]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: iaa - Fix potential use after free bug
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 24 Jul 2024 16:09:43 +0000 (11:09 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:37:15 +0000 (16:37 +0200)
commitc66f0be993ba52410edab06124c54ecf143b05c1
tree06d186252ff9b282d496f8cdb6b67f63945addb7
parent70bae3641ff4e9c750a207627d920a3efcd6c131
crypto: iaa - Fix potential use after free bug

[ Upstream commit e0d3b845a1b10b7b5abdad7ecc69d45b2aab3209 ]

The free_device_compression_mode(iaa_device, device_mode) function frees
"device_mode" but it iss passed to iaa_compression_modes[i]->free() a few
lines later resulting in a use after free.

The good news is that, so far as I can tell, nothing implements the
->free() function and the use after free happens in dead code.  But, with
this fix, when something does implement it, we'll be ready.  :)

Fixes: b190447e0fa3 ("crypto: iaa - Add compression mode management along with fixed mode")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/intel/iaa/iaa_crypto_main.c