Skip to contentSkip to conversation

rxrpc: fix reference count leak in rxrpc_server_keyring()

PATCH New Ren Wei 1 participant 1 message Mar 30 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ren Wei

author
#1 lore raw

PATCH 1/1 rxrpc: fix reference count leak in rxrpc_server_keyring()

From: Luxiao Xu <[email protected]>

This patch fixes a reference count leak in rxrpc_server_keyring() by checking if rx->securities is already set.

Fixes 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
---
 net/rxrpc/server_key.c | 3 +++
 1 file changed, 3 insertions(+)
net/rxrpc/server_key.c +3 -0
index 36b05fd842a7..d4777851079f 100644
@@ -125,6 +125,9 @@ int rxrpc_server_keyring(struct rxrpc_sock *rx, sockptr_t optval, int optlen)
 
 	_enter("");
 
+	if (rx->securities)
+		return -EEXIST;
+
 	if (optlen <= 0 || optlen > PAGE_SIZE - 1)
 		return -EINVAL;
 
Signature · 1 line
2.43.0