diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2020-03-31 19:35:06 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-03-31 20:12:51 +0300 |
commit | 7f80ccfe996871ca69648efee74a60ae7ad0dcd9 (patch) | |
tree | dfd01ce248e528cbed4965a14324e14b5885dc5a /net | |
parent | a0190431d195f9e796f77eed8be90bebe0a4002b (diff) | |
download | linux-7f80ccfe996871ca69648efee74a60ae7ad0dcd9.tar.xz |
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@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/rpl_iptunnel.c | 4 |
1 files changed, 3 insertions, 1 deletions
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), |