Blame SOURCES/0003-channel-usbredir-Fix-crash-on-channel-up.patch

3538ab
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3538ab
From: Victor Toso <me@victortoso.com>
3538ab
Date: Fri, 6 Apr 2018 09:59:44 +0200
3538ab
Subject: [PATCH] channel-usbredir: Fix crash on channel-up
3538ab
3538ab
By adding a guard to not handle channel-up on SpiceUsbredirChannel in
3538ab
case struct usbredirhost wasn't initialized yet. Same guard is in
3538ab
place for the generic usbredir_handle_msg() function to avoid handling
3538ab
Server's message while Client's initialization is not done.
3538ab
3538ab
As mentioned in commit 291f3e4419e6, this isn't a problem for
3538ab
graphical clients as some initialization is done to present the
3538ab
shareable usb devices to user.
3538ab
3538ab
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1399838
3538ab
Signed-off-by: Victor Toso <victortoso@redhat.com>
3538ab
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
3538ab
---
3538ab
 src/channel-usbredir.c | 1 +
3538ab
 1 file changed, 1 insertion(+)
3538ab
3538ab
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
3538ab
index 1f791bc..306bdd5 100644
3538ab
--- a/src/channel-usbredir.c
3538ab
+++ b/src/channel-usbredir.c
3538ab
@@ -817,6 +817,7 @@ static void spice_usbredir_channel_up(SpiceChannel *c)
3538ab
     SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);
3538ab
     SpiceUsbredirChannelPrivate *priv = channel->priv;
3538ab
 
3538ab
+    g_return_if_fail(priv->host != NULL);
3538ab
     /* Flush any pending writes */
3538ab
     usbredirhost_write_guest_data(priv->host);
3538ab
 }