🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12030

[PATCH net-next 2/3] net/sched: act_vlan: size push_eth in get_fill_size

#12030
From: Linkui Xiao
Date: Fri, 06 Nov 2026 06:41
66 lines
11615 bytes
From: Linkui Xiao <xiaolinkui@kylinos.cn>

tcf_vlan_dump() emits TCA_VLAN_PUSH_ETH_DST and TCA_VLAN_PUSH_ETH_SRC for
every action installed with TCA_VLAN_ACT_PUSH_ETH, but
tcf_vlan_get_fill_size() budgets only TCA_VLAN_PARMS plus the push VLAN
id, protocol and priority.  Commit 19fbcb36a39e ("net/sched: act_vlan:
Add {POP,PUSH}_ETH actions") put the two Ethernet addresses in the dump
without putting them here.

get_fill_size() is the per-action term of the budget that
tcf_action_fill_size() returns to the core, which uses it to size the
netlink skb carrying the action, so it has to bound what dump() can write
rather than describe one particular instance.  Commit 4ba61bfd4998
("net/sched: add get_fill_size() to the five actions that lack one")
states the convention: "Size every optional attribute unconditionally".
act_vlan already follows it for TCA_VLAN_PUSH_VLAN_ID,
TCA_VLAN_PUSH_VLAN_PROTOCOL and TCA_VLAN_PUSH_VLAN_PRIORITY, all of which
are sized even though a PUSH_ETH instance emits none of them; the
push_eth attributes are simply missing.

This does not overflow today, and only by coincidence.  A PUSH_ETH dump
writes nla_total_size(sizeof(struct tc_vlan)) + 2 *
nla_total_size(ETH_ALEN) == 28 + 24 == 52 bytes, and the current budget
is also exactly 52 bytes, because the three PUSH_VLAN_* attributes that
a PUSH_ETH instance never emits happen to add up to the same 24 bytes the
two MAC addresses need.  That leaves zero slack, and nothing keeps it
that way: the moment any PUSH_VLAN_* attribute is made conditional --
precisely the change the convention quoted above forbids -- a push_eth
dump no longer fits the budget, and building the notification fails with
-EMSGSIZE.

Account for the two attributes the way the rest of the function already
does.  Nothing changes at runtime: the budget already equals or exceeds
what dump() writes for every instance, and all four consumers of it --
tcf_get_notify(), tcf_del_notify_msg(), tcf_add_notify_msg() and
tcf_reoffload_del_notify_msg() -- allocate at least
max(attr_size, NLMSG_GOODSIZE), which is SKB_WITH_OVERHEAD(PAGE_SIZE)
and dwarfs a 24-byte difference.  The RTM_GETACTION dump path sizes its
skb from the netlink dump machinery instead.

Tested by building with CONFIG_NET_ACT_VLAN=y; net/sched builds with W=1
and no new warnings.

Fixes: 19fbcb36a39e ("net/sched: act_vlan: Add {POP,PUSH}_ETH actions")
Signed-off-by: Linkui Xiao <xiaolinkui@kylinos.cn>
---
 net/sched/act_vlan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 6a375fdc63dd..e666004bb919 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -348,7 +348,8 @@ static size_t tcf_vlan_get_fill_size(const struct tc_action *act)
 	return nla_total_size(sizeof(struct tc_vlan))
 		+ nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_ID */
 		+ nla_total_size(sizeof(u16)) /* TCA_VLAN_PUSH_VLAN_PROTOCOL */
-		+ nla_total_size(sizeof(u8)); /* TCA_VLAN_PUSH_VLAN_PRIORITY */
+		+ nla_total_size(sizeof(u8)) /* TCA_VLAN_PUSH_VLAN_PRIORITY */
+		+ 2 * nla_total_size(ETH_ALEN); /* TCA_VLAN_PUSH_ETH_{DST,SRC} */
 }
 
 static int tcf_vlan_offload_act_setup(struct tc_action *act, void *entry_data,
-- 
2.25.1
Technical Details
Message-ID: <20261106064114.3592670-3-xiaolinkui@126.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-357786-linux-kernel-netdev=dewy.ru
References: <20261106064114.3592670-1-xiaolinkui@126.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-357786-linux-kernel-netdev=dewy.ru
From: xiaolinkui@126.com (Linkui Xiao)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 2/3] net/sched: act_vlan: size push_eth in get_fill_size
Date: Fri,  6 Nov 2026 14:41:13 +0800
Organization: Usenet Network
Message-ID: <20261106064114.3592670-3-xiaolinkui@126.com>
References: <20261106064114.3592670-1-xiaolinkui@126.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3812481"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6xL52kGBht/8hKCBMJO14adj9YU= sha256:2Yy3pruJJAecOuzuSIfq4c2Xy6v95VQZSdT90oIKTUo=
	sha1:ipAaDLHhE49mY9Hmz9LfdnSlotA= sha256:JSgzOqPN7FoVW/JnREiVEkHLFoLRsL0pKSVzJIAOkFQ=
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 046E9113183; Fri,  6 Nov 2026 09:46:15 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=126.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 3pBeM7kjBQs0;
	Fri,  6 Nov 2026 09:46: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-357786-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=126.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DC9E311317B; Fri,  6 Nov 2026 09:46:03 +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 ED5B830EDC; Fri,  6 Nov 2026 06:42:18 +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=1793947338;
	b=YDI/NpQbTYpWl9MUxPbM91SP63vfGwSxMpmF0drdNJg/9jyVwgGOabMp2QFr5nAkioh5
	 sUFbUWwciLrMBFCCZDo0Ut170/dOqSuXUUkMZGIu/YB2EJXhO635zo6Shaxl/C+PMHcOO
	 viJf2lCvwf8GunTp7OXVNtPwlbt+cMw5kt1tGA4XRaYmuvMFzzI1Z4AAqtzSWSVCcEOV7
	 Dv0RmWLrva+hq6Vxf4WlKwJbH8JlRVXKSTwClvW8D6ws2Ifh0GT++5lEuy2ogFlKaxzez
	 kZldTX8UveWUPb8H+km7FhS39OzHm2WCXeSyORPb/c4z5kwT6FZKeivP4lQb+4su0ZA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793947338;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: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:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=ht+KGDq4apws2pxXUS2+kqpptXwtJfA+zxTTVVaGiZQ=;
	b=VJx5qyEtQmg9uCV4MxMb17HWMEoLVM24jP+pnIss4lw5E9c00JULGPweHNF1PY0uEEYp
	 qKAuR7PUx8/Iy+uKMHjCYEiABDSErGERU68NACnBrB21kedaOwrcVc7ZdN/Mju3Uuijn1
	 CScgwFzWUuv2fepomOW0t4QPaweFJrJNTN5HsrawZ3GhVA7aPGmY059RXZNjaxVhUuQsE
	 jFuU+MU/nwePtIL3pzWdeSCrczTilZFM/YK65U84G3seEcBWLv/DA/vsxaQUgA3RkSQiH
	 htxKEKuZIo/rHIgKy0rqMm4i1tENYqjsCbcKpUOn6doHw9FI/vb7qlySxH2LE+bAzrQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=iRX6sOQH;
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.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 995AC606A326;
	Fri,  6 Nov 2026 06:42:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=iRX6sOQH
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.7
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793947327;
	b=F2Kf3nyA71gZG1pb+Iw2Tf1vV2S7uwmWe9VHWoj6b/A5XNiO90GdFpqpN6sH281k5dm0
	 O916iAvP5qu19RHBmsPPW/mtPpSX7bL3zf1x7niIU+NeVkYwxwk5FotagaOKXC3Jyicfy
	 q8P2eKIp+Y1c5Y7k+7L0RN4FvlMoaAKr5Isa9tXEggi8offAsbzgPVtXn3KCZGRac+hnW
	 ZcO9YkYIWjraBX2clWQkFuxSYTEv6WVfwFsiM+ArtfAlPVuQluxoli6g8hRQp2s9w1ZR0
	 qYLPvsML5ktdpbEPcLYaXU1xf8eATliXV22EZ9MnsTRccf9uJ+p9iwqS75fhZIb7n/A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793947327;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam:
	 X-CM-SenderInfo;
	bh=ht+KGDq4apws2pxXUS2+kqpptXwtJfA+zxTTVVaGiZQ=;
	b=VeSXs1q6QiGZgQAsr4IG5NAUr6dUc1gyStDY2lKA7fy4g3s1rBPmNiFx45Tq6iO9LzuZ
	 um9dUXHnvMClhvpL0k1EJBT6UHoOqV2Pd5D9wQKbPwEJm/zx3p6fnk/T/51ZUM2TSPiYr
	 78YneHPDrml/5YX4yDHELdeO+BWMrcg/2NS1XQUI6jpa2t1DpK+OfN9yGaYZgn2qyVzuI
	 2Ue+sliC9tqzD/wNLKBptacOI9bNtfCopRygjCVh9RVgSjRkBDKXfTqMcTXWZdXFwUr9F
	 b1RbE5iMcBr08C6U1DaGjuNAAWgBLq8YVeUh+K4EGYtc7RKT47F7dDWjTOyjfjJyzpQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=126.com;
	spf=pass smtp.mailfrom=126.com;
	dkim=pass header.d=126.com header.i=@126.com header.a=rsa-sha256 header.s=s110527 header.b=iRX6sOQH;
	arc=none smtp.remote-ip=220.197.31.7
X-Received: from m16.mail.126.com (m16.mail.126.com [220.197.31.7])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20667606A32D;
	Fri,  6 Nov 2026 06:42:04 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 20667606A32D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=126.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=126.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com;
	s=s110527; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=ht
	+KGDq4apws2pxXUS2+kqpptXwtJfA+zxTTVVaGiZQ=; b=iRX6sOQHLkmpDmG02Q
	66jvepKN/lwB1Ug6wXwTkBUq0EPvAHTT2LvdUmkiPbpuS+RJCGdyQJ0T3X9+DLln
	qYiE+ncCSlS5lruRsKfdYY7Ax11mpm+jcgMlhtqDooNLHrSHqf/cHHwVfihHDfAV
	EtC28qkTDxM5eMd8FjfJRTbQI=
X-Received: from localhost.localdomain (unknown [])
	by gzga-smtp-mtada-g0-4 (Coremail) with SMTP id _____wDnR+uMdu1qZ7kzCw--.3170S4;
	Fri, 06 Nov 2026 14:41:21 +0800 (CST)
X-Cc: netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linkui Xiao <xiaolinkui@kylinos.cn>
X-Mailer: git-send-email 2.25.1
X-In-Reply-To: <20261106064114.3592670-1-xiaolinkui@126.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
X-CM-TRANSID: _____wDnR+uMdu1qZ7kzCw--.3170S4
X-Coremail-Antispam: 1Uf129KBjvJXoWxWr1fZryUJry7Cw4fury8Zrb_yoW5uw45pr
	yDuFZ5Cr1DJr9rXrWktF48ua95WFn3Jr4UWryqk34fAr15Kwn2kFW7Kay29w17Ars5Cryr
	AryqgFnrWr4Duw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UPPEhUUUUU=
X-CM-SenderInfo: p0ld0z5lqn3xa6rslhhfrp/xtbBqBHXrmrtdpF28gAA3k