Message ID | 20241202-netpoll_rcu_herbet_fix-v2-1-2b9d58edc76a@debian.org (mailing list archive) |
---|---|
State | New |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [RESEND,net-next,v2] netpoll: Use rtnl_dereference() for npinfo pointer access | expand |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 2e459b9d88eb52b7c5e4710bf3f7740045d9314b..99e5aa9cc992f429eecf20aeadd04dc293b8f22b 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c @@ -634,7 +634,8 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) goto out; } - if (!rcu_access_pointer(ndev->npinfo)) { + npinfo = rtnl_dereference(ndev->npinfo); + if (!npinfo) { npinfo = kmalloc(sizeof(*npinfo), GFP_KERNEL); if (!npinfo) { err = -ENOMEM; @@ -654,7 +655,6 @@ int __netpoll_setup(struct netpoll *np, struct net_device *ndev) goto free_npinfo; } } else { - npinfo = rtnl_dereference(ndev->npinfo); refcount_inc(&npinfo->refcnt); }