From: hare@suse.de (Hannes Reinecke)
Subject: [PATCH] nvme-multipath: avoid crash on invalid subsystem cntlid enumeration
Date: Fri, 29 Mar 2019 10:57:54 +0100 [thread overview]
Message-ID: <20190329095754.109653-1-hare@suse.de> (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
next reply other threads:[~2019-03-29 9:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 9:57 Hannes Reinecke [this message]
2019-03-29 10:02 ` [PATCH] nvme-multipath: avoid crash on invalid subsystem cntlid enumeration 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190329095754.109653-1-hare@suse.de \
--to=hare@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox