]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix reset of cgroup when detaching USB device from LXC guests
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 4 Feb 2014 17:41:22 +0000 (17:41 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 18 Feb 2014 18:24:11 +0000 (18:24 +0000)
When detaching a USB device from an LXC guest we must remove
the device from the cgroup ACL. Unfortunately we were telling
the cgroup code to use the guest /dev path, not the host /dev
path, and the guest device node had already been unlinked.
This was, however, fortunate since the code passed &priv->cgroup
instead of priv->cgroup, so would have crash if the device node
were accessible.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 2c2bec94d27ccd070bee18a6113b1cfea6d80126)

src/lxc/lxc_driver.c

index d2a1befc9698657760373ac7cd3e01cf5f6aa728..f2aa52e85d069215bbee741c2ed8d9355b872db7 100644 (file)
@@ -3991,7 +3991,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
     }
 
     if (!(usb = virUSBDeviceNew(def->source.subsys.u.usb.bus,
-                                def->source.subsys.u.usb.device, vroot)))
+                                def->source.subsys.u.usb.device, NULL)))
         goto cleanup;
 
     VIR_DEBUG("Unlinking %s", dst);
@@ -4005,7 +4005,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
 
     if (virUSBDeviceFileIterate(usb,
                                 virLXCTeardownHostUsbDeviceCgroup,
-                                &priv->cgroup) < 0)
+                                priv->cgroup) < 0)
         VIR_WARN("cannot deny device %s for domain %s",
                  dst, vm->def->name);