Hi Navid,

Navid Emamdoost <navid.emamdo...@gmail.com> wrote on Fri,  4 Oct 2019
12:19:05 -0500:

> In onenand_scan if scan_bbt fails the allocated buffers for oob_buf,
> verify_buf, and page_buf should be released.
> 
> Fixes: 5988af231978 ("mtd: Flex-OneNAND support")

Missing Cc: sta...@vger.kernel.org

> Signed-off-by: Navid Emamdoost <navid.emamdo...@gmail.com>
> ---
> Changes in v2:
>       -- added release for this->verify_buf (thanks to Miquel Raynal
> for the hint).
> ---

These three dashes are not needed.

>  drivers/mtd/nand/onenand/onenand_base.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/onenand/onenand_base.c 
> b/drivers/mtd/nand/onenand/onenand_base.c
> index 77bd32a683e1..6329ada3f15c 100644
> --- a/drivers/mtd/nand/onenand/onenand_base.c
> +++ b/drivers/mtd/nand/onenand/onenand_base.c
> @@ -3977,8 +3977,14 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
>       this->badblockpos = ONENAND_BADBLOCK_POS;
>  
>       ret = this->scan_bbt(mtd);
> -     if ((!FLEXONENAND(this)) || ret)
> +     if ((!FLEXONENAND(this)) || ret) {
> +             kfree(this->oob_buf);
> +#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
> +             kfree(this->verify_buf);
> +#endif

Sorry for the ping-pong but actually, only the oob_buf and page_buf
have been introduced by the commit 5988af you point in the Fixes tag.

To help stable kernels maintainers I suggest you free the verify_buf
in a second patch which fixes:

4a8ce0b03071 mtd: onenand: allocate verify buffer in the core

> +             kfree(this->page_buf);
>               return ret;
> +     }
>  
>       /* Change Flex-OneNAND boundaries if required */
>       for (i = 0; i < MAX_DIES; i++)

Thanks,
Miquèl

Reply via email to