diff mbox series

[net,2/4] ieee802154: Avoid calling WARN_ON() on -ENOMEM in cfg802154_pernet_exit()

Message ID 20250325141723.499850-3-i.abramov@mt-integration.ru (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Avoid using WARN_ON() on allocation failure in device_rename() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 3 blamed authors not CCed: stefan@datenfreihafen.org alex.aring@gmail.com marcel@holtmann.org; 8 maintainers not CCed: edumazet@google.com pabeni@redhat.com alex.aring@gmail.com miquel.raynal@bootlin.com linux-wpan@vger.kernel.org horms@kernel.org stefan@datenfreihafen.org marcel@holtmann.org
netdev/build_clang fail Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn fail Errors and warnings before: 7 this patch: 7
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 16 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ivan Abramov March 25, 2025, 2:17 p.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.

Fixes: 66e5c2672cd1 ("ieee802154: add netns support")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
---
 net/ieee802154/core.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

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