Message ID | 20240710020055.4116034-1-cuigaosheng1@huawei.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [-next] rxrpc: Remove the BUG in rxkad_init_connection_security | expand |
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:
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@huawei.com> --- net/rxrpc/rxkad.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)