Hey Alon,

On Tue, Jul 26, 2016 at 01:47:16PM +0300, Alon Levy wrote:
> On fedora 24 this function is tail optimized, resulting in a busy wait.
> 
> This happens to me with virt-manager running a win7 vm 

Ah ok, probably goes with the call with interface_count == 0 in
usbredirhost.c if libusb_get_active_config_descriptor() returns NULL. In
this case, if usbredirfilter_check1() does not match the device, then
we'll indeed keep calling usbredirfilter_check() as num_skipped will
always be 0 when interface_count is 0. The tail optimization of the call
means that instead of crashing because of the infinite recursion, we
just busy wait.

Patch looks good to me, though a bit more details in the commit log
would have avoided some head scratching :p

Christophe

> 
> usbredir-0.7.1-2.fc24.x86_64
> ---
> Hi Guys!
> 
>  One liner to fix an issue I had with virt-manager - symptom is 100% cpu
>  taken in it, stack traced to the problem fixed by this patch.
> 
> Alon
> 
>  usbredirparser/usbredirfilter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/usbredirparser/usbredirfilter.c
> b/usbredirparser/usbredirfilter.c
> index 02184ef..bdfbfc2 100644
> --- a/usbredirparser/usbredirfilter.c
> +++ b/usbredirparser/usbredirfilter.c
> @@ -205,7 +205,7 @@ int usbredirfilter_check(
>       * by recursively calling this function with a flag that forbids
>       * skipping (usbredirfilter_fl_dont_skip_non_boot_hid)
>       */
> -    if (num_skipped == interface_count) {
> +    if (interface_count > 0 && num_skipped == interface_count) {
>          rc = usbredirfilter_check(rules, rules_count,
>                                    device_class, device_subclass,
>                                    device_protocol,
>                                    interface_class, interface_subclass,
> -- 
> 2.7.4
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: signature.asc
Description: PGP signature

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

Reply via email to