aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2016-09-07 10:19:25 -0400
committerDavid Howells <dhowells@redhat.com>2016-09-07 10:30:22 -0400
commit278ac0cdd5e516bdef2b9b8f5a4dd6366a5bccfe (patch)
tree66c323033869878b0ca7b740ac8bf06f94462780
parentf4fdb3525b247e1b4f9cc563641494c96c80f91a (diff)
rxrpc: Cache the security index in the rxrpc_call struct
Cache the security index in the rxrpc_call struct so that we can get at it even when the call has been disconnected and the connection pointer cleared. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--net/rxrpc/ar-internal.h1
-rw-r--r--net/rxrpc/call_object.c1
-rw-r--r--net/rxrpc/conn_client.c3
-rw-r--r--net/rxrpc/input.c2
-rw-r--r--net/rxrpc/sendmsg.c2
5 files changed, 7 insertions, 2 deletions
diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 913255a53564..e3dfc9da05fe 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -475,6 +475,7 @@ struct rxrpc_call {
475 atomic_t skb_count; /* Outstanding packets on this call */ 475 atomic_t skb_count; /* Outstanding packets on this call */
476 atomic_t sequence; /* Tx data packet sequence counter */ 476 atomic_t sequence; /* Tx data packet sequence counter */
477 u16 service_id; /* service ID */ 477 u16 service_id; /* service ID */
478 u8 security_ix; /* Security type */
478 u32 call_id; /* call ID on connection */ 479 u32 call_id; /* call ID on connection */
479 u32 cid; /* connection ID plus channel index */ 480 u32 cid; /* connection ID plus channel index */
480 int debug_id; /* debug ID for printks */ 481 int debug_id; /* debug ID for printks */
diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c
index 060ddc32a85e..83019e489555 100644
--- a/net/rxrpc/call_object.c
+++ b/net/rxrpc/call_object.c
@@ -345,6 +345,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
345 candidate->peer = conn->params.peer; 345 candidate->peer = conn->params.peer;
346 candidate->cid = sp->hdr.cid; 346 candidate->cid = sp->hdr.cid;
347 candidate->call_id = sp->hdr.callNumber; 347 candidate->call_id = sp->hdr.callNumber;
348 candidate->security_ix = sp->hdr.securityIndex;
348 candidate->rx_data_post = 0; 349 candidate->rx_data_post = 0;
349 candidate->state = RXRPC_CALL_SERVER_ACCEPTING; 350 candidate->state = RXRPC_CALL_SERVER_ACCEPTING;
350 candidate->flags |= (1 << RXRPC_CALL_IS_SERVICE); 351 candidate->flags |= (1 << RXRPC_CALL_IS_SERVICE);
diff --git a/net/rxrpc/conn_client.c b/net/rxrpc/conn_client.c
index 82de1aeaef21..9344a8416ceb 100644
--- a/net/rxrpc/conn_client.c
+++ b/net/rxrpc/conn_client.c
@@ -348,6 +348,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
348 348
349 if (cp->exclusive) { 349 if (cp->exclusive) {
350 call->conn = candidate; 350 call->conn = candidate;
351 call->security_ix = candidate->security_ix;
351 _leave(" = 0 [exclusive %d]", candidate->debug_id); 352 _leave(" = 0 [exclusive %d]", candidate->debug_id);
352 return 0; 353 return 0;
353 } 354 }
@@ -395,6 +396,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
395candidate_published: 396candidate_published:
396 set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags); 397 set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags);
397 call->conn = candidate; 398 call->conn = candidate;
399 call->security_ix = candidate->security_ix;
398 spin_unlock(&local->client_conns_lock); 400 spin_unlock(&local->client_conns_lock);
399 _leave(" = 0 [new %d]", candidate->debug_id); 401 _leave(" = 0 [new %d]", candidate->debug_id);
400 return 0; 402 return 0;
@@ -412,6 +414,7 @@ found_extant_conn:
412 414
413 spin_lock(&conn->channel_lock); 415 spin_lock(&conn->channel_lock);
414 call->conn = conn; 416 call->conn = conn;
417 call->security_ix = conn->security_ix;
415 list_add(&call->chan_wait_link, &conn->waiting_calls); 418 list_add(&call->chan_wait_link, &conn->waiting_calls);
416 spin_unlock(&conn->channel_lock); 419 spin_unlock(&conn->channel_lock);
417 _leave(" = 0 [extant %d]", conn->debug_id); 420 _leave(" = 0 [extant %d]", conn->debug_id);
diff --git a/net/rxrpc/input.c b/net/rxrpc/input.c
index f7239a6f9181..9242fefd7f40 100644
--- a/net/rxrpc/input.c
+++ b/net/rxrpc/input.c
@@ -198,7 +198,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call,
198 198
199 /* if the packet need security things doing to it, then it goes down 199 /* if the packet need security things doing to it, then it goes down
200 * the slow path */ 200 * the slow path */
201 if (call->conn->security_ix) 201 if (call->security_ix)
202 goto enqueue_packet; 202 goto enqueue_packet;
203 203
204 sp->call = call; 204 sp->call = call;
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 803078bea507..2439aff131c7 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -322,7 +322,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
322 sp->hdr.serial = atomic_inc_return(&conn->serial); 322 sp->hdr.serial = atomic_inc_return(&conn->serial);
323 sp->hdr.type = RXRPC_PACKET_TYPE_DATA; 323 sp->hdr.type = RXRPC_PACKET_TYPE_DATA;
324 sp->hdr.userStatus = 0; 324 sp->hdr.userStatus = 0;
325 sp->hdr.securityIndex = conn->security_ix; 325 sp->hdr.securityIndex = call->security_ix;
326 sp->hdr._rsvd = 0; 326 sp->hdr._rsvd = 0;
327 sp->hdr.serviceId = call->service_id; 327 sp->hdr.serviceId = call->service_id;
328 328