Backport https://github.com/fwupd/fwupd/pull/3144 to fix
https://bugzilla.redhat.com/show_bug.cgi?id=1949491
This commit is contained in:
parent
cf90a6a1bc
commit
3160ec50bb
66
3144.patch
Normal file
66
3144.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 393950b8b9f56bde7e759f23f362faa44053c580 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Hughes <richard@hughsie.com>
|
||||
Date: Wed, 14 Apr 2021 18:02:01 +0100
|
||||
Subject: [PATCH] Cancel the GDBusObjectManager operation to fix a potential
|
||||
crash
|
||||
|
||||
If blues takes longer than 1500ms to successfully start, then we will call
|
||||
fu_bluez_backend_connect_cb() with a freed FuBluezBackendHelper.
|
||||
|
||||
Hopefully fixes https://bugzilla.redhat.com/show_bug.cgi?id=1949491
|
||||
---
|
||||
src/fu-bluez-backend.c | 13 ++++++-------
|
||||
1 file changed, 6 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/fu-bluez-backend.c b/src/fu-bluez-backend.c
|
||||
index 3e68d8438..f00637202 100644
|
||||
--- a/src/fu-bluez-backend.c
|
||||
+++ b/src/fu-bluez-backend.c
|
||||
@@ -117,6 +117,7 @@ typedef struct {
|
||||
GDBusObjectManager *object_manager;
|
||||
GMainLoop *loop;
|
||||
GError **error;
|
||||
+ GCancellable *cancellable;
|
||||
guint timeout_id;
|
||||
} FuBluezBackendHelper;
|
||||
|
||||
@@ -127,6 +128,7 @@ fu_bluez_backend_helper_free (FuBluezBackendHelper *helper)
|
||||
g_object_unref (helper->object_manager);
|
||||
if (helper->timeout_id != 0)
|
||||
g_source_remove (helper->timeout_id);
|
||||
+ g_cancellable_cancel (helper->cancellable);
|
||||
g_main_loop_unref (helper->loop);
|
||||
g_free (helper);
|
||||
}
|
||||
@@ -148,12 +150,7 @@ static gboolean
|
||||
fu_bluez_backend_timeout_cb (gpointer user_data)
|
||||
{
|
||||
FuBluezBackendHelper *helper = (FuBluezBackendHelper *) user_data;
|
||||
- g_set_error (helper->error,
|
||||
- G_IO_ERROR,
|
||||
- G_IO_ERROR_TIMED_OUT,
|
||||
- "failed to connect to Bluez after %ums",
|
||||
- (guint) FU_BLUEZ_BACKEND_TIMEOUT);
|
||||
- g_main_loop_quit (helper->loop);
|
||||
+ g_cancellable_cancel (helper->cancellable);
|
||||
helper->timeout_id = 0;
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
@@ -168,6 +165,7 @@ fu_bluez_backend_setup (FuBackend *backend, GError **error)
|
||||
* forever and make fwupd startup also fail */
|
||||
helper->error = error;
|
||||
helper->loop = g_main_loop_new (NULL, FALSE);
|
||||
+ helper->cancellable = g_cancellable_new ();
|
||||
helper->timeout_id = g_timeout_add (FU_BLUEZ_BACKEND_TIMEOUT,
|
||||
fu_bluez_backend_timeout_cb,
|
||||
helper);
|
||||
@@ -176,7 +174,8 @@ fu_bluez_backend_setup (FuBackend *backend, GError **error)
|
||||
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
||||
"org.bluez",
|
||||
"/",
|
||||
- NULL, NULL, NULL, NULL,
|
||||
+ NULL, NULL, NULL,
|
||||
+ helper->cancellable,
|
||||
fu_bluez_backend_connect_cb,
|
||||
helper);
|
||||
g_main_loop_run (helper->loop);
|
@ -44,11 +44,14 @@
|
||||
Summary: Firmware update daemon
|
||||
Name: fwupd
|
||||
Version: 1.5.9
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/fwupd/fwupd
|
||||
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz
|
||||
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1949491
|
||||
Patch0: 3144.patch
|
||||
|
||||
BuildRequires: gettext
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: libxmlb-devel >= %{libxmlb_version}
|
||||
@ -494,6 +497,9 @@ done
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Wed Apr 14 2021 Andrew Thurman <ajtbecool@gmail.com> 1.5.9-2
|
||||
- Backport https://github.com/fwupd/fwupd/pull/3144 to fix https://bugzilla.redhat.com/show_bug.cgi?id=1949491
|
||||
|
||||
* Tue Apr 13 2021 Richard Hughes <richard@hughsie.com> 1.5.9-1
|
||||
- New upstream release
|
||||
- Avoid runtime warning in dfu-tool
|
||||
|
Loading…
Reference in New Issue
Block a user