From: "Tomáš Golembiovský" <tgolembi@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
"Blake, Eric" <eblake@redhat.com>,
sjubran@redhat.com, okrishtal@virtuozzo.com,
Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH v4 01/11] qga-win: fix crashes when PCI info cannot be retrived
Date: Tue, 9 Oct 2018 13:07:23 +0200 [thread overview]
Message-ID: <20181009130723.76f3c6f2@fiorina> (raw)
In-Reply-To: <CAMxuvay-g7rokzGhjZqk0mrithEAHD-g2pBTHrAouuEXzgt6rQ@mail.gmail.com>
On Thu, 4 Oct 2018 17:21:32 +0400
Marc-André Lureau <marcandre.lureau@redhat.com> wrote:
> Hi
> On Thu, Oct 4, 2018 at 3:22 PM Tomáš Golembiovský <tgolembi@redhat.com> wrote:
> >
> > 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áš Golembiovský <tgolembi@redhat.com>
> > ---
> > 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(char *guid, Error **errp)
> > * https://technet.microsoft.com/en-us/library/ee851589(v=ws.10).aspx */
> > if (DeviceIoControl(vol_h, IOCTL_SCSI_GET_ADDRESS, NULL, 0, scsi_ad,
> > sizeof(SCSI_ADDRESS), &len, NULL)) {
> > + Error *local_err = NULL;
> > disk->unit = addr.Lun;
> > disk->target = addr.TargetId;
> > disk->bus = addr.PathId;
> > - disk->pci_controller = get_pci_info(name, errp);
> > + g_debug("unit=%lld target=%lld bus=%lld",
> > + disk->unit, disk->target, disk->bus);
> > + disk->pci_controller = 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 != NULL) {
> > + g_debug("pci: domain=%lld bus=%lld slot=%lld function=%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 = NULL;
> > + }
> > + /* We do not set error in case pci_controller is NULL, because we still
> > + * have enough information about volume. */
> > + if (disk->pci_controller == NULL) {
> > + g_debug("no PCI controller info");
> > + disk->pci_controller = g_malloc0(sizeof(GuestPCIAddress));
> > }
>
> Shouldn't pci-controller be made optional in the schema instead?
It should, but that requires API change.
Eric suggested that previously too:
https://lists.gnu.org/archive/html/qemu-devel/2018-06/msg08599.html
I will do that in next version.
Tomas
>
> >
> > list = g_malloc0(sizeof(*list));
> > --
> > 2.19.0
> >
--
Tomáš Golembiovský <tgolembi@redhat.com>
next prev parent reply other threads:[~2018-10-10 8:29 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 11:22 [Qemu-devel] [PATCH v4 00/11] qga: report serial number and disk node Tomáš Golembiovský
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 01/11] qga-win: fix crashes when PCI info cannot be retrived Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-09 11:07 ` Tomáš Golembiovský [this message]
2018-10-10 23:35 ` Michael Roth
2018-10-11 1:04 ` Eric Blake
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 02/11] qga-win: handle NULL values Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-10 23:08 ` Michael Roth
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 03/11] build: rename CONFIG_QGA_NTDDDISK to CONFIG_QGA_NTDDSCSI Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-07 9:29 ` Sameeh Jubran
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 04/11] qga-win: add debugging information Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 05/11] qga-win: refactor disk properties (bus) Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 06/11] configure: add test for libudev Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 07/11] qga: report disk serial number Tomáš Golembiovský
2018-10-04 13:21 ` Marc-André Lureau
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 08/11] qga-win: refactor disk info Tomáš Golembiovský
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 09/11] qga-win: handle multi-disk volumes Tomáš Golembiovský
2018-10-07 12:13 ` Sameeh Jubran
2018-10-10 14:57 ` Tomáš Golembiovský
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 10/11] qga: return disk device in guest-get-fsinfo Tomáš Golembiovský
2018-10-04 13:20 ` Marc-André Lureau
2018-10-04 11:22 ` [Qemu-devel] [PATCH v4 11/11] qga-win: demystify namespace striping Tomáš Golembiovský
2018-10-04 13:20 ` Marc-André Lureau
2018-10-07 11:03 ` Sameeh Jubran
2018-10-09 12:38 ` Tomáš Golembiovský
2018-10-10 17:19 ` Eric Blake
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=20181009130723.76f3c6f2@fiorina \
--to=tgolembi@redhat.com \
--cc=eblake@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=okrishtal@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
--cc=sjubran@redhat.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).