Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Lin Ma
Sat, 28 Nov 2026 02:44
[PATCH net v2] rxrpc: Fix NULL Tx buffer handling in the retransmission path
Author: Lin Ma
Date: Sat, 28 Nov 2026 02:44
Date: Sat, 28 Nov 2026 02:44
123 lines
15370 bytes
15370 bytes
rxrpc_retransmit_data() can be handed a NULL txb in two ways.
First, rxrpc_transmit_fresh_data() commits the Tx queue state before
rxrpc_send_data_packet() has prepared the packet. If the wire header
allocation fails, tx_transmitted is not advanced, and the next pass
builds req.seq from tx_transmitted but req.tq from the new tail segment.
Indexing that segment with the stale sequence number can select a NULL or
wrong txbuf. If the LAST packet was in the unsent batch, the Tx phase
can also be closed with packets that were never sent.
Second, rxrpc_input_ackall() rotates the Tx window and frees txbufs up to
tx_transmitted, but it doesn't advance acks_hard_ack. A subsequent TLP
expiry can therefore select an in-range but already-freed slot.
Fix the first by only committing tx_qtail and tx_top after
rxrpc_send_data_packet() has advanced tx_transmitted, and by arming a
short retry timer if it didn't. Fix the second by advancing
acks_hard_ack on ACKALL. Also make rxrpc_retransmit_data() tolerate a
missing txbuf as a final guard, and retain the lower-bound check in
rxrpc_resend_tlp().
Fixes: b341a0263b1b ("rxrpc: Implement progressive transmission queue struct")
Fixes: 7c482665931b6 ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]")
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
Changes in v2:
- Only commit tx_qtail and tx_top after rxrpc_send_data_packet() has
advanced tx_transmitted, and retry after a short delay if the wire
header allocation failed, instead of only guarding the TLP fast path.
- Advance acks_hard_ack on ACKALL and tolerate a missing txbuf.
Link: https://lore.kernel.org/all/20261122135515.3989708-1-linma@zju.edu.cn/
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122135515.3989708-1-linma%40zju.edu.cn
net/rxrpc/call_event.c | 29 +++++++++++++++++++++++------
net/rxrpc/input.c | 7 +++++++
2 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c
index 21be9c86d7a7..2360e9289602 100644
--- a/net/rxrpc/call_event.c
+++ b/net/rxrpc/call_event.c
@@ -64,6 +64,9 @@ static bool rxrpc_retransmit_data(struct rxrpc_call *call,
unsigned int ix = req->seq & RXRPC_TXQ_MASK;
struct rxrpc_txbuf *txb = tq->bufs[ix];
+ if (!txb)
+ return false;
+
_enter("%x,%x,%x,%x", tq->qbase, req->seq, ix, txb->debug_id);
req->retrans = true;
@@ -141,6 +144,7 @@ void rxrpc_resend_tlp(struct rxrpc_call *call)
/* There's a chance it'll be on the tail segment of the queue. */
req.tq = READ_ONCE(call->tx_qtail);
if (req.tq &&
+ after_eq(call->tx_transmitted, req.tq->qbase) &&
before(call->tx_transmitted, req.tq->qbase + RXRPC_NR_TXQUEUE)) {
rxrpc_retransmit_data(call, &req);
return;
@@ -213,6 +217,7 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
struct rxrpc_txbuf *txb;
rxrpc_seq_t send_top, seq;
int limit = min(space, max(call->peer->pmtud_jumbo, 1));
+ bool last;
/* Order send_top before the contents of the new txbufs and
* txqueue pointers
@@ -244,17 +249,29 @@ static void rxrpc_transmit_fresh_data(struct rxrpc_call *call, unsigned int limi
break;
} while (req.n < limit && before(seq, send_top));
+ last = txb->flags & RXRPC_LAST_PACKET;
+
if (__rxrpc_call_state(call) == RXRPC_CALL_CLIENT_PRE_SEND)
rxrpc_set_call_state(call, RXRPC_CALL_CLIENT_SEND_REQUEST);
- if (txb->flags & RXRPC_LAST_PACKET) {
- rxrpc_close_tx_phase(call);
- tq = NULL;
+
+ rxrpc_send_data_packet(call, &req);
+
+ if (call->tx_transmitted != seq) {
+ /* The wire header allocation failed; retry shortly. */
+ ktime_t delay = ms_to_ktime(100);
+
+ call->rack_timer_mode = RXRPC_CALL_RACKTIMER_TLP_PTO;
+ call->rack_timo_at = ktime_add(ktime_get_real(), delay);
+ trace_rxrpc_timer_set(call, delay,
+ rxrpc_timer_trace_rack_tlp_pto);
+ break;
}
- call->tx_qtail = tq;
- call->tx_top = seq;
+ call->tx_qtail = last ? NULL : tq;
+ call->tx_top = seq;
+ if (last)
+ rxrpc_close_tx_phase(call);
space -= req.n;
- rxrpc_send_data_packet(call, &req);
}
}
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index 73cafe6bfa9f..ee1073951c8d 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -1242,6 +1242,13 @@ static void rxrpc_input_ackall(struct rxrpc_call *call, struct sk_buff *skb)
if (rxrpc_rotate_tx_window(call, call->tx_transmitted, &summary))
rxrpc_end_tx_phase(call, false, rxrpc_eproto_unexpected_ackall);
+
+ /* ACKALL acknowledges everything transmitted, but rotating the Tx
+ * window only advances tx_bottom. Advance the hard-ACK mark too so
+ * that a subsequent TLP probe doesn't select a freed Tx buffer.
+ */
+ if (after(call->tx_transmitted, call->acks_hard_ack))
+ call->acks_hard_ack = call->tx_transmitted;
}
/*
Re: [PATCH net v2] rxrpc: Fix NULL Tx buffer handling in the retransmission path
Author: netdev-bot+sinfo
Date: Sat, 28 Nov 2026 02:49
Date: Sat, 28 Nov 2026 02:49
23 lines
8542 bytes
8542 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by LLM and not proven at runtime). If it was triggered please include the symptoms, like the stack trace or kernel messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads