Accepting request 557196 from home:jfehlig:branches:Virtualization

- storage: Don't dereference driver object if virStorageSource is
  not initialized
  2d07f1f0-fix-storage-crash.patch
  bsc#1072974

OBS-URL: https://build.opensuse.org/request/show/557196
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=649
This commit is contained in:
James Fehlig 2017-12-14 23:46:39 +00:00 committed by Git OBS Bridge
parent f4c63178f5
commit 9e7c17be27
3 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,62 @@
commit 2d07f1f0ebd44b0348daa61afa0de34f3f838c22
Author: Peter Krempa <pkrempa@redhat.com>
Date: Wed Dec 6 16:20:07 2017 +0100
storage: Don't dereference driver object if virStorageSource is not initialized
virStorageFileReportBrokenChain uses data from the driver private data
pointer to print the user and group. This would lead to a crash in call
paths where we did not initialize the storage backend as recently added
in commit 24e47ee2b93 to qemuDomainDetermineDiskChain.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1522682
Index: libvirt-3.10.0/src/storage/storage_source.c
===================================================================
--- libvirt-3.10.0.orig/src/storage/storage_source.c
+++ libvirt-3.10.0/src/storage/storage_source.c
@@ -419,19 +419,33 @@ virStorageFileReportBrokenChain(int errc
virStorageSourcePtr src,
virStorageSourcePtr parent)
{
- unsigned int access_user = src->drv->uid;
- unsigned int access_group = src->drv->gid;
- if (src == parent) {
- virReportSystemError(errcode,
- _("Cannot access storage file '%s' "
- "(as uid:%u, gid:%u)"),
- src->path, access_user, access_group);
+ if (src->drv) {
+ unsigned int access_user = src->drv->uid;
+ unsigned int access_group = src->drv->gid;
+
+ if (src == parent) {
+ virReportSystemError(errcode,
+ _("Cannot access storage file '%s' "
+ "(as uid:%u, gid:%u)"),
+ src->path, access_user, access_group);
+ } else {
+ virReportSystemError(errcode,
+ _("Cannot access backing file '%s' "
+ "of storage file '%s' (as uid:%u, gid:%u)"),
+ src->path, parent->path, access_user, access_group);
+ }
} else {
- virReportSystemError(errcode,
- _("Cannot access backing file '%s' "
- "of storage file '%s' (as uid:%u, gid:%u)"),
- src->path, parent->path, access_user, access_group);
+ if (src == parent) {
+ virReportSystemError(errcode,
+ _("Cannot access storage file '%s'"),
+ src->path);
+ } else {
+ virReportSystemError(errcode,
+ _("Cannot access backing file '%s' "
+ "of storage file '%s'"),
+ src->path, parent->path);
+ }
}
}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Dec 14 23:04:20 UTC 2017 - jfehlig@suse.com
- storage: Don't dereference driver object if virStorageSource is
not initialized
2d07f1f0-fix-storage-crash.patch
bsc#1072974
-------------------------------------------------------------------
Mon Dec 4 18:30:11 UTC 2017 - jfehlig@suse.com

View File

@ -308,6 +308,7 @@ Source4: libvirt-supportconfig
Source99: baselibs.conf
Source100: %{name}-rpmlintrc
# Upstream patches
Patch0: 2d07f1f0-fix-storage-crash.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
@ -883,6 +884,7 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%prep
%setup -q
%patch0 -p1
%patch100 -p1
%patch101 -p1
%patch150 -p1