Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rxrpc: Fix received abort handling

AF_RXRPC is incorrectly sending back to the server any abort it receives
for a client connection. This is due to the final-ACK offload to the
connection event processor patch. The abort code is copied into the
last-call information on the connection channel and then the event
processor is set.

Instead, the following should be done:

(1) In the case of a final-ACK for a successful call, the ACK should be
scheduled as before.

(2) In the case of a locally generated ABORT, the ABORT details should be
cached for sending in response to further packets related to that
call and no further action scheduled at call disconnect time.

(3) In the case of an ACK received from the peer, the call should be
considered dead, no ABORT should be transmitted at this time. In
response to further non-ABORT packets from the peer relating to this
call, an RX_USER_ABORT ABORT should be transmitted.

(4) In the case of a call killed due to network error, an RX_USER_ABORT
ABORT should be cached for transmission in response to further
packets, but no ABORT should be sent at this time.

Fixes: 3136ef49a14c ("rxrpc: Delay terminal ACK transmission on a client call")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

David Howells and committed by
David S. Miller
17e9e23b e729452e

+14 -5
+2 -1
net/rxrpc/conn_client.c
··· 834 834 * can be skipped if we find a follow-on call. The first DATA packet 835 835 * of the follow on call will implicitly ACK this call. 836 836 */ 837 - if (test_bit(RXRPC_CALL_EXPOSED, &call->flags)) { 837 + if (call->completion == RXRPC_CALL_SUCCEEDED && 838 + test_bit(RXRPC_CALL_EXPOSED, &call->flags)) { 838 839 unsigned long final_ack_at = jiffies + 2; 839 840 840 841 WRITE_ONCE(chan->final_ack_at, final_ack_at);
+12 -4
net/rxrpc/conn_object.c
··· 177 177 * through the channel, whilst disposing of the actual call record. 178 178 */ 179 179 trace_rxrpc_disconnect_call(call); 180 - if (call->abort_code) { 181 - chan->last_abort = call->abort_code; 182 - chan->last_type = RXRPC_PACKET_TYPE_ABORT; 183 - } else { 180 + switch (call->completion) { 181 + case RXRPC_CALL_SUCCEEDED: 184 182 chan->last_seq = call->rx_hard_ack; 185 183 chan->last_type = RXRPC_PACKET_TYPE_ACK; 184 + break; 185 + case RXRPC_CALL_LOCALLY_ABORTED: 186 + chan->last_abort = call->abort_code; 187 + chan->last_type = RXRPC_PACKET_TYPE_ABORT; 188 + break; 189 + default: 190 + chan->last_abort = RX_USER_ABORT; 191 + chan->last_type = RXRPC_PACKET_TYPE_ABORT; 192 + break; 186 193 } 194 + 187 195 /* Sync with rxrpc_conn_retransmit(). */ 188 196 smp_wmb(); 189 197 chan->last_call = chan->call_id;