]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: skcipher - Zap type in crypto_alloc_sync_skcipher
authorHerbert Xu <herbert@gondor.apana.org.au>
Sat, 15 Feb 2025 00:57:51 +0000 (08:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:10 +0000 (11:13 +0200)
[ 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 <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
crypto/skcipher.c

index a9eb2dcf289821e559707324231e24d067a8d4ec..2d2b1589a0097193c6bfd3ef48bb9fc238c7f02b 100644 (file)
@@ -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);