Add patch to avoid crashes in VM

Add patch to avoid dbus crash
Resolves: rhbz#2104986
This commit is contained in:
Wim Taymans 2022-07-13 13:02:58 +02:00
parent 324b3de430
commit 3ac37fa0f2
3 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From bc6b54229200537863426977c8d121bf9168fb94 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Thu, 7 Jul 2022 20:58:36 +0300
Subject: [PATCH 1/2] alsa: use "obj_type" as a variable name to avoid
shadowing lua's "type" function
This causes a crash when running in a VM because the code tries to
execute lua's "type()" and ends up executing the local string variable...
Fixes: #303
---
src/scripts/monitors/alsa.lua | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/scripts/monitors/alsa.lua b/src/scripts/monitors/alsa.lua
index 43fab94..38f847f 100644
--- a/src/scripts/monitors/alsa.lua
+++ b/src/scripts/monitors/alsa.lua
@@ -49,7 +49,7 @@ function nonempty(str)
return str ~= "" and str or nil
end
-function createNode(parent, id, type, factory, properties)
+function createNode(parent, id, obj_type, factory, properties)
local dev_props = parent.properties
-- set the device id and spa factory name; REQUIRED, do not change
@@ -199,7 +199,7 @@ function createDevice(parent, id, factory, properties)
end
end
-function prepareDevice(parent, id, type, factory, properties)
+function prepareDevice(parent, id, obj_type, factory, properties)
-- ensure the device has an appropriate name
local name = "alsa_card." ..
(properties["device.name"] or
--
2.36.1

View File

@ -0,0 +1,51 @@
From 842e267af2925c5c0e8ea44b0f3d4e2823f787ce Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Wed, 13 Jul 2022 13:38:14 +0300
Subject: [PATCH 2/2] dbus: fix crash when trying to reconnect
When coming from on_sync_reconnect, data points to the WpDBus object
instead of the activation transition.
Fixes: #305
---
lib/wp/dbus.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/lib/wp/dbus.c b/lib/wp/dbus.c
index 01a3b21..7c2d023 100644
--- a/lib/wp/dbus.c
+++ b/lib/wp/dbus.c
@@ -58,14 +58,26 @@ wp_dbus_set_state (WpDbus *self, WpDBusState new_state)
static void
on_got_bus (GObject * obj, GAsyncResult * res, gpointer data)
{
- WpTransition *transition = WP_TRANSITION (data);
- WpDbus *self = wp_transition_get_source_object (transition);
+ WpTransition *transition;
+ WpDbus *self;
g_autoptr (GError) error = NULL;
+ if (WP_IS_TRANSITION (data)) {
+ // coming from wp_dbus_enable
+ transition = WP_TRANSITION (data);
+ self = wp_transition_get_source_object (transition);
+ } else {
+ // coming from on_sync_reconnect
+ transition = NULL;
+ self = WP_DBUS (data);
+ }
+
self->connection = g_dbus_connection_new_for_address_finish (res, &error);
if (!self->connection) {
- g_prefix_error (&error, "Failed to connect to bus: ");
- wp_transition_return_error (transition, g_steal_pointer (&error));
+ if (transition) {
+ g_prefix_error (&error, "Failed to connect to bus: ");
+ wp_transition_return_error (transition, g_steal_pointer (&error));
+ }
return;
}
--
2.36.1

View File

@ -1,6 +1,6 @@
Name: wireplumber
Version: 0.4.11
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A modular session/policy manager for PipeWire
License: MIT
@ -8,6 +8,8 @@ URL: https://pipewire.pages.freedesktop.org/wireplumber/
Source0: https://gitlab.freedesktop.org/pipewire/%{name}/-/archive/%{version}/%{name}-%{version}.tar.bz2
## upstream patches
Patch0001: 0001-alsa-use-obj_type-as-a-variable-name-to-avoid-shadow.patch
Patch0002: 0002-dbus-fix-crash-when-trying-to-reconnect.patch
## upstreamable patches
@ -115,6 +117,11 @@ fi
%{_datadir}/gir-1.0/Wp-0.4.gir
%changelog
* Wed Jul 13 2022 Wim Taymans <wim.taymans@redhat.com> - 0.4.11-2
- Add patch to avoid crashes in VM
- Add patch to avoid dbus crash
- Resolves: rhbz#2104986
* Tue Jul 5 2022 Wim Taymans <wim.taymans@redhat.com> - 0.4.11-1
- wireplumber 0.4.11