LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: wan: lapbether.c: Use built-in RCU list checking
@ 2020-01-15 11:41 madhuparnabhowmik04
  2020-01-16 13:31 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: madhuparnabhowmik04 @ 2020-01-15 11:41 UTC (permalink / raw)
  To: davem, gregkh
  Cc: paulmck, joel, netdev, linux-kernel, rcu, frextrite, Madhuparna Bhowmik

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

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;
 	}
-- 
2.17.1


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

* Re: [PATCH] net: wan: lapbether.c: Use built-in RCU list checking
  2020-01-15 11:41 [PATCH] net: wan: lapbether.c: Use built-in RCU list checking madhuparnabhowmik04
@ 2020-01-16 13:31 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-01-16 13:31 UTC (permalink / raw)
  To: madhuparnabhowmik04
  Cc: gregkh, paulmck, joel, netdev, linux-kernel, rcu, frextrite

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.

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-15 11:41 [PATCH] net: wan: lapbether.c: Use built-in RCU list checking madhuparnabhowmik04
2020-01-16 13:31 ` David Miller

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git