[Spice-devel] [PATCH] usbredir: fix redirection of user-accesible device nodes.

Michal Suchanek michal.suchanek at ruk.cuni.cz
Thu Jul 9 02:57:12 PDT 2015


Hello,

any problem with this one?

I am not sure about the GError memory management. Unfortunately the
Debian provided version of spicy crashes on exit so I don't get clear
valgrind output regarding leaks.

The only minor issue is that if you in fact have a libusb issue but have
support for the policykit compiled-in you get teh policykit error
displayed in dialog and the libusb error only on stderr.

Thanks

Michal

Excerpts from Michal Suchanek's message of Mon Jun 29 15:46:56 +0200 2015:
> When calling ACL helper fails also try to open the device node directly.
> 
> Otherwise user-accessible device nodes are rejected when policykit
> support is compiled in and policy is not set up when in fact the device
> could be accessed.
> 
> Signed-off-by: Michal Suchanek <hramrach at gmail.com>
> ---
>  src/channel-usbredir.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> index 292b82f..b5745b6 100644
> --- a/src/channel-usbredir.c
> +++ b/src/channel-usbredir.c
> @@ -276,21 +276,24 @@ static void spice_usbredir_channel_open_acl_cb(
>      SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(user_data);
>      SpiceUsbredirChannelPrivate *priv = channel->priv;
>      GError *err = NULL;
> +    GError *acl_err = NULL;
>  
>      g_return_if_fail(acl_helper == priv->acl_helper);
>      g_return_if_fail(priv->state == STATE_WAITING_FOR_ACL_HELPER ||
>                       priv->state == STATE_DISCONNECTING);
>  
> -    spice_usb_acl_helper_open_acl_finish(acl_helper, acl_res, &err);
> -    if (!err && priv->state == STATE_DISCONNECTING) {
> +    spice_usb_acl_helper_open_acl_finish(acl_helper, acl_res, &acl_err);
> +    if (!acl_err && priv->state == STATE_DISCONNECTING) {
>          err = g_error_new_literal(G_IO_ERROR, G_IO_ERROR_CANCELLED,
>                                    "USB redirection channel connect cancelled");
>      }
> -    if (!err) {
> -        spice_usbredir_channel_open_device(channel, &err);
> -    }
> +
> +    spice_usbredir_channel_open_device(channel, &err);
>      if (err) {
> -        g_simple_async_result_take_error(priv->result, err);
> +        if (acl_err)
> +            g_simple_async_result_take_error(priv->result, acl_err);
> +        else
> +            g_simple_async_result_take_error(priv->result, err);
>          libusb_unref_device(priv->device);
>          priv->device = NULL;
>          g_boxed_free(spice_usb_device_get_type(), priv->spice_device);


More information about the Spice-devel mailing list