From: Greg Kroah-Hartman Date: Sat, 23 Aug 2025 15:40:32 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v5.4.297~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=798b83a86049fb7e374889973022305ab45d4006;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch --- diff --git a/queue-5.15/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch b/queue-5.15/fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch new file mode 100644 index 0000000000..f0821be9fc --- /dev/null +++ b/queue-5.15/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.15/series b/queue-5.15/series index e903e90baa..c4dee7e2db 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -573,3 +573,4 @@ drm-amd-display-find-first-crtc-and-its-line-time-in-dce110_fill_display_configs drm-amd-display-fill-display-clock-and-vblank-time-in-dce110_fill_display_configs.patch fs-buffer-fix-use-after-free-when-call-bh_read-helpe.patch use-uniform-permission-checks-for-all-mount-propagat.patch +fpga-zynq_fpga-fix-the-wrong-usage-of-dma_map_sgtable.patch