[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200331163506.GA5124@embeddedor>
Date: Tue, 31 Mar 2020 11:35:06 -0500
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: "David S. Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>,
Alexander Aring <alex.aring@...il.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>
Subject: [PATCH net-next] net: ipv6: rpl_iptunnel: Fix potential memory leak
in rpl_do_srh_inline
In case memory resources for buf were allocated, release them before
return.
Addresses-Coverity-ID: 1492011 ("Resource leak")
Fixes: a7a29f9c361f ("net: ipv6: add rpl sr tunnel")
Signed-off-by: Gustavo A. R. Silva <gustavo@...eddedor.com>
---
net/ipv6/rpl_iptunnel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c
index 203037afe001..a49ddc6cd020 100644
--- a/net/ipv6/rpl_iptunnel.c
+++ b/net/ipv6/rpl_iptunnel.c
@@ -155,8 +155,10 @@ static int rpl_do_srh_inline(struct sk_buff *skb, const struct rpl_lwt *rlwt,
hdrlen = ((csrh->hdrlen + 1) << 3);
err = skb_cow_head(skb, hdrlen + skb->mac_len);
- if (unlikely(err))
+ if (unlikely(err)) {
+ kfree(buf);
return err;
+ }
skb_pull(skb, sizeof(struct ipv6hdr));
skb_postpull_rcsum(skb, skb_network_header(skb),
--
2.26.0
Powered by blists - more mailing lists