Skip to content
Snippets Groups Projects
Commit 1080e512 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by David S. Miller
Browse files

net: orphan frags on receive


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: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 868eefeb
No related merge requests found
...@@ -1632,6 +1632,8 @@ static inline int deliver_skb(struct sk_buff *skb, ...@@ -1632,6 +1632,8 @@ static inline int deliver_skb(struct sk_buff *skb,
struct packet_type *pt_prev, struct packet_type *pt_prev,
struct net_device *orig_dev) struct net_device *orig_dev)
{ {
if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
return -ENOMEM;
atomic_inc(&skb->users); atomic_inc(&skb->users);
return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
} }
...@@ -3262,7 +3264,10 @@ ncls: ...@@ -3262,7 +3264,10 @@ ncls:
} }
if (pt_prev) { 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 { } else {
atomic_long_inc(&skb->dev->rx_dropped); atomic_long_inc(&skb->dev->rx_dropped);
kfree_skb(skb); kfree_skb(skb);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment