[Spice-devel] [spice-gtk v1] channel-usbredir: Fix crash on channel-up
Victor Toso
victortoso at redhat.com
Tue Nov 29 21:46:24 UTC 2016
From: Victor Toso <me at victortoso.com>
Seems that usbredirhost initialization can take longer then
the channel_up call from spice-channel.
As this seems to be a race, a simple check for NULL pointer should be
enough. Similar fix was done in 5b252b0f499601bcf387c02a4dd35d27ed34c
#0 in usbredirhost_write_guest_data (host=0x0) at usbredirhost.c:876
#1 in spice_channel_recv_auth (channel=0x55af5f3b8f50 [SpiceUsbredirChannel]) at spice-channel.c:1225
#2 in spice_channel_coroutine (data=0x55af5f3b8f50) at spice-channel.c:2580
#3 in coroutine_trampoline (cc=0x55af5f3b85e0) at coroutine_ucontext.c:63
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1399838
Signed-off-by: Victor Toso <victortoso at redhat.com>
---
src/channel-usbredir.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 4837d68..561f486 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -817,6 +817,9 @@ static void spice_usbredir_channel_up(SpiceChannel *c)
SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);
SpiceUsbredirChannelPrivate *priv = channel->priv;
+ if (priv->host == NULL)
+ return;
+
/* Flush any pending writes */
usbredirhost_write_guest_data(priv->host);
}
--
2.9.3
More information about the Spice-devel
mailing list