diff mbox series

[BlueZ,v1,1/2] adapter: Fix up address type when loading keys

Message ID 20240828153956.861220-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 366a8c522b648f47147de4852c5c030d69b916b3
Headers show
Series [BlueZ,v1,1/2] adapter: Fix up address type when loading keys | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz Aug. 28, 2024, 3:39 p.m. UTC
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(-)

Comments

bluez.test.bot@gmail.com Aug. 28, 2024, 6:09 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=884360

---Test result---

Test Summary:
CheckPatch                    FAIL      1.12 seconds
GitLint                       PASS      0.61 seconds
BuildEll                      PASS      24.67 seconds
BluezMake                     PASS      1628.74 seconds
MakeCheck                     PASS      13.10 seconds
MakeDistcheck                 PASS      178.68 seconds
CheckValgrind                 PASS      253.12 seconds
CheckSmatch                   PASS      357.20 seconds
bluezmakeextell               PASS      120.68 seconds
IncrementalBuild              PASS      2944.83 seconds
ScanBuild                     PASS      1002.49 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1,2/2] Revert "adapter: Fix link key address type for old kernels"
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '7ad5669402c9acff8e4cc808edc12a41df36654e', maybe rebased or not pulled?
#97: 
This reverts commit 7ad5669402c9acff8e4cc808edc12a41df36654e since it no

/github/workspace/src/src/13781508.patch total: 0 errors, 1 warnings, 136 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13781508.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org Aug. 28, 2024, 6:20 p.m. UTC | #2
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 mbox series

Patch

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);