public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Fernando Fernandez Mancera <fmancera@suse.de>
To: Shigeru Yoshida <syoshida@redhat.com>,
	davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	syzbot+cb809def1baaac68ab92@syzkaller.appspotmail.com
Subject: Re: [PATCH net] ipv6: Fix ECMP sibling count mismatch when clearing RTF_ADDRCONF
Date: Wed, 4 Feb 2026 13:59:07 +0100	[thread overview]
Message-ID: <e7d8487b-32aa-4895-91e2-a594a26e4efd@suse.de> (raw)
In-Reply-To: <20260204095837.1285552-1-syoshida@redhat.com>

On 2/4/26 10:58 AM, Shigeru Yoshida wrote:
> syzbot reported a kernel BUG in fib6_add_rt2node() when adding an IPv6
> route. [0]
> 
> Commit f72514b3c569 ("ipv6: clear RA flags when adding a static
> route") introduced logic to clear RTF_ADDRCONF from existing routes
> when a static route with the same nexthop is added. However, this
> causes a problem when the existing route has a gateway.
> 
> When RTF_ADDRCONF is cleared from a route that has a gateway, that
> route becomes eligible for ECMP, i.e. rt6_qualify_for_ecmp() returns
> true. The issue is that this route was never added to the
> fib6_siblings list.
> 
> This leads to a mismatch between the following counts:
> 
> - The sibling count computed by iterating fib6_next chain, which
>    includes the newly ECMP-eligible route
> 
> - The actual siblings in fib6_siblings list, which does not include
>    that route
> 
> When a subsequent ECMP route is added, fib6_add_rt2node() hits
> BUG_ON(sibling->fib6_nsiblings != rt->fib6_nsiblings) because the
> counts don't match.
> 
> Fix this by only clearing RTF_ADDRCONF when the existing route does
> not have a gateway. Routes without a gateway cannot qualify for ECMP
> anyway (rt6_qualify_for_ecmp() requires fib_nh_gw_family), so clearing
> RTF_ADDRCONF on them is safe and matches the original intent of the
> commit.
> 
> [0]:
> kernel BUG at net/ipv6/ip6_fib.c:1217!
> Oops: invalid opcode: 0000 [#1] SMP KASAN PTI
> CPU: 0 UID: 0 PID: 6010 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
> RIP: 0010:fib6_add_rt2node+0x3433/0x3470 net/ipv6/ip6_fib.c:1217
> [...]
> Call Trace:
>   <TASK>
>   fib6_add+0x8da/0x18a0 net/ipv6/ip6_fib.c:1532
>   __ip6_ins_rt net/ipv6/route.c:1351 [inline]
>   ip6_route_add+0xde/0x1b0 net/ipv6/route.c:3946
>   ipv6_route_ioctl+0x35c/0x480 net/ipv6/route.c:4571
>   inet6_ioctl+0x219/0x280 net/ipv6/af_inet6.c:577
>   sock_do_ioctl+0xdc/0x300 net/socket.c:1245
>   sock_ioctl+0x576/0x790 net/socket.c:1366
>   vfs_ioctl fs/ioctl.c:51 [inline]
>   __do_sys_ioctl fs/ioctl.c:597 [inline]
>   __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
>   do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
>   do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94
>   entry_SYSCALL_64_after_hwframe+0x77/0x7f
> 
> Fixes: f72514b3c569 ("ipv6: clear RA flags when adding a static route")
> Reported-by: syzbot+cb809def1baaac68ab92@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=cb809def1baaac68ab92
> Tested-by: syzbot+cb809def1baaac68ab92@syzkaller.appspotmail.com
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> ---
>   net/ipv6/ip6_fib.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Thanks for catching this. I got a bash reproducer and will send a 
kselftest for this specific scenario.

Reviewed-by: Fernando Fernandez Mancera <fmancera@suse.de>

  reply	other threads:[~2026-02-04 12:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04  9:58 [PATCH net] ipv6: Fix ECMP sibling count mismatch when clearing RTF_ADDRCONF Shigeru Yoshida
2026-02-04 12:59 ` Fernando Fernandez Mancera [this message]
2026-02-05 16:50 ` patchwork-bot+netdevbpf

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=e7d8487b-32aa-4895-91e2-a594a26e4efd@suse.de \
    --to=fmancera@suse.de \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syoshida@redhat.com \
    --cc=syzbot+cb809def1baaac68ab92@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