[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 07/24] qga-win: prevent crash when executing fsinf
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PULL v2 07/24] qga-win: prevent crash when executing fsinfo command |
Date: |
Tue, 30 Oct 2018 20:38:04 -0500 |
From: Sameeh Jubran <address@hidden>
The fsinfo command is currently implemented for Windows only and it's disk
parameter can be enabled by adding the define "CONFIG_QGA_NTDDSCSI" to the qga
code. When enabled and executed the qemu-ga crashed with the following message:
------------------------------------------------
File qapi/qapi-visit-core.c, Line 49
Expression: !(v->type & VISITOR_OUTPUT) || *obj)
------------------------------------------------
After some digging, turns out that the GuestPCIAddress is null and the
qapi visitor doesn't like that, so we can always allocate it instead and
initiate all it's members to -1.
Signed-off-by: Sameeh Jubran <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
Signed-off-by: Tomáš Golembiovský <address@hidden>
Signed-off-by: Michael Roth <address@hidden>
---
qga/commands-win32.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 347577f2a4..f0e6f6128b 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -499,6 +499,11 @@ static GuestPCIAddress *get_pci_info(char *guid, Error
**errp)
char *buffer = NULL;
GuestPCIAddress *pci = NULL;
char *name = g_strdup(&guid[4]);
+ pci = g_malloc0(sizeof(*pci));
+ pci->domain = -1;
+ pci->slot = -1;
+ pci->function = -1;
+ pci->bus = -1;
if (!QueryDosDevice(name, dev_name, ARRAY_SIZE(dev_name))) {
error_setg_win32(errp, GetLastError(), "failed to get dos device
name");
@@ -570,7 +575,6 @@ static GuestPCIAddress *get_pci_info(char *guid, Error
**errp)
func = addr & 0x0000FFFF;
dev = (addr >> 16) & 0x0000FFFF;
- pci = g_malloc0(sizeof(*pci));
pci->domain = dev;
pci->slot = slot;
pci->function = func;
--
2.17.1
- [Qemu-devel] [PULL v2 18/24] qga: group agent init/cleanup init separate routines, (continued)
- [Qemu-devel] [PULL v2 18/24] qga: group agent init/cleanup init separate routines, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 16/24] qga-win: demystify namespace stripping, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 22/24] qga-win: install service with --retry-path set by default, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 23/24] qga-win: report specific error when failing to open channel, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 03/24] qga: ignore non present cpus when handling qmp_guest_get_vcpus(), Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 02/24] qga-win: add support for qmp_guest_fsfreeze_freeze_list, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 24/24] qga-win: changing --retry-path option behavior, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 04/24] configure: add test for libudev, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 05/24] qga: linux: report disk serial number, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 06/24] qga: linux: return disk device in guest-get-fsinfo, Michael Roth, 2018/10/30
- [Qemu-devel] [PULL v2 07/24] qga-win: prevent crash when executing fsinfo command,
Michael Roth <=
- [Qemu-devel] [PULL v2 08/24] qga-win: fsinfo: pci-info: allow partial info, Michael Roth, 2018/10/30