[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <174265463731.356712.9731171337027251381.stgit@pro.pro>
Date: Sat, 22 Mar 2025 17:43:57 +0300
From: Kirill Tkhai <tkhai@...ru>
To: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: tkhai@...ru
Subject: [PATCH NET-PREV 49/51] ieee802154: Call dev_change_net_namespace() under nd_lock
We want to provide "nd_lock is locked" context during
NETDEV_REGISTER (and later for NETDEV_UNREGISTER)
events. When calling from __register_netdevice(),
notifiers are already in that context, and we do the
same for dev_change_net_namespace() here.
Signed-off-by: Kirill Tkhai <tkhai@...ru>
---
net/ieee802154/core.c | 2 ++
net/ieee802154/nl802154.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index 60e8fff1347e..8a85a57bf042 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -349,10 +349,12 @@ static void __net_exit cfg802154_pernet_exit(struct net *net)
struct cfg802154_registered_device *rdev;
rtnl_lock();
+ mutex_lock(&fallback_nd_lock.mutex);
list_for_each_entry(rdev, &cfg802154_rdev_list, list) {
if (net_eq(wpan_phy_net(&rdev->wpan_phy), net))
WARN_ON(cfg802154_switch_netns(rdev, &init_net));
}
+ mutex_unlock(&fallback_nd_lock.mutex);
rtnl_unlock();
}
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
index a512f2a647e8..e8f21de679b7 100644
--- a/net/ieee802154/nl802154.c
+++ b/net/ieee802154/nl802154.c
@@ -2855,6 +2855,7 @@ static const struct genl_ops nl802154_ops[] = {
.doit = nl802154_wpan_phy_netns,
.flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
+ NL802154_FLAG_NEED_FALLBACK_ND_LOCK |
NL802154_FLAG_NEED_RTNL,
},
{
Powered by blists - more mailing lists