summaryrefslogtreecommitdiff
path: root/crypto/skcipher.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-03-05 19:33:05 -0800
committerHerbert Xu <herbert@gondor.apana.org.au>2025-03-08 16:24:36 +0800
commiteca6828403b80343647de39d4782ee56cc9e36dd (patch)
treef0d7728af0df229e9a7d595f417e01ee17a1ff2e /crypto/skcipher.c
parent98330b9a61506de7df0d1725122111909c157864 (diff)
crypto: skcipher - fix mismatch between mapping and unmapping order
Local kunmaps have to be unmapped in the opposite order from which they were mapped. My recent change flipped the unmap order in the SKCIPHER_WALK_DIFF case. Adjust the mapping side to match. This fixes a WARN_ON_ONCE that was triggered when running the crypto-self tests on a 32-bit kernel with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y. Fixes: 95dbd711b1d8 ("crypto: skcipher - use the new scatterwalk functions") Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/skcipher.c')
-rw-r--r--crypto/skcipher.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 53123d3685d5..66d19c360dd8 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -209,12 +209,12 @@ static int skcipher_next_fast(struct skcipher_walk *walk)
diff |= (u8 *)(sg_page(walk->in.sg) + (walk->in.offset >> PAGE_SHIFT)) -
(u8 *)(sg_page(walk->out.sg) + (walk->out.offset >> PAGE_SHIFT));
- skcipher_map_src(walk);
- walk->dst.virt.addr = walk->src.virt.addr;
+ skcipher_map_dst(walk);
+ walk->src.virt.addr = walk->dst.virt.addr;
if (diff) {
walk->flags |= SKCIPHER_WALK_DIFF;
- skcipher_map_dst(walk);
+ skcipher_map_src(walk);
}
return 0;