cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
Blob Blame History Raw
From aca95f3fddc84f304d9da49e79bf4715243f0fa3 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 6 Jun 2017 15:23:03 +0200
Subject: [PATCH 15/17] usb: don't wakeup during coldplug

RH-Author: Gerd Hoffmann <kraxel@redhat.com>
Message-id: <20170606152303.28066-2-kraxel@redhat.com>
Patchwork-id: 75503
O-Subject: [RHEL-7.4 qemu-kvm-rhev PATCH 1/1] usb: don't wakeup during coldplug
Bugzilla: 1452512
RH-Acked-by: Marcel Apfelbaum <marcel@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1452512
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20170523084635.20062-1-kraxel@redhat.com
(cherry picked from commit 26022652c6fd067b9fa09280f5a6d6284a21c73f)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/usb/core.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/usb/core.c b/hw/usb/core.c
index 45fa00c..241ae66 100644
--- a/hw/usb/core.c
+++ b/hw/usb/core.c
@@ -98,6 +98,14 @@ void usb_wakeup(USBEndpoint *ep, unsigned int stream)
     USBDevice *dev = ep->dev;
     USBBus *bus = usb_bus_from_device(dev);
 
+    if (!qdev_hotplug) {
+        /*
+         * This is machine init cold plug.  No need to wakeup anyone,
+         * all devices will be reset anyway.  And trying to wakeup can
+         * cause problems due to hitting uninitialized devices.
+         */
+        return;
+    }
     if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) {
         dev->port->ops->wakeup(dev->port);
     }
-- 
1.8.3.1