diff mbox series

[v1] Bluetooth: hci_sync: Fix suspending with wrong filter policy

Message ID 20240715144730.311392-1-luiz.dentz@gmail.com (mailing list archive)
State Superseded
Headers show
Series [v1] Bluetooth: hci_sync: Fix suspending with wrong filter policy | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Luiz Augusto von Dentz July 15, 2024, 2:47 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

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")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_sync.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Paul Menzel July 15, 2024, 2:59 p.m. UTC | #1
Dear Luiz,


Thank you for the patch.

Am 15.07.24 um 16:47 schrieb Luiz Augusto von Dentz:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> 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*

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

… *if* the …?

> 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?

> Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> ---
>   net/bluetooth/hci_sync.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index cd2ed16da8a4..0996f159c675 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -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

> +	 */
> +	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
Luiz Augusto von Dentz July 15, 2024, 3:05 p.m. UTC | #2
Hi Paul,

On Mon, Jul 15, 2024 at 11:00 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Luiz,
>
>
> Thank you for the patch.
>
> Am 15.07.24 um 16:47 schrieb Luiz Augusto von Dentz:
> > From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> >
> > 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*
>
> > suspended and the resulting filter policy would be 0x00 (no acceptlist)
>
> … *if* the …?
>
> > 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.

> > Fixes: 182ee45da083 ("Bluetooth: hci_sync: Rework hci_suspend_notifier")
> > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> > ---
> >   net/bluetooth/hci_sync.c | 7 +++++++
> >   1 file changed, 7 insertions(+)
> >
> > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> > index cd2ed16da8a4..0996f159c675 100644
> > --- a/net/bluetooth/hci_sync.c
> > +++ b/net/bluetooth/hci_sync.c
> > @@ -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
>
> > +      */
> > +     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
bluez.test.bot@gmail.com July 15, 2024, 3:13 p.m. UTC | #3
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
diff mbox series

Patch

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index cd2ed16da8a4..0996f159c675 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -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