Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: sahara - Fix dma unmap direction

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Mogens Lauridsen and committed by
Herbert Xu
1e320410 2d97591e

+4 -4
+4 -4
drivers/crypto/sahara.c
··· 543 543 544 544 unmap_out: 545 545 dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, 546 - DMA_TO_DEVICE); 546 + DMA_FROM_DEVICE); 547 547 unmap_in: 548 548 dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, 549 - DMA_FROM_DEVICE); 549 + DMA_TO_DEVICE); 550 550 551 551 return -EINVAL; 552 552 } ··· 594 594 } 595 595 596 596 dma_unmap_sg(dev->device, dev->out_sg, dev->nb_out_sg, 597 - DMA_TO_DEVICE); 598 - dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, 599 597 DMA_FROM_DEVICE); 598 + dma_unmap_sg(dev->device, dev->in_sg, dev->nb_in_sg, 599 + DMA_TO_DEVICE); 600 600 601 601 return 0; 602 602 }