android_kernel_samsung_msm8976/drivers/crypto
Vakul Garg 85acabeb3c crypto: caam - Fixed the memory out of bound overwrite issue
commit 9c23b7d3d6bda41e2a27375df705485523a96dc8 upstream.

When kernel is compiled with CONFIG_SLUB_DEBUG=y and
CRYPTO_MANAGER_DISABLE_TESTS=n, during kernel bootup, the kernel
reports error given below. The root cause is that in function
hash_digest_key(), for allocating descriptor, insufficient memory was
being allocated. The required number of descriptor words apart from
input and output pointers are 8 (instead of 6).

=============================================================================
BUG dma-kmalloc-32 (Not tainted): Redzone overwritten
-----------------------------------------------------------------------------

Disabling lock debugging due to kernel taint
INFO: 0xdec5dec0-0xdec5dec3. First byte 0x0 instead of 0xcc
INFO: Allocated in ahash_setkey+0x60/0x594 age=7 cpu=1 pid=1257
        __kmalloc+0x154/0x1b4
        ahash_setkey+0x60/0x594
        test_hash+0x260/0x5a0
        alg_test_hash+0x48/0xb0
        alg_test+0x84/0x228
        cryptomgr_test+0x4c/0x54
        kthread+0x98/0x9c
        ret_from_kernel_thread+0x64/0x6c
INFO: Slab 0xc0bd0ba0 objects=19 used=2 fp=0xdec5d0d0 flags=0x0081
INFO: Object 0xdec5dea0 @offset=3744 fp=0x5c200014

Bytes b4 dec5de90: 00 00 00 00 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a
........ZZZZZZZZ
Object dec5dea0: b0 80 00 0a 84 41 00 0d f0 40 00 00 00 67 3f c0
.....A...@...g?.
Object dec5deb0: 00 00 00 50 2c 14 00 50 f8 40 00 00 1e c5 d0 00
...P,..P.@......
Redzone dec5dec0: 00 00 00 14                                      ....
Padding dec5df68: 5a 5a 5a 5a 5a 5a 5a 5a
ZZZZZZZZ
Call Trace:
[dec65b60] [c00071b4] show_stack+0x4c/0x168 (unreliable)
[dec65ba0] [c00d4ec8] check_bytes_and_report+0xe4/0x11c
[dec65bd0] [c00d507c] check_object+0x17c/0x23c
[dec65bf0] [c0550a00] free_debug_processing+0xf4/0x294
[dec65c20] [c0550bdc] __slab_free+0x3c/0x294
[dec65c80] [c03f0744] ahash_setkey+0x4e0/0x594
[dec65cd0] [c01ef138] test_hash+0x260/0x5a0
[dec65e50] [c01ef4c0] alg_test_hash+0x48/0xb0
[dec65e70] [c01eecc4] alg_test+0x84/0x228
[dec65ee0] [c01ec640] cryptomgr_test+0x4c/0x54
[dec65ef0] [c005adc0] kthread+0x98/0x9c
[dec65f40] [c000e1ac] ret_from_kernel_thread+0x64/0x6c
FIX dma-kmalloc-32: Restoring 0xdec5dec0-0xdec5dec3=0xcc

Change-Id: I0c7a1048053e811025d1c3b487940f87345c8f5d
Signed-off-by: Vakul Garg <vakul@freescale.com>
Reviewed-by: Geanta Neag Horia Ioan-B05471 <horia.geanta@freescale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-04 16:50:57 +08:00
..
amcc crypto: crypto4xx - fix error return code 2012-09-27 13:32:15 +08:00
caam crypto: caam - Fixed the memory out of bound overwrite issue 2013-08-04 16:50:57 +08:00
nx drivers/crypto/nx: Fixes for multiple races and issues 2013-05-24 18:11:10 +10:00
ux500 Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2013-05-02 14:53:12 -07:00
atmel-aes-regs.h crypto: atmel - add Atmel AES driver 2012-07-11 11:07:40 +08:00
atmel-aes.c crypto: atmel-aes - add support for latest release of the IP (0x130) 2013-03-10 16:46:42 +08:00
atmel-sha-regs.h crypto: atmel-sha - add support for latest release of the IP (0x410) 2013-03-10 16:46:42 +08:00
atmel-sha.c crypto: atmel-sha - add support for latest release of the IP (0x410) 2013-03-10 16:46:42 +08:00
atmel-tdes-regs.h crypto: atmel-tdes - add support for latest release of the IP (0x700) 2013-03-10 16:46:42 +08:00
atmel-tdes.c crypto: atmel-tdes - add support for latest release of the IP (0x700) 2013-03-10 16:46:42 +08:00
bfin_crc.c crypto: bfin_crc - Fix possible NULL pointer dereference 2013-03-10 16:46:43 +08:00
geode-aes.c Drivers: crypto: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
geode-aes.h
hifn_795x.c Drivers: crypto: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
ixp4xx_crypto.c IXP4xx crypto: MOD_AES{128,192,256} already include key size. 2012-11-22 03:36:15 +00:00
Kconfig crypto: sahara - Add driver for SAHARA2 accelerator. 2013-03-21 17:44:41 +08:00
Makefile crypto: sahara - Add driver for SAHARA2 accelerator. 2013-03-21 17:44:41 +08:00
mv_cesa.c Drivers: crypto: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
mv_cesa.h
n2_asm.S
n2_core.c Drivers: crypto: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
n2_core.h
omap-aes.c crypto: omap-aes - Use module_platform_driver macro 2013-03-10 18:16:35 +08:00
omap-sham.c crypto: omap-sham - Use module_platform_driver macro 2013-03-10 18:16:36 +08:00
padlock-aes.c crypto: drivers - remove cra_list initialization 2012-08-01 17:47:28 +08:00
padlock-sha.c crypto: Add support for x86 cpuid auto loading for x86 crypto drivers 2012-01-26 16:48:10 -08:00
picoxcell_crypto.c crypto: picoxcell - Use of_match_ptr() macro 2013-03-22 18:13:55 +08:00
picoxcell_crypto_regs.h
s5p-sss.c crypto: s5p-sss - Use devm_clk_get() 2013-01-20 10:16:44 +11:00
sahara.c crypto: sahara - fix building as module 2013-06-05 16:36:20 +08:00
talitos.c Revert "crypto: talitos - add IPsec ESN support" 2013-03-21 17:36:02 +08:00
talitos.h crypto: talitos - add sha224, sha384 and sha512 to existing AEAD algorithms 2012-07-11 11:08:29 +08:00
tegra-aes.c Drivers: crypto: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
tegra-aes.h crypto: driver for Tegra AES hardware 2012-01-13 16:38:37 +11:00