Re: [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.


Were you able to reproduce this condition?

If I put the check I put because the code will support not having
usbredirhost at all, not because it will be created in the future
(in this case will ever be NULL).

> 
> 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;
>  
>      /*

Frediano
_______________________________________________
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]