1
0
Fork 0
alistair23-linux/drivers/crypto
John Garry 0b0cf6af3f crypto: hisilicon - Fix reference after free of memories on error path
coccicheck currently warns of the following issues in the driver:
drivers/crypto/hisilicon/sec/sec_algs.c:864:51-66: ERROR: reference preceded by free on line 812
drivers/crypto/hisilicon/sec/sec_algs.c:864:40-49: ERROR: reference preceded by free on line 813
drivers/crypto/hisilicon/sec/sec_algs.c:861:8-24: ERROR: reference preceded by free on line 814
drivers/crypto/hisilicon/sec/sec_algs.c:860:41-51: ERROR: reference preceded by free on line 815
drivers/crypto/hisilicon/sec/sec_algs.c:867:7-18: ERROR: reference preceded by free on line 816

It would appear than on certain error paths that we may attempt reference-
after-free some memories.

This patch fixes those issues. The solution doesn't look perfect, but
having same memories free'd possibly from separate functions makes it
tricky.

Fixes: 915e4e8413 ("crypto: hisilicon - SEC security accelerator driver")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2018-11-09 17:35:43 +08:00
..
amcc crypto: skcipher - remove useless setting of type flags 2018-07-09 00:30:27 +08:00
axis crypto: axis - fix platform_no_drv_owner.cocci warnings 2018-10-12 14:20:44 +08:00
bcm crypto: aead - remove useless setting of type flags 2018-07-09 00:30:26 +08:00
caam crypto: caam - add SPDX license identifier to all files 2018-10-17 14:16:18 +08:00
cavium crypto: cavium/nitrox - use pci_alloc_irq_vectors() while enabling MSI-X. 2018-10-05 10:22:48 +08:00
ccp crypto: ccp - Make function sev_get_firmware() static 2018-10-05 10:16:56 +08:00
ccree crypto: ccree - avoid implicit enum conversion 2018-10-17 14:16:18 +08:00
chelsio Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-10-25 16:43:35 -07:00
hisilicon crypto: hisilicon - Fix reference after free of memories on error path 2018-11-09 17:35:43 +08:00
inside-secure treewide: Replace more open-coded allocation size multiplications 2018-10-05 18:06:30 -07:00
marvell crypto: remove redundant type flags from tfm allocation 2018-07-09 00:30:29 +08:00
mediatek headers: separate linux/mod_devicetable.h from linux/platform_device.h 2018-07-07 17:52:26 +02:00
nx powerpc updates for 4.19 2018-08-17 11:32:50 -07:00
qat Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-10-25 16:43:35 -07:00
qce crypto: qce - Remove VLA usage of skcipher 2018-09-28 12:46:08 +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 Char/Misc driver patches for 4.19-rc1 2018-08-18 11:04:51 -07:00
sunxi-ss crypto: skcipher - remove useless setting of type flags 2018-07-09 00:30:27 +08:00
ux500 Char/Misc driver patches for 4.19-rc1 2018-08-18 11:04:51 -07:00
virtio Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-08-15 16:01:47 -07:00
vmx crypto: vmx - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
Kconfig s390/zcrypt: multiple zcrypt device nodes support 2018-10-08 09:09:58 +02:00
Makefile crypto: caam/qi2 - add DPAA2-CAAM driver 2018-09-21 13:24:51 +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 - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-authenc.h crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-ecc.c crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
atmel-ecc.h crypto: atmel - switch to SPDX license identifiers 2018-09-04 11:37:04 +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 - switch to SPDX license identifiers 2018-09-04 11:37:04 +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 - switch to SPDX license identifiers 2018-09-04 11:37:04 +08:00
exynos-rng.c crypto: drivers - simplify getting .drvdata 2018-04-28 16:09:35 +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 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: ixp4xx - don't leak pointers to authenc keys 2018-03-31 01:33:12 +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 Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2018-10-17 14:14:06 +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: ahash - remove useless setting of type flags 2018-07-09 00:30:25 +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-aes - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
omap-aes.h crypto: omap-aes - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
omap-crypto.c crypto: omap-crypto - Verify page zone scatterlists before starting DMA 2018-03-09 22:45:36 +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: ahash - remove useless setting of type flags 2018-07-09 00:30:25 +08:00
padlock-aes.c crypto: padlock-aes - Fix Nano workaround data corruption 2018-07-20 13:47:42 +08:00
padlock-sha.c crypto: shash - remove useless setting of type flags 2018-07-09 00:30:24 +08:00
picoxcell_crypto.c crypto: picoxcell - Remove VLA usage of skcipher 2018-09-28 12:46:09 +08:00
picoxcell_crypto_regs.h
qcom-rng.c crypto: qcom-rng - Add ACPI support 2018-07-27 19:04:32 +08:00
s5p-sss.c crypto: s5p-sss: Add aes-ctr support 2018-09-28 12:46:06 +08:00
sahara.c crypto: sahara - Remove VLA usage of skcipher 2018-09-28 12:46:08 +08:00
talitos.c crypto: ahash - remove useless setting of cra_type 2018-07-09 00:30:26 +08:00
talitos.h crypto: talitos - chain in buffered data for ahash on SEC1 2017-10-12 22:55:38 +08:00