linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>,
	Richard Weinberger <richard@nod.at>, Kangjie Lu <kjlu@umn.edu>,
	LKML <linux-kernel@vger.kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Navid Emamdoost <emamd001@umn.edu>,
	linux-mtd@lists.infradead.org,
	Stephen McCamant <smccaman@umn.edu>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] mtd: onenand: prevent memory leak in onenand_scan
Date: Fri, 4 Oct 2019 12:20:20 -0500	[thread overview]
Message-ID: <CAEkB2ERissJF6EOhMtoO+RBXJOVnZYuMBnkvL2DxxMKfVJoYXQ@mail.gmail.com> (raw)
In-Reply-To: <20191004175740.5dd84c38@xps13>

Thanks Miquel for pointing that out. v2 was sent.

Thank you,
Navid.

On Fri, Oct 4, 2019 at 10:57 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> 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



-- 
Navid.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

      parent reply	other threads:[~2019-10-04 17:20 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
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     ` Navid Emamdoost [this message]

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=CAEkB2ERissJF6EOhMtoO+RBXJOVnZYuMBnkvL2DxxMKfVJoYXQ@mail.gmail.com \
    --to=navid.emamdoost@gmail.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=miquel.raynal@bootlin.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).