diff options
author | Alex Shi <alex.shi@linaro.org> | 2014-07-29 12:35:30 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2014-07-29 12:35:30 +0800 |
commit | 2517325cd75273dc472cf7fa17617df945cf423d (patch) | |
tree | 37c6bc96a46542e49ce25f476ed7f0f4192957a2 /include | |
parent | a4121f52920d3588e475336bf076915899e51509 (diff) | |
parent | 6a0a453177b4ed9de73a93af7f15473389b3248b (diff) |
Merge tag '3.14.14' into linux-linaro-lsk-v3.14
This 3.14.14 stable release
Diffstat (limited to 'include')
-rw-r--r-- | include/net/sock.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 57c31dd15e64..2f7bc435c93d 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1755,8 +1755,8 @@ sk_dst_get(struct sock *sk) rcu_read_lock(); dst = rcu_dereference(sk->sk_dst_cache); - if (dst) - dst_hold(dst); + if (dst && !atomic_inc_not_zero(&dst->__refcnt)) + dst = NULL; rcu_read_unlock(); return dst; } @@ -1793,9 +1793,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst) static inline void sk_dst_set(struct sock *sk, struct dst_entry *dst) { - spin_lock(&sk->sk_dst_lock); - __sk_dst_set(sk, dst); - spin_unlock(&sk->sk_dst_lock); + struct dst_entry *old_dst; + + sk_tx_queue_clear(sk); + old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst); + dst_release(old_dst); } static inline void @@ -1807,9 +1809,7 @@ __sk_dst_reset(struct sock *sk) static inline void sk_dst_reset(struct sock *sk) { - spin_lock(&sk->sk_dst_lock); - __sk_dst_reset(sk); - spin_unlock(&sk->sk_dst_lock); + sk_dst_set(sk, NULL); } struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); |