From patchwork Thu Feb 3 07:41:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 81625 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 90B2DB7110 for ; Thu, 3 Feb 2011 18:44:45 +1100 (EST) Received: from localhost ([127.0.0.1]:39366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pktru-0002ki-Hv for incoming@patchwork.ozlabs.org; Thu, 03 Feb 2011 02:44:42 -0500 Received: from [140.186.70.92] (port=38496 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pktp7-000208-NA for qemu-devel@nongnu.org; Thu, 03 Feb 2011 02:41:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pktp6-0001FK-N7 for qemu-devel@nongnu.org; Thu, 03 Feb 2011 02:41:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pktp6-0001ER-GJ for qemu-devel@nongnu.org; Thu, 03 Feb 2011 02:41:48 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p137fkYS001836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 Feb 2011 02:41:46 -0500 Received: from localhost (ovpn-113-79.phx2.redhat.com [10.3.113.79]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p137fg02003501; Thu, 3 Feb 2011 02:41:44 -0500 From: Amit Shah To: qemu list Date: Thu, 3 Feb 2011 13:11:37 +0530 Message-Id: <93a4de53f23e3b09ff5a77f59384d5ca61c9fdf1.1296718895.git.amit.shah@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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 master/0.14] 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); }