Skip to content

Commit

Permalink
net: fix memory leak on oom with zerocopy
Browse files Browse the repository at this point in the history
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: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
mstsirkin authored and davem330 committed Sep 18, 2012
1 parent e4d1aa4 commit 0e698bf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/dev.c
Expand Up @@ -3322,7 +3322,7 @@ static int __netif_receive_skb(struct sk_buff *skb)

if (pt_prev) {
if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC)))
ret = -ENOMEM;
goto drop;
else
ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
} else {
Expand Down

0 comments on commit 0e698bf

Please sign in to comment.