🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23613

[PATCH net-next v2 1/3] net: qualcomm: rmnet: recheck the aggregate after flushing it

#23613
From: Antonio Quartulli
Date: Fri, 27 Nov 2026 15:08
48 lines
11177 bytes
When an skb does not fit in the pending aggregate,
rmnet_map_tx_aggregate() flushes it with agg_lock dropped, then jumps
back past the skbagg_head check. rmnet vnds are lltx and can share a
port, so another CPU may start an aggregate meanwhile: it is then
overwritten and leaked along with the packets chained to it, or
overtaken by a skb sent without aggregation.

Reproducer, with UDP sent through both vnds from several CPUs:

  ip link add v0 mtu 9000 type veth peer name v1 mtu 9000
  ip link set v0 up; ip link set v1 up
  ip link add link v0 name rmnet1 type rmnet mux_id 1
  ip link add link v0 name rmnet2 type rmnet mux_id 2
  ethtool -C rmnet1 tx-aggr-max-frames 64 tx-aggr-max-bytes 4096 \
          tx-aggr-time-usecs 2000

The tx_bytes of rmnet1 and rmnet2 stay above those of v0 after the flush
timeout, and kmemleak reports skbs allocated by skb_copy_expand() in
rmnet_map_tx_aggregate().

Move the label before the skbagg_head check.

Fixes: 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")
Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
---
 drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index 7ee2bc33433f..048a6a35ea28 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -597,11 +597,11 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port
 	memcpy(&last, &port->agg_last, sizeof(struct timespec64));
 	ktime_get_real_ts64(&port->agg_last);
 
+new_packet:
 	if (!port->skbagg_head) {
 		/* Check to see if we should agg first. If the traffic is very
 		 * sparse, don't aggregate.
 		 */
-new_packet:
 		diff = timespec64_sub(port->agg_last, last);
 		size = port->egress_agg_params.bytes;
 
-- 
2.56.1
Technical Details
Message-ID: <20261127150827.785753-2-antonio@mandelbit.com>
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-372812-linux-kernel-netdev=dewy.ru
References: <20261127150827.785753-1-antonio@mandelbit.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-372812-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v2 1/3] net: qualcomm: rmnet: recheck the aggregate after flushing it
Date: Fri, 27 Nov 2026 16:08:25 +0100
Organization: Usenet Network
Message-ID: <20261127150827.785753-2-antonio@mandelbit.com>
References: <20261127150827.785753-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="758171"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:C0CzG/sClgavk3kH8XgxkcJlxFM= sha256:c1/x0pe0XFwSLPPxfbnLkMYVbmcLcdEYxPLr745N9Ao=
	sha1:IpWitgq6JMmmOptfwj1d7/mglLs= sha256:g5yWv/6/zZlfcIq0nvzWOYRUh5/4cSdrIr0WA50kdoo=
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 53F13125F63; Fri, 27 Nov 2026 18:09:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	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]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=mandelbit.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 R-Tb6_-KOnUQ;
	Fri, 27 Nov 2026 18:08:58 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-372812-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id B0B4F125F61; Fri, 27 Nov 2026 18:08:46 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id A2DD560446C; Fri, 27 Nov 2026 15:08:45 +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=1795792122;
	b=uy2uJHd8cy5nQdHr4hT/WfGOndSY6lWD3ncnX0UTg/I87XNuIrphL0YFPZY+XdmpQVuE
	 IvTcHTE7iJ+hp8b6vnrD9vLVeUYy2Qc/3BZ6xqcode1/4ryeSZPHhPFTevUJYm7gsDC6B
	 CJ6L+7DjBFxlLKJrqyAM4BlEceZLfuhttSS8wkU9Wl411dZlTxENyuhkGTAHr17zLJ9zG
	 QNU9i3wXOWpeZm8F4m/m2lu8nGFVFcVbpnMMqMHtNt+px4SX5xPtgJIf9++SFShOyxsLE
	 7NMuIfmk5MbOYpw6ub/v67shHkPjATDrzPANfpMiLOxeSJl/1S1TYZQOsGGtBIsX8Jg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795792122;
	h=X-Original-To:Received:DMARC-Filter: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:X-Rspamd-Queue-Id;
	bh=wnREu1DivVRBdVLiud6/AG7sCceCRA6xn2hZdTRplvM=;
	b=sG3l2xw/QGERJrFGZJRYUdHblX/wh0mBn28ZWrIqkN42inyDcqHXKoiHf8j60xObTH94
	 5pBKl2d9pPwv4ivcT3n1Lci0GVphiOc2UhepqDuy201reaIvGZuaq/xvvzqF1HGBNnXUs
	 s8zqHFunvCxCHIGpRqClBy4xW6KfvRe9zxugFdvlT/hvKMMgALSxDz5tUSR9TD/TlohuR
	 3klYxKsAB1Z3AYU0EjRPm7Ztp3FyyufZjx0xwY+M/oafVVvPDHCHwS1/hjkMxKsQHTAVS
	 I+rqWTtBuuWHYEUunIdV5wIPTMHp49Wyia95qYwLExc+mBB9SNAPrmNNrrFQ0iXZ7vg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=OJtiozAo;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.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 E9A1E606A334;
	Fri, 27 Nov 2026 15:08:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=OJtiozAo
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795792121;
	b=Yxp7Tx9TijtphIC7AUVMmat545fuNN0LbGbhoXJNFYrZICP9dJLk7VCwkrZE0ipNs/ZD
	 V2/x4NKr1bOBs6oD1xNlWI2fgh+P4YY7yd0/paKGXtJqrG6sgz4Ujs6WyYA7baH9GO/ul
	 CCuTAKzwGvsTMwWIEj1WoGL0PKtNbXa/m5/FIdZrkWgPWJEjKKk53PqZcZGC9WBo0z4Ga
	 gCImFoS6Az/PclbdvTtqoYEatiwg476KKM6aSr7Z5+8SrS69aEClb4TGoYl6JtTY0pcI8
	 7O6VoGIUxWdolLKUq13mktd8ncTMo7Xv1mRaNDmo46CUOaH9f946hTgzpAOWpse+nxg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795792121;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=wnREu1DivVRBdVLiud6/AG7sCceCRA6xn2hZdTRplvM=;
	b=RGVzEmIxAfhg+zmszoGDrHqupzvE+yxaTzUXjr+BTdqijwbHJM1PRR5uJkdr82NQO68q
	 RMUvd5I+liaxBgB23IHuCzW+9kHCYM57se6Nwwe9Q5A9zfFX2aseAoUCwVwnTiZ2VPtHE
	 +97tvuolkYAhTnX5kXtYmOAnUk8tVUliNYMfeCKrImk+S3hKbnthUfIqZWVHdZlltoGhF
	 cJ1t01usE5S/AWutkpFYZ7qTrqIqhSGaV+ASz6RW5CmqfAi5WKVQZDjsJjKXwUIr118T2
	 jdJac2mHHQYvJm6M7LZJarb9qKVfRxdUEH/ApPL5513+eVdU8F77AOMMHUHvuAQpG/Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=OJtiozAo;
	arc=none smtp.remote-ip=195.10.208.50
X-Received: from mout-b-105.mailbox.org (mout-b-105.mailbox.org [195.10.208.50])
	(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 31B34606A31C
	for <netdev@vger.kernel.org>; Fri, 27 Nov 2026 15:08:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31B34606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-105.mailbox.org (Postfix) with ESMTPS id 4jbcHl1SzVz9sHc;
	Fri, 27 Nov 2026 16:08:35 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795792115;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=wnREu1DivVRBdVLiud6/AG7sCceCRA6xn2hZdTRplvM=;
	b=OJtiozAows720+CpZ+7XAxyfPzQsfE+rMuN5VGSs7BTp1s80AEOqXpS3/WVG74NQG74KyW
	5BxHIXN3Om7X9T8ZrqjDKTODeqTQAcUHP1ktHhDFbUdKI8fk6iT2wCOp4u/JAxpTLnxHDg
	aVnAhAvWisAV6ZfnVc5oBzRLxBshkAP5I2K/nRGa8AnTjLcdV3ck6Gdd0QJH4tRDt3IyfJ
	2Crq60n9BWLkkZB+J9EXB+fuzFqBoQkfHKgC4Q/04BV9jWwA3CzqtefPh58NE1e/lKbW7Q
	MaJG8wsr/kfDVm/hqE9pxustvThYaToLQHYaDlaIKTivlMq1KaVaumsA+MH5xg==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=antonio@mandelbit.com
X-Cc: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>,
	Sean Tranchetti <sean.tranchetti@oss.qualcomm.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Daniele Palmas <dnlplm@gmail.com>,
	Koen Vandeputte <koen.vandeputte@citymesh.com>,
	Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261127150827.785753-1-antonio@mandelbit.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-Rspamd-Queue-Id: 4jbcHl1SzVz9sHc