]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix path used for USB device attach with LXC
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 4 Feb 2014 16:43:18 +0000 (16:43 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 18 Feb 2014 16:00:09 +0000 (16:00 +0000)
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 c3648972222d4eb056e6e667c193ba56a7aa3557)

src/lxc/lxc_driver.c

index 48456ad0b9c0de9975ab16c828c0feb9981a7d4e..63c545c5cd868dd06c96266a93a987632a7d7245 100644 (file)
@@ -3338,7 +3338,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
                     (unsigned long long)priv->initpid) < 0)
         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)
         goto cleanup;
@@ -3403,7 +3403,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
 
     if (virUSBDeviceFileIterate(usb,
                                 virLXCSetupHostUsbDeviceCgroup,
-                                &priv->cgroup) < 0)
+                                priv->cgroup) < 0)
         goto cleanup;
 
     ret = 0;