linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Bluez PATCH v2] device: Disable auto connect for temporary devices
@ 2020-09-24 23:19 Yu Liu
  2020-09-25 19:29 ` [Bluez,v2] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Yu Liu @ 2020-09-24 23:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yu Liu

When connecting a LE keyboard, if the user input the wrong passkey, the
stack would keep auto connect and thus allow the user to retry the
passkey indefinitely which is a security concern. This fix would
disallow the auto connect if the authentication failed.

---

Changes in v2:
- Move the logic into btd_device_set_temporary

Changes in v1:
- Initial change

 src/device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/device.c b/src/device.c
index a4b5968d4..a5ef46730 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5684,6 +5684,10 @@ void btd_device_set_temporary(struct btd_device *device, bool temporary)
 		if (device->bredr)
 			adapter_whitelist_remove(device->adapter, device);
 		adapter_connect_list_remove(device->adapter, device);
+		if (device->auto_connect) {
+			device->disable_auto_connect = TRUE;
+			device_set_auto_connect(device, FALSE);
+		}
 		device->temporary_timer = g_timeout_add_seconds(main_opts.tmpto,
 							device_disappeared,
 							device);
-- 
2.28.0.681.g6f77f65b4e-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [Bluez,v2] device: Disable auto connect for temporary devices
  2020-09-24 23:19 [Bluez PATCH v2] device: Disable auto connect for temporary devices Yu Liu
@ 2020-09-25 19:29 ` bluez.test.bot
  2020-09-28 23:21   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: bluez.test.bot @ 2020-09-25 19:29 UTC (permalink / raw)
  To: linux-bluetooth, yudiliu

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

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

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Bluez,v2] device: Disable auto connect for temporary devices
  2020-09-25 19:29 ` [Bluez,v2] " bluez.test.bot
@ 2020-09-28 23:21   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2020-09-28 23:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yu Liu

Hi Yu Liu,

On Fri, Sep 25, 2020 at 1:51 PM <bluez.test.bot@gmail.com> wrote:
>
> 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=355131
>
> ---Test result---
>
> ##############################
> Test: CheckPatch - PASS
>
> ##############################
> Test: CheckGitLint - PASS
>
> ##############################
> Test: CheckBuild - PASS
>
> ##############################
> Test: MakeCheck - PASS
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bluez PATCH v2] device: Disable auto connect for temporary devices
@ 2020-09-24 23:17 Yu Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Yu Liu @ 2020-09-24 23:17 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yu Liu

When connecting a LE keyboard, if the user input the wrong passkey, the
stack would keep auto connect and thus allow the user to retry the
passkey indefinitely which is a security concern. This fix would
disallow the auto connect if the authentication failed.

---

Changes in v2:
- Move the logic into btd_device_set_temporary

Changes in v1:
- Initial change

 src/device.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index a4b5968d4..13159d927 100644
--- a/src/device.c
+++ b/src/device.c
@@ -5684,6 +5684,10 @@ void btd_device_set_temporary(struct btd_device *device, bool temporary)
 		if (device->bredr)
 			adapter_whitelist_remove(device->adapter, device);
 		adapter_connect_list_remove(device->adapter, device);
+		if (device->auto_connect) {
+			device->disable_auto_connect = TRUE;
+			device_set_auto_connect(device, FALSE);
+		}
 		device->temporary_timer = g_timeout_add_seconds(main_opts.tmpto,
 							device_disappeared,
 							device);
@@ -6036,8 +6040,9 @@ void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
 		 * treated as a newly discovered device.
 		 */
 		if (!device_is_paired(device, bdaddr_type) &&
-				!device_is_trusted(device))
+				!device_is_trusted(device)) {
 			btd_device_set_temporary(device, true);
+		}
 
 		device_bonding_failed(device, status);
 		return;
-- 
2.28.0.681.g6f77f65b4e-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-28 23:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 23:19 [Bluez PATCH v2] device: Disable auto connect for temporary devices Yu Liu
2020-09-25 19:29 ` [Bluez,v2] " bluez.test.bot
2020-09-28 23:21   ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2020-09-24 23:17 [Bluez PATCH v2] " Yu Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).