net: wan: lapbether.c: Use built-in RCU list checking
diff mbox series

Message ID 20200115114101.13068-1-madhuparnabhowmik04@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • net: wan: lapbether.c: Use built-in RCU list checking
Related show

Commit Message

madhuparnabhowmik04@gmail.com Jan. 15, 2020, 11:41 a.m. UTC
From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

The only callers of the function lapbeth_get_x25_dev()
are lapbeth_rcv() and lapbeth_device_event().

lapbeth_rcv() uses rcu_read_lock() whereas lapbeth_device_event()
is called with RTNL held (As mentioned in the comments).

Therefore, pass lockdep_rtnl_is_held() as cond argument in
list_for_each_entry_rcu();

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
---
 drivers/net/wan/lapbether.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Jan. 16, 2020, 1:31 p.m. UTC | #1
From: madhuparnabhowmik04@gmail.com
Date: Wed, 15 Jan 2020 17:11:01 +0530

> From: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>
> 
> The only callers of the function lapbeth_get_x25_dev()
> are lapbeth_rcv() and lapbeth_device_event().
> 
> lapbeth_rcv() uses rcu_read_lock() whereas lapbeth_device_event()
> is called with RTNL held (As mentioned in the comments).
> 
> Therefore, pass lockdep_rtnl_is_held() as cond argument in
> list_for_each_entry_rcu();
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik04@gmail.com>

Applied.

Patch
diff mbox series

diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 0f1217b506ad..e30d91a38cfb 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -64,7 +64,7 @@  static struct lapbethdev *lapbeth_get_x25_dev(struct net_device *dev)
 {
 	struct lapbethdev *lapbeth;
 
-	list_for_each_entry_rcu(lapbeth, &lapbeth_devices, node) {
+	list_for_each_entry_rcu(lapbeth, &lapbeth_devices, node, lockdep_rtnl_is_held()) {
 		if (lapbeth->ethdev == dev) 
 			return lapbeth;
 	}