From: Daniel P. Berrange Date: Tue, 4 Feb 2014 16:43:18 +0000 (+0000) Subject: Fix path used for USB device attach with LXC X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fcb42e922b2a2e57ee40db53e488e9fb6491802;p=thirdparty%2Flibvirt.git 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 (cherry picked from commit c3648972222d4eb056e6e667c193ba56a7aa3557) --- diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 5bd668721d..41135ee659 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -3549,7 +3549,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(); @@ -3617,7 +3617,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, if (virUSBDeviceFileIterate(usb, virLXCSetupHostUsbDeviceCgroup, - &priv->cgroup) < 0) + priv->cgroup) < 0) goto cleanup; ret = 0;