From nobody Wed Nov 5 11:01:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540293954873410.4418026550487; Tue, 23 Oct 2018 04:25:54 -0700 (PDT) Received: from localhost ([::1]:40281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEuom-00038B-5n for importer@patchew.org; Tue, 23 Oct 2018 07:25:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gEumk-0001qq-JO for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gEumf-0007hn-WC for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:42 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42306) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gEumc-0007ah-8E for qemu-devel@nongnu.org; Tue, 23 Oct 2018 07:23:36 -0400 Received: by mail-wr1-f67.google.com with SMTP id a9so1256765wrx.9 for ; Tue, 23 Oct 2018 04:23:32 -0700 (PDT) Received: from localhost.localdomain (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id g8-v6sm1498990wmf.45.2018.10.23.04.23.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 04:23:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MZIg3TKh4tJfdWpxQEZBiPE59Bfdfyf9BbMYucvibcg=; b=D3kaHkr4dYJ3A5dWS4nWHdy89cnJh2oq6oCWX8BNboxqDVX4pgJFbGBz9iLERY+R7K dcdld3j0JOJbXp4k4tb0U1WxqoO2KX6GHAqt270vvkaQ33Pif7jP6Sa6xSEd7o/USKst xrjPtYgVtueH7Y9SUQjOgQMHNMEsrvwHWaRMVcfHK6BL7TS5RMtpDV2mdAX3qlswLCBG MFluZMwfOwwnn7KWTBLilXGSfvhBZRcV8j/Suura6Z4/QADX+sXN5T1/PXrBiHok6Gz5 CkO0uaAs/qnv3ycKE8y8kZJ/QJPCURQukHqmlZl6uPSE+EaoQqW4XWEEeilZeX8TOjcM B9LA== X-Gm-Message-State: ABuFfogRkfB0ZXrauBMc+h0Kj+6G2TOAd7ZeCU7CV3KHlA+p1kycUV2s c5VkXInJd/L+Qp4AlK0rvbUonvdjCoY= X-Google-Smtp-Source: ACcGV63+XUqLvL//r2Uy+/V/2q5MlHW9t1WRF+H7vWP8lOjTg8I3k0lUZ+FOeCuIyl0lZcg/vOxmYg== X-Received: by 2002:adf:8347:: with SMTP id 65-v6mr49713823wrd.264.1540293810947; Tue, 23 Oct 2018 04:23:30 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Tue, 23 Oct 2018 13:23:13 +0200 Message-Id: <0480ec44dcd79afecf5903a1c0f5ac2092732d9a.1540293795.git.tgolembi@redhat.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.221.67 Subject: [Qemu-devel] [PATCH v5 04/14] qga-win: prevent crash when executing fsinfo command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Roth , Olga Krishtal , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Sameeh Jubran , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 From: Sameeh Jubran 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 mess= age: Reviewed-by: Philippe Mathieu-Daud=C3=A9 ------------------------------------------------ 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Michael Roth (cherry picked from commit ecb8293d90eafde5b0423ef90aacfeff718ed913) Signed-off-by: Michael Roth Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- 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 98d9735389..8289e7d6ea 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 =3D NULL; GuestPCIAddress *pci =3D NULL; char *name =3D g_strdup(&guid[4]); + pci =3D g_malloc0(sizeof(*pci)); + pci->domain =3D -1; + pci->slot =3D -1; + pci->function =3D -1; + pci->bus =3D -1; =20 if (!QueryDosDevice(name, dev_name, ARRAY_SIZE(dev_name))) { error_setg_win32(errp, GetLastError(), "failed to get dos device n= ame"); @@ -556,7 +561,6 @@ static GuestPCIAddress *get_pci_info(char *guid, Error = **errp) =20 func =3D addr & 0x0000FFFF; dev =3D (addr >> 16) & 0x0000FFFF; - pci =3D g_malloc0(sizeof(*pci)); pci->domain =3D dev; pci->slot =3D slot; pci->function =3D func; --=20 2.19.0