On Wed, 26 Jun 2019 03:04:50 -0700
Eric Dumazet <eduma...@google.com> wrote:

> sysbot reported that we lack appropriate rcu_read_lock()
> protection in fib_dump_info_fnhe()

Thanks for fixing this.

> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
> index 
> 6aee412a68bdd3c24a6a0eb9883e04b7a83998e0..59670fafcd2612b94c237cbe30109adb196cf3f0
>  100644
> --- a/net/ipv4/route.c
> +++ b/net/ipv4/route.c
> @@ -2872,12 +2872,13 @@ int fib_dump_info_fnhe(struct sk_buff *skb, struct 
> netlink_callback *cb,
>               if (nhc->nhc_flags & RTNH_F_DEAD)
>                       continue;
>  
> +             rcu_read_lock();
>               bucket = rcu_dereference(nhc->nhc_exceptions);
> -             if (!bucket)
> -                     continue;
> -
> -             err = fnhe_dump_bucket(net, skb, cb, table_id, bucket, genid,
> -                                    fa_index, fa_start);
> +             err = 0;

Could you perhaps move declaration and initialisation of 'err' outside
the block while at it? It looks a bit more readable at this point.

> +             if (bucket)
> +                     err = fnhe_dump_bucket(net, skb, cb, table_id, bucket,
> +                                            genid, fa_index, fa_start);
> +             rcu_read_unlock();
>               if (err)
>                       return err;
>       }

Either way,

Reviewed-by: Stefano Brivio <sbri...@redhat.com>

-- 
Stefano

Reply via email to