From: Gaosheng Cui Date: Sat, 6 Jul 2024 06:50:08 +0000 (+0800) Subject: gss_krb5: Fix the error handling path for crypto_sync_skcipher_setkey X-Git-Tag: v6.11-rc1~161^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a3123341dc358952ce2bf8067fbdfb7eaadf71bb;p=thirdparty%2Flinux.git gss_krb5: Fix the error handling path for crypto_sync_skcipher_setkey If we fail to call crypto_sync_skcipher_setkey, we should free the memory allocation for cipher, replace err_return with err_free_cipher to free the memory of cipher. Fixes: 4891f2d008e4 ("gss_krb5: import functionality to derive keys into the kernel") Signed-off-by: Gaosheng Cui Reviewed-by: Simon Horman Signed-off-by: Chuck Lever --- diff --git a/net/sunrpc/auth_gss/gss_krb5_keys.c b/net/sunrpc/auth_gss/gss_krb5_keys.c index 06d8ee0db000f..4eb19c3a54c70 100644 --- a/net/sunrpc/auth_gss/gss_krb5_keys.c +++ b/net/sunrpc/auth_gss/gss_krb5_keys.c @@ -168,7 +168,7 @@ static int krb5_DK(const struct gss_krb5_enctype *gk5e, goto err_return; blocksize = crypto_sync_skcipher_blocksize(cipher); if (crypto_sync_skcipher_setkey(cipher, inkey->data, inkey->len)) - goto err_return; + goto err_free_cipher; ret = -ENOMEM; inblockdata = kmalloc(blocksize, gfp_mask);