Commit e1602892 authored by Jiewei Ke's avatar Jiewei Ke Committed by Tomasz Zawadzki
Browse files

nvmf: fix nullptr reference in retry_connect



When nvmf_ctrlr_cmd_connect finds subsystem is not active, it will start
a poller to run retry_connect. But the subsystem may be deleted during
the retry interval, and retry_connect should not access the sgroup in
this case.

Fixes issue #3100.

Change-Id: I7b36511a9461debe67b813d21f8a2de1a879730f
Signed-off-by: default avatarJiewei Ke <jiewei@smartx.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/19434


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
parent 423f72da
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -909,8 +909,10 @@ retry_connect(void *arg)
	int rc;

	sgroup = nvmf_subsystem_pg_from_connect_cmd(req);
	assert(sgroup != NULL);
	/* subsystem may be deleted during the retry interval, so we need to check sgroup */
	if (sgroup != NULL) {
		sgroup->mgmt_io_outstanding++;
	}
	spdk_poller_unregister(&req->poller);
	rc = nvmf_ctrlr_cmd_connect(req);
	if (rc == SPDK_NVMF_REQUEST_EXEC_STATUS_COMPLETE) {