All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+85ff1051228a04613a32@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [bluetooth?] [wireless?] WARNING in free_netdev (2)
Date: Sun, 19 Jan 2025 15:48:07 +0800	[thread overview]
Message-ID: <20250119074808.2137-1-hdanton@sina.com> (raw)
In-Reply-To: <678add43.050a0220.303755.0016.GAE@google.com>

On Fri, 17 Jan 2025 14:44:19 -0800
> syzbot found the following issue on:
> 
> HEAD commit:    8d20dcda404d selftests: drv-net-hw: inject pp_alloc_fail e..
> git tree:       net-next
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13ffc2b0580000

#syz test

diff -pur p/include/linux/netdevice.h q/include/linux/netdevice.h
--- p/include/linux/netdevice.h	2025-01-19 14:23:21.962713400 +0800
+++ q/include/linux/netdevice.h	2025-01-19 14:44:32.303599900 +0800
@@ -2047,6 +2047,7 @@ enum netdev_reg_state {
  *	FIXME: cleanup struct net_device such that network protocol info
  *	moves out.
  */
+extern unsigned long extra_netdev_locks;
 
 struct net_device {
 	/* Cacheline organization can be found documented in
diff -pur p/net/core/dev.c q/net/core/dev.c
--- p/net/core/dev.c	2025-01-19 14:26:04.863348200 +0800
+++ q/net/core/dev.c	2025-01-19 15:43:55.326734000 +0800
@@ -10269,14 +10269,19 @@ static bool from_cleanup_net(void)
 #endif
 }
 
+unsigned long extra_netdev_locks = 0;
 static void rtnl_drop_if_cleanup_net(void)
 {
+	if (extra_netdev_locks)
+		return;
 	if (from_cleanup_net())
 		__rtnl_unlock();
 }
 
 static void rtnl_acquire_if_cleanup_net(void)
 {
+	if (extra_netdev_locks)
+		return;
 	if (from_cleanup_net())
 		rtnl_lock();
 }
@@ -11606,8 +11611,6 @@ void free_netdev(struct net_device *dev)
 		return;
 	}
 
-	mutex_destroy(&dev->lock);
-
 	kfree(dev->ethtool);
 	netif_free_tx_queues(dev);
 	netif_free_rx_queues(dev);
diff -pur p/net/wireless/core.c q/net/wireless/core.c
--- p/net/wireless/core.c	2025-01-19 14:29:30.497265000 +0800
+++ q/net/wireless/core.c	2025-01-19 14:40:07.687903000 +0800
@@ -1247,8 +1247,11 @@ static void _cfg80211_unregister_wdev(st
 
 	if (wdev->netdev) {
 		sysfs_remove_link(&wdev->netdev->dev.kobj, "phy80211");
-		if (unregister_netdev)
+		if (unregister_netdev) {
+			extra_netdev_locks++;
 			unregister_netdevice(wdev->netdev);
+			extra_netdev_locks--;
+		}
 	}
 
 	list_del_rcu(&wdev->list);
--

  parent reply	other threads:[~2025-01-19  7:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-17 22:44 [syzbot] [bluetooth?] [wireless?] WARNING in free_netdev (2) syzbot
2025-01-18 10:54 ` Hillf Danton
2025-01-18 11:35   ` syzbot
2025-01-19  7:48 ` Hillf Danton [this message]
2025-01-19  7:50   ` syzbot

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=20250119074808.2137-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+85ff1051228a04613a32@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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.