From: sashiko-bot@kernel.org
To: "Hannes Reinecke" <hare@kernel.org>
Cc: linux-nvme@lists.infradead.org
Subject: Re: [PATCH] nvme-rdma: use current network namespace
Date: Wed, 25 Nov 2026 14:25:58 +0000 [thread overview]
Message-ID: <sashiko-outbox-233553@kernel.org> (raw)
In-Reply-To: <20261125141737.2383-1-hare@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] nvme-rdma: netns reference leak in nvme_rdma_free_ctrl()
--
commit ea2302951454868193e26cecb0bf291eea317e73
Author: Hannes Reinecke <hare@kernel.org>
nvme-rdma: use current network namespace
This commit records the caller's network namespace in struct nvme_rdma_ctrl
and passes it to inet_pton_with_scope() and rdma_create_id() instead of
init_net.
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 32189fdfc0f51..76b4cba80b369 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
[ ... ]
> @@ -2288,6 +2289,8 @@ static struct nvme_rdma_ctrl *nvme_rdma_alloc_ctrl(struct device *dev,
> if (!ctrl)
> return ERR_PTR(-ENOMEM);
> ctrl->ctrl.opts = opts;
> + ctrl->net = get_net(current->nsproxy->net_ns);
> +
> /*
> * Safe to init list while allocating ctrl object.
> */
[ ... ]
> @@ -2354,6 +2357,7 @@ static struct nvme_rdma_ctrl *nvme_rdma_alloc_ctrl(struct device *dev,
> out_kfree_queues:
> kfree(ctrl->queues);
> out_free_ctrl:
> + put_net(ctrl->net);
> kfree(ctrl);
> return ERR_PTR(ret);
> }
[Severity: High]
Does this leak ctrl->net when a controller is freed after
nvme_rdma_alloc_ctrl() succeeds? Once nvme_init_ctrl() succeeds,
controller teardown goes through nvme_put_ctrl() -> nvme_rdma_free_ctrl(),
which frees ctrl without calling put_net(ctrl->net), preventing the
network namespace from ever being destroyed.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125141737.2383-1-hare@kernel.org?part=1
prev parent reply other threads:[~2026-11-25 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 14:17 [PATCH] nvme-rdma: use current network namespace Hannes Reinecke
2026-11-25 14:25 ` sashiko-bot [this message]
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=sashiko-outbox-233553@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hare@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.