Skip to contentSkip to conversation

'info mtree' fix

GIT PULL New Avi Kivity 2 participants 4 messages Nov 13, 2011

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

Fix a segfault due to incorrect usage of QTAILQ_FOREACH_SAFE().

Avi Kivity (1):
memory: fix 'info mtree' segfaults

 memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.7.1
author
#1 lore raw

PATCH 1/1 memory: fix 'info mtree' segfaults

'info mtree' accesses invalid memory in two cases, both due to incorrect (and unsafe) usage of QTAILQ_FOREACH_SAFE().

---
 memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
memory.c +2 -2
index c0c1d12..7c20a07 100644
@@ -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 &&
Signature · 1 line
1.7.7.1
author
#2 lore raw
In reply to Avi Kivity
Quoted 8 lines · Avi Kivity

Fix a segfault due to incorrect usage of QTAILQ_FOREACH_SAFE().

Avi Kivity (1):
memory: fix 'info mtree' segfaults

 memory.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Gaaah. If it isn't generated by git request-pull, it's broken.

Please pull from:

git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent

to receive the fix above.

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 10 lines · Avi Kivity
Quoted 8 lines · Avi Kivity

Fix a segfault due to incorrect usage of QTAILQ_FOREACH_SAFE().

Avi Kivity (1):
memory: fix 'info mtree' segfaults

  memory.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
Quoted 7 lines

Gaaah. If it isn't generated by git request-pull, it's broken.

Please pull from:

git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git memory/urgent

to receive the fix above.

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 1 line