Commit 9d08def9 authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Konrad Sztyber
Browse files

hello_sock: check if ctx->group is NULL



Fixed issue detected by Klocwork scan.
ctx->group must be checked for NULL before call to
spdk_sock_group_provide_buf(ctx->group, ...), otherwise
in this function we are dereferencing NULL pointer
in line:
	STAILQ_INSERT_HEAD(&group->pool, provided, link);

Change-Id: I10d1d35d1026f12f7fa02b24639f6036e0a798f2
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18244


Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 72e713d7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -450,6 +450,11 @@ hello_sock_listen(struct hello_context_t *ctx)
	 * Create sock group for server socket
	 */
	ctx->group = spdk_sock_group_create(NULL);
	if (ctx->group == NULL) {
		SPDK_ERRLOG("Cannot create sock group\n");
		spdk_sock_close(&ctx->sock);
		return -1;
	}

	/*
	 * Provide a buffer to the group to be used with receive.