aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-05-16 15:11:44 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-05-16 15:11:44 -0400
commit08e6d907fe606b751adddce54ad8f51e0950bc3f (patch)
tree1a987f519b1ea706a61cd23d7eeea038dfe81b7a /net/bluetooth
parentd34c34fb2592bd5231a153ad1676c3ded175410a (diff)
parent671267bf3aac3dae0555730b07ef29c042e325b2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/af_bluetooth.c2
-rw-r--r--net/bluetooth/hci_core.c8
-rw-r--r--net/bluetooth/hci_event.c11
-rw-r--r--net/bluetooth/l2cap_core.c5
-rw-r--r--net/bluetooth/l2cap_sock.c12
5 files changed, 31 insertions, 7 deletions
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index 72eb187a5f6..6fb68a9743a 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -450,7 +450,7 @@ unsigned int bt_sock_poll(struct file *file, struct socket *sock, poll_table *wa
450 sk->sk_state == BT_CONFIG) 450 sk->sk_state == BT_CONFIG)
451 return mask; 451 return mask;
452 452
453 if (sock_writeable(sk)) 453 if (!bt_sk(sk)->suspended && sock_writeable(sk))
454 mask |= POLLOUT | POLLWRNORM | POLLWRBAND; 454 mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
455 else 455 else
456 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); 456 set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 83d3d3563bc..a8962382f9c 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2715,6 +2715,14 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
2715 if (conn) { 2715 if (conn) {
2716 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); 2716 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
2717 2717
2718 hci_dev_lock(hdev);
2719 if (test_bit(HCI_MGMT, &hdev->dev_flags) &&
2720 !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
2721 mgmt_device_connected(hdev, &conn->dst, conn->type,
2722 conn->dst_type, 0, NULL, 0,
2723 conn->dev_class);
2724 hci_dev_unlock(hdev);
2725
2718 /* Send to upper protocol */ 2726 /* Send to upper protocol */
2719 l2cap_recv_acldata(conn, skb, flags); 2727 l2cap_recv_acldata(conn, skb, flags);
2720 return; 2728 return;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index d81262aff26..4edbfd929f6 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2062,6 +2062,12 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2062 2062
2063 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); 2063 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);
2064 2064
2065 if (ev->status && conn->state == BT_CONNECTED) {
2066 hci_acl_disconn(conn, 0x13);
2067 hci_conn_put(conn);
2068 goto unlock;
2069 }
2070
2065 if (conn->state == BT_CONFIG) { 2071 if (conn->state == BT_CONFIG) {
2066 if (!ev->status) 2072 if (!ev->status)
2067 conn->state = BT_CONNECTED; 2073 conn->state = BT_CONNECTED;
@@ -2072,6 +2078,7 @@ static inline void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *
2072 hci_encrypt_cfm(conn, ev->status, ev->encrypt); 2078 hci_encrypt_cfm(conn, ev->status, ev->encrypt);
2073 } 2079 }
2074 2080
2081unlock:
2075 hci_dev_unlock(hdev); 2082 hci_dev_unlock(hdev);
2076} 2083}
2077 2084
@@ -2125,7 +2132,7 @@ static inline void hci_remote_features_evt(struct hci_dev *hdev, struct sk_buff
2125 goto unlock; 2132 goto unlock;
2126 } 2133 }
2127 2134
2128 if (!ev->status) { 2135 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
2129 struct hci_cp_remote_name_req cp; 2136 struct hci_cp_remote_name_req cp;
2130 memset(&cp, 0, sizeof(cp)); 2137 memset(&cp, 0, sizeof(cp));
2131 bacpy(&cp.bdaddr, &conn->dst); 2138 bacpy(&cp.bdaddr, &conn->dst);
@@ -2901,7 +2908,7 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
2901 if (conn->state != BT_CONFIG) 2908 if (conn->state != BT_CONFIG)
2902 goto unlock; 2909 goto unlock;
2903 2910
2904 if (!ev->status) { 2911 if (!ev->status && !test_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
2905 struct hci_cp_remote_name_req cp; 2912 struct hci_cp_remote_name_req cp;
2906 memset(&cp, 0, sizeof(cp)); 2913 memset(&cp, 0, sizeof(cp));
2907 bacpy(&cp.bdaddr, &conn->dst); 2914 bacpy(&cp.bdaddr, &conn->dst);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 7adfcecf7a5..3714c965645 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -4916,6 +4916,11 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4916 4916
4917 if (!status && (chan->state == BT_CONNECTED || 4917 if (!status && (chan->state == BT_CONNECTED ||
4918 chan->state == BT_CONFIG)) { 4918 chan->state == BT_CONFIG)) {
4919 struct sock *sk = chan->sk;
4920
4921 bt_sk(sk)->suspended = false;
4922 sk->sk_state_change(sk);
4923
4919 l2cap_check_encryption(chan, encrypt); 4924 l2cap_check_encryption(chan, encrypt);
4920 l2cap_chan_unlock(chan); 4925 l2cap_chan_unlock(chan);
4921 continue; 4926 continue;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index 6bf8ff75d95..b7bc7b981ee 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -596,10 +596,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
596 sk->sk_state = BT_CONFIG; 596 sk->sk_state = BT_CONFIG;
597 chan->state = BT_CONFIG; 597 chan->state = BT_CONFIG;
598 598
599 /* or for ACL link, under defer_setup time */ 599 /* or for ACL link */
600 } else if (sk->sk_state == BT_CONNECT2 && 600 } else if ((sk->sk_state == BT_CONNECT2 &&
601 bt_sk(sk)->defer_setup) { 601 bt_sk(sk)->defer_setup) ||
602 err = l2cap_chan_check_security(chan); 602 sk->sk_state == BT_CONNECTED) {
603 if (!l2cap_chan_check_security(chan))
604 bt_sk(sk)->suspended = true;
605 else
606 sk->sk_state_change(sk);
603 } else { 607 } else {
604 err = -EINVAL; 608 err = -EINVAL;
605 } 609 }