]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme-multipath: put module reference when delayed removal work is canceled
authorJohn Garry <john.g.garry@oracle.com>
Wed, 15 Apr 2026 15:53:58 +0000 (15:53 +0000)
committerKeith Busch <kbusch@kernel.org>
Thu, 16 Apr 2026 22:08:38 +0000 (15:08 -0700)
The delayed disk removal work is canceled when a NS (re)appears. However,
we do not put the module reference grabbed in nvme_mpath_remove_disk(), so
fix that.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Nilay Shroff <nilay@linux.ibm.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c

index 0d623476e36f87c59212e157493b3ef53c70d027..fead3b7cd4beafe46d083bf099dcc7f83f1e9640 100644 (file)
@@ -4083,7 +4083,8 @@ static int nvme_init_ns_head(struct nvme_ns *ns, struct nvme_ns_info *info)
        mutex_unlock(&ctrl->subsys->lock);
 
 #ifdef CONFIG_NVME_MULTIPATH
-       cancel_delayed_work(&head->remove_work);
+       if (cancel_delayed_work(&head->remove_work))
+               module_put(THIS_MODULE);
 #endif
        return 0;