diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-08-07 15:56:44 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-08-14 02:49:12 -0400 |
commit | d52deb17489b8155e031fb1a9f116c602d719e11 (patch) | |
tree | 19ffd2d662432060d174466667c9b97b26c69cf5 /net/bluetooth | |
parent | 5ff6f34d4260c542df3712e29ead87cf071ad472 (diff) |
Bluetooth: Resume BT_CONNECTED state after LE security elevation
The LE ATT socket uses a special trick where it temporarily sets
BT_CONFIG state for the duration of a security level elevation. In order
to not require special hacks for going back to BT_CONNECTED state in the
l2cap_core.c code the most reasonable place to resume the state is the
resume callback. This patch adds a new flag to track the pending
security level change and ensures that the state is set back to
BT_CONNECTED in the resume callback in case the flag is set.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_sock.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 1884f72083c2..5a42f6a818c0 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -790,6 +790,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, | |||
790 | if (chan->scid == L2CAP_CID_ATT) { | 790 | if (chan->scid == L2CAP_CID_ATT) { |
791 | if (smp_conn_security(conn->hcon, sec.level)) | 791 | if (smp_conn_security(conn->hcon, sec.level)) |
792 | break; | 792 | break; |
793 | set_bit(FLAG_PENDING_SECURITY, &chan->flags); | ||
793 | sk->sk_state = BT_CONFIG; | 794 | sk->sk_state = BT_CONFIG; |
794 | chan->state = BT_CONFIG; | 795 | chan->state = BT_CONFIG; |
795 | 796 | ||
@@ -1359,6 +1360,11 @@ static void l2cap_sock_resume_cb(struct l2cap_chan *chan) | |||
1359 | { | 1360 | { |
1360 | struct sock *sk = chan->data; | 1361 | struct sock *sk = chan->data; |
1361 | 1362 | ||
1363 | if (test_and_clear_bit(FLAG_PENDING_SECURITY, &chan->flags)) { | ||
1364 | sk->sk_state = BT_CONNECTED; | ||
1365 | chan->state = BT_CONNECTED; | ||
1366 | } | ||
1367 | |||
1362 | clear_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags); | 1368 | clear_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags); |
1363 | sk->sk_state_change(sk); | 1369 | sk->sk_state_change(sk); |
1364 | } | 1370 | } |