Commit 0e698bf6 authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by David S. Miller

net: fix memory leak on oom with zerocopy

If orphan flags fails, we don't free the skb
on receive, which leaks the skb memory.

Return value was also wrong: netif_receive_skb
is supposed to return NET_RX_DROP, not ENOMEM.
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4d1aa40
...@@ -3322,7 +3322,7 @@ static int __netif_receive_skb(struct sk_buff *skb) ...@@ -3322,7 +3322,7 @@ static int __netif_receive_skb(struct sk_buff *skb)
if (pt_prev) { if (pt_prev) {
if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
ret = -ENOMEM; goto drop;
else else
ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment