mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <kangyan91@outlook.com>
Cc: <aleksander.lobakin@intel.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <florian.fainelli@broadcom.com>,
	<horms@kernel.org>, <kory.maincent@bootlin.com>,
	<kuba@kernel.org>, <kuniyu@amazon.com>,
	<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<pabeni@redhat.com>, <syzkaller@googlegroups.com>
Subject: Re: unregister_netdevice: waiting for DEV to become free [unbalanced refcount bug in dev_ifsioc]
Date: Thu, 13 Mar 2025 15:44:06 -0700	[thread overview]
Message-ID: <20250313224415.60894-1-kuniyu@amazon.com> (raw)
In-Reply-To: <SY8P300MB0421225D54EB92762AE8F0F2A1D32@SY8P300MB0421.AUSP300.PROD.OUTLOOK.COM>

From: YAN KANG <kangyan91@outlook.com>
Date: Thu, 13 Mar 2025 16:18:22 +0000
> I have repro to trigger it.

FTR, I think the attached prog is not a repro by itself.

> ...
>
> Syzkaller reproducer:
> # {Threaded:false Repeat:true RepeatTimes:0 Procs:4 Slowdown:1 Sandbox: SandboxArg:0 Leak:false NetInjection:false NetDevices:false NetReset:false

This syz prog does not unshare() nor create necessary devices.
Someone must create a bridge and another device.


> r0 = syz_init_net_socket$nl_generic(0x10, 0x3, 0x10)
> ioctl$sock_SIOCGIFINDEX_802154(r0, 0x89a2, &(0x7f0000000a80)={'wpan3\x00'})
> r1 = syz_init_net_socket$nl_generic(0x10, 0x3, 0x10)
> ioctl$sock_SIOCGIFINDEX_802154(r1, 0x89a0, &(0x7f0000000a80)={'wpan3\x00'})
> r2 = syz_init_net_socket$nl_generic(0x10, 0x3, 0x10)
> ioctl$sock_SIOCGIFINDEX_802154(r2, 0x89a1, &(0x7f0000000a80)={'wpan3\x00'})

0x89a1 is SIOCBRDELBR, and wpan3 is the name of the bridge dev, which
looks correct from this line.

> unregister_netdevice: waiting for wpan3 to become free. Usage count = 2

But apparently SIOCBRDELIF (0x89a3) is missing in the repro, so
there must be another prog running that adds and removes a dev
to wpan3.

When you share a repro, please make sure it's standalone.


> I GET backtrace for panic by gdb
> (gdb) bt
> #0  netdev_wait_allrefs_any (list=0xffffc9001bfa7bc8) at net/core/dev.c:11151

Also, this should not panic.

Under RTNL pressure, the SIOCBRDELIF's thread may not be able to acquire
RTNL and complete SIOCBRDELIF, then netdev_wait_allrefs_any() will log the
message but it's not under RTNL.  Once the SIOCBRDELIF's thread acquire
RTNL, the refcnt will be released soon and __rtnl_unlock() will be
unblocked.

Thanks

      parent reply	other threads:[~2025-03-13 22:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 16:18 YAN KANG
2025-03-13 20:31 ` Kuniyuki Iwashima
2025-03-13 22:44 ` Kuniyuki Iwashima [this message]

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=20250313224415.60894-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=horms@kernel.org \
    --cc=kangyan91@outlook.com \
    --cc=kory.maincent@bootlin.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzkaller@googlegroups.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®