]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/core/sock.c
net: add a noref bit on skb dst
[net-next-2.6.git] / net / core / sock.c
index 63530a03b8c29243a64af4b17c4b613e18971579..bf88a167c8f2ce5f008858454c103d762b0575ad 100644 (file)
@@ -307,6 +307,11 @@ int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
         */
        skb_len = skb->len;
 
+       /* we escape from rcu protected region, make sure we dont leak
+        * a norefcounted dst
+        */
+       skb_dst_force(skb);
+
        spin_lock_irqsave(&list->lock, flags);
        skb->dropcount = atomic_read(&sk->sk_drops);
        __skb_queue_tail(list, skb);
@@ -1536,6 +1541,7 @@ static void __release_sock(struct sock *sk)
                do {
                        struct sk_buff *next = skb->next;
 
+                       WARN_ON_ONCE(skb_dst_is_noref(skb));
                        skb->next = NULL;
                        sk_backlog_rcv(sk, skb);