Re: [PATCH net 1/1] ipv6: fix fib6 walker UAF on seq stop
From: Ido Schimmel
Date: Wed Sep 09 2026 - 04:29:07 EST
On Tue, Sep 08, 2026 at 07:42:56AM +0000, Zihan Xi wrote:
> ipv6_route_iter_active() treats a walker in FWS_U at the table root as
> already unlinked. fib6_del_route() can move a still-linked walker into
> that same state when the current leaf is the last route at the root,
> so ipv6_route_native_seq_stop() skips fib6_walker_unlink(). The seq
> private object can then be freed while it remains on
> net->ipv6.fib6_walkers. A later route deletion walks the dangling list
> and uses the freed walker.
>
> Use the list head as membership state and reinitialize it when
> unlinking. Keep the existing w->node check so a never-started iterator
> with a zeroed private object is not treated as linked.
>
> The same stop helper is used by /proc/net/ipv6_route and by the BPF
> ipv6_route iterator. The BPF show path only widens the race.
>
> Fixes: 8d2ca1d7b5c3 ("ipv6: avoid high order memory allocations for /proc/net/ipv6_route")
> Cc: stable@xxxxxxxxxxxxxxx
> Reported-by: Vega <vega@xxxxxxxxxx>
> Assisted-by: LLM
> Co-developed-by: Luxing Yin <root@xxxxxxxxxx>
> Signed-off-by: Luxing Yin <root@xxxxxxxxxx>
> Signed-off-by: Zihan Xi <zihanx@xxxxxxxxxx>
Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>