diff options
Diffstat (limited to 'net/bluetooth/l2cap.c')
-rw-r--r-- | net/bluetooth/l2cap.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 2e3abdfbd69d..252264062f59 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -2197,7 +2197,7 @@ static int l2cap_auth_cfm(struct hci_conn *hcon, u8 status) | |||
2197 | return 0; | 2197 | return 0; |
2198 | } | 2198 | } |
2199 | 2199 | ||
2200 | static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status) | 2200 | static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) |
2201 | { | 2201 | { |
2202 | struct l2cap_chan_list *l; | 2202 | struct l2cap_chan_list *l; |
2203 | struct l2cap_conn *conn = hcon->l2cap_data; | 2203 | struct l2cap_conn *conn = hcon->l2cap_data; |
@@ -2215,8 +2215,19 @@ static int l2cap_encrypt_cfm(struct hci_conn *hcon, u8 status) | |||
2215 | read_lock(&l->lock); | 2215 | read_lock(&l->lock); |
2216 | 2216 | ||
2217 | for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { | 2217 | for (sk = l->head; sk; sk = l2cap_pi(sk)->next_c) { |
2218 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
2219 | |||
2218 | bh_lock_sock(sk); | 2220 | bh_lock_sock(sk); |
2219 | 2221 | ||
2222 | if ((pi->link_mode & (L2CAP_LM_ENCRYPT | L2CAP_LM_SECURE)) && | ||
2223 | (sk->sk_state == BT_CONNECTED || | ||
2224 | sk->sk_state == BT_CONFIG) && | ||
2225 | !status && encrypt == 0x00) { | ||
2226 | __l2cap_sock_close(sk, ECONNREFUSED); | ||
2227 | bh_unlock_sock(sk); | ||
2228 | continue; | ||
2229 | } | ||
2230 | |||
2220 | if (sk->sk_state != BT_CONNECT2) { | 2231 | if (sk->sk_state != BT_CONNECT2) { |
2221 | bh_unlock_sock(sk); | 2232 | bh_unlock_sock(sk); |
2222 | continue; | 2233 | continue; |