From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Navid Emamdoost <navid.emamdoost@gmail.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Marek Vasut <marek.vasut@gmail.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Navid Emamdoost <emamd001@umn.edu>,
kjlu@umn.edu, Stephen McCamant <smccaman@umn.edu>,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: onenand: prevent memory leak in onenand_scan
Date: Fri, 4 Oct 2019 17:57:40 +0200 [thread overview]
Message-ID: <20191004175740.5dd84c38@xps13> (raw)
In-Reply-To: <CAEkB2ETTmCsuOFDsJQ8LbBPHNgckpDFn2XhVePwAQEsCRsJo6g@mail.gmail.com>
Hi Navid,
Navid Emamdoost <navid.emamdoost@gmail.com> wrote on Mon, 30 Sep 2019
16:37:17 -0500:
> Would you please take a look at this patch?
>
> On Wed, Sep 25, 2019 at 10:43 AM Navid Emamdoost
> <navid.emamdoost@gmail.com> wrote:
> >
> > In onenand_scan if scan_bbt fails the allocated buffers should be
> > released.
> >
> > Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> > ---
> > drivers/mtd/nand/onenand/onenand_base.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c
> > index 77bd32a683e1..79c01f42925a 100644
> > --- a/drivers/mtd/nand/onenand/onenand_base.c
> > +++ b/drivers/mtd/nand/onenand/onenand_base.c
> > @@ -3977,8 +3977,11 @@ 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->page_buf);
Apparently you missed:
#ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
kfree(this->verify_buf);
#endif
> > + kfree(this->oob_buf);
> > return ret;
> > + }
> >
> > /* Change Flex-OneNAND boundaries if required */
> > for (i = 0; i < MAX_DIES; i++)
> > --
> > 2.17.1
> >
>
>
Thanks,
Miquèl
next prev parent reply other threads:[~2019-10-04 15:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 15:43 [PATCH] mtd: onenand: prevent memory leak in onenand_scan Navid Emamdoost
2019-09-27 15:24 ` Markus Elfring
2019-09-30 21:37 ` Navid Emamdoost
2019-10-04 15:57 ` Miquel Raynal [this message]
2019-10-04 17:19 ` [PATCH v2] " Navid Emamdoost
2019-10-05 14:04 ` Markus Elfring
2019-10-07 8:54 ` Miquel Raynal
2019-10-04 17:20 ` [PATCH] " Navid Emamdoost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191004175740.5dd84c38@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=navid.emamdoost@gmail.com \
--cc=richard@nod.at \
--cc=smccaman@umn.edu \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).