Message ID | 20240709104910.3397496-1-cuigaosheng1@huawei.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [-next] rxrpc: Fix the error handling path in rxkad_init_connection_security | expand |
On Tue, Jul 09, 2024 at 06:49:10PM +0800, Gaosheng Cui wrote: > 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@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> As an aside, the BUG() in the middle of rxkad_init_connection_security() is a bit of a surprise.
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);
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@huawei.com> --- net/rxrpc/rxkad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)