|
|
43618d |
From 009332c5530a3f3419578b62b44a98ff8de31ca2 Mon Sep 17 00:00:00 2001
|
|
|
43618d |
From: Cole Robinson <crobinso@redhat.com>
|
|
|
43618d |
Date: Tue, 1 Oct 2013 07:55:19 -0400
|
|
|
43618d |
Subject: [PATCH] qemu: cgroup: Fix crash if starting nographics guest
|
|
|
43618d |
|
|
|
43618d |
We can dereference graphics[0] even if guest has no graphics device
|
|
|
43618d |
configured. I screwed this up in a216e6487255d3b65d97c7ec1fa5da63dbced902
|
|
|
43618d |
|
|
|
43618d |
https://bugzilla.redhat.com/show_bug.cgi?id=1014088
|
|
|
43618d |
(cherry picked from commit a924d9d083c215df6044387057c501d9aa338b96)
|
|
|
43618d |
---
|
|
|
43618d |
src/qemu/qemu_cgroup.c | 5 +++--
|
|
|
43618d |
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
43618d |
|
|
|
43618d |
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
|
|
|
43618d |
index f95c7f2..ace7e35 100644
|
|
|
43618d |
--- a/src/qemu/qemu_cgroup.c
|
|
|
43618d |
+++ b/src/qemu/qemu_cgroup.c
|
|
|
43618d |
@@ -490,9 +490,10 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
|
|
|
43618d |
|
|
|
43618d |
if (vm->def->nsounds &&
|
|
|
43618d |
((!vm->def->ngraphics && cfg->nogfxAllowHostAudio) ||
|
|
|
43618d |
- ((vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
|
|
|
43618d |
+ (vm->def->graphics &&
|
|
|
43618d |
+ ((vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
|
|
|
43618d |
cfg->vncAllowHostAudio) ||
|
|
|
43618d |
- (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)))) {
|
|
|
43618d |
+ (vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL))))) {
|
|
|
43618d |
rv = virCgroupAllowDeviceMajor(priv->cgroup, 'c', DEVICE_SND_MAJOR,
|
|
|
43618d |
VIR_CGROUP_DEVICE_RW);
|
|
|
43618d |
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_SND_MAJOR,
|