Skip to content

Commit 38b1dc4

Browse files
committed
rxrpc: Fix server keyring leak
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: 17926a7 ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Signed-off-by: David Howells <dhowells@redhat.com>
1 parent fea9911 commit 38b1dc4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/rxrpc/key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ int rxrpc_request_key(struct rxrpc_sock *rx, sockptr_t optval, int optlen)
903903

904904
_enter("");
905905

906-
if (optlen <= 0 || optlen > PAGE_SIZE - 1)
906+
if (optlen <= 0 || optlen > PAGE_SIZE - 1 || rx->securities)
907907
return -EINVAL;
908908

909909
description = memdup_sockptr_nul(optval, optlen);

0 commit comments

Comments
 (0)