diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 4 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 12 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 8 |
3 files changed, 14 insertions, 10 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8a0ce706aebd..a0a2f97b9c62 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1754,11 +1754,11 @@ int hci_register_dev(struct hci_dev *hdev) | |||
1754 | if (hdev->dev_type != HCI_AMP) | 1754 | if (hdev->dev_type != HCI_AMP) |
1755 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); | 1755 | set_bit(HCI_AUTO_OFF, &hdev->dev_flags); |
1756 | 1756 | ||
1757 | schedule_work(&hdev->power_on); | ||
1758 | |||
1759 | hci_notify(hdev, HCI_DEV_REG); | 1757 | hci_notify(hdev, HCI_DEV_REG); |
1760 | hci_dev_hold(hdev); | 1758 | hci_dev_hold(hdev); |
1761 | 1759 | ||
1760 | schedule_work(&hdev->power_on); | ||
1761 | |||
1762 | return id; | 1762 | return id; |
1763 | 1763 | ||
1764 | err_wqueue: | 1764 | err_wqueue: |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index aa2ea0a8142c..91de4239da66 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -326,7 +326,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, | |||
326 | struct hci_dev *d; | 326 | struct hci_dev *d; |
327 | size_t rp_len; | 327 | size_t rp_len; |
328 | u16 count; | 328 | u16 count; |
329 | int i, err; | 329 | int err; |
330 | 330 | ||
331 | BT_DBG("sock %p", sk); | 331 | BT_DBG("sock %p", sk); |
332 | 332 | ||
@@ -347,9 +347,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, | |||
347 | return -ENOMEM; | 347 | return -ENOMEM; |
348 | } | 348 | } |
349 | 349 | ||
350 | rp->num_controllers = cpu_to_le16(count); | 350 | count = 0; |
351 | |||
352 | i = 0; | ||
353 | list_for_each_entry(d, &hci_dev_list, list) { | 351 | list_for_each_entry(d, &hci_dev_list, list) { |
354 | if (test_bit(HCI_SETUP, &d->dev_flags)) | 352 | if (test_bit(HCI_SETUP, &d->dev_flags)) |
355 | continue; | 353 | continue; |
@@ -357,10 +355,13 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, | |||
357 | if (!mgmt_valid_hdev(d)) | 355 | if (!mgmt_valid_hdev(d)) |
358 | continue; | 356 | continue; |
359 | 357 | ||
360 | rp->index[i++] = cpu_to_le16(d->id); | 358 | rp->index[count++] = cpu_to_le16(d->id); |
361 | BT_DBG("Added hci%u", d->id); | 359 | BT_DBG("Added hci%u", d->id); |
362 | } | 360 | } |
363 | 361 | ||
362 | rp->num_controllers = cpu_to_le16(count); | ||
363 | rp_len = sizeof(*rp) + (2 * count); | ||
364 | |||
364 | read_unlock(&hci_dev_list_lock); | 365 | read_unlock(&hci_dev_list_lock); |
365 | 366 | ||
366 | err = cmd_complete(sk, MGMT_INDEX_NONE, MGMT_OP_READ_INDEX_LIST, 0, rp, | 367 | err = cmd_complete(sk, MGMT_INDEX_NONE, MGMT_OP_READ_INDEX_LIST, 0, rp, |
@@ -1366,6 +1367,7 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data, | |||
1366 | continue; | 1367 | continue; |
1367 | 1368 | ||
1368 | list_del(&match->list); | 1369 | list_del(&match->list); |
1370 | kfree(match); | ||
1369 | found++; | 1371 | found++; |
1370 | } | 1372 | } |
1371 | 1373 | ||
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index 8c225ef349cd..a5923378bdf0 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #define SMP_TIMEOUT msecs_to_jiffies(30000) | 33 | #define SMP_TIMEOUT msecs_to_jiffies(30000) |
34 | 34 | ||
35 | #define AUTH_REQ_MASK 0x07 | ||
36 | |||
35 | static inline void swap128(u8 src[16], u8 dst[16]) | 37 | static inline void swap128(u8 src[16], u8 dst[16]) |
36 | { | 38 | { |
37 | int i; | 39 | int i; |
@@ -230,7 +232,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn, | |||
230 | req->max_key_size = SMP_MAX_ENC_KEY_SIZE; | 232 | req->max_key_size = SMP_MAX_ENC_KEY_SIZE; |
231 | req->init_key_dist = 0; | 233 | req->init_key_dist = 0; |
232 | req->resp_key_dist = dist_keys; | 234 | req->resp_key_dist = dist_keys; |
233 | req->auth_req = authreq; | 235 | req->auth_req = (authreq & AUTH_REQ_MASK); |
234 | return; | 236 | return; |
235 | } | 237 | } |
236 | 238 | ||
@@ -239,7 +241,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn, | |||
239 | rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE; | 241 | rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE; |
240 | rsp->init_key_dist = 0; | 242 | rsp->init_key_dist = 0; |
241 | rsp->resp_key_dist = req->resp_key_dist & dist_keys; | 243 | rsp->resp_key_dist = req->resp_key_dist & dist_keys; |
242 | rsp->auth_req = authreq; | 244 | rsp->auth_req = (authreq & AUTH_REQ_MASK); |
243 | } | 245 | } |
244 | 246 | ||
245 | static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) | 247 | static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size) |
@@ -265,7 +267,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send) | |||
265 | 267 | ||
266 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags); | 268 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags); |
267 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, | 269 | mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type, |
268 | hcon->dst_type, reason); | 270 | hcon->dst_type, HCI_ERROR_AUTH_FAILURE); |
269 | 271 | ||
270 | cancel_delayed_work_sync(&conn->security_timer); | 272 | cancel_delayed_work_sync(&conn->security_timer); |
271 | 273 | ||