[PATCH -next] rxrpc: Fix the error handling path in rxkad_init_connection_security

Gaosheng Cui cuigaosheng1 at huawei.com
Tue Jul 9 03:49:10 PDT 2024


If security_level of rxrpc_connection is invalid, ci should be freed
by crypto_free_sync_skcipher, replace error with error_ci to fix the
memory leak.

Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Signed-off-by: Gaosheng Cui <cuigaosheng1 at huawei.com>
---
 net/rxrpc/rxkad.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 48a1475e6b06..104bb1ec9002 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -125,7 +125,7 @@ static int rxkad_init_connection_security(struct rxrpc_connection *conn,
 		break;
 	default:
 		ret = -EKEYREJECTED;
-		goto error;
+		goto error_ci;
 	}
 
 	ret = rxkad_prime_packet_security(conn, ci);
-- 
2.25.1




More information about the linux-afs mailing list