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] [day] [month] [year] [list]
Date:   Wed, 26 Aug 2020 15:48:05 -0700
From:   Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
To:     Marcel Holtmann <marcel@...tmann.org>,
        Bluez mailing list <linux-bluetooth@...r.kernel.org>
Cc:     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: Clear suspend tasks on unregister

Please disregard this earlier email without the Fixes tag.

On Wed, Aug 26, 2020 at 3:26 PM Abhishek Pandit-Subedi
<abhishekpandit@...omium.org> wrote:
>
> While unregistering, make sure to clear the suspend tasks before
> cancelling the work. If the unregister is called during resume from
> suspend, this will unnecessarily add 2s to the resume time otherwise.
>
> Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@...omium.org>
> ---
> This was discovered with RT8822CE using the btusb driver. This chipset
> will reset on resume during system suspend and was unnecessarily adding
> 2s to every resume. Since we're unregistering anyway, there's no harm in
> just clearing the pending events.
>
>  net/bluetooth/hci_core.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 68bfe57b66250f..ed4cb3479433c0 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -3442,6 +3442,16 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr,
>         }
>  }
>
> +static void hci_suspend_clear_tasks(struct hci_dev *hdev)
> +{
> +       int i;
> +
> +       for (i = 0; i < __SUSPEND_NUM_TASKS; ++i)
> +               clear_bit(i, hdev->suspend_tasks);
> +
> +       wake_up(&hdev->suspend_wait_q);
> +}
> +
>  static int hci_suspend_wait_event(struct hci_dev *hdev)
>  {
>  #define WAKE_COND                                                              \
> @@ -3785,6 +3795,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
>         cancel_work_sync(&hdev->power_on);
>
>         unregister_pm_notifier(&hdev->suspend_notifier);
> +       hci_suspend_clear_tasks(hdev);
>         cancel_work_sync(&hdev->suspend_prepare);
>
>         hci_dev_do_close(hdev);
> --
> 2.28.0.297.g1956fa8f8d-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ