linux-stable/drivers/crypto
Giovanni Cabiddu 3dfaf0071e crypto: qat - remove dma_free_coherent() for RSA
After commit f5ff79fddf ("dma-mapping: remove CONFIG_DMA_REMAP"), if
the algorithms are enabled, the driver crashes with a BUG_ON while
executing vunmap() in the context of a tasklet. This is due to the fact
that the function dma_free_coherent() cannot be called in an interrupt
context (see Documentation/core-api/dma-api-howto.rst).

The functions qat_rsa_enc() and qat_rsa_dec() allocate memory with
dma_alloc_coherent() if the source or the destination buffers are made
of multiple flat buffers or of a size that is not compatible with the
hardware.
This memory is then freed with dma_free_coherent() in the context of a
tasklet invoked to handle the response for the corresponding request.

Replace allocations with dma_alloc_coherent() in the functions
qat_rsa_enc() and qat_rsa_dec() with kmalloc() + dma_map_single().

Cc: stable@vger.kernel.org
Fixes: a990532023 ("crypto: qat - Add support for RSA algorithm")
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Adam Guerin <adam.guerin@intel.com>
Reviewed-by: Wojciech Ziemba <wojciech.ziemba@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2022-05-20 13:49:18 +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 - remove dma_free_coherent() for RSA 2022-05-20 13:49:18 +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 crypto: drivers - use semicolons rather than commas to separate statements 2020-10-02 18:02:15 +10:00
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 crypto: omap-aes - permit asynchronous skcipher as fallback 2020-07-16 21:49:02 +10:00
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 crypto: algapi - Remove skbuff.h inclusion 2020-08-20 14:04:28 +10:00
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