Thread (12 messages) 12 messages, 4 authors, 2015-08-12

Re: Panic with demuxed ipv4 multicast udp sockets on 4.0.4

From: Eric Dumazet <hidden>
Date: 2015-07-31 10:17:50
Subsystem: networking [general], the rest, user datagram protocol (udp) · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Willem de Bruijn

On Thu, 2015-07-30 at 22:29 +0000, Gregory Hoggarth wrote:
Hi Eric,

Thanks for the patch. I have put this into our code and we'll run our test over tonight and the weekend and report back on Monday.

Thanks,
Oh well, real fix will be :

(Or at least test if DST_NOCACHE is set : those dst need special care)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 83aa604f9273..470196cb50b8 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1995,12 +1995,12 @@ void udp_v4_early_demux(struct sk_buff *skb)
 
 	skb->sk = sk;
 	skb->destructor = sock_efree;
-	dst = sk->sk_rx_dst;
+	dst = READ_ONCE(sk->sk_rx_dst);
 
 	if (dst)
 		dst = dst_check(dst, 0);
-	if (dst)
-		skb_dst_set_noref(skb, dst);
+	if (dst && atomic_inc_not_zero(&dst->__refcnt))
+		skb_dst_set(skb, dst);
 }
 
 int udp_rcv(struct sk_buff *skb)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help