Message ID | 20250325141912.499929-1-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 |
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);
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(-)