Commit b189e65e authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvmf/tcp: add stricter checking on trsvcid values



Don't allow 0 as a port number - this will just
end up using an ephemeral port number instead.

This fix also catches case where user specifies
'-0' as trsvcid.

Fixes issue #3170.
Fixes issue #3171.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I4b6d0cdeb988033786fbdbd0d0348b292a889985
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/20527


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 757d23d0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -763,8 +763,8 @@ nvmf_tcp_trsvcid_to_int(const char *trsvcid)
		return -1;
	}

	/* Valid TCP/IP port numbers are in [0, 65535] */
	if (ull > 65535) {
	/* Valid TCP/IP port numbers are in [1, 65535] */
	if (ull == 0 || ull > 65535) {
		return -1;
	}