netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <i.abramov@mt-integration.ru>
Cc: <alex.aring@gmail.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <horms@kernel.org>, <kuba@kernel.org>,
	<linux-kernel@vger.kernel.org>, <linux-wpan@vger.kernel.org>,
	<lvc-project@linuxtesting.org>, <miquel.raynal@bootlin.com>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<stefan@datenfreihafen.org>
Subject: Re: [PATCH 0/3] Avoid calling WARN_ON() on allocation failure in cfg802154_switch_netns()
Date: Thu, 27 Mar 2025 19:35:03 -0700	[thread overview]
Message-ID: <20250328023511.14859-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20250328010427.735657-1-i.abramov@mt-integration.ru>

From: Ivan Abramov <i.abramov@mt-integration.ru>
Date: Fri, 28 Mar 2025 04:04:24 +0300
> This series was inspired by Syzkaller report on warning in
> cfg802154_switch_netns().
> 
> WARNING: CPU: 0 PID: 5837 at net/ieee802154/core.c:258 cfg802154_switch_netns+0x3c7/0x3d0 net/ieee802154/core.c:258
> Modules linked in:
> CPU: 0 UID: 0 PID: 5837 Comm: syz-executor125 Not tainted 6.13.0-rc6-syzkaller-00918-g7b24f164cf00 #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
> RIP: 0010:cfg802154_switch_netns+0x3c7/0x3d0 net/ieee802154/core.c:258
> Call Trace:
>  <TASK>
>  nl802154_wpan_phy_netns+0x13d/0x210 net/ieee802154/nl802154.c:1292
>  genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline]
>  genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline]
>  genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210
>  netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
>  genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219
>  netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
>  netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1348
>  netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1892
>  sock_sendmsg_nosec net/socket.c:711 [inline]
>  __sock_sendmsg+0x221/0x270 net/socket.c:726
>  ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2594
>  ___sys_sendmsg net/socket.c:2648 [inline]
>  __sys_sendmsg+0x269/0x350 net/socket.c:2680
>  do_syscall_x64 arch/x86/entry/common.c:52 [inline]
>  do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>  entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> This warning is caused by Syzkaller's fault injection, which causes
> kstrdup() in device_rename() to fail, so device_rename() returns -ENOMEM.
> 
> Since practically such failure is not possible, avoid it, additionally
> fixing similar pointless allocation-related warnings.
> 
> Ivan Abramov (3):
>   ieee802154: Restore initial state on failed device_rename() in
>     cfg802154_switch_netns()
>   ieee802154: Avoid calling WARN_ON() on -ENOMEM in
>     cfg802154_switch_netns()
>   ieee802154: Remove WARN_ON() in cfg802154_pernet_exit()

While at it, apply the same change to cfg80211_switch_netns() and
cfg80211_pernet_exit().

Thanks!


> 
>  net/ieee802154/core.c | 51 ++++++++++++++++++++++++-------------------
>  1 file changed, 29 insertions(+), 22 deletions(-)
> 
> -- 

  parent reply	other threads:[~2025-03-28  2:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28  1:04 [PATCH 0/3] Avoid calling WARN_ON() on allocation failure in cfg802154_switch_netns() Ivan Abramov
2025-03-28  1:04 ` [PATCH 1/3] ieee802154: Restore initial state on failed device_rename() " Ivan Abramov
2025-03-28  1:04 ` [PATCH 2/3] ieee802154: Avoid calling WARN_ON() on -ENOMEM " Ivan Abramov
2025-03-28  2:30   ` Kuniyuki Iwashima
2025-03-31  9:40     ` Ivan Abramov
2025-03-28  1:04 ` [PATCH 3/3] ieee802154: Remove WARN_ON() in cfg802154_pernet_exit() Ivan Abramov
2025-03-28  2:35 ` Kuniyuki Iwashima [this message]
2025-03-28  8:29 ` [PATCH 0/3] Avoid calling WARN_ON() on allocation failure in cfg802154_switch_netns() Miquel Raynal

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=20250328023511.14859-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=i.abramov@mt-integration.ru \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stefan@datenfreihafen.org \
    /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;
as well as URLs for NNTP newsgroup(s).