* [PATCH] crypto: qat - fix double free during reset
@ 2023-10-09 12:27 Giovanni Cabiddu
2023-10-20 5:52 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Giovanni Cabiddu @ 2023-10-09 12:27 UTC (permalink / raw)
To: herbert; +Cc: linux-crypto, qat-linux, Svyatoslav Pankratov, Giovanni Cabiddu
From: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
There is no need to free the reset_data structure if the recovery is
unsuccessful and the reset is synchronous. The function
adf_dev_aer_schedule_reset() handles the cleanup properly. Only
asynchronous resets require such structure to be freed inside the reset
worker.
Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
Signed-off-by: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
---
drivers/crypto/intel/qat/qat_common/adf_aer.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/intel/qat/qat_common/adf_aer.c b/drivers/crypto/intel/qat/qat_common/adf_aer.c
index 04af32a2811c..a39e70bd4b21 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_aer.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_aer.c
@@ -92,7 +92,8 @@ static void adf_device_reset_worker(struct work_struct *work)
if (adf_dev_restart(accel_dev)) {
/* The device hanged and we can't restart it so stop here */
dev_err(&GET_DEV(accel_dev), "Restart device failed\n");
- kfree(reset_data);
+ if (reset_data->mode == ADF_DEV_RESET_ASYNC)
+ kfree(reset_data);
WARN(1, "QAT: device restart failed. Device is unusable\n");
return;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: qat - fix double free during reset
2023-10-09 12:27 [PATCH] crypto: qat - fix double free during reset Giovanni Cabiddu
@ 2023-10-20 5:52 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2023-10-20 5:52 UTC (permalink / raw)
To: Giovanni Cabiddu; +Cc: linux-crypto, qat-linux, Svyatoslav Pankratov
On Mon, Oct 09, 2023 at 01:27:19PM +0100, Giovanni Cabiddu wrote:
> From: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
>
> There is no need to free the reset_data structure if the recovery is
> unsuccessful and the reset is synchronous. The function
> adf_dev_aer_schedule_reset() handles the cleanup properly. Only
> asynchronous resets require such structure to be freed inside the reset
> worker.
>
> Fixes: d8cba25d2c68 ("crypto: qat - Intel(R) QAT driver framework")
> Signed-off-by: Svyatoslav Pankratov <svyatoslav.pankratov@intel.com>
> Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> ---
> drivers/crypto/intel/qat/qat_common/adf_aer.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-20 5:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-09 12:27 [PATCH] crypto: qat - fix double free during reset Giovanni Cabiddu
2023-10-20 5:52 ` Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.