Skip to contentSkip to conversation

device: Attempt to elevate security on Pair while connected

PATCH Superseded Luiz Augusto von Dentz 2 participants 3 messages Mar 24, 2025 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/2 device: Attempt to elevate security on Pair while connected

From: Luiz Augusto von Dentz <[email protected]>

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

---
 src/device.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/device.c +4 -1
index 57577e57920a..a04eebe1dff6 100644
@@ -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);
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH v2 2/2 device: Make Connect and Pair mutually exclusive

From: Luiz Augusto von Dentz <[email protected]>

This makes Device.Connect and Device.Pair methods mutually exclusive so they cannot happen in parallel, so just as Connect:Connect and Pair:Pair combinations the Connect:Pair and Pair:Connect will now return org.bluez.Error.InProgress.

---
 src/device.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
src/device.c +7 -1
index a04eebe1dff6..6d80f86f5fbb 100644
@@ -2620,6 +2620,9 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
 	struct btd_device *dev = user_data;
 	uint8_t bdaddr_type;
 
+	if (dev->bonding)
+		return btd_error_in_progress(msg);
+
 	if (dev->bredr_state.connected) {
 		/*
 		 * Check if services have been resolved and there is at least
@@ -2639,6 +2642,9 @@ static DBusMessage *dev_connect(DBusConnection *conn, DBusMessage *msg,
 	if (bdaddr_type != BDADDR_BREDR) {
 		int err;
 
+		if (dev->connect)
+			return btd_error_in_progress(msg);
+
 		if (dev->le_state.connected)
 			return dbus_message_new_method_return(msg);
 
@@ -3124,7 +3130,7 @@ static DBusMessage *pair_device(DBusConnection *conn, DBusMessage *msg,
 	if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_INVALID))
 		return btd_error_invalid_args(msg);
 
-	if (device->bonding)
+	if (device->bonding || device->connect)
 		return btd_error_in_progress(msg);
 
 	/* Only use this selection algorithms when device is combo
Signature · 1 line
2.48.1
#2 lore raw
In reply to Luiz Augusto von Dentz

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=946951

---Test result---

Test Summary:

CheckPatch                    PENDING   0.51 seconds
GitLint                       PENDING   0.22 seconds
BuildEll                      PASS      20.39 seconds
BluezMake                     PASS      1517.36 seconds
MakeCheck                     PASS      13.08 seconds
MakeDistcheck                 PASS      155.76 seconds
CheckValgrind                 PASS      212.67 seconds
CheckSmatch                   PASS      286.63 seconds
bluezmakeextell               PASS      99.19 seconds
IncrementalBuild              PENDING   0.31 seconds
ScanBuild                     PASS      904.50 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