From patchwork Tue Feb 23 07:19:58 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: 81410 X-Patchwork-Delegate: ericvh@gmail.com Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1N7KTrs010029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 23 Feb 2010 07:21:05 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Njp4C-0000fP-RV; Tue, 23 Feb 2010 07:20:24 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Njp4B-0000fH-RQ for v9fs-developer@lists.sourceforge.net; Tue, 23 Feb 2010 07:20:23 +0000 X-ACL-Warn: Received: from e28smtp02.in.ibm.com ([122.248.162.2]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Njp49-0005HN-4Y for v9fs-developer@lists.sourceforge.net; Tue, 23 Feb 2010 07:20:23 +0000 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp02.in.ibm.com (8.14.3/8.13.1) with ESMTP id o1N7K1ap001958 for ; Tue, 23 Feb 2010 12:50:01 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o1N7K1E32580480 for ; Tue, 23 Feb 2010 12:50:01 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o1N7K09m006074 for ; Tue, 23 Feb 2010 18:20:01 +1100 Received: from localhost.localdomain (N20wks267635wss.in.ibm.com [9.124.31.147]) by d28av05.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVin) with ESMTP id o1N7K0Fq006069; Tue, 23 Feb 2010 18:20:00 +1100 From: "Aneesh Kumar K.V" To: v9fs-developer@lists.sourceforge.net Date: Tue, 23 Feb 2010 12:49:58 +0530 Message-Id: <1266909598-15585-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.0.83.g241b9 X-Spam-Score: -0.9 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.9 AWL AWL: From: address is in the auto white-list X-Headers-End: 1Njp49-0005HN-4Y Subject: [V9fs-developer] [PATCH] net/9p: Prevent crash when booting on older qemu X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 23 Feb 2010 07:21:05 +0000 (UTC) diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h index e7fb078..5cf1176 100644 --- a/include/linux/virtio_9p.h +++ b/include/linux/virtio_9p.h @@ -5,6 +5,11 @@ #include #include +/* The feature bitmap for virtio 9P */ + +/* The mount point is specified in a config variable */ +#define VIRTIO_9P_MOUNT_TAG 0 + struct virtio_9p_config { /* length of the tag name */ __u16 tag_len; diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index a04a7e4..026775a 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -256,8 +256,14 @@ static int p9_virtio_probe(struct virtio_device *vdev) sg_init_table(chan->sg, VIRTQUEUE_NUM); chan->inuse = false; - vdev->config->get(vdev, offsetof(struct virtio_9p_config, tag_len), - &tag_len, sizeof(tag_len)); + if (virtio_has_feature(vdev, VIRTIO_9P_MOUNT_TAG)) { + vdev->config->get(vdev, + offsetof(struct virtio_9p_config, tag_len), + &tag_len, sizeof(tag_len)); + } else { + err = -EINVAL; + goto out_free_vq; + } tag = kmalloc(tag_len, GFP_KERNEL); if (!tag) { err = -ENOMEM; @@ -352,13 +358,19 @@ static struct virtio_device_id id_table[] = { { 0 }, }; +static unsigned int features[] = { + VIRTIO_9P_MOUNT_TAG, +}; + /* The standard "struct lguest_driver": */ static struct virtio_driver p9_virtio_drv = { - .driver.name = KBUILD_MODNAME, - .driver.owner = THIS_MODULE, - .id_table = id_table, - .probe = p9_virtio_probe, - .remove = p9_virtio_remove, + .feature_table = features, + .feature_table_size = ARRAY_SIZE(features), + .driver.name = KBUILD_MODNAME, + .driver.owner = THIS_MODULE, + .id_table = id_table, + .probe = p9_virtio_probe, + .remove = p9_virtio_remove, }; static struct p9_trans_module p9_virtio_trans = {