diff options
author | Eric Biggers <ebiggers@google.com> | 2018-07-23 10:54:58 -0700 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-08-03 18:06:04 +0800 |
commit | 40f6ea894d5da061e92946d28fc9bc44bdfb597c (patch) | |
tree | a342050b80ef9febf3ff9918dabe6e3389cf769a /crypto/gcm.c | |
parent | 8e5dea859c5db92df36d78165c9ead4acd09ba58 (diff) | |
download | linux-crypto-40f6ea894d5da061e92946d28fc9bc44bdfb597c.tar.gz linux-crypto-40f6ea894d5da061e92946d28fc9bc44bdfb597c.zip |
crypto: ablkcipher - fix crash flushing dcache in error path
Like the skcipher_walk and blkcipher_walk cases:
scatterwalk_done() is only meant to be called after a nonzero number of
bytes have been processed, since scatterwalk_pagedone() will flush the
dcache of the *previous* page. But in the error case of
ablkcipher_walk_done(), e.g. if the input wasn't an integer number of
blocks, scatterwalk_done() was actually called after advancing 0 bytes.
This caused a crash ("BUG: unable to handle kernel paging request")
during '!PageSlab(page)' on architectures like arm and arm64 that define
ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE, provided that the input was
page-aligned as in that case walk->offset == 0.
Fix it by reorganizing ablkcipher_walk_done() to skip the
scatterwalk_advance() and scatterwalk_done() if an error has occurred.
Reported-by: Liu Chao <liuchao741@huawei.com>
Fixes: 70c70cf14eaf ("crypto: skcipher - Add ablkcipher_walk interfaces")
Cc: <stable@vger.kernel.org> # v2.6.35+
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/gcm.c')
0 files changed, 0 insertions, 0 deletions