From: Greg Kroah-Hartman Date: Sat, 23 Aug 2025 15:40:55 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v5.4.297~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4be68d6bbe896bfeb532d5d91f85677596a71201;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch --- diff --git a/queue-6.6/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch b/queue-6.6/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch new file mode 100644 index 0000000000..f0821be9fc --- /dev/null +++ b/queue-6.6/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch @@ -0,0 +1,44 @@ +From 1ca61060de92a4320d73adfe5dc8d335653907ac Mon Sep 17 00:00:00 2001 +From: Xu Yilun +Date: Wed, 6 Aug 2025 15:06:05 +0800 +Subject: fpga: zynq_fpga: Fix the wrong usage of dma_map_sgtable() + +From: Xu Yilun + +commit 1ca61060de92a4320d73adfe5dc8d335653907ac upstream. + +dma_map_sgtable() returns only 0 or the error code. Read sgt->nents to +get the number of mapped segments. + +Fixes: 37e00703228a ("zynq_fpga: use sgtable-based scatterlist wrappers") +Reported-by: Pavel Pisa +Closes: https://lore.kernel.org/linux-fpga/202508041548.22955.pisa@fel.cvut.cz/ +Reviewed-by: Jason Gunthorpe +Reviewed-by: Marek Szyprowski +Signed-off-by: Xu Yilun +Tested-by: Pavel Pisa +Link: https://lore.kernel.org/r/20250806070605.1920909-2-yilun.xu@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/fpga/zynq-fpga.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/fpga/zynq-fpga.c ++++ b/drivers/fpga/zynq-fpga.c +@@ -405,12 +405,12 @@ static int zynq_fpga_ops_write(struct fp + } + } + +- priv->dma_nelms = +- dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0); +- if (priv->dma_nelms == 0) { ++ err = dma_map_sgtable(mgr->dev.parent, sgt, DMA_TO_DEVICE, 0); ++ if (err) { + dev_err(&mgr->dev, "Unable to DMA map (TO_DEVICE)\n"); +- return -ENOMEM; ++ return err; + } ++ priv->dma_nelms = sgt->nents; + + /* enable clock */ + err = clk_enable(priv->clk); diff --git a/queue-6.6/series b/queue-6.6/series index ba0fa2ec66..b5e2a016a5 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -510,3 +510,4 @@ mmc-sdhci-pci-gli-add-a-new-function-to-simplify-the-code.patch cpuidle-menu-remove-iowait-influence.patch cpuidle-governors-menu-avoid-selecting-states-with-too-much-latency.patch drm-dp-change-aux-dpcd-probe-address-from-dpcd_rev-to-lane0_1_status.patch +fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch