All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: mt29f_spinand: fix memory leak while programming pages
@ 2018-08-01  9:44 Jheng-Jhong Wu
  2018-08-01 11:45 ` Dan Carpenter
  2018-08-02  7:51 ` [PATCH v2] " Jheng-Jhong Wu
  0 siblings, 2 replies; 8+ messages in thread
From: Jheng-Jhong Wu @ 2018-08-01  9:44 UTC (permalink / raw)
  Cc: goodwater.wu, Greg Kroah-Hartman, devel, linux-kernel

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@gmail.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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-08-02  8:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01  9:44 [PATCH] staging: mt29f_spinand: fix memory leak while programming pages Jheng-Jhong Wu
2018-08-01 11:45 ` Dan Carpenter
     [not found]   ` <CALtPoQCyoe5V0m5=3K1XeZm41aDCaJ0rmYU-a=qkm=Yb8jgMxg@mail.gmail.com>
2018-08-02  3:42     ` Jheng-Jhong Wu
2018-08-02  6:12       ` Dan Carpenter
2018-08-02  7:51 ` [PATCH v2] " Jheng-Jhong Wu
2018-08-02  8:02   ` Greg Kroah-Hartman
2018-08-02  8:31     ` Jheng-Jhong Wu
2018-08-02  8:41       ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.