From: NeilBrown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: Re: [PATCH 1/2] Avoid use after free
Date: Mon, 31 Oct 2011 10:43:58 +1100 [thread overview]
Message-ID: <20111031104358.24632497@notabene.brown> (raw)
In-Reply-To: <1319831451-26704-2-git-send-email-Jes.Sorensen@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
On Fri, 28 Oct 2011 21:50:50 +0200 Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> If picking just one spare disk from the container, jump out of the
> loop once freeing the list. Otherwise we end up accessing the list
> that we just freed.
>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
> util.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/util.c b/util.c
> index 2cf617d..1bbd87f 100644
> --- a/util.c
> +++ b/util.c
> @@ -1766,6 +1766,7 @@ struct mdinfo *container_choose_spares(struct supertype *st,
> if (get_one) {
> sysfs_free(*dp);
> d->next = NULL;
> + goto out;
> }
> } else {
> *dp = d->next;
> @@ -1773,5 +1774,6 @@ struct mdinfo *container_choose_spares(struct supertype *st,
> sysfs_free(d);
> }
> }
> +out:
> return disks;
> }
Hi Jes,
I dont' think patch is needed.
The while loop that it jumps out of is
while (*dp)
at the place you put the goto,
dp == &d->next
As d->next was just set to NULL, *dp will be NULL, so the loop will
exit with the need for a goto.
I have applied the second patch - the GPT stack overflow one, thanks.
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2011-10-30 23:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-28 19:50 [PATCH 0/2] Misc fixes Jes.Sorensen
2011-10-28 19:50 ` [PATCH 1/2] Avoid use after free Jes.Sorensen
2011-10-30 23:43 ` NeilBrown [this message]
2011-10-31 7:41 ` Jes Sorensen
2011-10-28 19:50 ` [PATCH 2/2] Avoid stack overflow if GPT partition entries on disk are > 128 bytes Jes.Sorensen
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=20111031104358.24632497@notabene.brown \
--to=neilb@suse.de \
--cc=Jes.Sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).