Skip to content

Commit

Permalink
net: make sure napi_list is safe for RCU traversal
Browse files Browse the repository at this point in the history
netpoll needs to traverse dev->napi_list under RCU, make
sure it uses the right iterator and that removal from this
list is handled safely.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Sep 10, 2020
1 parent 4d092dd commit 5251ef8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -6656,7 +6656,7 @@ void __netif_napi_del(struct napi_struct *napi)
return;

napi_hash_del(napi);
list_del_init(&napi->dev_list);
list_del_rcu(&napi->dev_list);
napi_free_frags(napi);

flush_gro_hash(napi);
Expand Down
2 changes: 1 addition & 1 deletion net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ static int netpoll_owner_active(struct net_device *dev)
{
struct napi_struct *napi;

list_for_each_entry(napi, &dev->napi_list, dev_list) {
list_for_each_entry_rcu(napi, &dev->napi_list, dev_list) {
if (napi->poll_owner == smp_processor_id())
return 1;
}
Expand Down

0 comments on commit 5251ef8

Please sign in to comment.