From 2c75dbedda3eaa6d5bb36c1481e901b5e3d32b02 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 24 Feb 2016 13:56:16 +0100 Subject: [PATCH] vma: better driver guessing for bdrv_open --- ...better-driver-guessing-for-bdrv_open.patch | 42 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 43 insertions(+) create mode 100644 debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch diff --git a/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch b/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch new file mode 100644 index 0000000..50b1d44 --- /dev/null +++ b/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch @@ -0,0 +1,42 @@ +From 97fe08940a43098fb033950ea8c46716a7476439 Mon Sep 17 00:00:00 2001 +From: Wolfgang Bumiller +Date: Tue, 23 Feb 2016 15:48:41 +0100 +Subject: [PATCH] vma: better driver guessing for bdrv_open + +Only use 'raw' when the file actually ends with .raw and +no protocol has been specified. With protocol pass the +BDRV_O_PROTOCOL flag to tell bdrv_fill_options() to take it +into account. +--- + vma.c | 15 +++++++++++---- + 1 file changed, 11 insertions(+), 4 deletions(-) + +diff --git a/vma.c b/vma.c +index cc48013..1c4103f 100644 +--- a/vma.c ++++ b/vma.c +@@ -301,10 +301,17 @@ static int extract_content(int argc, char **argv) + + BlockDriverState *bs = bdrv_new(); + +- const char *tmp = g_strrstr(devfn, "."); +- const char *format = (tmp == NULL) ? "raw" : ++tmp; +- QDict *options = qdict_new(); +- qdict_put(options, "driver", qstring_from_str(format)); ++ size_t devlen = strlen(devfn); ++ bool protocol = path_has_protocol(devfn); ++ QDict *options = NULL; ++ if (devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0 && !protocol) { ++ /* 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)) { + g_error("can't open file %s - %s", devfn, +-- +2.1.4 + diff --git a/debian/patches/series b/debian/patches/series index 8a61d6b..379f0d1 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -40,6 +40,7 @@ pve/0039-qapi-qmp_mashal_-renames-for-get_link_status.patch pve/0040-vnc-make-x509-imply-tls-again.patch 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 extra/CVE-2015-8558-ehci_make_idt_processing_more_robust.patch extra/CVE-2015-8613-scsi-initialize-info-object.patch extra/CVE-2015-8701-net-rocker-off-by-one.patch -- 2.39.2