netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: use proper lockdep annotation in __sk_dst_set()
@ 2017-03-06 19:23 Eric Dumazet
  2017-03-09  7:14 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-03-06 19:23 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

From: Eric Dumazet <edumazet@google.com>

__sk_dst_set() must be called while we own the socket.

We can get proper lockdep coverage using lockdep_sock_is_held()
and rcu_dereference_protected()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/sock.h |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 5e5997654db6454f82179cc35c4bc22e89d0c06f..6db7693b9e61854abaa461706f2678c6d429b73f 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1780,11 +1780,8 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
 
 	sk_tx_queue_clear(sk);
 	sk->sk_dst_pending_confirm = 0;
-	/*
-	 * This can be called while sk is owned by the caller only,
-	 * with no state that can be checked in a rcu_dereference_check() cond
-	 */
-	old_dst = rcu_dereference_raw(sk->sk_dst_cache);
+	old_dst = rcu_dereference_protected(sk->sk_dst_cache,
+					    lockdep_sock_is_held(sk));
 	rcu_assign_pointer(sk->sk_dst_cache, dst);
 	dst_release(old_dst);
 }

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

* Re: [PATCH net-next] net: use proper lockdep annotation in __sk_dst_set()
  2017-03-06 19:23 [PATCH net-next] net: use proper lockdep annotation in __sk_dst_set() Eric Dumazet
@ 2017-03-09  7:14 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-03-09  7:14 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 06 Mar 2017 11:23:55 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> __sk_dst_set() must be called while we own the socket.
> 
> We can get proper lockdep coverage using lockdep_sock_is_held()
> and rcu_dereference_protected()
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

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

end of thread, other threads:[~2017-03-09  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-06 19:23 [PATCH net-next] net: use proper lockdep annotation in __sk_dst_set() Eric Dumazet
2017-03-09  7:14 ` 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).