mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
qemu: cgroup: Fix crash if starting nographics guest
We can dereference graphics[0] even if guest has no graphics device configured. I screwed this up ina216e64872
https://bugzilla.redhat.com/show_bug.cgi?id=1014088 (cherry picked from commita924d9d083
)
This commit is contained in:
parent
0e20cc86b8
commit
b1b060f14e
@ -490,9 +490,10 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
|
||||
|
||||
if (vm->def->nsounds &&
|
||||
((!vm->def->ngraphics && cfg->nogfxAllowHostAudio) ||
|
||||
(vm->def->graphics &&
|
||||
((vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
|
||||
cfg->vncAllowHostAudio) ||
|
||||
(vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL)))) {
|
||||
(vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL))))) {
|
||||
rv = virCgroupAllowDeviceMajor(priv->cgroup, 'c', DEVICE_SND_MAJOR,
|
||||
VIR_CGROUP_DEVICE_RW);
|
||||
virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_SND_MAJOR,
|
||||
|
Loading…
Reference in New Issue
Block a user