[PATCH NET-PREV 26/51] 6lowpan: Use __register_netdevice in .newlink

From
Kirill Tkhai <hidden>
Date
2025-03-22 14:41:12
Also in
lkml
Reply to
Kirill Tkhai, 2025-03-22
The objective is to conform .newlink with its callers,
which already assign nd_lock (and matches master nd_lock
if there is one).

Signed-off-by: Kirill Tkhai <redacted>
---
 net/6lowpan/core.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/6lowpan/core.c b/net/6lowpan/core.c
index 850d4a185f55..b5cbf85b291c 100644
--- a/net/6lowpan/core.c
+++ b/net/6lowpan/core.c
@@ -39,7 +39,7 @@ int lowpan_register_netdevice(struct net_device *dev,
 
 	dev->ndisc_ops = &lowpan_ndisc_ops;
 
-	ret = register_netdevice(dev);
+	ret = __register_netdevice(dev);
 	if (ret < 0)
 		return ret;
 
@@ -52,10 +52,18 @@ EXPORT_SYMBOL(lowpan_register_netdevice);
 int lowpan_register_netdev(struct net_device *dev,
 			   enum lowpan_lltypes lltype)
 {
+	struct nd_lock *nd_lock;
 	int ret;
 
 	rtnl_lock();
+	if (!attach_new_nd_lock(dev))
+		goto out;
+	lock_netdev(dev, &nd_lock);
 	ret = lowpan_register_netdevice(dev, lltype);
+	if (ret)
+		detach_nd_lock(dev);
+	unlock_netdev(nd_lock);
+out:
 	rtnl_unlock();
 	return ret;
 }
Thread (54 messages) 54 messages, 3 authors, last reply 2025-03-25
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help