[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240710020055.4116034-1-cuigaosheng1@huawei.com>
Date: Wed, 10 Jul 2024 10:00:55 +0800
From: Gaosheng Cui <cuigaosheng1@...wei.com>
To: <dhowells@...hat.com>, <marc.dionne@...istor.com>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<cuigaosheng1@...wei.com>
CC: <linux-afs@...ts.infradead.org>, <netdev@...r.kernel.org>
Subject: [PATCH -next] rxrpc: Remove the BUG in rxkad_init_connection_security
If crypto_sync_skcipher_setkey fails, we only need to return the
error code, It is not necessary to trigger the BUG directly.
Signed-off-by: Gaosheng Cui <cuigaosheng1@...wei.com>
---
net/rxrpc/rxkad.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/rxrpc/rxkad.c b/net/rxrpc/rxkad.c
index 104bb1ec9002..75d291ada9e8 100644
--- a/net/rxrpc/rxkad.c
+++ b/net/rxrpc/rxkad.c
@@ -114,9 +114,10 @@ static int rxkad_init_connection_security(struct rxrpc_connection *conn,
goto error;
}
- if (crypto_sync_skcipher_setkey(ci, token->kad->session_key,
- sizeof(token->kad->session_key)) < 0)
- BUG();
+ ret = crypto_sync_skcipher_setkey(ci, token->kad->session_key,
+ sizeof(token->kad->session_key));
+ if (ret < 0)
+ goto error_ci;
switch (conn->security_level) {
case RXRPC_SECURITY_PLAIN:
--
2.25.1
Powered by blists - more mailing lists