blk-crypto: fix check for too-large dun_bytes
authorEric Biggers <ebiggers@google.com>
Wed, 25 Aug 2021 05:59:18 +0000 (22:59 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 07:50:30 +0000 (09:50 +0200)
commit80b1a70b045051ae3e5497565c6f6c24962d6c77
treee408775e818ab32fbc05afdd53448bb3a9d803f9
parentba6e5af621ab2fb4cd4acb37d4914c832991689c
blk-crypto: fix check for too-large dun_bytes

[ Upstream commit cc40b7225151f611ef837f6403cfaeadc7af214a ]

dun_bytes needs to be less than or equal to the IV size of the
encryption mode, not just less than or equal to BLK_CRYPTO_MAX_IV_SIZE.

Currently this doesn't matter since blk_crypto_init_key() is never
actually passed invalid values, but we might as well fix this.

Fixes: a892c8d52c02 ("block: Inline encryption support for blk-mq")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20210825055918.51975-1-ebiggers@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-crypto.c