Commit d1e858c5 authored by David Howells's avatar David Howells

rxrpc: Fix handling of connection failure in client call creation

If rxrpc_connect_call() fails during the creation of a client connection,
there are two bugs that we can hit that need fixing:

 (1) The call state should be moved to RXRPC_CALL_DEAD before the call
     cleanup phase is invoked.  If not, this can cause an assertion failure
     later.

 (2) call->link should be reinitialised after being deleted in
     rxrpc_new_client_call() - which otherwise leads to a failure later
     when the call cleanup attempts to delete the link again.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 2c4579e4
...@@ -425,9 +425,10 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, ...@@ -425,9 +425,10 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
rxrpc_put_call(call); rxrpc_put_call(call);
write_lock_bh(&rxrpc_call_lock); write_lock_bh(&rxrpc_call_lock);
list_del(&call->link); list_del_init(&call->link);
write_unlock_bh(&rxrpc_call_lock); write_unlock_bh(&rxrpc_call_lock);
call->state = RXRPC_CALL_DEAD;
rxrpc_put_call(call); rxrpc_put_call(call);
_leave(" = %d", ret); _leave(" = %d", ret);
return ERR_PTR(ret); return ERR_PTR(ret);
...@@ -439,6 +440,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx, ...@@ -439,6 +440,7 @@ struct rxrpc_call *rxrpc_new_client_call(struct rxrpc_sock *rx,
*/ */
found_user_ID_now_present: found_user_ID_now_present:
write_unlock(&rx->call_lock); write_unlock(&rx->call_lock);
call->state = RXRPC_CALL_DEAD;
rxrpc_put_call(call); rxrpc_put_call(call);
_leave(" = -EEXIST [%p]", call); _leave(" = -EEXIST [%p]", call);
return ERR_PTR(-EEXIST); return ERR_PTR(-EEXIST);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment