Commit 152d0bcd authored by Herbert Xu's avatar Herbert Xu

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: e3023094 ("dm crypt: Avoid using MAX_CIPHER_BLOCKSIZE")
Cc: <stable@vger.kernel.org> #6.5+
Reported-by: default avatarTatu Heikkilä <tatu.heikkila@gmail.com>
Reviewed-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 21155620
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment