dm-crypt: Extend state buffer size in crypt_iv_lmk_one

On Thu, Jun 19, 2025 at 11:17:37PM +0200, Milan Broz wrote:
>
> : Call Trace:
> :  crypto_shash_export+0x65/0xc0
> :  crypt_iv_lmk_one+0x106/0x1a0 [dm_crypt]

Thanks for the report.  The problem is that crypt_iv_lmk_one is
calling crypto_shash_export using a buffer that is less than the
size as returned by crypto_shash_statesize.

The easiest fix is to expand the buffer to HASH_MAX_STATESIZE:

---8<---
The output buffer size of of crypto_shash_export is returned by
crypto_shash_statesize.  Alternatively HASH_MAX_STATESIZE may be
used for stack buffers.

Fixes: 8cf4c341f193 ("crypto: md5-generic - Use API partial block handling")
Reported-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 file changed