* Patch "crypto: arm/aes-ctr - fix NULL dereference in tail processing" has been added to the 4.7-stable tree
@ 2016-09-25 18:17 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-09-25 18:17 UTC (permalink / raw)
To: ard.biesheuvel, gregkh, herbert, xiakaixu; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
crypto: arm/aes-ctr - fix NULL dereference in tail processing
to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
crypto-arm-aes-ctr-fix-null-dereference-in-tail-processing.patch
and it can be found in the queue-4.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From f82e90b28654804ab72881d577d87c3d5c65e2bc Mon Sep 17 00:00:00 2001
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Date: Tue, 13 Sep 2016 09:48:52 +0100
Subject: crypto: arm/aes-ctr - fix NULL dereference in tail processing
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
commit f82e90b28654804ab72881d577d87c3d5c65e2bc upstream.
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: 86464859cc77 ("crypto: arm - AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions")
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm/crypto/aes-ce-glue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/arm/crypto/aes-ce-glue.c
+++ b/arch/arm/crypto/aes-ce-glue.c
@@ -284,7 +284,7 @@ static int ctr_encrypt(struct blkcipher_
err = blkcipher_walk_done(desc, &walk,
walk.nbytes % AES_BLOCK_SIZE);
}
- if (nbytes) {
+ if (walk.nbytes % AES_BLOCK_SIZE) {
u8 *tdst = walk.dst.virt.addr + blocks * AES_BLOCK_SIZE;
u8 *tsrc = walk.src.virt.addr + blocks * AES_BLOCK_SIZE;
u8 __aligned(8) tail[AES_BLOCK_SIZE];
Patches currently in stable-queue which might be from ard.biesheuvel@linaro.org are
queue-4.7/crypto-arm64-aes-ctr-fix-null-dereference-in-tail-processing.patch
queue-4.7/crypto-arm-aes-ctr-fix-null-dereference-in-tail-processing.patch
queue-4.7/crypto-skcipher-fix-blkcipher-walk-oom-crash.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-09-25 18:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25 18:17 Patch "crypto: arm/aes-ctr - fix NULL dereference in tail processing" has been added to the 4.7-stable tree gregkh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.