🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23169

[PATCH net 1/6] net: qualcomm: rmnet: recheck the aggregate after flushing it

#23169
From: Antonio Quartulli
Date: Thu, 26 Nov 2026 16:32
47 lines
11125 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 soon exceed those of v0, 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 39d6d084e73f..73b04fe386df 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -600,11 +600,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 - skb->len;
 
-- 
2.56.1
Technical Details
Message-ID: <20261126163219.1744750-2-antonio@mandelbit.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372226-linux-kernel-netdev=dewy.ru
References: <20261126163219.1744750-1-antonio@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372226-linux-kernel-netdev=dewy.ru
From: antonio@mandelbit.com (Antonio Quartulli)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/6] net: qualcomm: rmnet: recheck the aggregate after flushing it
Date: Thu, 26 Nov 2026 17:32:14 +0100
Organization: Usenet Network
Message-ID: <20261126163219.1744750-2-antonio@mandelbit.com>
References: <20261126163219.1744750-1-antonio@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="508525"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ipEB8JUrwaicngufdvJlB47fQEU= sha256:vDT9t6KnODliZpObTAAC8aPbqbVBTiQmioY7xAyDyiU=
	sha1:IKC7xb8/QKWXkhE+m2wpWQ325EY= sha256:uLGOcrPQsgd8StUoH1vW65qfnG0c/jXVc48yLp6Ciyg=
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 9B0A8125EE8; Thu, 26 Nov 2026 19:33:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, 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, URIBL_BLOCKED=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 08OvVoNUGO2q;
	Thu, 26 Nov 2026 19:33:05 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372226-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3AEDD125EEB; Thu, 26 Nov 2026 19:32:57 +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 1D4D4384F5; Thu, 26 Nov 2026 16:32:31 +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=1795710751;
	b=5LAbrFZx7qaYrBQ/WJHZ83m9BQDnY3Q8oQEMzZ0IcwQsAElVaX3y3T9eV+mVwVzn1NO/
	 zdy8xFLpNo5TvixnGXOL+kWpbLgMiAlHwM5gugKlV0Q3taIQYlBbqKA1w6lSWRgKT31rY
	 6xeCd7homDwxRMoxVJiqTmw20v/81jlcuUIUm1jFSZrebPzRnF8vh/1uK1fxULBvp9+i5
	 +iqcT2qmYQ+Zm940/fgZUrt0JRXBsF1/Pgk5Fu84L0ISKXUz9oaP1oJESY4treQRNZGYK
	 WIP0NZOMOKLx+41XAlq/3Vf+EIiP2pilNfQYFA+r6+6OSeSvU0WihQN0fHaQPCKYoxA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710751;
	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=et1ZT7h51+8tWjs/YhcQm47JpYp2mp8eeYsMlD1FRhA=;
	b=s0anHS92RzXByayHwj28DY9vs013xKycEVDFH3L8MwJjOo3OlkuEVXZ9DxTbb2q0Bkjw
	 kCzw0J1JMNDr2J7HNoU64XYJtSr+Mg+3PMRX+SMdUMAx1Yw/edE1DHHvMVtVrKyni49am
	 zEphqsaVRtkRIbXddX5WOEX1t11hBGd4JbyafLo4PuS7sjg70Zyw84XyS2bnMC8XkBmea
	 ZlWGVgrwqApg/7tjUYjoNkfVpC1etFefbtDi7/XqISE29Q6RyPLEtlBAl/Jz8t1ASpSCX
	 9JiIWamUpXSZPKIvPbF8hO2S3MhDeumu+dDSMD9uuK90OJ2IDZh25YZuXGFngM5X3mA==
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=YKargoDC;
	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 E6FEB606A32C;
	Thu, 26 Nov 2026 16:32:30 +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=YKargoDC
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.40
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795710750;
	b=5L74KsBGmiwJjGtQ8z0bGr1xAlOrZbkHdV9ErYr3Nf75Ue3MyBM9i73M3hxHwtaRAX3B
	 FSvgkaoiobzlYFN6KXHP/d+VSjOH0w9WpDAQZuSs0oS4JYrF4rSfMA9BxPZ5C6u3T6zFW
	 WswrhXQPh3hBdBaqWs70/34Dv2ef00x5FHl4Tgb8pEi0QiGBA9NNpeR+VED6aP3EMxnbu
	 Yqz0ezGelfxjVUtGNpp2EhlO4KuOIYzz08q3lINl7weFKq5kmO2UtpPhJHniUUdtA6D1/
	 qWk0L6W/DZ2OIbKtif8ESC9l87Bze/OLahkhksXL7V5THWz0Zqalb6j5V5dsmN10SMg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795710750;
	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=et1ZT7h51+8tWjs/YhcQm47JpYp2mp8eeYsMlD1FRhA=;
	b=bxDsXSBtHgXgu2xv+tmiCnThsESKXubARljMyGl36V1poeURtWmgpZjkLPilFf+iUpXb
	 tCi6B/1tRhmKKQgThN1Sa7IUPTLHkVMg57RoSRRhAtAH2nmG+VuVVofvT7K/U9IHKu6uD
	 LnctdH2L3kXdVJebR6pCIUfKOGyS5mrEY+hmEPTeRwLKq/LnZzj1o3P59U+Y1ncEYPLVE
	 E/Ga7P9lhLcJZeSw3hLK6OzE5YF/NbPxpvL5+nsCmT8zKlcKvEHaQ6LaDhXXGKXXZlCh2
	 ir0MUBS4A0PvttpPsZ8Vbfx5v64q/RrhqqPxGfN5klfK/8pfIO2eZxWWqc1D9b1CcZw==
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=YKargoDC;
	arc=none smtp.remote-ip=195.10.208.40
X-Received: from mout-b-210.mailbox.org (mout-b-210.mailbox.org [195.10.208.40])
	(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 DF4E0606A31E
	for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 16:32:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DF4E0606A31E
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-210.mailbox.org (Postfix) with ESMTPS id 4jb2Bw6vhnzFq8X;
	Thu, 26 Nov 2026 17:32:24 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1795710745;
	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=et1ZT7h51+8tWjs/YhcQm47JpYp2mp8eeYsMlD1FRhA=;
	b=YKargoDC7XaLAcia5rtTt9qm61qUag6muuU7j4d5tW8leZ7k1NSpuI1l1uSreDUf8Au+p+
	5Aa8XHx66ZoxIMRY9Ts6YBMcKdPqjulCvUY4cfvkVcatOycg3ZmXTQjm79nDXDOyOtGvhS
	Y1o9fMEg6AJ2pA4Tac+3NUuXXXZdg0C+Q90hJX1ZnEAa/AqrOayDcZyvUFu35PTC3+aX1S
	zcE4uj7OyjTfJlLhtqG/vHmGmWc6rhBDtq1iOwv2akIYYzHm3OvC/+lBCoQuQpYqd9h+Wd
	UGWaznnjKKR5KzAlxZKpXZaEz4P7PnCccNA02WG3djzftOxlHet1LU+IvXO5yw==
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>,
	Taehee Yoo <ap420073@gmail.com>,
	koen.vandeputte@citymesh.com,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20261126163219.1744750-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: 4jb2Bw6vhnzFq8X