summaryrefslogtreecommitdiffstats
path: root/drivers/net/macsec.c
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2017-10-10 17:07:12 +0200
committerDavid S. Miller <davem@davemloft.net>2017-10-11 23:07:20 +0200
commit5aba2ba5030b66a6f8c93049b718556f9aacd7c6 (patch)
tree1806c841ef764418525222567e31d5ca5ac62029 /drivers/net/macsec.c
parentnet: call cgroup_sk_alloc() earlier in sk_clone_lock() (diff)
downloadlinux-5aba2ba5030b66a6f8c93049b718556f9aacd7c6.tar.xz
linux-5aba2ba5030b66a6f8c93049b718556f9aacd7c6.zip
macsec: fix memory leaks when skb_to_sgvec fails
Fixes: cda7ea690350 ("macsec: check return value of skb_to_sgvec always") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/macsec.c')
-rw-r--r--drivers/net/macsec.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 98e4deaa3a6a..5ab1b8849c30 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -742,6 +742,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
sg_init_table(sg, ret);
ret = skb_to_sgvec(skb, sg, 0, skb->len);
if (unlikely(ret < 0)) {
+ aead_request_free(req);
macsec_txsa_put(tx_sa);
kfree_skb(skb);
return ERR_PTR(ret);
@@ -954,6 +955,7 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb,
sg_init_table(sg, ret);
ret = skb_to_sgvec(skb, sg, 0, skb->len);
if (unlikely(ret < 0)) {
+ aead_request_free(req);
kfree_skb(skb);
return ERR_PTR(ret);
}