All of lore.kernel.org
 help / color / mirror / Atom feed
From: <subash.a.kasiviswanathan@oss.qualcomm.com>
To: "'Jérémy Jean'" <Jeremy.Jean@oss.cyber.gouv.fr>,
	"'Sean Tranchetti'" <sean.tranchetti@oss.qualcomm.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: RE: [PATCH net] net: qualcomm: rmnet: bound TX aggregates on byte-limit update
Date: Sun, 8 Nov 2026 00:36:17 -0700	[thread overview]
Message-ID: <000301dd6f53$d7b931f0$872b95d0$@oss.qualcomm.com> (raw)
In-Reply-To: <20261031221052.1642262-2-Jeremy.Jean@oss.cyber.gouv.fr>

> -----Original Message-----
> From: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> Sent: Saturday, October 31, 2026 4:11 PM
> To: Subash Abhinov Kasiviswanathan
> <subash.a.kasiviswanathan@oss.qualcomm.com>; Sean Tranchetti
> <sean.tranchetti@oss.qualcomm.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Jérémy Jean
> <Jeremy.Jean@oss.cyber.gouv.fr>; stable@vger.kernel.org
> Subject: [PATCH net] net: qualcomm: rmnet: bound TX aggregates on byte-
> limit update
> 
> If userspace reduces the TX aggregation byte limit while a buffered skb is
> pending, subtracting the skb length from the new limit underflows.
> The later comparison with unsigned skb->len then lets the buffered skb grow
> past the limit.
> 
> Check lengths before subtracting. Flush a buffered skb if it is already at or
> above the new byte limit.
> 
> Fixes: 64b5d1f8f2d1 ("net: qualcomm: rmnet: add tx packets aggregation")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> ---
>  drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c | 12 ++++++-----
> -
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> index e6f48dc9fe64..205ac81f2c82 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_map_data.c
> @@ -594,7 +594,7 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff
> *skb, struct rmnet_port *port
>  	struct timespec64 diff, last;
>  	unsigned int len = skb->len;
>  	struct sk_buff *agg_skb;
> -	int size;
> +	unsigned int size;
> 
>  	spin_lock_bh(&port->agg_lock);
>  	memcpy(&last, &port->agg_last, sizeof(struct timespec64)); @@ -
> 606,13 +606,14 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff
> *skb, struct rmnet_port *port
>  		 */
>  new_packet:
>  		diff = timespec64_sub(port->agg_last, last);
> -		size = port->egress_agg_params.bytes - skb->len;
> +		size = port->egress_agg_params.bytes;
> 
> -		if (size < 0) {
> +		if (skb->len > size) {
>  			/* dropped */
>  			spin_unlock_bh(&port->agg_lock);
>  			return 0;
>  		}
> +		size -= skb->len;
> 
>  		if (diff.tv_sec > 0 || diff.tv_nsec >
> RMNET_AGG_BYPASS_TIME_NSEC ||
>  		    size == 0)
> @@ -630,9 +631,8 @@ unsigned int rmnet_map_tx_aggregate(struct sk_buff
> *skb, struct rmnet_port *port
>  		goto schedule;
>  	}
>  	diff = timespec64_sub(port->agg_last, port->agg_time);
> -	size = port->egress_agg_params.bytes - port->skbagg_head->len;
> -
> -	if (skb->len > size) {
> +	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);
> --
> 2.47.3

Reviewed-by: Subash Abhinov Kasiviswanathan <subash.a.kasiviswanathan@oss.qualcomm.com>


  parent reply	other threads:[~2026-11-08  7:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 22:10 [PATCH net] net: qualcomm: rmnet: avoid stale VND access on TX drop Jérémy Jean
2026-10-31 22:10 ` [PATCH net] net: qualcomm: rmnet: bound TX aggregates on byte-limit update Jérémy Jean
2026-10-31 22:13   ` netdev-bot+sinfo
2026-11-08 14:18     ` Simon Horman
2026-11-08 14:36       ` Jérémy Jean
2026-11-08 16:40         ` Simon Horman
2026-11-08  7:36   ` subash.a.kasiviswanathan [this message]
2026-11-10  2:55   ` patchwork-bot+netdevbpf
2026-10-31 22:13 ` [PATCH net] net: qualcomm: rmnet: avoid stale VND access on TX drop netdev-bot+sinfo
2026-11-01 22:11 ` netdev-bot+sashiko
2026-11-01 22:59   ` Jérémy Jean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000301dd6f53$d7b931f0$872b95d0$@oss.qualcomm.com' \
    --to=subash.a.kasiviswanathan@oss.qualcomm.com \
    --cc=Jeremy.Jean@oss.cyber.gouv.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sean.tranchetti@oss.qualcomm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.