From: Gustavo A. R. Silva Date: Tue, 31 Mar 2020 16:35:06 +0000 (-0500) Subject: net: ipv6: rpl_iptunnel: Fix potential memory leak in rpl_do_srh_inline X-Git-Tag: v5.10.7~2946^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f80ccfe996871ca69648efee74a60ae7ad0dcd9;p=platform%2Fkernel%2Flinux-rpi.git 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 Signed-off-by: David S. Miller --- diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c index 203037a..a49ddc6 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),