[v2] vmdk: refuse to open higher version than supported

Submitted by Fam Zheng on June 13, 2013, 3:21 a.m.

Details

Message ID 1371093689-18228-1-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng June 13, 2013, 3:21 a.m.
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 <famz@redhat.com>

---

v2: Report error and return -ENOTSUP.

---
 block/vmdk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Stefan Hajnoczi June 13, 2013, 8:38 a.m.
On Thu, Jun 13, 2013 at 11:21:29AM +0800, Fam Zheng wrote:
> 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 <famz@redhat.com>
> 
> ---
> 
> v2: Report error and return -ENOTSUP.
> 
> ---
>  block/vmdk.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Fam Zheng June 24, 2013, 6:19 a.m.
On Thu, 06/13 10:38, Stefan Hajnoczi wrote:
> On Thu, Jun 13, 2013 at 11:21:29AM +0800, Fam Zheng wrote:
> > 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 <famz@redhat.com>
> > 
> > ---
> > 
> > v2: Report error and return -ENOTSUP.
> > 
> > ---
> >  block/vmdk.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> 
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Is this OK to be applied? Thanks.
Stefan Hajnoczi June 24, 2013, 9:18 a.m.
On Thu, Jun 13, 2013 at 11:21:29AM +0800, Fam Zheng wrote:
> 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 <famz@redhat.com>
> 
> ---
> 
> v2: Report error and return -ENOTSUP.
> 
> ---
>  block/vmdk.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Patch hide | download patch | download mbox

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) {