Re: [PATCH v2] mtd: spi-nor: fix a memory leak bug

From: Tudor.Ambarus
Date: Wed Aug 21 2019 - 04:23:16 EST




On 08/19/2019 08:16 PM, Wenwen Wang wrote:
> External E-Mail
>
>
> In spi_nor_parse_4bait(), 'dwords' is allocated through kmalloc(). However,
> it is not deallocated in the following execution if spi_nor_read_sfdp()
> fails, leading to a memory leak. To fix this issue, free 'dwords' before
> returning the error.
>
> Fixes: 816873eaeec6 ("mtd: spi-nor: parse SFDP 4-byte Address Instruction
> Table")
>
> Signed-off-by: Wenwen Wang <wenwen@xxxxxxxxxx>
> ---
> drivers/mtd/spi-nor/spi-nor.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>


Since the bug was not introduced in the previous release and we are quite late
for mtd/fixes,

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git,
spi-nor/next branch.

Thanks,
ta