From patchwork Tue Mar 19 13:54:39 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: 229077 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 6B8022C0098 for ; Wed, 20 Mar 2013 00:52:05 +1100 (EST) Received: from localhost ([::1]:54650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHwxP-0004zZ-Mu for incoming@patchwork.ozlabs.org; Tue, 19 Mar 2013 09:52:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46680) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHwwn-0004mQ-Kw for qemu-devel@nongnu.org; Tue, 19 Mar 2013 09:51:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHwwj-00015B-2w for qemu-devel@nongnu.org; Tue, 19 Mar 2013 09:51:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHwwi-000151-RP for qemu-devel@nongnu.org; Tue, 19 Mar 2013 09:51:21 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2JDpKot032145 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 19 Mar 2013 09:51:20 -0400 Received: from shalem.localdomain.com (vpn1-7-199.ams2.redhat.com [10.36.7.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2JDpF4A010657; Tue, 19 Mar 2013 09:51:19 -0400 From: Hans de Goede To: Gerd Hoffmann Date: Tue, 19 Mar 2013 14:54:39 +0100 Message-Id: <1363701279-14291-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1363701279-14291-1-git-send-email-hdegoede@redhat.com> References: <1363701279-14291-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 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 2/2] 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 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;