Re: [PATCH] crypto: iaa - Fix potential use after free bug

From: Herbert Xu
Date: Fri Aug 02 2024 - 09:16:54 EST


On Wed, Jul 24, 2024 at 11:09:43AM -0500, Dan Carpenter wrote:
> 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@xxxxxxxxxx>
> ---
> drivers/crypto/intel/iaa/iaa_crypto_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt