Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit a46add4

Browse files
IurmanJgregkh
authored andcommitted
net: ipv6: rpl_iptunnel: Fix memory leak in rpl_input
[ Upstream commit 2c84b0a ] Free the skb before returning from rpl_input when skb_cow_head() fails. Use a "drop" label and goto instructions. Fixes: a7a29f9 ("net: ipv6: add rpl sr tunnel") Signed-off-by: Justin Iurman <justin.iurman@uliege.be> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20240911174557.11536-1-justin.iurman@uliege.be Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 50d062b commit a46add4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

net/ipv6/rpl_iptunnel.c

+7-5
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,8 @@ static int rpl_input(struct sk_buff *skb)
263263
rlwt = rpl_lwt_lwtunnel(orig_dst->lwtstate);
264264

265265
err = rpl_do_srh(skb, rlwt);
266-
if (unlikely(err)) {
267-
kfree_skb(skb);
268-
return err;
269-
}
266+
if (unlikely(err))
267+
goto drop;
270268

271269
local_bh_disable();
272270
dst = dst_cache_get(&rlwt->cache);
@@ -286,9 +284,13 @@ static int rpl_input(struct sk_buff *skb)
286284

287285
err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
288286
if (unlikely(err))
289-
return err;
287+
goto drop;
290288

291289
return dst_input(skb);
290+
291+
drop:
292+
kfree_skb(skb);
293+
return err;
292294
}
293295

294296
static int nla_put_rpl_srh(struct sk_buff *skb, int attrtype,

0 commit comments

Comments
 (0)