From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: iaa - Fix potential use after free bug
Date: Mon, 29 Jul 2024 11:40:18 -0500 [thread overview]
Message-ID: <d11ad678099ccce94eacf721c8d06a38129ce2d3.camel@linux.intel.com> (raw)
In-Reply-To: <e049271f-41f2-4d04-ac69-80186f2eecd9@stanley.mountain>
Hi Dan,
On Wed, 2024-07-24 at 11:09 -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. :)
>
Good catch, thanks for fixing this.
Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
> Fixes: b190447e0fa3 ("crypto: iaa - Add compression mode management
> along with fixed mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/crypto/intel/iaa/iaa_crypto_main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c
> b/drivers/crypto/intel/iaa/iaa_crypto_main.c
> index e810d286ee8c..237f87000070 100644
> --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c
> +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c
> @@ -495,10 +495,10 @@ static void
> remove_device_compression_modes(struct iaa_device *iaa_device)
> if (!device_mode)
> continue;
>
> - free_device_compression_mode(iaa_device,
> device_mode);
> - iaa_device->compression_modes[i] = NULL;
> if (iaa_compression_modes[i]->free)
> iaa_compression_modes[i]->free(device_mode);
> + free_device_compression_mode(iaa_device,
> device_mode);
> + iaa_device->compression_modes[i] = NULL;
> }
> }
>
next prev parent reply other threads:[~2024-07-29 16:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 16:09 Dan Carpenter
2024-07-29 16:40 ` Tom Zanussi [this message]
2024-08-02 13:16 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d11ad678099ccce94eacf721c8d06a38129ce2d3.camel@linux.intel.com \
--to=tom.zanussi@linux.intel.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®