Skip to contentSkip to conversation

spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()

PATCH In review Felix Gu 2 participants 2 messages May 9 – May 16

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()

When DMA read times out in mtk_snand_read_page_cache(), the original code erroneously jumped to cleanup label which skips DMA unmapping and ECC disable, causing a resource leak.

Fixes 764f1b748164 ("spi: add driver for MTK SPI NAND Flash Interface")
---
 drivers/spi/spi-mtk-snfi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-mtk-snfi.c +1 -1
index e616e6800e92..6e96e50fedad 100644
@@ -961,7 +961,7 @@ static int mtk_snand_read_page_cache(struct mtk_snand *snf,
 		    &snf->op_done, usecs_to_jiffies(SNFI_POLL_INTERVAL))) {
 		dev_err(snf->dev, "DMA timed out for reading from cache.\n");
 		ret = -ETIMEDOUT;
-		goto cleanup;
+		goto cleanup2;
 	}
 
 	// Wait for BUS_SEC_CNTR returning expected value

---
base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83
change-id: 20260509-snfi-c8d170513987

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer
#1 lore raw
Quoted 1 line · Felix Gu

spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.1

Thanks!

[1/1] spi: mtk-snfi: Fix resource leak in mtk_snand_read_page_cache()

      https://git.kernel.org/broonie/spi/c/496ba79b9496

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark