WSL2-Linux-Kernel/arch/arm64
Ard Biesheuvel 2db34e78f1 crypto: arm64/aes-ctr - fix NULL dereference in tail processing
The AES-CTR glue code avoids calling into the blkcipher API for the
tail portion of the walk, by comparing the remainder of walk.nbytes
modulo AES_BLOCK_SIZE with the residual nbytes, and jumping straight
into the tail processing block if they are equal. This tail processing
block checks whether nbytes != 0, and does nothing otherwise.

However, in case of an allocation failure in the blkcipher layer, we
may enter this code with walk.nbytes == 0, while nbytes > 0. In this
case, we should not dereference the source and destination pointers,
since they may be NULL. So instead of checking for nbytes != 0, check
for (walk.nbytes % AES_BLOCK_SIZE) != 0, which implies the former in
non-error conditions.

Fixes: 49788fe2a1 ("arm64/crypto: AES-ECB/CBC/CTR/XTS using ARMv8 NEON and Crypto Extensions")
Cc: stable@vger.kernel.org
Reported-by: xiakaixu <xiakaixu@huawei.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2016-09-13 18:44:59 +08:00
..
boot PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
configs ARM: SoC 64-bit changes for v4.8 2016-08-01 18:29:28 -04:00
crypto crypto: arm64/aes-ctr - fix NULL dereference in tail processing 2016-09-13 18:44:59 +08:00
include arm64 fixes: 2016-08-06 08:58:59 -04:00
kernel arm64 fixes: 2016-08-06 08:58:59 -04:00
kvm KVM/ARM Changes for v4.8 - Take 2 2016-08-04 13:59:56 +02:00
lib arm64: kasan: instrument user memory access API 2016-06-21 15:37:18 +01:00
mm arm64 fixes: 2016-08-06 08:58:59 -04:00
net arm64: bpf: optimize LD_ABS, LD_IND 2016-06-10 23:11:50 -07:00
xen arm/xen: add support for vm_assist hypercall 2016-07-06 10:42:14 +01:00
Kconfig PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
Kconfig.debug arm64: enable CONFIG_SET_MODULE_RONX by default 2016-05-31 14:23:29 +01:00
Kconfig.platforms ARM: 64-bit DT updates for v4.8 2016-08-01 18:47:01 -04:00
Makefile arm64 fixes: 2016-08-06 08:58:59 -04:00