* [PATCH] net: fix memory leak on oom with zerocopy
@ 2012-09-16 8:44 Michael S. Tsirkin
2012-09-18 20:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Michael S. Tsirkin @ 2012-09-16 8:44 UTC (permalink / raw)
Cc: David S. Miller, Eric Dumazet, Ben Hutchings,
Michał Mirosław, netdev, linux-kernel
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>
---
Fixes a memory leak so 3.6 material?
net/core/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 8398836..899f827 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3321,7 +3321,7 @@ ncls:
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 {
--
MST
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: fix memory leak on oom with zerocopy
2012-09-16 8:44 [PATCH] net: fix memory leak on oom with zerocopy Michael S. Tsirkin
@ 2012-09-18 20:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-09-18 20:25 UTC (permalink / raw)
To: mst; +Cc: edumazet, bhutchings, mirq-linux, netdev, linux-kernel
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Sun, 16 Sep 2012 11:44:16 +0300
> 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>
Applied, thanks Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-18 20:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-16 8:44 [PATCH] net: fix memory leak on oom with zerocopy Michael S. Tsirkin
2012-09-18 20:25 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).