linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yu Liu <yudiliu@google.com>
To: linux-bluetooth@vger.kernel.org
Cc: Yu Liu <yudiliu@google.com>
Subject: [Bluez PATCH v2] device: Disable auto connect for temporary devices
Date: Thu, 24 Sep 2020 16:19:58 -0700	[thread overview]
Message-ID: <20200924161949.Bluez.v2.1.Iedecbb8c8ebb111b14206dddc5bea3c40dfa1771@changeid> (raw)

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


             reply	other threads:[~2020-09-24 23:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 23:19 Yu Liu [this message]
2020-09-25 19:29 ` [Bluez,v2] device: Disable auto connect for temporary devices 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200924161949.Bluez.v2.1.Iedecbb8c8ebb111b14206dddc5bea3c40dfa1771@changeid \
    --to=yudiliu@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).