diff options
| author | Hiago De Franco <hiago.franco@toradex.com> | 2025-01-07 16:23:01 -0300 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-01-18 06:26:45 -0800 |
| commit | 9794a5ad9ef39672cc059e18dabc7469aa93760c (patch) | |
| tree | 77a66cf7a8a5a789a5024f0bb0de45da6361ec90 | |
| parent | 54b2e90c01001cebb5f5947fbd6c4e50d701df69 (diff) | |
| download | poky-9794a5ad9ef39672cc059e18dabc7469aa93760c.tar.gz | |
bluez5: backport patch to fix address type when loading keys
With Linux kernel v6.6, due to commit 59b047bc9808 ("Bluetooth:
MGMT/SMP: Fix address type when using SMP over BREDR/LE"), an error
might occur when trying to automatically repair a bluetooth device, as
the key might store using a wrong/invalid address type. This happens
only with bluez5 version 5.72:
HCI Event: Link Key Request (0x17) plen 6 bdaddr 8C:98:6B:7A:BD:F0
HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6 bdaddr 8C:98:6B:7A:BD:F0
This was already solved upstream, therefore backport the patch to fix
this issue.
(From OE-Core rev: d719d02f2f3ce8f54de0e10d89a8d389edb61fed)
Signed-off-by: Hiago De Franco <hiago.franco@toradex.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-up-address-type-when-loading-keys.patch | 52 |
2 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc index 3f2f096aac..9cbeb5e99f 100644 --- a/meta/recipes-connectivity/bluez5/bluez5.inc +++ b/meta/recipes-connectivity/bluez5/bluez5.inc | |||
| @@ -54,6 +54,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \ | |||
| 54 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ | 54 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ |
| 55 | file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ | 55 | file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ |
| 56 | file://0001-test-gatt-Fix-hung-issue.patch \ | 56 | file://0001-test-gatt-Fix-hung-issue.patch \ |
| 57 | file://0001-adapter-Fix-up-address-type-when-loading-keys.patch \ | ||
| 57 | " | 58 | " |
| 58 | S = "${WORKDIR}/bluez-${PV}" | 59 | S = "${WORKDIR}/bluez-${PV}" |
| 59 | 60 | ||
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-up-address-type-when-loading-keys.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-up-address-type-when-loading-keys.patch new file mode 100644 index 0000000000..a2c067b5fa --- /dev/null +++ b/meta/recipes-connectivity/bluez5/bluez5/0001-adapter-Fix-up-address-type-when-loading-keys.patch | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | From 366a8c522b648f47147de4852c5c030d69b916b3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | ||
| 3 | Date: Wed, 28 Aug 2024 11:30:16 -0400 | ||
| 4 | Subject: [PATCH] adapter: Fix up address type when loading keys | ||
| 5 | |||
| 6 | Due to kernel change 59b047bc9808 | ||
| 7 | ("Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE") | ||
| 8 | some keys maybe store using the wrong/invalid address type as per MGMT | ||
| 9 | API, so this attempts to fix them up. | ||
| 10 | |||
| 11 | Fixes: https://github.com/bluez/bluez/issues/875 | ||
| 12 | Upstream-Status: Backport [366a8c522b648f47147de4852c5c030d69b916b3] | ||
| 13 | Signed-off-by: Hiago De Franco <hiago.franco@toradex.com> | ||
| 14 | --- | ||
| 15 | src/adapter.c | 20 ++++++++++++++++++-- | ||
| 16 | 1 file changed, 18 insertions(+), 2 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/src/adapter.c b/src/adapter.c | ||
| 19 | index 245de4456868..9f44bdefa5f4 100644 | ||
| 20 | --- a/src/adapter.c | ||
| 21 | +++ b/src/adapter.c | ||
| 22 | @@ -5017,12 +5017,28 @@ static void load_devices(struct btd_adapter *adapter) | ||
| 23 | goto free; | ||
| 24 | } | ||
| 25 | |||
| 26 | - if (key_info) | ||
| 27 | + if (key_info) { | ||
| 28 | + /* Fix up address type if it was stored with the wrong | ||
| 29 | + * address type since Load Link Keys are only meant to | ||
| 30 | + * work with BR/EDR addresses as per MGMT documentation. | ||
| 31 | + */ | ||
| 32 | + if (key_info->bdaddr_type != BDADDR_BREDR) | ||
| 33 | + key_info->bdaddr_type = BDADDR_BREDR; | ||
| 34 | + | ||
| 35 | adapter->load_keys = g_slist_append(adapter->load_keys, | ||
| 36 | key_info); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + if (ltk_info) { | ||
| 40 | + /* Fix up address type if it was stored with the wrong | ||
| 41 | + * address type since Load Long Term Keys are only meant | ||
| 42 | + * to work with LE addresses as per MGMT documentation. | ||
| 43 | + */ | ||
| 44 | + if (ltk_info->bdaddr_type == BDADDR_BREDR) | ||
| 45 | + ltk_info->bdaddr_type = BDADDR_LE_PUBLIC; | ||
| 46 | |||
| 47 | - if (ltk_info) | ||
| 48 | ltks = g_slist_append(ltks, ltk_info); | ||
| 49 | + } | ||
| 50 | |||
| 51 | if (peripheral_ltk_info) | ||
| 52 | ltks = g_slist_append(ltks, peripheral_ltk_info); | ||
