[PATCH] usb: fix crash when failing to attach a second usb device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



when failing to attach another usb device to a domain for some reason
which has one use device attached before, the libvirtd crashed.
The crash is caused by null-pointer dereference error in invoking
usbDeviceListSteal passed in NULL value usb variable.
commit 05abd1507d66aabb6cad12eeafeb4c4d1911c585 introduces the bug.
---
 src/qemu/qemu_hotplug.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index ad31eba..9b60816 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1213,7 +1213,8 @@ error:
 
 cleanup:
     usbDeviceListFree(list);
-    usbDeviceListSteal(driver->activeUsbHostdevs, usb);
+    if (usb)
+        usbDeviceListSteal(driver->activeUsbHostdevs, usb);
     return -1;
 }
 
-- 
1.7.7.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]