Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-multipath: avoid crash on invalid subsystem cntlid enumeration
@ 2019-03-29  9:57 Hannes Reinecke
  2019-03-29 10:02 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Reinecke @ 2019-03-29  9:57 UTC (permalink / raw)


The controller ID is supposed to be unique for each subsystem;
however, if it _isn't_ we will crash when calling device_add_disk()
for the namespaces.
While this surely is an error on the subsystem side we really shouldn't
crash. So simply use the 'instance' number when generating the disk
name to avoid this issue.

Signed-off-by: Hannes Reinecke <hare at suse.com>
---
 drivers/nvme/host/multipath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index f0716f6ce41f..2551264ef2b5 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -31,7 +31,7 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
 		sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
 	} else if (ns->head->disk) {
 		sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
-				ctrl->cntlid, ns->head->instance);
+				ctrl->instance, ns->head->instance);
 		*flags = GENHD_FL_HIDDEN;
 	} else {
 		sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance,
-- 
2.16.4

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

end of thread, other threads:[~2019-04-03 18:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29  9:57 [PATCH] nvme-multipath: avoid crash on invalid subsystem cntlid enumeration Hannes Reinecke
2019-03-29 10:02 ` Christoph Hellwig
2019-03-29 10:23   ` Hannes Reinecke
2019-04-01  5:17     ` Keith Busch
2019-04-01 11:50       ` Hannes Reinecke
2019-04-02  8:55         ` Keith Busch
2019-04-03 18:09           ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox