Re: [PATCH] ipv4: fib: annotate data-race around nh->nh_saddr

From: Eric Dumazet

Date: Mon Sep 14 2026 - 15:58:45 EST


On Mon, Sep 14, 2026 at 12:51 PM Kuniyuki Iwashima <kuniyu@xxxxxxxxxx> wrote:
>
> On Fri, Sep 11, 2026 at 12:38 AM Linkui Xiao <xiaolinkui@xxxxxxx> wrote:
> >
> > From: Linkui Xiao <xiaolinkui@xxxxxxxxxx>
> >
> > fib_select_multipath() compares nexthop_nh->nh_saddr against the flow
> > source address with no lock held, while fib_info_update_nhc_saddr()
> > stores a new value from another CPU as soon as the preferred source
> > address of the egress device changes.
> >
> > Commit 195374d89368 ("ipv4: fib: annotate races around nh->nh_saddr_genid
> > and nh->nh_saddr") added WRITE_ONCE() on the store side and READ_ONCE()
> > in fib_result_prefsrc() after syzbot reported
> >
> > BUG: KCSAN: data-race in fib_select_path / fib_select_path
> >
> > but it only covered that reader. fib_select_multipath(), reached from
> > fib_select_path(), is a second lockless reader of nh->nh_saddr and was
> > left bare.
>
> 32607a332cfe added the reader after 195374d89368.
>

Indeed, please put in V2:

Fixes: 32607a332cfe ("ipv4: prefer multipath nexthop that matches
source address")

pw-bot: cr