rxrpc: rxrpc_kernel_send_data() needs to handle failed call better
authorDavid Howells <dhowells@redhat.com>
Thu, 9 Mar 2017 08:10:32 +0000 (08:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Mar 2017 02:30:10 +0000 (18:30 -0800)
If rxrpc_kernel_send_data() is asked to send data through a call that has
already failed (due to a remote abort, received protocol error or network
error), then return the associated error code saved in the call rather than
ESHUTDOWN.

This allows the caller to work out whether to ask for the abort code or not
based on this.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rxrpc/sendmsg.c

index 47ccfea..97ab214 100644 (file)
@@ -618,8 +618,9 @@ int rxrpc_kernel_send_data(struct socket *sock, struct rxrpc_call *call,
                ret = rxrpc_send_data(rxrpc_sk(sock->sk), call, msg, len);
                break;
        case RXRPC_CALL_COMPLETE:
-               /* It's too late for this call */
-               ret = -ESHUTDOWN;
+               read_lock_bh(&call->state_lock);
+               ret = -call->error;
+               read_unlock_bh(&call->state_lock);
                break;
        default:
                 /* Request phase complete for this client call */