rxrpc: add rxrpc_sock_set_min_security_level

Add a helper to directly set the RXRPC_MIN_SECURITY_LEVEL sockopt from
kernel space without going through a fake uaccess.

Thanks to David Howells for the documentation updates.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Christoph Hellwig
2020-05-28 07:12:35 +02:00
committed by David S. Miller
parent 7d7207c2d5
commit 298cd88a66
4 changed files with 28 additions and 6 deletions

View File

@@ -571,6 +571,19 @@ out:
return ret;
}
int rxrpc_sock_set_min_security_level(struct sock *sk, unsigned int val)
{
if (sk->sk_state != RXRPC_UNBOUND)
return -EISCONN;
if (val > RXRPC_SECURITY_MAX)
return -EINVAL;
lock_sock(sk);
rxrpc_sk(sk)->min_sec_level = val;
release_sock(sk);
return 0;
}
EXPORT_SYMBOL(rxrpc_sock_set_min_security_level);
/*
* set RxRPC socket options
*/