🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7787

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

#7787
From: Eric Dumazet
Date: Tue, 27 Oct 2026 08:26
57 lines
10069 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: <20261027082604.1485903-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-352280-linux-kernel-netdev=dewy.ru
References: <20261027082604.1485903-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-352280-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 5/5] net/sched: act_ife: do not consume the inner header on egress
Date: Tue, 27 Oct 2026 09:26:04 +0100
Organization: Usenet Network
Message-ID: <20261027082604.1485903-6-edumazet@kernel.org>
References: <20261027082604.1485903-1-edumazet@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1492631"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:58mw9pOqk6QpyIANm6nCA/YkWbs= sha256:/4wqoJ2OmRhGcrou6XDwYaxB5yCrIKyeEoaxTc+Ijtw=
	sha1:IEAIpGT36MmqyYtaieowqtVC0HM= sha256:wQaD8REoyCorqKrthObgLrmuu6pA/2x+Olah0FMaLb4=
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 231B0125BDD; Tue, 27 Oct 2026 11:29:21 +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 5rMsEOEzMmdk;
	Tue, 27 Oct 2026 11:29:18 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352280-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 0A534125BDC; Tue, 27 Oct 2026 11:29:10 +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 0787C2CA67; Tue, 27 Oct 2026 08:26:47 +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=1793089606;
	b=E6TcwEPwoayS1mBZcdPJU0DV4dL7Pmjrl181rOZnSG/yk3fdXbptS6ARrj3fordyOjcH
	 n0mN6BnIMi0G1mGTv0jCbS0Ztr78BtgmOSHMH91mB5vy3TeJi92bN+pXC/3KwFPvDAh+A
	 F6qIIYVt2yDSbOPYHoo8a6DV40gq6DlM4e86oTnTzYxWuo0aVPqBW+To5oZZG4D9rrVbe
	 dHiefYwMD4/PtM7MtRW2a3K2U7CTTeXd5HhvxA9E9D5uvDgBv71o3h4w96KQWbfEQwwRF
	 qiW/KBDRMyXf1RCiwqjACkPXPFQgaMePKZUa3BwjoS9oomTd49ryKqYQTAogC4RG4Cg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793089606;
	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=5JY0XwCUVmq0ZIWvM5YrBPhpj1LQG+d/DFVJav9EKUJ/kk5GLrgSWLlOebTw6K15LYLt
	 XO+PopFH4+LtvjX9D0IUrIAWEKp3057JL7r7y5wDdZ+kj9YuX3qC+ZPUUieH3EfHU+05y
	 rAIPx7x3GH/JAjyquAdR+WpcBvoNAJSsij39PWEb3Gw6e+uffBnEaTP/9ZUYE3wXUwWgp
	 e8pNfhUWBMb3nitCaIBPvHT83ThgScTNLSQgt3zVJRfRAiI5qFDnpE9n9Gai+HhqEzkYW
	 w6SDhMnL2eb3XIPurVlPdP+3tSEokHUE8wUv2iH8m+u5UI7QuftXwkR9JFBOZReQEdQ==
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=O2aiKLSh;
	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 D1163606A322;
	Tue, 27 Oct 2026 08:26:46 +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=O2aiKLSh
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=1793089605;
	b=dmAAZpn/5bnQH1beoMtQHj3RCelegt9kUEqvLVWWzt3YT3TR2ftA+tH0gaNST0hZMuau
	 fWOidJ7AsdbngCIrrgzFmpdpiS3j2B3744rq6diA0JayHFgwNfKlE0Bludzm3p01Y5Y5X
	 7DUMwW5/LM67rIbiUWCpAISpZALEvvkWqrIhGG8bmwAtAztrtd6rXrfxni4upWJDzb+Go
	 1kCK9Fw7ingFs74sOSD3fGzdB1KHf40MZr8o+MC/a+M2Zm15ukc6n+Ic+2+sI2wDQzfL0
	 yN/ZCTV2MLmsyf7DSCMu0SlkPWvlQjFed8w5dwFPLW3cQcPpsnmisLFsTRMktnx8Lqg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793089605;
	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=iQexALRKkTjgcwH2oVLaVW9m+WkCHNY8PBWjMVbcP5Owex8Eac9MQht6ENouMAXAhZ2n
	 dnHf8XZgtNi5id00HSw83jKiQaCddSjMpy/q5uIeh69VDMqNzV4mwswdYLYuRIV8xf1mn
	 mNJ2iZLnLKmS8IXubAf49rUcROqi/S9VVKYqQMa086bRiB/EhvIsI4r3QRwyDQtX2qPJ5
	 gGFzrhP4a3RSaHbXn9o4oVmBpkqEFB5bSzq6ZGdC623LxnJLNZ7Fny06fAHvvzbgfZTAw
	 nDwv/HZ8tgAOcYWv7OUPAqkk54KWsq3uTBTptP1DbYF4FL4d9BMQu39y22UBFFysKvw==
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=O2aiKLSh;
	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 54E09606A31B;
	Tue, 27 Oct 2026 08:26:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 069071F01825;
	Tue, 27 Oct 2026 08:26:40 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793089604;
	bh=2mAQAxNJCmgorWtFYC1x4ukB0tp8HVcxnxU1mYBs9GQ=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=O2aiKLShXReTJCgUIhmKSGZFMBb1Okr2Lt3LXRJAKrbuQTwrd5O8bkiaog1wmxOxy
	 eu2iL4be2Fqp8EsiSnaeMGFrIKgin4x/wW4HpPQAIOkakuVZJG8nFVlHNOkg2jbbww
	 Psi/gcfqt+eD9uzmQ4Jw/Y40Jtq5AWSBzu2BtANE2LlUthfLlNDeqXUuHcUUmLoy4Y
	 oaoAwBIMcdeudiZM/tvXWDrGmUT01qpfWydgqNAFgQfxh3G8BIVTGuZI2nFekz2d+C
	 1+goT8Z07/IP1ZCwGrIoZeodfugM9olCnZC92yDVLoA0afEmroe1z7ltiVacYmPM7C
	 H91hZm19eJj8A==
X-Cc: Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	netdev@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: <20261027082604.1485903-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