It's pointless to call WARN_ON() in case of an allocation failure in
dev_change_net_namespace() and 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: 66e5c2672cd1 ("ieee802154: add netns support")
Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
---
net/ieee802154/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c
index ddde594513a0..8c47957f5df7 100644
--- a/net/ieee802154/core.c
+++ b/net/ieee802154/core.c
@@ -228,8 +228,10 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
continue;
wpan_dev->netdev->netns_local = false;
err = dev_change_net_namespace(wpan_dev->netdev, net, "wpan%d");
- if (err)
+ if (err) {
+ WARN_ON(err && err != -ENOMEM);
break;
+ }
wpan_dev->netdev->netns_local = true;
}
@@ -237,7 +239,7 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
goto errout;
err = device_rename(&rdev->wpan_phy.dev, dev_name(&rdev->wpan_phy.dev));
- WARN_ON(err);
+ WARN_ON(err && err != -ENOMEM);
if (err)
goto errout;
@@ -258,7 +260,7 @@ int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
wpan_dev->netdev->netns_local = false;
err = dev_change_net_namespace(wpan_dev->netdev, net,
"wpan%d");
- WARN_ON(err);
+ WARN_ON(err && err != -ENOMEM);
wpan_dev->netdev->netns_local = true;
}
--
2.39.5
From: Ivan Abramov <i.abramov@mt-integration.ru>
Date: Fri, 28 Mar 2025 04:04:26 +0300
> It's pointless to call WARN_ON() in case of an allocation failure in
> dev_change_net_namespace() and 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: 66e5c2672cd1 ("ieee802154: add netns support")
> Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
I suggested using net_warn_ratelimited() so this tag is not needed.
The patch itself looks good to me:
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
> Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Reported-by: syzbot+e0bd4e4815a910c0daa8@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/000000000000f4a1b7061f9421de@google.com/#t
On Thu, 27 Mar 2025 19:30:02 -0700, Kuniyuki Iwashima wrote:
> From: Ivan Abramov <i.abramov@mt-integration.ru>
> Date: Fri, 28 Mar 2025 04:04:26 +0300
>> It's pointless to call WARN_ON() in case of an allocation failure in
>> dev_change_net_namespace() and 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: 66e5c2672cd1 ("ieee802154: add netns support")
>> Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
>
> I suggested using net_warn_ratelimited() so this tag is not needed.
> The patch itself looks good to me:
Should I send v2 series with fixed tags?
Thank you for reviewing the series!
> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
>
>
>> Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
>
> Reported-by: syzbot+e0bd4e4815a910c0daa8@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/000000000000f4a1b7061f9421de@google.com/#t
--
Ivan Abramov <i.abramov@mt-integration.ru>
© 2016 - 2025 Red Hat, Inc.