[PATCH v7 06/20] usb-backend: add safe check on attach()

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

 



From: Frediano Ziglio <fziglio@xxxxxxxxxx>

At this moment, spice_usb_backend_channel_attach() is only related to
real devices and this call might happen on channel-up event that can
possibly come before usbredirhost has been created.

Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
---
 src/usb-backend.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/usb-backend.c b/src/usb-backend.c
index 6ed957c..68faaae 100644
--- a/src/usb-backend.c
+++ b/src/usb-backend.c
@@ -720,6 +720,11 @@ gboolean spice_usb_backend_channel_attach(SpiceUsbBackendChannel *ch,
 
     g_return_val_if_fail(dev != NULL, FALSE);
 
+    // no physical device enabled
+    if (ch->usbredirhost == NULL) {
+        return FALSE;
+    }
+
     libusb_device_handle *handle = NULL;
 
     /*
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]