linux/drivers/crypto/intel
Thorsten Blum c77b33b585 crypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode
commit 4832930196 upstream.

The local variable 'i' is initialized with -EINVAL, but the for loop
immediately overwrites it and -EINVAL is never returned.

If no empty compression mode can be found, the function would return the
out-of-bounds index IAA_COMP_MODES_MAX, which would cause an invalid
array access in add_iaa_compression_mode().

Fix both issues by returning either a valid index or -EINVAL.

Cc: stable@vger.kernel.org
Fixes: b190447e0f ("crypto: iaa - Add compression mode management along with fixed mode")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-02-16 10:18:43 +01:00
..
iaa crypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode 2026-02-16 10:18:43 +01:00
ixp4xx crypto: ixp4xx - fix OF node reference leaks in init_ixp_crypto() 2025-02-08 09:57:30 +01:00
keembay crypto: keembay - Add missing check after sg_nents_for_len() 2025-10-15 12:00:05 +02:00
qat crypto: qat - fix duplicate restarting msg during AER error 2026-01-17 16:31:21 +01:00
Kconfig crypto: iaa - Add Intel IAA Compression Accelerator crypto driver core 2023-12-15 17:52:53 +08:00
Makefile crypto: iaa - Add Intel IAA Compression Accelerator crypto driver core 2023-12-15 17:52:53 +08:00