Skip to content

Commit 8a03b27

Browse files
hreineckeChristoph Hellwig
authored andcommitted
nvme-multipath: avoid crash on invalid subsystem cntlid enumeration
A process holding an open reference to a removed disk prevents it from completing deletion, so its name continues to exist. A subsequent gendisk creation may have the same cntlid which risks collision when using that for the name. Use the unique ctrl->instance instead. Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 8730c1d commit 8a03b27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/nvme/host/multipath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void nvme_set_disk_name(char *disk_name, struct nvme_ns *ns,
3131
sprintf(disk_name, "nvme%dn%d", ctrl->instance, ns->head->instance);
3232
} else if (ns->head->disk) {
3333
sprintf(disk_name, "nvme%dc%dn%d", ctrl->subsys->instance,
34-
ctrl->cntlid, ns->head->instance);
34+
ctrl->instance, ns->head->instance);
3535
*flags = GENHD_FL_HIDDEN;
3636
} else {
3737
sprintf(disk_name, "nvme%dn%d", ctrl->subsys->instance,

0 commit comments

Comments
 (0)