Skip to content

Commit 96b82af

Browse files
committed
Bluetooth: hci_sync: Fix suspending with wrong filter policy
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 attempts to check if hdev is marked as suspended and if the resulting filter policy would be 0x00 (no acceptlist) then skip passive scanning if thre no devices in the acceptlist otherwise reset the filter policy to 0x01 so the acceptlist is used since the devices programmed there can still wakeup be system. Fixes: 182ee45 ("Bluetooth: hci_sync: Rework hci_suspend_notifier") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent d09009b commit 96b82af

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

net/bluetooth/hci_sync.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2976,6 +2976,27 @@ static int hci_passive_scan_sync(struct hci_dev *hdev)
29762976
*/
29772977
filter_policy = hci_update_accept_list_sync(hdev);
29782978

2979+
/* If suspended and filter_policy set to 0x00 (no acceptlist) then
2980+
* passive scanning cannot be started since that would require the host
2981+
* to be woken up to process the reports.
2982+
*/
2983+
if (hdev->suspended && !filter_policy) {
2984+
/* Check if accept list is empty then there is no need to scan
2985+
* while suspended.
2986+
*/
2987+
if (list_empty(&hdev->le_accept_list))
2988+
return 0;
2989+
2990+
/* If there are devices is the accept_list that means some
2991+
* devices could not be programmed which in non-suspended case
2992+
* means filter_policy needs to be set to 0x00 so the host needs
2993+
* to filter, but since this is treating suspended case we
2994+
* can ignore device needing host to filter to allow devices in
2995+
* the acceptlist to be able to wakeup the system.
2996+
*/
2997+
filter_policy = 0x01;
2998+
}
2999+
29793000
/* When the controller is using random resolvable addresses and
29803001
* with that having LE privacy enabled, then controllers with
29813002
* Extended Scanner Filter Policies support can now enable support

0 commit comments

Comments
 (0)