[PATCH 1/1] esp6: fix memleak on error path in esp6_input

Subsystems: networking [general], networking [ipsec], the rest

STALE2956d

2 messages, 2 authors, 2018-06-27 · open the first message on its own page

[PATCH 1/1] esp6: fix memleak on error path in esp6_input

From: Zhen Lei <hidden>
Date: 2018-06-27 03:52:50

This ought to be an omission in e6194923237 ("esp: Fix memleaks on error
paths."). The memleak on error path in esp6_input is similar to esp_input
of esp4.

Fixes: e6194923237 ("esp: Fix memleaks on error paths.")
Fixes: 3f29770723f ("ipsec: check return value of skb_to_sgvec always")

Signed-off-by: Zhen Lei <redacted>
---
 net/ipv6/esp6.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 97513f3..88a7579 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -669,8 +669,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;
+	}

 	skb->ip_summed = CHECKSUM_NONE;

--
1.8.3

Re: [PATCH 1/1] esp6: fix memleak on error path in esp6_input

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2018-06-27 15:51:28

On Wed, Jun 27, 2018 at 11:49:28AM +0800, Zhen Lei wrote:
This ought to be an omission in e6194923237 ("esp: Fix memleaks on error
paths."). The memleak on error path in esp6_input is similar to esp_input
of esp4.

Fixes: e6194923237 ("esp: Fix memleaks on error paths.")
Fixes: 3f29770723f ("ipsec: check return value of skb_to_sgvec always")

Signed-off-by: Zhen Lei <redacted>
Applied, thanks a lot for the fix!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help