From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <justin.iurman@uliege.be>
Cc: <aahringo@redhat.com>, <davem@davemloft.net>,
<dsahern@kernel.org>, <edumazet@google.com>, <kuba@kernel.org>,
<linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>
Subject: Re: [PATCH net-next] ipv6: rpl: free skb
Date: Tue, 10 Sep 2024 13:40:10 -0700 [thread overview]
Message-ID: <20240910204010.96400-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20240910100032.18168-1-justin.iurman@uliege.be>
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,
> --
next prev parent reply other threads:[~2024-09-10 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 10:00 Justin Iurman
2024-09-10 20:40 ` Kuniyuki Iwashima [this message]
2024-09-10 21:49 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240910204010.96400-1-kuniyu@amazon.com \
--to=kuniyu@amazon.com \
--cc=aahringo@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=justin.iurman@uliege.be \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®