Article View: linux.kernel.netdev
Article #24815[PATCH net-next v3 2/3] net: qualcomm: rmnet: always arm the flush timer for a new aggregate
From: Antonio Quartulli
Date: Mon, 30 Nov 2026 22:01
Date: Mon, 30 Nov 2026 22:01
61 lines
11974 bytes
11974 bytes
On flush, rmnet_map_tx_aggregate() resets agg_state and drops agg_lock
before cancelling the flush timer. A CPU starting a new aggregate in
that window finds the old timer active, so it neither arms it nor sets
agg_state. Once the old timer is cancelled, the new aggregate waits for
the next packet; if the port is torn down first,
rmnet_map_tx_aggregate_exit() leaks it because agg_state is not
-EINPROGRESS.
To make reproducing this bug easier, a udelay(2000) was added
after agg_lock is dropped in the flush paths. Then, with two vnds on one
port, tx-aggr-max-frames 2 and tx-aggr-time-usecs 100000, one CPU sends
3 packets on the first vnd (bypass, new aggregate, flush) and another
sends 1 packet on the second vnd 0.5 ms later: that packet stays queued
past the timeout.
Cancel the timer under agg_lock, so a timer armed for a newer aggregate
cannot be cancelled, and arm it whenever agg_state is not -EINPROGRESS;
hrtimer_start() copes with a timer that is still enqueued or running.
If the cancel races with a running callback, the flush work it queued
finds either no aggregate or the new one, which it flushes early.
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
index f02ea5d728d0..f862166b0467 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -640,8 +640,8 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port
}
agg_skb = port->skbagg_head;
reset_aggr_params(port);
+ hrtimer_try_to_cancel(&port->hrtimer);
spin_unlock_bh(&port->agg_lock);
- hrtimer_cancel(&port->hrtimer);
rmnet_send_skb(port, agg_skb);
spin_lock_bh(&port->agg_lock);
flushed = true;
@@ -664,14 +664,14 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port
port->skbagg_head->len == port->egress_agg_params.bytes) {
agg_skb = port->skbagg_head;
reset_aggr_params(port);
+ hrtimer_try_to_cancel(&port->hrtimer);
spin_unlock_bh(&port->agg_lock);
- hrtimer_cancel(&port->hrtimer);
rmnet_send_skb(port, agg_skb);
return len;
}
schedule:
- if (!hrtimer_active(&port->hrtimer) && port->agg_state != -EINPROGRESS) {
+ if (port->agg_state != -EINPROGRESS) {
port->agg_state = -EINPROGRESS;
hrtimer_start(&port->hrtimer,
ns_to_ktime(port->egress_agg_params.time_nsec),
--
2.56.1
Technical Details
Message-ID:
<20261130220200.3378310-3-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-374491-linux-kernel-netdev=dewy.ruReferences:
<20261130220200.3378310-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-374491-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: [PATCH net-next v3 2/3] net: qualcomm: rmnet: always arm the flush timer for a new aggregate Date: Mon, 30 Nov 2026 23:01:59 +0100 Organization: Usenet Network Message-ID: <20261130220200.3378310-3-antonio@mandelbit.com> References: <20261130220200.3378310-1-antonio@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="1550471"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cZQYpp8D/IIQgtR3PF8qdZSA1gI= sha256:zWwekq/0dMNWIYUiPJt9jmAUj/Fhwu3d7ntVqPKhi9Y= sha1:1I7kuM38cbYsEejY3kd3Ue3dbH0= sha256:d6TPkxeAH3RHgauI18YUbcW7o2aUoDhXa7etQGPGxlE= 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 CE50712600F; Tue, 1 Dec 2026 01:02:29 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 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] 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 yK_11wCqHL2x; Tue, 1 Dec 2026 01:02:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374491-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 81B3B12600E; Tue, 1 Dec 2026 01:02:18 +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 99F562C758; Mon, 30 Nov 2026 22:02:11 +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=1796076130; b=zvpv+Vsz6pwqdnW8ge5AimQVEiePN8eqjMZuI5nE/VDbZbEKm6AL/pKRkKR+EeqpKjBB fA70L1qTfUvQ/otKl+OuLrylPOqAJkDyTIZY6eW5/eBbzLcayvdhk/5IQ3Kzs2fAGHls1 JIifAjfND+5w2b31pz7t8O8IfGz1iNmEloO/MeTq5XTUZ6kWeCZntTmVzOpCAUWjXm8UO AJxOS2N3LgMZUVGdZoq4oc4aGVBzaMxvYcsMs7AagoipO/G81HGvNSR6okK81uZHa840/ 6+L19CL9XX3ieK73r54/LU+uISCxf3Ht+3IdV/OH+ACdQhU4R8bBzmRLmdlh62NBfMw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796076130; 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=sZsddTEy75PP9G6QIG8CSsa3n00tmICR7Oil+U9mk1w=; b=yGpEUvd1ijrM+Pd4+isjG+oziWmxjvpaL/hJYVL4WDFWYphJbC3Te0MmN/xjvFM7lvFF WKYSiUuN3Mj1D7RYNiotIdMbS/c/lzBzbGkmnDfrxt4gTXAUVb+9n6/LpXPU2mQ2zw8Nv PEDd5p3Ew/8V3ACSbbax+8MI4UNd++vDTuApQfRDgpP5Fdl4PPbK2jAFxNINNS6BpyL8s J3td8er1pHgZ691PlYVNrBaciVmE6lEHGUTpUF1bnAJpLNcqZfizo/9T0GVXYml24z+n8 +kYDKz6FgHhawtPvuFsvZGheS3RL6oHCaTCAAB8ihnc2cet+5eCJCHT/I6DvwBM/RIw== 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=bWpI0apN; 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 129C6606A33F; Mon, 30 Nov 2026 22:02:10 +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=bWpI0apN X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.42 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796076129; b=1Vlkle1nfqiMpG2yybLQw/sHzgWsAPel3o8RdwxwrLk63EepbEaCEV2J+Ysa+3j+cxDl LfdDuMKKZtqRd9MP7TfV8UT8AuMfrTHU/oQGfoOICL3s1w5Wkr0gDxX35sGHN6JwkGrPd Ks5SWYFDdHu8YE56ZzhCv/W5H2F0ppit5ZF++OGc+mxBklqZvH09XvgHMCiBe9G1VNnnV pHfiB491HpBUtsSE9KB5j555PzX2/Hj5D34XxARqw8OyumxdcZlmoqx6YxhfDHNnOLrmb C1sU6/4caW7KspkuyS70LwB2OI0GtQbIDQgt4YYPPjNwJ25t7N8oDZaKt13aX0uXCqw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796076129; 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=sZsddTEy75PP9G6QIG8CSsa3n00tmICR7Oil+U9mk1w=; b=wllApFiJ0nT25l5hvowlKTfm/YrZMIOBzXnxJ5V0i3xq5W9KFIzQ78I9UTqYC346iYRP I7y7wlpD2zWWgij7J3Td7SbJvcrPgzKv+5m+wgdy0/oVMFg3YU5Y6+pOh01U0tLO3faYL XHcj+L6WDuHpbjJb4pf6/e0eqAoQFgcBxbBPthpRIsKXLueH85zGXAYh5uyIZv+EVaQG5 0iGvBgRolLoAjtBr7yCb2s6Ld7eSx3TNVeix1vODirZQRYs2rK9BvU66ERPdsPjyg5J+B JPL2cqMo2JNNRyHlhw/kb/3MJULJkyvCVI9RaDMJzRbX870lcOnEiWSvbz5bMrad0Qg== 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=bWpI0apN; arc=none smtp.remote-ip=195.10.208.42 X-Received: from mout-b-112.mailbox.org (mout-b-112.mailbox.org [195.10.208.42]) (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 B1D63606A325 for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 22:02:08 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B1D63606A325 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 smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (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-112.mailbox.org (Postfix) with ESMTPS id 4jddKT19T3z5wV5; Mon, 30 Nov 2026 23:02:05 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com; s=MBO0001; t=1796076125; 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=sZsddTEy75PP9G6QIG8CSsa3n00tmICR7Oil+U9mk1w=; b=bWpI0apNfAUiM925Ht3nzGwAZGrGQzrtPzcJgcII0TF5NpEgcVTRGfEoQ8RHoUck6J9WCL K11YRRQ+d3CAdwXQrFknr0tal9cYLUdN1yQgsLno+9im1Ql1+zVhXciyWAvHjG4vfy9tYB TJ3PTo4SD6Wl9Gvf0I9jyos/Z7bJpwCl/L/onWFcv3Rfnpue2a3Mhm00PU5yzrEm3jMAX2 EM1DjL9V4LTx/+OR5fh3ELXpRLwpU9t/IhvvtGchoMJf1kTWQNfoAkDVizDagb62+dWVjW YEZnuOjHUvKfJeyygnDdGkNeTViNzvjTPgqRzyNxySpEcWIHdZ9z17FDKL1+aQ== X-Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of antonio@mandelbit.com designates 2001:67c:2050:b231:465::202 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: <20261130220200.3378310-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: 4jddKT19T3z5wV5