diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2011-06-14 05:48:19 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-06-14 13:48:01 -0400 |
commit | df3c3931ec58cca3409c71b18ad6da0cd71fe163 (patch) | |
tree | 0a159ff9f6c82805eae6bc7ae330d23cdab3e4f5 /net/bluetooth | |
parent | 6fdf658c9a0e51e6663f2769f6d310c2843a862b (diff) |
Bluetooth: Fix accepting connect requests for defer_setup
When authentication completes we shouldn't blindly accept any pending
L2CAP connect requests. If the socket has the defer_setup feature
enabled it should still wait for user space acceptance of the connect
request. The issue only happens for non-SSP connections since with SSP
the L2CAP Connect request may not be sent for non-SDP PSMs before
authentication has completed successfully.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index e64a1c2df238..56fdd9162da9 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -4002,21 +4002,30 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4002 | } | 4002 | } |
4003 | } else if (sk->sk_state == BT_CONNECT2) { | 4003 | } else if (sk->sk_state == BT_CONNECT2) { |
4004 | struct l2cap_conn_rsp rsp; | 4004 | struct l2cap_conn_rsp rsp; |
4005 | __u16 result; | 4005 | __u16 res, stat; |
4006 | 4006 | ||
4007 | if (!status) { | 4007 | if (!status) { |
4008 | sk->sk_state = BT_CONFIG; | 4008 | if (bt_sk(sk)->defer_setup) { |
4009 | result = L2CAP_CR_SUCCESS; | 4009 | struct sock *parent = bt_sk(sk)->parent; |
4010 | res = L2CAP_CR_PEND; | ||
4011 | stat = L2CAP_CS_AUTHOR_PEND; | ||
4012 | parent->sk_data_ready(parent, 0); | ||
4013 | } else { | ||
4014 | sk->sk_state = BT_CONFIG; | ||
4015 | res = L2CAP_CR_SUCCESS; | ||
4016 | stat = L2CAP_CS_NO_INFO; | ||
4017 | } | ||
4010 | } else { | 4018 | } else { |
4011 | sk->sk_state = BT_DISCONN; | 4019 | sk->sk_state = BT_DISCONN; |
4012 | l2cap_sock_set_timer(sk, HZ / 10); | 4020 | l2cap_sock_set_timer(sk, HZ / 10); |
4013 | result = L2CAP_CR_SEC_BLOCK; | 4021 | res = L2CAP_CR_SEC_BLOCK; |
4022 | stat = L2CAP_CS_NO_INFO; | ||
4014 | } | 4023 | } |
4015 | 4024 | ||
4016 | rsp.scid = cpu_to_le16(chan->dcid); | 4025 | rsp.scid = cpu_to_le16(chan->dcid); |
4017 | rsp.dcid = cpu_to_le16(chan->scid); | 4026 | rsp.dcid = cpu_to_le16(chan->scid); |
4018 | rsp.result = cpu_to_le16(result); | 4027 | rsp.result = cpu_to_le16(res); |
4019 | rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); | 4028 | rsp.status = cpu_to_le16(stat); |
4020 | l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, | 4029 | l2cap_send_cmd(conn, chan->ident, L2CAP_CONN_RSP, |
4021 | sizeof(rsp), &rsp); | 4030 | sizeof(rsp), &rsp); |
4022 | } | 4031 | } |