mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Alain Michaud <alainmichaud@google.com>
Cc: BlueZ <linux-bluetooth@vger.kernel.org>,
	CrosBT Upstreaming <chromeos-bluetooth-upstreaming@chromium.org>,
	Alain Michaud <alainm@chromium.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	Paolo Abeni <pabeni@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH v2] Bluetooth: clear the temporary linkkey in hci_conn_cleanup
Date: Thu, 2 Jun 2022 17:24:40 +0200	[thread overview]
Message-ID: <CB19541D-F4AD-47D9-A1DC-52A0519EFB69@holtmann.org> (raw)
In-Reply-To: <20220602151456.v2.1.I9f2f4ef058af96a5ad610a90c6938ed17a7d103f@changeid>

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


  reply	other threads:[~2022-06-02 15:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 15:15 Alain Michaud
2022-06-02 15:24 ` Marcel Holtmann [this message]
2022-06-02 15:50 ` patchwork-bot+bluetooth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CB19541D-F4AD-47D9-A1DC-52A0519EFB69@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=alainm@chromium.org \
    --cc=alainmichaud@google.com \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johan.hedberg@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®