diff options
author | Eric Biggers <ebiggers@google.com> | 2017-03-23 13:39:46 -0700 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-03-24 21:51:34 +0800 |
commit | 7850b58ce111818befca6f2975adb7c559caa461 (patch) | |
tree | 7ca636ddf578e37425761e50526b1c56faee3316 /crypto/chacha20_generic.c | |
parent | 4c6427919ee920d5963cf826de76292286342aa0 (diff) | |
download | linux-crypto-7850b58ce111818befca6f2975adb7c559caa461.tar.gz linux-crypto-7850b58ce111818befca6f2975adb7c559caa461.zip |
crypto: xts,lrw - fix out-of-bounds write after kmalloc failure
In the generic XTS and LRW algorithms, for input data > 128 bytes, a
temporary buffer is allocated to hold the values to be XOR'ed with the
data before and after encryption or decryption. If the allocation
fails, the fixed-size buffer embedded in the request buffer is meant to
be used as a fallback --- resulting in more calls to the ECB algorithm,
but still producing the correct result. However, we weren't correctly
limiting subreq->cryptlen in this case, resulting in pre_crypt()
overrunning the embedded buffer. Fix this by setting subreq->cryptlen
correctly.
Fixes: 6c1314f521f2 ("crypto: xts - Convert to skcipher")
Fixes: f96ee41be16a ("crypto: lrw - Convert to skcipher")
Cc: stable@vger.kernel.org # v4.10+
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/chacha20_generic.c')
0 files changed, 0 insertions, 0 deletions