From patchwork Mon Feb 21 09:03:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 83803 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 C4A3FB70A4 for ; Mon, 21 Feb 2011 20:33:43 +1100 (EST) Received: from localhost ([127.0.0.1]:49909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrS9E-0005Zu-Fz for incoming@patchwork.ozlabs.org; Mon, 21 Feb 2011 04:33:40 -0500 Received: from [140.186.70.92] (port=34532 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrRg6-0002kV-UB for qemu-devel@nongnu.org; Mon, 21 Feb 2011 04:03:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrRg6-0003xP-4l for qemu-devel@nongnu.org; Mon, 21 Feb 2011 04:03:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrRg5-0003xD-SP for qemu-devel@nongnu.org; Mon, 21 Feb 2011 04:03:34 -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.14.4/8.14.4) with ESMTP id p1L93W9M024988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 21 Feb 2011 04:03:32 -0500 Received: from localhost (ovpn-113-38.phx2.redhat.com [10.3.113.38]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1L93UxC003169; Mon, 21 Feb 2011 04:03:31 -0500 From: Amit Shah To: qemu list Date: Mon, 21 Feb 2011 14:33:16 +0530 Message-Id: <09f49f10778aaf20522aef8ddf92cdd54f7d36e0.1298278891.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Amit Shah Subject: [Qemu-devel] [PATCH RESEND 2/3] virtio-serial: Disallow generic ports at id 0 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 It was found libvirt was using port 0 for generic ports. It has been fixed in libvirt commit 8e28c5d40200b4c5d483bd585d237b9d870372e5. Port 0 is reserved for virtconsole devices for backward compatibility with the old -virtioconsole (from qemu 0.12) device type. Ensure we don't allow instantiating a port at id 0 as well. Signed-off-by: Amit Shah --- hw/virtio-console.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 62624ec..3560db3 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -11,6 +11,7 @@ */ #include "qemu-char.h" +#include "qemu-error.h" #include "virtio-serial.h" typedef struct VirtConsole { @@ -118,6 +119,14 @@ static int virtserialport_initfn(VirtIOSerialDevice *dev) VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, &dev->qdev); VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); + if (port->id == 0) { + /* + * Disallow a generic port at id 0, that's reserved for + * console ports. + */ + error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); + return -1; + } return generic_port_init(vcon, dev); }