diff options
| author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2016-09-13 09:48:53 +0100 |
|---|---|---|
| committer | Mister Oyster <oysterized@gmail.com> | 2017-08-31 13:34:02 +0200 |
| commit | 0ae94f7f60ce1acde696b923bd0ceb5e25624857 (patch) | |
| tree | 3f2b38934c162a8255c357ff191b1f126d43cb74 /include/linux | |
| parent | 63c6f428431925198979c858eb9f8ac503c5c1e9 (diff) | |
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: 49788fe2a128 ("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>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
