Avoid dereferencing unintialized elements in the error path.
Some drives sometimes have errors for things like setting the number of queue entries in the submission queue. The error paths taken for these drives ensure a panic dereferencing uninialized data. Sponsored by: Netflix
This commit is contained in:
parent
05ee702af6
commit
824073fbd6
@ -193,8 +193,10 @@ nvme_ctrlr_fail(struct nvme_controller *ctrlr)
|
||||
|
||||
ctrlr->is_failed = TRUE;
|
||||
nvme_qpair_fail(&ctrlr->adminq);
|
||||
for (i = 0; i < ctrlr->num_io_queues; i++)
|
||||
nvme_qpair_fail(&ctrlr->ioq[i]);
|
||||
if (ctrlr->ioq != NULL) {
|
||||
for (i = 0; i < ctrlr->num_io_queues; i++)
|
||||
nvme_qpair_fail(&ctrlr->ioq[i]);
|
||||
}
|
||||
nvme_notify_fail_consumers(ctrlr);
|
||||
}
|
||||
|
||||
@ -397,7 +399,7 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrlr)
|
||||
while (status.done == FALSE)
|
||||
pause("nvme", 1);
|
||||
if (nvme_completion_is_error(&status.cpl)) {
|
||||
nvme_printf(ctrlr, "nvme_set_num_queues failed!\n");
|
||||
nvme_printf(ctrlr, "nvme_ctrlr_set_num_qpairs failed!\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
|
@ -1000,6 +1000,9 @@ nvme_qpair_fail(struct nvme_qpair *qpair)
|
||||
struct nvme_tracker *tr;
|
||||
struct nvme_request *req;
|
||||
|
||||
if (!mtx_initialized(&qpair->lock))
|
||||
return;
|
||||
|
||||
mtx_lock(&qpair->lock);
|
||||
|
||||
while (!STAILQ_EMPTY(&qpair->queued_req)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user