From patchwork Thu Oct 5 09:04:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 821657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y76Pv3h1Bz9t2x for ; Thu, 5 Oct 2017 20:08:35 +1100 (AEDT) Received: from localhost ([::1]:38528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e028v-00013a-Jf for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 05:08:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e025P-0007Kv-23 for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:05:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e025J-00048V-21 for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52666) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e025I-00047d-PT for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D63E072FFB for ; Thu, 5 Oct 2017 09:04:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D63E072FFB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E2165FCCB; Thu, 5 Oct 2017 09:04:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1C5ED4057A; Thu, 5 Oct 2017 11:04:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 11:04:40 +0200 Message-Id: <20171005090443.26889-2-kraxel@redhat.com> In-Reply-To: <20171005090443.26889-1-kraxel@redhat.com> References: <20171005090443.26889-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 05 Oct 2017 09:04:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] hw/usb/bus: Remove bad object_unparent() from usb_try_create_simple() 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: Thomas Huth , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Valgrind detects an invalid read operation when hot-plugging of an USB device fails: $ valgrind x86_64-softmmu/qemu-system-x86_64 -device usb-ehci -nographic -S ==30598== Memcheck, a memory error detector ==30598== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==30598== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info ==30598== Command: x86_64-softmmu/qemu-system-x86_64 -device usb-ehci -nographic -S ==30598== 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 ==30598== Invalid read of size 8 ==30598== at 0x60EF50: object_unparent (object.c:445) ==30598== by 0x580F0D: usb_try_create_simple (bus.c:346) ==30598== by 0x581BEB: usb_claim_port (bus.c:451) ==30598== by 0x582310: usb_qdev_realize (bus.c:257) ==30598== by 0x4CB399: device_set_realized (qdev.c:914) ==30598== by 0x60E26D: property_set_bool (object.c:1886) ==30598== by 0x61235E: object_property_set_qobject (qom-qobject.c:27) ==30598== by 0x61000F: object_property_set_bool (object.c:1162) ==30598== by 0x4567C3: qdev_device_add (qdev-monitor.c:630) ==30598== by 0x456D52: qmp_device_add (qdev-monitor.c:807) ==30598== by 0x470A99: hmp_device_add (hmp.c:1933) ==30598== by 0x3679C3: handle_hmp_command (monitor.c:3123) The object_unparent() here is not necessary anymore since commit 69382d8b3e8600b3 ("qdev: Fix object reference leak in case device.realize() fails"), so let's remove it now. Suggested-by: Paolo Bonzini Signed-off-by: Thomas Huth Message-id: 1506526106-30971-1-git-send-email-thuth@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index d910f849e7..e56dc3348a 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -341,9 +341,7 @@ static USBDevice *usb_try_create_simple(USBBus *bus, const char *name, object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err) { error_propagate(errp, err); - error_prepend(errp, "Failed to initialize USB device '%s': ", - name); - object_unparent(OBJECT(dev)); + error_prepend(errp, "Failed to initialize USB device '%s': ", name); return NULL; } return dev; From patchwork Thu Oct 5 09:04:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 821658 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y76QL1v8Wz9t2x for ; Thu, 5 Oct 2017 20:08:58 +1100 (AEDT) Received: from localhost ([::1]:38529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e029I-0001JA-8r for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 05:08:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e025S-0007Nz-Pp for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e025J-00048b-4M for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60998) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e025I-00047M-Ux for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 86CCB7E427; Thu, 5 Oct 2017 09:04:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 86CCB7E427 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id B991D600C0; Thu, 5 Oct 2017 09:04:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2369A4057E; Thu, 5 Oct 2017 11:04:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 11:04:41 +0200 Message-Id: <20171005090443.26889-3-kraxel@redhat.com> In-Reply-To: <20171005090443.26889-1-kraxel@redhat.com> References: <20171005090443.26889-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 05 Oct 2017 09:04:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] usb: fix libusb config variable name. 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: Jan Kiszka , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Cc: Jan Kiszka Fixes: 4e5ee5b21c84fe3023a64b5cc2e12a52ab0597c1 Signed-off-by: Gerd Hoffmann Tested-by: Jan Kiszka Message-id: 20170926063820.30773-1-kraxel@redhat.com --- hw/usb/Makefile.objs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 9255234c63..0e6d54b21f 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -42,7 +42,7 @@ redirect.o-cflags = $(USB_REDIR_CFLAGS) redirect.o-libs = $(USB_REDIR_LIBS) # usb pass-through -ifeq ($(CONFIG_LIBUSB)$(CONFIG_USB),yy) +ifeq ($(CONFIG_USB_LIBUSB)$(CONFIG_USB),yy) common-obj-y += host-libusb.o host-legacy.o else common-obj-y += host-stub.o From patchwork Thu Oct 5 09:04:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 821654 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y76Mz6fzMz9t44 for ; Thu, 5 Oct 2017 20:06:54 +1100 (AEDT) Received: from localhost ([::1]:38519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e027J-0008KT-0i for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 05:06:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e025N-0007K9-Hu for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e025L-0004A7-2P for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37658) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e025K-00049R-SF for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F098C883C3 for ; Thu, 5 Oct 2017 09:04:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com F098C883C3 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB1B017981; Thu, 5 Oct 2017 09:04:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2A5623F116; Thu, 5 Oct 2017 11:04:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 11:04:42 +0200 Message-Id: <20171005090443.26889-4-kraxel@redhat.com> In-Reply-To: <20171005090443.26889-1-kraxel@redhat.com> References: <20171005090443.26889-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 05 Oct 2017 09:04:50 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] usb: Use angle brackets for cacard include directive 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: Fam Zheng , Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Fam Zheng This is a library header, so angle brackets are more appropriate; also move the line to before QEMU headers, as is recommended in HACKING. Signed-off-by: Fam Zheng Message-id: 20170920085952.3872-1-famz@redhat.com Signed-off-by: Gerd Hoffmann --- hw/usb/ccid-card-passthru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/ccid-card-passthru.c b/hw/usb/ccid-card-passthru.c index 45d96b03c6..117711862e 100644 --- a/hw/usb/ccid-card-passthru.c +++ b/hw/usb/ccid-card-passthru.c @@ -9,11 +9,11 @@ */ #include "qemu/osdep.h" +#include #include "chardev/char-fe.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "ccid.h" -#include "cacard/vscard_common.h" #define DPRINTF(card, lvl, fmt, ...) \ do { \ From patchwork Thu Oct 5 09:04:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 821655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y76NQ5CsXz9ryk for ; Thu, 5 Oct 2017 20:07:18 +1100 (AEDT) Received: from localhost ([::1]:38522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e027g-00009a-RA for incoming@patchwork.ozlabs.org; Thu, 05 Oct 2017 05:07:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52983) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e025N-0007KC-IR for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e025I-00047z-Kt for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52600) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e025I-00046t-FK for qemu-devel@nongnu.org; Thu, 05 Oct 2017 05:04:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFF394E34A for ; Thu, 5 Oct 2017 09:04:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DFF394E34A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=kraxel@redhat.com Received: from sirius.home.kraxel.org (ovpn-116-239.ams2.redhat.com [10.36.116.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCC3D600C8; Thu, 5 Oct 2017 09:04:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 314634057F; Thu, 5 Oct 2017 11:04:43 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 5 Oct 2017 11:04:43 +0200 Message-Id: <20171005090443.26889-5-kraxel@redhat.com> In-Reply-To: <20171005090443.26889-1-kraxel@redhat.com> References: <20171005090443.26889-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 05 Oct 2017 09:04:47 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] usb: fix host-stub.c build race 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: Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Suggested-by: Thomas Huth Signed-off-by: Gerd Hoffmann Reviewed-by: Thomas Huth Message-id: 20171004125210.7817-1-kraxel@redhat.com --- hw/usb/Makefile.objs | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs index 0e6d54b21f..bdfead6701 100644 --- a/hw/usb/Makefile.objs +++ b/hw/usb/Makefile.objs @@ -47,6 +47,7 @@ common-obj-y += host-libusb.o host-legacy.o else common-obj-y += host-stub.o endif +common-obj-$(CONFIG_ALL) += host-stub.o host-libusb.o-cflags := $(LIBUSB_CFLAGS) host-libusb.o-libs := $(LIBUSB_LIBS)