|
|
9ae3a8 |
From 7322fbc37925671b3ac9e589ba8eb200b7aee7f3 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
Message-Id: <7322fbc37925671b3ac9e589ba8eb200b7aee7f3.1418766606.git.jen@redhat.com>
|
|
|
9ae3a8 |
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
|
|
|
9ae3a8 |
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
|
|
|
9ae3a8 |
From: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 4 Dec 2014 00:04:57 -0600
|
|
|
9ae3a8 |
Subject: [CHANGE 03/31] vmdk: Check VMFS extent line field number
|
|
|
9ae3a8 |
To: rhvirt-patches@redhat.com,
|
|
|
9ae3a8 |
jen@redhat.com
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1417651524-18041-4-git-send-email-famz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 62676
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 03/30] vmdk: Check VMFS extent line field number
|
|
|
9ae3a8 |
Bugzilla: 1134237
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
VMFS extent line in description file should be with 4 fields:
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RW <size> VMFS "file-name.vmdk"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Check the number explicitly and report error if offset is appended as
|
|
|
9ae3a8 |
FLAT, which should be invalid format.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b47053bd0359c68094d7a25a65687c0844771e34)
|
|
|
9ae3a8 |
Signed-off-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/vmdk.c | 9 +++++++--
|
|
|
9ae3a8 |
tests/qemu-iotests/059 | 14 ++++++++++++++
|
|
|
9ae3a8 |
tests/qemu-iotests/059.out | 5 +++++
|
|
|
9ae3a8 |
3 files changed, 26 insertions(+), 2 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/vmdk.c b/block/vmdk.c
|
|
|
9ae3a8 |
index a5b1f1c..d77eb37 100644
|
|
|
9ae3a8 |
--- a/block/vmdk.c
|
|
|
9ae3a8 |
+++ b/block/vmdk.c
|
|
|
9ae3a8 |
@@ -750,9 +750,14 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,
|
|
|
9ae3a8 |
return -EINVAL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
} else if (!strcmp(type, "VMFS")) {
|
|
|
9ae3a8 |
- flat_offset = 0;
|
|
|
9ae3a8 |
+ if (ret == 4) {
|
|
|
9ae3a8 |
+ flat_offset = 0;
|
|
|
9ae3a8 |
+ } else {
|
|
|
9ae3a8 |
+ error_setg(errp, "Invalid extent lines:\n%s", p);
|
|
|
9ae3a8 |
+ return -EINVAL;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
} else if (ret != 4) {
|
|
|
9ae3a8 |
- error_setg(errp, "Invalid extent lines: \n%s", p);
|
|
|
9ae3a8 |
+ error_setg(errp, "Invalid extent lines:\n%s", p);
|
|
|
9ae3a8 |
return -EINVAL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
|
|
|
9ae3a8 |
index 23534c2..c8d92a0 100755
|
|
|
9ae3a8 |
--- a/tests/qemu-iotests/059
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/059
|
|
|
9ae3a8 |
@@ -81,6 +81,20 @@ IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G
|
|
|
9ae3a8 |
$QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/'
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
echo
|
|
|
9ae3a8 |
+echo "=== Testing malformed VMFS extent description line ==="
|
|
|
9ae3a8 |
+cat >"$TEST_IMG" <
|
|
|
9ae3a8 |
+# Disk DescriptorFile
|
|
|
9ae3a8 |
+version=1
|
|
|
9ae3a8 |
+CID=58ab4847
|
|
|
9ae3a8 |
+parentCID=ffffffff
|
|
|
9ae3a8 |
+createType="vmfs"
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+# Extent description
|
|
|
9ae3a8 |
+RW 12582912 VMFS "dummy.vmdk" 1
|
|
|
9ae3a8 |
+EOF
|
|
|
9ae3a8 |
+_img_info
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+echo
|
|
|
9ae3a8 |
echo "=== Testing version 3 ==="
|
|
|
9ae3a8 |
_use_sample_img iotest-version3.vmdk.bz2
|
|
|
9ae3a8 |
_img_info
|
|
|
9ae3a8 |
diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out
|
|
|
9ae3a8 |
index 87a2004..f161651 100644
|
|
|
9ae3a8 |
--- a/tests/qemu-iotests/059.out
|
|
|
9ae3a8 |
+++ b/tests/qemu-iotests/059.out
|
|
|
9ae3a8 |
@@ -2038,6 +2038,11 @@ Format specific information:
|
|
|
9ae3a8 |
filename: TEST_DIR/t-f500.vmdk
|
|
|
9ae3a8 |
format: FLAT
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+=== Testing malformed VMFS extent description line ===
|
|
|
9ae3a8 |
+qemu-img: Could not open 'TEST_DIR/t.IMGFMT': Invalid extent lines:
|
|
|
9ae3a8 |
+RW 12582912 VMFS "dummy.IMGFMT" 1
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
=== Testing version 3 ===
|
|
|
9ae3a8 |
image: TEST_DIR/iotest-version3.IMGFMT
|
|
|
9ae3a8 |
file format: IMGFMT
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
2.1.0
|
|
|
9ae3a8 |
|