lib/iscsi: Add a assert for conn->sock

In some cases, conn->sock will be lost, while conn pointer will still be.
A runtime error will apperars: null pointer of type 'struct spdk_sock'.
This only happens when ./configure with asan.
So I add a sssert to display this error explicitly when it occurs.

Change-Id: I7d012ac1a29a7fb0bce4815e0622582f23222a25
Signed-off-by: WANGHAILIANG <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1102
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
WANGHAILIANG 2020-03-03 15:04:54 +08:00 committed by Tomasz Zawadzki
parent c49a710157
commit bdbe33e663

View File

@ -188,6 +188,7 @@ iscsi_poll_group_remove_conn(struct spdk_iscsi_poll_group *pg, struct spdk_iscsi
{
int rc;
assert(conn->sock != NULL);
rc = spdk_sock_group_remove_sock(pg->sock_group, conn->sock);
if (rc < 0) {
SPDK_ERRLOG("Failed to remove sock=%p of conn=%p\n", conn->sock, conn);