diff options
author | Xin Long | 2019-03-31 11:03:02 +0200 |
---|---|---|
committer | David S. Miller | 2019-04-02 03:10:51 +0200 |
commit | 5869b8fadad0be948e310c456f111c4103f5fbfb (patch) | |
tree | f74def4622ce45ed84f1ddf9fc34bd85f7e22010 /net/ipv4/af_inet.c | |
parent | net: phy: improve genphy_read_status (diff) | |
download | kernel-qcow2-linux-5869b8fadad0be948e310c456f111c4103f5fbfb.tar.gz kernel-qcow2-linux-5869b8fadad0be948e310c456f111c4103f5fbfb.tar.xz kernel-qcow2-linux-5869b8fadad0be948e310c456f111c4103f5fbfb.zip |
net: use rcu_dereference_protected to fetch sk_dst_cache in sk_destruct
As Eric noticed, in .sk_destruct, sk->sk_dst_cache update is prevented, and
no barrier is needed for this. So change to use rcu_dereference_protected()
instead of rcu_dereference_check() to fetch sk_dst_cache in there.
v1->v2:
- no change, repost after net-next is open.
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 7f3a984ad618..08a8430f5647 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -160,7 +160,7 @@ void inet_sock_destruct(struct sock *sk) WARN_ON(sk->sk_forward_alloc); kfree(rcu_dereference_protected(inet->inet_opt, 1)); - dst_release(rcu_dereference_check(sk->sk_dst_cache, 1)); + dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1)); dst_release(sk->sk_rx_dst); sk_refcnt_debug_dec(sk); } |