From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 5/7] Bluetooth: Fix locking of the SMP context
Date: Fri, 5 Sep 2014 15:47:40 +0300 [thread overview]
Message-ID: <20140905124740.GA30842@t440s.lan> (raw)
In-Reply-To: <1409920838-30242-6-git-send-email-johan.hedberg@gmail.com>
Hi,
On Fri, Sep 05, 2014, johan.hedberg@gmail.com wrote:
> @@ -1192,12 +1195,19 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
> if (smp_ltk_encrypt(conn, hcon->pending_sec_level))
> return 0;
>
> - if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags))
> - return 0;
> + l2cap_chan_lock(chan);
> +
> + /* If SMP is already in progress ignore this request */
> + if (chan->data) {
> + ret = 0;
> + goto unlock;
> + }
>
> smp = smp_chan_create(conn);
> - if (!smp)
> - return 1;
> + if (!smp) {
> + ret = 1;
> + goto unlock;
> + }
>
> authreq = seclevel_to_authreq(sec_level);
>
> @@ -1223,8 +1233,11 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level)
> }
>
> set_bit(SMP_FLAG_INITIATOR, &smp->flags);
> + ret = 0;
>
> - return 0;
> +unlock:
> + l2cap_chan_unlock(conn->smp);
> + return ret;
Seems something didn't go quite right with my rebasing skills and this
fix dropped out from the mix. I'll send another revision of this patch.
Johan
next prev parent reply other threads:[~2014-09-05 12:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 12:40 [PATCH v2 0/7] Bluetooth: SMP fixes/improvements johan.hedberg
2014-09-05 12:40 ` [PATCH v2 1/7] Bluetooth: Remove unnecessary checks after canceling SMP security timer johan.hedberg
2014-09-05 12:40 ` [PATCH v2 2/7] Bluetooth: Don't take any action in smp_resume_cb if not encrypted johan.hedberg
2014-09-05 12:40 ` [PATCH v2 3/7] Bluetooth: Move identity address update behind a workqueue johan.hedberg
2014-09-05 12:40 ` [PATCH v2 4/7] Bluetooth: Remove unnecessary deferred work for SMP key distribution johan.hedberg
2014-09-05 12:40 ` [PATCH v2 5/7] Bluetooth: Fix locking of the SMP context johan.hedberg
2014-09-05 12:47 ` Johan Hedberg [this message]
2014-09-05 12:50 ` [PATCH v2.1 " johan.hedberg
2014-09-05 12:40 ` [PATCH v2 6/7] Bluetooth: Fix calling smp_distribute_keys() when still waiting for keys johan.hedberg
2014-09-05 12:40 ` [PATCH v2 7/7] Bluetooth: Add strict checks for allowed SMP PDUs johan.hedberg
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=20140905124740.GA30842@t440s.lan \
--to=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;
as well as URLs for NNTP newsgroup(s).