[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250403113519.992462-1-i.abramov@mt-integration.ru>
Date: Thu, 3 Apr 2025 14:35:14 +0300
From: Ivan Abramov <i.abramov@...integration.ru>
To: "David S. Miller" <davem@...emloft.net>
CC: Ivan Abramov <i.abramov@...integration.ru>,
<syzbot+1df6ffa7a6274ae264db@...kaller.appspotmail.com>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Simon Horman <horms@...nel.org>, Kuniyuki Iwashima
<kuniyu@...zon.com>, Stanislav Fomichev <sdf@...ichev.me>, Ahmed Zaki
<ahmed.zaki@...el.com>, Alexander Lobakin <aleksander.lobakin@...el.com>,
"Eric W. Biederman" <ebiederm@...ssion.com>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH net v2] net: Avoid calling WARN_ON() on -ENOMEM in netif_change_net_namespace()
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")
Reported-by: syzbot+1df6ffa7a6274ae264db@...kaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/000000000000a45a92061ce6cc7d@google.com/
Link: https://lore.kernel.org/netdev/20250328011302.743860-1-i.abramov@mt-integration.ru/
Signed-off-by: Ivan Abramov <i.abramov@...integration.ru>
---
v2: Add Reported-by and Closes tags and make sure to commit against
latest netdev/net as per Kuniyuki Iwashima's observation. Also add Link
tag.
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 be17e0660144..001c362a4c1d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -12196,7 +12196,7 @@ int netif_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);
--
2.39.5
Powered by blists - more mailing lists