All of lore.kernel.org
 help / color / mirror / Atom feed
* Fix dma unmap direction in iMX sahara aes calculation
@ 2017-07-16 21:21 Mogens Lauridsen
  2017-07-25 17:51 ` Fabio Estevam
  2017-07-28  9:57 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Mogens Lauridsen @ 2017-07-16 21:21 UTC (permalink / raw)
  To: linux-crypto

Hi,

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

Thanks,
Mogens

Signed-off-by: Mogens Lauridsen <mlauridsen171@gmail.com>

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 1d9ecd3..9538c52 100644ae
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -543,10 +543,10 @@ static int sahara_hw_descriptor_create(struct sahara_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;
 }

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

* Re: Fix dma unmap direction in iMX sahara aes calculation
  2017-07-16 21:21 Fix dma unmap direction in iMX sahara aes calculation Mogens Lauridsen
@ 2017-07-25 17:51 ` Fabio Estevam
  2017-07-28  9:57 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2017-07-25 17:51 UTC (permalink / raw)
  To: Mogens Lauridsen; +Cc: linux-crypto

Hi Mogens,

On Sun, Jul 16, 2017 at 6:21 PM, Mogens Lauridsen
<mlauridsen171@gmail.com> wrote:
> Hi,
>
> The direction used in dma_unmap_sg in aes calc in sahara.c is wrong.
> This result in the cache not being invalidated correct when aes
> calculation is done and result is dma'ed to memory.
> This is seen as sporadic wrong result from aes calc.
>
> Thanks,
> Mogens
>
> Signed-off-by: Mogens Lauridsen <mlauridsen171@gmail.com>

Your two fixes are good, but the patch format is not correct.

You could try to use git send-email for submitting the two patches.

Subject could be improved. If you run 'git log
drivers/crypto/sahara.c' you will see the common standard, so you
could do:

crypto: sahara - Fix dma unmap direction as the Subject.

Then you need to run './scripts/checkpatch.pl 0001-your.patch' to see
what people and lists to send it to.

Please resend them.

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

* Re: Fix dma unmap direction in iMX sahara aes calculation
  2017-07-16 21:21 Fix dma unmap direction in iMX sahara aes calculation Mogens Lauridsen
  2017-07-25 17:51 ` Fabio Estevam
@ 2017-07-28  9:57 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2017-07-28  9:57 UTC (permalink / raw)
  To: Mogens Lauridsen; +Cc: linux-crypto

Mogens Lauridsen <mlauridsen171@gmail.com> wrote:
> Hi,
> 
> The direction used in dma_unmap_sg in aes calc in sahara.c is wrong.
> This result in the cache not being invalidated correct when aes
> calculation is done and result is dma'ed to memory.
> This is seen as sporadic wrong result from aes calc.
> 
> Thanks,
> Mogens
> 
> Signed-off-by: Mogens Lauridsen <mlauridsen171@gmail.com>
> 
> diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
> index 1d9ecd3..9538c52 100644ae
> --- a/drivers/crypto/sahara.c
> +++ b/drivers/crypto/sahara.c
> @@ -543,10 +543,10 @@ static int sahara_hw_descriptor_create(struct sahara_dev *
> 
> unmap_out:
>        dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg,
> -               DMA_TO_DEVICE);
> +               DMA_FROM_DEVICE);

Your patch is space-damaged and does not apply.  Please send your
emails in a way that preserves white spaces.

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] 3+ messages in thread

end of thread, other threads:[~2017-07-28  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-16 21:21 Fix dma unmap direction in iMX sahara aes calculation Mogens Lauridsen
2017-07-25 17:51 ` Fabio Estevam
2017-07-28  9:57 ` 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.