linux/drivers/crypto
Antoine Tenart b7007dbccd crypto: inside-secure - fix the invalidation step during cra_exit
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>
2018-02-22 22:16:27 +08:00
..
amcc crypto: Use zeroing memory allocator instead of allocator/memset 2018-01-12 23:02:56 +11:00
axis crypto: axis - remove unnecessary platform_get_resource() error check 2018-01-26 01:10:29 +11:00
bcm crypto: drivers - remove duplicate includes 2017-12-22 19:29:01 +11:00
caam crypto: caam/qi - add GCM support 2018-02-15 23:26:55 +08:00
cavium crypto: drivers - remove duplicate includes 2017-12-22 19:29:01 +11:00
ccp crypto: ccp - Make function ccp_get_dma_chan_attr static 2018-02-15 23:26:56 +08:00
ccree crypto: ccree - add FIPS support 2018-02-15 23:26:42 +08:00
chelsio crypto: chelsio - Make function aead_ccm_validate_input static 2018-02-15 23:26:56 +08:00
inside-secure crypto: inside-secure - fix the invalidation step during cra_exit 2018-02-22 22:16:27 +08:00
marvell Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-01-31 14:22:45 -08:00
mediatek crypto: mediatek - move to generic async completion 2017-11-03 22:11:23 +08:00
nx crypto: nx - fix spelling mistake: "availavle" -> "available" 2017-11-29 17:33:25 +11:00
qat crypto: qat - Make several functions static 2018-02-15 23:26:57 +08:00
qce Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-11-14 10:52:09 -08: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: stm32/cryp - add stm32mp1 support 2018-02-15 23:26:57 +08:00
sunxi-ss crypto: sunxi-ss - Add MODULE_ALIAS to sun4i-ss 2018-02-22 22:16:15 +08:00
ux500 crypto: ux500/hash - Add empty export and import 2018-02-15 23:23:46 +08:00
virtio crypto: virtio - convert to new crypto engine API 2018-02-15 23:26:52 +08:00
vmx Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2017-11-14 10:52:09 -08: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 - remove empty functions 2017-11-06 14:45:05 +08:00
atmel-authenc.h
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 - remove useless irq init 2017-11-03 22:11:24 +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 - remove empty functions 2017-11-06 14:45:05 +08:00
bfin_crc.c crypto: bfin_crc - Add empty hash export and import 2018-02-15 23:23:46 +08:00
bfin_crc.h
exynos-rng.c crypto: exynos-rng - Add SPDX license identifier and correct module license 2018-01-18 22:52:23 +11: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 crypto: hifn_795x - Fix a memory leak in the error handling path of 'hifn_probe()' 2017-11-29 17:33:30 +11:00
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: Use zeroing memory allocator instead of allocator/memset 2018-01-12 23:02:56 +11:00
Kconfig crypto: ccree - introduce CryptoCell driver 2018-02-15 23:26:40 +08:00
Makefile crypto: ccree - introduce CryptoCell driver 2018-02-15 23:26:40 +08: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 - Add empty hash export and import 2018-02-15 23:23:44 +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 - Add empty hash export and import 2018-02-15 23:23:45 +08: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 - pr_err() strings should end with newlines 2017-10-12 22:54:51 +08:00
omap-aes.c crypto: omap - convert to new crypto engine API 2018-02-15 23:26:51 +08:00
omap-aes.h crypto: omap - convert to new crypto engine API 2018-02-15 23:26:51 +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 - convert to new crypto engine API 2018-02-15 23:26:51 +08:00
omap-sham.c crypto: omap - use of_device_get_match_data 2017-10-07 12:10:35 +08:00
padlock-aes.c crypto: padlock-aes - constify x86_cpu_id 2017-09-22 17:43:20 +08:00
padlock-sha.c crypto: padlock-sha - constify x86_cpu_id 2017-09-22 17:43:20 +08:00
picoxcell_crypto.c crypto: picoxcell - Fix error handling in spacc_probe() 2018-01-26 01:10:36 +11:00
picoxcell_crypto_regs.h
s5p-sss.c crypto: s5p-sss - Fix kernel Oops in AES-ECB mode 2018-02-15 18:13:56 +08:00
sahara.c crypto: sahara - constify platform_device_id 2017-08-22 14:54:53 +08:00
talitos.c crypto: talitos - fix Kernel Oops on hashing an empty file 2018-02-08 22:37:06 +11:00
talitos.h crypto: talitos - chain in buffered data for ahash on SEC1 2017-10-12 22:55:38 +08:00