Eric Biggers aec286cd36 crypto: lrw - don't access already-freed walk.iv
If the user-provided IV needs to be aligned to the algorithm's
alignmask, then skcipher_walk_virt() copies the IV into a new aligned
buffer walk.iv.  But skcipher_walk_virt() can fail afterwards, and then
if the caller unconditionally accesses walk.iv, it's a use-after-free.

Fix this in the LRW template by checking the return value of
skcipher_walk_virt().

This bug was detected by my patches that improve testmgr to fuzz
algorithms against their generic implementation.  When the extra
self-tests were run on a KASAN-enabled kernel, a KASAN use-after-free
splat occured during lrw(aes) testing.

Fixes: c778f96bf347 ("crypto: lrw - Optimize tweak computation")
Cc: <stable@vger.kernel.org> # v4.20+
Cc: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2019-04-18 22:14:58 +08:00
..
2018-06-18 20:17:38 +05:30
2019-01-25 18:41:51 +08:00
2018-09-04 11:35:03 +08:00
2018-05-26 09:16:44 +02:00
2019-02-15 13:21:55 +08:00
2018-04-21 00:58:34 +08:00
2018-07-20 13:51:21 +08:00
2019-01-11 14:16:58 +08:00
2019-03-07 18:32:03 -08:00
2019-03-07 18:32:03 -08:00
2018-05-16 07:23:35 +02:00
2019-03-07 18:32:03 -08:00
2018-09-04 11:35:03 +08:00
2018-04-21 00:58:30 +08:00