linux-stable/drivers/crypto
Giovanni Cabiddu 3868238397 crypto: qat - add backlog mechanism
The implementations of the crypto algorithms (aead, skcipher, etc) in
the QAT driver do not properly support 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 the completion of a
request that was never submitted to the hardware.

Fix this by adding a software backlog queue: if the ring buffer is more
than eighty percent full, then the request is enqueued to a backlog
list and the error code -EBUSY is returned back to the caller.
Requests in the backlog queue are resubmitted at a later time, in the
context of the callback of a previously submitted request.
The request for which -EBUSY is returned is then marked as -EINPROGRESS
once submitted to the HW queues.

The submission loop inside the function qat_alg_send_message() has been
modified to decide which submission policy to use based on the request
flags. If the request does not have the CRYPTO_TFM_REQ_MAY_BACKLOG set,
the previous behaviour has been preserved.

Based on a patch by
Vishnu Das Ramachandran <vishnu.dasx.ramachandran@intel.com>

Cc: stable@vger.kernel.org
Fixes: d370cec321 ("crypto: qat - Intel(R) QAT crypto interface")
Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Kyle Sanderson <kyle.leet@gmail.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Marco Chiappero <marco.chiappero@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-05-20 13:49:17 +08:00
..
allwinner crypto: sun8i-ce - do not fallback if cryptlen is less than sg length 2022-05-13 17:24:48 +08:00
amcc crypto: amcc - fix incorrect kernel-doc comment syntax in files 2021-03-26 20:15:58 +11:00
amlogic crypto: amlogic - call finalize with bh disabled 2022-03-03 10:47:49 +12:00
axis crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
bcm crypto: bcm - Fix a whole host of kernel-doc misdemeanours 2021-03-26 20:02:35 +11:00
caam crypto: caam/rng - Add support for PRNG 2022-05-06 18:16:55 +08:00
cavium crypto: cavium/nitrox - remove check of list iterator against head past the loop body 2022-04-08 16:26:43 +08:00
ccp crypto: ccp - Fix the INIT_EX data file open failure 2022-04-29 13:44:57 +08:00
ccree crypto: ccree - use fine grained DMA mapping dir 2022-04-15 16:34:25 +08:00
chelsio treewide: Replace open-coded flex arrays in unions 2021-10-18 12:28:53 -07:00
gemini crypto: gemini - call finalize with bh disabled 2022-03-03 10:47:49 +12:00
hisilicon crypto: hisilicon/sec - add sm4 generic selection 2022-05-06 18:16:55 +08:00
inside-secure crypto: inside-secure - Add MODULE_FIRMWARE macros 2022-05-06 18:16:55 +08:00
keembay crypto: keembay - Make use of devm helper function devm_platform_ioremap_resource() 2022-04-29 13:44:57 +08:00
marvell crypto: octeontx2 - simplify the return expression of otx2_cpt_aead_cbc_aes_sha_setkey() 2022-05-13 17:24:48 +08:00
nx crypto: nx - Constify static attribute_group structs 2022-02-18 16:21:09 +11:00
qat crypto: qat - add backlog mechanism 2022-05-20 13:49:17 +08:00
qce crypto: qce - fix uaf on qce_skcipher_register_one 2021-11-20 15:02:08 +11:00
rockchip crypto: rockchip - ECB does not need IV 2022-02-18 16:21:10 +11:00
stm32 crypto: stm32 - fix reference leak in stm32_crc_remove 2022-03-25 16:21:05 +12:00
ux500 crypto: ux500/hash - simplify if-if to if-else 2022-04-15 16:34:28 +08:00
virtio virtio-crypto: rename skcipher algs 2022-03-28 16:52:58 -04:00
vmx crypto: vmx - Fix build error 2022-05-10 11:20:25 +08:00
xilinx crypto: xilinx: prevent probing on non-xilinx hardware 2022-03-09 15:12:31 +12:00
atmel-aes-regs.h
atmel-aes.c crypto: atmel - add support for AES and SHA IPs available on lan966x SoC 2022-02-05 15:10:51 +11:00
atmel-authenc.h crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
atmel-ecc.c crypto: atmel - Avoid flush_scheduled_work() usage 2022-05-06 18:16:55 +08:00
atmel-i2c.c crypto: atmel - Avoid flush_scheduled_work() usage 2022-05-06 18:16:55 +08:00
atmel-i2c.h crypto: atmel - Avoid flush_scheduled_work() usage 2022-05-06 18:16:55 +08:00
atmel-sha-regs.h
atmel-sha.c crypto: atmel - add support for AES and SHA IPs available on lan966x SoC 2022-02-05 15:10:51 +11:00
atmel-sha204a.c crypto: atmel - Avoid flush_scheduled_work() usage 2022-05-06 18:16:55 +08:00
atmel-tdes-regs.h
atmel-tdes.c crypto: atmel-tdes - Add support for the TDES IP available on sama7g5 SoC 2022-02-11 20:39:38 +11:00
exynos-rng.c
geode-aes.c crypto: geode - use DEFINE_SPINLOCK() for spinlock 2021-04-16 21:16:31 +10:00
geode-aes.h
hifn_795x.c
img-hash.c crypto: img-hash - remove need for error return variable ret 2021-09-17 11:06:14 +08:00
ixp4xx_crypto.c ARM: ixp4xx: Drop all common code 2022-02-12 18:20:04 +01:00
Kconfig crypto: s390 - add crypto library interface for ChaCha20 2022-05-13 17:24:49 +08:00
Makefile crypto: atmel - Avoid flush_scheduled_work() usage 2022-05-06 18:16:55 +08:00
mxs-dcp.c crypto: mxs-dcp - Fix scatterlist processing 2022-01-31 11:21:46 +11:00
n2_asm.S
n2_core.c crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
n2_core.h
omap-aes-gcm.c
omap-aes.c crypto: omap-aes - Constify static attribute_group 2022-02-18 16:21:09 +11:00
omap-aes.h
omap-crypto.c crypto: omap - Avoid redundant copy when using truncated sg list 2021-08-21 15:44:53 +08:00
omap-crypto.h
omap-des.c crypto: omap - increase priority of DES/3DES 2021-12-24 14:18:22 +11:00
omap-sham.c crypto: omap-sham - Constify static attribute_group 2022-02-18 16:21:09 +11:00
padlock-aes.c
padlock-sha.c crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
qcom-rng.c crypto: qcom-rng - ensure buffer for generate is completely filled 2022-03-14 14:41:04 +12:00
s5p-sss.c crypto: s5p-sss - Add error handling in s5p_aes_probe() 2021-10-29 21:04:03 +08:00
sa2ul.c crypto: sa2ul - Add the new compatible for AM62 2022-04-21 17:53:54 +08:00
sa2ul.h crypto: sa2ul - Add support for AM64 2021-04-22 17:31:30 +10:00
sahara.c crypto: sahara - Remove unused .id_table support 2021-01-03 08:41:34 +11:00
talitos.c crypto: talitos - Uniform coding style with defined variable 2022-05-13 17:24:49 +08:00
talitos.h crypto: talitos - Work around SEC6 ERRATA (AES-CTR mode data size error) 2021-01-29 15:57:58 +11:00