diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2023-10-06 09:41:55 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-19 23:10:56 +0200 |
commit | 59073dfbc666aaaa6a0422a61bdce7995c94d1c8 (patch) | |
tree | 935fba42a352d7c14a5435de5423b9c0f94b04df | |
parent | 2a1ddddba6541143c8f73962f3021f1789114284 (diff) | |
download | linux-stable-59073dfbc666aaaa6a0422a61bdce7995c94d1c8.tar.gz linux-stable-59073dfbc666aaaa6a0422a61bdce7995c94d1c8.tar.bz2 linux-stable-59073dfbc666aaaa6a0422a61bdce7995c94d1c8.zip |
dm crypt: Fix reqsize in crypt_iv_eboiv_gen
commit 152d0bcdf1efcb54a4fa20f694e9c7bbb6d06cbf upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 1dc6227d353e..dc0463bf3c2c 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) |