]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
crypto: qat - disable registration of algorithms
authorGiovanni Cabiddu <giovanni.cabiddu@intel.com>
Fri, 4 Mar 2022 17:54:47 +0000 (17:54 +0000)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 27 Apr 2022 09:56:16 +0000 (11:56 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969106
commit 8893d27ffcaf6ec6267038a177cb87bcde4dd3de upstream.

The implementations of aead and skcipher in the QAT driver do not
support properly requests with the CRYPTO_TFM_REQ_MAY_BACKLOG flag set.
If the HW queue is full, the driver returns -EBUSY but does not enqueue
the request.
This can result in applications like dm-crypt waiting indefinitely for a
completion of a request that was never submitted to the hardware.

To avoid this problem, disable the registration of all crypto algorithms
in the QAT driver by setting the number of crypto instances to 0 at
configuration time.

Cc: stable@vger.kernel.org
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit cb807cb52a8e399dfe7d58a64549cbbbb176ba9d)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/crypto/qat/qat_4xxx/adf_drv.c
drivers/crypto/qat/qat_common/qat_crypto.c

index 359fb7989dfbfd4fd25e47892a695e5442abf302..8fd44703115f293b77cb3559fca6edd804c85977 100644 (file)
@@ -52,6 +52,13 @@ static int adf_crypto_dev_config(struct adf_accel_dev *accel_dev)
        if (ret)
                goto err;
 
+       /* Temporarily set the number of crypto instances to zero to avoid
+        * registering the crypto algorithms.
+        * This will be removed when the algorithms will support the
+        * CRYPTO_TFM_REQ_MAY_BACKLOG flag
+        */
+       instances = 0;
+
        for (i = 0; i < instances; i++) {
                val = i;
                bank = i * 2;
index ece6776fbd53da1a62490f5bafd1161c9428d5d1..3efbb388360100b22856032e8f032f6524498c7d 100644 (file)
@@ -136,6 +136,13 @@ int qat_crypto_dev_config(struct adf_accel_dev *accel_dev)
        if (ret)
                goto err;
 
+       /* Temporarily set the number of crypto instances to zero to avoid
+        * registering the crypto algorithms.
+        * This will be removed when the algorithms will support the
+        * CRYPTO_TFM_REQ_MAY_BACKLOG flag
+        */
+       instances = 0;
+
        for (i = 0; i < instances; i++) {
                val = i;
                snprintf(key, sizeof(key), ADF_CY "%d" ADF_RING_ASYM_BANK_NUM, i);