From: Keith Busch <kbusch@kernel.org>
To: John Garry <john.g.garry@oracle.com>
Cc: Keith Busch <kbusch@meta.com>,
linux-nvme@lists.infradead.org, hch@lst.de, nilay@linux.ibm.com
Subject: Re: [PATCH 1/2] nvme-multipath: fix leak on try_module_get failure
Date: Wed, 15 Apr 2026 08:23:36 -0600 [thread overview]
Message-ID: <ad-faFB43WBycLSk@kbusch-mbp> (raw)
In-Reply-To: <8c068126-0b30-4d46-a07c-a4f975b7fa53@oracle.com>
On Wed, Apr 15, 2026 at 10:26:00AM +0100, John Garry wrote:
> Are we also missing the module_put() for when we cancel the timer? AFAICS,
> we only put the module for after the disk is removed.
Yes, I believe you are correct.
> Maybe we need something like this:
>
> Subject: [PATCH] nvme-multipath: put module reference when delayed removal
> timer is canceled
>
> The delayed removal timer is canceled when a NS appears. However, we do not
> put the module reference grabbed in nvme_mpath_remove_disk(), so fix that.
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 1e33af94c24b..1b445830358e 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -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_sync(&head->remove_work))
> + module_put(THIS_MODULE);
> #endif
I don't think we need the _sync() variant here, but the check and
module_put() look good.
next prev parent reply other threads:[~2026-04-15 14:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 20:21 [PATCH 1/2] nvme-multipath: fix leak on try_module_get failure Keith Busch
2026-02-25 20:21 ` [PATCH 2/2] nvme: fix unmatched id's under delayed path deletion Keith Busch
2026-02-25 20:34 ` Keith Busch
2026-02-26 7:04 ` Nilay Shroff
2026-02-26 15:37 ` Christoph Hellwig
2026-02-26 16:51 ` Keith Busch
2026-02-26 18:31 ` Nilay Shroff
2026-02-26 18:35 ` Keith Busch
2026-02-27 13:53 ` Christoph Hellwig
2026-02-26 6:35 ` [PATCH 1/2] nvme-multipath: fix leak on try_module_get failure Nilay Shroff
2026-02-26 8:31 ` John Garry
2026-02-26 15:35 ` Christoph Hellwig
2026-04-15 9:26 ` John Garry
2026-04-15 14:23 ` Keith Busch [this message]
2026-04-15 15:13 ` John Garry
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=ad-faFB43WBycLSk@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=hch@lst.de \
--cc=john.g.garry@oracle.com \
--cc=kbusch@meta.com \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.