From patchwork Tue Mar 25 14:17:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Abramov X-Patchwork-Id: 14029092 X-Patchwork-Delegate: kuba@kernel.org Received: from ksmg01.maxima.ru (ksmg01.mt-integration.ru [81.200.124.38]) (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 131EF259C8E; Tue, 25 Mar 2025 14:25:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.200.124.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912704; cv=none; b=BHjCisg/XcAt1dPlGiSmBjz7Eje6qHGEenj5NckiEMPr7zD5FPv3uVw/uQyGdpYwRM/CoC14k4mWu14ilsxFeqIZufxOqhMfjILBhIsFyjkyaxgrlabOI4oMCXt+7zIcGeICFCTV+UmLEfPcmyD87vQkortBtmYC+LVOgjSjzPs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912704; c=relaxed/simple; bh=fOt02q7aI4iR1SBSf8MwhkVxvKQIQh/ojaCpWHTGtHU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tHq5MEQxddTIyZcGn1t1prXj3ZtpxBxg6MT34DtFEzY1u+FyYLZfxEfTY0dQVNlgeMAH+asqlMSrRfWLteqvCQgrBLjgbHGty0wDiVPC4p9FL4AOBiJqQXWXDhBXOlHwn96+aJ5+Gd7Xx8HpqmM/9+BXNNnPFWVIvu3nM865kqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru; spf=pass smtp.mailfrom=mt-integration.ru; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b=AVXQEc8C; arc=none smtp.client-ip=81.200.124.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b="AVXQEc8C" Received: from ksmg01.maxima.ru (localhost [127.0.0.1]) by ksmg01.maxima.ru (Postfix) with ESMTP id 65CB4C0018; Tue, 25 Mar 2025 17:18:39 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 ksmg01.maxima.ru 65CB4C0018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt-integration.ru; s=sl; t=1742912319; bh=fKTbCdR8RoY0Azgc4ltS0nUJfMNiLiqqosTYdtUpw/4=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=AVXQEc8CHwNpWH+GqnRD73k5nQ+LyWqC2z6fSUzzkRHA6imMUz/KbE/Usm3mXSOwl s8Bd8tQwLtJzhWLclDKTFv9SCMZV7T7IUU8XApuUZCJbZ+eFbzGqKvfGBgB30J+HX+ RlccVe6rfFQKpvk72Nu9oRCxN5yGeajtmOPruWg0K46ggoENqzSorCJUenqicAy+Eu FslIwH2pnM9Xl3MBFwrS0r3FnnXOVql2LcfxiU0vbQ4uA0uVO9GECwsgyV/5tZ1SW5 FcJi0cuD9cRGyKLJ5Hi5M0ByRbUxWwBb7ucExZaYa59Nm+SCIsM+1prURhmPQIqdVd 3makicSeJdc2Q== Received: from ksmg01.maxima.ru (mail.maxima.ru [81.200.124.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.maxima.ru", Issuer "GlobalSign GCC R3 DV TLS CA 2020" (verified OK)) by ksmg01.maxima.ru (Postfix) with ESMTPS; Tue, 25 Mar 2025 17:18:39 +0300 (MSK) Received: from db126-1-abramov-14-d-mosos.mti-lab.com (172.25.20.118) by mmail-p-exch01.mt.ru (81.200.124.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Mar 2025 17:18:37 +0300 From: Ivan Abramov To: "David S. Miller" CC: Ivan Abramov , Jakub Kicinski , , , Subject: [PATCH net 1/4] ieee802154: Restore initial state on failed device_rename() in cfg802154_switch_netns() Date: Tue, 25 Mar 2025 17:17:20 +0300 Message-ID: <20250325141723.499850-2-i.abramov@mt-integration.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250325141723.499850-1-i.abramov@mt-integration.ru> References: <20250325141723.499850-1-i.abramov@mt-integration.ru> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: mmail-p-exch02.mt.ru (81.200.124.62) To mmail-p-exch01.mt.ru (81.200.124.61) X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dmarc=none header.from=mt-integration.ru;spf=none smtp.mailfrom=mt-integration.ru;dkim=none X-KSMG-AntiSpam-Envelope-From: i.abramov@mt-integration.ru X-KSMG-AntiSpam-Info: LuaCore: 51 0.3.51 68896fb0083a027476849bf400a331a2d5d94398, {rep_avail}, {Tracking_from_domain_doesnt_match_to}, mt-integration.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;81.200.124.61:7.1.2;ksmg01.maxima.ru:7.1.1;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 81.200.124.61 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 192091 [Mar 25 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.1.8310, bases: 2025/03/25 08:37:00 #27838357 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 7 X-Patchwork-Delegate: kuba@kernel.org Currently, the return value of device_rename() is not checked or acted upon. There is also a pointless WARN_ON() call in case of an allocation failure, since it only leads to useless splats caused by deliberate fault injections. Since it's possible to roll back the changes made before the device_rename() call in case of failure, do it. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 66e5c2672cd1 ("ieee802154: add netns support") Signed-off-by: Ivan Abramov --- net/ieee802154/core.c | 44 +++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index 88adb04e4072..f9865eb2c7cf 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c @@ -233,31 +233,35 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev, wpan_dev->netdev->netns_local = true; } - if (err) { - /* failed -- clean up to old netns */ - net = wpan_phy_net(&rdev->wpan_phy); - - list_for_each_entry_continue_reverse(wpan_dev, - &rdev->wpan_dev_list, - list) { - if (!wpan_dev->netdev) - continue; - wpan_dev->netdev->netns_local = false; - err = dev_change_net_namespace(wpan_dev->netdev, net, - "wpan%d"); - WARN_ON(err); - wpan_dev->netdev->netns_local = true; - } + if (err) + goto errout; - return err; - } + err = device_rename(&rdev->wpan_phy.dev, dev_name(&rdev->wpan_phy.dev)); - wpan_phy_net_set(&rdev->wpan_phy, net); + if (err) + goto errout; - err = device_rename(&rdev->wpan_phy.dev, dev_name(&rdev->wpan_phy.dev)); - WARN_ON(err); + wpan_phy_net_set(&rdev->wpan_phy, net); return 0; + +errout: + /* failed -- clean up to old netns */ + net = wpan_phy_net(&rdev->wpan_phy); + + list_for_each_entry_continue_reverse(wpan_dev, + &rdev->wpan_dev_list, + list) { + if (!wpan_dev->netdev) + continue; + wpan_dev->netdev->netns_local = false; + err = dev_change_net_namespace(wpan_dev->netdev, net, + "wpan%d"); + WARN_ON(err); + wpan_dev->netdev->netns_local = true; + } + + return err; } void cfg802154_dev_free(struct cfg802154_registered_device *rdev) From patchwork Tue Mar 25 14:17:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Abramov X-Patchwork-Id: 14029093 X-Patchwork-Delegate: kuba@kernel.org Received: from ksmg01.maxima.ru (ksmg01.mt-integration.ru [81.200.124.38]) (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 3ADC1257AED; Tue, 25 Mar 2025 14:25:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.200.124.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912704; cv=none; b=ZPlCF3MwDlyQOcM7FNnsKk53zlPd5CGL0l5TZ4AB4yXVR5FCujXEEAQjiTVLdEv4gpJ7li49Y13D7WOfEE7eWxKoUyCvr0/k8yr4HqgEXm4QI2xleS63QCIvQc4RRnT3GxvGiWs3ZLzJbketVLbB0CyOmhjEB/HnbPD0/EAHQx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912704; c=relaxed/simple; bh=i+jJluvfmw7QTM79kGVnkPJFy3jfLDA7MJjNItHHP2s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JTQtmgzv0qpXvuHjZJtI1JjvavO3KBl0iu4hoZ7UgEXBdknvnaHI3zoRxnLfi7hu1oGW0aaQq6OdgkbXkuvOiJ+6eeeqS/QukBshGnUvU64emO+ZbSKwLn3EuVLv8KJjmUEBwBytNcLlA3E6JBz4piYyasTFs80JYhaKgzDS9Uc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru; spf=pass smtp.mailfrom=mt-integration.ru; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b=GFYk7dep; arc=none smtp.client-ip=81.200.124.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b="GFYk7dep" Received: from ksmg01.maxima.ru (localhost [127.0.0.1]) by ksmg01.maxima.ru (Postfix) with ESMTP id 8A476C001B; Tue, 25 Mar 2025 17:18:40 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 ksmg01.maxima.ru 8A476C001B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt-integration.ru; s=sl; t=1742912320; bh=VpnvlnY8bY5vnElrzVp5C0j7oZyYs6XQRrZNSP6s5wc=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=GFYk7depy8+PUULfLypFldRXPm69P1R2EpnI/HPh/gzhPDbHGD7EbYP5kp1c46UFH AL3Bgc8zd7xeHzq4dnmPN7RdE29NgjePU6XLdqyoslRZpqWS0slyfZYqynhwA34o1G XoTXSYHBoDgAcDLZ9p6vgTIV9okw3ygf+jTfN3JuzSwrZNcPafj8fiKmsy71NtzIa6 oINBOX3R/+2EpQnRjUFxth40jim2FUGf+yjKEaRwEh3ivuwPU7ZjrDfimQSsafSa3n ezCej509S7FPxeGfpCiVYtxSI7wnD4WfDch6o9Yf8U5ovWEtpgu0T8zUezlGNxF336 YZjngfybQ3DBQ== Received: from ksmg01.maxima.ru (mail.maxima.ru [81.200.124.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.maxima.ru", Issuer "GlobalSign GCC R3 DV TLS CA 2020" (verified OK)) by ksmg01.maxima.ru (Postfix) with ESMTPS; Tue, 25 Mar 2025 17:18:40 +0300 (MSK) Received: from db126-1-abramov-14-d-mosos.mti-lab.com (172.25.20.118) by mmail-p-exch01.mt.ru (81.200.124.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Mar 2025 17:18:38 +0300 From: Ivan Abramov To: "David S. Miller" CC: Ivan Abramov , Jakub Kicinski , , , Subject: [PATCH net 2/4] ieee802154: Avoid calling WARN_ON() on -ENOMEM in cfg802154_pernet_exit() Date: Tue, 25 Mar 2025 17:17:21 +0300 Message-ID: <20250325141723.499850-3-i.abramov@mt-integration.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250325141723.499850-1-i.abramov@mt-integration.ru> References: <20250325141723.499850-1-i.abramov@mt-integration.ru> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: mmail-p-exch02.mt.ru (81.200.124.62) To mmail-p-exch01.mt.ru (81.200.124.61) X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dmarc=none header.from=mt-integration.ru;spf=none smtp.mailfrom=mt-integration.ru;dkim=none X-KSMG-AntiSpam-Envelope-From: i.abramov@mt-integration.ru X-KSMG-AntiSpam-Info: LuaCore: 51 0.3.51 68896fb0083a027476849bf400a331a2d5d94398, {rep_avail}, {Tracking_from_domain_doesnt_match_to}, mt-integration.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;81.200.124.61:7.1.2;ksmg01.maxima.ru:7.1.1;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 81.200.124.61 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 192091 [Mar 25 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.1.8310, bases: 2025/03/25 08:37:00 #27838357 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 7 X-Patchwork-Delegate: kuba@kernel.org It's pointless to call WARN_ON() in case of an allocation failure in device_rename(), since it only leads to useless splats caused by deliberate fault injections, so avoid it. Fixes: 66e5c2672cd1 ("ieee802154: add netns support") Signed-off-by: Ivan Abramov --- net/ieee802154/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index f9865eb2c7cf..77760ed4e528 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c @@ -351,11 +351,14 @@ static struct notifier_block cfg802154_netdev_notifier = { static void __net_exit cfg802154_pernet_exit(struct net *net) { struct cfg802154_registered_device *rdev; + int err; rtnl_lock(); 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)); + if (net_eq(wpan_phy_net(&rdev->wpan_phy), net)) { + err = cfg802154_switch_netns(rdev, &init_net); + WARN_ON(err && err != -ENOMEM); + } } rtnl_unlock(); } From patchwork Tue Mar 25 14:17:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Abramov X-Patchwork-Id: 14029090 X-Patchwork-Delegate: kuba@kernel.org Received: from ksmg01.maxima.ru (ksmg01.mt-integration.ru [81.200.124.38]) (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 1659A259CBD; Tue, 25 Mar 2025 14:18:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.200.124.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912331; cv=none; b=VRvKYkNaKFyBuR8G/LZQgpEXZZwTLiv6Er4X2IL4c14OchzAR2ct8dBRbOB1YOJbKPoTM2/G3YAhcuNJ4COkRltNZijcY+g8mINCZru7AYjr3J0w8bb0s/AhgN/+MFXDCE/metGDuIZhhphIY520ppxF1dgyNaf3OSAvlSBVbYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912331; c=relaxed/simple; bh=7mFZoI3oUwSgsrtXYgoQO4zWvGggFBPc0QqMqh4qw+A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U514vfBuylbAE+7qDvCMz1fp0TZAOJIuheatpa0Wy6y6KDM/krQHPMXfZV4EE2PSNWf0nF08f2xPYxUF+u81o9aZb85M5cHQ3ELIv5gwEzZEIo9hbLea4ZUnPphAIFwq3gtzQ6A7m00ahQNYd0kAFcQPxnpBpzghovn/2UxFOQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru; spf=pass smtp.mailfrom=mt-integration.ru; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b=RjqEDJSL; arc=none smtp.client-ip=81.200.124.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b="RjqEDJSL" Received: from ksmg01.maxima.ru (localhost [127.0.0.1]) by ksmg01.maxima.ru (Postfix) with ESMTP id 85491C001C; Tue, 25 Mar 2025 17:18:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 ksmg01.maxima.ru 85491C001C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt-integration.ru; s=sl; t=1742912325; bh=Kl/vgxvkF6dodXZC7H99NoGlSRboIwJ+apzfaBVvyhU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=RjqEDJSLlzXSQ2giJRH//e0mYZa0eFVLw8+h0gdhptBKVqS6if41pBTNHjzeFYrCn rdXI6p69dsu51Vr3ZtAOdIQAgg6RZvdXchklmGjK5QXC2CJuuQtS8v5WdaHgM3kbiD xc/fUGKxmk+yQ4c5k9E21xfot/Om2pVdeUOIKEd2gueZRgAP05mVPGTe7sZr+hjRbN msSlbb3gx0xTS1tc+p4VshVnnCebMylkeI3dqo7j/oXXaRGBQwKy2oG7DSnAASuaBI NXifTAesbETyi4L+XnQFRvw8stlBILzA1S41Q/i3JDk1jQDrlX+2VltoHRXz/VQe+V ey1co8Qk/VpLg== Received: from ksmg01.maxima.ru (mail.maxima.ru [81.200.124.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.maxima.ru", Issuer "GlobalSign GCC R3 DV TLS CA 2020" (verified OK)) by ksmg01.maxima.ru (Postfix) with ESMTPS; Tue, 25 Mar 2025 17:18:45 +0300 (MSK) Received: from db126-1-abramov-14-d-mosos.mti-lab.com (172.25.20.118) by mmail-p-exch01.mt.ru (81.200.124.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Mar 2025 17:18:43 +0300 From: Ivan Abramov To: "David S. Miller" CC: Ivan Abramov , Jakub Kicinski , , , Subject: [PATCH net 3/4] cfg80211: Avoid calling WARN_ON() on -ENOMEM in cfg80211_switch_netns() Date: Tue, 25 Mar 2025 17:17:22 +0300 Message-ID: <20250325141723.499850-4-i.abramov@mt-integration.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250325141723.499850-1-i.abramov@mt-integration.ru> References: <20250325141723.499850-1-i.abramov@mt-integration.ru> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: mmail-p-exch02.mt.ru (81.200.124.62) To mmail-p-exch01.mt.ru (81.200.124.61) X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dmarc=none header.from=mt-integration.ru;spf=none smtp.mailfrom=mt-integration.ru;dkim=none X-KSMG-AntiSpam-Envelope-From: i.abramov@mt-integration.ru X-KSMG-AntiSpam-Info: LuaCore: 51 0.3.51 68896fb0083a027476849bf400a331a2d5d94398, {rep_avail}, {Tracking_from_domain_doesnt_match_to}, mt-integration.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;81.200.124.61:7.1.2;ksmg01.maxima.ru:7.1.1;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 81.200.124.61 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 192091 [Mar 25 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.1.8310, bases: 2025/03/25 08:37:00 #27838357 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 7 X-Patchwork-Delegate: kuba@kernel.org It's pointless to call WARN_ON() in case of an allocation failure in device_rename(), since it only leads to useless splats caused by deliberate fault injections, so avoid it. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 04600794958f ("cfg80211: support sysfs namespaces") Signed-off-by: Ivan Abramov --- net/wireless/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/core.c b/net/wireless/core.c index 828e29872633..7c0ca2fd3b45 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -201,7 +201,7 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, wiphy_net_set(&rdev->wiphy, net); err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev)); - WARN_ON(err); + WARN_ON(err && err != -ENOMEM); nl80211_notify_wiphy(rdev, NL80211_CMD_NEW_WIPHY); From patchwork Tue Mar 25 14:19:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Abramov X-Patchwork-Id: 14029091 X-Patchwork-Delegate: kuba@kernel.org Received: from ksmg01.maxima.ru (ksmg01.maxima.ru [81.200.124.38]) (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 AFC6125A62B; Tue, 25 Mar 2025 14:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=81.200.124.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912371; cv=none; b=qTqIJqWzJ/X11UtUFJq3duMgTj78OgJceyIw6zD+g/xUO6S2V6W0ML3UMlUc7GbGB6PYmfA+O/Y9m3XdyymVTjlyyMk7Fq1EXyxyPCzmSjtIcRdX2LswvuCGImB/DHZj66iKcqhhVnCvCyvbiky1ffGj5t7GLC5G4yXgr8WjdiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742912371; c=relaxed/simple; bh=GmM9nc0h7Rpsda36dj+2kNnrsCf+HAeRmCa1HiIvXRQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=I7wvCdBozfZ8H9YNgWT45GRvSRNUkXdF02yd+8og3suph4kK4eRPmsM7kvDr128BGLe8IUvlGnRsooLOQJkkbI2Y8vGiobMPuE/adSG7XIA9lPdGXQQVxk3lmvuTdBDm8Qbutx6eJu38zPDIqdQ18xELW1BkZgITvb0cfbNIDHk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru; spf=pass smtp.mailfrom=mt-integration.ru; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b=CNJSVftO; arc=none smtp.client-ip=81.200.124.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mt-integration.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mt-integration.ru header.i=@mt-integration.ru header.b="CNJSVftO" Received: from ksmg01.maxima.ru (localhost [127.0.0.1]) by ksmg01.maxima.ru (Postfix) with ESMTP id 1BAD5C001E; Tue, 25 Mar 2025 17:19:28 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 ksmg01.maxima.ru 1BAD5C001E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mt-integration.ru; s=sl; t=1742912368; bh=xOIKQhfLeGn+BFImddppcHEQgCWq+xEUuCyR1dMleec=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=CNJSVftOKCqRKX5+oLBucq6KGFkuJIXJmSD9gEBUroZJAi6hOnGKYfhBCivitmyZh fVCiMNTbdBJXgJPLyQKt09ow1ycjBdUG4JGBbRjgiq3EAWWj1IY8Wds74Abt6x22/Z 0DKgJ8qNj/7BK7RyLAuhNkeARzW52ltWp28hXbxJwOVNLtFP4bgI3UhUVz9EEZOgpf NMox4+BP8i8B7fhqPFQJV61QSDUDh8TdoWhFemBkEexlvGcEyWNuPqqvxVCbxUXtqD o46Cff3AHRDEI9Z4hnOVHgWBzF9d8brFEzl/Eorq0iqPT5P13RWjnXx3i0N2SlsFUz i7nlZe9Bl0sCA== Received: from ksmg01.maxima.ru (mail.maxima.ru [81.200.124.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.maxima.ru", Issuer "GlobalSign GCC R3 DV TLS CA 2020" (verified OK)) by ksmg01.maxima.ru (Postfix) with ESMTPS; Tue, 25 Mar 2025 17:19:27 +0300 (MSK) Received: from db126-1-abramov-14-d-mosos.mti-lab.com (172.25.20.118) by mmail-p-exch01.mt.ru (81.200.124.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 25 Mar 2025 17:19:26 +0300 From: Ivan Abramov To: "David S. Miller" CC: Ivan Abramov , Jakub Kicinski , , , Subject: [PATCH net 4/4] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace() Date: Tue, 25 Mar 2025 17:19:12 +0300 Message-ID: <20250325141912.499929-1-i.abramov@mt-integration.ru> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: mmail-p-exch02.mt.ru (81.200.124.62) To mmail-p-exch01.mt.ru (81.200.124.61) X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Auth: dmarc=none header.from=mt-integration.ru;spf=none smtp.mailfrom=mt-integration.ru;dkim=none X-KSMG-AntiSpam-Envelope-From: i.abramov@mt-integration.ru X-KSMG-AntiSpam-Info: LuaCore: 51 0.3.51 68896fb0083a027476849bf400a331a2d5d94398, {rep_avail}, {Tracking_from_domain_doesnt_match_to}, mt-integration.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;81.200.124.61:7.1.2;ksmg01.maxima.ru:7.1.1;127.0.0.199:7.1.2, FromAlignment: s, ApMailHostAddress: 81.200.124.61 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiSpam-Lua-Profiles: 192091 [Mar 25 2025] X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Version: 6.1.1.11 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.1.8310, bases: 2025/03/25 08:37:00 #27838357 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: NotDetected X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 7 X-Patchwork-Delegate: kuba@kernel.org It's pointless to call WARN_ON() in case of an allocation failure in device_rename(), since it only leads to useless splats caused by deliberate fault injections, so avoid it. Found by Linux Verification Center (linuxtesting.org) with Syzkaller. Fixes: 8b41d1887db7 ("[NET]: Fix running without sysfs") Signed-off-by: Ivan Abramov --- net/core/dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/dev.c b/net/core/dev.c index 2f7f5fd9ffec..14726cc8796b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -12102,7 +12102,7 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net, dev_set_uevent_suppress(&dev->dev, 1); err = device_rename(&dev->dev, dev->name); dev_set_uevent_suppress(&dev->dev, 0); - WARN_ON(err); + WARN_ON(err && err != -ENOMEM); /* Send a netdev-add uevent to the new namespace */ kobject_uevent(&dev->dev.kobj, KOBJ_ADD);