diff mbox series

[BlueZ,v1] device: Attempt to elevate security on Pair while connected

Message ID 20250321200527.1733821-1-luiz.dentz@gmail.com
State Superseded
Headers show
Series [BlueZ,v1] device: Attempt to elevate security on Pair while connected | expand

Commit Message

Luiz Augusto von Dentz March 21, 2025, 8:05 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This would make Pair act behave the same as when the device reconnect
and bonding already exists.

Fixes: https://github.com/bluez/bluez/issues/1125
---
 src/device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com March 21, 2025, 9:12 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=946413

---Test result---

Test Summary:
CheckPatch                    PENDING   0.22 seconds
GitLint                       PENDING   0.27 seconds
BuildEll                      PASS      20.44 seconds
BluezMake                     PASS      1558.49 seconds
MakeCheck                     PASS      13.42 seconds
MakeDistcheck                 PASS      159.45 seconds
CheckValgrind                 PASS      215.37 seconds
CheckSmatch                   PASS      284.29 seconds
bluezmakeextell               PASS      98.23 seconds
IncrementalBuild              PENDING   0.30 seconds
ScanBuild                     PASS      868.20 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 57577e57920a..a04eebe1dff6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3185,10 +3185,13 @@  static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
 
 		if (!state->connected && btd_le_connect_before_pairing())
 			err = device_connect_le(device);
-		else
+		else if (!state->connected || !bt_att_set_security(device->att,
+						BT_ATT_SECURITY_MEDIUM))
 			err = adapter_create_bonding(adapter, &device->bdaddr,
 							device->bdaddr_type,
 							io_cap);
+		else
+			err = 0;
 	} else {
 		err = adapter_create_bonding(adapter, &device->bdaddr,
 							BDADDR_BREDR, io_cap);