Article View: linux.kernel.netdev
Article #23927Re: [PATCH net-next v2 1/3] net: qualcomm: rmnet: recheck the aggregate after flushing it
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 15:39
Date: Sat, 28 Nov 2026 15:39
122 lines
12671 bytes
12671 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In rmnet_map_tx_aggregate()
(drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c), the retry path…
- [Medium] In rmnet_map_tx_aggregate()
(drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c), the flush-and-…
--
net: qualcomm: rmnet: recheck the aggregate after flushing it
This commit moves the new_packet label in rmnet_map_tx_aggregate() so that
it sits before the skbagg_head check. When the pending aggregate is flushed
with agg_lock dropped, the retry now sees any aggregate another CPU started
in the meantime. Before, that aggregate could be overwritten and leaked.
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> index 7ee2bc33433f6..048a6a35ea28f 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:
[Severity: Medium]
With the label here, the retry can reach the existing-aggregate branch
holding an aggregate that another CPU created while agg_lock was dropped.
Are the timestamps still valid at that point?
port->agg_last is refreshed only once, at function entry, above the label.
Consider this sequence:
CPU A
rmnet_map_tx_aggregate()
flushes the aggregate, spin_unlock_bh(&port->agg_lock)
CPU B
rmnet_map_tx_aggregate()
ktime_get_real_ts64(&port->agg_last); /* tB */
port->skbagg_head = skb_copy_expand(...);
ktime_get_real_ts64(&port->agg_time); /* tB' > tB */
CPU A
spin_lock_bh(&port->agg_lock);
goto new_packet;
...
diff = timespec64_sub(port->agg_last, port->agg_time);
Here diff is tB - tB', which is negative. set_normalized_timespec64() turns
it into tv_sec = -1 and tv_nsec close to 1e9. For any time_nsec under about
one second, that makes this check true:
if (diff.tv_sec > 0 || diff.tv_nsec > port->egress_agg_params.time_nsec ||
Would CPU B's new aggregate then be flushed as soon as CPU A's skb is
appended, while it holds only two packets?
The !skbagg_head branch has a similar problem on retry. It compares
port->agg_last against CPU A's entry-time last, and another CPU may have
changed agg_last in the meantime.
Could the label go before the memcpy(&last, ...) and
ktime_get_real_ts64(&port->agg_last) pair, so the timestamps are refreshed
on each retry?
> if (!port->skbagg_head) {
> /* Check to see if we should agg first. If the traffic is very
> * sparse, don't aggregate.
> */
> -new_packet:
[Severity: Medium]
Does the flush-and-retry path now become a loop with no bound?
Before this patch, goto new_packet jumped into the body of
if (!port->skbagg_head), so there was at most one retry. Now each retry
runs the full check again, and this branch in rmnet_map_tx_aggregate() can
be taken again:
if (port->skbagg_head->len >= port->egress_agg_params.bytes ||
skb->len > port->egress_agg_params.bytes - port->skbagg_head->len) {
agg_skb = port->skbagg_head;
reset_aggr_params(port);
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;
}
Each pass drops agg_lock and transmits through rmnet_send_skb(). In that
window, other CPUs sending through other lltx vnds on the same port can
start a new aggregate.
Take a large skb, for example 4000 bytes with tx-aggr-max-bytes 4096. It
fails the fit check against any head larger than 96 bytes. Could one sender
then keep flushing other CPUs' aggregates for as long as they keep sending?
All of this runs in the ndo_start_xmit path with BH disabled, and the
sender's own skb never gets queued.
Would it help to bound this? For example, the skb could be sent through
no_aggr, or only one retry could be allowed if the skb still does not fit
after a flush.
> diff = timespec64_sub(port->agg_last, last);
> size = port->egress_agg_params.bytes;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127150827.785753-1-antonio%40mandelbit.com
Technical Details
Message-ID:
<179588035206.3135.9208603226356983404@kernel.org>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-373197-linux-kernel-netdev=dewy.ruReferences:
<20261127150827.785753-2-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-373197-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 1/3] net: qualcomm: rmnet: recheck the aggregate after flushing it Date: Sat, 28 Nov 2026 15:39:12 +0000 Organization: Usenet Network Message-ID: <179588035206.3135.9208603226356983404@kernel.org> References: <20261127150827.785753-2-antonio@mandelbit.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="978406"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:y1ucMGLvvikmrj1nt3A83ekYGzQ= sha256:xS4s0ghLxswWiy9cc+m+zxH/9NEQVkuk1CAdkHnW79Q= sha1:Nr2MibFB09yl0CxGslCLsXZpUKM= sha256:2/1/7/Q3kFNbohMymlbCcGVxzvYo09bzm2rfRWqUYYA= 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 E503A125F82; Sat, 28 Nov 2026 18:39:48 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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=kernel.org 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 A8bnPJcmCDdh; Sat, 28 Nov 2026 18:39:42 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373197-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 0AB6E125F76; Sat, 28 Nov 2026 18:39:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id B6A752A1AD; Sat, 28 Nov 2026 15:39:26 +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=1795880360; b=P3w5Gq9w9ajN3ISL2aeVstSn4Mrx+926wzAnBYdxQLxUpz2ukl8Uo6edRfi/Ms9szBNB VTuXynxo9PFTeXS+V02Bhfcm/RgtCgQVBBEpU17BgXtCX1ZMQUmRedZR2TZ+NS5efmdGi 25I3Q4kmKpQccmfjXAqFs0p0azETIkNZXKaINDTpFgWQsPYUFEJYGreojUdezs1x6+XQp wRR0jPANlXr6lqPRZhCJA/t4zrRegHO662WK0Ucp9/aYcK4208tc01UAJKivAgwqoDlY6 RHjhqZ2rEAD9deow6NrCncWrNhN19ya60EBxTXEJEFpx74B/IY1dM79cQlHnW0TjwGg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795880360; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=zQHw7mVK7LKItLxkJA+wMTqy3m4hU8qfrN4Udx4CmcE=; b=z8LtCeN7kCCCFFu/9JUdkc5Qv6S28IuNmI2E2NCsBbRQkgooV0V4tVk4Fut2/M7Up70/ rhtb0DPZw3iHLc5OxuvfiulftVVBWmuLXYl20TgOI49GadzKW8TxR3LcYy3kDCAXBZx7D uBzMAKthdu3pk4kBqOuOWviTsBdHj1cG7z5f53jIzpF0JYvGnGia3h94+ATeJ1X0aHaC+ rUInbamBdkpuUsNARHvICwdDWBAjC7jwHs/RgiZ1rEISErryDfsXDM7VWvv+hAlHX7lyF C2l3CA+23DltKXjuBra0zGvgpG+RlFEEvrdlRlB/j4Nm2NrOkQ1a2ZluyUU9VjURcIg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aKZFlm+B; 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 00521606A33A; Sat, 28 Nov 2026 15:39:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aKZFlm+B X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795880354; b=hgK3S6+nRfuXbBgPIHvwDEhQwe94zWU9yOvKIYYYvFuN3+WCDQaxEsMU6EljHp0L7hc3 wuWv44KWo7GP/Ffs2IEyznhEepadVq5XgLvPzp1vwlgrH12T9X1th4K3Qd1OHPa3iwSRx 20582TYrhgJo1lXHhryfRIStTz5Dh+WXAWt2Yy3twQnmWQoxf1+dQ8RkH4y6/ktkVMBCo qnSsnBK1aGdL4LAwZkmlOjbybNltvAXRX7oAvBhXSxeJupbKeg8EyHX3Y/9Ex9S4RAyvE 91Lo2NoZ2Bhdkbj5CxYS9LDKGhGvhHUhUJcny671NBd3JtGhbgH68G+qoC9e0JZFu0Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795880354; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=zQHw7mVK7LKItLxkJA+wMTqy3m4hU8qfrN4Udx4CmcE=; b=saJu+cgMVASkPryVYQrKjY36Zc+WeLluUm6KlkZlFk0Pr8qyELA49LPQj6ZF+fqxmxrb knJDDm0fA/MqhZ9HDUhSk4KZZnQw3a0hA5iXK9Es3BUs3Jsfya5/V1oHqYWK9Nyx2bpnJ QFdwOMZBb8JDmKJK1QkZpisDO6IbzvnS0Xb7ALQLqj5awrYzBDRImSGjawuaOG2UGoP3C QISw0jPGgoqTn0MvYioc/6qYgRtzS3m/6EXkj94x3WifOlCQjoDBtlAnr/3LrdVyKVpB0 1xoj88v1n9/amTuWjzW9lANmuX/GbCTAJ9n9siA29jlxCbBsJaTeY3DzI1MGgWAoO/Q== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aKZFlm+B; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 202CF606A336 for <netdev@vger.kernel.org>; Sat, 28 Nov 2026 15:39:13 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85DE31F00927; Sat, 28 Nov 2026 15:39:12 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795880353; bh=zQHw7mVK7LKItLxkJA+wMTqy3m4hU8qfrN4Udx4CmcE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=aKZFlm+BPZhFHX5UOSYsDp/Nyn8MnJzdSBn9/gSo1FCQaQEJ5ntlqFapLeG3rCQru QaLPbNUqLIuvQfD5YwbAPf+3Uxpmn3/EkK1qS3w1r8DoNbur1mJY594fqv/pEsOvw9 nYjGP8Q7vMpVAPsUKtIYxILeXRymIcFApDuv41BdevsIDf4bL08bDPdqJl3S4l7zt+ afKjwX1+Ah4WWC9xDZbXVA3wTWZNO43ua5zK32EQG92WVrulPXMwO7M+BfznMgVyFN F9C2TCpdnkChMz9nTym3qrUKY6qPgQKicZjFqpv6gBgCDWYIw0GuiBZh5hGfIL4fkg 6dn5Dyx5rxXsA== X-Cc: netdev@vger.kernel.org, subash.a.kasiviswanathan@oss.qualcomm.com, sean.tranchetti@oss.qualcomm.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, dnlplm@gmail.com, koen.vandeputte@citymesh.com, Jeremy.Jean@oss.cyber.gouv.fr X-In-Reply-To: <20261127150827.785753-2-antonio@mandelbit.com> X-sashiko-severity: Medium 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