From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail78-36.sinamail.sina.com.cn (mail78-36.sinamail.sina.com.cn [219.142.78.36]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA0356FC3 for ; Sun, 19 Jan 2025 06:54:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=219.142.78.36 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737269682; cv=none; b=kGfAQiDsjnLzv/0KgUcN/ktjUyiKWWE4gUzn9rfv36AsumZfZ+pBN9K+6AamUMIM1QlN34ZtTFZdEoOsPFpq3S7znV8ZRCy3vSVmHYEObzFRe0c75t7z9jljtT/+I9b6PwZfyLj4z15m9Qs5NEXHU++IVxU9k8nUdn/gSCiCS8Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737269682; c=relaxed/simple; bh=qIXaSqtpI9regkitvOloATDCxeKKBSpxGYHa1BBxENs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gN5fPshas7vQbEsIwQLdl7Tmkr+XpojjHTZBVHqXvdC1Rj0Unpk9Pg7F+CRQ+YhCNbEtnVEoNUA4PdWi3OQwMk+/B0RXF3BZzaa30yG0ql8YWYVG14/5yFL8EIQjknmZDmwNaijtN8ePpskxLecvOtUANHoqPoN62s6jfP5sfO0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; arc=none smtp.client-ip=219.142.78.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([116.24.10.102]) by sina.com (10.185.250.24) with ESMTP id 678CA19C000012B9; Sun, 19 Jan 2025 14:54:22 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 55612210748366 X-SMAIL-UIID: 321656859C354A4FA3AE1B518E45AD0E-20250119-145422-1 From: Hillf Danton To: syzbot Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [wireless?] possible deadlock in ieee80211_remove_interfaces Date: Sun, 19 Jan 2025 14:54:09 +0800 Message-ID: <20250119065410.2116-1-hdanton@sina.com> In-Reply-To: <678aaa6d.050a0220.303755.0013.GAE@google.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, 17 Jan 2025 11:07:25 -0800 > syzbot has found a reproducer for the following issue on: > > HEAD commit: 8d20dcda404d selftests: drv-net-hw: inject pp_alloc_fail e.. > git tree: net-next > C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13ca3a18580000 #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 14:35:42.722041700 +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(); } 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); --