summaryrefslogtreecommitdiff
path: root/net/rxrpc
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2020-10-02 14:04:51 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 09:48:17 +0200
commit2f2a503643ad8204be8f8f8e7fb7f227b5972e4a (patch)
treea87a62a2f8a30a2214111d3252015ac43711a1dd /net/rxrpc
parent81f997b4b9f4527be45699224ec7f7ac4970cef4 (diff)
downloadlinux-rt-2f2a503643ad8204be8f8f8e7fb7f227b5972e4a.tar.gz
rxrpc: Fix server keyring leak
[ Upstream commit 38b1dc47a35ba14c3f4472138ea56d014c2d609b ] If someone calls setsockopt() twice to set a server key keyring, the first keyring is leaked. Fix it to return an error instead if the server key keyring is already set. Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/rxrpc')
-rw-r--r--net/rxrpc/key.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
index 01d2d40ef21c..fa475b02bdce 100644
--- a/net/rxrpc/key.c
+++ b/net/rxrpc/key.c
@@ -899,7 +899,7 @@ int rxrpc_request_key(struct rxrpc_sock *rx, char __user *optval, int optlen)
_enter("");
- if (optlen <= 0 || optlen > PAGE_SIZE - 1)
+ if (optlen <= 0 || optlen > PAGE_SIZE - 1 || rx->securities)
return -EINVAL;
description = memdup_user_nul(optval, optlen);