diff mbox series

Bluetooth: Use whitelist for scan policy when suspending

Message ID 20200707155207.1.Id31098b8dbbcf90468fcd7fb07ad0e872b11c36b@changeid (mailing list archive)
State Accepted
Headers show
Series Bluetooth: Use whitelist for scan policy when suspending | expand

Commit Message

Miao-chen Chou July 7, 2020, 10:52 p.m. UTC
Even with one advertisement monitor in place, the scan policy should use
the whitelist while the system is going to suspend to prevent waking by
random advertisement.

The following test was performed.
- With a paired device, register one advertisement monitor, suspend
the system and verify that the host was not awaken by random
advertisements.

Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>

---

 net/bluetooth/hci_request.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Marcel Holtmann July 8, 2020, noon UTC | #1
Hi Miao-chen,

> Even with one advertisement monitor in place, the scan policy should use
> the whitelist while the system is going to suspend to prevent waking by
> random advertisement.
> 
> The following test was performed.
> - With a paired device, register one advertisement monitor, suspend
> the system and verify that the host was not awaken by random
> advertisements.
> 
> Signed-off-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
> 
> ---
> 
> net/bluetooth/hci_request.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 6168a3440eff9..e161aabd7bf36 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -799,9 +799,10 @@  static u8 update_white_list(struct hci_request *req)
 
 	/* Once the controller offloading of advertisement monitor is in place,
 	 * the if condition should include the support of MSFT extension
-	 * support.
+	 * support. If suspend is ongoing, whitelist should be the default to
+	 * prevent waking by random advertisements.
 	 */
-	if (!idr_is_empty(&hdev->adv_monitors_idr))
+	if (!idr_is_empty(&hdev->adv_monitors_idr) && !hdev->suspended)
 		return 0x00;
 
 	/* Select filter policy to use white list */