mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 22:02:02 +00:00
crypto: stm32 - fix loop iterating through scatterlist for DMA
commitd9c83f71ee
upstream. We were reading the length of the scatterlist sg after copying value of tsg inside. So we are using the size of the previous scatterlist and for the first one we are using an unitialised value. Fix this by copying tsg in sg[0] before reading the size. Fixes :8a1012d3f2
("crypto: stm32 - Support for STM32 HASH module") Cc: stable@vger.kernel.org Signed-off-by: Thomas Bourgoin <thomas.bourgoin@foss.st.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9ab2c149c2
commit
cb65ad51f1
1 changed files with 1 additions and 1 deletions
|
@ -565,9 +565,9 @@ static int stm32_hash_dma_send(struct stm32_hash_dev *hdev)
|
|||
}
|
||||
|
||||
for_each_sg(rctx->sg, tsg, rctx->nents, i) {
|
||||
sg[0] = *tsg;
|
||||
len = sg->length;
|
||||
|
||||
sg[0] = *tsg;
|
||||
if (sg_is_last(sg)) {
|
||||
if (hdev->dma_mode == 1) {
|
||||
len = (ALIGN(sg->length, 16) - 16);
|
||||
|
|
Loading…
Reference in a new issue