Skip to content

Commit

Permalink
pktgen: fix skb leak in case of failure
Browse files Browse the repository at this point in the history
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>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ilpo Järvinen authored and David S. Miller committed Oct 14, 2008
1 parent 9e9540b commit b4bb4ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand All @@ -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);
Expand All @@ -2494,6 +2493,9 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
}
}
return 1;
err:
kfree_skb(skb);
return 0;
}
#endif

Expand Down

0 comments on commit b4bb4ac

Please sign in to comment.