Skip to contentSkip to conversation

client/mgmt: Fix registering pairing callbacks

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Oct 3, 2023 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 client/mgmt: Fix registering pairing callbacks

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

Don't register pairing callbacks until mgmt.pair is called otherwise it may take over the role of pairing agent when bluetoothctl agent is in use.

---
 client/mgmt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
client/mgmt.c +14 -8
index c056d018a9da..947d8fcd5556 100644
@@ -3056,6 +3056,18 @@ static void pair_rsp(uint8_t status, uint16_t len, const void *param,
 	bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
+static void register_pair_callbacks(struct mgmt *mgmt, uint16_t index)
+{
+	mgmt_register(mgmt, MGMT_EV_PIN_CODE_REQUEST, index, request_pin,
+								mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_USER_CONFIRM_REQUEST, index, user_confirm,
+								mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_USER_PASSKEY_REQUEST, index,
+						request_passkey, mgmt, NULL);
+	mgmt_register(mgmt, MGMT_EV_PASSKEY_NOTIFY, index,
+						passkey_notify, mgmt, NULL);
+}
+
 static struct option pair_options[] = {
 	{ "help",	0, 0, 'h' },
 	{ "capability",	1, 0, 'c' },
@@ -3105,6 +3117,8 @@ static void cmd_pair(int argc, char **argv)
 	if (index == MGMT_INDEX_NONE)
 		index = 0;
 
+	register_pair_callbacks(mgmt, index);
+
 	memset(&cp, 0, sizeof(cp));
 	str2ba(argv[0], &cp.addr.bdaddr);
 	cp.addr.type = type;
@@ -5780,14 +5794,6 @@ static void register_mgmt_callbacks(struct mgmt *mgmt, uint16_t index)
 					local_name_changed, NULL, NULL);
 	mgmt_register(mgmt, MGMT_EV_DEVICE_FOUND, index, device_found,
 								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_PIN_CODE_REQUEST, index, request_pin,
-								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_USER_CONFIRM_REQUEST, index, user_confirm,
-								mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_USER_PASSKEY_REQUEST, index,
-						request_passkey, mgmt, NULL);
-	mgmt_register(mgmt, MGMT_EV_PASSKEY_NOTIFY, index,
-						passkey_notify, mgmt, NULL);
 	mgmt_register(mgmt, MGMT_EV_UNCONF_INDEX_ADDED, index,
 					unconf_index_added, NULL, NULL);
 	mgmt_register(mgmt, MGMT_EV_UNCONF_INDEX_REMOVED, index,
Signature · 1 line
2.41.0
#1 lore raw

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

---Test result---

Test Summary:

CheckPatch                    PASS      0.38 seconds
GitLint                       PASS      0.26 seconds
BuildEll                      PASS      27.84 seconds
BluezMake                     PASS      783.27 seconds
MakeCheck                     PASS      12.19 seconds
MakeDistcheck                 PASS      160.83 seconds
CheckValgrind                 PASS      255.32 seconds
CheckSmatch                   PASS      348.54 seconds
bluezmakeextell               PASS      106.02 seconds
IncrementalBuild              PASS      659.30 seconds
ScanBuild                     PASS      1041.71 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 3 Oct 2023 14:14:42 -0700 you wrote:

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

Don't register pairing callbacks until mgmt.pair is called otherwise it may take over the role of pairing agent when bluetoothctl agent is in use.

---
 client/mgmt.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

Here is the summary with links:
- [BlueZ] client/mgmt: Fix registering pairing callbacks

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9741e47aebcd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html