* [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
@ 2022-06-02 15:15 Alain Michaud
2022-06-02 15:24 ` Marcel Holtmann
2022-06-02 15:50 ` patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Alain Michaud @ 2022-06-02 15:15 UTC (permalink / raw)
To: linux-bluetooth
Cc: chromeos-bluetooth-upstreaming, Alain Michaud, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg,
Luiz Augusto von Dentz, Marcel Holtmann, Paolo Abeni,
linux-kernel, netdev
From: Alain Michaud <alainm@chromium.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@chromium.org>
---
Changes in v2:
-Address Feedback from Luiz
net/bluetooth/hci_conn.c | 3 +++
net/bluetooth/hci_event.c | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 352d7d612128..5911ca0c5239 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_and_clear_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..b67fdd1ad8da 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2729,7 +2729,7 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)
mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags);
if (conn->type == ACL_LINK) {
- if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
+ if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
hci_remove_link_key(hdev, &conn->dst);
}
@@ -3372,7 +3372,7 @@ 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_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
hci_remove_link_key(hdev, &conn->dst);
hci_req_update_scan(hdev);
--
2.36.1.255.ge46751e96f-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
2022-06-02 15:15 [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
@ 2022-06-02 15:24 ` Marcel Holtmann
2022-06-02 15:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2022-06-02 15:24 UTC (permalink / raw)
To: Alain Michaud
Cc: BlueZ, CrosBT Upstreaming, Alain Michaud, David S. Miller,
Eric Dumazet, Jakub Kicinski, Johan Hedberg,
Luiz Augusto von Dentz, Paolo Abeni, LKML, netdev
Hi Alain,
> 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@chromium.org>
>
> ---
>
> Changes in v2:
> -Address Feedback from Luiz
>
> net/bluetooth/hci_conn.c | 3 +++
> net/bluetooth/hci_event.c | 4 ++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 352d7d612128..5911ca0c5239 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_and_clear_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..b67fdd1ad8da 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2729,7 +2729,7 @@ static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)
> mgmt_conn = test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags);
>
> if (conn->type == ACL_LINK) {
> - if (test_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> + if (test_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> hci_remove_link_key(hdev, &conn->dst);
> }
>
> @@ -3372,7 +3372,7 @@ 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_and_clear_bit(HCI_CONN_FLUSH_KEY, &conn->flags))
> hci_remove_link_key(hdev, &conn->dst);
do you mind splitting this into two patches. The test_and_clear_bit() change is obviously correct, but it is fix that is not described in the commit message.
Or if you think that it makes sense to keep this together, please add a paragraph about it in the commit message.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
2022-06-02 15:15 [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
2022-06-02 15:24 ` Marcel Holtmann
@ 2022-06-02 15:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2022-06-02 15:50 UTC (permalink / raw)
To: Alain Michaud
Cc: linux-bluetooth, chromeos-bluetooth-upstreaming, alainm, davem,
edumazet, kuba, johan.hedberg, luiz.dentz, marcel, pabeni,
linux-kernel, netdev
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:
On Thu, 2 Jun 2022 15:15:03 +0000 you wrote:
> From: Alain Michaud <alainm@chromium.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.
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
https://git.kernel.org/bluetooth/bluetooth-next/c/5a4e1528d840
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-02 15:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02 15:15 [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
2022-06-02 15:24 ` Marcel Holtmann
2022-06-02 15:50 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox