From: Richard Weinberger <richard@nod.at>
To: Richard Genoud <richard.genoud@gmail.com>
Cc: Artem Bityutskiy <dedekind1@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
linux-mtd <linux-mtd@lists.infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] UBI: fastmap: fix a mem leak on error path
Date: Fri, 27 Sep 2013 21:44:29 +0200 [thread overview]
Message-ID: <5245E01D.3020104@nod.at> (raw)
In-Reply-To: <1380296235-24194-1-git-send-email-richard.genoud@gmail.com>
Am 27.09.2013 17:37, schrieb Richard Genoud:
> If the scan_pool() function fails, the "free" list is not freed.
> This leads to destroy_ai(ai) complaining with:
> "kmem_cache_destroy ubi_ainf_peb_slab: Slab cache still has objects"
Hmm, I *think* we need to take care about used and eba_orphans too.
Tomorrow I'll have time to investigate...
Thanks,
//richard
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> drivers/mtd/ubi/fastmap.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> index 05067f5..22eb527 100644
> --- a/drivers/mtd/ubi/fastmap.c
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -841,6 +841,10 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
> fail_bad:
> ret = UBI_BAD_FASTMAP;
> fail:
> + list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &free, u.list) {
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> + list_del(&tmp_aeb->u.list);
> + }
> return ret;
> }
>
>
prev parent reply other threads:[~2013-09-27 19:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-27 15:37 [PATCH] UBI: fastmap: fix a mem leak on error path Richard Genoud
2013-09-27 19:44 ` Richard Weinberger [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=5245E01D.3020104@nod.at \
--to=richard@nod.at \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard.genoud@gmail.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