From cff38f0609198fef6905e3a9239e2a427925e50b Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 8 Jan 2024 19:19:04 +0000 Subject: [PATCH] Upstream fix for crash on A2DP audio suspend --- ...-transport-Fix-crash-on-A2DP-suspend.patch | 66 +++++++++++++++++++ bluez.spec | 7 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 0001-audio-transport-Fix-crash-on-A2DP-suspend.patch diff --git a/0001-audio-transport-Fix-crash-on-A2DP-suspend.patch b/0001-audio-transport-Fix-crash-on-A2DP-suspend.patch new file mode 100644 index 0000000..1139864 --- /dev/null +++ b/0001-audio-transport-Fix-crash-on-A2DP-suspend.patch @@ -0,0 +1,66 @@ +From 36f057d7f66c62fd01e0cf27cfe816bfd5be5d21 Mon Sep 17 00:00:00 2001 +From: Luiz Augusto von Dentz +Date: Tue, 2 Jan 2024 13:02:04 -0500 +Subject: [PATCH 1/3] audio: transport: Fix crash on A2DP suspend + +Commit 052534ae07b8 ("transport: Update transport release flow for +bcast src") introduced a crash where it assumes transport->data always +refers to struct bap_transport which causes a crash when the transport +is in fact A2DP. + +Fixes: https://github.com/bluez/bluez/issues/701 +--- + profiles/audio/transport.c | 16 +++++++++------- + 1 file changed, 9 insertions(+), 7 deletions(-) + +diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c +index e2073451c..0c60f06ee 100644 +--- a/profiles/audio/transport.c ++++ b/profiles/audio/transport.c +@@ -643,7 +643,6 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, + { + struct media_transport *transport = data; + struct media_owner *owner = transport->owner; +- struct bap_transport *bap = transport->data; + const char *sender; + struct media_request *req; + guint id; +@@ -675,11 +674,6 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, + req = media_request_create(msg, id); + media_owner_add(owner, req); + +- if (bt_bap_stream_get_type(bap->stream) == +- BT_BAP_STREAM_TYPE_BCAST) { +- bap_disable_complete(bap->stream, 0x00, 0x00, owner); +- } +- + return NULL; + } + +@@ -1416,6 +1410,7 @@ static guint suspend_bap(struct media_transport *transport, + { + struct bap_transport *bap = transport->data; + bt_bap_stream_func_t func = NULL; ++ guint id; + + if (!bap->stream) + return 0; +@@ -1427,7 +1422,14 @@ static guint suspend_bap(struct media_transport *transport, + + bap_update_links(transport); + +- return bt_bap_stream_disable(bap->stream, bap->linked, func, owner); ++ id = bt_bap_stream_disable(bap->stream, bap->linked, func, owner); ++ ++ if (bt_bap_stream_get_type(bap->stream) == BT_BAP_STREAM_TYPE_BCAST) { ++ bap_disable_complete(bap->stream, 0x00, 0x00, owner); ++ return 0; ++ } ++ ++ return id; + } + + static void cancel_bap(struct media_transport *transport, guint id) +-- +2.43.0 + diff --git a/bluez.spec b/bluez.spec index 34cc13f..e5993ea 100644 --- a/bluez.spec +++ b/bluez.spec @@ -6,7 +6,7 @@ Name: bluez Version: 5.71 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Bluetooth utilities License: GPLv2+ URL: http://www.bluez.org/ @@ -20,6 +20,8 @@ Source1: bluez.gitignore # https://lore.kernel.org/linux-bluetooth/20220901110719.176944-1-hadess@hadess.net/T/#m9c08d004cd5422783ee1d93154f42303bba9169f Patch2: power-state-adapter-property.patch Patch3: ghi-686.patch +# GH 701 +Patch4: 0001-audio-transport-Fix-crash-on-A2DP-suspend.patch BuildRequires: dbus-devel >= 1.6 BuildRequires: glib2-devel @@ -335,6 +337,9 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/ %{_userunitdir}/obex.service %changelog +* Sun Jan 07 2024 Peter Robinson - 5.71-3 +- Upstream fix for crash on A2DP audio suspend + * Fri Dec 29 2023 Peter Robinson - 5.71-2 - Fix link key address type for old kernels