Skip to contentSkip to conversation

Bluetooth: hci_sync: Fix suspending with wrong filter policy

PATCH Superseded Luiz Augusto von Dentz 3 participants 4 messages Jul 15, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_sync: Fix suspending with wrong filter policy

From: Luiz Augusto von Dentz <[email protected]>

When suspending the scan filter policy cannot be 0x00 (no acceptlist) since that means the host has to process every advertisement report waking up the system, so this attempt to check if hdev is marked as suspended and the resulting filter policy would be 0x00 (no acceptlist) then skip passive scanning.

Note: This disables remote wakeup for devices using privacy when LL privacy is not enabled since that would require the controller to resolve the addresses.

Fixes 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
---
 net/bluetooth/hci_sync.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/bluetooth/hci_sync.c +7 -0
index cd2ed16da8a4..0996f159c675 100644
@@ -2976,6 +2976,13 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
 	 */
 	filter_policy = hci_update_accept_list_sync(hdev);
 
+	/* If suspended and filter_policy set to 0x00 (no acceptlist) then
+	 * passive scanning cannot be started since that would require the host
+	 * to be wakeup.
+	 */
+	if (hdev->suspended && !filter_policy)
+		return 0;
+
 	/* When the controller is using random resolvable addresses and
 	 * with that having LE privacy enabled, then controllers with
 	 * Extended Scanner Filter Policies support can now enable support
Signature · 1 line
2.45.2
#1 lore raw

Dear Luiz,

Thank you for the patch.

Am 15.07.24 um 16:47 schrieb Luiz Augusto von Dentz:

Quoted 5 lines

From: Luiz Augusto von Dentz <[email protected]>

When suspending the scan filter policy cannot be 0x00 (no acceptlist) since that means the host has to process every advertisement report waking up the system, so this attempt to check if hdev is marked as

attempt*s*

Quoted 1 line

suspended and the resulting filter policy would be 0x00 (no acceptlist)

… *if* the …?

Quoted 5 lines

then skip passive scanning.

Note: This disables remote wakeup for devices using privacy when LL privacy is not enabled since that would require the controller to resolve the addresses.

Would that regress certain use-cases?

Quoted 11 lines
Fixes 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
---
  net/bluetooth/hci_sync.c | 7 +++++++
  1 file changed, 7 insertions(+)
net/bluetooth/hci_sync.c +0 -0
index cd2ed16da8a4..0996f159c675 100644

net/bluetooth/hci_sync.c static int hci_passive_scan_sync(struct hci_dev *hdev) · line 2981

Quoted 6 lines
net/bluetooth/hci_sync.c +3 -0
@@ -2976,6 +2976,13 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
  	 */
  	filter_policy = hci_update_accept_list_sync(hdev);
 
+	/* If suspended and filter_policy set to 0x00 (no acceptlist) then
+	 * passive scanning cannot be started since that would require the host
+	 * to be wakeup.

to be woken up

net/bluetooth/hci_sync.c static int hci_passive_scan_sync(struct hci_dev *hdev) · line 2988

Quoted 7 lines
net/bluetooth/hci_sync.c +4 -0
+	 */
+	if (hdev->suspended && !filter_policy)
+		return 0;
+
  	/* When the controller is using random resolvable addresses and
  	 * with that having LE privacy enabled, then controllers with
  	 * Extended Scanner Filter Policies support can now enable support

Kind regards,

Paul

author maintainer
#2 lore raw

Hi Paul,

Quoted 19 lines · Paul Menzel

Dear Luiz,

Thank you for the patch.

Am 15.07.24 um 16:47 schrieb Luiz Augusto von Dentz:

Quoted 5 lines

From: Luiz Augusto von Dentz <[email protected]>

When suspending the scan filter policy cannot be 0x00 (no acceptlist) since that means the host has to process every advertisement report waking up the system, so this attempt to check if hdev is marked as

attempt*s*

Quoted 1 line

suspended and the resulting filter policy would be 0x00 (no acceptlist)

… *if* the …?

Quoted 7 lines
Quoted 5 lines

then skip passive scanning.

Note: This disables remote wakeup for devices using privacy when LL privacy is not enabled since that would require the controller to resolve the addresses.

Would that regress certain use-cases?

Not apart from what is already stated which is sort of a broke behavior since any advertisement would result in the system being woken up which was never the intention. Anyway we do have CI test cases to cover such regressions.

Quoted 32 lines
Quoted 11 lines
Fixes 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
---
  net/bluetooth/hci_sync.c | 7 +++++++
  1 file changed, 7 insertions(+)
net/bluetooth/hci_sync.c +0 -0
index cd2ed16da8a4..0996f159c675 100644

net/bluetooth/hci_sync.c static int hci_passive_scan_sync(struct hci_dev *hdev) · line 2981

Quoted 6 lines
net/bluetooth/hci_sync.c +3 -0
@@ -2976,6 +2976,13 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
       */
      filter_policy = hci_update_accept_list_sync(hdev);
 
+     /* If suspended and filter_policy set to 0x00 (no acceptlist) then
+      * passive scanning cannot be started since that would require the host
+      * to be wakeup.

to be woken up

net/bluetooth/hci_sync.c static int hci_passive_scan_sync(struct hci_dev *hdev) · line 2988

Quoted 7 lines
net/bluetooth/hci_sync.c +4 -0
+      */
+     if (hdev->suspended && !filter_policy)
+             return 0;
+
      /* When the controller is using random resolvable addresses and
       * with that having LE privacy enabled, then controllers with
       * Extended Scanner Filter Policies support can now enable support

Kind regards,

Paul

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

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=871404

---Test result---

Test Summary:

CheckPatch                    PASS      0.70 seconds
GitLint                       PASS      0.33 seconds
SubjectPrefix                 PASS      0.13 seconds
BuildKernel                   PASS      30.84 seconds
CheckAllWarning               PASS      32.00 seconds
CheckSparse                   PASS      38.57 seconds
CheckSmatch                   PASS      104.84 seconds
BuildKernel32                 PASS      29.16 seconds
TestRunnerSetup               PASS      539.09 seconds
TestRunner_l2cap-tester       PASS      20.03 seconds
TestRunner_iso-tester         PASS      33.41 seconds
TestRunner_bnep-tester        PASS      4.87 seconds
TestRunner_mgmt-tester        PASS      115.79 seconds
TestRunner_rfcomm-tester      PASS      7.65 seconds
TestRunner_sco-tester         PASS      15.16 seconds
TestRunner_ioctl-tester       PASS      8.00 seconds
TestRunner_mesh-tester        PASS      6.03 seconds
TestRunner_smp-tester         PASS      7.02 seconds
TestRunner_userchan-tester    PASS      6.12 seconds
IncrementalBuild              PASS      34.41 seconds

---
Regards,
Linux Bluetooth