linux-stable/drivers/crypto
Antoine Tenart 2b2a92910c crypto: inside-secure - fix the invalidation step during cra_exit
[ Upstream commit b7007dbccd ]

When exiting a transformation, the cra_exit() helper is called in each
driver providing one. The Inside Secure SafeXcel driver has one, which
is responsible of freeing some areas and of sending one invalidation
request to the crypto engine, to invalidate the context that was used
during the transformation.

We could see in some setups (when lots of transformations were being
used with a short lifetime, and hence lots of cra_exit() calls) NULL
pointer dereferences and other weird issues. All these issues were
coming from accessing the tfm context.

The issue is the invalidation request completion is checked using a
wait_for_completion_interruptible() call in both the cipher and hash
cra_exit() helpers. In some cases this was interrupted while the
invalidation request wasn't processed yet. And then cra_exit() returned,
and its caller was freeing the tfm instance. Only then the request was
being handled by the SafeXcel driver, which lead to the said issues.

This patch fixes this by using wait_for_completion() calls in these
specific cases.

Fixes: 1b44c5a60c ("crypto: inside-secure - add SafeXcel EIP197 crypto engine driver")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 16:17:46 +02:00
..
amcc crypto: crypto4xx - increase context and scatter ring buffer elements 2017-12-25 14:26:25 +01:00
axis crypto: artpec6 - set correct iv size for gcm(aes) 2018-03-24 11:01:28 +01:00
bcm crypto: brcm - Explicity ACK mailbox message 2017-11-21 09:49:21 +01:00
caam crypto: caam - Fix null dereference at error path 2018-04-08 14:26:31 +02:00
cavium crypto: cavium - fix memory leak on info 2018-03-19 08:42:49 +01:00
ccp crypto: ccp - don't disable interrupts while setting up debugfs 2018-05-25 16:17:44 +02:00
chelsio crypto: chelsio - select CRYPTO_GF128MUL 2018-01-10 09:31:18 +01:00
inside-secure crypto: inside-secure - fix the invalidation step during cra_exit 2018-05-25 16:17:46 +02:00
marvell License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mediatek crypto: mediatek - fix error return code in mtk_crypto_probe() 2017-07-18 17:50:54 +08:00
nx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qat License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
qce License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rockchip License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
stm32 crypto: hash - annotate algorithms taking optional key 2018-02-16 20:23:00 +01:00
sunxi-ss crypto: sunxi-ss - Add MODULE_ALIAS to sun4i-ss 2018-05-25 16:17:45 +02:00
ux500 scripts/spelling.txt: add "disble(d)" pattern and fix typo instances 2017-03-09 17:01:09 -08:00
virtio License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
vmx License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atmel-aes-regs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atmel-aes.c crypto: atmel-aes - fix the keys zeroing on errors 2018-05-25 16:17:44 +02:00
atmel-authenc.h crypto: atmel-authenc - add support to authenc(hmac(shaX), Y(aes)) modes 2017-02-03 18:16:14 +08:00
atmel-ecc.c crypto: atmel-ecc - fix signed integer to u8 assignment 2017-08-03 13:47:23 +08:00
atmel-ecc.h crypto: atmel-ecc - introduce Microchip / Atmel ECC driver 2017-07-18 17:50:58 +08:00
atmel-sha-regs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atmel-sha.c crypto: atmel-sha - remove unnecessary static in atmel_sha_remove() 2017-08-03 13:47:16 +08:00
atmel-tdes-regs.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
atmel-tdes.c crypto: atmel-tdes - remove unnecessary static in atmel_tdes_remove() 2017-08-03 13:47:18 +08:00
bfin_crc.c crypto: hash - annotate algorithms taking optional key 2018-02-16 20:23:00 +01:00
bfin_crc.h
exynos-rng.c crypto: exynos - Add new Exynos RNG driver 2017-04-21 20:30:46 +08:00
geode-aes.c crypto: geode-aes - fixed coding style warnings and error 2017-07-18 18:15:57 +08:00
geode-aes.h
hifn_795x.c
img-hash.c crypto: img-hash - remove unnecessary static in img_hash_remove() 2017-08-03 13:47:18 +08:00
ixp4xx_crypto.c crypto: ixp4xx - Fix error handling path in 'aead_perform()' 2017-08-09 20:01:33 +08:00
Kconfig crypto: artpec6 - remove select on non-existing CRYPTO_SHA384 2018-04-26 11:02:12 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mv_cesa.c crypto: mv_cesa - Use IPAD/OPAD constant 2017-05-23 12:52:08 +08:00
mv_cesa.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mxc-scc.c crypto: mxc-scc - fix error code in mxc_scc_probe() 2017-07-18 17:50:54 +08:00
mxs-dcp.c crypto: mxs-dcp - print error message on platform_get_irq failure 2017-07-18 17:50:54 +08:00
n2_asm.S License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
n2_core.c crypto: n2 - cure use after free 2018-01-10 09:31:18 +01:00
n2_core.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
omap-aes-gcm.c crypto: omap-aes - fix spelling mistake "Encryptio" -> "Encryption" 2017-06-20 11:21:29 +08:00
omap-aes.c crypto: omap-aes - fix error return code in omap_aes_probe() 2017-07-18 17:50:55 +08:00
omap-aes.h crypto: omap-aes - Add support for GCM mode 2017-06-10 12:04:19 +08:00
omap-crypto.c crypto: omap - add base support library for common routines 2017-06-10 12:04:15 +08:00
omap-crypto.h crypto: omap - add base support library for common routines 2017-06-10 12:04:15 +08:00
omap-des.c crypto: omap-des - fix error return code in omap_des_probe() 2017-07-18 17:50:55 +08:00
omap-sham.c crypto: omap-sham - remove unnecessary static in omap_sham_remove() 2017-08-03 13:47:15 +08:00
padlock-aes.c x86/cpu: Rename cpu_data.x86_mask to cpu_data.x86_stepping 2018-02-22 15:42:24 +01:00
padlock-sha.c
picoxcell_crypto.c
picoxcell_crypto_regs.h
s5p-sss.c crypto: s5p-sss - Fix kernel Oops in AES-ECB mode 2018-02-25 11:08:04 +01:00
sahara.c crypto: sahara - constify platform_device_id 2017-08-22 14:54:53 +08:00
talitos.c crypto: talitos - fix IPsec cipher in length 2018-05-09 09:51:49 +02:00
talitos.h