From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umy6Y-00039J-2v for qemu-devel@nongnu.org; Wed, 12 Jun 2013 23:21:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Umy6V-0007hD-GO for qemu-devel@nongnu.org; Wed, 12 Jun 2013 23:21:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Umy6V-0007h5-9D for qemu-devel@nongnu.org; Wed, 12 Jun 2013 23:21:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5D3Lcn9007686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 12 Jun 2013 23:21:38 -0400 From: Fam Zheng Date: Thu, 13 Jun 2013 11:21:29 +0800 Message-Id: <1371093689-18228-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2] vmdk: refuse to open higher version than supported List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Jeffrey Cody , famz@redhat.com, stefanha@redhat.com Refuse to open higher version for safety. Although we try to be compatible with published VMDK spec, VMware has newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge what's changed in it. And it is very likely to have more new versions in the future, so it's not safe to open them blindly. Signed-off-by: Fam Zheng --- v2: Report error and return -ENOTSUP. --- block/vmdk.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/vmdk.c b/block/vmdk.c index 608daaf..9dda2f5 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -558,6 +558,15 @@ static int vmdk_open_vmdk4(BlockDriverState *bs, header = footer.header; } + if (le32_to_cpu(header.version) >= 3) { + char buf[64]; + snprintf(buf, sizeof(buf), "VMDK version %d", + le32_to_cpu(header.version)); + qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE, + bs->device_name, "vmdk", buf); + return -ENOTSUP; + } + l1_entry_sectors = le32_to_cpu(header.num_gtes_per_gte) * le64_to_cpu(header.granularity); if (l1_entry_sectors == 0) { -- 1.8.3