lib/nvme: assign NULL to external_io_msgs ring after free

Multiple nmvme_io_msg producers on the ctrlr share the same ring.
After freeing it, it should be set to NULL. In order to prevent
either nvme_io_msg_ctrlr_detach() or spdk_nvme_io_msg_process()
from interacting on freed memory.

Above happened when resolving issues in later patches.
After their respective fixes, there is no scenario that
solely reproduces this failure so no tests were added in this
patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I72b695d995b63bd002cc03e60cd4bdc82cfbe8ae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1917
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-04-16 09:54:15 -04:00 committed by Jim Harris
parent f955c75ef4
commit 251a551aa3

View File

@ -155,6 +155,7 @@ nvme_io_msg_ctrlr_register(struct spdk_nvme_ctrlr *ctrlr,
if (ctrlr->external_io_msgs_qpair == NULL) {
SPDK_ERRLOG("spdk_nvme_ctrlr_alloc_io_qpair() failed\n");
spdk_ring_free(ctrlr->external_io_msgs);
ctrlr->external_io_msgs = NULL;
return -ENOMEM;
}
@ -176,6 +177,7 @@ nvme_io_msg_ctrlr_detach(struct spdk_nvme_ctrlr *ctrlr)
if (ctrlr->external_io_msgs) {
spdk_ring_free(ctrlr->external_io_msgs);
ctrlr->external_io_msgs = NULL;
}
if (ctrlr->external_io_msgs_qpair) {