Commit b4bb4ac8 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

pktgen: fix skb leak in case of failure

Seems that skb goes into void unless something magic happened
in pskb_expand_head in case of failure.
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e9540b8
...@@ -2474,7 +2474,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev, ...@@ -2474,7 +2474,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
if (ret < 0) { if (ret < 0) {
printk(KERN_ERR "Error expanding " printk(KERN_ERR "Error expanding "
"ipsec packet %d\n",ret); "ipsec packet %d\n",ret);
return 0; goto err;
} }
} }
...@@ -2484,8 +2484,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev, ...@@ -2484,8 +2484,7 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
if (ret) { if (ret) {
printk(KERN_ERR "Error creating ipsec " printk(KERN_ERR "Error creating ipsec "
"packet %d\n",ret); "packet %d\n",ret);
kfree_skb(skb); goto err;
return 0;
} }
/* restore ll */ /* restore ll */
eth = (__u8 *) skb_push(skb, ETH_HLEN); eth = (__u8 *) skb_push(skb, ETH_HLEN);
...@@ -2494,6 +2493,9 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev, ...@@ -2494,6 +2493,9 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
} }
} }
return 1; return 1;
err:
kfree_skb(skb);
return 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment