qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Thomas Huth <thuth@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Something wrong in usb_try_create_simple()
Date: Wed, 27 Sep 2017 15:25:27 +0200	[thread overview]
Message-ID: <de7c8fda-7e93-b3fb-c1bf-ef7768e808e8@redhat.com> (raw)
In-Reply-To: <70a6ee09-f482-58f9-dded-2fa90bdab90e@redhat.com>

On 27/09/2017 13:38, Thomas Huth wrote:
>  Hi Gerd,
> 
> today, I've run into this issue reported by valgrind:
> 
> $ valgrind x86_64-softmmu/qemu-system-x86_64 -device usb-ehci -nographic -S
> ==2043== Memcheck, a memory error detector
> ==2043== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==2043== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info
> ==2043== Command: x86_64-softmmu/qemu-system-x86_64 -device usb-ehci -nographic -S
> ==2043== 
> QEMU 2.10.50 monitor - type 'help' for more information
> (qemu) device_add usb-tablet
> (qemu) device_add usb-tablet
> (qemu) device_add usb-tablet
> (qemu) device_add usb-tablet
> (qemu) device_add usb-tablet
> (qemu) device_add usb-tablet
> ==2043== Invalid read of size 8
> ==2043==    at 0x60EF50: object_unparent (object.c:445)

This object_unparent is not needed anymore.  See

    commit 69382d8b3e8600b349c191394d761dcb480502cf
    Author: Igor Mammedov <imammedo@redhat.com>
    Date:   Mon Jul 25 11:59:22 2016 +0200

    qdev: Fix object reference leak in case device.realize() fails

Paolo

> ==2043==    by 0x580F0D: usb_try_create_simple (bus.c:346)
> ==2043==    by 0x581BEB: usb_claim_port (bus.c:451)
> ==2043==    by 0x582310: usb_qdev_realize (bus.c:257)
> ==2043==    by 0x4CB399: device_set_realized (qdev.c:914)
> ==2043==    by 0x60E26D: property_set_bool (object.c:1886)
> ==2043==    by 0x61235E: object_property_set_qobject (qom-qobject.c:27)
> ==2043==    by 0x61000F: object_property_set_bool (object.c:1162)
> ==2043==    by 0x4567C3: qdev_device_add (qdev-monitor.c:630)
> ==2043==    by 0x456D52: qmp_device_add (qdev-monitor.c:807)
> ==2043==    by 0x470A99: hmp_device_add (hmp.c:1933)
> ==2043==    by 0x3679C3: handle_hmp_command (monitor.c:3123)
> ==2043==  Address 0x2100b430 is 32 bytes inside a block of size 6,448 free'd
> ==2043==    at 0x4C2ACDD: free (vg_replace_malloc.c:530)
> ==2043==    by 0xA04EBCD: g_free (in /usr/lib64/libglib-2.0.so.0.5000.3)
> ==2043==    by 0x60F735: object_finalize (object.c:471)
> ==2043==    by 0x60F735: object_unref (object.c:902)
> ==2043==    by 0x60E746: object_property_del_child.isra.7 (object.c:427)
> ==2043==    by 0x4CB2B2: device_set_realized (qdev.c:994)
> ==2043==    by 0x60E26D: property_set_bool (object.c:1886)
> ==2043==    by 0x61235E: object_property_set_qobject (qom-qobject.c:27)
> ==2043==    by 0x61000F: object_property_set_bool (object.c:1162)
> ==2043==    by 0x580EBB: usb_try_create_simple (bus.c:341)
> ==2043==    by 0x581BEB: usb_claim_port (bus.c:451)
> ==2043==    by 0x582310: usb_qdev_realize (bus.c:257)
> ==2043==    by 0x4CB399: device_set_realized (qdev.c:914)
> ==2043==  Block was alloc'd at
> ==2043==    at 0x4C29BE3: malloc (vg_replace_malloc.c:299)
> ==2043==    by 0xA04EABD: g_malloc (in /usr/lib64/libglib-2.0.so.0.5000.3)
> ==2043==    by 0x60EE0C: object_new_with_type (object.c:482)
> ==2043==    by 0x4CA080: qdev_try_create (qdev.c:152)
> ==2043==    by 0x580E7A: usb_try_create_simple (bus.c:336)
> ==2043==    by 0x581BEB: usb_claim_port (bus.c:451)
> ==2043==    by 0x582310: usb_qdev_realize (bus.c:257)
> ==2043==    by 0x4CB399: device_set_realized (qdev.c:914)
> ==2043==    by 0x60E26D: property_set_bool (object.c:1886)
> ==2043==    by 0x61235E: object_property_set_qobject (qom-qobject.c:27)
> ==2043==    by 0x61000F: object_property_set_bool (object.c:1162)
> ==2043==    by 0x4567C3: qdev_device_add (qdev-monitor.c:630)
> 
> Any idea what could be wrong here?
> 
>  Thomas
> 
> 

      reply	other threads:[~2017-09-27 13:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 11:38 [Qemu-devel] Something wrong in usb_try_create_simple() Thomas Huth
2017-09-27 13:25 ` Paolo Bonzini [this message]

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=de7c8fda-7e93-b3fb-c1bf-ef7768e808e8@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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).