linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
@ 2020-10-29  7:48 Sathish Narasimman
  2020-11-03  2:05 ` Narasimman, Sathish
  2020-11-09 12:41 ` Marcel Holtmann
  0 siblings, 2 replies; 9+ messages in thread
From: Sathish Narasimman @ 2020-10-29  7:48 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: chethan.tumkur.narayan, ravishankar.srivatsa, kiran.k,
	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

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

Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
---
 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


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

* RE: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-29  7:48 [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect Sathish Narasimman
@ 2020-11-03  2:05 ` Narasimman, Sathish
  2020-11-09 12:41 ` Marcel Holtmann
  1 sibling, 0 replies; 9+ messages in thread
From: Narasimman, Sathish @ 2020-11-03  2:05 UTC (permalink / raw)
  To: Sathish Narasimman, linux-bluetooth, Narasimman, Sathish
  Cc: Tumkur Narayan, Chethan, Srivatsa, Ravishankar, K, Kiran

Hi

> -----Original Message-----
> From: Sathish Narasimman <nsathish41@gmail.com>
> Sent: Thursday, October 29, 2020 1:18 PM
> To: linux-bluetooth@vger.kernel.org
> Cc: Tumkur Narayan, Chethan <chethan.tumkur.narayan@intel.com>;
> Srivatsa, Ravishankar <ravishankar.srivatsa@intel.com>; K, Kiran
> <kiran.k@intel.com>; Narasimman, Sathish
> <sathish.narasimman@intel.com>
> 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 <sathish.narasimman@intel.com>
> ---
>  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


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

* Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-29  7:48 [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect Sathish Narasimman
  2020-11-03  2:05 ` Narasimman, Sathish
@ 2020-11-09 12:41 ` Marcel Holtmann
  2020-12-26 17:02   ` Kan-Ru Chen
  1 sibling, 1 reply; 9+ messages in thread
From: Marcel Holtmann @ 2020-11-09 12:41 UTC (permalink / raw)
  To: Sathish Narasimman
  Cc: open list:BLUETOOTH DRIVERS, Chethan T N, Srivatsa, Ravishankar,
	kiran.k, Sathish Narasimman

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 <sathish.narasimman@intel.com>
> ---
> net/bluetooth/hci_request.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel


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

* Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-11-09 12:41 ` Marcel Holtmann
@ 2020-12-26 17:02   ` Kan-Ru Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Kan-Ru Chen @ 2020-12-26 17:02 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: nsathish41, linux-bluetooth, chethan.tumkur.narayan,
	ravishankar.srivatsa, kiran.k, sathish.narasimman

Hi,

Marcel Holtmann <marcel@holtmann.org> 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 <sathish.narasimman@intel.com>
>> ---
>> 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

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

* RE: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-29  0:22   ` Luiz Augusto von Dentz
@ 2020-10-29  7:27     ` Narasimman, Sathish
  0 siblings, 0 replies; 9+ messages in thread
From: Narasimman, Sathish @ 2020-10-29  7:27 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, Narasimman, Sathish
  Cc: Bluez mailing list, Tumkur Narayan, Chethan, Srivatsa,
	Ravishankar, K, Kiran, Sathish Narasimman

Hi Luiz

> -----Original Message-----
> From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Sent: Thursday, October 29, 2020 5:52 AM
> To: Sathish Narasimman <nsathish41@gmail.com>
> Cc: Bluez mailing list <linux-bluetooth@vger.kernel.org>; Tumkur Narayan,
> Chethan <chethan.tumkur.narayan@intel.com>; Srivatsa, Ravishankar
> <ravishankar.srivatsa@intel.com>; K, Kiran <kiran.k@intel.com>;
> Narasimman, Sathish <sathish.narasimman@intel.com>
> Subject: Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
> 
> Hi Sathish,
> 
> On Wed, Oct 28, 2020 at 4:46 PM Sathish Narasimman
> <nsathish41@gmail.com> wrote:
> >
> > Hi
> >
> > On Thu, Oct 22, 2020 at 1:47 PM Sathish Narasimman
> <nsathish41@gmail.com> wrote:
> > >
> > > 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
> > >
> > > Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
> > > ---
> > >  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.
> > 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

> 
> --
> Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-28  5:30 ` Sathish Narasimman
@ 2020-10-29  0:22   ` Luiz Augusto von Dentz
  2020-10-29  7:27     ` Narasimman, Sathish
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2020-10-29  0:22 UTC (permalink / raw)
  To: Sathish Narasimman
  Cc: Bluez mailing list, Chethan T N, ravishankar.srivatsa, Kiran K,
	Sathish Narasimman

Hi Sathish,

On Wed, Oct 28, 2020 at 4:46 PM Sathish Narasimman <nsathish41@gmail.com> wrote:
>
> Hi
>
> On Thu, Oct 22, 2020 at 1:47 PM Sathish Narasimman <nsathish41@gmail.com> wrote:
> >
> > 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
> >
> > Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
> > ---
> >  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.
> 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.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-22  8:23 Sathish Narasimman
  2020-10-28  5:30 ` Sathish Narasimman
@ 2020-10-29  0:20 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2020-10-29  0:20 UTC (permalink / raw)
  To: Sathish Narasimman
  Cc: linux-bluetooth, Chethan T N, ravishankar.srivatsa, Kiran K,
	Sathish Narasimman

Hi Sathish,

On Thu, Oct 22, 2020 at 2:04 AM Sathish Narasimman <nsathish41@gmail.com> wrote:
>
> 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
>
> Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
> ---
>  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
>

Reviewed-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
  2020-10-22  8:23 Sathish Narasimman
@ 2020-10-28  5:30 ` Sathish Narasimman
  2020-10-29  0:22   ` Luiz Augusto von Dentz
  2020-10-29  0:20 ` Luiz Augusto von Dentz
  1 sibling, 1 reply; 9+ messages in thread
From: Sathish Narasimman @ 2020-10-28  5:30 UTC (permalink / raw)
  To: Bluez mailing list
  Cc: Chethan T N, ravishankar.srivatsa, kiran.k, Sathish Narasimman

Hi

On Thu, Oct 22, 2020 at 1:47 PM Sathish Narasimman <nsathish41@gmail.com> wrote:
>
> 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
>
> Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
> ---
>  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.
Seems Many devices are failing to reconnect after every on 5.9 kernel

This patch will FIX the issue

Regards
Sathish N

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

* [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect
@ 2020-10-22  8:23 Sathish Narasimman
  2020-10-28  5:30 ` Sathish Narasimman
  2020-10-29  0:20 ` Luiz Augusto von Dentz
  0 siblings, 2 replies; 9+ messages in thread
From: Sathish Narasimman @ 2020-10-22  8:23 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: chethan.tumkur.narayan, ravishankar.srivatsa, kiran.k,
	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

Signed-off-by: Sathish Narasimman <sathish.narasimman@intel.com>
---
 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


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

end of thread, other threads:[~2020-12-26 17:04 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29  7:48 [PATCH] Bluetooth: Fix: LL PRivacy BLE device fails to connect Sathish Narasimman
2020-11-03  2:05 ` Narasimman, Sathish
2020-11-09 12:41 ` Marcel Holtmann
2020-12-26 17:02   ` Kan-Ru Chen
  -- strict thread matches above, loose matches on Subject: below --
2020-10-22  8:23 Sathish Narasimman
2020-10-28  5:30 ` Sathish Narasimman
2020-10-29  0:22   ` Luiz Augusto von Dentz
2020-10-29  7:27     ` Narasimman, Sathish
2020-10-29  0:20 ` Luiz Augusto von Dentz

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).