svn commit: r328677 - stable/11/sys/dev/nvme
Alexander Motin
mav at FreeBSD.org
Thu Feb 1 16:27:11 UTC 2018
Author: mav
Date: Thu Feb 1 16:27:10 2018
New Revision: 328677
URL: https://svnweb.freebsd.org/changeset/base/328677
Log:
MFC r314889 (by imp):
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.
Modified:
stable/11/sys/dev/nvme/nvme_ctrlr.c
stable/11/sys/dev/nvme/nvme_qpair.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:26:35 2018 (r328676)
+++ stable/11/sys/dev/nvme/nvme_ctrlr.c Thu Feb 1 16:27:10 2018 (r328677)
@@ -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 *ctrl
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);
}
Modified: stable/11/sys/dev/nvme/nvme_qpair.c
==============================================================================
--- stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 16:26:35 2018 (r328676)
+++ stable/11/sys/dev/nvme/nvme_qpair.c Thu Feb 1 16:27:10 2018 (r328677)
@@ -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)) {
More information about the svn-src-all
mailing list