diff mbox series

[BlueZ,v2] Disable auto-connect on device remove

Message ID 20200909123943.BlueZ.v2.1.I588558f1e38231193d6e955a4008ce54712d5c89@changeid (mailing list archive)
State New, archived
Headers show
Series [BlueZ,v2] Disable auto-connect on device remove | expand

Commit Message

Manish Mandlik Sept. 9, 2020, 7:40 p.m. UTC
Auto-connect is not disabled when a device is removed. So in case the
pairing is cancelled, the device is removed, but it stays in the kernel
auto-connect list. This causes future advertisement from that device to
trigger a pairing even if the user has already cancelled the pairing.

This patch disables auto-connect on device remove.

Signed-off-by: Manish Mandlik <mmandlik@google.com>
---

Changes in v2:
- Disable auto-connect on device remove instead of pairing cancel as this
  is the main culprit of the issue.
- Updated the title from "Disable auto-connect on cancel pair" to "Disable
  auto-connect on device remove"

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

Comments

Luiz Augusto von Dentz Sept. 9, 2020, 11:17 p.m. UTC | #1
Hi Manish,

On Wed, Sep 9, 2020 at 12:40 PM Manish Mandlik <mmandlik@google.com> wrote:
>
> Auto-connect is not disabled when a device is removed. So in case the
> pairing is cancelled, the device is removed, but it stays in the kernel
> auto-connect list. This causes future advertisement from that device to
> trigger a pairing even if the user has already cancelled the pairing.
>
> This patch disables auto-connect on device remove.
>
> Signed-off-by: Manish Mandlik <mmandlik@google.com>
> ---
>
> Changes in v2:
> - Disable auto-connect on device remove instead of pairing cancel as this
>   is the main culprit of the issue.
> - Updated the title from "Disable auto-connect on cancel pair" to "Disable
>   auto-connect on device remove"
>
>  src/device.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/device.c b/src/device.c
> index df440ce09..8f73ce4d3 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -4447,6 +4447,11 @@ void device_remove(struct btd_device *device, gboolean remove_stored)
>  {
>         DBG("Removing device %s", device->path);
>
> +       if (device->auto_connect) {
> +               device->disable_auto_connect = TRUE;
> +               device_set_auto_connect(device, FALSE);
> +       }
> +
>         if (device->bonding) {
>                 uint8_t status;
>
> --
> 2.28.0.526.ge36021eeef-goog
>

Appled, thanks.
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index df440ce09..8f73ce4d3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -4447,6 +4447,11 @@  void device_remove(struct btd_device *device, gboolean remove_stored)
 {
 	DBG("Removing device %s", device->path);
 
+	if (device->auto_connect) {
+		device->disable_auto_connect = TRUE;
+		device_set_auto_connect(device, FALSE);
+	}
+
 	if (device->bonding) {
 		uint8_t status;