[PATCH] mtd: nand: qpic_common: fix BAM transaction memory leak

Felix Gu ustc.gu at gmail.com
Sat Nov 14 23:20:01 PST 2026


qcom_nandc_alloc() allocates the BAM transaction, but
qcom_nandc_unalloc() does not free it. This leaks the transaction on
controller removal and probe failures after successful allocation.

Release it in qcom_nandc_unalloc().

Fixes: fdf3ee5c6e52 ("mtd: nand: Add qpic_common API file")
Reported-by: Sashiko <sashiko-bot at kernel.org>
Closes: https://sashiko.dev/#/bug/linux-ba3b41c6-9de2-42b9-8205-67454e0229f6
Signed-off-by: Felix Gu <ustc.gu at gmail.com>
---
 drivers/mtd/nand/qpic_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/qpic_common.c b/drivers/mtd/nand/qpic_common.c
index e97043b866d2..0f81303ae8b6 100644
--- a/drivers/mtd/nand/qpic_common.c
+++ b/drivers/mtd/nand/qpic_common.c
@@ -657,6 +657,8 @@ void qcom_nandc_unalloc(struct qcom_nand_controller *nandc)
 
 		if (nandc->cmd_chan)
 			dma_release_channel(nandc->cmd_chan);
+
+		qcom_free_bam_transaction(nandc);
 	} else {
 		if (nandc->chan)
 			dma_release_channel(nandc->chan);

---
base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
change-id: 20261115-nandc_unalloc-85129684cbad

Best regards,
--  
Felix Gu <ustc.gu at gmail.com>




More information about the linux-mtd mailing list