All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
@ 2022-06-01 15:11 Alain Michaud
  2022-06-01 16:11 ` bluez.test.bot
  2022-06-01 21:45 ` [PATCH] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Alain Michaud @ 2022-06-01 15:11 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>

---

 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);
+		}
 
 		hci_req_update_scan(hdev);
 	}
-- 
2.36.1.255.ge46751e96f-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: Bluetooth: clear the temporary linkkey in hci_conn_cleanup
  2022-06-01 15:11 [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
@ 2022-06-01 16:11 ` bluez.test.bot
  2022-06-01 21:45 ` [PATCH] " Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-06-01 16:11 UTC (permalink / raw)
  To: linux-bluetooth, alainmichaud

[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]

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=646601

---Test result---

Test Summary:
CheckPatch                    PASS      1.10 seconds
GitLint                       PASS      0.56 seconds
SubjectPrefix                 PASS      0.42 seconds
BuildKernel                   PASS      37.30 seconds
BuildKernel32                 PASS      33.55 seconds
Incremental Build with patchesPASS      44.53 seconds
TestRunner: Setup             PASS      558.21 seconds
TestRunner: l2cap-tester      PASS      17.90 seconds
TestRunner: bnep-tester       PASS      6.14 seconds
TestRunner: mgmt-tester       PASS      104.45 seconds
TestRunner: rfcomm-tester     PASS      9.84 seconds
TestRunner: sco-tester        PASS      9.45 seconds
TestRunner: smp-tester        PASS      9.48 seconds
TestRunner: userchan-tester   PASS      6.28 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
  2022-06-01 15:11 [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
  2022-06-01 16:11 ` bluez.test.bot
@ 2022-06-01 21:45 ` Luiz Augusto von Dentz
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2022-06-01 21:45 UTC (permalink / raw)
  To: Alain Michaud
  Cc: linux-bluetooth, ChromeOS Bluetooth Upstreaming, Alain Michaud,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Johan Hedberg,
	Marcel Holtmann, Paolo Abeni, Linux Kernel Mailing List,
	open list:NETWORKING [GENERAL]

Hi Alain,

On Wed, Jun 1, 2022 at 8:12 AM Alain Michaud <alainmichaud@google.com> 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.
>
> Signed-off-by: Alain Michaud <alainm@chromium.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-01 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 15:11 [PATCH] Bluetooth: clear the temporary linkkey in hci_conn_cleanup Alain Michaud
2022-06-01 16:11 ` bluez.test.bot
2022-06-01 21:45 ` [PATCH] " Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.