From: Shuai Liu <847807867@qq.com>
To: netdev@vger.kernel.org
Cc: dsahern@kernel.org, idosch@nvidia.com, edumazet@kernel.org,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org,
syzbot+af16ddc8fd22a1d135f8@syzkaller.appspotmail.com
Subject: [PATCH] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR
Date: Wed, 18 Nov 2026 14:28:28 +0800 [thread overview]
Message-ID: <tencent_F3B718D78486FB80B4040B92FC5BD3076E06@qq.com> (raw)
When an interface MTU drops below IPV6_MIN_MTU, addrconf_notify()
stops IPv6 on the interface via addrconf_ifdown(). With
keep_addr_on_down enabled, permanent addresses are kept but their
host routes are deleted and ifp->rt is cleared; recovery is expected
to happen when the device is brought up, where the NETDEV_UP path
runs addrconf_permanent_addr().
That recovery never happens when IPv6 is stopped through the
NETDEV_CHANGEMTU path: the device itself never goes down, so no
NETDEV_UP event follows when the MTU is restored. The address is
left with ifp->rt == NULL while the device is up, and every later
RTM_NEWADDR notification only warns:
BUG: Address ::ffff:127.0.0.1 on device lo is missing its host route.
syzbot hit this by flapping lo's MTU across IPV6_MIN_MTU with
keep_addr_on_down set and toggling IFF_NOARP, which restarts DAD;
DAD is skipped on the loopback device, so DAD completion and the
warning repeat on every toggle and the address stays permanently
without its host route.
Instead of only warning, regenerate the host route with
fixup_permanent_addr() when RTM_NEWADDR arrives for an address
without ifp->rt on an up device, keeping the warning only for the
allocation failure case.
Fixes: 2d819d250a13 ("ipv6: Handle missing host route in __ipv6_ifa_notify")
Reported-by: syzbot+af16ddc8fd22a1d135f8@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=af16ddc8fd22a1d135f8
Signed-off-by: Shuai Liu <847807867@qq.com>
---
net/ipv6/addrconf.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 4b0cb7d23541d..70230ffdc077f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -6357,17 +6357,17 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
/*
* If the address was optimistic we inserted the route at the
* start of our DAD process, so we don't need to do it again.
- * If the device was taken down in the middle of the DAD
- * cycle there is a race where we could get here without a
- * host route, so nothing to insert. That will be fixed when
- * the device is brought up.
+ * Otherwise, if the host route is gone while the device is up
+ * (e.g. dropped by addrconf_ifdown() for a low MTU and the
+ * address kept by keep_addr_on_down), regenerate it.
*/
- if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node)) {
- ip6_ins_rt(net, ifp->rt);
- } else if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) {
- pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n",
- &ifp->addr, ifp->idev->dev->name);
+ if (!ifp->rt && (ifp->idev->dev->flags & IFF_UP)) {
+ if (fixup_permanent_addr(net, ifp->idev, ifp))
+ pr_warn("BUG: Address %pI6c on device %s is missing its host route.\n",
+ &ifp->addr, ifp->idev->dev->name);
}
+ if (ifp->rt && !rcu_access_pointer(ifp->rt->fib6_node))
+ ip6_ins_rt(net, ifp->rt);
if (ifp->idev->cnf.forwarding)
addrconf_join_anycast(ifp);
base-commit: 7cfbf79c66c63e807ea452abf0546e6f6d6833a6
--
2.43.0
next reply other threads:[~2026-11-18 6:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 6:28 Shuai Liu [this message]
2026-11-22 6:52 ` [PATCH] ipv6: addrconf: regenerate missing host route on RTM_NEWADDR netdev-bot+sashiko
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=tencent_F3B718D78486FB80B4040B92FC5BD3076E06@qq.com \
--to=847807867@qq.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=syzbot+af16ddc8fd22a1d135f8@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