rxrpc: input: reject ACKALL outside transmit phase
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 rxrpc: input: reject ACKALL outside transmit phase
From: Wyatt Feng <[email protected]>
rxrpc_input_ackall() accepts ACKALL packets without checking whether the call is in a state that can legitimately have outstanding transmit buffers. A forged ACKALL can therefore reach a new service call in RXRPC_CALL_SERVER_RECV_REQUEST before any reply packets have been queued.
In that state call->tx_top is zero and call->tx_queue is NULL, so rxrpc_rotate_tx_window() dereferences a NULL txqueue and triggers a null-pointer dereference.
Fix rxrpc_input_ackall() to mirror the transmit-state gating already used for normal ACK processing, and ignore ACKALL when there is no outstanding transmit window to rotate.
--- net/rxrpc/input.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
net/rxrpc/input.c +15 -1
@@ -1206,8 +1206,22 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb)static void rxrpc_input_ackall (struct rxrpc_call *call,struct sk_buff *skb) {struct rxrpc_ack_summary summary = {0 }; +rxrpc_seq_t top =READ_ONCE (call->tx_top); + +switch (__rxrpc_call_state (call)) { +case RXRPC_CALL_CLIENT_SEND_REQUEST : +case RXRPC_CALL_CLIENT_AWAIT_REPLY : +case RXRPC_CALL_SERVER_SEND_REPLY : +case RXRPC_CALL_SERVER_AWAIT_ACK : +break ; +default : +return ; + } + +if (call->tx_bottom == top) +return ; -if (rxrpc_rotate_tx_window (call, call->tx_top, &summary)) +if (rxrpc_rotate_tx_window (call, top, &summary))rxrpc_end_tx_phase (call, false, rxrpc_eproto_unexpected_ackall); }
Signature · 1 line
2.47.3