Message ID | 20240828153956.861220-1-luiz.dentz@gmail.com |
---|---|
State | New |
Headers | show |
Series | [BlueZ,v1,1/2] adapter: Fix up address type when loading keys | expand |
Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Wed, 28 Aug 2024 11:39:55 -0400 you wrote: > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> > > Due to kernel change 59b047bc9808 > ("Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE") > some keys maybe store using the wrong/invalid address type as per MGMT > API, so this attempts to fix them up. > > [...] Here is the summary with links: - [BlueZ,v1,1/2] adapter: Fix up address type when loading keys https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=366a8c522b64 - [BlueZ,v1,2/2] Revert "adapter: Fix link key address type for old kernels" https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d6515f4ca7d4 You are awesome, thank you!
diff --git a/src/adapter.c b/src/adapter.c index 245de4456868..9f44bdefa5f4 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -5017,12 +5017,28 @@ static void load_devices(struct btd_adapter *adapter) goto free; } - if (key_info) + if (key_info) { + /* Fix up address type if it was stored with the wrong + * address type since Load Link Keys are only meant to + * work with BR/EDR addresses as per MGMT documentation. + */ + if (key_info->bdaddr_type != BDADDR_BREDR) + key_info->bdaddr_type = BDADDR_BREDR; + adapter->load_keys = g_slist_append(adapter->load_keys, key_info); + } + + if (ltk_info) { + /* Fix up address type if it was stored with the wrong + * address type since Load Long Term Keys are only meant + * to work with LE addresses as per MGMT documentation. + */ + if (ltk_info->bdaddr_type == BDADDR_BREDR) + ltk_info->bdaddr_type = BDADDR_LE_PUBLIC; - if (ltk_info) ltks = g_slist_append(ltks, ltk_info); + } if (peripheral_ltk_info) ltks = g_slist_append(ltks, peripheral_ltk_info);
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Due to kernel change 59b047bc9808 ("Bluetooth: MGMT/SMP: Fix address type when using SMP over BREDR/LE") some keys maybe store using the wrong/invalid address type as per MGMT API, so this attempts to fix them up. Fixes: https://github.com/bluez/bluez/issues/875 --- src/adapter.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)