Skip to content

Commit eca6828

Browse files
ebiggersherbertx
authored andcommitted
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: 95dbd71 ("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>
1 parent 98330b9 commit eca6828

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crypto/skcipher.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,12 @@ static int skcipher_next_fast(struct skcipher_walk *walk)
209209
diff |= (u8 *)(sg_page(walk->in.sg) + (walk->in.offset >> PAGE_SHIFT)) -
210210
(u8 *)(sg_page(walk->out.sg) + (walk->out.offset >> PAGE_SHIFT));
211211

212-
skcipher_map_src(walk);
213-
walk->dst.virt.addr = walk->src.virt.addr;
212+
skcipher_map_dst(walk);
213+
walk->src.virt.addr = walk->dst.virt.addr;
214214

215215
if (diff) {
216216
walk->flags |= SKCIPHER_WALK_DIFF;
217-
skcipher_map_dst(walk);
217+
skcipher_map_src(walk);
218218
}
219219

220220
return 0;

0 commit comments

Comments
 (0)