linux/net/rxrpc
David Howells 5ac0d62226 rxrpc: Fix missing notification
Under some circumstances, rxrpc will fail a transmit a packet through the
underlying UDP socket (ie. UDP sendmsg returns an error).  This may result
in a call getting stuck.

In the instance being seen, where AFS tries to send a probe to the Volume
Location server, tracepoints show the UDP Tx failure (in this case returing
error 99 EADDRNOTAVAIL) and then nothing more:

 afs_make_vl_call: c=0000015d VL.GetCapabilities
 rxrpc_call: c=0000015d NWc u=1 sp=rxrpc_kernel_begin_call+0x106/0x170 [rxrpc] a=00000000dd89ee8a
 rxrpc_call: c=0000015d Gus u=2 sp=rxrpc_new_client_call+0x14f/0x580 [rxrpc] a=00000000e20e4b08
 rxrpc_call: c=0000015d SEE u=2 sp=rxrpc_activate_one_channel+0x7b/0x1c0 [rxrpc] a=00000000e20e4b08
 rxrpc_call: c=0000015d CON u=2 sp=rxrpc_kernel_begin_call+0x106/0x170 [rxrpc] a=00000000e20e4b08
 rxrpc_tx_fail: c=0000015d r=1 ret=-99 CallDataNofrag

The problem is that if the initial packet fails and the retransmission
timer hasn't been started, the call is set to completed and an error is
returned from rxrpc_send_data_packet() to rxrpc_queue_packet().  Though
rxrpc_instant_resend() is called, this does nothing because the call is
marked completed.

So rxrpc_notify_socket() isn't called and the error is passed back up to
rxrpc_send_data(), rxrpc_kernel_send_data() and thence to afs_make_call()
and afs_vl_get_capabilities() where it is simply ignored because it is
assumed that the result of a probe will be collected asynchronously.

Fileserver probing is similarly affected via afs_fs_get_capabilities().

Fix this by always issuing a notification in __rxrpc_set_call_completion()
if it shifts a call to the completed state, even if an error is also
returned to the caller through the function return value.

Also put in a little bit of optimisation to avoid taking the call
state_lock and disabling softirqs if the call is already in the completed
state and remove some now redundant rxrpc_notify_socket() calls.

Fixes: f5c17aaeb2 ("rxrpc: Calls should only have one terminal state")
Reported-by: Gerry Seidman <gerry@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
2020-06-05 13:36:35 +01:00
..
af_rxrpc.c afs: Fix client call Rx-phase signal handling 2020-03-13 23:04:35 +00:00
ar-internal.h rxrpc: Move the call completion handling out of line 2020-06-05 13:36:35 +01:00
call_accept.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
call_event.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
call_object.c rxrpc: Fix call interruptibility handling 2020-03-13 23:04:30 +00:00
conn_client.c rxrpc: Fix call interruptibility handling 2020-03-13 23:04:30 +00:00
conn_event.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
conn_object.c rxrpc: Fix service call disconnection 2020-02-07 11:19:38 +01:00
conn_service.c rxrpc: Fix missing security check on incoming calls 2019-12-20 16:21:32 +00:00
input.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
insecure.c rxrpc: Fix -Wframe-larger-than= warnings from on-stack crypto 2019-07-30 10:32:35 -07:00
Kconfig crypto: skcipher - rename the crypto_blkcipher module and kconfig option 2019-11-01 13:42:47 +08:00
key.c KEYS: Don't write out to userspace while holding key semaphore 2020-03-29 12:40:41 +01:00
local_event.c rxrpc: Use the tx-phase skb flag to simplify tracing 2019-08-27 10:04:18 +01:00
local_object.c rxrpc: Fix DATA Tx to disable nofrag for UDP on AF_INET6 socket 2020-04-14 16:26:47 -07:00
Makefile rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
misc.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
net_ns.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00
output.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
peer_event.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
peer_object.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
proc.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
protocol.h rxrpc: Improve jumbo packet counting 2019-08-27 09:48:37 +01:00
recvmsg.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
rtt.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
rxkad.c rxrpc: Fix a memory leak in rxkad_verify_response() 2020-05-23 00:35:46 +01:00
security.c rxrpc: Fix missing security check on incoming calls 2019-12-20 16:21:32 +00:00
sendmsg.c rxrpc: Fix missing notification 2020-06-05 13:36:35 +01:00
skbuff.c rxrpc: Use skb_unshare() rather than skb_cow_data() 2019-08-27 10:13:46 +01:00
sysctl.c rxrpc: Fix the excessive initial retransmission timeout 2020-05-11 16:42:28 +01:00
utils.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 36 2019-05-24 17:27:11 +02:00