aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-09-04 08:10:10 -0400
committerDavid Howells <dhowells@redhat.com>2016-09-04 08:10:10 -0400
commitaf338a9ea60acc6337fe9fcdcf664aec2520e541 (patch)
tree5d7883b1d7cee050b782c540b7cee933adb12dd5
parent00b5407e427ac2588a2496b92035a94602b3cd1b (diff)
rxrpc: The client call state must be changed before attachment to conn
We must set the client call state to RXRPC_CALL_CLIENT_SEND_REQUEST before attaching the call to the connection struct, not after, as it's liable to receive errors and conn aborts as soon as the assignment is made - and these will cause its state to be changed outside of the initiating thread's control. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--net/rxrpc/call_object.c2
-rw-r--r--net/rxrpc/conn_client.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 57e00fc9cff2..65691742199b 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -197,8 +197,6 @@ static int rxrpc_begin_client_call(struct rxrpc_call *call,
197 if (ret < 0) 197 if (ret < 0)
198 return ret; 198 return ret;
199 199
200 call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
201
202 spin_lock(&call->conn->params.peer->lock); 200 spin_lock(&call->conn->params.peer->lock);
203 hlist_add_head(&call->error_link, &call->conn->params.peer->error_targets); 201 hlist_add_head(&call->error_link, &call->conn->params.peer->error_targets);
204 spin_unlock(&call->conn->params.peer->lock); 202 spin_unlock(&call->conn->params.peer->lock);
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 4b213bc0f554..e19804dd6c8d 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -537,6 +537,10 @@ static void rxrpc_activate_one_channel(struct rxrpc_connection *conn,
537 struct rxrpc_call, chan_wait_link); 537 struct rxrpc_call, chan_wait_link);
538 u32 call_id = chan->call_counter + 1; 538 u32 call_id = chan->call_counter + 1;
539 539
540 write_lock_bh(&call->state_lock);
541 call->state = RXRPC_CALL_CLIENT_SEND_REQUEST;
542 write_unlock_bh(&call->state_lock);
543
540 rxrpc_see_call(call); 544 rxrpc_see_call(call);
541 list_del_init(&call->chan_wait_link); 545 list_del_init(&call->chan_wait_link);
542 conn->active_chans |= 1 << channel; 546 conn->active_chans |= 1 << channel;