From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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 ; Sat, 28 Nov 2026 15:39:13 +0000 (UTC) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85DE31F00927; Sat, 28 Nov 2026 15:39:12 +0000 (UTC) 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== Subject: Re: [PATCH net-next v2 1/3] net: qualcomm: rmnet: recheck the aggregate after flushing it From: netdev-bot+sashiko@kernel.org To: antonio@mandelbit.com 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 Date: Sat, 28 Nov 2026 15:39:12 +0000 Message-ID: <179588035206.3135.9208603226356983404@kernel.org> In-Reply-To: <20261127150827.785753-2-antonio@mandelbit.com> References: <20261127150827.785753-2-antonio@mandelbit.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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