Re: [PATCH net 2/2] netpoll: Use rcu_access_pointer() in netpoll_poll_lock
From: Herbert Xu
Date: Mon Nov 18 2024 - 22:48:55 EST
On Mon, Nov 18, 2024 at 03:15:18AM -0800, Breno Leitao wrote:
>
> diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
> index cd4e28db0cbd77572a579aff2067b5864d1a904a..959a4daacea1f2f76536e309d198bc14407942a4 100644
> --- a/include/linux/netpoll.h
> +++ b/include/linux/netpoll.h
> @@ -72,7 +72,7 @@ static inline void *netpoll_poll_lock(struct napi_struct *napi)
> {
> struct net_device *dev = napi->dev;
>
> - if (dev && dev->npinfo) {
> + if (dev && rcu_access_pointer(dev->npinfo)) {
This function is only ever called in a BH context and as such
the correct primitive would be rcu_dereference. Indeed calling
this outside of BH/RCU context would be silly.
Cheers,
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt