Skip to contentSkip to conversation

QMP queue

GIT PULL Applied Luiz Capitulino 2 participants 5 messages Aug 18, 2014 – Aug 19, 2014

lore
Share & tools
lore
#0 lore raw

Three little birds.

The following changes since commit 08ab59770da57648bfb8fc9be37f0ef7fb50b0f9:

Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging (2014-08-18 12:55:02 +0100)

are available in the git repository at:

git://repo.or.cz/qemu/qmp-unstable.git queue/qmp

for you to fetch changes up to b3dd1b8c295636e64ceb14cdc4db6420d7319e38:

monitor: fix use after free (2014-08-18 14:39:10 -0400)

----------------------------------------------------------------
Chen Gang (1):
dump.c: Fix memory leak issue in cleanup processing for dump_init()

Hani Benhabiles (1):
monitor: Remove hardcoded watchdog event names

Michael S. Tsirkin (1):
monitor: fix use after free

 dump.c                    | 18 +++++-------------
 include/monitor/monitor.h |  2 +-
 monitor.c                 | 19 ++++++++++---------
 stubs/fdset-remove-fd.c   |  3 +--
 4 files changed, 17 insertions(+), 25 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 2/3] dump.c: Fix memory leak issue in cleanup processing for dump_init()

From: Chen Gang <[email protected]>

In dump_init(), when failure occurs, need notice about 'fd' and memory mapping. So call dump_cleanup() for it (need let all initializations at front).

Also simplify dump_cleanup(): remove redundant 'ret' and redundant 'fd' checking.

---
 dump.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)
dump.c +5 -13
index ce646bc..71d3e94 100644
@@ -71,18 +71,14 @@ uint64_t cpu_to_dump64(DumpState *s, uint64_t val)
 
 static int dump_cleanup(DumpState *s)
 {
-    int ret = 0;
-
     guest_phys_blocks_free(&s->guest_phys_blocks);
     memory_mapping_list_free(&s->list);
-    if (s->fd != -1) {
-        close(s->fd);
-    }
+    close(s->fd);
     if (s->resume) {
         vm_start();
     }
 
-    return ret;
+    return 0;
 }
 
 static void dump_error(DumpState *s, const char *reason)
@@ -1499,6 +1495,8 @@ static int dump_init(DumpState *s, int fd, bool has_format,
     s->begin = begin;
     s->length = length;
 
+    memory_mapping_list_init(&s->list);
+
     guest_phys_blocks_init(&s->guest_phys_blocks);
     guest_phys_blocks_append(&s->guest_phys_blocks);
 
@@ -1526,7 +1524,6 @@ static int dump_init(DumpState *s, int fd, bool has_format,
     }
 
     /* get memory mapping */
-    memory_mapping_list_init(&s->list);
     if (paging) {
         qemu_get_guest_memory_mapping(&s->list, &s->guest_phys_blocks, &err);
         if (err != NULL) {
@@ -1622,12 +1619,7 @@ static int dump_init(DumpState *s, int fd, bool has_format,
     return 0;
 
 cleanup:
-    guest_phys_blocks_free(&s->guest_phys_blocks);
-
-    if (s->resume) {
-        vm_start();
-    }
-
+    dump_cleanup(s);
     return -1;
 }
 
Signature · 1 line
1.9.3
#2 lore raw

[Qemu-devel] [PULL 1/3] monitor: Remove hardcoded watchdog event names

In reply to Luiz Capitulino

From: Hani Benhabiles <[email protected]>

---
 monitor.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
monitor.c +5 -6
index cdbaa60..48f0fdc 100644
@@ -4521,16 +4521,15 @@ void netdev_del_completion(ReadLineState *rs, int nb_args, const char *str)
 
 void watchdog_action_completion(ReadLineState *rs, int nb_args, const char *str)
 {
+    int i;
+
     if (nb_args != 2) {
         return;
     }
     readline_set_completion_index(rs, strlen(str));
-    add_completion_option(rs, str, "reset");
-    add_completion_option(rs, str, "shutdown");
-    add_completion_option(rs, str, "poweroff");
-    add_completion_option(rs, str, "pause");
-    add_completion_option(rs, str, "debug");
-    add_completion_option(rs, str, "none");
+    for (i = 0; WatchdogExpirationAction_lookup[i]; i++) {
+        add_completion_option(rs, str, WatchdogExpirationAction_lookup[i]);
+    }
 }
 
 void migrate_set_capability_completion(ReadLineState *rs, int nb_args,
Signature · 1 line
1.9.3
#3 lore raw

[Qemu-devel] [PULL 3/3] monitor: fix use after free

In reply to Luiz Capitulino

From: "Michael S. Tsirkin" <[email protected]>

The function monitor_fdset_dup_fd_find_remove() references member of 'mon_fdset' which - when remove flag is set - may be freed in function monitor_fdset_cleanup().
remove is set by monitor_fdset_dup_fd_remove which in practice does not need the returned value, so make it void,
and return -1 from monitor_fdset_dup_fd_find_remove.

---
 include/monitor/monitor.h | 2 +-
 monitor.c                 | 8 +++++---
 stubs/fdset-remove-fd.c   | 3 +--
 3 files changed, 7 insertions(+), 6 deletions(-)
include/monitor/monitor.h +1 -1
index 3d6929d..78a5fc8 100644
@@ -64,7 +64,7 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
                                 Error **errp);
 int monitor_fdset_get_fd(int64_t fdset_id, int flags);
 int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
-int monitor_fdset_dup_fd_remove(int dup_fd);
+void monitor_fdset_dup_fd_remove(int dup_fd);
 int monitor_fdset_dup_fd_find(int dup_fd);
 
 #endif /* !MONITOR_H */
monitor.c +5 -3
index 48f0fdc..34cee74 100644
@@ -2542,8 +2542,10 @@ static int monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove)
                     if (QLIST_EMPTY(&mon_fdset->dup_fds)) {
                         monitor_fdset_cleanup(mon_fdset);
                     }
+                    return -1;
+                } else {
+                    return mon_fdset->id;
                 }
-                return mon_fdset->id;
             }
         }
     }
@@ -2555,9 +2557,9 @@ int monitor_fdset_dup_fd_find(int dup_fd)
     return monitor_fdset_dup_fd_find_remove(dup_fd, false);
 }
 
-int monitor_fdset_dup_fd_remove(int dup_fd)
+void monitor_fdset_dup_fd_remove(int dup_fd)
 {
-    return monitor_fdset_dup_fd_find_remove(dup_fd, true);
+    monitor_fdset_dup_fd_find_remove(dup_fd, true);
 }
 
 int monitor_handle_fd_param(Monitor *mon, const char *fdname)
stubs/fdset-remove-fd.c +1 -2
index b3886d9..7f6d61e 100644
@@ -1,7 +1,6 @@
 #include "qemu-common.h"
 #include "monitor/monitor.h"
 
-int monitor_fdset_dup_fd_remove(int dupfd)
+void monitor_fdset_dup_fd_remove(int dupfd)
 {
-    return -1;
 }
Signature · 1 line
1.9.3
#4 lore raw
In reply to Luiz Capitulino
Quoted 22 lines · Luiz Capitulino

Three little birds.

The following changes since commit 08ab59770da57648bfb8fc9be37f0ef7fb50b0f9:

Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging (2014-08-18 12:55:02 +0100)

are available in the git repository at:

git://repo.or.cz/qemu/qmp-unstable.git queue/qmp

for you to fetch changes up to b3dd1b8c295636e64ceb14cdc4db6420d7319e38:

monitor: fix use after free (2014-08-18 14:39:10 -0400)

----------------------------------------------------------------
Chen Gang (1):
dump.c: Fix memory leak issue in cleanup processing for dump_init()

Hani Benhabiles (1):
monitor: Remove hardcoded watchdog event names

Quoted 9 lines

Michael S. Tsirkin (1):
monitor: fix use after free

 dump.c                    | 18 +++++-------------
 include/monitor/monitor.h |  2 +-
 monitor.c                 | 19 ++++++++++---------
 stubs/fdset-remove-fd.c   |  3 +--
 4 files changed, 17 insertions(+), 25 deletions(-)

Applied, thanks.

-- PMM