* [PATCH] blk-crypto: fix check for too-large dun_bytes
@ 2021-08-25 5:59 Eric Biggers
2021-08-25 12:45 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Eric Biggers @ 2021-08-25 5:59 UTC (permalink / raw)
To: linux-block; +Cc: Satya Tangirala
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.
Fixes: a892c8d52c02 ("block: Inline encryption support for blk-mq")
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
block/blk-crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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))
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] blk-crypto: fix check for too-large dun_bytes
2021-08-25 5:59 [PATCH] blk-crypto: fix check for too-large dun_bytes Eric Biggers
@ 2021-08-25 12:45 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-08-25 12:45 UTC (permalink / raw)
To: Eric Biggers, linux-block; +Cc: Satya Tangirala
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.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-25 12:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 5:59 [PATCH] blk-crypto: fix check for too-large dun_bytes Eric Biggers
2021-08-25 12:45 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.