From: Herbert Xu Date: Sat, 15 Feb 2025 00:57:51 +0000 (+0800) Subject: crypto: skcipher - Zap type in crypto_alloc_sync_skcipher X-Git-Tag: v6.15-rc1~118^2~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ee509efc74ddbc59bb5d6fd6e050f9ef25f74bff;p=thirdparty%2Fkernel%2Flinux.git crypto: skcipher - Zap type in crypto_alloc_sync_skcipher The type needs to be zeroed as otherwise the user could use it to allocate an asynchronous sync skcipher. Signed-off-by: Herbert Xu --- diff --git a/crypto/skcipher.c b/crypto/skcipher.c index e3751cc88b76e..cdf0f11c7eaa3 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -682,6 +682,7 @@ struct crypto_sync_skcipher *crypto_alloc_sync_skcipher( /* Only sync algorithms allowed. */ mask |= CRYPTO_ALG_ASYNC | CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE; + type &= ~(CRYPTO_ALG_ASYNC | CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE); tfm = crypto_alloc_tfm(alg_name, &crypto_skcipher_type, type, mask);