[PATCH net 0/4] Avoid using WARN_ON() on allocation failure in device_rename()

From: Ivan Abramov
Date: Tue Mar 25 2025 - 10:26:59 EST


This patch series is based on
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/ and is
intended for the generic netdev maintainers, as it affects multiple
networking subsystems.

There are a couple of Syzkaller reports about WARN_ON() being triggered
by failed device_rename().

They are triggered by fuzzer's fault injection and subsequent allocation
failure in kstrdup(). Failure of kstrdup() in device_rename() should not
lead to WARN_ON(), so means to avoid it are introduced in this series.

If it is possible to reverse the changes done prior to failed
device_rename(), do that. Otherwise ignore -ENOMEM return code in
WARN_ON().

Ivan Abramov (4):
ieee802154: Restore initial state on failed device_rename() in
cfg802154_switch_netns()
ieee802154: Avoid calling WARN_ON() on -ENOMEM in
cfg802154_pernet_exit()
cfg80211: Avoid calling WARN_ON() on -ENOMEM in
cfg80211_switch_netns()
net: Avoid calling WARN_ON() on -ENOMEM in
__dev_change_net_namespace()

net/core/dev.c | 2 +-
net/ieee802154/core.c | 51 ++++++++++++++++++++++++-------------------
net/wireless/core.c | 2 +-
3 files changed, 31 insertions(+), 24 deletions(-)

--
2.39.5