diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2012-09-15 18:44:16 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-18 16:24:00 -0400 |
commit | 0e698bf6624c469cd4f3f391247b142963ca9c4e (patch) | |
tree | 143c603ac88a8d4bd8717329f9676ba28dcd6427 /net | |
parent | e4d1aa40e363ed3e0486aeeeb0d173f7f822737e (diff) |
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: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d7fe32c946c1..ac7609d85187 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3322,7 +3322,7 @@ ncls: | |||
3322 | 3322 | ||
3323 | if (pt_prev) { | 3323 | if (pt_prev) { |
3324 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) | 3324 | if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) |
3325 | ret = -ENOMEM; | 3325 | goto drop; |
3326 | else | 3326 | else |
3327 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); | 3327 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
3328 | } else { | 3328 | } else { |