diff options
| author | Max Gurtovoy <mgurtovoy@nvidia.com> | 2025-09-24 23:35:44 +0300 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2025-12-01 08:53:17 -0800 |
| commit | 7fce856f1180c2db3c9f5a88b04bb7124a20cb21 (patch) | |
| tree | 55f5622e157bb4b3bdebc82fac4365d1de13aa93 /drivers | |
| parent | d211a2803551c8ffdf0b97d129388f7d9cc129b5 (diff) | |
nvmet: add sanity checks when freeing subsystem
Add WARN_ON_ONCE checks in nvmet_subsys_free() to ensure that the
ctrls and hosts lists are all empty during subsystem release. This helps
catch resource leaks.
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/nvme/target/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 5d7d483bfbe3..9de429a3f0d8 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1903,6 +1903,8 @@ static void nvmet_subsys_free(struct kref *ref) struct nvmet_subsys *subsys = container_of(ref, struct nvmet_subsys, ref); + WARN_ON_ONCE(!list_empty(&subsys->ctrls)); + WARN_ON_ONCE(!list_empty(&subsys->hosts)); WARN_ON_ONCE(!xa_empty(&subsys->namespaces)); nvmet_debugfs_subsys_free(subsys); |
