All of lore.kernel.org
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] tcp: Pass lockdep expression to RCU lists
@ 2020-02-19 10:05 ` Amol Grover
  0 siblings, 0 replies; 6+ messages in thread
From: Amol Grover @ 2020-02-19 10:05 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, Jakub Kicinski
  Cc: Paul E . McKenney, netdev, linux-kernel, Madhuparna Bhowmik,
	Joel Fernandes, linux-kernel-mentees

tcp_cong_list is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of tcp_cong_list_lock.

Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 net/ipv4/tcp_cong.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 3737ec096650..8d4446ed309e 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -25,7 +25,8 @@ static struct tcp_congestion_ops *tcp_ca_find(const char *name)
 {
 	struct tcp_congestion_ops *e;
 
-	list_for_each_entry_rcu(e, &tcp_cong_list, list) {
+	list_for_each_entry_rcu(e, &tcp_cong_list, list,
+				lockdep_is_held(&tcp_cong_list_lock)) {
 		if (strcmp(e->name, name) == 0)
 			return e;
 	}
@@ -55,7 +56,8 @@ struct tcp_congestion_ops *tcp_ca_find_key(u32 key)
 {
 	struct tcp_congestion_ops *e;
 
-	list_for_each_entry_rcu(e, &tcp_cong_list, list) {
+	list_for_each_entry_rcu(e, &tcp_cong_list, list,
+				lockdep_is_held(&tcp_cong_list_lock)) {
 		if (e->key == key)
 			return e;
 	}
@@ -317,7 +319,8 @@ int tcp_set_allowed_congestion_control(char *val)
 	}
 
 	/* pass 2 clear old values */
-	list_for_each_entry_rcu(ca, &tcp_cong_list, list)
+	list_for_each_entry_rcu(ca, &tcp_cong_list, list,
+				lockdep_is_held(&tcp_cong_list_lock))
 		ca->flags &= ~TCP_CONG_NON_RESTRICTED;
 
 	/* pass 3 mark as allowed */
-- 
2.24.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2020-02-20  3:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19 10:05 [Linux-kernel-mentees] [PATCH] tcp: Pass lockdep expression to RCU lists Amol Grover
2020-02-19 10:05 ` Amol Grover
2020-02-19 19:35 ` [Linux-kernel-mentees] " Eric Dumazet
2020-02-19 19:35   ` Eric Dumazet
2020-02-20  3:47   ` [Linux-kernel-mentees] " Amol Grover
2020-02-20  3:47     ` Amol Grover

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.