🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23583

Re: [PATCH net v2 1/2] net: reset the mac header in __dev_direct_xmit()

#23583
From: Björn Töpel
Date: Fri, 27 Nov 2026 14:38
34 lines
9186 bytes
Jason Xing <kerneljasonxing@gmail.com> writes:

> Compared to __dev_queue_xmit(), __dev_direct_xmit() is the only open
> gate for skbs whose mac_header might not be initialized. A few months
> ago commit c2707480cfbf ("net/packet: reset the MAC header on the
> packet-socket transmit path") solves the case where AF_PACKET skb can
> miss resetting mac header if a few conditions in packet_parse_headers()
> are not satisified and it will cause out-of-bounds access.
>
> Similarly, Petr reported an issue about AF_XDP path where copy mode
> can also trigger the uninitialized mac header problem.
>
> In reply to Petr's patch, Eric suggested to add the reset logic in a
> general layer to stop future issues like this happening instead of
> dealing with scattered cases one by one[1]. So anchor the mac header in
> __dev_direct_xmit() exactly as __dev_queue_xmit() does, before
> validate_xmit_skb_list() so that ndo_features_check() and the vlan helpers
> see it too.
>
> For callers that already reset the header the operation is idempotent.
>
> [1]: https://lore.kernel.org/all/CANn89i+aacS2PfaMXnimzGgbCLz-JSnqo6QyoS122Gf+kxya3w@mail.gmail.com/
>
> Fixes: 35fcde7f8deb ("xsk: support for Tx")
> Cc: stable@vger.kernel.org
> Reported-by: Petr Oros <poros@redhat.com>
> Closes: https://lore.kernel.org/all/20260817153957.3177627-1-poros@redhat.com/
> Suggested-by: Eric Dumazet <edumazet@kernel.org>
> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>

Reviewed-by: Björn Töpel <bjorn@kernel.org>
Technical Details
Message-ID: <87cxrqgwzz.fsf@all.your.base.are.belong.to.us>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372780-linux-kernel-netdev=dewy.ru
References: <20261127105347.72997-1-kerneljasonxing@gmail.com> <20261127105347.72997-2-kerneljasonxing@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372780-linux-kernel-netdev=dewy.ru
From: bjorn@kernel.org (Björn Töpel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 1/2] net: reset the mac header in
 __dev_direct_xmit()
Date: Fri, 27 Nov 2026 15:38:40 +0100
Organization: Usenet Network
Message-ID: <87cxrqgwzz.fsf@all.your.base.are.belong.to.us>
References: <20261127105347.72997-1-kerneljasonxing@gmail.com>
 <20261127105347.72997-2-kerneljasonxing@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="751386"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:K4iyUOasncmKqxmgVEVpLpdhK+w= sha256:nQFSsQqvxT9cf8NIEmygGvwGqg03qXM+pcUPwI9q3MQ=
	sha1:jr6gnP5RLcjqD0/ebL5CCS8cgYY= sha256:gdKLNrgcS4Rm3Kjr68IuKAzRSVmzvMULKZYKHhJCRhQ=
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 38F86125F61; Fri, 27 Nov 2026 17:43:16 +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 OdZcZEWiuiKT;
	Fri, 27 Nov 2026 17:43:12 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372780-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 583AD125F5D; Fri, 27 Nov 2026 17:43:04 +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 BC8183CF21; Fri, 27 Nov 2026 14:40:39 +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=1795790325;
	b=MFjOPcsWmVXwSW+Xnm+7TrjnuatUxa2796aCBzmUOHOIKvxik3Ro/K/UXiTYFO6dTcNe
	 Vttx/aCDh63olYyrVBECBsRqBJjHpJtvaqqFAXa1vwoqe3GX30E70AUnS+w9c0ivC2Ucj
	 be+pFTx4w7V/cyy14ioQSqJiQ1xcZtM0ZdVvECZhBglLiY2kd5qq2x9Dk9PtbYtJIwkNh
	 2MXT/OJYiSm2ZAe/skh/YeSLXgeFIxjkoXmqqhl1IY0DAU73rFU+9WTdTSZVTjZYEcjiD
	 hebWq1KLx+NEwHRdAV4Ryzs6IOqTTE6abG4BwEpi+jbgmeLAS7OoM33k6vsuxnGVZyw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795790325;
	h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject:
	 In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=xJpIceYu2KxI6ncR8keKatQpZCcoR32gRrL57WMYwKo=;
	b=f4PDuuZfRmCXvgakSnx/jVY7Mi9s6WsEAsvZJ2yuedmW2/hYVNEICSBgtcnYEZdtwws2
	 yy1p5b1dlunXsTw2JrB0T/lV++TLnwreg0uHoIdJ0HpYT9DV1MWGCzPbOm2zddFlTDNzo
	 rvui9WhS1z01UAvVNG0JLnRyo/wFdFDzCC/xxlHEmNfYx2hpKJAGGO9Rsr3H+UXI9j8OB
	 BDQYsBRekDBpgHQa5D8Fij65k5wzVwDz3vHfJfg68iVYWJ7bI/qUpFWCGgbwRDIgczFjj
	 ac2uebkVZPBI2Q0OXXDPGNy6kpOcrsHGqWc8UTwClByTeaviwHgc9RXyWG/R6aFXxZw==
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=I+UqYskQ;
	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 54EDC606A339;
	Fri, 27 Nov 2026 14:38:45 +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=I+UqYskQ
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=1795790324;
	b=WWT0PlkF3eGgO34mReBkmYREN2Um9CEZPOc6Du77mf0/r3dXN39G4DudlE9bX/mFXnST
	 1A7LbUsJ4zbgqvhZUlBwIq8wN/W+wsbkLHV59puz+yqrLOoAzp7bMjCna8MeO4HdVYrpc
	 1F5O4v3xZDx1pQrOwP5u67BJJfybfyRs2Q63unMRuhBBgjGtTbjPqDMEmWm8RfbvMLlOU
	 /xZ6uFVvoeINXdkulmyixA6c0yz0iEtX4s4Jv42VDAtQHnZaxUzlQD+Czy0kp16fEJerg
	 B6y/ehNjeaLsaXwEmrpSJewudoXZdIH8wu/KI2KwzPHiWB8m/lD2HbJcnEK/5u5y/MQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795790324;
	h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References:
	 Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=xJpIceYu2KxI6ncR8keKatQpZCcoR32gRrL57WMYwKo=;
	b=yXipJa34oVl1fx9EeAU3FIJa/ezBhH5tz8t5z5E7TiuaJUYWtI9fXQ30+ZvchDhFp6fR
	 nAX8YB0srM7wANwAHpB58bIO7ZWLDR8MbAJaDIBeZIIjursEsEtwxqqtMd78F21FQvi1Q
	 WtLCV3JzVHaexBjZkuUlq7pDNMT7rVwqcmtGZ757G+7KXNFNl6KGYJsmD79kDbL0OvoKA
	 a3eDnjBAIwCMLc7jABrAytvDBqs7ovoHsffJlhrBJgsmiLi3s1HABKrqBiNIBtWSoSDlS
	 6Z2tK97B10YFE5Mb1n8un+S4MP4CA/skYjk7R2MY1Vr39Xl5YwphnjnhTr6JS1J4QRA==
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=I+UqYskQ;
	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 74CD8606A333;
	Fri, 27 Nov 2026 14:38:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 697601F000C1;
	Fri, 27 Nov 2026 14:38:43 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795790324;
	bh=xJpIceYu2KxI6ncR8keKatQpZCcoR32gRrL57WMYwKo=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=I+UqYskQCs6jwv4Cusi7O+4pkTVlALVF1TR+b+Kgf+/PonKcfSXU00z977gQ/tBcp
	 FGkyl4J2uQZKym3I7F+tDjiSBdEzOjUTx1xgOMfRypRpK0vzAaAHarr38o7eVYC+hA
	 DMzW/o15vea1pYkiMi76xXQqRmInwGYUX9TKpIB6u03wJfJ9alVRvr27zZS39FD8FE
	 0/vL3o0Xs5LyYAVK+tCdysBuzI+1oMzgIDl/Vm7t7yFKyIJZORfmBd9G9h7zNsz3ME
	 F9vOALJ60KMrJFwgsa9Ud56Rut7MVOEYa0MLOv1wJ05559wERQgvZqNeLaKJGuq7Ip
	 YayBJ2Zk0Aiyg==
X-Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, Jason Xing
 <kerneljasonxing@gmail.com>, stable@vger.kernel.org, Petr Oros
 <poros@redhat.com>
X-In-Reply-To: <20261127105347.72997-2-kerneljasonxing@gmail.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