Re: [PATCH] ipv6: ip6_fib: fix possible null-pointer-dereference in ipv6_route_native_seq_show

From: Paolo Abeni
Date: Tue Nov 05 2024 - 07:28:41 EST




On 11/1/24 05:48, Yi Zou wrote:
> In the ipv6_route_native_seq_show function, the fib6_nh variable
> is assigned the value from nexthop_fib6_nh(rt->nh), which could
> return NULL. This creates a risk of a null-pointer-dereference
> when accessing fib6_nh->fib_nh_gw_family. This can be resolved by
> checking if fib6_nh is non-NULL before accessing fib6_nh->fib_nh_gw_family
> and assign dev using dev = fib6_nh ? fib6_nh->fib_nh_dev : NULL;
> to prevent null-pointer dereference errors.
>
> Signed-off-by: Yi Zou <03zouyi09.25@xxxxxxxxx>

Please send a new revision, including a the target tree in the subj
prefix - in this case 'net' and a suitable Fixes tag.

/P