Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH] RDMA/core: skip compat cleanup for init_net
@ 2026-10-28  5:02 Jiale Yao
  2026-10-28  5:07 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-28  5:02 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky, Parav Pandit, linux-rdma,
	linux-kernel
  Cc: stable

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.

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-28  5:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28  5:02 [PATCH] RDMA/core: skip compat cleanup for init_net Jiale Yao
2026-10-28  5:07 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox