From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 03/10] UBI: fix some use after free bugs
Date: Thu, 11 Sep 2014 17:16:03 +0200 [thread overview]
Message-ID: <1410448570-2054-4-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1410448570-2054-1-git-send-email-s.hauer@pengutronix.de>
From: Dan Carpenter <dan.carpenter@oracle.com>
Move the kmem_cache_free() calls down a couple lines.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/ubi/fastmap.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index de68c32..50db661 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -462,8 +462,8 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
}
}
if (found_orphan) {
- kfree(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ kfree(tmp_aeb);
}
new_aeb = kzalloc(sizeof(*new_aeb), GFP_KERNEL);
@@ -835,16 +835,16 @@ fail_bad:
ret = UBI_BAD_FASTMAP;
fail:
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &used, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &eba_orphans, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
list_for_each_entry_safe(tmp_aeb, _tmp_aeb, &lfree, u.list) {
- free(tmp_aeb);
list_del(&tmp_aeb->u.list);
+ free(tmp_aeb);
}
return ret;
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2014-09-11 15:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-11 15:16 UBI patches Sascha Hauer
2014-09-11 15:16 ` [PATCH 01/10] UBI: fix error return code Sascha Hauer
2014-09-11 15:16 ` [PATCH 02/10] UBI: avoid program operation on NOR flash after erasure interrupted Sascha Hauer
2014-09-11 15:16 ` Sascha Hauer [this message]
2014-09-11 15:16 ` [PATCH 04/10] UBI: fix error path in __wl_get_peb Sascha Hauer
2014-09-11 15:16 ` [PATCH 05/10] UBI: fix ubi free PEBs count calculation Sascha Hauer
2014-09-11 15:16 ` [PATCH 06/10] UBI: fix rb_tree node comparison in add_map Sascha Hauer
2014-09-11 15:16 ` [PATCH 07/10] UBI: fix the volumes tree sorting criteria Sascha Hauer
2014-09-11 15:16 ` [PATCH 08/10] UBI: fastmap: do not miss bit-flips Sascha Hauer
2014-09-11 15:16 ` [PATCH 09/10] UBI: init_volumes: Ignore volumes with no LEBs Sascha Hauer
2014-09-11 15:16 ` [PATCH 10/10] UBI: bugfix in ubi_wl_flush() Sascha Hauer
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=1410448570-2054-4-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox