From: Antoine Tenart <atenart@kernel.org>
To: Michael Bommarito <michael.bommarito@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] ila: reload IPv6 header after pskb_may_pull in checksum adjust
Date: Mon, 13 Jul 2026 11:44:43 +0200 [thread overview]
Message-ID: <alSzDJLwroWRoeB8@kwain> (raw)
In-Reply-To: <20260711150648.2915106-1-michael.bommarito@gmail.com>
Hi Michael,
On Sat, Jul 11, 2026 at 11:06:48AM -0400, Michael Bommarito wrote:
> ila_csum_adjust_transport() caches ip6h = ipv6_hdr(skb) before calling
> pskb_may_pull(). On a non-linear skb whose transport header sits in a page
> fragment, pskb_may_pull() can call __pskb_pull_tail() / pskb_expand_head()
> and free the old skb head, leaving ip6h dangling; the following
> get_csum_diff(ip6h, p) then reads freed memory. ila_update_ipv6_locator()
> has the same pattern and additionally writes the new locator through the
> stale destination-address pointer.
>
> Impact: a remote IPv6 packet routed through a configured ILA
> csum-adjust-transport route or receive-side mapping triggers a
> slab-use-after-free in ila_update_ipv6_locator() (KASAN). The route or
> mapping requires CAP_NET_ADMIN to configure, but trigger packets are
> unauthenticated once it exists.
>
> Reload ip6h (and the derived iaddr) after each pskb_may_pull() before use,
> matching the transport-header reload the code already performs.
>
> Fixes: 33f11d16142b ("ila: Create net/ipv6/ila directory")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com>
> ---
> net/ipv6/ila/ila_common.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/net/ipv6/ila/ila_common.c b/net/ipv6/ila/ila_common.c
> index e71571455c8a0..acedc5a84e4d7 100644
> --- a/net/ipv6/ila/ila_common.c
> +++ b/net/ipv6/ila/ila_common.c
> @@ -85,6 +85,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,
> struct tcphdr *th = (struct tcphdr *)
> (skb_network_header(skb) + nhoff);
>
> + ip6h = ipv6_hdr(skb);
> diff = get_csum_diff(ip6h, p);
> inet_proto_csum_replace_by_diff(&th->check, skb,
> diff, true, true);
> @@ -96,6 +97,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,
> (skb_network_header(skb) + nhoff);
>
> if (uh->check || skb->ip_summed == CHECKSUM_PARTIAL) {
> + ip6h = ipv6_hdr(skb);
> diff = get_csum_diff(ip6h, p);
> inet_proto_csum_replace_by_diff(&uh->check, skb,
> diff, true, true);
> @@ -110,6 +112,7 @@ static void ila_csum_adjust_transport(struct sk_buff *skb,
> struct icmp6hdr *ih = (struct icmp6hdr *)
> (skb_network_header(skb) + nhoff);
>
> + ip6h = ipv6_hdr(skb);
> diff = get_csum_diff(ip6h, p);
> inet_proto_csum_replace_by_diff(&ih->icmp6_cksum, skb,
> diff, true, true);
> @@ -151,6 +154,9 @@ void ila_update_ipv6_locator(struct sk_buff *skb, struct ila_params *p,
> break;
> }
>
> + ip6h = ipv6_hdr(skb);
> + iaddr = ila_a2i(&ip6h->daddr);
You should be able to reload the pointers only in the
ILA_CSUM_ADJUST_TRANSPORT case.
> +
> /* Now change destination address */
> iaddr->loc = p->locator;
> }
> --
> 2.53.0
>
prev parent reply other threads:[~2026-07-13 9:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 15:06 [PATCH net] ila: reload IPv6 header after pskb_may_pull in checksum adjust Michael Bommarito
2026-07-13 9:44 ` Antoine Tenart [this message]
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=alSzDJLwroWRoeB8@kwain \
--to=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.bommarito@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/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