From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Cc: "Stefan Weil" <sw@weilnetz.de>, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 1.0 1/1] memory: fix 'info mtree' segfaults
Date: Sun, 13 Nov 2011 12:06:19 +0200 [thread overview]
Message-ID: <1321178779-18124-2-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1321178779-18124-1-git-send-email-avi@redhat.com>
'info mtree' accesses invalid memory in two cases, both due to incorrect
(and unsafe) usage of QTAILQ_FOREACH_SAFE().
Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
memory.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/memory.c b/memory.c
index c0c1d12..7c20a07 100644
--- a/memory.c
+++ b/memory.c
@@ -1401,7 +1401,7 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
alias_print_queue);
}
- QTAILQ_FOREACH_SAFE(next_ml, &submr_print_queue, queue, ml) {
+ QTAILQ_FOREACH_SAFE(ml, &submr_print_queue, queue, next_ml) {
g_free(ml);
}
}
@@ -1425,7 +1425,7 @@ void mtree_info(fprintf_function mon_printf, void *f)
}
QTAILQ_FOREACH_SAFE(ml, &ml_head, queue, ml2) {
- g_free(ml2);
+ g_free(ml);
}
if (address_space_io.root &&
--
1.7.7.1
next prev parent reply other threads:[~2011-11-13 10:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-13 10:06 [Qemu-devel] [PULL 1.0 0/1] 'info mtree' fix Avi Kivity
2011-11-13 10:06 ` Avi Kivity [this message]
2011-11-13 10:08 ` Avi Kivity
2011-11-13 17:48 ` Anthony Liguori
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=1321178779-18124-2-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).