[PATCH net v3 08/10] rxrpc: Fix detection of TLP probe response

From: David Howells

Date: Tue Nov 24 2026 - 11:15:11 EST


Fix detection of the TLP probe response to include a check that
->tlp_serial is valid, otherwise it's possible to see an ACK of a packet
that matches an old value of ->tlp_seq as a probe response.

Also make sure that we check to see if an ACK is a TLP probe response -
even if we would otherwise discard it as being out of order.

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/input.c | 21 +++++++++++++++------
net/rxrpc/input_rack.c | 5 +++--
2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 63a0feae2081..d01a8d95dc6d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -275,7 +275,8 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
/* Packet directly hard ACK'd. */
tq->nr_reported_acks++;
rxrpc_input_rack_one(call, summary, tq, ix);
- if (seq == call->tlp_seq)
+ if (call->tlp_serial &&
+ seq == call->tlp_seq)
summary->tlp_probe_acked = true;
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
@@ -288,7 +289,8 @@ static bool rxrpc_rotate_tx_window(struct rxrpc_call *call, rxrpc_seq_t to,
/* Soft NAK -> hard ACK. */
call->acks_nr_snacks--;
rxrpc_input_rack_one(call, summary, tq, ix);
- if (seq == call->tlp_seq)
+ if (call->tlp_serial &&
+ seq == call->tlp_seq)
summary->tlp_probe_acked = true;
summary->nr_new_hacks++;
__set_bit(ix, &tq->segment_acked);
@@ -1139,7 +1141,7 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
/* Discard any out-of-order or duplicate ACKs (outside lock). */
if (!rxrpc_is_ack_valid(call, hard_ack, prev_pkt)) {
trace_rxrpc_rx_discard_ack(call, summary.ack_serial, hard_ack, prev_pkt);
- goto send_response; /* Still respond if requested. */
+ goto check_for_tlp_probe; /* Still respond if requested. */
}

trailer.maxMTU = 0;
@@ -1217,9 +1219,16 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)
*/
rxrpc_congestion_management(call, &summary);
rxrpc_rack_detect_loss_and_arm_timer(call, &summary);
- rxrpc_tlp_process_ack(call, &summary);
- if (call->tlp_serial && after_eq(summary.acked_serial, call->tlp_serial))
- call->tlp_serial = 0;
+
+check_for_tlp_probe:
+ if (call->tlp_serial) {
+ /* Need to check to see if the ACK is a TLP probe response,
+ * even if the ACKs may have come out of order.
+ */
+ rxrpc_tlp_process_ack(call, &summary);
+ if (after_eq(summary.acked_serial, call->tlp_serial))
+ call->tlp_serial = 0;
+ }

send_response:
if (summary.ack_reason == RXRPC_ACK_PING)
diff --git a/net/rxrpc/input_rack.c b/net/rxrpc/input_rack.c
index c652451cc9b5..07972c85f256 100644
--- a/net/rxrpc/input_rack.c
+++ b/net/rxrpc/input_rack.c
@@ -368,11 +368,12 @@ void rxrpc_tlp_send_probe(struct rxrpc_call *call)
}

/*
- * Detect losses using the ACK of a TLP loss probe [RFC8958 7.4].
+ * Detect losses using the ACK of a TLP loss probe [RFC8958 7.4]. The caller
+ * must check ->tlp_serial != 0 before calling.
*/
void rxrpc_tlp_process_ack(struct rxrpc_call *call, struct rxrpc_ack_summary *summary)
{
- if (!call->tlp_serial || after(call->tlp_seq, call->acks_hard_ack))
+ if (after(call->tlp_seq, call->acks_hard_ack))
return;

if (!call->tlp_is_retrans) {