]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
gss_krb5: Fix the error handling path for crypto_sync_skcipher_setkey
authorGaosheng Cui <cuigaosheng1@huawei.com>
Sat, 6 Jul 2024 06:50:08 +0000 (14:50 +0800)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 8 Jul 2024 18:10:06 +0000 (14:10 -0400)
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 <cuigaosheng1@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
net/sunrpc/auth_gss/gss_krb5_keys.c

index 06d8ee0db000fb3a4a5bdcd15734199a0677859b..4eb19c3a54c70e5e3acacce4dbc5e2ea6b81a44e 100644 (file)
@@ -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);