Patchwork [2/2] usb-redir: Fix crash on migration with no client connected

login
register
mail settings
Submitter Hans de Goede
Date March 19, 2013, 1:54 p.m.
Message ID <1363701279-14291-3-git-send-email-hdegoede@redhat.com>
Download mbox | patch
Permalink /patch/229077/
State New
Headers show

Comments

Hans de Goede - March 19, 2013, 1:54 p.m.
If no client is connected on the src side, then we won't receive a
parser during migrate, in this case usbredir_post_load() should be a nop,
rather then to try to derefefence the NULL dev->parser pointer.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 hw/usb/redirect.c | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 0b2a5e6..e0df74b 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -2006,6 +2006,10 @@  static int usbredir_post_load(void *priv, int version_id)
 {
     USBRedirDevice *dev = priv;
 
+    if (dev->parser == NULL) {
+        return 0;
+    }
+
     switch (dev->device_info.speed) {
     case usb_redir_speed_low:
         dev->dev.speed = USB_SPEED_LOW;