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]
Message-ID: <CABBYNZK8=RCC0bS3KVyn8y93nW_rSR0DDb=Yyp6CgFLaJGz5bA@mail.gmail.com>
Date:   Wed, 1 Jun 2022 14:45:08 -0700
From:   Luiz Augusto von Dentz <luiz.dentz@...il.com>
To:     Alain Michaud <alainmichaud@...gle.com>
Cc:     "linux-bluetooth@...r.kernel.org" <linux-bluetooth@...r.kernel.org>,
        ChromeOS Bluetooth Upstreaming 
        <chromeos-bluetooth-upstreaming@...omium.org>,
        Alain Michaud <alainm@...omium.org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Marcel Holtmann <marcel@...tmann.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>
Subject: Re: [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup

Hi Alain,

On Wed, Jun 1, 2022 at 8:12 AM Alain Michaud <alainmichaud@...gle.com> wrote:
>
> From: Alain Michaud <alainm@...omium.org>
>
> If a hardware error occurs and the connections are flushed without a
> disconnection_complete event being signaled, the temporary linkkeys are
> not flushed.
>
> This change ensures that any outstanding flushable linkkeys are flushed
> when the connection are flushed from the hash table.
>
> Signed-off-by: Alain Michaud <alainm@...omium.org>
>
> ---
>
>  net/bluetooth/hci_conn.c  | 3 +++
>  net/bluetooth/hci_event.c | 4 +++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 352d7d612128..85dc1af90fcb 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -118,6 +118,9 @@ static void hci_conn_cleanup(struct hci_conn *conn)
>         if (test_bit(HCI_CONN_PARAM_REMOVAL_PEND, &conn->flags))
>                 hci_conn_params_del(conn->hdev, &conn->dst, conn->dst_type);
>
> +       if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> +               hci_remove_link_key(hdev, &conn->dst);
> +
>         hci_chan_list_flush(conn);
>
>         hci_conn_hash_del(hdev, conn);
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 6b83f9b0082c..09f4ff71e747 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -3372,8 +3372,10 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, void *data,
>                                 reason, mgmt_connected);
>
>         if (conn->type == ACL_LINK) {
> -               if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> +               if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags)) {
>                         hci_remove_link_key(hdev, &conn->dst);
> +                       clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags);
> +               }

Could we use test_and_clean_bit instead? In theory there could be
other threads trying to clean up so I guess it would be safer to
reduce the risk of having concurrency problems although hci_dev_lock
would prevent that, better to be safe than sorry.

>                 hci_req_update_scan(hdev);
>         }
> --
> 2.36.1.255.ge46751e96f-goog
>


-- 
Luiz Augusto von Dentz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ