๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6554

Re: [PATCH net 5/5] net: openvswitch: ensure a linear inner Ethernet header on NSH pop

#6554
From: Eric Dumazet
Date: Thu, 22 Oct 2026 17:47
80 lines
12485 bytes
Le jeu. 22 oct. 2026 ร  14:43, Ilya Maximets <i.maximets@ovn.org> a รฉcrit :
>
> On 10/22/26 11:22 AM, Jamal Hadi Salim wrote:
> > The issue:
> > pop_nsh() restores MAC_PROTO_ETHERNET when the popped NSH next-protocol
> > is TUN_P_ETHERNET, but nsh_pop() only guarantees that the NSH header is
> > in the linear area.  When the inner Ethernet header sits in a page
> > fragment, the datapath then claims an Ethernet header it cannot access
> > linearly.
> >
> > Output to an OVS internal vport then calls eth_type_trans(), which
> > pulls ETH_HLEN from an empty linear area and triggers the BUG in
> > __skb_pull():
> >
> >   kernel BUG at ./include/linux/skbuff.h:2830!
> >   RIP: 0010:eth_type_trans+0x335/0x500
> >   internal_dev_recv
> >   ovs_vport_send
> >   do_output
> >   do_execute_actions
> >   ovs_execute_actions
> >   ovs_dp_process_packet
> >   ovs_vport_receive
> >   internal_dev_xmit
> >
> > Conditions to recreate the bug:
> > On a system with 4 KiB pages and CONFIG_OPENVSWITCH and CONFIG_PACKET
> > enabled, use CAP_NET_ADMIN to create an OVS datapath and bring its local
> > internal port up with MTU 9000.  Install a flow matching an Ethernet/NSH
> > packet with a 24-byte MD1 header whose next-protocol is TUN_P_ETHERNET,
> > and actions pop_eth, pop_nsh, output to the local port.  With
> > CAP_NET_RAW, send a 4148-byte AF_PACKET/SOCK_RAW frame containing outer
> > Ethernet, the NSH header, inner Ethernet and 4096 payload bytes.  The
> > two pops consume the linear headers and expose the inner Ethernet header
> > in page fragments.
> >
> > The fix:
> > Pull the inner Ethernet header into the linear area before restoring
> > MAC_PROTO_ETHERNET.  This is the NSH counterpart of the MPLS/TEB
> > producer fix in the previous patch.
> >
> > Fixes: b2d0f5d5dc53 ("openvswitch: enable NSH support")
> > Link: https://lore.kernel.org/netdev/e85fa16e-df3c-43dd-bb3a-9edca07200ea@kernel.org/
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> > ---
> >  net/openvswitch/actions.c | 7 +++++--
> >  1 file changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> > index 03b31e33e880..cb7e16c6a8ef 100644
> > --- a/net/openvswitch/actions.c
> > +++ b/net/openvswitch/actions.c
> > @@ -314,10 +314,13 @@ static int pop_nsh(struct sk_buff *skb, struct sw_flow_key *key)
> >               return err;
> >
> >       /* safe right before invalidate_flow_key */
> > -     if (skb->protocol == htons(ETH_P_TEB))
> > +     if (skb->protocol == htons(ETH_P_TEB)) {
> > +             if (!pskb_may_pull(skb, ETH_HLEN))
> > +                     return -ENOMEM;
> >               key->mac_proto = MAC_PROTO_ETHERNET;
> > -     else
> > +     } else {
> >               key->mac_proto = MAC_PROTO_NONE;
> > +     }
> >       invalidate_flow_key(key);
> >       return 0;
> >  }
>
> Reviewed-by: Ilya Maximets <i.maximets@ovn.org>

Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Technical Details
Message-ID: <CAL4Wiipm9x5LekCb2WTo1CfqihwRY1=rV0W+KdS-FVA_pRCj3A@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350732-linux-kernel-netdev=dewy.ru
References: <ACT-N6N4.v1.r0.20261022051412@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-1@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-2@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-3@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-4@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-5@mojatatu.com> <0225eac7-1432-4d46-8649-2ad864aa26d4@ovn.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350732-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 5/5] net: openvswitch: ensure a linear inner Ethernet
 header on NSH pop
Date: Thu, 22 Oct 2026 19:47:50 +0200
Organization: Usenet Network
Message-ID: <CAL4Wiipm9x5LekCb2WTo1CfqihwRY1=rV0W+KdS-FVA_pRCj3A@mail.gmail.com>
References: <ACT-N6N4.v1.r0.20261022051412@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-1@mojatatu.com>
 <ACT-N6N4.v1.r0.20261022051412-2@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-3@mojatatu.com>
 <ACT-N6N4.v1.r0.20261022051412-4@mojatatu.com> <ACT-N6N4.v1.r0.20261022051412-5@mojatatu.com>
 <0225eac7-1432-4d46-8649-2ad864aa26d4@ovn.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="282197"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:q9JMS+IGHLEDRknggNM5Aa0b8mU= sha256:nYorj8veqgua25NkLXLgoH6X/d/trWjk0ACsBwodnAA=
	sha1:dodoMQDwK+LqECykxqa/3oH5LwY= sha256:SAVjUksr7H/pJ3HcJ/Vyavs9YfT8xCvyx5g1y23VdMY=
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 BE81E111301; Thu, 22 Oct 2026 20:49:03 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, 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] 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 Cm3w0WjOKa3j;
	Thu, 22 Oct 2026 20:49:00 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-350732-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 60B501112F7; Thu, 22 Oct 2026 20:48:52 +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 1942924E91; Thu, 22 Oct 2026 17:48:12 +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=1792691289;
	b=438yvaUGR4QC5wI78Fw0MUqJjFB9XEMZ0SMvkNk6+4xLrjhB/d2a5XSjnrRacgAvp5W/
	 guRs7p7PdYxTvv5vF+1BPF4xoy2Xtoml9Nnp26MZHGgtSMfl3gtsJvRZ0/fNehwzT3R+s
	 hEQBmdBHoJJyBrBDDiQCgEsH8TOkWY0f9zpg6BeVmAzeNSDw2XFf8Fze9CSXRBgLOZXqU
	 VhbgHhbTU5LXR8LoQuTAZTdnXFdNFKeQGp0KI3KKSnvQ52TYN2sS1eVz1P3xfPvHXcpqE
	 4BWyNcsc3vbTfqM6r9V2hfyKWwgHsAVZFf0hD3vR5XdETVBhFtbNOpiDVANdgD3TT0Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792691289;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=MGotvCzhWr/lonfJnRU59oPcrOTBROzb2+c6xsa3Gm8=;
	b=zkpgb5X/180Nus9Lzy/1uIsWiYSd++UfhPtT5k/kpNTW6kGRyPFZcb3l4dksyxipIklC
	 bsQA0POhMgBfQAtyMDTmzf7PzkjTVzauLgdBMu8FeNiUQbVddHujKAK1G/0HvqhnObVTz
	 tAhrrIM4zITW5HLTFQFEhOibcWEVlabOcwz+LgU5fct3f6bX5pJ7dsHnL8zK84WOd4+eJ
	 TYQDNwQeh5zwONcOg3NakryNu1Btl5c5WSQOssGKZm9IWXtKuknV0i76ZCYzMXLZkaRip
	 zFVSc42G3zTgPN0za7+va6pV5J20ZoFJr/laMLIOv8HEu63E1yDcEMO41abuyXzQFdA==
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=G2ZmsuqW;
	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 2C4EC606A324;
	Thu, 22 Oct 2026 17:48:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=G2ZmsuqW
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=1792691288;
	b=D8HgDhmQW4JODP67GyNDiENLISrZPWAm8NLFgE5vg/7s1rIleorxho8mHuAN+21HmBjy
	 FpVoJkBPTHpTVufhczy33xynh1qwU0bM++6/G2HzCNhtTqOVJSsASV7QZPVB46x6hOrQO
	 GiSgw5ynklo21gGUAk/4wSrj/BpBFtDy4PSIUYWDZtQm13VohI8cuUDonD7eO3fDhACiM
	 5mCS8mnfbBpTrGIY34qlM8l1SNh15LR3vBRdEJEXdRJwfwgN7ThDMETA7cYF80Y2fQRJU
	 zk4fJnnA0BbtixNr2bqs2XyoKgIHvJw0K/luPv2CWFNMGPwA7eKANfaZjrCVDwsJOkg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792691288;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=MGotvCzhWr/lonfJnRU59oPcrOTBROzb2+c6xsa3Gm8=;
	b=l9MRdrgy7COTwc9Krw510824C+vsghJR1O4bDfULthgZJB02Xl/kBto96nKHp/whJtkK
	 mYgsPugOji7bT2t3qvQinx/Okjy7NVZhsfd/QlZzIZAduOKNjnyY0VH8PunvHgaIcmVhJ
	 aKRKE/RhseKN/vz86nukUDR2Fb+vs3P1zyKX175nipKIBUnic2bv8sF4eKNX2CxEVOPTh
	 7zZIfhLIvwA2s81H+iKGilXlFRfycWhVsmdaWTCIgfOac5qmF51dv/bq77LC/akTJ2dGs
	 ar//X9Aof73AKB3rq4hHxI0TM4GsSpAbylf4zVQk7RxPiHi6etIUWfvaalhMBodVPbw==
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=G2ZmsuqW;
	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 0FC2F606A31A
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:48:07 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2DD91F031E6
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 17:48:07 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792691287;
	bh=MGotvCzhWr/lonfJnRU59oPcrOTBROzb2+c6xsa3Gm8=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=G2ZmsuqWEkBNHwHLkDIFwTgdwWMAd3VNDMwaCMWpekNralQaK67EgcCV65cGgVuvE
	 Z1t4l+1ZaspZDFN+aExiW1/gzzI8+zKtPOP6pqWyU5MA/tUfYkLXCYYJmBVhVtLw7F
	 wkYsKr/O0pFcd6I1qGPFnd2xcbVJ3SzKFDsMKzE4oSLjm1jMKrdQ3BsGddjo+7vWbt
	 4csvW/KjdE1ca6xD1BLQ1AYh62VR3KYJC29nAqEpcYS9NA3vjLZv6BhuC6p1UCrweR
	 VI96xsUqb8q+e06o9xbKIUxqB0WWBg2ALwreAZu2V/QOMgHqiUCp56/5wkv7KEDc7l
	 cvBD8yWEqNB5g==
X-Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-5ba35c0df4fso2242867e87.0
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 10:48:07 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBy/vlYfs4eA6WA11cXUhqKRJcptuXNqMiaiDZyC4BPTuKOJ8Gx5roAe+im0+DERsPmpIH3dzQQ=@vger.kernel.org
X-Gm-Message-State: AFq9FYINatprmGTRGGt/Aolm/qzEEJkZ4XFoOLvEI+J8ru3vUdA4aVam
	sXc8j4Cy4MgTwkOk4f4HjoBsREZ1zo/woCw1jJTCFWf0G2j22lPipMVTAi83OPyeLV+xTl0aN6Q
	6IryORRqvHdTNg82TFaUlJYTwLz5X8aI=
X-Received: by 2002:a2e:b88b:0:b0:3ac:4ce6:8b73 with SMTP id
 38308e7fff4ca-3ac4ce68e14mr12334331fa.22.1792691286350; Thu, 22 Oct 2026
 10:48:06 -0700 (PDT)
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
X-In-Reply-To: <0225eac7-1432-4d46-8649-2ad864aa26d4@ovn.org>
X-Gmail-Original-Message-ID: <CAL4Wiipm9x5LekCb2WTo1CfqihwRY1=rV0W+KdS-FVA_pRCj3A@mail.gmail.com>
X-Gm-Features: AclHuK-omgKLVDEOSqFcU4jhRjUPSbk60eGlMwcbvEyU8LVQvfW9BHbpDh38hkk
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>, netdev@vger.kernel.org, 
	Aaron Conole <aconole@redhat.com>, Eelco Chaudron <echaudro@redhat.com>, 
	"David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Simon Horman <horms@kernel.org>, Eric Garver <e@erig.me>, Yi Yang <yi.y.yang@intel.com>, 
	Jiri Benc <jbenc@redhat.com>, Pravin Shelar <pshelar@ovn.org>, Jiri Pirko <jiri@resnulli.us>, 
	Victor Nogueira <victor@mojatatu.com>, dev@openvswitch.org, stable@vger.kernel.org