From patchwork Thu Mar 25 16:43:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 48584 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 0221AB7CE7 for ; Fri, 26 Mar 2010 05:37:03 +1100 (EST) Received: from localhost ([127.0.0.1]:59534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NurvP-0004rA-Be for incoming@patchwork.ozlabs.org; Thu, 25 Mar 2010 14:36:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NuqBS-0007UQ-Ow for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:45:26 -0400 Received: from [140.186.70.92] (port=50905 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NuqB8-0007L7-8a for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:45:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NuqAx-0005HX-Sp for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:45:06 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:45346) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NuqAx-0005HB-BC for qemu-devel@nongnu.org; Thu, 25 Mar 2010 12:44:55 -0400 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [202.81.31.245]) by e23smtp08.au.ibm.com (8.14.3/8.13.1) with ESMTP id o2PGisiB004618 for ; Fri, 26 Mar 2010 03:44:54 +1100 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2PGisAf847980 for ; Fri, 26 Mar 2010 03:44:54 +1100 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2PGirAI031915 for ; Fri, 26 Mar 2010 03:44:53 +1100 Received: from localhost.localdomain ([9.77.125.24]) by d23av03.au.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o2PGhgP7030935; Fri, 26 Mar 2010 03:44:51 +1100 From: "Aneesh Kumar K.V" To: qemu-devel@nongnu.org Date: Thu, 25 Mar 2010 22:13:40 +0530 Message-Id: <1269535420-31206-33-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.2.323.g0d092 In-Reply-To: <1269535420-31206-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1269535420-31206-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: ericvh@gmail.com, "M. Mohan Kumar" , aliguori@us.ibm.com, Sripathi Kodi , "Aneesh Kumar K.V" Subject: [Qemu-devel] [PATCH -V3 32/32] virtio-9p: Handle unknown 9P protocol versions as per the standards. 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 From: Sripathi Kodi Currently the code does BUG_ON if it receives any version other than 9P2000.u. However, 9P protocol says: If the server does not understand the client's version string, it should respond with an Rversion message (not Rerror) with the version string the 7 characters "unknown". Signed-off-by: Sripathi Kodi Signed-off-by: M. Mohan Kumar Signed-off-by: Aneesh Kumar K.V --- hw/virtio-9p.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/virtio-9p.c b/hw/virtio-9p.c index 1b791ca..e6ddb3a 100644 --- a/hw/virtio-9p.c +++ b/hw/virtio-9p.c @@ -725,7 +725,10 @@ static void v9fs_version(V9fsState *s, V9fsPDU *pdu) size_t offset = 7; pdu_unmarshal(pdu, offset, "ds", &msize, &version); - BUG_ON(strcmp(version.data, "9P2000.u") != 0); + + if (strcmp(version.data, "9P2000.u")) { + v9fs_string_sprintf(&version, "unknown"); + } offset += pdu_marshal(pdu, offset, "ds", msize, &version); complete_pdu(s, pdu, offset);