summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlises Cardenas <raul.casas@nxp.com>2016-02-09 04:58:59 -0600
committerUlises Cardenas <raul.casas@nxp.com>2016-02-10 01:59:16 -0600
commit929646fd4ae5e5dd357bbcf79f87c0160359e0cc (patch)
treeae993cbd7b31acb6b72183d43246cd9522b75766
parent21f09fb4cdd5e9e3f1dcd462d8e962183ce29f30 (diff)
MLK-12340: CAAM: system hang during cryptomgr_test
During the crypto manager self test, a aead encryption opertation is carried out. This operations allocates a aead request, which is handed to the CAAM driver. The CAAM driver allocates and maps the required structures. During the allocation aead extended descriptor, a DMA to device mapping and synchronization are required. The order of this two operations matter, which should be map and then sync. Otherwise, there will be NULL pointer exception. This patch fix the order of this two operations, from sync-then-map to map-then-sync. Signed-off-by: Ulises Cardenas <raul.casas@nxp.com>
-rw-r--r--drivers/crypto/caam/caamalg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index dcc2c72058d4..828ec36f3197 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -2758,8 +2758,6 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
sg_to_sec4_sg_last(req->dst, dst_nents,
edesc->sec4_sg + sec4_sg_index, 0);
}
- dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma, sec4_sg_bytes,
- DMA_TO_DEVICE);
edesc->sec4_sg_dma = dma_map_single(jrdev, edesc->sec4_sg,
sec4_sg_bytes, DMA_TO_DEVICE);
@@ -2768,6 +2766,8 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
return ERR_PTR(-ENOMEM);
}
+ dma_sync_single_for_device(jrdev, edesc->sec4_sg_dma, sec4_sg_bytes,
+ DMA_TO_DEVICE);
return edesc;
}