From: Simon Horman <horms@kernel.org>
To: Qing Ming <a0yami@mailbox.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Guillaume Nault <gnault@redhat.com>,
Sabrina Dubroca <sd@queasysnail.net>,
David Ahern <dsahern@kernel.org>,
Robert Shearman <rshearma@brocade.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] mpls: reload header after pskb_may_pull()
Date: Tue, 18 Aug 2026 08:55:25 +0100 [thread overview]
Message-ID: <20260818075525.GA265046@horms.kernel.org> (raw)
In-Reply-To: <20260814095404.7205-1-a0yami@mailbox.org>
On Fri, Aug 14, 2026 at 05:54:04PM +0800, Qing Ming wrote:
> mpls_select_multipath() calls mpls_multipath_hash() to choose a nexthop
> when an MPLS route has multiple nexthops. While walking the MPLS label
> stack, the hash routine caches hdr for the current label. After finding
> the bottom-of-stack label, it calls pskb_may_pull() before reading the
> inner IP header.
>
> If an skb is constructed with the inner IP header in nonlinear data and
> insufficient tailroom in the linear head, pskb_may_pull() calls
> pskb_expand_head() to replace the skb head and free the old one. This
> leaves hdr pointing to freed memory. The IPv6 path can invalidate hdr
> again when it performs a second pull for the larger header.
>
> The issue was found through static analysis. A reproducer sending a legal
> Geneve packet through a bareudp/MPLS multipath setup triggered the same
> KASAN report in 2 of 2 unpatched runs:
>
> BUG: KASAN: slab-use-after-free in mpls_select_multipath
> Read of size 1 at addr ffff88800ecc6e20 by task ksoftirqd/1/23
>
> Call Trace:
> mpls_select_multipath
> mpls_forward
> __netif_receive_skb_list_core
> netif_receive_skb_list_internal
> napi_complete_done
> gro_cell_poll
> __napi_poll
> net_rx_action
>
> Freed by task 23:
> kfree
> pskb_expand_head
> __pskb_pull_tail
> mpls_select_multipath
>
> Reload hdr from the current skb head after each successful pull before
> deriving the inner IPv4 or IPv6 header pointer.
>
> Fixes: 9f427a0e474a ("net: mpls: Fix multipath selection for LSR use case")
> Cc: stable@vger.kernel.org
> Signed-off-by: Qing Ming <a0yami@mailbox.org>
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-08-18 7:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 9:54 [PATCH net] mpls: reload header after pskb_may_pull() Qing Ming
2026-08-18 7:55 ` Simon Horman [this message]
2026-08-18 9:20 ` patchwork-bot+netdevbpf
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=20260818075525.GA265046@horms.kernel.org \
--to=horms@kernel.org \
--cc=a0yami@mailbox.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=gnault@redhat.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rshearma@brocade.com \
--cc=sd@queasysnail.net \
--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