netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pktgen: fix skb leak in case of failure
@ 2008-10-13 14:22 Ilpo Järvinen
  2008-10-13 17:01 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ilpo Järvinen @ 2008-10-13 14:22 UTC (permalink / raw)
  To: David Miller; +Cc: Netdev

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1067 bytes --]

Seems that skb goes into void unless something magic happened
in pskb_expand_head in case of failure.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 net/core/pktgen.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index fcb1031..b6b2a8e 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2474,7 +2474,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
 				if (ret < 0) {
 					printk(KERN_ERR "Error expanding "
 					       "ipsec packet %d\n",ret);
-					return 0;
+					goto err;
 				}
 			}
 
@@ -2484,8 +2484,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
 			if (ret) {
 				printk(KERN_ERR "Error creating ipsec "
 				       "packet %d\n",ret);
-				kfree_skb(skb);
-				return 0;
+				goto err;
 			}
 			/* restore ll */
 			eth = (__u8 *) skb_push(skb, ETH_HLEN);
@@ -2494,6 +2493,9 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
 		}
 	}
 	return 1;
+err:
+	kfree_skb(skb);
+	return 0;
 }
 #endif
 
-- 
1.5.2.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pktgen: fix skb leak in case of failure
  2008-10-13 14:22 [PATCH] pktgen: fix skb leak in case of failure Ilpo Järvinen
@ 2008-10-13 17:01 ` Arnaldo Carvalho de Melo
  2008-10-14  1:45   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2008-10-13 17:01 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: David Miller, Netdev

Em Mon, Oct 13, 2008 at 05:22:18PM +0300, Ilpo Järvinen escreveu:
> Seems that skb goes into void unless something magic happened
> in pskb_expand_head in case of failure.
> 
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>

Good catch!

Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pktgen: fix skb leak in case of failure
  2008-10-13 17:01 ` Arnaldo Carvalho de Melo
@ 2008-10-14  1:45   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-10-14  1:45 UTC (permalink / raw)
  To: acme; +Cc: ilpo.jarvinen, netdev

From: Arnaldo Carvalho de Melo <acme@redhat.com>
Date: Mon, 13 Oct 2008 14:01:58 -0300

> Em Mon, Oct 13, 2008 at 05:22:18PM +0300, Ilpo Järvinen escreveu:
> > Seems that skb goes into void unless something magic happened
> > in pskb_expand_head in case of failure.
> > 
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> 
> Good catch!
> 
> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Applied, thanks everyone.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-14  1:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-13 14:22 [PATCH] pktgen: fix skb leak in case of failure Ilpo Järvinen
2008-10-13 17:01 ` Arnaldo Carvalho de Melo
2008-10-14  1:45   ` 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).