aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 07b7fcd60d80..156350745700 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1730,8 +1730,8 @@ sk_dst_get(struct sock *sk)
1730 1730
1731 rcu_read_lock(); 1731 rcu_read_lock();
1732 dst = rcu_dereference(sk->sk_dst_cache); 1732 dst = rcu_dereference(sk->sk_dst_cache);
1733 if (dst) 1733 if (dst && !atomic_inc_not_zero(&dst->__refcnt))
1734 dst_hold(dst); 1734 dst = NULL;
1735 rcu_read_unlock(); 1735 rcu_read_unlock();
1736 return dst; 1736 return dst;
1737} 1737}
@@ -1768,9 +1768,11 @@ __sk_dst_set(struct sock *sk, struct dst_entry *dst)
1768static inline void 1768static inline void
1769sk_dst_set(struct sock *sk, struct dst_entry *dst) 1769sk_dst_set(struct sock *sk, struct dst_entry *dst)
1770{ 1770{
1771 spin_lock(&sk->sk_dst_lock); 1771 struct dst_entry *old_dst;
1772 __sk_dst_set(sk, dst); 1772
1773 spin_unlock(&sk->sk_dst_lock); 1773 sk_tx_queue_clear(sk);
1774 old_dst = xchg((__force struct dst_entry **)&sk->sk_dst_cache, dst);
1775 dst_release(old_dst);
1774} 1776}
1775 1777
1776static inline void 1778static inline void
@@ -1782,9 +1784,7 @@ __sk_dst_reset(struct sock *sk)
1782static inline void 1784static inline void
1783sk_dst_reset(struct sock *sk) 1785sk_dst_reset(struct sock *sk)
1784{ 1786{
1785 spin_lock(&sk->sk_dst_lock); 1787 sk_dst_set(sk, NULL);
1786 __sk_dst_reset(sk);
1787 spin_unlock(&sk->sk_dst_lock);
1788} 1788}
1789 1789
1790struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1790struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);