summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Jiejing <jiejing.zhang@freescale.com>2012-09-12 18:04:49 +0800
committerTapani <tapani@vmail.me>2013-03-29 14:35:15 +0800
commit22d49f53097e7016a45f75a78aa24de8dc16ffea (patch)
treea9c3e2475f62f3a52dca18b8f266932805b6e00a
parentefcdf13f7bfadba8e012ec5ae1a2a91c08b53b47 (diff)
ENGR00240112-1 caam: fix user space crypto API support.
This patch fix the CAAM support for Crypto User Space API support. in the dma_map_sg_chained() function, the chained mode will loop until the scatter list end, but when the scatter list end, it will return null and orignal code will set this to the sg list point used by dma_sync, so it will panic. When do chain dma, use a tmp do going through the list. Signed-off-by Zhang Jiejing <jiejing.zhang@freescale.com>
-rw-r--r--drivers/crypto/caam/sg_sw_sec4.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/crypto/caam/sg_sw_sec4.h b/drivers/crypto/caam/sg_sw_sec4.h
index e05fc58c9637..f3f5187a14c3 100644
--- a/drivers/crypto/caam/sg_sw_sec4.h
+++ b/drivers/crypto/caam/sg_sw_sec4.h
@@ -1,7 +1,7 @@
/*
* CAAM/SEC 4.x functions for using scatterlists in caam driver
*
- * Copyright (C) 2008-2012 Freescale Semiconductor, Inc.
+ * Copyright (C) 2008-2013 Freescale Semiconductor, Inc.
*
*/
@@ -93,9 +93,13 @@ static int dma_map_sg_chained(struct device *dev, struct scatterlist *sg,
{
if (unlikely(chained)) {
int i;
+ struct scatterlist *tsg = sg;
+ /* Needs a temp copy for sg pointer, otherwise
+ * scatterwalke_sg_next will return null when list is
+ * ended */
for (i = 0; i < nents; i++) {
- dma_map_sg(dev, sg, 1, dir);
- sg = scatterwalk_sg_next(sg);
+ dma_map_sg(dev, tsg, 1, dir);
+ tsg = scatterwalk_sg_next(tsg);
}
} else {
dma_map_sg(dev, sg, nents, dir);