Skip to contentSkip to conversation

nvme: fixup crash on failed discovery

PATCH New Hannes Reinecke 3 participants 4 messages Aug 7, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: fixup crash on failed discovery

When the initial discovery fails the subsystem hasn't been setup, and we'll encounter a kernel oops during shutdown.

Signed-off-by Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/multipath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/multipath.c +1 -1
index 420efcda33d9..c1f41aa879c1 100644
@@ -24,7 +24,7 @@ MODULE_PARM_DESC(multipath,
 
 inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl)
 {
-	return multipath && (ctrl->subsys->cmic & (1 << 3));
+	return multipath && ctrl->subsys && (ctrl->subsys->cmic & (1 << 3));
 }
 
 /*
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/1 nvme: fixup crash on failed discovery

Quoted 2 lines · Hannes Reinecke

When the initial discovery fails the subsystem hasn't been setup, and we'll encounter a kernel oops during shutdown.

This looks ok, but I'm curious where we even call nvme_ctrl_use_ana if we fail early.

#2 lore raw

PATCH 1/1 nvme: fixup crash on failed discovery

Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke

When the initial discovery fails the subsystem hasn't been setup, and we'll encounter a kernel oops during shutdown.

This looks ok, but I'm curious where we even call nvme_ctrl_use_ana if we fail early.

This is called via nvme_sysfs_delete()->nvme_ctrl_delete()->nvme_stop_ctrl()->nvme_mpath_stop() called from 'nvme discover' on a failing controller.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
hare at suse.com			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: F. Imend?rffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG N?rnberg)
#3 lore raw

PATCH 1/1 nvme: fixup crash on failed discovery

Quoted 11 lines · Hannes Reinecke
Quoted 7 lines · Christoph Hellwig
Quoted 2 lines · Hannes Reinecke

When the initial discovery fails the subsystem hasn't been setup, and we'll encounter a kernel oops during shutdown.

This looks ok, but I'm curious where we even call nvme_ctrl_use_ana if we fail early.

This is called via nvme_sysfs_delete()->nvme_ctrl_delete()->nvme_stop_ctrl()->nvme_mpath_stop() called from 'nvme discover' on a failing controller.

Thanks. Applied with a slightly updated changelog.