tcp: force a dst refcount when prequeue packet
authorEric Dumazet <edumazet@google.com>
Thu, 25 Apr 2013 01:34:55 +0000 (18:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Apr 2013 04:34:24 +0000 (00:34 -0400)
Before escaping RCU protected section and adding packet into
prequeue, make sure the dst is refcounted.

Reported-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tcp.h

index cf0694d4ad60f62be703eaec51db142b9c5c4e29..a34548041c17edccec0c0e30df5682cc22ad4ec9 100644 (file)
@@ -1049,6 +1049,7 @@ static inline bool tcp_prequeue(struct sock *sk, struct sk_buff *skb)
            skb_queue_len(&tp->ucopy.prequeue) == 0)
                return false;
 
+       skb_dst_force(skb);
        __skb_queue_tail(&tp->ucopy.prequeue, skb);
        tp->ucopy.memory += skb->truesize;
        if (tp->ucopy.memory > sk->sk_rcvbuf) {