[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1533116658-14924-1-git-send-email-goodwater.wu@gmail.com>
Date: Wed, 1 Aug 2018 17:44:18 +0800
From: Jheng-Jhong Wu <goodwater.wu@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: goodwater.wu@...il.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: mt29f_spinand: fix memory leak while programming pages
In spinand_program_page(), it uses devm_kzalloc() to allocate memory to
wbuf dynamically if internal ECC is on, but it doesn't free memory
allocated to wbuf at the end of this function. This leads to a memory leak
issue when internal ECC is on.
Signed-off-by: Jheng-Jhong Wu <goodwater.wu@...il.com>
---
drivers/staging/mt29f_spinand/mt29f_spinand.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index e389009..cf51ca8 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -553,6 +553,8 @@ static int spinand_program_page(struct spi_device *spi_nand,
}
enable_hw_ecc = 0;
}
+
+ devm_kfree(&spi_nand->dev, wbuf);
#endif
return 0;
--
2.7.4
Powered by blists - more mailing lists