🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6367

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

#6367
From: Jamal Hadi Salim
Date: Thu, 22 Oct 2026 09:22
69 lines
13505 bytes
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;
 }
-- 
2.43.0
Technical Details
Message-ID: <ACT-N6N4.v1.r0.20261022051412-5@mojatatu.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-350475-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>

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-350475-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 5/5] net: openvswitch: ensure a linear inner Ethernet header on NSH pop
Date: Thu, 22 Oct 2026 05:22:22 -0400
Organization: Usenet Network
Message-ID: <ACT-N6N4.v1.r0.20261022051412-5@mojatatu.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>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="176348"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:hlARjFsJcu7Xh3IxAPN0AnbRiP0= sha256:J36rgq2F2D/xfgdOJhodT/FgSjGBCmpZMwTrdco4x8I=
	sha1:swmnCUMU3eNVO0sguMVrHv70ckU= sha256:mSvnDqiBpkIywWrviPPVhoJ/4aBEtm1sWJrYpbdJ2c0=
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 0D0B611120E; Thu, 22 Oct 2026 12:34:58 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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 (1024-bit key)
	header.d=mojatatu.com
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 QT9f3o0qH6Uw;
	Thu, 22 Oct 2026 12:34:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-350475-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 6C39E1111DC; Thu, 22 Oct 2026 12:34:44 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 7327626956; Thu, 22 Oct 2026 09:22:50 +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=1792660958;
	b=Ed4Xsr19inGUPLRl3dvccAl3SnwyMsMVQIM1BfvTMopWojjICZr0h6SSnlvtbQdq3p2c
	 Y9/RXRDzJOE+udKWjZkpzoT1RfGuZZaFf10u3dTq8DotpJSb0GDJbWTfDyh9+/AT+voi6
	 Vl7yHoQhwcd7bgv6RsxHYbqQuFqCKrmlRl5v9faBCdKIKfd3bQ/sjWRWTTH8jMR+ylvDC
	 fQNmfOrXytSs//oFWYFigh7adcUlWo1/z/+06gkF/+uFB0Bko4Gh/hcnYET9W7W6gph2o
	 r3nh78usMmRD6Vp+qWrk9NFGjVqZRtN4iileQlKomOmk794n9tsNKjyE2eWf3J4FDVw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792660958;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=icU9YO4XysvgHIVlrdyvNfTHVdM7KlIy9zFDYV/1joU=;
	b=IvPjdatn72abXRouJbO0EOV/CSEeTmo0+as0OLJpN0Keq3wsMpxvOdCSh3gO7NGd0OWM
	 OPHczNs7heetggAJoHr77XaVzcHURTGqVXP1p8q4zSigJZAA5uqoQjtPsxzKxnZ2r/i+/
	 keT8hDV+6fQCGB6P1hfGPg/0vG3F6B5gWXK6/EJWmn+fNODtRlQiDUhFpp5zQi399AZC2
	 Y7MTNy7FMWkS825IfVByPAjNXJ8hVgwRB1gb7ij+pAcdMgo4Uo1tFSTCXhDecuGcqXYKw
	 8ay1IvZQctZKe2DnUVaj+Ggnu+NJmvELfUKnrLj9H0QaiAmv2/ks5j+zVkKAWG46bsQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=ANhnSiVf;
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	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 8568360A260B;
	Thu, 22 Oct 2026 09:22:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=ANhnSiVf
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.180
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792660957;
	b=thNBSIxOGvdZFOL/puljH3ttjCSQ3J94Pgmgo599zZrejwq20IO5cwYC0Lhe07heMyI/
	 jgJC7PyF4Hpd+zWwQYkbNsdrC0RJPz7yPoeUZoXuFmIZN7pYSfEmYP1NKXjMfEXOwNkp0
	 nAnuGPoDN6lEzE26cBUT5BoVivZGQACKeqyFoCBFW7d/RyaS7E++i8NOvsrVmRSP2q6HK
	 7YejIXlqna481VrDjvBFJAOEIZcQyxoDQJ7502t3VRVqJ+smYQVexdFxs18MhlrjhBvuq
	 ZTca4rVeOtsefzROmnvXZJwDeyq8BADCD7VakvojVHwME89vp0jakqBZ/7afeVNqSLA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792660957;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=icU9YO4XysvgHIVlrdyvNfTHVdM7KlIy9zFDYV/1joU=;
	b=0OaKBWmpExm1irsRnCjRH+mYc73tea1CII4HPXlEP6gdUxpBA/hjSilRNtB4Pp3sPnMg
	 ZlJJvzntYESsXXjdAV0ln+YukVo7k+beT8doGgjW0euZMTxhNjGzV3WS+VimbGtqh2+zW
	 FIXSGqEwXA0EhTSo+hLMhAQ51C8UgoV8FlRX2kOxTweY6AppmdagfUJCpZDkRATGuYwqI
	 9ff6nr3CldjLRC+puSk6yGcRZmtSUiJp7FdS+AH4U+nc27Ml+ZFnHzCP66B5i9Yha69Eq
	 2RHv/kcf3m709TX2Gr9DAb/AQ9GXWYU5lyzLio/VB2WayABVkjRz7Lq/LEZ+OURI1dw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=ANhnSiVf;
	arc=none smtp.remote-ip=209.85.222.180
X-Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 557C0606A332
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 09:22:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 557C0606A332
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-93cb1c0e851so115988085a.0
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 02:22:37 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1792660956; x=1793265756; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=icU9YO4XysvgHIVlrdyvNfTHVdM7KlIy9zFDYV/1joU=;
        b=ANhnSiVfzgB9MNcKy4OsRyOoBJPY3Gg2xPECaa9IuD/0Y94JUV7KpwwC9JBBmgXKX3
         7R/T+gVz2BoscttxgoKYb3emHKYJkgGxHjkGjDpcOePbaweY4/AHbAYIts1hoD2KbBKI
         1JF8gqqozwanGCLuNbgyS5FTNNwMW38eXf4Js=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1792660956; x=1793265756;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=icU9YO4XysvgHIVlrdyvNfTHVdM7KlIy9zFDYV/1joU=;
        b=W333ac+WBbQjkf4bltaZt2McTrp+J8fj3s8KYK6cQZBQsQ7VikYptbRcQpUDNKjE2B
         hSJWMBCwkGwpnS39RK7y2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cGNS3S16WwrU=
X-Received: by 2002:a05:620a:294b:b0:93c:735c:2477 with SMTP id af79cd13be357-93f57f6fbd4mr922058985a.21.1792660956306;
        Thu, 22 Oct 2026 02:22:36 -0700 (PDT)
X-Received: from mbili.waya ([64.203.83.2])
        by smtp.gmail.com with ESMTPSA id af79cd13be357-93f56e2a60fsm469884685a.41.2026.10.22.02.22.34
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 22 Oct 2026 02:22:35 -0700 (PDT)
X-Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Aaron Conole <aconole@redhat.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	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
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <ACT-N6N4.v1.r0.20261022051412-4@mojatatu.com>
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