From: Leon Romanovsky <leon@kernel.org>
To: Jiale Yao <yaojiale02@163.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Parav Pandit <parav@mellanox.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] RDMA/core: skip compat cleanup for init_net
Date: Tue, 3 Nov 2026 13:53:36 +0200 [thread overview]
Message-ID: <20261103115336.GD264423@unreal> (raw)
In-Reply-To: <20261028050245.125370-1-yaojiale02@163.com>
On Wed, Oct 28, 2026 at 01:02:44PM +0800, Jiale Yao wrote:
> rdma_dev_init_net() does not allocate an rdma_nets XArray entry or
> create compatibility devices for init_net. rdma_dev_exit_net() still
> runs the common cleanup, using the zero-initialized rnet->id to hide and
> erase an entry and removing compatibility devices with that ID. ID zero
> may belong to a non-default network namespace.
No, it can't
Thanks
>
> Handle init_net separately on exit, mirroring the initialization path.
> Only tear down its netlink state and leave the XArray and compatibility
> devices untouched.
>
> Fixes: 1d2fedd8561d ("RDMA/core: Support netlink commands in non init_net net namespaces")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiale Yao <yaojiale02@163.com>
> ---
> drivers/infiniband/core/device.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 29af9fe860e2..74460850ccba 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -1153,6 +1153,11 @@ static void rdma_dev_exit_net(struct net *net)
> unsigned long index;
> int ret;
>
> + if (net_eq(net, &init_net)) {
> + rdma_nl_net_exit(rnet);
> + return;
> + }
> +
> down_write(&rdma_nets_rwsem);
> /*
> * Prevent the ID from being re-used and hide the id from xa_for_each.
> --
> 2.34.1
>
prev parent reply other threads:[~2026-11-03 11:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 5:02 [PATCH] RDMA/core: skip compat cleanup for init_net Jiale Yao
2026-10-28 5:07 ` sashiko-bot
2026-11-03 11:53 ` Leon Romanovsky [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=20261103115336.GD264423@unreal \
--to=leon@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=stable@vger.kernel.org \
--cc=yaojiale02@163.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.