From: Richard Weinberger <richard@nod.at>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [patch] UBI: fix some use after free bugs
Date: Wed, 29 Jan 2014 13:29:27 +0000 [thread overview]
Message-ID: <52E90237.1050005@nod.at> (raw)
In-Reply-To: <20140129131756.GC10678@elgon.mountain>
Am 29.01.2014 14:17, schrieb Dan Carpenter:
> Move the kmem_cache_free() calls down a couple lines.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks for fixing this Dan!
Acked-by: Richard Weinberger <richard@nod.at>
> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> index ead861307b3c..c5dad652614d 100644
> --- a/drivers/mtd/ubi/fastmap.c
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -463,8 +463,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
> }
> }
> if (found_orphan) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
>
> new_aeb = kmem_cache_alloc(ai->aeb_slab_cache,
> @@ -846,16 +846,16 @@ fail_bad:
> ret = UBI_BAD_FASTMAP;
> fail:
> list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
> list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
> 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);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
>
> return ret;
>
WARNING: multiple messages have this Message-ID (diff)
From: Richard Weinberger <richard@nod.at>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: Re: [patch] UBI: fix some use after free bugs
Date: Wed, 29 Jan 2014 14:29:27 +0100 [thread overview]
Message-ID: <52E90237.1050005@nod.at> (raw)
In-Reply-To: <20140129131756.GC10678@elgon.mountain>
Am 29.01.2014 14:17, schrieb Dan Carpenter:
> Move the kmem_cache_free() calls down a couple lines.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks for fixing this Dan!
Acked-by: Richard Weinberger <richard@nod.at>
> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
> index ead861307b3c..c5dad652614d 100644
> --- a/drivers/mtd/ubi/fastmap.c
> +++ b/drivers/mtd/ubi/fastmap.c
> @@ -463,8 +463,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
> }
> }
> if (found_orphan) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
>
> new_aeb = kmem_cache_alloc(ai->aeb_slab_cache,
> @@ -846,16 +846,16 @@ fail_bad:
> ret = UBI_BAD_FASTMAP;
> fail:
> list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
> list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
> - kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> list_del(&tmp_aeb->u.list);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
> 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);
> + kmem_cache_free(ai->aeb_slab_cache, tmp_aeb);
> }
>
> return ret;
>
next prev parent reply other threads:[~2014-01-29 13:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-29 13:17 [patch] UBI: fix some use after free bugs Dan Carpenter
2014-01-29 13:17 ` Dan Carpenter
2014-01-29 13:29 ` Richard Weinberger [this message]
2014-01-29 13:29 ` Richard Weinberger
2014-02-04 7:45 ` Artem Bityutskiy
2014-02-04 7:45 ` Artem Bityutskiy
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=52E90237.1050005@nod.at \
--to=richard@nod.at \
--cc=computersforpeace@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.