lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 1 Jun 2020 18:48:56 -0700
From:   Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
To:     Manish Mandlik <mmandlik@...gle.com>
Cc:     Marcel Holtmann <marcel@...tmann.org>,
        Luiz Augusto von Dentz <luiz.dentz@...il.com>,
        Bluez mailing list <linux-bluetooth@...r.kernel.org>,
        ChromeOS Bluetooth Upstreaming 
        <chromeos-bluetooth-upstreaming@...omium.org>,
        "David S. Miller" <davem@...emloft.net>,
        Johan Hedberg <johan.hedberg@...il.com>,
        netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH] Bluetooth: Check scan state before disabling during suspend

Hey linux-bluetooth,

We found this bug when reverting some Chromium maintained patches in
our repository that was conditionally dropping LE scan enable commands
if it wasn't toggling between true/false. On some Intel controllers,
disabling LE scan when it's already disabled resulted in a "Command
Disallowed" and this was causing suspend to fail.

On Mon, Jun 1, 2020 at 6:43 PM Manish Mandlik <mmandlik@...gle.com> wrote:
>
> Check current scan state by checking HCI_LE_SCAN flag and send scan
> disable command only if scan is already enabled.
>
> Signed-off-by: Manish Mandlik <mmandlik@...gle.com>
> ---
>
>  net/bluetooth/hci_request.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
> index 1fc55685da62d..1acf5b8e0910c 100644
> --- a/net/bluetooth/hci_request.c
> +++ b/net/bluetooth/hci_request.c
> @@ -998,8 +998,9 @@ static void hci_req_set_event_filter(struct hci_request *req)
>
>  static void hci_req_config_le_suspend_scan(struct hci_request *req)
>  {
> -       /* Can't change params without disabling first */
> -       hci_req_add_le_scan_disable(req);
> +       /* Before changing params disable scan if enabled */
> +       if (hci_dev_test_flag(req->hdev, HCI_LE_SCAN))
> +               hci_req_add_le_scan_disable(req);
>
>         /* Configure params and enable scanning */
>         hci_req_add_le_passive_scan(req);
> @@ -1065,8 +1066,9 @@ void hci_req_prepare_suspend(struct hci_dev *hdev, enum suspended_state next)
>                 page_scan = SCAN_DISABLED;
>                 hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &page_scan);
>
> -               /* Disable LE passive scan */
> -               hci_req_add_le_scan_disable(&req);
> +               /* Disable LE passive scan if enabled */
> +               if (hci_dev_test_flag(hdev, HCI_LE_SCAN))
> +                       hci_req_add_le_scan_disable(&req);
>
>                 /* Mark task needing completion */
>                 set_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks);
> --
> 2.27.0.rc2.251.g90737beb825-goog
>

Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ