summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2017-03-06 20:23:55 +0100
committerDavid S. Miller <davem@davemloft.net>2017-03-09 08:14:39 +0100
commit95964c6de787eb21468a29b94e9d25e1a24d6a37 (patch)
tree4aedebd8aac85212bc86194b48512ad88197c960 /include/net/sock.h
parentMerge branch 'flow_dissector-improvements' (diff)
downloadlinux-95964c6de787eb21468a29b94e9d25e1a24d6a37.tar.xz
linux-95964c6de787eb21468a29b94e9d25e1a24d6a37.zip
net: use proper lockdep annotation in __sk_dst_set()
__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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h7
1 files changed, 2 insertions, 5 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 5e5997654db6..6db7693b9e61 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);
}