From: Ido Schimmel <idosch@nvidia.com>
To: Xu Rao <raoxu@uniontech.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, kuniyu@google.com,
willemb@google.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, dsahern@kernel.org,
syzbot+e2af46126e0644cbebdd@syzkaller.appspotmail.com
Subject: Re: [PATCH net v2] ipv6: addrconf: skip autoconf on unregistering devices
Date: Wed, 13 May 2026 10:30:31 +0300 [thread overview]
Message-ID: <20260513073031.GA344043@shredder> (raw)
In-Reply-To: <1BEC9A31C1E03F38+20260512124410.719476-1-raoxu@uniontech.com>
On Tue, May 12, 2026 at 08:44:10PM +0800, Xu Rao wrote:
> syzbot reports that unregister_netdevice() can wait forever for a
> netdevsim device whose reference count never drops to zero.
>
> The leaked reference is held by an IPv6 local route created from
> addrconf. A late NETDEV_CHANGE notification can still reach
> addrconf_notify() after the device has entered NETREG_UNREGISTERING.
> The handler can then run automatic address configuration, add a
> link-local address and install its host route after unregister teardown
> has already started. The route nexthop takes a netdev reference in
> fib6_nh_init(), and there might not be a later ifdown pass to remove
> the newly created address and route.
Do you have a reproducer?
The kernel repeatedly sends NETDEV_UNREGISTER notifications when it's
waiting for the reference count to drop.
>
> Do not run MTU, UP or CHANGE based IPv6 autoconfiguration once the
> device is unregistering. Keep NETDEV_DOWN and NETDEV_UNREGISTER
> handling unchanged so the teardown path can still remove existing IPv6
> state.
>
> Reported-by: syzbot+e2af46126e0644cbebdd@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=e2af46126e0644cbebdd
> Signed-off-by: Xu Rao <raoxu@uniontech.com>
> ---
> v2:
> - Drop READ_ONCE() around dev->reg_state. addrconf_notify() is called
> from the netdevice notifier path, so a plain load is sufficient.
> - Do not add a Fixes tag. The issue does not appear to be caused by a
> single commit, but by a long-standing unregister-time lifecycle gap.
>
> net/ipv6/addrconf.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 5476b6536eb7..a517e57cf86a 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -3666,6 +3666,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
> break;
>
> case NETDEV_CHANGEMTU:
> + if (dev->reg_state == NETREG_UNREGISTERING)
> + break;
> +
> /* if MTU under IPV6_MIN_MTU stop IPv6 on this interface. */
> if (dev->mtu < IPV6_MIN_MTU) {
> addrconf_ifdown(dev, dev != net->loopback_dev);
> @@ -3691,6 +3694,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
> fallthrough;
> case NETDEV_UP:
> case NETDEV_CHANGE:
> + if (dev->reg_state == NETREG_UNREGISTERING)
> + break;
> +
> if (idev && idev->cnf.disable_ipv6)
> break;
>
> --
> 2.50.1
prev parent reply other threads:[~2026-05-13 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 12:44 [PATCH net v2] ipv6: addrconf: skip autoconf on unregistering devices Xu Rao
2026-05-13 7:30 ` Ido Schimmel [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=20260513073031.GA344043@shredder \
--to=idosch@nvidia.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raoxu@uniontech.com \
--cc=syzbot+e2af46126e0644cbebdd@syzkaller.appspotmail.com \
--cc=willemb@google.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