From: Sameeh Jubran <sameeh@daynix.com>
To: qemu-devel@nongnu.org
Cc: Yan Vugenfirer <yan@daynix.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 1/2] qga-win: prevent crash when executing fsinfo command
Date: Tue, 26 Jun 2018 18:10:37 +0300 [thread overview]
Message-ID: <20180626151038.24771-2-sameeh@daynix.com> (raw)
In-Reply-To: <20180626151038.24771-1-sameeh@daynix.com>
From: Sameeh Jubran <sjubran@redhat.com>
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 <sjubran@redhat.com>
---
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 2d48394748..c5f1c884e1 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -485,6 +485,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");
@@ -556,7 +561,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.13.6
next prev parent reply other threads:[~2018-06-26 15:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-26 15:10 [Qemu-devel] [PATCH 0/2] prevent qga from crashing Sameeh Jubran
2018-06-26 15:10 ` Sameeh Jubran [this message]
2018-06-26 16:11 ` [Qemu-devel] [PATCH 1/2] qga-win: prevent crash when executing fsinfo command Philippe Mathieu-Daudé
2018-06-28 21:44 ` Eric Blake
2018-06-28 23:33 ` Sameeh Jubran
2018-07-09 22:58 ` Michael Roth
2018-07-16 11:42 ` Sameeh Jubran
2018-06-26 15:10 ` [Qemu-devel] [PATCH 2/2] qga-win: fsinfo: pci-info: allow partial info Sameeh Jubran
2018-07-16 20:04 ` Michael Roth
2018-07-17 7:58 ` Sameeh Jubran
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=20180626151038.24771-2-sameeh@daynix.com \
--to=sameeh@daynix.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=yan@daynix.com \
/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).