From patchwork Fri Mar 15 10:52:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 227954 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7A94E2C00B9 for ; Fri, 15 Mar 2013 21:49:40 +1100 (EST) Received: from localhost ([::1]:34256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGSCg-0000Fl-Gx for incoming@patchwork.ozlabs.org; Fri, 15 Mar 2013 06:49:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGSCR-0000FV-9B for qemu-devel@nongnu.org; Fri, 15 Mar 2013 06:49:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGSCQ-0000DV-9z for qemu-devel@nongnu.org; Fri, 15 Mar 2013 06:49:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGSCQ-0000DO-1y for qemu-devel@nongnu.org; Fri, 15 Mar 2013 06:49:22 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2FAnK5A030125 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Mar 2013 06:49:20 -0400 Received: from shalem.localdomain.com (vpn1-4-146.ams2.redhat.com [10.36.4.146]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2FAnILk017133; Fri, 15 Mar 2013 06:49:19 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Fri, 15 Mar 2013 11:52:37 +0100 Message-Id: <1363344757-11149-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Hans de Goede , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] usb-redir: Fix crash on migration with no client connected X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/usb/redirect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c index 9ba714d..06d22da 100644 --- a/hw/usb/redirect.c +++ b/hw/usb/redirect.c @@ -2005,6 +2005,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;