summaryrefslogtreecommitdiffstats
path: root/net/rxrpc/security.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2022-10-20 21:58:36 +0100
committerDavid Howells <dhowells@redhat.com>2022-12-01 13:36:41 +0000
commitf3441d4125fc98995858550a5521b8d7daf0504a (patch)
treeae8f9ea3179dfa461ae1bad59189eb447e99ef0e /net/rxrpc/security.c
parent15f661dc95daec9b38e8e4cc931c95afe0ae0cef (diff)
downloadlinux-f3441d4125fc98995858550a5521b8d7daf0504a.tar.gz
linux-f3441d4125fc98995858550a5521b8d7daf0504a.tar.bz2
linux-f3441d4125fc98995858550a5521b8d7daf0504a.zip
rxrpc: Copy client call parameters into rxrpc_call earlier
Copy client call parameters into rxrpc_call earlier so that that can be used to convey them to the connection code - which can then be offloaded to the I/O thread. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
Diffstat (limited to 'net/rxrpc/security.c')
-rw-r--r--net/rxrpc/security.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/net/rxrpc/security.c b/net/rxrpc/security.c
index e6ddac9b3732..209f2c25a0da 100644
--- a/net/rxrpc/security.c
+++ b/net/rxrpc/security.c
@@ -63,6 +63,36 @@ const struct rxrpc_security *rxrpc_security_lookup(u8 security_index)
}
/*
+ * Initialise the security on a client call.
+ */
+int rxrpc_init_client_call_security(struct rxrpc_call *call)
+{
+ const struct rxrpc_security *sec;
+ struct rxrpc_key_token *token;
+ struct key *key = call->key;
+ int ret;
+
+ if (!key)
+ return 0;
+
+ ret = key_validate(key);
+ if (ret < 0)
+ return ret;
+
+ for (token = key->payload.data[0]; token; token = token->next) {
+ sec = rxrpc_security_lookup(token->security_index);
+ if (sec)
+ goto found;
+ }
+ return -EKEYREJECTED;
+
+found:
+ call->security = sec;
+ _leave(" = 0");
+ return 0;
+}
+
+/*
* initialise the security on a client connection
*/
int rxrpc_init_client_conn_security(struct rxrpc_connection *conn)