Skip to content

Commit e67a8e3

Browse files
IurmanJmehmetb0
authored andcommitted
net: ipv6: rpl_iptunnel: Fix memory leak in rpl_input
BugLink: https://bugs.launchpad.net/bugs/2086242 [ 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> Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent 7503159 commit e67a8e3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

net/ipv6/rpl_iptunnel.c

Lines changed: 7 additions & 5 deletions
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);
@@ -287,9 +285,13 @@ static int rpl_input(struct sk_buff *skb)
287285

288286
err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
289287
if (unlikely(err))
290-
return err;
288+
goto drop;
291289

292290
return dst_input(skb);
291+
292+
drop:
293+
kfree_skb(skb);
294+
return err;
293295
}
294296

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

0 commit comments

Comments
 (0)