All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme: don't ignore tagset allocation failures
@ 2017-03-29  9:03 Max Gurtovoy
  2017-03-29 17:19 ` Sagi Grimberg
  0 siblings, 1 reply; 8+ messages in thread
From: Max Gurtovoy @ 2017-03-29  9:03 UTC (permalink / raw)


the nvme_dev_add() function silently ignores failures.
In case blk_mq_alloc_tag_set fails, we hit NULL deref while
calling blk_mq_init_queue during nvme_alloc_ns with tagset == NULL.
Instead, we'll not issue the scan_work in case tagset allocation
failed and leave the ctrl functional.

Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
Reviewed-by: Keith Busch <keith.busch at intel.com>
---
 drivers/nvme/host/core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 9b3b57f..493722a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2115,9 +2115,9 @@ void nvme_queue_scan(struct nvme_ctrl *ctrl)
 {
 	/*
 	 * Do not queue new scan work when a controller is reset during
-	 * removal.
+	 * removal or if the tagset doesn't exist.
 	 */
-	if (ctrl->state == NVME_CTRL_LIVE)
+	if (ctrl->state == NVME_CTRL_LIVE && ctrl->tagset)
 		schedule_work(&ctrl->scan_work);
 }
 EXPORT_SYMBOL_GPL(nvme_queue_scan);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-03-30 13:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29  9:03 [PATCH 1/1] nvme: don't ignore tagset allocation failures Max Gurtovoy
2017-03-29 17:19 ` Sagi Grimberg
2017-03-29 17:32   ` Keith Busch
2017-03-29 17:42     ` Sagi Grimberg
2017-03-29 23:10       ` Keith Busch
2017-03-30  5:47         ` Sagi Grimberg
2017-03-30  7:13           ` Max Gurtovoy
2017-03-30 13:05             ` Sagi Grimberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.