]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
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)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:30:01 +0000 (09:30 +0200)
commite1825b28db1031e46834d5e2631a188fe2a361d4
tree8c011ba6a6a54427eecca580df2d02f1ddabe700
parent5cd7ca0c9d86742df54f30ef4ad7e7a5022aba50
crypto: qce: skcipher: Fix incorrect sg count for dma transfers

BugLink: https://bugs.launchpad.net/bugs/1938340
[ Upstream commit 1339a7c3ba05137a2d2fe75f602311bbfc6fab33 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/crypto/qce/skcipher.c