Re: [PATCH net-next v2] netpoll: Use rtnl_dereference() for npinfo pointer access

From: Eric Dumazet
Date: Fri Nov 22 2024 - 09:46:59 EST


On Fri, Nov 22, 2024 at 2:18 PM Breno Leitao <leitao@xxxxxxxxxx> wrote:
>
> In the __netpoll_setup() function, when accessing the device's npinfo
> pointer, replace rcu_access_pointer() with rtnl_dereference(). This
> change is more appropriate, as suggested by Herbert Xu[1].
>
> The function is called with the RTNL mutex held, and the pointer is
> being dereferenced later, so, dereference earlier and just reuse the
> pointer for the if/else.
>
> The replacement ensures correct pointer access while maintaining
> the existing locking and RCU semantics of the netpoll subsystem.
>
> Link: https://lore.kernel.org/lkml/Zz1cKZYt1e7elibV@xxxxxxxxxxxxxxxxxxx/ [1]
> Suggested-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
> Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
> Acked-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>

Okay, but net-next is currently closed.