linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: caif: Add lockdep expression to RCU traversal primitive
@ 2020-03-12  5:34 Amol Grover
  2020-03-12  5:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Amol Grover @ 2020-03-12  5:34 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Greg Kroah-Hartman,
	Thomas Gleixner, Richard Fontana, Allison Randal, Paolo Abeni
  Cc: netdev, linux-kernel, linux-kernel-mentees, Joel Fernandes,
	Madhuparna Bhowmik, Paul E . Mckenney, Amol Grover,
	kernel test robot

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>
---
 net/caif/caif_dev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
index 03c7cdd8e4cb..195d2d67be8a 100644
--- a/net/caif/caif_dev.c
+++ b/net/caif/caif_dev.c
@@ -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;
 	}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: caif: Add lockdep expression to RCU traversal primitive
  2020-03-12  5:34 [PATCH] net: caif: Add lockdep expression to RCU traversal primitive Amol Grover
@ 2020-03-12  5:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-03-12  5:55 UTC (permalink / raw)
  To: frextrite
  Cc: kuba, gregkh, tglx, rfontana, allison, pabeni, netdev,
	linux-kernel, linux-kernel-mentees, joel, madhuparnabhowmik10,
	paulmck, lkp

From: Amol Grover <frextrite@gmail.com>
Date: Thu, 12 Mar 2020 11:04:20 +0530

> 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>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-12  5:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12  5:34 [PATCH] net: caif: Add lockdep expression to RCU traversal primitive Amol Grover
2020-03-12  5:55 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).