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.14.9~402 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85919fcb987d616be8489d0a7d3b7a61e396c19c;p=thirdparty%2Fkernel%2Fstable.git crypto: skcipher - Zap type in crypto_alloc_sync_skcipher [ Upstream commit ee509efc74ddbc59bb5d6fd6e050f9ef25f74bff ] The type needs to be zeroed as otherwise the user could use it to allocate an asynchronous sync skcipher. Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- diff --git a/crypto/skcipher.c b/crypto/skcipher.c index a9eb2dcf28982..2d2b1589a0097 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -681,6 +681,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);