From 471b71465bd72a73b9f822f836af41c001effb16 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 10 Sep 2023 11:38:00 +0100 Subject: [PATCH] 4.14-stable patches added patches: crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch --- ...terating-through-scatterlist-for-dma.patch | 37 +++++++++++++++++++ queue-4.14/series | 1 + 2 files changed, 38 insertions(+) create mode 100644 queue-4.14/crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch diff --git a/queue-4.14/crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch b/queue-4.14/crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch new file mode 100644 index 00000000000..3d8ef49c903 --- /dev/null +++ b/queue-4.14/crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch @@ -0,0 +1,37 @@ +From d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f Mon Sep 17 00:00:00 2001 +From: Thomas Bourgoin +Date: Thu, 13 Jul 2023 17:15:15 +0200 +Subject: crypto: stm32 - fix loop iterating through scatterlist for DMA + +From: Thomas Bourgoin + +commit d9c83f71eeceed2cb54bb78be84f2d4055fd9a1f 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 : 8a1012d3f2ab ("crypto: stm32 - Support for STM32 HASH module") +Cc: stable@vger.kernel.org +Signed-off-by: Thomas Bourgoin +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/stm32/stm32-hash.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/crypto/stm32/stm32-hash.c ++++ b/drivers/crypto/stm32/stm32-hash.c +@@ -574,9 +574,9 @@ static int stm32_hash_dma_send(struct st + } + + 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); diff --git a/queue-4.14/series b/queue-4.14/series index 9c8e831f4d0..58460b45b8c 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -117,3 +117,4 @@ dccp-fix-out-of-bounds-access-in-dccp-error-handler.patch x.509-if-signature-is-unsupported-skip-validation.patch net-handle-arphrd_ppp-in-dev_is_mac_header_xmit.patch pstore-ram-check-start-of-empty-przs-during-init.patch +crypto-stm32-fix-loop-iterating-through-scatterlist-for-dma.patch -- 2.47.3