svn commit: r351907 - stable/12/sys/dev/nvme
Warner Losh
imp at FreeBSD.org
Thu Sep 5 23:07:58 UTC 2019
Author: imp
Date: Thu Sep 5 23:07:57 2019
New Revision: 351907
URL: https://svnweb.freebsd.org/changeset/base/351907
Log:
MFC r351411:
When we have errors resetting the device before we allocate the queues, don't
try to tear them down in the ctrlr_destroy path. Otherwise, we dereference
queue structures that are NULL and we trap.
Modified:
stable/12/sys/dev/nvme/nvme_ctrlr.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Sep 5 23:04:37 2019 (r351906)
+++ stable/12/sys/dev/nvme/nvme_ctrlr.c Thu Sep 5 23:07:57 2019 (r351907)
@@ -1211,12 +1211,14 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, dev
if (ctrlr->cdev)
destroy_dev(ctrlr->cdev);
- if (!gone)
- nvme_ctrlr_destroy_qpairs(ctrlr);
- for (i = 0; i < ctrlr->num_io_queues; i++)
- nvme_io_qpair_destroy(&ctrlr->ioq[i]);
- free(ctrlr->ioq, M_NVME);
- nvme_admin_qpair_destroy(&ctrlr->adminq);
+ if (ctrlr->is_initialized) {
+ if (!gone)
+ nvme_ctrlr_destroy_qpairs(ctrlr);
+ for (i = 0; i < ctrlr->num_io_queues; i++)
+ nvme_io_qpair_destroy(&ctrlr->ioq[i]);
+ free(ctrlr->ioq, M_NVME);
+ nvme_admin_qpair_destroy(&ctrlr->adminq);
+ }
/*
* Notify the controller of a shutdown, even though this is due to
More information about the svn-src-all
mailing list