2013-05-10 12:08:39

by Horia Geantă

[permalink] [raw]
Subject: [PATCH] crypto: caam - fix inconsistent assoc dma mapping direction

req->assoc is dma mapped BIDIRECTIONAL and unmapped TO_DEVICE.
Since it is read-only for the device, use TO_DEVICE both for mapping
and unmapping.

Cc: <[email protected]> # 3.9, 3.8
Signed-off-by: Horia Geanta <[email protected]>
---
drivers/crypto/caam/caamalg.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
index 42420fb..bf7da50 100644
--- a/drivers/crypto/caam/caamalg.c
+++ b/drivers/crypto/caam/caamalg.c
@@ -1154,7 +1154,7 @@ static struct aead_edesc *aead_edesc_alloc(struct aead_request *req,
dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained);

sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1,
- DMA_BIDIRECTIONAL, assoc_chained);
+ DMA_TO_DEVICE, assoc_chained);
if (likely(req->src == req->dst)) {
sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1,
DMA_BIDIRECTIONAL, src_chained);
@@ -1336,7 +1336,7 @@ static struct aead_edesc *aead_giv_edesc_alloc(struct aead_givcrypt_request
dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained);

sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1,
- DMA_BIDIRECTIONAL, assoc_chained);
+ DMA_TO_DEVICE, assoc_chained);
if (likely(req->src == req->dst)) {
sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1,
DMA_BIDIRECTIONAL, src_chained);
--
1.7.7.6


2013-05-10 13:04:49

by Garg Vakul-B16394

[permalink] [raw]
Subject: RE: [PATCH] crypto: caam - fix inconsistent assoc dma mapping direction

Looks good.


> -----Original Message-----
> From: Geanta Neag Horia Ioan-B05471
> Sent: Friday, May 10, 2013 5:39 PM
> To: [email protected]
> Cc: Herbert Xu; [email protected]; Phillips Kim-R1AAHA; Garg Vakul-
> B16394
> Subject: [PATCH] crypto: caam - fix inconsistent assoc dma mapping
> direction
>
> req->assoc is dma mapped BIDIRECTIONAL and unmapped TO_DEVICE.
> Since it is read-only for the device, use TO_DEVICE both for mapping and
> unmapping.
>
> Cc: <[email protected]> # 3.9, 3.8
> Signed-off-by: Horia Geanta <[email protected]>
> ---
> drivers/crypto/caam/caamalg.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/caam/caamalg.c
> b/drivers/crypto/caam/caamalg.c index 42420fb..bf7da50 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -1154,7 +1154,7 @@ static struct aead_edesc *aead_edesc_alloc(struct
> aead_request *req,
> dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained);
>
> sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1,
> - DMA_BIDIRECTIONAL, assoc_chained);
> + DMA_TO_DEVICE, assoc_chained);
> if (likely(req->src == req->dst)) {
> sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1,
> DMA_BIDIRECTIONAL, src_chained);
> @@ -1336,7 +1336,7 @@ static struct aead_edesc
> *aead_giv_edesc_alloc(struct aead_givcrypt_request
> dst_nents = sg_count(req->dst, req->cryptlen, &dst_chained);
>
> sgc = dma_map_sg_chained(jrdev, req->assoc, assoc_nents ? : 1,
> - DMA_BIDIRECTIONAL, assoc_chained);
> + DMA_TO_DEVICE, assoc_chained);
> if (likely(req->src == req->dst)) {
> sgc = dma_map_sg_chained(jrdev, req->src, src_nents ? : 1,
> DMA_BIDIRECTIONAL, src_chained);
> --
> 1.7.7.6

2013-05-14 02:38:16

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH] crypto: caam - fix inconsistent assoc dma mapping direction

On Fri, May 10, 2013 at 03:08:39PM +0300, Horia Geanta wrote:
> req->assoc is dma mapped BIDIRECTIONAL and unmapped TO_DEVICE.
> Since it is read-only for the device, use TO_DEVICE both for mapping
> and unmapping.
>
> Cc: <[email protected]> # 3.9, 3.8
> Signed-off-by: Horia Geanta <[email protected]>

Applied to crypto. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt