This commit is contained in:
Peter Robinson 2024-01-14 14:08:03 +00:00
parent cff38f0609
commit 1edc3dc75d
5 changed files with 6 additions and 276 deletions

View File

@ -1,66 +0,0 @@
From 36f057d7f66c62fd01e0cf27cfe816bfd5be5d21 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
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

View File

@ -1,38 +0,0 @@
From 90b72b787a6ae6b9b0bf8ece238e108e8607a433 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Sat, 9 Nov 2013 18:13:43 +0100
Subject: [PATCH 1/2] obex: Use GLib helper function to manipulate paths
Instead of trying to do it by hand. This also makes sure that
relative paths aren't used by the agent.
---
obexd/src/manager.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/obexd/src/manager.c b/obexd/src/manager.c
index f84384ae4..285c07c37 100644
--- a/obexd/src/manager.c
+++ b/obexd/src/manager.c
@@ -650,14 +650,14 @@ static void agent_reply(DBusPendingCall *call, void *user_data)
DBUS_TYPE_STRING, &name,
DBUS_TYPE_INVALID)) {
/* Splits folder and name */
- const char *slash = strrchr(name, '/');
+ gboolean is_relative = !g_path_is_absolute(name);
DBG("Agent replied with %s", name);
- if (!slash) {
- agent->new_name = g_strdup(name);
+ if (is_relative) {
+ agent->new_name = g_path_get_basename(name);
agent->new_folder = NULL;
} else {
- agent->new_name = g_strdup(slash + 1);
- agent->new_folder = g_strndup(name, slash - name);
+ agent->new_name = g_path_get_basename(name);
+ agent->new_folder = g_path_get_dirname(name);
}
}
--
2.14.1

View File

@ -5,8 +5,8 @@
%endif
Name: bluez
Version: 5.71
Release: 3%{?dist}
Version: 5.72
Release: 1%{?dist}
Summary: Bluetooth utilities
License: GPLv2+
URL: http://www.bluez.org/
@ -14,14 +14,8 @@ URL: http://www.bluez.org/
Source0: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.xz
Source1: bluez.gitignore
# https://github.com/hadess/bluez/commits/obex-5.46
# Upstream's logic has changed so needs a rebase
#Patch1: 0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch
# 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
@ -337,6 +331,9 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%{_userunitdir}/obex.service
%changelog
* Sun Jan 14 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 5.72-1
- Update to 5.72
* Sun Jan 07 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 5.71-3
- Upstream fix for crash on A2DP audio suspend

View File

@ -1,163 +0,0 @@
From 7ad5669402c9acff8e4cc808edc12a41df36654e Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Wed, 20 Dec 2023 12:20:03 -0500
Subject: [PATCH] adapter: Fix link key address type for old kernels
On old kernels only BDADDR_BREDR is supported so this attempts to detect
that and retry.
Fixes: https://github.com/bluez/bluez/issues/686
---
src/adapter.c | 59 ++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 44 insertions(+), 15 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index ee70b00d2..022390f0d 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -311,6 +311,7 @@ struct btd_adapter {
bool pincode_requested; /* PIN requested during last bonding */
GSList *connections; /* Connected devices */
GSList *devices; /* Devices structure pointers */
+ GSList *load_keys; /* Devices keys to be loaded */
GSList *connect_list; /* Devices to connect when found */
struct btd_device *connect_le; /* LE device waiting to be connected */
sdp_list_t *services; /* Services associated to adapter */
@@ -4284,6 +4285,9 @@ static int set_privacy(struct btd_adapter *adapter, uint8_t privacy)
return -1;
}
+static void load_link_keys(struct btd_adapter *adapter, bool debug_keys,
+ bool retry);
+
static void load_link_keys_complete(uint8_t status, uint16_t length,
const void *param, void *user_data)
{
@@ -4293,18 +4297,31 @@ static void load_link_keys_complete(uint8_t status, uint16_t length,
btd_error(adapter->dev_id,
"Failed to load link keys for hci%u: %s (0x%02x)",
adapter->dev_id, mgmt_errstr(status), status);
+
+ if (status == MGMT_STATUS_INVALID_PARAMS) {
+ load_link_keys(adapter, btd_opts.debug_keys, true);
+ /* Release keys after retry since we shall only retry
+ * once.
+ */
+ goto done;
+ }
+
return;
}
DBG("link keys loaded for hci%u", adapter->dev_id);
+
+done:
+ g_slist_free_full(adapter->load_keys, g_free);
+ adapter->load_keys = NULL;
}
-static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
- bool debug_keys)
+static void load_link_keys(struct btd_adapter *adapter, bool debug_keys,
+ bool retry)
{
struct mgmt_cp_load_link_keys *cp;
struct mgmt_link_key_info *key;
- size_t key_count, cp_size;
+ size_t count, cp_size;
unsigned int id;
GSList *l;
@@ -4318,12 +4335,14 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
if (!(adapter->supported_settings & MGMT_SETTING_BREDR))
return;
- key_count = g_slist_length(keys);
+ count = g_slist_length(adapter->load_keys);
+ if (!count)
+ return;
- DBG("hci%u keys %zu debug_keys %d", adapter->dev_id, key_count,
- debug_keys);
+ DBG("hci%u keys %zu debug_keys %d retry %s", adapter->dev_id, count,
+ debug_keys, retry ? "true" : "false");
- cp_size = sizeof(*cp) + (key_count * sizeof(*key));
+ cp_size = sizeof(*cp) + (count * sizeof(*key));
cp = g_try_malloc0(cp_size);
if (cp == NULL) {
@@ -4341,13 +4360,18 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
* behavior for debug keys.
*/
cp->debug_keys = debug_keys;
- cp->key_count = htobs(key_count);
+ cp->key_count = htobs(count);
- for (l = keys, key = cp->keys; l != NULL; l = g_slist_next(l), key++) {
+ for (l = adapter->load_keys, key = cp->keys; l != NULL;
+ l = g_slist_next(l), key++) {
struct link_key_info *info = l->data;
bacpy(&key->addr.bdaddr, &info->bdaddr);
- key->addr.type = info->bdaddr_type;
+ /* Old kernels might only support loading with type set to
+ * BDADDR_BREDR so on retry set that instead of using the stored
+ * info.
+ */
+ key->addr.type = retry ? BDADDR_BREDR : info->bdaddr_type;
key->type = info->type;
memcpy(key->val, info->key, 16);
key->pin_len = info->pin_len;
@@ -4359,9 +4383,12 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
g_free(cp);
- if (id == 0)
+ if (id == 0) {
btd_error(adapter->dev_id, "Failed to load link keys for hci%u",
adapter->dev_id);
+ g_slist_free_full(adapter->load_keys, g_free);
+ adapter->load_keys = NULL;
+ }
}
static void load_ltks_complete(uint8_t status, uint16_t length,
@@ -4873,7 +4900,6 @@ static void load_defaults(struct btd_adapter *adapter)
static void load_devices(struct btd_adapter *adapter)
{
char dirname[PATH_MAX];
- GSList *keys = NULL;
GSList *ltks = NULL;
GSList *irks = NULL;
GSList *params = NULL;
@@ -4964,7 +4990,8 @@ static void load_devices(struct btd_adapter *adapter)
}
if (key_info)
- keys = g_slist_append(keys, key_info);
+ adapter->load_keys = g_slist_append(adapter->load_keys,
+ key_info);
if (ltk_info)
ltks = g_slist_append(ltks, ltk_info);
@@ -5013,8 +5040,7 @@ static void load_devices(struct btd_adapter *adapter)
closedir(dir);
- load_link_keys(adapter, keys, btd_opts.debug_keys);
- g_slist_free_full(keys, g_free);
+ load_link_keys(adapter, btd_opts.debug_keys, false);
load_ltks(adapter, ltks);
g_slist_free_full(ltks, g_free);
@@ -6930,6 +6956,9 @@ static void adapter_remove(struct btd_adapter *adapter)
g_slist_free(adapter->devices);
adapter->devices = NULL;
+ g_slist_free(adapter->load_keys);
+ adapter->load_keys = NULL;
+
discovery_cleanup(adapter, 0);
unload_drivers(adapter);

View File

@ -1 +1 @@
SHA512 (bluez-5.71.tar.xz) = 648394bbe470405aa0e2d3914474e95c122f567deaaac20a5dd74bac29fa430dfb64cdb7bdb4fb7510e62fa73e96112a97197fc212b421bf480b8d1bb24cfb5d
SHA512 (bluez-5.72.tar.xz) = 1c6560f60ac0654d7c25ed8ab2f0f3a3a9ca8688ee28e1c476ffc7ae38737e739d27bbb88789c86b03fc600a8a68496d90a7b395ec393dd2bbf69be62357991a