[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250328-electric-buzzard-of-completion-bedfc5@leitao>
Date: Fri, 28 Mar 2025 06:25:10 -0700
From: Breno Leitao <leitao@...ian.org>
To: Ivan Abramov <i.abramov@...integration.ru>
Cc: "David S. Miller" <davem@...emloft.net>,
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>,
Joe Damato <jdamato@...tly.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: Re: [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in
__dev_change_net_namespace()
Hello Ivan,
On Fri, Mar 28, 2025 at 04:12:57AM +0300, Ivan Abramov wrote:
> 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@...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);
I am curious if we shouldn't skip the rest of that function if
device_rename failed. Something as:
if (WARN_ON(err && err != -ENOMEM))
goto out;
Powered by blists - more mailing lists