netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net/sock: Update sk rcu iterator macro.
@ 2017-10-23 15:39 Tim Hansen
  2017-10-23 18:42 ` Levin, Alexander (Sasha Levin)
  2017-10-25 16:20 ` [lkp-robot] [net/sock] e7396cb0c7: BUG:unable_to_handle_kernel kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Tim Hansen @ 2017-10-23 15:39 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-kernel, alexander.levin, devtimhansen

Mark hlist nodes in sk rcu iterator as protected by the rcu.
hlist_next_rcu accomplishes this and silences the warnings
sparse throws for net/ipv4/udp.c and net/ipv6/udp.c.

Found with make C=1 net/ipv4/udp.o on linux-next tag 
next-20171009.

Signed-off-by: Tim Hansen <devtimhansen@gmail.com>
---
 include/net/sock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 64e5ac41b9cf..96cb7b7e4924 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -737,10 +737,10 @@ static inline void sk_add_bind_node(struct sock *sk,
  *
  */
 #define sk_for_each_entry_offset_rcu(tpos, pos, head, offset)		       \
-	for (pos = rcu_dereference((head)->first);			       \
+	for (pos = rcu_dereference(hlist_next_rcu((head)->first));	       \
 	     pos != NULL &&						       \
 		({ tpos = (typeof(*tpos) *)((void *)pos - offset); 1;});       \
-	     pos = rcu_dereference(pos->next))
+	     pos = rcu_dereference(hlist_next_rcu(pos->next)))
 
 static inline struct user_namespace *sk_user_ns(struct sock *sk)
 {
-- 
2.15.0.rc0

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

end of thread, other threads:[~2017-10-26  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-23 15:39 [PATCH v2] net/sock: Update sk rcu iterator macro Tim Hansen
2017-10-23 18:42 ` Levin, Alexander (Sasha Levin)
2017-10-23 19:37   ` Tim Hansen
2017-10-25 16:20 ` [lkp-robot] [net/sock] e7396cb0c7: BUG:unable_to_handle_kernel kernel test robot

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