From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>,
Richard Weinberger <richard@nod.at>,
Marek Vasut <marek.vasut@gmail.com>,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Subject: Re: [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails
Date: Tue, 2 May 2017 09:17:00 +0200 [thread overview]
Message-ID: <20170502091700.3798404a@bbrezillon> (raw)
In-Reply-To: <20170502000455.13240-1-computersforpeace@gmail.com>
On Mon, 1 May 2017 17:04:50 -0700
Brian Norris <computersforpeace@gmail.com> wrote:
> This bug seems to have been here forever, although we came close to
> fixing all of them in [1]!
>
> [1] 11eaf6df1cce ("mtd: nand: Remove BUG() abuse in nand_scan_tail")
>
> Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
> The goto isn't *really* necessary, but I thought it'd be more consistent.
>
> Compile tested only
>
> drivers/mtd/nand/nand_base.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 978242b1213f..e4919f9dece4 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -4794,7 +4794,11 @@ int nand_scan_tail(struct mtd_info *mtd)
> return 0;
>
> /* Build bad block table */
> - return chip->scan_bbt(mtd);
> + ret = chip->scan_bbt(mtd);
> + if (ret)
> + goto err_free;
> + return 0;
> +
> err_free:
> if (nbuf) {
> kfree(nbuf->databuf);
next prev parent reply other threads:[~2017-05-02 7:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 0:04 [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Brian Norris
2017-05-02 0:04 ` [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer Brian Norris
2017-05-02 7:15 ` Boris Brezillon
2017-05-02 0:04 ` [PATCH] mtd: nand: drop unneeded module.h include Brian Norris
2017-05-02 7:16 ` Boris Brezillon
2017-05-15 20:50 ` Boris Brezillon
2017-05-02 0:04 ` [PATCH] mtd: nand: free vendor-specific resources in init failure paths Brian Norris
2017-05-02 7:52 ` Boris Brezillon
2017-05-02 16:15 ` Boris Brezillon
2017-05-15 20:49 ` Boris Brezillon
2017-05-02 0:04 ` [PATCH] mtd: nand: orion: don't complain for probe deferral Brian Norris
2017-05-02 7:56 ` Boris Brezillon
2017-05-02 8:07 ` Simon Baatz
2017-05-08 17:46 ` Brian Norris
2017-05-02 0:04 ` [PATCH] mtd: nand: samsung: warn about un-parseable ECC info Brian Norris
2017-05-02 7:57 ` Boris Brezillon
2017-05-15 20:48 ` Boris Brezillon
2017-05-02 0:22 ` [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Ezequiel Garcia
2017-05-02 1:33 ` Brian Norris
2017-05-02 2:21 ` Ezequiel Garcia
2017-05-02 7:17 ` Boris Brezillon [this message]
2017-05-15 20:50 ` Boris Brezillon
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=20170502091700.3798404a@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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