Article View: linux.kernel.netdev
Article #23172[PATCH net 2/6] net: qualcomm: rmnet: always arm the flush timer for a new aggregate
From: Antonio Quartulli
Date: Thu, 26 Nov 2026 16:32
Date: Thu, 26 Nov 2026 16:32
60 lines
11880 bytes
11880 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, and 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 73b04fe386df..fdfc65c7c5e5 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
@@ -635,8 +635,8 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff *skb, struct rmnet_port *port
if (skb->len > size) {
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);
goto new_packet;
@@ -658,14 +658,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:
<20261126163219.1744750-3-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-372229-linux-kernel-netdev=dewy.ruReferences:
<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-372229-linux-kernel-netdev=dewy.ru From: antonio@mandelbit.com (Antonio Quartulli) Newsgroups: linux.kernel.netdev Subject: [PATCH net 2/6] net: qualcomm: rmnet: always arm the flush timer for a new aggregate Date: Thu, 26 Nov 2026 17:32:15 +0100 Organization: Usenet Network Message-ID: <20261126163219.1744750-3-antonio@mandelbit.com> References: <20261126163219.1744750-1-antonio@mandelbit.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="508694"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:bJpgHzambyjhwv7ux+enXt5n+3Y= sha256:sBEc+EGoy3IYajcS3YOg+Jhf30TxotHTZ77RI65Jlk0= sha1:TEirW9Zvhs4/KSpQWH2nW6wYW2s= sha256:LZCuStVKl6VC2/l1tKs2nJDLO49bD7Vtz1SYZ0Xx4ss= 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 6FAC8125EE8; Thu, 26 Nov 2026 19:33:24 +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 bSskkb9wDXgn; Thu, 26 Nov 2026 19:33:21 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372229-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 4A5A5125EEB; Thu, 26 Nov 2026 19:33:13 +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 521763C90A; Thu, 26 Nov 2026 16:32:36 +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=1795710756; b=vQtBkO3Y05IRIIkXDxjyC+7ECiF84xFLNZ8VIQjwdMV8Q/r1rzmgPjjS+iWlysIa04WF wuEr8nOfYyhEtZPHv7ND25lOkQac/1wQ880SHSXsQQwuoS5+rAimjhAOg4G1YaxzF3P4g 0UCpAmYBpniBveOsqEz6MWJ5j4gUXux1jhs2SrDpQXfgMYj69AZ4nuxKw5hu/dAYZnsfZ TLV6CgHXqohLgIMd1RQcN2u4rPhlLN9Se9K2NyqE+W+WdvpK2+5Sk/XCxtYS9dhnaUJP1 RlbH4QOZIj7mn0bZkIEjDo5gq9NeaoF6rIRkgBhwDWsOQ5IxgPiFl8vbYOapLZ5MlSQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795710756; 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=NAFuRlfHzyLod0BAEG+HKMSQVYdL8WhP8DUW/14PJNU=; b=hZL4AdEEfgUFvsUsDw0jYJtrtw52CdIiJNGj7C5p/N5htqoNH29hm2rJ1Vg0QhEmpogO ILfn7cfj/md0g59sXIvm7Zgl1ICRk18jO/lbv2tDlzRVoQ0S3DrpKGqky5gIkHJi9+NUy 74oDoEjSUL0HE9QGKUZVyNw/A8F+qLhpmGpOUjQvnu/Y31Yi0iHLwxCQ/COSH4pfrgN6S A6jgjTes7favKo8QNF+u3UurjeouAA402jbqgig+4CFWBFT1J1F22Y9xl0oFGx8VRR6t+ DfFtfKq8X7AE9S/gZPRuLk8IMUVtDSr49DBq6A/np30R0JyRoQ8iaR4s83Y8ma5OZEQ== 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="eq/SZq0q"; 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 29B8E606A32C; Thu, 26 Nov 2026 16:32:36 +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=eq/SZq0q 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=1795710755; b=KjgG8cAIlw9cgvbuFc7r/l8Fa7PytLPnl4LGbfXpLXo4rZIIlkuSSCRsAysF4MFSZiG2 o1dhRdVOD4v8PsNFvRKcYBY/JNoskt2Zuo3vLqRYUiR1+UcsIE5mDh6fRb6MY3GfOF3h2 yu2AMlBjWQyF1Gj3oyMErN0z38JhlE7jwu5fz8ocikxnCMqHdlsDX9SyRzwcOCkTib1BQ zsnlB/sHzJwp75b/rM15ZhyByVL9gXVXEr5JCto3BGqeoDQ5laI5+bKrzzIzQrdCmf9AQ NiDqQO6BLSnh/4ahis7c8+e5VtuhPbYzBELNJ4cSEXTxvtjsjNzF1MlQANjHem5/DqQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795710755; 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=NAFuRlfHzyLod0BAEG+HKMSQVYdL8WhP8DUW/14PJNU=; b=SV91CFhlLAvelGSxg3n7EFjmUJ0AvnjwGjUAkgDZnmZFkZxh3cnDqMLLzZSl3oe1LRm7 7o+lC3HwBSG70E7TgwulYRvjctYSJHX3J/xB8z2mHk2Gs5TIKYN0A4sFvtmIEDESClTpI AHeYX/C9gZSy7bo7azkBtIyWxoMfngVw5OHEBXBf1oi2ruacOlB85nmJlrY3svvkj1deG y6Wwx7h7KwgcryCmyD+WWBtjOIQuPut4p/mi+OpBvoAwuA1VfyBVy5BiHF4W1LuEpKKrV upSbhVdJmibIMH9oukLUPQfXL9BZuf96gTCWK9K5F9BzRTXsVfTOiZYLV3SJkjY11ag== 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="eq/SZq0q"; 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 A0411606A31E for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 16:32:34 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A0411606A31E 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 4jb2Bx5NwVz9tNL; Thu, 26 Nov 2026 17:32:25 +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=NAFuRlfHzyLod0BAEG+HKMSQVYdL8WhP8DUW/14PJNU=; b=eq/SZq0qm8qDN6cymvL5x0aTkWvELQUrTvbWbEhAD5+XqI2rGOWc70PQEEk08BBVWTOEJu bsAWbbP6CoCcGpjUFx0auD5UtR+68gleOOKQiQDeEAfzgZXDdC9+rkNMSpyWaylUayx5ap xMZEWFMEYq2vj4NiDMEI2+g3u8K5JRgFxrA+U64gHP4in9Gx6xcV8OipUaRuCfJQkODn5W fXBV2X2IwLyzbhVX+ndMrcpMP9n0+VXrdXYceFLkBJwJLTGpbhnyEgmQedMUHe+aRbt38l QuQz+JCQHjn0QANCKvxuI0cJsebeTkM0Ip+EtE3k3EDXy5YiDwjjeZmhhXEnXQ== 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: 4jb2Bx5NwVz9tNL