]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 27 Nov 2025 14:01:57 +0000 (15:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Feb 2026 09:19:44 +0000 (10:19 +0100)
commitd75207465eed20bc9b0daa4a0927de9568996067
tree78af781777bee214e5cc905c8b72f5bb2c2d76ec
parent65a0016016e8b115270d97ca44dce635cbd49375
crypto: iaa - Fix out-of-bounds index in find_empty_iaa_compression_mode

commit 48329301969f6d21b2ef35f678e40f72b59eac94 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: b190447e0fa3 ("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>
drivers/crypto/intel/iaa/iaa_crypto_main.c