From 61613dd907c4c7fc164eea63727df58c40fedd6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Thu, 15 Jun 2017 16:26:43 +0400 Subject: [PATCH] channel-usbredir: Fix crash on channel-up with spicy-stats --- ...nel-usbredir-Fix-crash-on-channel-up.patch | 59 +++++++++++++++++++ spice-gtk.spec | 7 ++- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 0004-channel-usbredir-Fix-crash-on-channel-up.patch diff --git a/0004-channel-usbredir-Fix-crash-on-channel-up.patch b/0004-channel-usbredir-Fix-crash-on-channel-up.patch new file mode 100644 index 0000000..4559891 --- /dev/null +++ b/0004-channel-usbredir-Fix-crash-on-channel-up.patch @@ -0,0 +1,59 @@ +From 291f3e4419e6fb4077ae43a5e09eb1c37b9dd729 Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Tue, 29 Nov 2016 22:34:04 +0100 +Subject: [PATCH spice-gtk] channel-usbredir: Fix crash on channel-up + +SpiceSession does not initialize its SpiceUsbDeviceManager object on +startup that could lead to a race condition where channel-usbredir is +requested to flush data while it is uninitialized. + +In a few places, spice_usb_device_manager_get() is called as in +usb-device-widget.c and spice-gtk-session.c but not used in +spicy-stats, making the tool to crash on startup if it encounters an +usbredir channel. + + #0 in usbredirhost_write_guest_data (host=0x0) at usbredir/usbredirhost/usbredirhost.c:876 + #1 in spice_usbredir_channel_up (c=0x643830) at channel-usbredir.c:821 + #2 in spice_channel_up (channel=0x643830) at spice-channel.c:1238 + #3 in spice_channel_recv_auth (channel=0x643830) at spice-channel.c:1225 + #4 in spice_channel_coroutine (data=0x643830) at spice-channel.c:2580 + #5 in coroutine_trampoline (cc=0x642ec0) at coroutine_ucontext.c:63 + #6 in continuation_trampoline (i0=6565568, i1=0) at continuation.c:55 + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1399838 + +Signed-off-by: Victor Toso +Reported-by: Michael Cullen +Acked-by: Christophe Fergeau +--- + src/spice-session.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/spice-session.c b/src/spice-session.c +index f900bd1..cc3dbdd 100644 +--- a/src/spice-session.c ++++ b/src/spice-session.c +@@ -281,6 +281,7 @@ static void spice_session_init(SpiceSession *session) + { + SpiceSessionPrivate *s; + gchar *channels; ++ GError *err = NULL; + + SPICE_DEBUG("New session (compiled from package " PACKAGE_STRING ")"); + s = session->priv = SPICE_SESSION_GET_PRIVATE(session); +@@ -293,6 +294,12 @@ static void spice_session_init(SpiceSession *session) + s->images = cache_image_new((GDestroyNotify)pixman_image_unref); + s->glz_window = glz_decoder_window_new(); + update_proxy(session, NULL); ++ ++ s->usb_manager = spice_usb_device_manager_get(session, &err); ++ if (err != NULL) { ++ SPICE_DEBUG("Could not initialize SpiceUsbDeviceManager - %s", err->message); ++ g_clear_error(&err); ++ } + } + + static void +-- +2.13.1.395.gf7b71de06 + diff --git a/spice-gtk.spec b/spice-gtk.spec index 2bbf111..78ac031 100644 --- a/spice-gtk.spec +++ b/spice-gtk.spec @@ -2,7 +2,7 @@ Name: spice-gtk Version: 0.33 -Release: 4%{?dist} +Release: 5%{?dist} Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries @@ -13,6 +13,7 @@ Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_ve Patch1: 0001-clipboard-Fix-crash-by-handling-error.patch Patch2: 0002-widget-skip-spice_egl_resize_display-if-context-is-n.patch Patch3: 0003-widget-call-gl-draw-when-skipping-draw.patch +Patch4: 0004-channel-usbredir-Fix-crash-on-channel-up.patch BuildRequires: intltool BuildRequires: usbredir-devel >= 0.5.2 @@ -191,6 +192,10 @@ rm -f %{buildroot}%{_libdir}/*.la %{_bindir}/spicy-stats %changelog +* Thu Jun 15 2017 Marc-André Lureau - 0.33-5 +- channel-usbredir: Fix crash on channel-up. + Resolves: rhbz#1399838 + * Thu Jun 15 2017 Marc-André Lureau - 0.33-4 - usbutils no longer ships usb.ids, it is hwdata now, set path manually.