aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2014-07-29 10:32:36 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-07-29 10:32:36 -0400
commita1ae52c203417a4e6aca01a5e8955d74fc7b3d0a (patch)
tree48ac79fee7d145f0c31c28bb09c9c066caf48170 /net
parent0da4cc6e624675c721e15cd7440ccd65b154f685 (diff)
parent3bd2724010a51d5d15afa8065ac3c5fab3725499 (diff)
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c181
-rw-r--r--net/bluetooth/hci_event.c35
-rw-r--r--net/bluetooth/mgmt.c33
-rw-r--r--net/bluetooth/rfcomm/core.c7
-rw-r--r--net/bluetooth/smp.c16
5 files changed, 252 insertions, 20 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index cfcb6055ced8..61bd1a8c5849 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -970,6 +970,62 @@ static int adv_channel_map_get(void *data, u64 *val)
970DEFINE_SIMPLE_ATTRIBUTE(adv_channel_map_fops, adv_channel_map_get, 970DEFINE_SIMPLE_ATTRIBUTE(adv_channel_map_fops, adv_channel_map_get,
971 adv_channel_map_set, "%llu\n"); 971 adv_channel_map_set, "%llu\n");
972 972
973static int adv_min_interval_set(void *data, u64 val)
974{
975 struct hci_dev *hdev = data;
976
977 if (val < 0x0020 || val > 0x4000 || val > hdev->le_adv_max_interval)
978 return -EINVAL;
979
980 hci_dev_lock(hdev);
981 hdev->le_adv_min_interval = val;
982 hci_dev_unlock(hdev);
983
984 return 0;
985}
986
987static int adv_min_interval_get(void *data, u64 *val)
988{
989 struct hci_dev *hdev = data;
990
991 hci_dev_lock(hdev);
992 *val = hdev->le_adv_min_interval;
993 hci_dev_unlock(hdev);
994
995 return 0;
996}
997
998DEFINE_SIMPLE_ATTRIBUTE(adv_min_interval_fops, adv_min_interval_get,
999 adv_min_interval_set, "%llu\n");
1000
1001static int adv_max_interval_set(void *data, u64 val)
1002{
1003 struct hci_dev *hdev = data;
1004
1005 if (val < 0x0020 || val > 0x4000 || val < hdev->le_adv_min_interval)
1006 return -EINVAL;
1007
1008 hci_dev_lock(hdev);
1009 hdev->le_adv_max_interval = val;
1010 hci_dev_unlock(hdev);
1011
1012 return 0;
1013}
1014
1015static int adv_max_interval_get(void *data, u64 *val)
1016{
1017 struct hci_dev *hdev = data;
1018
1019 hci_dev_lock(hdev);
1020 *val = hdev->le_adv_max_interval;
1021 hci_dev_unlock(hdev);
1022
1023 return 0;
1024}
1025
1026DEFINE_SIMPLE_ATTRIBUTE(adv_max_interval_fops, adv_max_interval_get,
1027 adv_max_interval_set, "%llu\n");
1028
973static int device_list_show(struct seq_file *f, void *ptr) 1029static int device_list_show(struct seq_file *f, void *ptr)
974{ 1030{
975 struct hci_dev *hdev = f->private; 1031 struct hci_dev *hdev = f->private;
@@ -1567,7 +1623,7 @@ static void hci_set_le_support(struct hci_request *req)
1567 1623
1568 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { 1624 if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
1569 cp.le = 0x01; 1625 cp.le = 0x01;
1570 cp.simul = lmp_le_br_capable(hdev); 1626 cp.simul = 0x00;
1571 } 1627 }
1572 1628
1573 if (cp.le != lmp_host_le_capable(hdev)) 1629 if (cp.le != lmp_host_le_capable(hdev))
@@ -1686,6 +1742,14 @@ static void hci_init4_req(struct hci_request *req, unsigned long opt)
1686 if (hdev->commands[22] & 0x04) 1742 if (hdev->commands[22] & 0x04)
1687 hci_set_event_mask_page_2(req); 1743 hci_set_event_mask_page_2(req);
1688 1744
1745 /* Read local codec list if the HCI command is supported */
1746 if (hdev->commands[29] & 0x20)
1747 hci_req_add(req, HCI_OP_READ_LOCAL_CODECS, 0, NULL);
1748
1749 /* Get MWS transport configuration if the HCI command is supported */
1750 if (hdev->commands[30] & 0x08)
1751 hci_req_add(req, HCI_OP_GET_MWS_TRANSPORT_CONFIG, 0, NULL);
1752
1689 /* Check for Synchronization Train support */ 1753 /* Check for Synchronization Train support */
1690 if (lmp_sync_train_capable(hdev)) 1754 if (lmp_sync_train_capable(hdev))
1691 hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL); 1755 hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL);
@@ -1825,6 +1889,10 @@ static int __hci_init(struct hci_dev *hdev)
1825 hdev, &supervision_timeout_fops); 1889 hdev, &supervision_timeout_fops);
1826 debugfs_create_file("adv_channel_map", 0644, hdev->debugfs, 1890 debugfs_create_file("adv_channel_map", 0644, hdev->debugfs,
1827 hdev, &adv_channel_map_fops); 1891 hdev, &adv_channel_map_fops);
1892 debugfs_create_file("adv_min_interval", 0644, hdev->debugfs,
1893 hdev, &adv_min_interval_fops);
1894 debugfs_create_file("adv_max_interval", 0644, hdev->debugfs,
1895 hdev, &adv_max_interval_fops);
1828 debugfs_create_file("device_list", 0444, hdev->debugfs, hdev, 1896 debugfs_create_file("device_list", 0444, hdev->debugfs, hdev,
1829 &device_list_fops); 1897 &device_list_fops);
1830 debugfs_create_u16("discov_interleaved_timeout", 0644, 1898 debugfs_create_u16("discov_interleaved_timeout", 0644,
@@ -3639,6 +3707,7 @@ int hci_conn_params_set(struct hci_dev *hdev, bdaddr_t *addr, u8 addr_type,
3639 list_add(&params->action, &hdev->pend_le_reports); 3707 list_add(&params->action, &hdev->pend_le_reports);
3640 hci_update_background_scan(hdev); 3708 hci_update_background_scan(hdev);
3641 break; 3709 break;
3710 case HCI_AUTO_CONN_DIRECT:
3642 case HCI_AUTO_CONN_ALWAYS: 3711 case HCI_AUTO_CONN_ALWAYS:
3643 if (!is_connected(hdev, addr, addr_type)) { 3712 if (!is_connected(hdev, addr, addr_type)) {
3644 list_add(&params->action, &hdev->pend_le_conns); 3713 list_add(&params->action, &hdev->pend_le_conns);
@@ -3914,6 +3983,8 @@ struct hci_dev *hci_alloc_dev(void)
3914 hdev->sniff_min_interval = 80; 3983 hdev->sniff_min_interval = 80;
3915 3984
3916 hdev->le_adv_channel_map = 0x07; 3985 hdev->le_adv_channel_map = 0x07;
3986 hdev->le_adv_min_interval = 0x0800;
3987 hdev->le_adv_max_interval = 0x0800;
3917 hdev->le_scan_interval = 0x0060; 3988 hdev->le_scan_interval = 0x0060;
3918 hdev->le_scan_window = 0x0030; 3989 hdev->le_scan_window = 0x0030;
3919 hdev->le_conn_min_interval = 0x0028; 3990 hdev->le_conn_min_interval = 0x0028;
@@ -5397,12 +5468,113 @@ void hci_req_add_le_scan_disable(struct hci_request *req)
5397 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp); 5468 hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
5398} 5469}
5399 5470
5471static void add_to_white_list(struct hci_request *req,
5472 struct hci_conn_params *params)
5473{
5474 struct hci_cp_le_add_to_white_list cp;
5475
5476 cp.bdaddr_type = params->addr_type;
5477 bacpy(&cp.bdaddr, &params->addr);
5478
5479 hci_req_add(req, HCI_OP_LE_ADD_TO_WHITE_LIST, sizeof(cp), &cp);
5480}
5481
5482static u8 update_white_list(struct hci_request *req)
5483{
5484 struct hci_dev *hdev = req->hdev;
5485 struct hci_conn_params *params;
5486 struct bdaddr_list *b;
5487 uint8_t white_list_entries = 0;
5488
5489 /* Go through the current white list programmed into the
5490 * controller one by one and check if that address is still
5491 * in the list of pending connections or list of devices to
5492 * report. If not present in either list, then queue the
5493 * command to remove it from the controller.
5494 */
5495 list_for_each_entry(b, &hdev->le_white_list, list) {
5496 struct hci_cp_le_del_from_white_list cp;
5497
5498 if (hci_pend_le_action_lookup(&hdev->pend_le_conns,
5499 &b->bdaddr, b->bdaddr_type) ||
5500 hci_pend_le_action_lookup(&hdev->pend_le_reports,
5501 &b->bdaddr, b->bdaddr_type)) {
5502 white_list_entries++;
5503 continue;
5504 }
5505
5506 cp.bdaddr_type = b->bdaddr_type;
5507 bacpy(&cp.bdaddr, &b->bdaddr);
5508
5509 hci_req_add(req, HCI_OP_LE_DEL_FROM_WHITE_LIST,
5510 sizeof(cp), &cp);
5511 }
5512
5513 /* Since all no longer valid white list entries have been
5514 * removed, walk through the list of pending connections
5515 * and ensure that any new device gets programmed into
5516 * the controller.
5517 *
5518 * If the list of the devices is larger than the list of
5519 * available white list entries in the controller, then
5520 * just abort and return filer policy value to not use the
5521 * white list.
5522 */
5523 list_for_each_entry(params, &hdev->pend_le_conns, action) {
5524 if (hci_bdaddr_list_lookup(&hdev->le_white_list,
5525 &params->addr, params->addr_type))
5526 continue;
5527
5528 if (white_list_entries >= hdev->le_white_list_size) {
5529 /* Select filter policy to accept all advertising */
5530 return 0x00;
5531 }
5532
5533 if (hci_find_irk_by_addr(hdev, &params->addr,
5534 params->addr_type)) {
5535 /* White list can not be used with RPAs */
5536 return 0x00;
5537 }
5538
5539 white_list_entries++;
5540 add_to_white_list(req, params);
5541 }
5542
5543 /* After adding all new pending connections, walk through
5544 * the list of pending reports and also add these to the
5545 * white list if there is still space.
5546 */
5547 list_for_each_entry(params, &hdev->pend_le_reports, action) {
5548 if (hci_bdaddr_list_lookup(&hdev->le_white_list,
5549 &params->addr, params->addr_type))
5550 continue;
5551
5552 if (white_list_entries >= hdev->le_white_list_size) {
5553 /* Select filter policy to accept all advertising */
5554 return 0x00;
5555 }
5556
5557 if (hci_find_irk_by_addr(hdev, &params->addr,
5558 params->addr_type)) {
5559 /* White list can not be used with RPAs */
5560 return 0x00;
5561 }
5562
5563 white_list_entries++;
5564 add_to_white_list(req, params);
5565 }
5566
5567 /* Select filter policy to use white list */
5568 return 0x01;
5569}
5570
5400void hci_req_add_le_passive_scan(struct hci_request *req) 5571void hci_req_add_le_passive_scan(struct hci_request *req)
5401{ 5572{
5402 struct hci_cp_le_set_scan_param param_cp; 5573 struct hci_cp_le_set_scan_param param_cp;
5403 struct hci_cp_le_set_scan_enable enable_cp; 5574 struct hci_cp_le_set_scan_enable enable_cp;
5404 struct hci_dev *hdev = req->hdev; 5575 struct hci_dev *hdev = req->hdev;
5405 u8 own_addr_type; 5576 u8 own_addr_type;
5577 u8 filter_policy;
5406 5578
5407 /* Set require_privacy to false since no SCAN_REQ are send 5579 /* Set require_privacy to false since no SCAN_REQ are send
5408 * during passive scanning. Not using an unresolvable address 5580 * during passive scanning. Not using an unresolvable address
@@ -5413,11 +5585,18 @@ void hci_req_add_le_passive_scan(struct hci_request *req)
5413 if (hci_update_random_address(req, false, &own_addr_type)) 5585 if (hci_update_random_address(req, false, &own_addr_type))
5414 return; 5586 return;
5415 5587
5588 /* Adding or removing entries from the white list must
5589 * happen before enabling scanning. The controller does
5590 * not allow white list modification while scanning.
5591 */
5592 filter_policy = update_white_list(req);
5593
5416 memset(&param_cp, 0, sizeof(param_cp)); 5594 memset(&param_cp, 0, sizeof(param_cp));
5417 param_cp.type = LE_SCAN_PASSIVE; 5595 param_cp.type = LE_SCAN_PASSIVE;
5418 param_cp.interval = cpu_to_le16(hdev->le_scan_interval); 5596 param_cp.interval = cpu_to_le16(hdev->le_scan_interval);
5419 param_cp.window = cpu_to_le16(hdev->le_scan_window); 5597 param_cp.window = cpu_to_le16(hdev->le_scan_window);
5420 param_cp.own_address_type = own_addr_type; 5598 param_cp.own_address_type = own_addr_type;
5599 param_cp.filter_policy = filter_policy;
5421 hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp), 5600 hci_req_add(req, HCI_OP_LE_SET_SCAN_PARAM, sizeof(param_cp),
5422 &param_cp); 5601 &param_cp);
5423 5602
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 4c41774aa556..623501ddd1b8 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -317,7 +317,7 @@ static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb)
317 if (param & SCAN_PAGE) 317 if (param & SCAN_PAGE)
318 set_bit(HCI_PSCAN, &hdev->flags); 318 set_bit(HCI_PSCAN, &hdev->flags);
319 else 319 else
320 clear_bit(HCI_ISCAN, &hdev->flags); 320 clear_bit(HCI_PSCAN, &hdev->flags);
321 321
322done: 322done:
323 hci_dev_unlock(hdev); 323 hci_dev_unlock(hdev);
@@ -2259,6 +2259,7 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2259 break; 2259 break;
2260 /* Fall through */ 2260 /* Fall through */
2261 2261
2262 case HCI_AUTO_CONN_DIRECT:
2262 case HCI_AUTO_CONN_ALWAYS: 2263 case HCI_AUTO_CONN_ALWAYS:
2263 list_del_init(&params->action); 2264 list_del_init(&params->action);
2264 list_add(&params->action, &hdev->pend_le_conns); 2265 list_add(&params->action, &hdev->pend_le_conns);
@@ -4251,6 +4252,7 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr,
4251 u8 addr_type, u8 adv_type) 4252 u8 addr_type, u8 adv_type)
4252{ 4253{
4253 struct hci_conn *conn; 4254 struct hci_conn *conn;
4255 struct hci_conn_params *params;
4254 4256
4255 /* If the event is not connectable don't proceed further */ 4257 /* If the event is not connectable don't proceed further */
4256 if (adv_type != LE_ADV_IND && adv_type != LE_ADV_DIRECT_IND) 4258 if (adv_type != LE_ADV_IND && adv_type != LE_ADV_DIRECT_IND)
@@ -4266,18 +4268,35 @@ static void check_pending_le_conn(struct hci_dev *hdev, bdaddr_t *addr,
4266 if (hdev->conn_hash.le_num_slave > 0) 4268 if (hdev->conn_hash.le_num_slave > 0)
4267 return; 4269 return;
4268 4270
4269 /* If we're connectable, always connect any ADV_DIRECT_IND event */
4270 if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags) &&
4271 adv_type == LE_ADV_DIRECT_IND)
4272 goto connect;
4273
4274 /* If we're not connectable only connect devices that we have in 4271 /* If we're not connectable only connect devices that we have in
4275 * our pend_le_conns list. 4272 * our pend_le_conns list.
4276 */ 4273 */
4277 if (!hci_pend_le_action_lookup(&hdev->pend_le_conns, addr, addr_type)) 4274 params = hci_pend_le_action_lookup(&hdev->pend_le_conns,
4275 addr, addr_type);
4276 if (!params)
4277 return;
4278
4279 switch (params->auto_connect) {
4280 case HCI_AUTO_CONN_DIRECT:
4281 /* Only devices advertising with ADV_DIRECT_IND are
4282 * triggering a connection attempt. This is allowing
4283 * incoming connections from slave devices.
4284 */
4285 if (adv_type != LE_ADV_DIRECT_IND)
4286 return;
4287 break;
4288 case HCI_AUTO_CONN_ALWAYS:
4289 /* Devices advertising with ADV_IND or ADV_DIRECT_IND
4290 * are triggering a connection attempt. This means
4291 * that incoming connectioms from slave device are
4292 * accepted and also outgoing connections to slave
4293 * devices are established when found.
4294 */
4295 break;
4296 default:
4278 return; 4297 return;
4298 }
4279 4299
4280connect:
4281 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW, 4300 conn = hci_connect_le(hdev, addr, addr_type, BT_SECURITY_LOW,
4282 HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER); 4301 HCI_LE_AUTOCONN_TIMEOUT, HCI_ROLE_MASTER);
4283 if (!IS_ERR(conn)) 4302 if (!IS_ERR(conn))
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 190668367e42..5d18efcb8467 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1086,8 +1086,8 @@ static void enable_advertising(struct hci_request *req)
1086 return; 1086 return;
1087 1087
1088 memset(&cp, 0, sizeof(cp)); 1088 memset(&cp, 0, sizeof(cp));
1089 cp.min_interval = cpu_to_le16(0x0800); 1089 cp.min_interval = cpu_to_le16(hdev->le_adv_min_interval);
1090 cp.max_interval = cpu_to_le16(0x0800); 1090 cp.max_interval = cpu_to_le16(hdev->le_adv_max_interval);
1091 cp.type = connectable ? LE_ADV_IND : LE_ADV_NONCONN_IND; 1091 cp.type = connectable ? LE_ADV_IND : LE_ADV_NONCONN_IND;
1092 cp.own_address_type = own_addr_type; 1092 cp.own_address_type = own_addr_type;
1093 cp.channel_map = hdev->le_adv_channel_map; 1093 cp.channel_map = hdev->le_adv_channel_map;
@@ -1881,7 +1881,18 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
1881 if (cp->val) { 1881 if (cp->val) {
1882 scan = SCAN_PAGE; 1882 scan = SCAN_PAGE;
1883 } else { 1883 } else {
1884 scan = 0; 1884 /* If we don't have any whitelist entries just
1885 * disable all scanning. If there are entries
1886 * and we had both page and inquiry scanning
1887 * enabled then fall back to only page scanning.
1888 * Otherwise no changes are needed.
1889 */
1890 if (list_empty(&hdev->whitelist))
1891 scan = SCAN_DISABLED;
1892 else if (test_bit(HCI_ISCAN, &hdev->flags))
1893 scan = SCAN_PAGE;
1894 else
1895 goto no_scan_update;
1885 1896
1886 if (test_bit(HCI_ISCAN, &hdev->flags) && 1897 if (test_bit(HCI_ISCAN, &hdev->flags) &&
1887 hdev->discov_timeout > 0) 1898 hdev->discov_timeout > 0)
@@ -1891,6 +1902,7 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
1891 hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan); 1902 hci_req_add(&req, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
1892 } 1903 }
1893 1904
1905no_scan_update:
1894 /* If we're going from non-connectable to connectable or 1906 /* If we're going from non-connectable to connectable or
1895 * vice-versa when fast connectable is enabled ensure that fast 1907 * vice-versa when fast connectable is enabled ensure that fast
1896 * connectable gets disabled. write_fast_connectable won't do 1908 * connectable gets disabled. write_fast_connectable won't do
@@ -2264,7 +2276,7 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
2264 2276
2265 if (val) { 2277 if (val) {
2266 hci_cp.le = val; 2278 hci_cp.le = val;
2267 hci_cp.simul = lmp_le_br_capable(hdev); 2279 hci_cp.simul = 0x00;
2268 } else { 2280 } else {
2269 if (test_bit(HCI_LE_ADV, &hdev->dev_flags)) 2281 if (test_bit(HCI_LE_ADV, &hdev->dev_flags))
2270 disable_advertising(&req); 2282 disable_advertising(&req);
@@ -5271,7 +5283,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
5271 MGMT_STATUS_INVALID_PARAMS, 5283 MGMT_STATUS_INVALID_PARAMS,
5272 &cp->addr, sizeof(cp->addr)); 5284 &cp->addr, sizeof(cp->addr));
5273 5285
5274 if (cp->action != 0x00 && cp->action != 0x01) 5286 if (cp->action != 0x00 && cp->action != 0x01 && cp->action != 0x02)
5275 return cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE, 5287 return cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE,
5276 MGMT_STATUS_INVALID_PARAMS, 5288 MGMT_STATUS_INVALID_PARAMS,
5277 &cp->addr, sizeof(cp->addr)); 5289 &cp->addr, sizeof(cp->addr));
@@ -5281,7 +5293,7 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
5281 if (cp->addr.type == BDADDR_BREDR) { 5293 if (cp->addr.type == BDADDR_BREDR) {
5282 bool update_scan; 5294 bool update_scan;
5283 5295
5284 /* Only "connect" action supported for now */ 5296 /* Only incoming connections action is supported for now */
5285 if (cp->action != 0x01) { 5297 if (cp->action != 0x01) {
5286 err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE, 5298 err = cmd_complete(sk, hdev->id, MGMT_OP_ADD_DEVICE,
5287 MGMT_STATUS_INVALID_PARAMS, 5299 MGMT_STATUS_INVALID_PARAMS,
@@ -5307,8 +5319,10 @@ static int add_device(struct sock *sk, struct hci_dev *hdev,
5307 else 5319 else
5308 addr_type = ADDR_LE_DEV_RANDOM; 5320 addr_type = ADDR_LE_DEV_RANDOM;
5309 5321
5310 if (cp->action) 5322 if (cp->action == 0x02)
5311 auto_conn = HCI_AUTO_CONN_ALWAYS; 5323 auto_conn = HCI_AUTO_CONN_ALWAYS;
5324 else if (cp->action == 0x01)
5325 auto_conn = HCI_AUTO_CONN_DIRECT;
5312 else 5326 else
5313 auto_conn = HCI_AUTO_CONN_REPORT; 5327 auto_conn = HCI_AUTO_CONN_REPORT;
5314 5328
@@ -5870,6 +5884,7 @@ static void restart_le_actions(struct hci_dev *hdev)
5870 list_del_init(&p->action); 5884 list_del_init(&p->action);
5871 5885
5872 switch (p->auto_connect) { 5886 switch (p->auto_connect) {
5887 case HCI_AUTO_CONN_DIRECT:
5873 case HCI_AUTO_CONN_ALWAYS: 5888 case HCI_AUTO_CONN_ALWAYS:
5874 list_add(&p->action, &hdev->pend_le_conns); 5889 list_add(&p->action, &hdev->pend_le_conns);
5875 break; 5890 break;
@@ -5922,8 +5937,8 @@ static int powered_update_hci(struct hci_dev *hdev)
5922 lmp_bredr_capable(hdev)) { 5937 lmp_bredr_capable(hdev)) {
5923 struct hci_cp_write_le_host_supported cp; 5938 struct hci_cp_write_le_host_supported cp;
5924 5939
5925 cp.le = 1; 5940 cp.le = 0x01;
5926 cp.simul = lmp_le_br_capable(hdev); 5941 cp.simul = 0x00;
5927 5942
5928 /* Check first if we already have the right 5943 /* Check first if we already have the right
5929 * host state (host features set) 5944 * host state (host features set)
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index a0690a84f3e9..af73bc3acb40 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1910,10 +1910,13 @@ static struct rfcomm_session *rfcomm_process_rx(struct rfcomm_session *s)
1910 /* Get data directly from socket receive queue without copying it. */ 1910 /* Get data directly from socket receive queue without copying it. */
1911 while ((skb = skb_dequeue(&sk->sk_receive_queue))) { 1911 while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
1912 skb_orphan(skb); 1912 skb_orphan(skb);
1913 if (!skb_linearize(skb)) 1913 if (!skb_linearize(skb)) {
1914 s = rfcomm_recv_frame(s, skb); 1914 s = rfcomm_recv_frame(s, skb);
1915 else 1915 if (!s)
1916 break;
1917 } else {
1916 kfree_skb(skb); 1918 kfree_skb(skb);
1919 }
1917 } 1920 }
1918 1921
1919 if (s && (sk->sk_state == BT_CLOSED)) 1922 if (s && (sk->sk_state == BT_CLOSED))
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index e49c83d8b957..a7c344b4acbc 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -1291,6 +1291,22 @@ static void smp_notify_keys(struct l2cap_conn *conn)
1291 bacpy(&hcon->dst, &smp->remote_irk->bdaddr); 1291 bacpy(&hcon->dst, &smp->remote_irk->bdaddr);
1292 hcon->dst_type = smp->remote_irk->addr_type; 1292 hcon->dst_type = smp->remote_irk->addr_type;
1293 l2cap_conn_update_id_addr(hcon); 1293 l2cap_conn_update_id_addr(hcon);
1294
1295 /* When receiving an indentity resolving key for
1296 * a remote device that does not use a resolvable
1297 * private address, just remove the key so that
1298 * it is possible to use the controller white
1299 * list for scanning.
1300 *
1301 * Userspace will have been told to not store
1302 * this key at this point. So it is safe to
1303 * just remove it.
1304 */
1305 if (!bacmp(&smp->remote_irk->rpa, BDADDR_ANY)) {
1306 list_del(&smp->remote_irk->list);
1307 kfree(smp->remote_irk);
1308 smp->remote_irk = NULL;
1309 }
1294 } 1310 }
1295 1311
1296 /* The LTKs and CSRKs should be persistent only if both sides 1312 /* The LTKs and CSRKs should be persistent only if both sides