]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: sun8i-ce - fix nents passed to dma_unmap_sg()
authorOvidiu Panait <ovidiu.panait.oss@gmail.com>
Mon, 19 May 2025 15:13:48 +0000 (18:13 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 13 Jun 2025 09:26:16 +0000 (17:26 +0800)
In sun8i_ce_cipher_unprepare(), dma_unmap_sg() is incorrectly called with
the number of entries returned by dma_map_sg(), rather than using the
original number of entries passed when mapping the scatterlist.

To fix this, stash the original number of entries passed to dma_map_sg()
in the request context.

Fixes: 0605fa0f7826 ("crypto: sun8i-ce - split into prepare/run/unprepare")
Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
Acked-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Tested-by: Corentin LABBE <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c

index f9cf00d690e2fd59ffc29153ac229c38257032c6..7cd3b13f3bdc654812e5a2af424e40b7ba5bc9a0 100644 (file)
@@ -278,8 +278,8 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
        }
 
        chan->timeout = areq->cryptlen;
-       rctx->nr_sgs = nr_sgs;
-       rctx->nr_sgd = nr_sgd;
+       rctx->nr_sgs = ns;
+       rctx->nr_sgd = nd;
        return 0;
 
 theend_sgs: