render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From 7a0d06ba87d2ab3e946bbe1e82b03f073a9bb5f9 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <7a0d06ba87d2ab3e946bbe1e82b03f073a9bb5f9@dist-git>
c401cc
From: "Daniel P. Berrange" <berrange@redhat.com>
c401cc
Date: Tue, 18 Feb 2014 15:45:34 -0700
c401cc
Subject: [PATCH] Fix reset of cgroup when detaching USB device from LXC guests
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1045643
c401cc
prereq of CVE-2013-6456
c401cc
c401cc
When detaching a USB device from an LXC guest we must remove
c401cc
the device from the cgroup ACL. Unfortunately we were telling
c401cc
the cgroup code to use the guest /dev path, not the host /dev
c401cc
path, and the guest device node had already been unlinked.
c401cc
This was, however, fortunate since the code passed &priv->cgroup
c401cc
instead of priv->cgroup, so would have crash if the device node
c401cc
were accessible.
c401cc
c401cc
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
c401cc
(cherry picked from commit 2c2bec94d27ccd070bee18a6113b1cfea6d80126)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/lxc/lxc_driver.c | 4 ++--
c401cc
 1 file changed, 2 insertions(+), 2 deletions(-)
c401cc
c401cc
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
c401cc
index 79d03ee..b098d29 100644
c401cc
--- a/src/lxc/lxc_driver.c
c401cc
+++ b/src/lxc/lxc_driver.c
c401cc
@@ -3912,7 +3912,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
c401cc
     }
c401cc
 
c401cc
     if (!(usb = virUSBDeviceNew(def->source.subsys.u.usb.bus,
c401cc
-                                def->source.subsys.u.usb.device, vroot)))
c401cc
+                                def->source.subsys.u.usb.device, NULL)))
c401cc
         goto cleanup;
c401cc
 
c401cc
     VIR_DEBUG("Unlinking %s", dst);
c401cc
@@ -3926,7 +3926,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver,
c401cc
 
c401cc
     if (virUSBDeviceFileIterate(usb,
c401cc
                                 virLXCTeardownHostUsbDeviceCgroup,
c401cc
-                                &priv->cgroup) < 0)
c401cc
+                                priv->cgroup) < 0)
c401cc
         VIR_WARN("cannot deny device %s for domain %s",
c401cc
                  dst, vm->def->name);
c401cc
 
c401cc
-- 
c401cc
1.9.0
c401cc