From: Rabin Vincent <rabin.vincent@axis.com>
To: dedekind1@gmail.com, richard@nod.at
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] ubi: fastmap: fix slab corruption
Date: Mon, 20 Mar 2017 16:20:48 +0100 [thread overview]
Message-ID: <20170320152048.GA8958@axis.com> (raw)
In-Reply-To: <1490023026-6327-1-git-send-email-rabin.vincent@axis.com>
On Mon, Mar 20, 2017 at 04:17:06PM +0100, Rabin Vincent wrote:
> /**
> * ubi_scan_fastmap - scan the fastmap.
> * @ubi: UBI device object
> @@ -847,7 +865,7 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
> struct ubi_vid_hdr *vh;
> struct ubi_ec_hdr *ech;
> struct ubi_fastmap_layout *fm;
> - struct ubi_ainf_peb *tmp_aeb, *aeb;
> + struct ubi_ainf_peb *aeb;
> int i, used_blocks, pnum, fm_anchor, ret = 0;
> size_t fm_size;
> __be32 crc, tmp_crc;
> @@ -857,9 +875,18 @@ int ubi_scan_fastmap(struct ubi_device *ubi, struct ubi_attach_info *ai,
> if (fm_anchor < 0)
> return UBI_NO_FASTMAP;
>
> - /* Move all (possible) fastmap blocks into our new attach structure. */
> - list_for_each_entry_safe(aeb, tmp_aeb, &scan_ai->fastmap, u.list)
> - list_move_tail(&aeb->u.list, &ai->fastmap);
> + /* Copy all (possible) fastmap blocks into our new attach structure. */
> + list_for_each_entry(aeb, &scan_ai->fastmap, u.list) {
> + struct ubi_ainf_peb *new;
> +
> + new = clone_aeb(ai, aeb);
> + if (!new) {
> + ret = -ENOMEM;
> + goto out;
I just noticed that this should be just a return instead of a goto out
since we haven't locked the semaphore yet. I'll send a v2 with that
fixed if you think that the rest of the patch look sane.
next prev parent reply other threads:[~2017-03-20 15:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-20 15:17 [PATCH] ubi: fastmap: fix slab corruption Rabin Vincent
2017-03-20 15:20 ` Rabin Vincent [this message]
2017-03-20 16:22 ` Richard Weinberger
2017-03-21 8:40 ` Rabin Vincent
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=20170320152048.GA8958@axis.com \
--to=rabin.vincent@axis.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--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 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.