diff options
| author | Kyle Smith <kyles@hpe.com> | 2026-11-05 21:54:38 +0000 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-11-06 07:48:48 -0800 |
| commit | 1e1d36e7610fc2c2c425ea246caf8ea0380d5fd6 (patch) | |
| tree | 6d81e8314510068bf98a303c0d02502db0166832 /tools/perf/scripts/python | |
| parent | 4a5aeebf1a00360bcc53c9e29fcd8d47aefa4c1d (diff) | |
nvme: Fix potential gendisk leak in nvme_alloc_ns
Multiple BUGs were seen after the following sequence:
1) ctrl A in subsys A allocs ns nvmeAcAn1 and ns_head nvmeAn1 and sets
both as live
2) ctrl B in subsys A allocs ns nvmeAcBn1 under ns_head nvmeAn1, but is
interrupted or stalled between nvme_init_ns_head and healthy return
3) the namespace is removed from subsystem, triggering rescan
4) nvmeAcAn1 completes nvme_ns_remove
5) nvmeAcBn1 allocation returns through an error pathway in nvme_alloc_ns
In this sequence, when nvmeAcBn1 returns, it is the last path and has the
responsibility of shutting down the live ns_head, but does not call
nvme_mpath_shutdown_disk. Failure to call nvme_mpath_shutdown_disk leaves
the gendisk active in sysfs/devfs while components around it are freed.
The result is that a new nvme_ns_head with the same namespace number
cannot be created in sysfs and freed memory can be accessed through
remaining userspace files. Most observed panics were seen from paths
utilizing nvme_find_path, such as nuse_show or blkdev_ioctl, though
occasionally corruption of the dpm list was detected as well.
Fix here is to simply keep ns_head cleanup the same as nvme_ns_remove.
This ensures we don't break delayed removal and that we clean up the
gendisk when appropriate.
Signed-off-by: Kyle Smith <kyles@hpe.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
