bdev/nvme: Fix NULL pointer access by DTRACE when creating qpair

bdev_nvme_qpair() should use qpair instead of ctrlr_ch->qpair for DTRACE.
Otherwise, we get segmentation fault when enabling DTRACE.

Fixes issue #2440

The master branch fixed this bug in the commit d7f0a18 but it was in a
large patch series. So extract only the fix and apply it to the 22.01.x
branch. The 21.10.x branch also has this bug but 22.01.x is a long term
support release that will be supported for 1 year.

Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reported-by: Or Gerlitz <ogerlitz@nvidia.com>
Change-Id: I458ad62c410af6ce7c228857fa9de28b2cea6282
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12086
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
This commit is contained in:
Shuhei Matsumoto 2022-03-30 06:23:13 +09:00 committed by Keith Lucas
parent 9407960927
commit 8c4c66ca04

View File

@ -1228,7 +1228,7 @@ bdev_nvme_create_qpair(struct nvme_ctrlr_channel *ctrlr_ch)
}
SPDK_DTRACE_PROBE3(bdev_nvme_create_qpair, nvme_ctrlr->nbdev_ctrlr->name,
spdk_nvme_qpair_get_id(ctrlr_ch->qpair), spdk_thread_get_id(nvme_ctrlr->thread));
spdk_nvme_qpair_get_id(qpair), spdk_thread_get_id(nvme_ctrlr->thread));
assert(ctrlr_ch->group != NULL);