Patch "crypto: qat - fix state machines cleanup paths" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    crypto: qat - fix state machines cleanup paths

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     crypto-qat-fix-state-machines-cleanup-paths.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c5d3a1f302de2cf5a1ee09727a57c32f076b0b83
Author: Giovanni Cabiddu <giovanni.cabiddu@xxxxxxxxx>
Date:   Thu Sep 14 10:55:45 2023 +0100

    crypto: qat - fix state machines cleanup paths
    
    [ Upstream commit c9ca9756f376f51f985130a0e599d956065d4c44 ]
    
    Commit 1bdc85550a2b ("crypto: qat - fix concurrency issue when device
    state changes") introduced the function adf_dev_down() which wraps the
    functions adf_dev_stop() and adf_dev_shutdown().
    In a subsequent change, the sequence adf_dev_stop() followed by
    adf_dev_shutdown() was then replaced across the driver with just a call
    to the function adf_dev_down().
    
    The functions adf_dev_stop() and adf_dev_shutdown() are called in error
    paths to stop the accelerator and free up resources and can be called
    even if the counterparts adf_dev_init() and adf_dev_start() did not
    complete successfully.
    However, the implementation of adf_dev_down() prevents the stop/shutdown
    sequence if the device is found already down.
    For example, if adf_dev_init() fails, the device status is not set as
    started and therefore a call to adf_dev_down() won't be calling
    adf_dev_shutdown() to undo what adf_dev_init() did.
    
    Do not check if a device is started in adf_dev_down() but do the
    equivalent check in adf_sysfs.c when handling a DEV_DOWN command from
    the user.
    
    Fixes: 2b60f79c7b81 ("crypto: qat - replace state machine calls")
    Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@xxxxxxxxx>
    Reviewed-by: Adam Guerin <adam.guerin@xxxxxxxxx>
    Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/crypto/intel/qat/qat_common/adf_init.c b/drivers/crypto/intel/qat/qat_common/adf_init.c
index 89001fe92e762..35aef5e8fc386 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_init.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_init.c
@@ -440,13 +440,6 @@ int adf_dev_down(struct adf_accel_dev *accel_dev, bool reconfig)
 
 	mutex_lock(&accel_dev->state_lock);
 
-	if (!adf_dev_started(accel_dev)) {
-		dev_info(&GET_DEV(accel_dev), "Device qat_dev%d already down\n",
-			 accel_dev->accel_id);
-		ret = -EINVAL;
-		goto out;
-	}
-
 	if (reconfig) {
 		ret = adf_dev_shutdown_cache_cfg(accel_dev);
 		goto out;
diff --git a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c
index a74d2f9303670..a8f33558d7cb8 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c
@@ -52,6 +52,13 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
 	case DEV_DOWN:
 		dev_info(dev, "Stopping device qat_dev%d\n", accel_id);
 
+		if (!adf_dev_started(accel_dev)) {
+			dev_info(&GET_DEV(accel_dev), "Device qat_dev%d already down\n",
+				 accel_id);
+
+			break;
+		}
+
 		ret = adf_dev_down(accel_dev, true);
 		if (ret < 0)
 			return -EINVAL;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux