Message ID | 20210825055918.51975-1-ebiggers@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | blk-crypto: fix check for too-large dun_bytes | expand |
On 8/24/21 11:59 PM, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > 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. Applied, thanks.
diff --git a/block/blk-crypto.c b/block/blk-crypto.c index c5bdaafffa29f..103c2e2d50d67 100644 --- a/block/blk-crypto.c +++ b/block/blk-crypto.c @@ -332,7 +332,7 @@ int blk_crypto_init_key(struct blk_crypto_key *blk_key, const u8 *raw_key, if (mode->keysize == 0) return -EINVAL; - if (dun_bytes == 0 || dun_bytes > BLK_CRYPTO_MAX_IV_SIZE) + if (dun_bytes == 0 || dun_bytes > mode->ivsize) return -EINVAL; if (!is_power_of_2(data_unit_size))