diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-10-06 09:41:55 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-10-06 10:39:18 +0800 |
commit | 152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf (patch) | |
tree | 7962c9ec572e92fca5d24af8c66fe451552a9a81 | |
parent | 21155620fbf2edbb071144894ff9d67ba9a1faa0 (diff) | |
download | linux-152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf.tar.gz linux-152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf.tar.bz2 linux-152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf.zip |
dm crypt: Fix reqsize in crypt_iv_eboiv_gen
A skcipher_request object is made up of struct skcipher_request
followed by a variable-sized trailer. The allocation of the
skcipher_request and IV in crypt_iv_eboiv_gen is missing the
memory for struct skcipher_request. Fix it by adding it to
reqsize.
Fixes: e3023094dffb ("dm crypt: Avoid using MAX_CIPHER_BLOCKSIZE")
Cc: <stable@vger.kernel.org> #6.5+
Reported-by: Tatu Heikkilä <tatu.heikkila@gmail.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/md/dm-crypt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index f2662c21a6df..5315fd261c23 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -753,7 +753,8 @@ static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv, int err; u8 *buf; - reqsize = ALIGN(crypto_skcipher_reqsize(tfm), __alignof__(__le64)); + reqsize = sizeof(*req) + crypto_skcipher_reqsize(tfm); + reqsize = ALIGN(reqsize, __alignof__(__le64)); req = kmalloc(reqsize + cc->iv_size, GFP_NOIO); if (!req) |