diff options
author | Oleksij Rempel <o.rempel@pengutronix.de> | 2017-07-12 06:40:28 +0200 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2017-07-14 16:48:36 +0200 |
commit | 425c6ee704e2032feca6fadaa8ca4966b5d91439 (patch) | |
tree | b951e8a4c052bb730e6a7a83f1d484a672feb4a4 | |
parent | 84213b2aa896593cdb3d58e0f1d441b30d4467d0 (diff) | |
download | barebox-425c6ee704e2032feca6fadaa8ca4966b5d91439.tar.gz barebox-425c6ee704e2032feca6fadaa8ca4966b5d91439.tar.xz |
crypto: caam: use dma_alloc_coherent instead of dma_alloc
dma_alloc return non-coherent memory, but the driver does no cache
maintenance on the buffer, causing memory corruption. Fix this by
requesting coherent memory for the DMA transfer.
Fixes: ef4144b4ab63 (crypto: caam - fix RNG buffer cache alignment)
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-rw-r--r-- | drivers/crypto/caam/caamrng.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c index 31a92731d2..51c267e3d3 100644 --- a/drivers/crypto/caam/caamrng.c +++ b/drivers/crypto/caam/caamrng.c @@ -203,8 +203,6 @@ static inline int rng_create_job_desc(struct caam_rng_ctx *ctx, int buf_id) init_job_desc_shared(desc, ctx->sh_desc_dma, sh_len, HDR_SHARE_DEFER | HDR_REVERSE); - bd->addr = (dma_addr_t)bd->buf; - append_seq_out_ptr_intlen(desc, bd->addr, RN_BUF_SIZE, 0); #ifdef DEBUG print_hex_dump(KERN_ERR, "rng job desc@: ", DUMP_PREFIX_OFFSET, 16, 4, @@ -218,7 +216,7 @@ static int caam_init_buf(struct caam_rng_ctx *ctx, int buf_id) struct buf_data *bd = &ctx->bufs[buf_id]; int err; - bd->buf = dma_alloc(RN_BUF_SIZE); + bd->buf = dma_alloc_coherent(RN_BUF_SIZE, &bd->addr); err = rng_create_job_desc(ctx, buf_id); if (err) |