mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +00:00
Initialization error of qemuCgroupData in Qemu host usb hotplug
Steps to reproduce this bug: # cat usb.xml <hostdev mode='subsystem' type='usb'> <source> <address bus='0x001' device='0x003'/> </source> </hostdev> # virsh attach-device vm1 usb.xml error: Failed to attach device from usb.xml error: server closed connection: The reason of this bug is that we set data.cgroup to NULL, and this will cause libvirtd crashed. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
This commit is contained in:
parent
18d68462e3
commit
bcac844f4f
@ -860,7 +860,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
||||
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
|
||||
virCgroupPtr cgroup = NULL;
|
||||
usbDevice *usb;
|
||||
qemuCgroupData data = { vm, cgroup };
|
||||
qemuCgroupData data;
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -873,6 +873,8 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
||||
hostdev->source.subsys.u.usb.device)) == NULL)
|
||||
goto error;
|
||||
|
||||
data.vm = vm;
|
||||
data.cgroup = cgroup;
|
||||
if (usbDeviceFileIterate(usb, qemuSetupHostUsbDeviceCgroup, &data) < 0)
|
||||
goto error;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user