Commit 8e6e2c2a authored by Peter Maydell's avatar Peter Maydell

Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging

* remotes/qmp-unstable/queue/qmp:
  monitor: fix use after free
  dump.c: Fix memory leak issue in cleanup processing for dump_init()
  monitor: Remove hardcoded watchdog event names
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 073fd73e b3dd1b8c
......@@ -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;
}
......
......@@ -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 */
......@@ -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)
......@@ -4521,16 +4523,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,
......
#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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment