From: Jakub Kicinski <kuba@kernel.org>
To: Eric Dumazet <edumazet@google.com>
Cc: Simon Horman <simon.horman@corigine.com>,
"David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Alexander Aring <alex.aring@gmail.com>,
David Lebrun <david.lebrun@uclouvain.be>,
netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net 1/3] ipv6: exthdrs: fix potential use-after-free in ipv6_rpl_srh_rcv()
Date: Mon, 22 May 2023 13:00:50 -0700 [thread overview]
Message-ID: <20230522130050.6fa160f6@kernel.org> (raw)
In-Reply-To: <CANn89iJofjC=aqSu6X9itW8VQXTSFUOiAmBB2Zzuw-6kqTnwzA@mail.gmail.com>
On Sun, 21 May 2023 20:22:16 +0200 Eric Dumazet wrote:
> On Thu, May 18, 2023 at 7:05 PM Simon Horman <simon.horman@corigine.com> wrote:
> > Not far below this line there is a call to pskb_pull():
> >
> > if (hdr->nexthdr == NEXTHDR_IPV6) {
> > int offset = (hdr->hdrlen + 1) << 3;
> >
> > skb_postpull_rcsum(skb, skb_network_header(skb),
> > skb_network_header_len(skb));
> >
> > if (!pskb_pull(skb, offset)) {
> > kfree_skb(skb);
> > return -1;
> > }
> > skb_postpull_rcsum(skb, skb_transport_header(skb),
> > offset);
> >
> > Should hdr be reloaded after the call to pskb_pull() too?
>
> I do not think so, because @hdr is not used between this pskb_pull()
> and the return -1:
>
> if (hdr->nexthdr == NEXTHDR_IPV6) {
> int offset = (hdr->hdrlen + 1) << 3;
>
> skb_postpull_rcsum(skb, skb_network_header(skb),
> skb_network_header_len(skb));
>
> if (!pskb_pull(skb, offset)) {
> kfree_skb(skb);
> return -1;
> }
> skb_postpull_rcsum(skb, skb_transport_header(skb),
> offset);
>
> skb_reset_network_header(skb);
> skb_reset_transport_header(skb);
> skb->encapsulation = 0;
>
> __skb_tunnel_rx(skb, skb->dev, net);
>
> netif_rx(skb);
> return -1;
> }
Hum, there's very similar code in ipv6_srh_rcv() (a different function
but with a very similar name) which calls pskb_pull() and then checks
if hdr->nexthdr is v4. I'm guessing that's the one Simon was referring
to.
next prev parent reply other threads:[~2023-05-22 20:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-17 21:31 [PATCH net 0/3] ipv6: exthdrs: fix three SRH issues Eric Dumazet
2023-05-17 21:31 ` [PATCH net 1/3] ipv6: exthdrs: fix potential use-after-free in ipv6_rpl_srh_rcv() Eric Dumazet
2023-05-18 17:05 ` Simon Horman
2023-05-21 18:22 ` Eric Dumazet
2023-05-22 20:00 ` Jakub Kicinski [this message]
2023-05-23 8:47 ` Simon Horman
2023-05-23 10:45 ` Eric Dumazet
2023-05-23 14:41 ` Simon Horman
2023-05-17 21:31 ` [PATCH net 2/3] ipv6: exthdrs: avoid potential NULL deref in ipv6_srh_rcv() Eric Dumazet
2023-05-18 17:06 ` Simon Horman
2023-05-17 21:31 ` [PATCH net 3/3] ipv6: exthdrs: avoid potential NULL deref in ipv6_rpl_srh_rcv() Eric Dumazet
2023-05-18 17:06 ` Simon Horman
2023-05-18 1:53 ` [PATCH net 0/3] ipv6: exthdrs: fix three SRH issues Alexander Aring
2023-05-21 17:05 ` Eric Dumazet
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=20230522130050.6fa160f6@kernel.org \
--to=kuba@kernel.org \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.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;
as well as URLs for NNTP newsgroup(s).