crypto: sun4i-ss - fix kmap usage
authorCorentin Labbe <clabbe@baylibre.com>
Mon, 14 Dec 2020 20:02:30 +0000 (20:02 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 2 Jan 2021 21:41:36 +0000 (08:41 +1100)
commit9bc3dd24e7dccd50757db743a3635ad5b0497e6e
tree2bab6d5bd89156f8ae415f7274dda78e6b57d335
parent4ec8977b921fd9d512701e009ce8082cb94b5c1c
crypto: sun4i-ss - fix kmap usage

With the recent kmap change, some tests which were conditional on
CONFIG_DEBUG_HIGHMEM now are enabled by default.
This permit to detect a problem in sun4i-ss usage of kmap.

sun4i-ss uses two kmap via sg_miter (one for input, one for output), but
using two kmap at the same time is hard:
"the ordering has to be correct and with sg_miter that's probably hard to get
right." (quoting Tlgx)

So the easiest solution is to never have two sg_miter/kmap open at the same time.
After each use of sg_miter, I store the current index, for being able to
resume sg_miter to the right place.

Fixes: 6298e948215f ("crypto: sunxi-ss - Add Allwinner Security System crypto accelerator")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-cipher.c