提交 17fc85a2 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
(cherry picked from commit c3648972)
上级 9bb26f09
...@@ -3296,7 +3296,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, ...@@ -3296,7 +3296,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
(unsigned long long)priv->initpid) < 0) (unsigned long long)priv->initpid) < 0)
goto cleanup; goto cleanup;
if (virAsprintf(&dstdir, "%s/dev/bus/%03d", if (virAsprintf(&dstdir, "%s/dev/bus/usb/%03d",
vroot, vroot,
def->source.subsys.u.usb.bus) < 0) def->source.subsys.u.usb.bus) < 0)
goto cleanup; goto cleanup;
...@@ -3361,7 +3361,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, ...@@ -3361,7 +3361,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver,
if (virUSBDeviceFileIterate(usb, if (virUSBDeviceFileIterate(usb,
virLXCSetupHostUsbDeviceCgroup, virLXCSetupHostUsbDeviceCgroup,
&priv->cgroup) < 0) priv->cgroup) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册