[pve-devel] [PATCH kvm] Fix #934: assume raw for /dev paths in vma extract

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Apr 12 14:06:03 CEST 2016


---
This one should be squashed with the other related ones in the 2.6 branch

 .../0045-vma-also-guess-raw-for-dev-paths.patch    | 36 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 debian/patches/pve/0045-vma-also-guess-raw-for-dev-paths.patch

diff --git a/debian/patches/pve/0045-vma-also-guess-raw-for-dev-paths.patch b/debian/patches/pve/0045-vma-also-guess-raw-for-dev-paths.patch
new file mode 100644
index 0000000..b48b5e8
--- /dev/null
+++ b/debian/patches/pve/0045-vma-also-guess-raw-for-dev-paths.patch
@@ -0,0 +1,36 @@
+From 7878879d6dc2330e6d2d34c1e83101ad796ce939 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller at proxmox.com>
+Date: Tue, 12 Apr 2016 13:49:44 +0200
+Subject: [PATCH] vma: also "guess" raw for /dev/ paths
+
+---
+ vma.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/vma.c b/vma.c
+index 1c4103f..2f604bb 100644
+--- a/vma.c
++++ b/vma.c
+@@ -304,13 +304,15 @@ static int extract_content(int argc, char **argv)
+ 	    size_t devlen = strlen(devfn);
+ 	    bool protocol = path_has_protocol(devfn);
+ 	    QDict *options = NULL;
+-	    if (devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0 && !protocol) {
++	    if (protocol) {
++		/* tell bdrv_open to honor the protocol */
++		flags |= BDRV_O_PROTOCOL;
++	    } else if ((devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0) ||
++	               strncmp(devfn, "/dev/", 5) == 0)
++	    {
+ 		/* explicit raw format */
+ 		options = qdict_new();
+ 		qdict_put(options, "driver", qstring_from_str("raw"));
+-	    } else if (protocol) {
+-		/* tell bdrv_open to honor the protocol */
+-		flags |= BDRV_O_PROTOCOL;
+ 	    }
+ 
+ 	    if (errp || bdrv_open(&bs, devfn, NULL, options, flags, &errp)) {
+-- 
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index e165c81..ecb8ad4 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -42,6 +42,7 @@ pve/0041-PVE-VNC-authentication.patch
 pve/0042-vma-writer-don-t-bail-out-on-zero-length-files.patch
 pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
 pve/0044-block-add-zeroinit.patch
+pve/0045-vma-also-guess-raw-for-dev-paths.patch
 extra/0001-vnc-clear-vs-tlscreds-after-unparenting-it.patch
 extra/CVE-2016-2198-ehci-null-pointer.patch
 extra/CVE-2016-2391-usb-ohci-avoid-multiple-eof-timers.patch
-- 
2.1.4





More information about the pve-devel mailing list