diff mbox series

cfg80211: Avoid calling WARN_ON() on -ENOMEM in cfg80211_switch_netns()

Message ID 20250328011619.743980-1-i.abramov@mt-integration.ru (mailing list archive)
State New
Delegated to: Johannes Berg
Headers show
Series cfg80211: Avoid calling WARN_ON() on -ENOMEM in cfg80211_switch_netns() | expand

Checks

Context Check Description
wifibot/fixes_present success Fixes tag not required for -next series
wifibot/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
wifibot/tree_selection success Guessed tree name to be wireless-next
wifibot/ynl success Generated files up to date; no warnings/errors; no diff in generated;
wifibot/build_32bit success Errors and warnings before: 0 this patch: 0
wifibot/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
wifibot/build_clang success Errors and warnings before: 0 this patch: 0
wifibot/build_clang_rust success No Rust files in patch. Skipping build
wifibot/build_tools success No tools touched, skip
wifibot/check_selftest success No net selftest shell script
wifibot/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
wifibot/deprecated_api success None detected
wifibot/header_inline success No static functions without inline keyword in header files
wifibot/kdoc success Errors and warnings before: 0 this patch: 0
wifibot/source_inline success Was 0 now: 0
wifibot/verify_fixes success Fixes tag looks correct
wifibot/verify_signedoff success Signed-off-by tag matches author and committer

Commit Message

Ivan Abramov March 28, 2025, 1:16 a.m. UTC
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 <i.abramov@mt-integration.ru>
---
 net/wireless/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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);