]> Git Repo - linux.git/commitdiff
net: orphan frags on receive
authorMichael S. Tsirkin <[email protected]>
Fri, 20 Jul 2012 09:23:17 +0000 (09:23 +0000)
committerDavid S. Miller <[email protected]>
Sun, 22 Jul 2012 19:39:33 +0000 (12:39 -0700)
zero copy packets are normally sent to the outside
network, but bridging, tun etc might loop them
back to host networking stack. If this happens
destructors will never be called, so orphan
the frags immediately on receive.

Signed-off-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
net/core/dev.c

index d70e4a3a49f2f86f41dd9410845147963c5d011b..cca02ae7a844ffa5d9bb3897dd1e2998a41ca653 100644 (file)
@@ -1632,6 +1632,8 @@ static inline int deliver_skb(struct sk_buff *skb,
                              struct packet_type *pt_prev,
                              struct net_device *orig_dev)
 {
+       if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
+               return -ENOMEM;
        atomic_inc(&skb->users);
        return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
 }
@@ -3262,7 +3264,10 @@ ncls:
        }
 
        if (pt_prev) {
-               ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
+               if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
+                       ret = -ENOMEM;
+               else
+                       ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
        } else {
                atomic_long_inc(&skb->dev->rx_dropped);
                kfree_skb(skb);
This page took 0.063352 seconds and 4 git commands to generate.