Patch "mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check" has been added to the 5.15-stable tree

gregkh at linuxfoundation.org gregkh at linuxfoundation.org
Sun Sep 14 01:02:03 PDT 2025


This is a note to let you know that I've just added the patch titled

    mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mtd-rawnand-stm32_fmc2-fix-dma_map_sg-error-check.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.


>From stable+bounces-179495-greg=kroah.com at vger.kernel.org Sat Sep 13 17:09:31 2025
From: Sasha Levin <sashal at kernel.org>
Date: Sat, 13 Sep 2025 11:09:16 -0400
Subject: mtd: rawnand: stm32_fmc2: Fix dma_map_sg error check
To: stable at vger.kernel.org
Cc: Jack Wang <jinpu.wang at ionos.com>, Miquel Raynal <miquel.raynal at bootlin.com>, Richard Weinberger <richard at nod.at>, Vignesh Raghavendra <vigneshr at ti.com>, Maxime Coquelin <mcoquelin.stm32 at gmail.com>, Alexandre Torgue <alexandre.torgue at foss.st.com>, Philipp Zabel <p.zabel at pengutronix.de>, Christophe Kerello <christophe.kerello at foss.st.com>, Cai Huoqing <cai.huoqing at linux.dev>, linux-mtd at lists.infradead.org, linux-stm32 at st-md-mailman.stormreply.com, linux-arm-kernel at lists.infradead.org, linux-kernel at vger.kernel.org, Sasha Levin <sashal at kernel.org>
Message-ID: <20250913150917.1408380-1-sashal at kernel.org>

From: Jack Wang <jinpu.wang at ionos.com>

[ Upstream commit 43b81c2a3e6e07915151045aa13a6e8a9bd64419 ]

dma_map_sg return 0 on error, in case of error return -EIO.

Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Cc: Richard Weinberger <richard at nod.at>
Cc: Vignesh Raghavendra <vigneshr at ti.com>
Cc: Maxime Coquelin <mcoquelin.stm32 at gmail.com>
Cc: Alexandre Torgue <alexandre.torgue at foss.st.com>
Cc: Philipp Zabel <p.zabel at pengutronix.de>
Cc: Christophe Kerello <christophe.kerello at foss.st.com>
Cc: Cai Huoqing <cai.huoqing at linux.dev>
Cc: linux-mtd at lists.infradead.org
Cc: linux-stm32 at st-md-mailman.stormreply.com
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Signed-off-by: Jack Wang <jinpu.wang at ionos.com>
Reviewed-by: Christophe Kerello <christophe.kerello at foss.st.com>
Signed-off-by: Miquel Raynal <miquel.raynal at bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220819060801.10443-5-jinpu.wang@ionos.com
Stable-dep-of: 513c40e59d5a ("mtd: rawnand: stm32_fmc2: avoid overlapping mappings on ECC buffer")
Signed-off-by: Sasha Levin <sashal at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/mtd/nand/raw/stm32_fmc2_nand.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -860,8 +860,8 @@ static int stm32_fmc2_nfc_xfer(struct na
 
 	ret = dma_map_sg(nfc->dev, nfc->dma_data_sg.sgl,
 			 eccsteps, dma_data_dir);
-	if (ret < 0)
-		return ret;
+	if (!ret)
+		return -EIO;
 
 	desc_data = dmaengine_prep_slave_sg(dma_ch, nfc->dma_data_sg.sgl,
 					    eccsteps, dma_transfer_dir,
@@ -891,8 +891,10 @@ static int stm32_fmc2_nfc_xfer(struct na
 
 		ret = dma_map_sg(nfc->dev, nfc->dma_ecc_sg.sgl,
 				 eccsteps, dma_data_dir);
-		if (ret < 0)
+		if (!ret) {
+			ret = -EIO;
 			goto err_unmap_data;
+		}
 
 		desc_ecc = dmaengine_prep_slave_sg(nfc->dma_ecc_ch,
 						   nfc->dma_ecc_sg.sgl,


Patches currently in stable-queue which might be from sashal at kernel.org are

queue-5.15/media-i2c-imx214-fix-link-frequency-validation.patch
queue-5.15/flexfiles-pnfs-fix-null-checks-on-result-of-ff_layou.patch
queue-5.15/kvm-svm-set-synthesized-tsa-cpuid-flags.patch
queue-5.15/tcp_bpf-call-sk_msg_free-when-tcp_bpf_send_verdict-f.patch
queue-5.15/mm-rmap-reject-hugetlb-folios-in-folio_make_device_exclusive.patch
queue-5.15/media-mtk-vcodec-venc-avoid-wenum-compare-conditional-warning.patch
queue-5.15/nfsv4-clear-the-nfs_cap_fs_locations-flag-if-it-is-n.patch
queue-5.15/revert-fbdev-disable-sysfb-device-registration-when-.patch
queue-5.15/tracing-do-not-add-length-to-print-format-in-synthetic-events.patch
queue-5.15/tracing-fix-tracing_marker-may-trigger-page-fault-du.patch
queue-5.15/kvm-svm-return-tsa_sq_no-and-tsa_l1_no-bits-in-__do_cpuid_func.patch
queue-5.15/nfsv4-don-t-clear-capabilities-that-won-t-be-reset.patch
queue-5.15/s390-cpum_cf-deny-all-sampling-events-by-counter-pmu.patch
queue-5.15/nfsv4-flexfiles-fix-layout-merge-mirror-check.patch
queue-5.15/mtd-nand-raw-atmel-respect-tar-tclr-in-read-setup-timing.patch
queue-5.15/mtd-nand-raw-atmel-fix-comment-in-timings-preparation.patch
queue-5.15/nfsv4-clear-the-nfs_cap_xattr-flag-if-not-supported-.patch
queue-5.15/net-fix-null-ptr-deref-by-sock_lock_init_class_and_name-and-rmmod.patch
queue-5.15/mtd-rawnand-stm32_fmc2-fix-dma_map_sg-error-check.patch
queue-5.15/mtd-rawnand-stm32_fmc2-avoid-overlapping-mappings-on-ecc-buffer.patch
queue-5.15/kvm-x86-move-open-coded-cpuid-leaf-0x80000021-eax-bit-propagation-code.patch
queue-5.15/xfs-short-circuit-xfs_growfs_data_private-if-delta-i.patch



More information about the linux-mtd mailing list