From patchwork Tue Mar 9 13:15:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 47159 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFC4BB7D09 for ; Wed, 10 Mar 2010 00:21:20 +1100 (EST) Received: from localhost ([127.0.0.1]:32798 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NozJF-0006Eh-RG for incoming@patchwork.ozlabs.org; Tue, 09 Mar 2010 08:17:17 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NozHw-0006Ce-2F for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:15:56 -0500 Received: from [199.232.76.173] (port=46199 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NozHu-0006CA-2D for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:15:54 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NozHr-00005j-Go for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:15:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18955) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NozHr-00005d-54 for qemu-devel@nongnu.org; Tue, 09 Mar 2010 08:15:51 -0500 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.13.8/8.13.8) with ESMTP id o29DFmxg023534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Mar 2010 08:15:48 -0500 Received: from localhost (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o29DFjpP031582; Tue, 9 Mar 2010 08:15:46 -0500 From: Juan Quintela To: qemu-devel , amit.shah@redhat.com Date: Tue, 09 Mar 2010 14:15:45 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Subject: [Qemu-devel] virtio-serial NULL deference X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Hi Amit Checking migration, I just found this problem: I don't know what to put there. a return -EINVAL or continue? Looking more at the code, I am not sure what checks: a- that bus->max_nr_ports is the same in both sides (or at least bigger on migration destination) b- We sent the value of config.nr_ports, but ... we assign it back on destination, instead of checking that they are the same. c- port->id is taken from nr_ports again, and nothing checks that ports appear in the same order in source and destination. Throughts? Later, Juan. diff --cc configure index cab1941,83f8b26..0000000 --- a/configure +++ b/configure diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index d0e0219..7d2f0b9 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -429,6 +429,10 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id) id = qemu_get_be32(f); port = find_port_by_id(s, id); + if (port == NULL) { + return -EINVAL; + } + port->guest_connected = qemu_get_byte(f); }