From: "Eric W. Biederman" <ebiederm@xmission.com>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: <i.abramov@mt-integration.ru>, <aleksander.lobakin@intel.com>,
<davem@davemloft.net>, <edumazet@google.com>,
<horms@kernel.org>, <jdamato@fastly.com>, <kuba@kernel.org>,
<leitao@debian.org>, <linux-kernel@vger.kernel.org>,
<lvc-project@linuxtesting.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>,
<syzbot+1df6ffa7a6274ae264db@syzkaller.appspotmail.com>
Subject: Re: [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace()
Date: Fri, 28 Mar 2025 09:17:42 -0500 [thread overview]
Message-ID: <875xjtb5o9.fsf@email.froward.int.ebiederm.org> (raw)
In-Reply-To: <20250328022204.12804-1-kuniyu@amazon.com> (Kuniyuki Iwashima's message of "Thu, 27 Mar 2025 19:15:00 -0700")
Kuniyuki Iwashima <kuniyu@amazon.com> writes:
>> Subject: [PATCH] net: Avoid calling WARN_ON() on -ENOMEM in __dev_change_net_namespace()
>
> s/__dev_change_net_namespace/netif_change_net_namespace/
>
> Also, please specify the target tree: [PATCH v2 net]
>
>
> From: Ivan Abramov <i.abramov@mt-integration.ru>
> Date: Fri, 28 Mar 2025 04:12:57 +0300
>> 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.
No. It is not pointless. The WARN_ON is there because the code can not
rollback if device_rename fails in
__dev_change_net_namespace/netif_change_net_namespace.
If device_rename fails it means that the kernel's device tree
are inconsistent with the actual network devices.
If anything we need a way to guarantee that the device_rename will
succeed, so that all of the parts that may fail may be performed
before we commit ourselves by notifying userspace that the device
is being renamed.
As for Breno Leitao <leitao@debian.org>'s question should we fail
immediately. That will put us in a far worse state.
As I recall the WARN_ON exists there because someone at the last minute
stuffed network devices into sysfs, and no one has taken the time to
handle the practically impossible case of a device_rename failure.
If you are going to do something with this logic please figure out how
to handle a failure instead just shutting up the error message that
let's you know something bad is wrong in the kernel.
Eric
next prev parent reply other threads:[~2025-03-28 15:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-28 1:12 Ivan Abramov
2025-03-28 2:15 ` Kuniyuki Iwashima
2025-03-28 14:17 ` Eric W. Biederman [this message]
2025-03-31 9:17 ` Ivan Abramov
2025-03-28 13:25 ` Breno Leitao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875xjtb5o9.fsf@email.froward.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=i.abramov@mt-integration.ru \
--cc=jdamato@fastly.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+1df6ffa7a6274ae264db@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®