Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: f1c131b ("crypto: xts - Convert to skcipher") Fixes: 700cb3f ("crypto: lrw - Convert to skcipher") Cc: [email protected] # v4.10+ Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Acked-by: David S. Miller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
- Loading branch information