aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/ar-connevent.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-04-11 15:34:42 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-11 15:34:42 -0400
commit7c3da7d0d4f3506ef70d9cf148a22400477854d0 (patch)
tree717c4bd8d4a001016917688b38ce767ecf79ce39 /net/rxrpc/ar-connevent.c
parentc64a73d584cc344915baee1183c791c0d0c42d79 (diff)
parente0e4d82f3be60cfe8b10304c6daf3ca5973ae9e3 (diff)
Merge branch 'rprpc-2nd-rewrite-part-1'
David Howells says: ==================== RxRPC: 2nd rewrite part 1 Okay, I'm in the process of rewriting the RxRPC rewrite. The primary aim of this second rewrite is to strictly control the number of active connections we know about and to get rid of connections we don't need much more quickly. On top of this, there are fixes to the protocol handling which will all occur in later parts. Here's the first set of patches from the second go, aimed at net-next. These are all fixes and cleanups preparatory to the main event. Notable parts of this set include: (1) A fix for the AFS filesystem to wait for outstanding calls to complete before closing the RxRPC socket. (2) Differentiation of local and remote abort codes. At a future point userspace will get to see this via control message data on recvmsg(). (3) Absorb the rxkad module into the af_rxrpc module to prevent a dependency loop. (4) Create a null security module and unconditionalise calls into the security module that's in force (there will always be a security module applied to a connection, even if it's just the null one). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rxrpc/ar-connevent.c')
-rw-r--r--net/rxrpc/ar-connevent.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/net/rxrpc/ar-connevent.c b/net/rxrpc/ar-connevent.c
index 1bdaaed8cdc4..5f9563968a5b 100644
--- a/net/rxrpc/ar-connevent.c
+++ b/net/rxrpc/ar-connevent.c
@@ -40,11 +40,13 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn, int state,
40 write_lock(&call->state_lock); 40 write_lock(&call->state_lock);
41 if (call->state <= RXRPC_CALL_COMPLETE) { 41 if (call->state <= RXRPC_CALL_COMPLETE) {
42 call->state = state; 42 call->state = state;
43 call->abort_code = abort_code; 43 if (state == RXRPC_CALL_LOCALLY_ABORTED) {
44 if (state == RXRPC_CALL_LOCALLY_ABORTED) 44 call->local_abort = conn->local_abort;
45 set_bit(RXRPC_CALL_EV_CONN_ABORT, &call->events); 45 set_bit(RXRPC_CALL_EV_CONN_ABORT, &call->events);
46 else 46 } else {
47 call->remote_abort = conn->remote_abort;
47 set_bit(RXRPC_CALL_EV_RCVD_ABORT, &call->events); 48 set_bit(RXRPC_CALL_EV_RCVD_ABORT, &call->events);
49 }
48 rxrpc_queue_call(call); 50 rxrpc_queue_call(call);
49 } 51 }
50 write_unlock(&call->state_lock); 52 write_unlock(&call->state_lock);
@@ -84,8 +86,8 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
84 86
85 rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code); 87 rxrpc_abort_calls(conn, RXRPC_CALL_LOCALLY_ABORTED, abort_code);
86 88
87 msg.msg_name = &conn->trans->peer->srx.transport.sin; 89 msg.msg_name = &conn->trans->peer->srx.transport;
88 msg.msg_namelen = sizeof(conn->trans->peer->srx.transport.sin); 90 msg.msg_namelen = conn->trans->peer->srx.transport_len;
89 msg.msg_control = NULL; 91 msg.msg_control = NULL;
90 msg.msg_controllen = 0; 92 msg.msg_controllen = 0;
91 msg.msg_flags = 0; 93 msg.msg_flags = 0;
@@ -101,7 +103,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
101 whdr._rsvd = 0; 103 whdr._rsvd = 0;
102 whdr.serviceId = htons(conn->service_id); 104 whdr.serviceId = htons(conn->service_id);
103 105
104 word = htonl(abort_code); 106 word = htonl(conn->local_abort);
105 107
106 iov[0].iov_base = &whdr; 108 iov[0].iov_base = &whdr;
107 iov[0].iov_len = sizeof(whdr); 109 iov[0].iov_len = sizeof(whdr);
@@ -112,7 +114,7 @@ static int rxrpc_abort_connection(struct rxrpc_connection *conn,
112 114
113 serial = atomic_inc_return(&conn->serial); 115 serial = atomic_inc_return(&conn->serial);
114 whdr.serial = htonl(serial); 116 whdr.serial = htonl(serial);
115 _proto("Tx CONN ABORT %%%u { %d }", serial, abort_code); 117 _proto("Tx CONN ABORT %%%u { %d }", serial, conn->local_abort);
116 118
117 ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 2, len); 119 ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 2, len);
118 if (ret < 0) { 120 if (ret < 0) {
@@ -172,15 +174,10 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
172 return -ECONNABORTED; 174 return -ECONNABORTED;
173 175
174 case RXRPC_PACKET_TYPE_CHALLENGE: 176 case RXRPC_PACKET_TYPE_CHALLENGE:
175 if (conn->security) 177 return conn->security->respond_to_challenge(conn, skb,
176 return conn->security->respond_to_challenge( 178 _abort_code);
177 conn, skb, _abort_code);
178 return -EPROTO;
179 179
180 case RXRPC_PACKET_TYPE_RESPONSE: 180 case RXRPC_PACKET_TYPE_RESPONSE:
181 if (!conn->security)
182 return -EPROTO;
183
184 ret = conn->security->verify_response(conn, skb, _abort_code); 181 ret = conn->security->verify_response(conn, skb, _abort_code);
185 if (ret < 0) 182 if (ret < 0)
186 return ret; 183 return ret;
@@ -236,8 +233,6 @@ static void rxrpc_secure_connection(struct rxrpc_connection *conn)
236 } 233 }
237 } 234 }
238 235
239 ASSERT(conn->security != NULL);
240
241 if (conn->security->issue_challenge(conn) < 0) { 236 if (conn->security->issue_challenge(conn) < 0) {
242 abort_code = RX_CALL_DEAD; 237 abort_code = RX_CALL_DEAD;
243 ret = -ENOMEM; 238 ret = -ENOMEM;