[PATCH 5.0 014/238] crypto: caam - fixed handling of sg list

From: Greg Kroah-Hartman
Date: Fri Mar 22 2019 - 08:35:57 EST


5.0-stable review patch. If anyone has any objections, please let me know.

------------------

From: Pankaj Gupta <pankaj.gupta@xxxxxxx>

commit 42e95d1f10dcf8b18b1d7f52f7068985b3dc5b79 upstream.

when the source sg contains more than 1 fragment and
destination sg contains 1 fragment, the caam driver
mishandle the buffers to be sent to caam.

Fixes: f2147b88b2b1 ("crypto: caam - Convert GCM to new AEAD interface")
Cc: <stable@xxxxxxxxxxxxxxx> # 4.2+
Signed-off-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
Signed-off-by: Arun Pathak <arun.pathak@xxxxxxx>
Reviewed-by: Horia Geanta <horia.geanta@xxxxxxx>
Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/crypto/caam/caamalg.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1040,6 +1040,7 @@ static void init_aead_job(struct aead_re
if (unlikely(req->src != req->dst)) {
if (edesc->dst_nents == 1) {
dst_dma = sg_dma_address(req->dst);
+ out_options = 0;
} else {
dst_dma = edesc->sec4_sg_dma +
sec4_sg_index *