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. This fix is incomplete: we leak IRQ and MSI resources when this happens. That's preferable to a crash but still should be fixed.
This commit is contained in:
parent
da8147c3c5
commit
8e61280bd9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351411
@ -1211,12 +1211,14 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t 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
|
||||
|
Loading…
Reference in New Issue
Block a user