The fast path in rxrpc_resend_tlp() checks that tx_transmitted is before the end of the tail Tx queue segment, but doesn't check that it is at or after the segment's base. If it is below the base, the wrong slot can be selected and rxrpc_retransmit_data() may dereference a NULL txbuf. This can happen when rxrpc_send_data_packet() fails to allocate its wire header after rxrpc_transmit_fresh_data() has advanced tx_qtail and tx_top but before tx_transmitted is updated. A subsequent TLP probe can then enter rxrpc_resend_tlp() in that state. Add the missing lower-bound check, matching the slower queue walk. The reporter triggered this at runtime. Fixes: 7c482665931b6 ("rxrpc: Implement RACK/TLP to deal with transmission stalls [RFC8985]") Signed-off-by: Lin Ma --- net/rxrpc/call_event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/rxrpc/call_event.c b/net/rxrpc/call_event.c index fec59d9338b9..4fca790a007f 100644 --- a/net/rxrpc/call_event.c +++ b/net/rxrpc/call_event.c @@ -141,6 +141,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;