OSDN Git Service

crypto: qce: skcipher: Fix incorrect sg count for dma transfers
authorThara Gopinath <thara.gopinath@linaro.org>
Fri, 21 May 2021 02:20:23 +0000 (22:20 -0400)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 28 May 2021 07:11:45 +0000 (15:11 +0800)
commit1339a7c3ba05137a2d2fe75f602311bbfc6fab33
treed4f32635cd154120c2dc5140ebef144cf546e2f1
parent9b7b94683a9b9c42a743d591e48b9f51f505dd1f
crypto: qce: skcipher: Fix incorrect sg count for dma transfers

Use the sg count returned by dma_map_sg to call into
dmaengine_prep_slave_sg rather than using the original sg count. dma_map_sg
can merge consecutive sglist entries, thus making the original sg count
wrong. This is a fix for memory coruption issues observed while testing
encryption/decryption of large messages using libkcapi framework.

Patch has been tested further by running full suite of tcrypt.ko tests
including fuzz tests.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qce/skcipher.c