mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
Fix path used for USB device attach with LXC
The LXC code missed the 'usb' component out of the path
/dev/bus/usb/$BUSNUM/$DEVNUM, so it failed to actually
setup cgroups for the device. This was in fact lucky
because the call to virLXCSetupHostUsbDeviceCgroup
was also mistakenly passing '&priv->cgroup' instead of
just 'priv->cgroup'. So once the path is fixed, libvirtd
would then crash trying to access the bogus virCgroupPtr
pointer. This would have been a security issue, were it
not for the bogus path preventing the pointer reference
being reached.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit c364897222
)
This commit is contained in:
parent
5d3891ffa2
commit
9194b050d7
@ -3400,7 +3400,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virAsprintf(&dstdir, "%s/dev/bus/%03d",
|
||||
if (virAsprintf(&dstdir, "%s/dev/bus/usb/%03d",
|
||||
vroot,
|
||||
def->source.subsys.u.usb.bus) < 0) {
|
||||
virReportOOMError();
|
||||
@ -3468,7 +3468,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
|
||||
|
||||
if (virUSBDeviceFileIterate(usb,
|
||||
virLXCSetupHostUsbDeviceCgroup,
|
||||
&priv->cgroup) < 0)
|
||||
priv->cgroup) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user