Skip to contentSkip to conversation

mtd: nand: qpic_common: fix BAM transaction memory leak

PATCH Applied Felix Gu 2 participants 2 messages Nov 15 – Nov 17

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 mtd: nand: qpic_common: fix BAM transaction memory leak

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")
---
 drivers/mtd/nand/qpic_common.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mtd/nand/qpic_common.c +2 -0
index e97043b866d2..0f81303ae8b6 100644
@@ -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,

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

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().

[...]

Applied to nand/next, thanks!

[1/1] mtd: nand: qpic_common: fix BAM transaction memory leak

      commit: a53bc9468f7c4461d51c66cbe949d0fbca37f7f6

Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl