From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/2] Bluetooth: Add support for encryption key refresh
Date: Thu, 7 Jun 2012 10:07:22 +0300 [thread overview]
Message-ID: <20120607070720.GC32366@aemeltch-MOBL1> (raw)
In-Reply-To: <1339052318-11423-3-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
On Thu, Jun 07, 2012 at 02:58:38PM +0800, Johan Hedberg wrote:
> From: Johan Hedberg <johan.hedberg@intel.com>
>
> With LE/SMP the completion of a security level elavation from medium to
> high is indicated by a HCI Encryption Key Refresh complete event. The
> necessary behavior upon receiving this event is a mix of what's done for
> auth_complete and encryption_change, which is also where most of the
> event handling code has been copied from.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
...
> +static void hci_key_refresh_complete_evt(struct hci_dev *hdev,
> + struct sk_buff *skb)
> +{
> + struct hci_ev_key_refresh_complete *ev = (void *) skb->data;
> + struct hci_conn *conn;
> +
> + BT_DBG("%s status %u handle %u", hdev->name, ev->status,
> + __le16_to_cpu(ev->handle));
> +
> + hci_dev_lock(hdev);
> +
> + conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
> + if (!conn)
> + goto unlock;
> +
> + if (!ev->status)
> + conn->sec_level = conn->pending_sec_level;
> +
> + clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
> +
> + if (ev->status && conn->state == BT_CONNECTED) {
> + hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE);
> + hci_conn_put(conn);
> + goto unlock;
> + }
> +
> + if (conn->state == BT_CONFIG) {
> + if (!ev->status)
> + conn->state = BT_CONNECTED;
> +
> + hci_proto_connect_cfm(conn, ev->status);
> + hci_conn_put(conn);
> + } else {
> + hci_auth_cfm(conn, ev->status);
> +
> + hci_conn_hold(conn);
If you want to keep extra hold(conn) you may just not put. Is this typo?
> + conn->disc_timeout = HCI_DISCONN_TIMEOUT;
> + hci_conn_put(conn);
> + }
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2012-06-07 7:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 6:58 [PATCH 0/2] Bluetooth: Fix SMP support for encryption key refresh Johan Hedberg
2012-06-07 6:58 ` [PATCH 1/2] Bluetooth: Fix SMP security elevation from medium to high Johan Hedberg
2012-06-08 7:19 ` Gustavo Padovan
2012-06-07 6:58 ` [PATCH 2/2] Bluetooth: Add support for encryption key refresh Johan Hedberg
2012-06-07 7:07 ` Andrei Emeltchenko [this message]
2012-06-07 7:14 ` Johan Hedberg
2012-06-07 7:25 ` Andrei Emeltchenko
2012-06-08 7:20 ` Gustavo Padovan
2012-06-08 15:31 ` [PATCH v2] " Johan Hedberg
2012-06-09 0:12 ` Gustavo Padovan
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=20120607070720.GC32366@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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