mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace()
@ 2025-03-28  1:12 Ivan Abramov
  2025-03-28  2:15 ` Kuniyuki Iwashima
  2025-03-28 13:25 ` Breno Leitao
  0 siblings, 2 replies; 5+ messages in thread
From: Ivan Abramov @ 2025-03-28  1:12 UTC (permalink / raw)
  To: David S. Miller
  Cc: Ivan Abramov, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Kuniyuki Iwashima, Joe Damato, Breno Leitao,
	Alexander Lobakin, Eric W. Biederman, netdev, linux-kernel,
	lvc-project

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")
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
---
 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 2f7f5fd9ffec..14726cc8796b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -12102,7 +12102,7 @@ int __dev_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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-31  9:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-28  1:12 [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace() Ivan Abramov
2025-03-28  2:15 ` Kuniyuki Iwashima
2025-03-28 14:17   ` Eric W. Biederman
2025-03-31  9:17     ` Ivan Abramov
2025-03-28 13:25 ` Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®