dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0107-usb-redir-Fix-crash-on-migration-with-no-client-conn.patch

cc240d
From 106a39c50211b7c7e96ffb47ad9deae5d9be6d84 Mon Sep 17 00:00:00 2001
cc240d
From: Hans de Goede <hdegoede@redhat.com>
cc240d
Date: Fri, 15 Mar 2013 11:52:37 +0100
cc240d
Subject: [PATCH] usb-redir: Fix crash on migration with no client connected
cc240d
cc240d
If no client is connected on the src side, then we won't receive a
cc240d
parser during migrate, in this case usbredir_post_load() should be a nop,
cc240d
rather then to try to derefefence the NULL dev->parser pointer.
cc240d
cc240d
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
cc240d
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
cc240d
(cherry picked from commit 3713e1485e6eace7d48b9c790602cfd92c616e5f)
cc240d
---
cc240d
 hw/usb/redirect.c | 4 ++++
cc240d
 1 file changed, 4 insertions(+)
cc240d
cc240d
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
cc240d
index 4d23b66..bf6aaf0 100644
cc240d
--- a/hw/usb/redirect.c
cc240d
+++ b/hw/usb/redirect.c
cc240d
@@ -2008,6 +2008,10 @@ static int usbredir_post_load(void *priv, int version_id)
cc240d
 {
cc240d
     USBRedirDevice *dev = priv;
cc240d
 
cc240d
+    if (dev->parser == NULL) {
cc240d
+        return 0;
cc240d
+    }
cc240d
+
cc240d
     switch (dev->device_info.speed) {
cc240d
     case usb_redir_speed_low:
cc240d
         dev->dev.speed = USB_SPEED_LOW;