mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
esp6: fix memleak on error path in esp6_input
commit7284fdf39aupstream. This ought to be an omission ine619492323("esp: Fix memleaks on error paths."). The memleak on error path in esp6_input is similar to esp_input of esp4. Fixes:e619492323("esp: Fix memleaks on error paths.") Fixes:3f29770723("ipsec: check return value of skb_to_sgvec always") Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -426,8 +426,10 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
|
||||
|
||||
sg_init_table(sg, nfrags);
|
||||
ret = skb_to_sgvec(skb, sg, 0, skb->len);
|
||||
if (unlikely(ret < 0))
|
||||
if (unlikely(ret < 0)) {
|
||||
kfree(tmp);
|
||||
goto out;
|
||||
}
|
||||
|
||||
aead_request_set_crypt(req, sg, sg, elen + ivlen, iv);
|
||||
aead_request_set_ad(req, assoclen);
|
||||
|
||||
Reference in New Issue
Block a user