From: sashiko-bot@kernel.org
To: "Jiri Pirko" <jiri@resnulli.us>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org, mkoutny@suse.com,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
tj@kernel.org, "Heiko Carstens" <hca@linux.ibm.com>,
hannes@cmpxchg.org
Subject: Re: [PATCH rdma-next 02/13] RDMA/core: Handle device name conflicts when changing net namespace
Date: Fri, 10 Jul 2026 09:56:27 +0000 [thread overview]
Message-ID: <20260710095627.CDAD21F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260709095532.855647-3-jiri@resnulli.us>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] User-triggerable WARN() during concurrent RDMA device unregistration and netns exit, leading to DoS on panic_on_warn systems.
--
--- Patch [2]: [PATCH rdma-next 02/13] RDMA/core: Handle device name conflicts when changing net namespace ---
commit 05c3f87e2143d43f2f1e27d0f13e1b1f97f35bab
Author: Jiri Pirko <jiri@nvidia.com>
RDMA/core: Handle device name conflicts when changing net namespace
This commit prepares namespace moves for per-netns names by checking
user-initiated moves for destination-name conflicts before disabling the
device. It also ensures teardown moves detach from the exiting namespace
even if fallback naming fails.
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -1160,8 +1168,17 @@ static void rdma_dev_exit_net(struct net *net)
>
> /*
> * If the real device is in the NS then move it back to init.
> + * Provide a fallback pattern so a name conflict in init_net
> + * cannot make the teardown move fail.
> */
> - rdma_dev_change_netns(dev, net, &init_net);
> + if (net_eq(net, read_pnet(&dev->coredev.rdma_net))) {
> + ret = rdma_dev_change_netns(dev, net, &init_net,
> + "ibdev%d");
> + if (ret)
> + WARN(1,
> + "Failed to move RDMA device %s to init_net on netns exit: %d\n",
> + dev_name(&dev->dev), ret);
[Severity: High]
Can this WARN(1) be triggered by a concurrent device unregistration?
Looking at rdma_dev_change_netns(), if a device is concurrently unregistered,
the refcount drops to 0 and the function legitimately returns -ENODEV:
drivers/infiniband/core/device.c:rdma_dev_change_netns() {
...
if (refcount_read(&device->refcount) == 0 ||
!net_eq(cur_net, read_pnet(&device->coredev.rdma_net))) {
ret = -ENODEV;
goto out;
}
...
}
If rdma_dev_exit_net() runs concurrently with device unregistration (e.g.,
module unload, PCI hotplug, or link deletion of a software RDMA device like
RXE), rdma_dev_change_netns() will return -ENODEV and trigger this warning.
Because an unprivileged user can acquire CAP_NET_ADMIN in a user namespace,
create an RXE device, and race netns deletion with device deletion, could
this be used to intentionally crash a host configured with panic_on_warn=1?
> + }
>
> put_device(&dev->dev);
> down_read(&devices_rwsem);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709095532.855647-1-jiri@resnulli.us?part=2
next prev parent reply other threads:[~2026-07-10 9:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 9:55 [PATCH rdma-next 00/13] RDMA: Make device names unique per net namespace Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 01/13] RDMA/core: Pass the net namespace to the device name lookups Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 02/13] RDMA/core: Handle device name conflicts when changing net namespace Jiri Pirko
2026-07-10 9:56 ` sashiko-bot [this message]
2026-07-09 9:55 ` [PATCH rdma-next 03/13] RDMA/core: Support renaming a device when changing its " Jiri Pirko
2026-07-10 9:56 ` sashiko-bot
2026-07-09 9:55 ` [PATCH rdma-next 04/13] RDMA/nldev: Report net namespace move errors through extack Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 05/13] RDMA/nldev: Allow setting the device name while changing net namespace Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 06/13] net/smc: Look up the pnetid ib device within the " Jiri Pirko
2026-07-10 9:56 ` sashiko-bot
2026-07-09 9:55 ` [PATCH rdma-next 07/13] RDMA/srp: Make the SRP sysfs class net namespace aware Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 08/13] RDMA/cgroup: Scope rdma cgroup device visibility to the net namespace Jiri Pirko
2026-07-09 13:04 ` Michal Koutný
2026-07-10 9:56 ` sashiko-bot
2026-07-09 9:55 ` [PATCH rdma-next 09/13] RDMA/cma: Document that CM configfs cannot be net namespace scoped Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 10/13] RDMA/core: Document the SELinux ibendport net namespace limitation Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 11/13] RDMA/core: Make device names unique per net namespace Jiri Pirko
2026-07-09 9:55 ` [PATCH rdma-next 12/13] RDMA/rxe: Implement disassociate_ucontext callback Jiri Pirko
2026-07-10 4:21 ` Zhu Yanjun
2026-07-10 9:56 ` sashiko-bot
2026-07-09 9:55 ` [PATCH rdma-next 13/13] RDMA/selftests: Add rxe_netns_names test Jiri Pirko
2026-07-10 4:24 ` Zhu Yanjun
2026-07-10 9:56 ` sashiko-bot
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=20260710095627.CDAD21F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hannes@cmpxchg.org \
--cc=hca@linux.ibm.com \
--cc=jiri@resnulli.us \
--cc=linux-s390@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tj@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox