mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
qemu: cgroup: Don't use NULL path on default backed RNGs
The "random" backend for virtio-rng can be started with no path
specified which equals to /dev/random. The cgroup code didn't consider
this and called few of the functions with NULL resulting into:
$ virsh start rng-vm
error: Failed to start domain rng-vm
error: Path '(null)' is not accessible: Bad address
Problem introduced by commit c6320d3463
This commit is contained in:
parent
3d968f409f
commit
99ff49eed1
@ -587,10 +587,16 @@ qemuSetupDevicesCgroup(virQEMUDriverPtr driver,
|
||||
if (vm->def->rng &&
|
||||
(vm->def->rng->backend == VIR_DOMAIN_RNG_BACKEND_RANDOM)) {
|
||||
VIR_DEBUG("Setting Cgroup ACL for RNG device");
|
||||
rv = virCgroupAllowDevicePath(priv->cgroup, vm->def->rng->source.file,
|
||||
const char *rngpath = vm->def->rng->source.file;
|
||||
|
||||
/* fix path when using the default */
|
||||
if (!rngpath)
|
||||
rngpath = "/dev/random";
|
||||
|
||||
rv = virCgroupAllowDevicePath(priv->cgroup, rngpath,
|
||||
VIR_CGROUP_DEVICE_RW);
|
||||
virDomainAuditCgroupPath(vm, priv->cgroup, "allow",
|
||||
vm->def->rng->source.file, "rw", rv == 0);
|
||||
rngpath, "rw", rv == 0);
|
||||
if (rv < 0 &&
|
||||
!virLastErrorIsSystemErrno(ENOENT))
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user