Article View: linux.kernel.netdev
Article #27279Re: [PATCH net v2] net: mpls: clear stale inner state on pop
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 07:25
Date: Sat, 05 Dec 2026 07:25
149 lines
13934 bytes
13934 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 ยท High: 1 ยท Medium: 0 ยท Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The fix is incomplete.
- [Low] net: mpls: Fixes trailer cites partial fix instead of originating
commit
--
net: mpls: clear stale inner state on pop
This patch extends the inner state invalidation in skb_mpls_pop(). It now
also fires when the recorded inner network header sits before the current
network header after an excess pop. In that case inner_protocol is cleared
and inner_network_header is set to the current network header, so
ovs_fragment() no longer picks up a negative or stale positive offset.
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 8ac7ad1378a12..81d101efb8cec 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -6865,12 +6865,15 @@ int skb_mpls_pop(struct sk_buff *skb, __be16 next_proto, int mac_len,
> }
> skb->protocol = next_proto;
>
> - /* The last label is gone, so the inner header recorded by
> - * skb_mpls_push() no longer describes this packet. Drop it, or a
> - * later push keeps the stale offset.
> + /* Clear the inner state when the last label is gone or the recorded
> + * inner header precedes the current network header. Point it at the
> + * current network header so consumers cannot reuse a stale offset.
> */
> - if (!eth_p_mpls(next_proto))
> + if (!eth_p_mpls(next_proto) ||
> + skb_inner_network_offset(skb) < mac_len) {
> skb->inner_protocol = 0;
> + skb->inner_network_header = skb->network_header;
> + }
[Severity: Low]
The Fixes tag points at 78a86d75a70e, but that commit did not
introduce the stale inner_network_header. It only added the
inner_protocol clear in skb_mpls_pop() for a non-MPLS next_proto. It
also carries its own Fixes: 48d2ab609b6b ("net: mpls: Fixups for GSO").
The stale offset that ovs_fragment() copies into network_header comes
from 48d2ab609b6b. That commit started recording inner_network_header
and inner_protocol on push, but never updated them on pop.
c66549ffd666 ("openvswitch: correctly fragment packet with mpls
headers") then made ovs_fragment() consume that value. The excess-pop
case handled here, where every POP declares an MPLS next_proto, was
reachable before 78a86d75a70e existed.
With only 78a86d75a70e cited, the stable and CVE tooling will treat
trees that have 48d2ab609b6b but not 78a86d75a70e as unaffected. This
fix would then not reach them.
Should this be Fixes: 48d2ab609b6b ("net: mpls: Fixups for GSO")
instead, or both tags? The hunk is written on top of the
78a86d75a70e condition. Older trees would need either that commit or
a small adjustment, and a note for the stable maintainers below the
--- line might help.
[Severity: High]
Does this fully close the excess-pop path into ovs_fragment()?
After an excess pop with an MPLS next_proto, skb->protocol stays MPLS. The
bytes at the current network header are no longer an IP header. They start
MPLS_HLEN or more bytes into the original IP header.
invalidate_flow_key() only touches key->mac_proto, so key->eth.type still
says IPv4 or IPv6.
ovs_fragment() then does:
net/openvswitch/actions.c:ovs_fragment() {
...
if (eth_p_mpls(skb->protocol)) {
orig_network_offset = skb_network_offset(skb);
skb->network_header = skb->inner_network_header;
}
if (skb_network_offset(skb) > MAX_L2_LEN) {
...
prepare_frag(vport, skb, orig_network_offset,
ovs_key_mac_proto(key));
...
ip_do_fragment(net, skb->sk, skb, ovs_vport_output);
...
}
With the new assignment the offset equals mac_len, so it passes the
MAX_L2_LEN check. ip_do_fragment() or ip6_fragment() is then chosen based
on the stale key->eth.type, and the shifted bytes get parsed as an L3
header.
With one excess pop on an IPv4 flow, iph->ihl comes from the high byte of
the original IP ID, which the sender controls. ip_do_fragment() only checks
hlen against the MTU:
hlen = iph->ihl * 4;
if (mtu < hlen + 8) {
Nothing bounds hlen by skb->len or skb_headlen().
Could the following setup crash? It uses an Ethernet-framed flow (mac_len
14) that outputs to an ARPHRD_NONE port with hard_header_len 0. A TUN-mode
tun is one such port, and ovs_netdev_link() accepts it. Set MRU=68, make
the garbage ihl 15 (hlen=60), and use a 70-byte frame after the pops:
do_output()
70 > mru + vport->dev->hard_header_len (68 + 0), so ovs_fragment()
prepare_frag()
pulls 14 bytes, skb->len is now 56
ip_do_fragment()
mtu 68 >= hlen + 8 (68), so it continues
ip_frag_init()
state->left = skb->len - hlen = 56 - 60, wraps to 0xFFFFFFFC
ip_frag_next()
skb_copy_from_linear_data(skb, ..., state->hlen) copies 60 bytes
out of a 56-byte area
skb_copy_bits(skb, 60, ..., 8) fails
BUG()
For non-linear skbs, wouldn't the hlen-byte linear copy in ip_frag_next()
also read past skb->tail into tailroom or skb_shared_info? Those bytes
would then go out on the wire in the fragment headers.
The commit message says:
Ethernet ports can also retain positive stale offsets, so a
negative-only downstream check is insufficient.
This path still treats a partly consumed packet as IPv4/IPv6. Would it be
better to refuse to fragment, or to validate the L3 header, once the inner
state has been invalidated? Pointing inner_network_header at the current
network header does not seem to stop this.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204070712.82311-1-ljp1205831794%40gmail.com
Technical Details
Message-ID:
<179645555620.3146.4545655418016880741@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-nl.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377867-linux-kernel-netdev=dewy.ruReferences:
<20261204070712.82311-1-ljp1205831794@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-nl.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377867-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2] net: mpls: clear stale inner state on pop Date: Sat, 05 Dec 2026 07:25:56 +0000 Organization: Usenet Network Message-ID: <179645555620.3146.4545655418016880741@kernel.org> References: <20261204070712.82311-1-ljp1205831794@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2975994"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:TA51epTV/PaQsSO7NCG2uGIV6BY= sha256:WhtmoMqeuLOcs7zv+47fzkNPPSm7mNZwVxOwF7iz1xY= sha1:vAK1goCc44vTB8V8sPoV0l8X4Ao= sha256:OkBQuTfSk+baJlpZfAEg81+acpRKFl+G1pnkpLOvI+8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 2B869117D93; Sat, 5 Dec 2026 10:26:14 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.641 X-Spam-Status: No, score=-3.641 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ntiPGBl5LOGc; Sat, 5 Dec 2026 10:26:10 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377867-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 45F20117D63; Sat, 5 Dec 2026 10:26:02 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id DB5C427E05; Sat, 5 Dec 2026 07:26:00 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796455558; b=FgdwZHYtOfFSTnGJHJvoi5idNyyqAI1Wr2t2q+gicsiuthCWEeNaaahX9ay/SENh2UAm W6QRiXGE2Fy8piyLVwalYtgSEvrYOqG7SLoQMtYK9S1g9hhKqr061vaLCOY8jW0KCz6ky OCDiFIrg/jlkgjqThFoP17cIatia0l9xacAHFbOMscjf7XSDC9D4ZN2qWn5V51AlW2oWl Be8pGDUsb7ks8eU4u6r9KixZODi/d1IjZpdKnd1/MrEAg5V3U0LxCuCMF5AIc2vUpRh0+ eQZqXIeXq+/yNuoA5vg7Tu0lNvd0g6XXR+d8BWhqRecB6cKmhNAgbBAIctnytWKKCGw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796455558; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=70QtFdeg7NrrCSQGlbEbSjd5CsR00Ohb8ekGxTb0nQE=; b=SW7uynIbJMxcsgYSVtOmsjH3vLvBYB7nkEouEeRbmJbfTFHCB22vFj+oTtuKY/0q+Vl4 XAqLBznnI+X2L/4BmKJQqr+Nz4CIvGpNM2Lfse4IhVjxYAd0lBj7DKGAqnaNvCCeHIAfO dMe/M+ecEFZoUGS9GkMGpP1HrVyDpXoTRkpmuJrB0ig/ySSeiw7Y6FBzlOCExg9Cl0vDy mI0NgZodIecFpqWeedSp8ULRLI1m4kbVK4jOqy0/TJB4n3MmesfLXvEedprsNyUm1f+Wq hSusRUJ4hLv20omqaM0P6cpSkzuScr1RH3NdNOiJMOejp4YG3NHYf2DPMetvD/gfCDg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CE5xM8vY; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AE438606A336; Sat, 5 Dec 2026 07:25:58 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CE5xM8vY X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796455557; b=MmX61h6T+v+TIl4532fmDAlB7VlJPWUBkve583TGLcFfuGqNpfivrzL0RqDdppLdRhGb Yxjh8kUtinn8CwV4uYpVHom9yBAOtBsoart04OvUJjmgaI56v/7qaSfWY/0SFPLEh8GBJ k1xW+vDab7SpzKRDAt0intUTX5CUQtdA8IE2nEUg9vkeJGKDbKv34vkHZh4e//4guosU1 QjS3t9/UZVe6BUBt3PGdAjv1wXnXs/iYdwLU5/QptWsB+CJ9m2U2VEF4WzNG9biQBGni0 d/0X/KLs039ZaweG/w2fHXtxdvujM4d7UUh5AVwmk8iNjghaYXocK8Kcf5SD00GkDkA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796455557; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=70QtFdeg7NrrCSQGlbEbSjd5CsR00Ohb8ekGxTb0nQE=; b=uOJHpVLBNJ9tbJW2tyV+/3pul6yUPtfWgpXXe5qo7jGB6b78eA8J82z3/X4bCREH3vu8 gCYsEupmLIfCzcbO7JvOlzJbv7FYDAeq5MSanuGqZxKq0BaAM+i0u0qH48xEAKc/4bkLh fDG5fmieaSKLdvHgay/y2yyHEg3qcNp9Gow5uYNMnrtH5OCt3/SMQp6v5c0pjbEJCfwd2 fRb68KQUGRR3evhHZDogGd3nS+M7aMhIIMm2u0pjtOK6DCUlhdK6xCpZdI697jjW2xqzi p0B2vfNcYfbHiVcnO962DyJ3q/2A66WKt/iO9K1tUDgLjlndKoAqksGJQNnUqolxCXQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CE5xM8vY; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA764606A322; Sat, 5 Dec 2026 07:25:57 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A98BB1F0092B; Sat, 5 Dec 2026 07:25:56 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796455557; bh=70QtFdeg7NrrCSQGlbEbSjd5CsR00Ohb8ekGxTb0nQE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=CE5xM8vYfnNOP+rduXwD5mGsV9GeHYMIGmjenA+jAFF5aMENCJn2OP/V5SymxS/r5 g+lj9mUVialZN2jVLVHW9HhGr0ejI7lLnPsrwaKDMs9/8jEE9TKD/REan0DwVvnA+V laroxRrzSxxFMbHhkTMV9VpUEtA0ZqOHmp5k5u4lFBpMmMt6qYcGAL78CweeWM7o57 jv6SoFMwoOrS9qo+WZ5Omgb95NBXn8OLJPg4AXyx7pfPCWFkVfGVs67IeWybfDs/MQ shTUbUcgCZK/LUzBlkZaut0odN7gvjqyAxbZNEIfYlXR8eejetIQjVXSGBl/ysZA5j WKkJgvLXWJEmA== X-Cc: aconole@redhat.com, almasrymina@google.com, davem@davemloft.net, dev@openvswitch.org, echaudro@redhat.com, edumazet@kernel.org, horms@kernel.org, i.maximets@ovn.org, jbenc@redhat.com, jiayuan.chen@linux.dev, josef@toxicpanda.com, kuba@kernel.org, littleddfu@gmail.com, netdev@vger.kernel.org, pabeni@redhat.com, willemb@google.com, jiapenglin@tencent.com, stable@vger.kernel.org, corvus@tencent.com X-In-Reply-To: <20261204070712.82311-1-ljp1205831794@gmail.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list