Skip to contentSkip to conversation

Bluetooth: Fix: LL PRivacy BLE device fails to connect

PATCH In review Sathish Narasimman 3 participants 5 messages Oct 22, 2020 – Oct 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Fix: LL PRivacy BLE device fails to connect

When adding device to white list the device is added to resolving list also it has to be added only when HCI_ENABLE_LL_PRIVACY flag is set. HCI_ENABLE_LL_PRIVACY flag has to be tested before adding/deleting devices to resolving list. use_ll_privacy macro is used only to check if controller supports LL_Privacy.

https://bugzilla.kernel.org/show_bug.cgi?id=209745

---
 net/bluetooth/hci_request.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/bluetooth/hci_request.c +8 -4
index 6f12bab4d2fa..610ed0817bd7 100644
@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
 		   cp.bdaddr_type);
 	hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
 
-	if (use_ll_privacy(req->hdev)) {
+	if (use_ll_privacy(req->hdev) &&
+	    hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
 		struct smp_irk *irk;
 
 		irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
@@ -732,7 +733,8 @@ static int add_to_white_list(struct hci_request *req,
 		return -1;
 
 	/* White list can not be used with RPAs */
-	if (!allow_rpa && !use_ll_privacy(hdev) &&
+	if (!allow_rpa &&
+	    !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
 	    hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
 		return -1;
 	}
@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request *req,
 		   cp.bdaddr_type);
 	hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
 
-	if (use_ll_privacy(hdev)) {
+	if (use_ll_privacy(hdev) &&
+	    hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
 		struct smp_irk *irk;
 
 		irk = hci_find_irk_by_addr(hdev, &params->addr,
@@ -812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req)
 		}
 
 		/* White list can not be used with RPAs */
-		if (!allow_rpa && !use_ll_privacy(hdev) &&
+		if (!allow_rpa &&
+		    !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
 		    hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
 			return 0x00;
 		}
Signature · 1 line
2.17.1
#1 lore raw

Hi

Quoted 59 lines · Sathish Narasimman

When adding device to white list the device is added to resolving list also it has to be added only when HCI_ENABLE_LL_PRIVACY flag is set. HCI_ENABLE_LL_PRIVACY flag has to be tested before adding/deleting devices to resolving list. use_ll_privacy macro is used only to check if controller supports LL_Privacy.

https://bugzilla.kernel.org/show_bug.cgi?id=209745

---
 net/bluetooth/hci_request.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/bluetooth/hci_request.c +8 -5
index 6f12bab4d2fa..610ed0817bd7 100644
@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(req->hdev)) {
+       if (use_ll_privacy(req->hdev) &&
+           hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
@@ -732,7 +733,8 @@ static int add_to_white_list(struct hci_request *req,
                return -1;
 
        /* White list can not be used with RPAs */
-       if (!allow_rpa && !use_ll_privacy(hdev) &&
+       if (!allow_rpa &&
+           !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
            hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
                return -1;
        }
@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request *req,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(hdev)) {
+       if (use_ll_privacy(hdev) &&
+           hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(hdev, &params->addr,
@@ -812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req)
                }
 
                /* White list can not be used with RPAs */
-               if (!allow_rpa && !use_ll_privacy(hdev) &&
+               if (!allow_rpa &&
+                   !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
                    hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
                        return 0x00;
                }
--
Quoted 2 lines

2.17.1

Gentle reminder.
Seems Many devices are failing to reconnect after every on 5.9 kernel

This patch will FIX the issue

Regards
Sathish N

#2 lore raw

Hi Sathish,

Quoted 70 lines · Sathish Narasimman

Hi

Quoted 59 lines · Sathish Narasimman

When adding device to white list the device is added to resolving list also it has to be added only when HCI_ENABLE_LL_PRIVACY flag is set. HCI_ENABLE_LL_PRIVACY flag has to be tested before adding/deleting devices to resolving list. use_ll_privacy macro is used only to check if controller supports LL_Privacy.

https://bugzilla.kernel.org/show_bug.cgi?id=209745

---
 net/bluetooth/hci_request.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/bluetooth/hci_request.c +8 -5
index 6f12bab4d2fa..610ed0817bd7 100644
@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(req->hdev)) {
+       if (use_ll_privacy(req->hdev) &&
+           hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
@@ -732,7 +733,8 @@ static int add_to_white_list(struct hci_request *req,
                return -1;
 
        /* White list can not be used with RPAs */
-       if (!allow_rpa && !use_ll_privacy(hdev) &&
+       if (!allow_rpa &&
+           !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
            hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
                return -1;
        }
@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request *req,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(hdev)) {
+       if (use_ll_privacy(hdev) &&
+           hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(hdev, &params->addr,
@@ -812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req)
                }
 
                /* White list can not be used with RPAs */
-               if (!allow_rpa && !use_ll_privacy(hdev) &&
+               if (!allow_rpa &&
+                   !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
                    hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
                        return 0x00;
                }
--
Quoted 2 lines

2.17.1

Gentle reminder.
Seems Many devices are failing to reconnect after every on 5.9 kernel

Quoted 1 line

This patch will FIX the issue

Btw, you should probably mention the commit id that introduced this regression.

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw

Hi Luiz

Quoted 90 lines

-----Original Message-----
From: Luiz Augusto von Dentz <[email protected]>
Sent: Thursday, October 29, 2020 5:52 AM
To: Sathish Narasimman <[email protected]>
Cc: Bluez mailing list <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; Srivatsa, Ravishankar <[email protected]>; K, Kiran <[email protected]>; Narasimman, Sathish <[email protected]>
Subject: Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect

Hi Sathish,

Quoted 4 lines · Sathish Narasimman

Hi

On Thu, Oct 22, 2020 at 1:47 PM Sathish Narasimman

Quoted 14 lines · <[email protected]> wrote:
Quoted 14 lines

When adding device to white list the device is added to resolving list also it has to be added only when HCI_ENABLE_LL_PRIVACY flag is set. HCI_ENABLE_LL_PRIVACY flag has to be tested before adding/deleting devices to resolving list. use_ll_privacy macro is used only to check if controller supports LL_Privacy.

https://bugzilla.kernel.org/show_bug.cgi?id=209745

---
 net/bluetooth/hci_request.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
Quoted 6 lines

net/bluetooth/hci_request.c static void del_from_white_list(struct hci_request

Quoted 6 lines
(quoted diff) +0 -0

b/net/bluetooth/hci_request.c index 6f12bab4d2fa..610ed0817bd7 100644

net/bluetooth/hci_request.c +0 -0
@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request

*req, bdaddr_t *bdaddr,

Quoted 11 lines
Quoted 11 lines
net/bluetooth/hci_request.c +2 -1
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp),
 &cp);
 
-       if (use_ll_privacy(req->hdev)) {
+       if (use_ll_privacy(req->hdev) &&
+           hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(req->hdev, bdaddr,

bdaddr_type); @@ -732,7 +733,8 @@ static int add_to_white_list(struct

hci_request *req,

Quoted 7 lines

net/bluetooth/hci_request.c static int add_to_white_list(struct hci_request *req,

Quoted 7 lines
                return -1;

        /* White list can not be used with RPAs */
net/bluetooth/hci_request.c +2 -1
-       if (!allow_rpa && !use_ll_privacy(hdev) &&
+       if (!allow_rpa &&
+           !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
            hci_find_irk_by_addr(hdev, &params->addr, params->addr_type))

{

Quoted 3 lines

net/bluetooth/hci_request.c static int add_to_white_list(struct hci_request

Quoted 3 lines
                return -1;
        }
net/bluetooth/hci_request.c +0 -0
@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request

*req,

Quoted 26 lines
Quoted 24 lines
net/bluetooth/hci_request.c +2 -1
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp),
 &cp);
 
-       if (use_ll_privacy(hdev)) {
+       if (use_ll_privacy(hdev) &&
+           hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(hdev, &params->addr, @@
-812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req)
                }

                /* White list can not be used with RPAs */
net/bluetooth/hci_request.c +3 -2
-               if (!allow_rpa && !use_ll_privacy(hdev) &&
+               if (!allow_rpa &&
+                   !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)
+ &&
                    hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
                        return 0x00;
                }
--

2.17.1

Quoted 7 lines
Quoted 4 lines

Gentle reminder.
Seems Many devices are failing to reconnect after every on 5.9 kernel

This patch will FIX the issue

Btw, you should probably mention the commit id that introduced this regression.

Will update the same in v2 of the patch

Quoted 3 lines

--
Luiz Augusto von Dentz

maintainer Reviewed-by on v1 1/1
#4 lore raw
In reply to Sathish Narasimman

Hi Sathish,

Quoted 59 lines · Sathish Narasimman

When adding device to white list the device is added to resolving list also it has to be added only when HCI_ENABLE_LL_PRIVACY flag is set. HCI_ENABLE_LL_PRIVACY flag has to be tested before adding/deleting devices to resolving list. use_ll_privacy macro is used only to check if controller supports LL_Privacy.

https://bugzilla.kernel.org/show_bug.cgi?id=209745

---
 net/bluetooth/hci_request.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
net/bluetooth/hci_request.c +8 -5
index 6f12bab4d2fa..610ed0817bd7 100644
@@ -698,7 +698,8 @@ static void del_from_white_list(struct hci_request *req, bdaddr_t *bdaddr,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(req->hdev)) {
+       if (use_ll_privacy(req->hdev) &&
+           hci_dev_test_flag(req->hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(req->hdev, bdaddr, bdaddr_type);
@@ -732,7 +733,8 @@ static int add_to_white_list(struct hci_request *req,
                return -1;
 
        /* White list can not be used with RPAs */
-       if (!allow_rpa && !use_ll_privacy(hdev) &&
+       if (!allow_rpa &&
+           !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
            hci_find_irk_by_addr(hdev, &params->addr, params->addr_type)) {
                return -1;
        }
@@ -750,7 +752,8 @@ static int add_to_white_list(struct hci_request *req,
                   cp.bdaddr_type);
        hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
 
-       if (use_ll_privacy(hdev)) {
+       if (use_ll_privacy(hdev) &&
+           hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY)) {
                struct smp_irk *irk;
 
                irk = hci_find_irk_by_addr(hdev, &params->addr,
@@ -812,7 +815,8 @@ static u8 update_white_list(struct hci_request *req)
                }
 
                /* White list can not be used with RPAs */
-               if (!allow_rpa && !use_ll_privacy(hdev) &&
+               if (!allow_rpa &&
+                   !hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY) &&
                    hci_find_irk_by_addr(hdev, &b->bdaddr, b->bdaddr_type)) {
                        return 0x00;
                }
--
Quoted 2 lines

2.17.1

Signature · 1 line
Luiz Augusto von Dentz