[PATCH net v3 07/10] rxrpc: Fix limit on packets to be transmitted in one go

From: David Howells

Date: Tue Nov 24 2026 - 11:14:01 EST


Fix rxrpc_transmit_fresh_data() to honour the limit set on the number of
packets it can transmit in one go. The 'limit' variable is accidentally
shadowed by another variable calculating the limit dynamically.

This was spotted by Claude-opus-5-5 run locally.

Fixes: 7c482665931b ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Marc Dionne <marc.dionne@xxxxxxxxxxxx>
cc: Jeffrey Altman <jaltman@xxxxxxxxxxxx>
cc: Eric Dumazet <edumazet@xxxxxxxxxx>
cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
cc: Jakub Kicinski <kuba@xxxxxxxxxx>
cc: Paolo Abeni <pabeni@xxxxxxxxxx>
cc: Simon Horman <horms@xxxxxxxxxx>
cc: linux-afs@xxxxxxxxxxxxxxxxxxx
cc: stable@xxxxxxxxxxxxxxx
---
net/rxrpc/call_event.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index b102a055c2e0..4def732352e9 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -189,7 +189,8 @@ static void rxrpc_close_tx_phase(struct rxrpc_call *call)
}

/*
- * Transmit some as-yet untransmitted data, to a maximum of the supplied limit.
+ * Transmit some as-yet untransmitted data, to a maximum of the supplied limit
+ * (UINT_MAX for no limit).
*/
static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limit,
enum rxrpc_txdata_trace trace)
@@ -212,7 +213,8 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
struct rxrpc_txqueue *tq;
struct rxrpc_txbuf *txb;
rxrpc_seq_t send_top, seq;
- int limit = min(space, max(call->peer->pmtud_jumbo, 1));
+ int jlimit = umin(umin(space, max(call->peer->pmtud_jumbo, 1)),
+ limit);

/* Order send_top before the contents of the new txbufs and
* txqueue pointers
@@ -242,7 +244,7 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
req.n++;
if (!txb->jumboable)
break;
- } while (req.n < limit && before(seq, send_top));
+ } while (req.n < jlimit && before(seq, send_top));

if (__rxrpc_call_state(call) == RXRPC_CALL_CLIENT_PRE_SEND)
rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_SEND_REQUEST);
@@ -255,6 +257,11 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi

space -= req.n;
rxrpc_send_data_packet(call, &req);
+ if (limit < UINT_MAX) {
+ limit -= req.n;
+ if (limit == 0)
+ break;
+ }
}
}