render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From e030e933c8353c9a06eb8a3d6114ae24bc0380e4 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <e030e933c8353c9a06eb8a3d6114ae24bc0380e4@dist-git>
c401cc
From: "Daniel P. Berrange" <berrange@redhat.com>
c401cc
Date: Tue, 18 Feb 2014 15:45:33 -0700
c401cc
Subject: [PATCH] Record hotplugged USB device in LXC live guest config
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1045643
c401cc
prereq of CVE-2013-6456
c401cc
c401cc
After hotplugging a USB device, the LXC driver forgot
c401cc
to add the device def to the virDomainDefPtr.
c401cc
c401cc
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
c401cc
(cherry picked from commit a537827d15516f2b59afb23ce2d50b8a88d7f090)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/lxc/lxc_driver.c | 5 +++++
c401cc
 1 file changed, 5 insertions(+)
c401cc
c401cc
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
c401cc
index 63c545c..79d03ee 100644
c401cc
--- a/src/lxc/lxc_driver.c
c401cc
+++ b/src/lxc/lxc_driver.c
c401cc
@@ -3378,6 +3378,9 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
c401cc
 
c401cc
     mode = 0700 | S_IFCHR;
c401cc
 
c401cc
+    if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
c401cc
+        goto cleanup;
c401cc
+
c401cc
     if (virFileMakePath(dstdir) < 0) {
c401cc
         virReportSystemError(errno,
c401cc
                              _("Unable to create %s"), dstdir);
c401cc
@@ -3406,6 +3409,8 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
c401cc
                                 priv->cgroup) < 0)
c401cc
         goto cleanup;
c401cc
 
c401cc
+    vm->def->hostdevs[vm->def->nhostdevs++] = def;
c401cc
+
c401cc
     ret = 0;
c401cc
 
c401cc
 cleanup:
c401cc
-- 
c401cc
1.9.0
c401cc