aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bluetooth/btusb.c6
-rw-r--r--include/net/bluetooth/hci.h2
-rw-r--r--net/bluetooth/hci_core.c10
-rw-r--r--net/bluetooth/hci_event.c4
-rw-r--r--net/bluetooth/l2cap_core.c4
-rw-r--r--net/bluetooth/l2cap_sock.c5
-rw-r--r--net/bluetooth/mgmt.c2
7 files changed, 26 insertions, 7 deletions
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 866811428e20..762a5109c68a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -71,6 +71,9 @@ static struct usb_device_id btusb_table[] = {
71 /* Apple MacBookAir3,1, MacBookAir3,2 */ 71 /* Apple MacBookAir3,1, MacBookAir3,2 */
72 { USB_DEVICE(0x05ac, 0x821b) }, 72 { USB_DEVICE(0x05ac, 0x821b) },
73 73
74 /* Apple MacBookPro8,2 */
75 { USB_DEVICE(0x05ac, 0x821a) },
76
74 /* AVM BlueFRITZ! USB v2.0 */ 77 /* AVM BlueFRITZ! USB v2.0 */
75 { USB_DEVICE(0x057c, 0x3800) }, 78 { USB_DEVICE(0x057c, 0x3800) },
76 79
@@ -690,7 +693,8 @@ static int btusb_send_frame(struct sk_buff *skb)
690 break; 693 break;
691 694
692 case HCI_ACLDATA_PKT: 695 case HCI_ACLDATA_PKT:
693 if (!data->bulk_tx_ep || hdev->conn_hash.acl_num < 1) 696 if (!data->bulk_tx_ep || (hdev->conn_hash.acl_num < 1 &&
697 hdev->conn_hash.le_num < 1))
694 return -ENODEV; 698 return -ENODEV;
695 699
696 urb = usb_alloc_urb(0, GFP_ATOMIC); 700 urb = usb_alloc_urb(0, GFP_ATOMIC);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 6846ec02dcb0..6138e313d175 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -84,6 +84,8 @@ enum {
84 HCI_SERVICE_CACHE, 84 HCI_SERVICE_CACHE,
85 HCI_LINK_KEYS, 85 HCI_LINK_KEYS,
86 HCI_DEBUG_KEYS, 86 HCI_DEBUG_KEYS,
87
88 HCI_RESET,
87}; 89};
88 90
89/* HCI ioctl defines */ 91/* HCI ioctl defines */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 675f0a1832ee..decd60198f31 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -185,6 +185,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt)
185 BT_DBG("%s %ld", hdev->name, opt); 185 BT_DBG("%s %ld", hdev->name, opt);
186 186
187 /* Reset device */ 187 /* Reset device */
188 set_bit(HCI_RESET, &hdev->flags);
188 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); 189 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
189} 190}
190 191
@@ -212,8 +213,10 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
212 /* Mandatory initialization */ 213 /* Mandatory initialization */
213 214
214 /* Reset */ 215 /* Reset */
215 if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) 216 if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
217 set_bit(HCI_RESET, &hdev->flags);
216 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL); 218 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
219 }
217 220
218 /* Read Local Supported Features */ 221 /* Read Local Supported Features */
219 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL); 222 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
@@ -583,6 +586,9 @@ static int hci_dev_do_close(struct hci_dev *hdev)
583 hci_req_cancel(hdev, ENODEV); 586 hci_req_cancel(hdev, ENODEV);
584 hci_req_lock(hdev); 587 hci_req_lock(hdev);
585 588
589 /* Stop timer, it might be running */
590 del_timer_sync(&hdev->cmd_timer);
591
586 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { 592 if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
587 hci_req_unlock(hdev); 593 hci_req_unlock(hdev);
588 return 0; 594 return 0;
@@ -622,7 +628,6 @@ static int hci_dev_do_close(struct hci_dev *hdev)
622 628
623 /* Drop last sent command */ 629 /* Drop last sent command */
624 if (hdev->sent_cmd) { 630 if (hdev->sent_cmd) {
625 del_timer_sync(&hdev->cmd_timer);
626 kfree_skb(hdev->sent_cmd); 631 kfree_skb(hdev->sent_cmd);
627 hdev->sent_cmd = NULL; 632 hdev->sent_cmd = NULL;
628 } 633 }
@@ -1073,6 +1078,7 @@ static void hci_cmd_timer(unsigned long arg)
1073 1078
1074 BT_ERR("%s command tx timeout", hdev->name); 1079 BT_ERR("%s command tx timeout", hdev->name);
1075 atomic_set(&hdev->cmd_cnt, 1); 1080 atomic_set(&hdev->cmd_cnt, 1);
1081 clear_bit(HCI_RESET, &hdev->flags);
1076 tasklet_schedule(&hdev->cmd_task); 1082 tasklet_schedule(&hdev->cmd_task);
1077} 1083}
1078 1084
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index da4c662dbc30..833797e9654b 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -183,6 +183,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
183 183
184 BT_DBG("%s status 0x%x", hdev->name, status); 184 BT_DBG("%s status 0x%x", hdev->name, status);
185 185
186 clear_bit(HCI_RESET, &hdev->flags);
187
186 hci_req_complete(hdev, HCI_OP_RESET, status); 188 hci_req_complete(hdev, HCI_OP_RESET, status);
187} 189}
188 190
@@ -1865,7 +1867,7 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
1865 if (ev->opcode != HCI_OP_NOP) 1867 if (ev->opcode != HCI_OP_NOP)
1866 del_timer(&hdev->cmd_timer); 1868 del_timer(&hdev->cmd_timer);
1867 1869
1868 if (ev->ncmd) { 1870 if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
1869 atomic_set(&hdev->cmd_cnt, 1); 1871 atomic_set(&hdev->cmd_cnt, 1);
1870 if (!skb_queue_empty(&hdev->cmd_q)) 1872 if (!skb_queue_empty(&hdev->cmd_q))
1871 tasklet_schedule(&hdev->cmd_task); 1873 tasklet_schedule(&hdev->cmd_task);
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 033c83be3524..c3cebed205cc 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1115,7 +1115,9 @@ int l2cap_ertm_send(struct sock *sk)
1115 bt_cb(skb)->tx_seq = pi->next_tx_seq; 1115 bt_cb(skb)->tx_seq = pi->next_tx_seq;
1116 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64; 1116 pi->next_tx_seq = (pi->next_tx_seq + 1) % 64;
1117 1117
1118 pi->unacked_frames++; 1118 if (bt_cb(skb)->retries == 1)
1119 pi->unacked_frames++;
1120
1119 pi->frames_sent++; 1121 pi->frames_sent++;
1120 1122
1121 if (skb_queue_is_last(TX_QUEUE(sk), skb)) 1123 if (skb_queue_is_last(TX_QUEUE(sk), skb))
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index fc85e7ae33c7..f77308e63e58 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -923,8 +923,9 @@ void __l2cap_sock_close(struct sock *sk, int reason)
923 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO); 923 rsp.status = cpu_to_le16(L2CAP_CS_NO_INFO);
924 l2cap_send_cmd(conn, l2cap_pi(sk)->ident, 924 l2cap_send_cmd(conn, l2cap_pi(sk)->ident,
925 L2CAP_CONN_RSP, sizeof(rsp), &rsp); 925 L2CAP_CONN_RSP, sizeof(rsp), &rsp);
926 } else 926 }
927 l2cap_chan_del(sk, reason); 927
928 l2cap_chan_del(sk, reason);
928 break; 929 break;
929 930
930 case BT_CONNECT: 931 case BT_CONNECT:
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 62055c9a8084..f87691e04dca 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1389,6 +1389,8 @@ static int user_confirm_reply(struct sock *sk, u16 index, unsigned char *data,
1389 if (!hdev) 1389 if (!hdev)
1390 return cmd_status(sk, index, mgmt_op, ENODEV); 1390 return cmd_status(sk, index, mgmt_op, ENODEV);
1391 1391
1392 hci_dev_lock_bh(hdev);
1393
1392 if (!test_bit(HCI_UP, &hdev->flags)) { 1394 if (!test_bit(HCI_UP, &hdev->flags)) {
1393 err = cmd_status(sk, index, mgmt_op, ENETDOWN); 1395 err = cmd_status(sk, index, mgmt_op, ENETDOWN);
1394 goto failed; 1396 goto failed;