From nobody Wed Nov 5 18:23:03 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 1536320671544925.5353933946395; Fri, 7 Sep 2018 04:44:31 -0700 (PDT) Received: from localhost ([::1]:38017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyFBX-0002ya-U3 for importer@patchew.org; Fri, 07 Sep 2018 07:44:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36673) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fyF9c-0000tU-Q5 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fyF9Y-000488-Pn for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:24 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:55717) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fyF9Y-000434-37 for qemu-devel@nongnu.org; Fri, 07 Sep 2018 07:42:20 -0400 Received: by mail-wm0-f42.google.com with SMTP id f21-v6so14428247wmc.5 for ; Fri, 07 Sep 2018 04:42:17 -0700 (PDT) Received: from fiorina.redhat.com (ip-94-112-73-67.net.upcbroadband.cz. [94.112.73.67]) by smtp.gmail.com with ESMTPSA id z184-v6sm25239813wmz.0.2018.09.07.04.42.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 04:42:15 -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=xnR0KRPA31IE8XMw4s1tThS9XN1dRAldDuDCWtG3v4E=; b=ED6Hr5S9GPDaplQuIVuqjKaXyYnvBrM/Gz2tjgnDCyJdloHR7Yx79Gs5tg/Q8Qup8q iEyUO9ZQuUJvCQCciNDbNz3hD+F3PlFfg7l4MYCZ8Jr/u5DdaO/6xn5PZqHMT+b5OVvd e8XgS0WF9BCyfCQ5mtDnr3XkYUjL2HpsF/av/3i4RlF5DrPg9q6KXb8fryMla/q6X/BM kRDoG9BOY3ELUGl695WYZ/I+v39U4TYIGl2rhhUb1zwBPMdRAfOmRbvofRuEYUD3pBnf 8Y4kvnV4AVJdSx6kqOidGgJmMRHRqrjR/23jovSk729UsLkEV6DZKhINffTqPh7sd97Z OspQ== X-Gm-Message-State: APzg51A//V2RHzkhp5FFhpH7MKnetoKNFYePhMI+Gp/9/gV+fqWRe9rP GjagOdLJeXJLVJv8wRRynJmCZokAp1I= X-Google-Smtp-Source: ANB0VdZZe04ptKH1aOb5HBzquZ+vCIme33I/LM/gdDpsQhTXeXaJz5IQK94Tt81vA3w9h8R841VxTg== X-Received: by 2002:a1c:c14:: with SMTP id 20-v6mr5391217wmm.117.1536320536281; Fri, 07 Sep 2018 04:42:16 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Fri, 7 Sep 2018 13:42:09 +0200 Message-Id: X-Mailer: git-send-email 2.18.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: 74.125.82.42 Subject: [Qemu-devel] [PATCH v3 1/5] qga: win32: fix crashes when PCI info cannot be retrived 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: Olga Krishtal , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Michael Roth , =?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 The guest-get-fsinfo command collects also information about PCI controller where the disk is attached. When this fails for some reasons it tries to return just the partial information. However in certain cases the pointer to the structure was not initialized and was set to NULL. This breaks the serializer and leads to a crash of the guest agent. Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- qga/commands-win32.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 98d9735389..9c959122d9 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -633,15 +633,32 @@ static GuestDiskAddressList *build_guest_disk_info(ch= ar *guid, Error **errp) * https://technet.microsoft.com/en-us/library/ee851589(v=3Dws.10)= .aspx */ if (DeviceIoControl(vol_h, IOCTL_SCSI_GET_ADDRESS, NULL, 0, scsi_a= d, sizeof(SCSI_ADDRESS), &len, NULL)) { + Error *local_err =3D NULL; disk->unit =3D addr.Lun; disk->target =3D addr.TargetId; disk->bus =3D addr.PathId; - disk->pci_controller =3D get_pci_info(name, errp); + g_debug("unit=3D%lld target=3D%lld bus=3D%lld", + disk->unit, disk->target, disk->bus); + disk->pci_controller =3D get_pci_info(name, &local_err); + + if (local_err) { + g_debug("failed to get PCI controller info: %s", + error_get_pretty(local_err)); + error_free(local_err); + } else if (disk->pci_controller !=3D NULL) { + g_debug("pci: domain=3D%lld bus=3D%lld slot=3D%lld functio= n=3D%lld", + disk->pci_controller->domain, + disk->pci_controller->bus, + disk->pci_controller->slot, + disk->pci_controller->function); + } } - /* We do not set error in this case, because we still have enough - * information about volume. */ - } else { - disk->pci_controller =3D NULL; + } + /* We do not set error in case pci_controller is NULL, because we still + * have enough information about volume. */ + if (disk->pci_controller =3D=3D NULL) { + g_debug("no PCI controller info"); + disk->pci_controller =3D g_malloc0(sizeof(GuestPCIAddress)); } =20 list =3D g_malloc0(sizeof(*list)); --=20 2.18.0