All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: sahara - Fix dma unmap direction
@ 2017-08-03 13:34 Mogens Lauridsen
  2017-08-17  9:00 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Mogens Lauridsen @ 2017-08-03 13:34 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, Mogens Lauridsen

The direction used in dma_unmap_sg in aes calc is wrong.
This result in the cache not being invalidated correct when aes
calculation is done and result has been dma'ed to memory.
This is seen as sporadic wrong result from aes calc.

Signed-off-by: Mogens Lauridsen <mlauridsen171@gmail.com>
---
 drivers/crypto/sahara.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index c2174ec88e2a..474da36bdd2c 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -543,10 +543,10 @@ static int sahara_hw_descriptor_create(struct sahara_dev *dev)
 
 unmap_out:
 	dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg,
-		DMA_TO_DEVICE);
+		DMA_FROM_DEVICE);
 unmap_in:
 	dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
-		DMA_FROM_DEVICE);
+		DMA_TO_DEVICE);
 
 	return -EINVAL;
 }
@@ -594,9 +594,9 @@ static int sahara_aes_process(struct ablkcipher_request *req)
 	}
 
 	dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg,
-		DMA_TO_DEVICE);
-	dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
 		DMA_FROM_DEVICE);
+	dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg,
+		DMA_TO_DEVICE);
 
 	return 0;
 }
-- 
2.13.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: sahara - Fix dma unmap direction
  2017-08-03 13:34 [PATCH] crypto: sahara - Fix dma unmap direction Mogens Lauridsen
@ 2017-08-17  9:00 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2017-08-17  9:00 UTC (permalink / raw)
  To: Mogens Lauridsen; +Cc: linux-crypto

On Thu, Aug 03, 2017 at 03:34:12PM +0200, Mogens Lauridsen wrote:
> The direction used in dma_unmap_sg in aes calc is wrong.
> This result in the cache not being invalidated correct when aes
> calculation is done and result has been dma'ed to memory.
> This is seen as sporadic wrong result from aes calc.
> 
> Signed-off-by: Mogens Lauridsen <mlauridsen171@gmail.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-17  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-03 13:34 [PATCH] crypto: sahara - Fix dma unmap direction Mogens Lauridsen
2017-08-17  9:00 ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.