nvmf: check the qpair->ctrlr

The ctrlr may be NULL, so we need to add a check here
to present segment fault.

Change-Id: I6c5361cc829af065082a95df0b8cc2f8d49a6002
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/436950 (master)
Reviewed-on: https://review.gerrithub.io/437916
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Ziye Yang 2018-12-13 01:39:44 +08:00 committed by Darek Stojaczyk
parent 2f1ac3644a
commit 86dbefdda6

View File

@ -1042,7 +1042,7 @@ _nvmf_subsystem_disconnect_next_qpair(void *ctx)
subsystem = qpair_ctx->subsystem;
TAILQ_FOREACH(qpair, &group->qpairs, link) {
if (qpair->ctrlr->subsys == subsystem) {
if ((qpair->ctrlr != NULL) && (qpair->ctrlr->subsys == subsystem)) {
break;
}
}
@ -1083,7 +1083,7 @@ spdk_nvmf_poll_group_remove_subsystem(struct spdk_nvmf_poll_group *group,
sgroup->state = SPDK_NVMF_SUBSYSTEM_INACTIVE;
TAILQ_FOREACH(qpair, &group->qpairs, link) {
if (qpair->ctrlr->subsys == subsystem) {
if ((qpair->ctrlr != NULL) && (qpair->ctrlr->subsys == subsystem)) {
break;
}
}