From: Peter Krempa Date: Thu, 23 Feb 2017 09:07:30 +0000 (+0100) Subject: qemu: Don't update physical storage size of empty drives X-Git-Tag: CVE-2017-2635^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3de387380f6057ee0e46cd9f2f0a092e8070875;p=thirdparty%2Flibvirt.git qemu: Don't update physical storage size of empty drives Previously the code called virStorageSourceUpdateBlockPhysicalSize which did not do anything on empty drives since it worked only on block devices. After the refactor in c5f6151390 it's called for all devices and thus attempts to deref the NULL path of empty drives. Add a check that skips the update of the physical size if the storage source is empty. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1420718 --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6e1e3d4088..77d81755a3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11336,6 +11336,9 @@ qemuDomainStorageUpdatePhysical(virQEMUDriverPtr driver, int fd = -1; struct stat sb; + if (virStorageSourceIsEmpty(src)) + return 0; + if (qemuDomainStorageOpenStat(driver, cfg, vm, src, &fd, &sb) < 0) return -1;