Commit 278ac0cd authored by David Howells's avatar David Howells

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: default avatarDavid Howells <dhowells@redhat.com>
parent f4fdb352
...@@ -475,6 +475,7 @@ struct rxrpc_call { ...@@ -475,6 +475,7 @@ struct rxrpc_call {
atomic_t skb_count; /* Outstanding packets on this call */ atomic_t skb_count; /* Outstanding packets on this call */
atomic_t sequence; /* Tx data packet sequence counter */ atomic_t sequence; /* Tx data packet sequence counter */
u16 service_id; /* service ID */ u16 service_id; /* service ID */
u8 security_ix; /* Security type */
u32 call_id; /* call ID on connection */ u32 call_id; /* call ID on connection */
u32 cid; /* connection ID plus channel index */ u32 cid; /* connection ID plus channel index */
int debug_id; /* debug ID for printks */ int debug_id; /* debug ID for printks */
......
...@@ -345,6 +345,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx, ...@@ -345,6 +345,7 @@ struct rxrpc_call *rxrpc_incoming_call(struct rxrpc_sock *rx,
candidate->peer = conn->params.peer; candidate->peer = conn->params.peer;
candidate->cid = sp->hdr.cid; candidate->cid = sp->hdr.cid;
candidate->call_id = sp->hdr.callNumber; candidate->call_id = sp->hdr.callNumber;
candidate->security_ix = sp->hdr.securityIndex;
candidate->rx_data_post = 0; candidate->rx_data_post = 0;
candidate->state = RXRPC_CALL_SERVER_ACCEPTING; candidate->state = RXRPC_CALL_SERVER_ACCEPTING;
candidate->flags |= (1 << RXRPC_CALL_IS_SERVICE); candidate->flags |= (1 << RXRPC_CALL_IS_SERVICE);
......
...@@ -348,6 +348,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call, ...@@ -348,6 +348,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
if (cp->exclusive) { if (cp->exclusive) {
call->conn = candidate; call->conn = candidate;
call->security_ix = candidate->security_ix;
_leave(" = 0 [exclusive %d]", candidate->debug_id); _leave(" = 0 [exclusive %d]", candidate->debug_id);
return 0; return 0;
} }
...@@ -395,6 +396,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call, ...@@ -395,6 +396,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
candidate_published: candidate_published:
set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags); set_bit(RXRPC_CONN_IN_CLIENT_CONNS, &candidate->flags);
call->conn = candidate; call->conn = candidate;
call->security_ix = candidate->security_ix;
spin_unlock(&local->client_conns_lock); spin_unlock(&local->client_conns_lock);
_leave(" = 0 [new %d]", candidate->debug_id); _leave(" = 0 [new %d]", candidate->debug_id);
return 0; return 0;
...@@ -412,6 +414,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call, ...@@ -412,6 +414,7 @@ static int rxrpc_get_client_conn(struct rxrpc_call *call,
spin_lock(&conn->channel_lock); spin_lock(&conn->channel_lock);
call->conn = conn; call->conn = conn;
call->security_ix = conn->security_ix;
list_add(&call->chan_wait_link, &conn->waiting_calls); list_add(&call->chan_wait_link, &conn->waiting_calls);
spin_unlock(&conn->channel_lock); spin_unlock(&conn->channel_lock);
_leave(" = 0 [extant %d]", conn->debug_id); _leave(" = 0 [extant %d]", conn->debug_id);
......
...@@ -198,7 +198,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call, ...@@ -198,7 +198,7 @@ static int rxrpc_fast_process_data(struct rxrpc_call *call,
/* if the packet need security things doing to it, then it goes down /* if the packet need security things doing to it, then it goes down
* the slow path */ * the slow path */
if (call->conn->security_ix) if (call->security_ix)
goto enqueue_packet; goto enqueue_packet;
sp->call = call; sp->call = call;
......
...@@ -322,7 +322,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, ...@@ -322,7 +322,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
sp->hdr.serial = atomic_inc_return(&conn->serial); sp->hdr.serial = atomic_inc_return(&conn->serial);
sp->hdr.type = RXRPC_PACKET_TYPE_DATA; sp->hdr.type = RXRPC_PACKET_TYPE_DATA;
sp->hdr.userStatus = 0; sp->hdr.userStatus = 0;
sp->hdr.securityIndex = conn->security_ix; sp->hdr.securityIndex = call->security_ix;
sp->hdr._rsvd = 0; sp->hdr._rsvd = 0;
sp->hdr.serviceId = call->service_id; sp->hdr.serviceId = call->service_id;
......
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