Skip to content

Commit 7f80ccf

Browse files
GustavoARSilvadavem330
authored andcommitted
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: a7a29f9 ("net: ipv6: add rpl sr tunnel") Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a019043 commit 7f80ccf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv6/rpl_iptunnel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,10 @@ static int rpl_do_srh_inline(struct sk_buff *skb, const struct rpl_lwt *rlwt,
155155
hdrlen = ((csrh->hdrlen + 1) << 3);
156156

157157
err = skb_cow_head(skb, hdrlen + skb->mac_len);
158-
if (unlikely(err))
158+
if (unlikely(err)) {
159+
kfree(buf);
159160
return err;
161+
}
160162

161163
skb_pull(skb, sizeof(struct ipv6hdr));
162164
skb_postpull_rcsum(skb, skb_network_header(skb),

0 commit comments

Comments
 (0)