[Spice-devel] [spice-gtk v2] usbredir: fix deadlock on error
Victor Toso
victortoso at redhat.com
Wed Jul 26 13:16:17 UTC 2017
Hi,
On Wed, Jul 26, 2017 at 02:48:41PM +0200, Pavel Grunt wrote:
> On Tue, 2017-06-20 at 13:10 +0200, Victor Toso wrote:
> > From: leaboy <wlbleaboy at 126.com>
> >
> > The current code deadlocks when a USB error occurs, releasing the
> > channel lock before the idle is called fixes this problem.
> >
> > More specifically when an error occurs, we queue a call to device_error
> > in an idle, and switch to the main context. The device_error() calls
> > spice_usbredir_channel_disconnect_device() which needs the channel to be
> > unlocked as it calls spice_usbredir_channel_lock().
>
> Ack
>
> Thanks,
> Pavel
Thanks, pushed.
Shortlog: usbredir: fix deadlock on error
Commit : 3fb475a9c9eac077c9eebb3623fe14b4cd1e965a
leaboy on Wed, 26 Jul 2017 15:14:43 +0200
>
>
> >
> > Examples:
> > - Redirect USB Storage device to the guest and copy some big file. While
> > copy is ongoing, unplug the USB Storage from the client machine;
> > - Unplug the usb device from the client machine while the USB Storage
> > device is being identified in the guest.
> > - With the auto-redirection option enabled, plug and unplug the USB
> > Storage Device frequently.
> >
> > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1353528
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> > src/channel-usbredir.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
> > index fef62ce..1f791bc 100644
> > --- a/src/channel-usbredir.c
> > +++ b/src/channel-usbredir.c
> > @@ -927,15 +927,16 @@ static void usbredir_handle_msg(SpiceChannel *c,
> > SpiceMsgIn *in)
> > err_data.caller = coroutine_self();
> > err_data.spice_device = g_boxed_copy(spice_usb_device_get_type(),
> > spice_device);
> > err_data.error = err;
> > + spice_usbredir_channel_unlock(channel);
> > g_idle_add(device_error, &err_data);
> > coroutine_yield(NULL);
> >
> > g_boxed_free(spice_usb_device_get_type(), err_data.spice_device);
> >
> > g_error_free(err);
> > + } else {
> > + spice_usbredir_channel_unlock(channel);
> > }
> > -
> > - spice_usbredir_channel_unlock(channel);
> > }
> >
> > #endif /* USE_USBREDIR */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170726/6a84454a/attachment.sig>
More information about the Spice-devel
mailing list