* [PATCH -next] rxrpc: Fix the error handling path in rxkad_init_connection_security
@ 2024-07-09 10:49 Gaosheng Cui
2024-07-09 17:58 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Gaosheng Cui @ 2024-07-09 10:49 UTC (permalink / raw)
To: dhowells, marc.dionne, davem, edumazet, kuba, pabeni,
cuigaosheng1
Cc: linux-afs, netdev
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(-)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH -next] rxrpc: Fix the error handling path in rxkad_init_connection_security
2024-07-09 10:49 [PATCH -next] rxrpc: Fix the error handling path in rxkad_init_connection_security Gaosheng Cui
@ 2024-07-09 17:58 ` Simon Horman
0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2024-07-09 17:58 UTC (permalink / raw)
To: Gaosheng Cui
Cc: dhowells, marc.dionne, davem, edumazet, kuba, pabeni, linux-afs,
netdev
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-09 17:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-09 10:49 [PATCH -next] rxrpc: Fix the error handling path in rxkad_init_connection_security Gaosheng Cui
2024-07-09 17:58 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).