* [PATCH net-next] ipv6: rpl: free skb
@ 2024-09-10 10:00 Justin Iurman
2024-09-10 20:40 ` Kuniyuki Iwashima
0 siblings, 1 reply; 3+ messages in thread
From: Justin Iurman @ 2024-09-10 10:00 UTC (permalink / raw)
To: netdev
Cc: davem, dsahern, edumazet, kuba, pabeni, linux-kernel, aahringo,
justin.iurman
Make rpl_input() free the skb before returning when skb_cow_head()
fails. Use a "drop" label and goto instructions.
Note: if you think it should be a fix and target "net" instead, let me
know.
Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
---
net/ipv6/rpl_iptunnel.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c
index 2c83b7586422..db3c19a42e1c 100644
--- a/net/ipv6/rpl_iptunnel.c
+++ b/net/ipv6/rpl_iptunnel.c
@@ -263,10 +263,8 @@ static int rpl_input(struct sk_buff *skb)
rlwt = rpl_lwt_lwtunnel(orig_dst->lwtstate);
err = rpl_do_srh(skb, rlwt);
- if (unlikely(err)) {
- kfree_skb(skb);
- return err;
- }
+ if (unlikely(err))
+ goto drop;
local_bh_disable();
dst = dst_cache_get(&rlwt->cache);
@@ -286,9 +284,13 @@ static int rpl_input(struct sk_buff *skb)
err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
if (unlikely(err))
- return err;
+ goto drop;
return dst_input(skb);
+
+drop:
+ kfree_skb(skb);
+ return err;
}
static int nla_put_rpl_srh(struct sk_buff *skb, int attrtype,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ipv6: rpl: free skb
2024-09-10 10:00 [PATCH net-next] ipv6: rpl: free skb Justin Iurman
@ 2024-09-10 20:40 ` Kuniyuki Iwashima
2024-09-10 21:49 ` Jakub Kicinski
0 siblings, 1 reply; 3+ messages in thread
From: Kuniyuki Iwashima @ 2024-09-10 20:40 UTC (permalink / raw)
To: justin.iurman
Cc: aahringo, davem, dsahern, edumazet, kuba, linux-kernel, netdev,
pabeni
From: Justin Iurman <justin.iurman@uliege.be>
Date: Tue, 10 Sep 2024 12:00:32 +0200
> Make rpl_input() free the skb before returning when skb_cow_head()
> fails. Use a "drop" label and goto instructions.
>
> Note: if you think it should be a fix and target "net" instead, let me
> know.
Please do so.
For the future submission, this kind of note and changelog between
each revision can be placed after '---' below so that it will disappear
during merge.
>
> Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
> ---
> net/ipv6/rpl_iptunnel.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c
> index 2c83b7586422..db3c19a42e1c 100644
> --- a/net/ipv6/rpl_iptunnel.c
> +++ b/net/ipv6/rpl_iptunnel.c
> @@ -263,10 +263,8 @@ static int rpl_input(struct sk_buff *skb)
> rlwt = rpl_lwt_lwtunnel(orig_dst->lwtstate);
>
> err = rpl_do_srh(skb, rlwt);
> - if (unlikely(err)) {
> - kfree_skb(skb);
> - return err;
> - }
> + if (unlikely(err))
> + goto drop;
>
> local_bh_disable();
> dst = dst_cache_get(&rlwt->cache);
> @@ -286,9 +284,13 @@ static int rpl_input(struct sk_buff *skb)
>
> err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
> if (unlikely(err))
> - return err;
> + goto drop;
>
> return dst_input(skb);
> +
> +drop:
> + kfree_skb(skb);
> + return err;
> }
>
> static int nla_put_rpl_srh(struct sk_buff *skb, int attrtype,
> --
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net-next] ipv6: rpl: free skb
2024-09-10 20:40 ` Kuniyuki Iwashima
@ 2024-09-10 21:49 ` Jakub Kicinski
0 siblings, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-09-10 21:49 UTC (permalink / raw)
To: justin.iurman
Cc: Kuniyuki Iwashima, aahringo, davem, dsahern, edumazet,
linux-kernel, netdev, pabeni
On Tue, 10 Sep 2024 13:40:10 -0700 Kuniyuki Iwashima wrote:
> > Note: if you think it should be a fix and target "net" instead, let me
> > know.
>
> Please do so.
Just to be clear - with a Fixes tag present.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-09-10 21:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 10:00 [PATCH net-next] ipv6: rpl: free skb Justin Iurman
2024-09-10 20:40 ` Kuniyuki Iwashima
2024-09-10 21:49 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).