🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8230

[PATCH net v2 5/5] net/sched: act_ife: do not consume the inner header on egress

#8230
From: Eric Dumazet
Date: Wed, 28 Oct 2026 12:27
57 lines
10053 bytes
From: Jamal Hadi Salim <jhs@mojatatu.com>

The issue:
tcf_ife_decode() unconditionally calls eth_type_trans(), which pulls
ETH_HLEN.  On egress this consumes the inner Ethernet header, and the
device receives an skb whose data points to the L3 header:

- loopback_xmit() parses L3 data as Ethernet: the "ethertype" comes
  from the inner IPv4 source address, and the decapsulated packet is
  dropped or misparsed.
- a real NIC transmits the frame without its Ethernet header.

(The __skb_pull() BUG this used to trigger in loopback_xmit() when the
remaining linear area was short is handled by "loopback: use
eth_type_trans_careful()".)

The Fix:
Parse the inner Ethernet header with eth_type_trans() in both directions,
then restore the egress data position and MAC length.  On ingress the
existing behavior is unchanged.  On egress, push the inner Ethernet header
back after parsing so the xmit path sees the original frame and later
actions see a consistent network header.

Conditions to recreate the bug:
- egress tc filter on lo: action ife decode pipe;
- AF_PACKET SOCK_RAW frame: outer Ethernet with ETH_P_IFE, IFE metadata,
  inner Ethernet + a valid IPv4 ICMP echo request to a local address;
- before this patch, no echo is received; after it, the echo is
  delivered and answered.

Fixes: ef6980b6becb ("introduce IFE action")
Cc: stable@vger.kernel.org
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
[edumazet: reworded changelog, the crash is now handled in loopback]
Signed-off-by: Eric Dumazet <edumazet@kernel.org>
---
 net/sched/act_ife.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 2afd68983ece40d8cae6c96af86e2ea65be476bc..3946a9589bb8fcd296e6f1f9234c00238df4d954 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -769,6 +769,10 @@ static int tcf_ife_decode(struct sk_buff *skb, const struct tc_action *a,
 
 	skb->protocol = eth_type_trans(skb, skb->dev);
 	skb_reset_network_header(skb);
+	if (!skb_at_tc_ingress(skb)) {
+		skb_push(skb, ETH_HLEN);
+		skb_reset_mac_len(skb);
+	}
 
 	return action;
 }
-- 
2.53.0
Technical Details
Message-ID: <20261028122703.2093730-6-edumazet@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352849-linux-kernel-netdev=dewy.ru
References: <20261028122703.2093730-1-edumazet@kernel.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-352849-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 5/5] net/sched: act_ife: do not consume the inner header on egress
Date: Wed, 28 Oct 2026 13:27:03 +0100
Organization: Usenet Network
Message-ID: <20261028122703.2093730-6-edumazet@kernel.org>
References: <20261028122703.2093730-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1768898"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:cBwtfwcDDDfU36BO0uUyWLdzqr0= sha256:zrGgkGgHQl9Hjkf4rLOEIlGfnJZ3NieuA6ltA6YwUHA=
	sha1:wIDT5kYpII3dt8yix9MiZ+M6eYU= sha256:FQ+MprEWjlcFu8BcnkTDMAoIRLYhaSWw98SHnTetFLk=
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 E1432125C36; Wed, 28 Oct 2026 15:32:59 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 HWD6pLNxZL1R;
	Wed, 28 Oct 2026 15:32:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352849-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 53062125C32; Wed, 28 Oct 2026 15:32:49 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 956882CE36; Wed, 28 Oct 2026 12:27:51 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1793190467;
	b=rMcMVMvBsaofu/7pdOU49gCgKPPXaJW7iMVlxFOqVd0jMOVnSNzQqpoVqYzGXflyEry9
	 1ziJOpr/PwU4TUb7hQYKRgsPdd7v+ciF/xfEWBpyg+YmlNZqYK3MepJSgjERyor0qspWz
	 H8Mxpa+Tbksyom7LejGsgL/eu6YFny/fV+Hi4xmypW/IH22X758f1L7nrCpu5KZp42cvx
	 EcHbGCCYOWA2GOh/SgdEsOdxUkYFdQ/9lzfEPutS11KQzko8eeB2zgt3btCJWPG3TT8OL
	 tXO6pRUWIOFO5CsgXsnYluLaDhs9xyIi4cVYDLMSJA47F2ZFO125nskUFEkegTdQ05w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793190467;
	h=X-Original-To:Received:Received:DKIM-Signature: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=2mAQAxNJCmgorWtFYC1x4ukB0tp8HVcxnxU1mYBs9GQ=;
	b=gXQ2bXF3rbyWIJ4xGT+WA9GIxzxWwV3wGA5os0/IBwj1hUQEZdhdMbUk5ka9EFimYTGG
	 u0tRpLcpAUMu6Yvb5BGXXYeVkAuQzpS4Kwhc3R2fGrI4xo9pQrdXq1CvDNh2R+stLcqYn
	 g9/WGbba2X9jJUMk067+5zPtSOuRvtY8E98jUtbZoLG3RyGrmMCKmBdcik+u5pPwmG6bQ
	 2wQCr/4+3++aJzj7TfnavpPMQj++9iMsWFwie6oNPXhcJynhFcMVK4ueY2MJRbFLK2kZv
	 ahZ10ExxkeKeA8fPv+v4+YEAEoQaXNeZnTQLu6Dwn6G5jujNrCQeYJ212fjp1Yv8qxA==
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=Ds59fc6M;
	arc=fail 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 27860606A333;
	Wed, 28 Oct 2026 12:27:47 +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=Ds59fc6M
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=1793190461;
	b=EKAup93L1IUnscaoOE/SflqeLkP19/HDEdc/mQ6R7PN4raaALqWqvUxxrdF4IlI8wM5Z
	 X+E3zaLVy8e0XiaIc/ysctX6b2Fr2gFems7XI1QszP+rVN63YzKrqz8odK948Ut7mfvmx
	 pPQshwTY43deAJCMAdKrlCnviltBcAEeq7X6yljwzU51mRndOSucbPr+76X1arkAcoE1e
	 9MN2rtCfmiiryHHdh4TCSCJzv2y+Si9VHk6kySkNiTbv8ZP63m4yybU7RAvH/Gh0n2Ztu
	 R75NXA3UxPtfwXR/JXznudX0q93VfbALmr4N4dchZq5QH7ugaS+KX3pllvBMKyAkdhA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793190461;
	h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Transfer-Encoding;
	bh=2mAQAxNJCmgorWtFYC1x4ukB0tp8HVcxnxU1mYBs9GQ=;
	b=HGSGaACXNumUDuwZLLVjqUh/Bxd1KMipoY/BbpRVbH1YOZg+vkALFqhF9RmYQ3SSNDyP
	 Tt/ARUX6F69vQ9/4VhbBKnogL8MrwHPAyyBN92uimuTYnmCfmKSEHYrGvZQH8kCh7MWHE
	 Fo/51HrqRqt627K3k+Roffzr6Q8CREVDNjBwN9eOSiVv2lM6xZEhWch9od3hShQ+4VScs
	 1Rd3etiLe4em50PAk3thhaCMVQ4Ih6o8HECE8VJNcDqGHgK0MbM7MQvL+039PfQz85Ld4
	 +oz/sIyxopXMpRSllZ8C8iws1rByOrDkr7f126HhKF40F5Jn5kh0RxAihKsi44MlZ9g==
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=Ds59fc6M;
	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 04A04606A33B;
	Wed, 28 Oct 2026 12:27:40 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D91D31F01825;
	Wed, 28 Oct 2026 12:27:36 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793190460;
	bh=2mAQAxNJCmgorWtFYC1x4ukB0tp8HVcxnxU1mYBs9GQ=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=Ds59fc6MMWMglh7fRHbOyulLCFSPawR9uXMzqF1bcvtJFAwG4FWblMy8HZbAa+pNU
	 W7J71hBfoR6quXsArwfh67ZURocLjUl9qVsT11Ob+6xmASSXwI3hhWuzepN3qiHETT
	 fYvqkWxCLLE9OM49er6vfM13uzJBzGyiczmeS7I4510DI5EUcAvoG9q1zPwBIc1qBe
	 NmO0gOBVmsE6v2L6UBeNndulSGmS4BAHkSsbRpR7GjvsgeL0n0woMwO5blewQiFZtR
	 VQp/2h7ghB27H87LiKQb7s1xSriLV98KQtwnh+C5Wb6eB6mbX1iS3igSaUab8x49fz
	 nRPc+MSV8xPHw==
X-Cc: Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	netdev@vger.kernel.org,
	bpf@vger.kernel.org,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Aaron Conole <aconole@redhat.com>,
	Eelco Chaudron <echaudro@redhat.com>,
	Ilya Maximets <i.maximets@ovn.org>,
	Jiri Pirko <jiri@resnulli.us>,
	dev@openvswitch.org,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Ren Wei <weir@nebusec.ai>,
	stable@vger.kernel.org,
	Eric Dumazet <edumazet@kernel.org>
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261028122703.2093730-1-edumazet@kernel.org>
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