2020-10-29 09:03:42

by Sathish Narasimman

[permalink] [raw]
Subject: [PATCH] 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

Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating whitelist")

Signed-off-by: Sathish Narasimman <[email protected]>
---
net/bluetooth/hci_request.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 6f12bab4d2fa..610ed0817bd7 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -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;
}
--
2.17.1


2020-11-03 02:05:49

by Sathish Narasimman

[permalink] [raw]
Subject: RE: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect

Hi

> -----Original Message-----
> From: Sathish Narasimman <[email protected]>
> Sent: Thursday, October 29, 2020 1:18 PM
> To: [email protected]
> Cc: Tumkur Narayan, Chethan <[email protected]>;
> Srivatsa, Ravishankar <[email protected]>; K, Kiran
> <[email protected]>; Narasimman, Sathish
> <[email protected]>
> Subject: [PATCH] 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
>
> Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating
> whitelist")
>
> Signed-off-by: Sathish Narasimman <[email protected]>
> ---
> net/bluetooth/hci_request.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c index
> 6f12bab4d2fa..610ed0817bd7 100644
> --- a/net/bluetooth/hci_request.c
> +++ b/net/bluetooth/hci_request.c
> @@ -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;
> }
> --
> 2.17.1

Gentle Reminder

Regards
Sathish N

2020-11-09 12:42:50

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect

Hi Sathish,

> 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
>
> Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating whitelist")
>
> Signed-off-by: Sathish Narasimman <[email protected]>
> ---
> net/bluetooth/hci_request.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel

2020-12-26 17:06:27

by Kan-Ru Chen

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect

Hi,

Marcel Holtmann <[email protected]> writes:

> Hi Sathish,
>
>> 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
>>
>> Fixes: 0eee35bdfa3b ("Bluetooth: Update resolving list when updating whitelist")
>>
>> Signed-off-by: Sathish Narasimman <[email protected]>
>> ---
>> net/bluetooth/hci_request.c | 12 ++++++++----
>> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> patch has been applied to bluetooth-next tree.

Can we also apply this patch to the 5.10 stable tree?

Thanks,
Kanru