Skip to content

Commit

Permalink
net: caif: Add lockdep expression to RCU traversal primitive
Browse files Browse the repository at this point in the history
caifdevs->list is traversed using list_for_each_entry_rcu()
outside an RCU read-side critical section but under the
protection of rtnl_mutex. Hence, add the corresponding lockdep
expression to silence the following false-positive warning:

[   10.868467] =============================
[   10.869082] WARNING: suspicious RCU usage
[   10.869817] 5.6.0-rc1-00177-g06ec0a154aae4 #1 Not tainted
[   10.870804] -----------------------------
[   10.871557] net/caif/caif_dev.c:115 RCU-list traversed in non-reader section!!

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Amol Grover <frextrite@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
frextrite authored and davem330 committed Mar 12, 2020
1 parent eecba79 commit f9fc28a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/caif/caif_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ static struct caif_device_entry *caif_get(struct net_device *dev)
caif_device_list(dev_net(dev));
struct caif_device_entry *caifd;

list_for_each_entry_rcu(caifd, &caifdevs->list, list) {
list_for_each_entry_rcu(caifd, &caifdevs->list, list,
lockdep_rtnl_is_held()) {
if (caifd->netdev == dev)
return caifd;
}
Expand Down

0 comments on commit f9fc28a

Please sign in to comment.