diff options
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 7bba469b6828..d563f2ebcbb3 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -206,6 +206,8 @@ static void __l2cap_chan_add(struct l2cap_conn *conn, struct sock *sk, struct so | |||
206 | 206 | ||
207 | BT_DBG("conn %p, psm 0x%2.2x, dcid 0x%4.4x", conn, l2cap_pi(sk)->psm, l2cap_pi(sk)->dcid); | 207 | BT_DBG("conn %p, psm 0x%2.2x, dcid 0x%4.4x", conn, l2cap_pi(sk)->psm, l2cap_pi(sk)->dcid); |
208 | 208 | ||
209 | conn->disc_reason = 0x13; | ||
210 | |||
209 | l2cap_pi(sk)->conn = conn; | 211 | l2cap_pi(sk)->conn = conn; |
210 | 212 | ||
211 | if (sk->sk_type == SOCK_SEQPACKET) { | 213 | if (sk->sk_type == SOCK_SEQPACKET) { |
@@ -491,6 +493,8 @@ static struct l2cap_conn *l2cap_conn_add(struct hci_conn *hcon, u8 status) | |||
491 | spin_lock_init(&conn->lock); | 493 | spin_lock_init(&conn->lock); |
492 | rwlock_init(&conn->chan_list.lock); | 494 | rwlock_init(&conn->chan_list.lock); |
493 | 495 | ||
496 | conn->disc_reason = 0x13; | ||
497 | |||
494 | return conn; | 498 | return conn; |
495 | } | 499 | } |
496 | 500 | ||
@@ -1840,6 +1844,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1840 | /* Check if the ACL is secure enough (if not SDP) */ | 1844 | /* Check if the ACL is secure enough (if not SDP) */ |
1841 | if (psm != cpu_to_le16(0x0001) && | 1845 | if (psm != cpu_to_le16(0x0001) && |
1842 | !hci_conn_check_link_mode(conn->hcon)) { | 1846 | !hci_conn_check_link_mode(conn->hcon)) { |
1847 | conn->disc_reason = 0x05; | ||
1843 | result = L2CAP_CR_SEC_BLOCK; | 1848 | result = L2CAP_CR_SEC_BLOCK; |
1844 | goto response; | 1849 | goto response; |
1845 | } | 1850 | } |
@@ -2472,7 +2477,19 @@ static int l2cap_connect_cfm(struct hci_conn *hcon, u8 status) | |||
2472 | return 0; | 2477 | return 0; |
2473 | } | 2478 | } |
2474 | 2479 | ||
2475 | static int l2cap_disconn_ind(struct hci_conn *hcon, u8 reason) | 2480 | static int l2cap_disconn_ind(struct hci_conn *hcon) |
2481 | { | ||
2482 | struct l2cap_conn *conn = hcon->l2cap_data; | ||
2483 | |||
2484 | BT_DBG("hcon %p", hcon); | ||
2485 | |||
2486 | if (hcon->type != ACL_LINK || !conn) | ||
2487 | return 0x13; | ||
2488 | |||
2489 | return conn->disc_reason; | ||
2490 | } | ||
2491 | |||
2492 | static int l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason) | ||
2476 | { | 2493 | { |
2477 | BT_DBG("hcon %p reason %d", hcon, reason); | 2494 | BT_DBG("hcon %p reason %d", hcon, reason); |
2478 | 2495 | ||
@@ -2717,6 +2734,7 @@ static struct hci_proto l2cap_hci_proto = { | |||
2717 | .connect_ind = l2cap_connect_ind, | 2734 | .connect_ind = l2cap_connect_ind, |
2718 | .connect_cfm = l2cap_connect_cfm, | 2735 | .connect_cfm = l2cap_connect_cfm, |
2719 | .disconn_ind = l2cap_disconn_ind, | 2736 | .disconn_ind = l2cap_disconn_ind, |
2737 | .disconn_cfm = l2cap_disconn_cfm, | ||
2720 | .security_cfm = l2cap_security_cfm, | 2738 | .security_cfm = l2cap_security_cfm, |
2721 | .recv_acldata = l2cap_recv_acldata | 2739 | .recv_acldata = l2cap_recv_acldata |
2722 | }; | 2740 | }; |