aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/udp.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 62c19fdd102d..f140048334ce 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1600,20 +1600,15 @@ static void flush_stack(struct sock **stack, unsigned int count,
1600} 1600}
1601 1601
1602/* For TCP sockets, sk_rx_dst is protected by socket lock 1602/* For TCP sockets, sk_rx_dst is protected by socket lock
1603 * For UDP, we use sk_dst_lock to guard against concurrent changes. 1603 * For UDP, we use xchg() to guard against concurrent changes.
1604 */ 1604 */
1605static void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst) 1605static void udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
1606{ 1606{
1607 struct dst_entry *old; 1607 struct dst_entry *old;
1608 1608
1609 spin_lock(&sk->sk_dst_lock); 1609 dst_hold(dst);
1610 old = sk->sk_rx_dst; 1610 old = xchg(&sk->sk_rx_dst, dst);
1611 if (likely(old != dst)) { 1611 dst_release(old);
1612 dst_hold(dst);
1613 sk->sk_rx_dst = dst;
1614 dst_release(old);
1615 }
1616 spin_unlock(&sk->sk_dst_lock);
1617} 1612}
1618 1613
1619/* 1614/*