From nobody Wed Nov 5 10:37:12 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 15336392427244.447290459596729; Tue, 7 Aug 2018 03:54:02 -0700 (PDT) Received: from localhost ([::1]:38345 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmzcn-0003NF-N3 for importer@patchew.org; Tue, 07 Aug 2018 06:54:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmzYQ-0008AQ-He for qemu-devel@nongnu.org; Tue, 07 Aug 2018 06:49:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmzYL-00035Z-LD for qemu-devel@nongnu.org; Tue, 07 Aug 2018 06:49:30 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34837) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmzYL-00035D-ED for qemu-devel@nongnu.org; Tue, 07 Aug 2018 06:49:25 -0400 Received: by mail-wr1-f67.google.com with SMTP id g1-v6so11831412wru.2 for ; Tue, 07 Aug 2018 03:49:25 -0700 (PDT) Received: from fiorina.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id i125-v6sm2308141wmd.23.2018.08.07.03.49.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Aug 2018 03:49:23 -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=X5LepDNieYkbdKjEhwiYO8WZOnC/U4KooY5hzpI0S2k=; b=ZBnRT/QlgAJfpFuldftiQKudm57JsSHIEP86VSIKU8nNsRN9cDTx7jbrWiyaVUjI23 Wb1uTGsq/5arROOReHILe/W7loCHqjmtIqH5DZfNhORk0sgTHmxAhlxvjHfu42DiyCqD BGKGOQN0jxbDXkcnEw6zu+1r2GYgIyUolgzQrGau6xWhzwwpUkKClGgYWeEtbgV7Ptd7 SIoPgun+xvmoKTQDxpMoW0dj9GnQqLHiVQLDB1KUSpQACTmlxZ1P53giS9MuhEAajW9R gu0Sx8dqBh+veS0aRA3oSTyNeIhR708AbBgxQXNzWC+np+6unCeY+PvVBhl2KWm2nWsE Zvkg== X-Gm-Message-State: AOUpUlGc8aG5lyLfSn+/LrbEC25TNHBLQQPTVLjKZ7DD7BJdHgrxWgCL qw37j3jRDrpWdbBhMNaw3AZjHIf83rw= X-Google-Smtp-Source: AAOMgpcx9kah8Ax66jAzmYbdFZZeViToNTLOCREwnlr5stMRLfgD39T43Eln4J+y35ejConN7WM+mg== X-Received: by 2002:adf:dc8e:: with SMTP id r14-v6mr12283262wrj.166.1533638964201; Tue, 07 Aug 2018 03:49:24 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: qemu-devel@nongnu.org Date: Tue, 7 Aug 2018 12:49:17 +0200 Message-Id: <951d1c8265e9ef6b36d61358fd01f267a9b83ca7.1533638952.git.tgolembi@redhat.com> 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: 209.85.221.67 Subject: [Qemu-devel] [PATCH 3/4] 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , Michael Roth 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 lead to crasehs 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 36d76c22c0..995f62c2e4 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -642,15 +642,32 @@ static GuestDiskAddressList *build_guest_disk_info(ch= ar *guid, Error **errp) g_debug("getting pci-controller info"); 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) { + slog("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