From: Greg Kroah-Hartman Date: Sat, 23 Aug 2025 15:40:10 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v5.4.297~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d3a0b72bc59f06fbb95c60fb043b1e37fbd746b0;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch --- diff --git a/queue-5.4/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch b/queue-5.4/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch new file mode 100644 index 0000000000..f0821be9fc --- /dev/null +++ b/queue-5.4/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-5.4/series b/queue-5.4/series index 6d60daa24a..711b8958d3 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -312,3 +312,4 @@ drm-amd-display-find-first-crtc-and-its-line-time-in-dce110_fill_display_configs fs-buffer-fix-use-after-free-when-call-bh_read-helpe.patch move_mount-allow-to-add-a-mount-into-an-existing-gro.patch use-uniform-permission-checks-for-all-mount-propagat.patch +fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch