diff options
-rw-r--r-- | drivers/bluetooth/hci_usb.c | 6 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 9 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 9 | ||||
-rw-r--r-- | net/bluetooth/l2cap.c | 6 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 29 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 11 |
6 files changed, 53 insertions, 17 deletions
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c index 406af579ac3a..b0238b46dded 100644 --- a/drivers/bluetooth/hci_usb.c +++ b/drivers/bluetooth/hci_usb.c | |||
@@ -114,10 +114,16 @@ static struct usb_device_id blacklist_ids[] = { | |||
114 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, | 114 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU }, |
115 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 }, | 115 | { USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 }, |
116 | 116 | ||
117 | /* Broadcom BCM2045 */ | ||
118 | { USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_WRONG_SCO_MTU }, | ||
119 | |||
117 | /* IBM/Lenovo ThinkPad with Broadcom chip */ | 120 | /* IBM/Lenovo ThinkPad with Broadcom chip */ |
118 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, | 121 | { USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU }, |
119 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU }, | 122 | { USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU }, |
120 | 123 | ||
124 | /* Targus ACB10US */ | ||
125 | { USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET }, | ||
126 | |||
121 | /* ANYCOM Bluetooth USB-200 and USB-250 */ | 127 | /* ANYCOM Bluetooth USB-200 and USB-250 */ |
122 | { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET }, | 128 | { USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET }, |
123 | 129 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 832b5f44be5c..bfc9a35bad33 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -499,6 +499,15 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char | |||
499 | break; | 499 | break; |
500 | 500 | ||
501 | case HCI_FILTER: | 501 | case HCI_FILTER: |
502 | { | ||
503 | struct hci_filter *f = &hci_pi(sk)->filter; | ||
504 | |||
505 | uf.type_mask = f->type_mask; | ||
506 | uf.opcode = f->opcode; | ||
507 | uf.event_mask[0] = *((u32 *) f->event_mask + 0); | ||
508 | uf.event_mask[1] = *((u32 *) f->event_mask + 1); | ||
509 | } | ||
510 | |||
502 | len = min_t(unsigned int, len, sizeof(uf)); | 511 | len = min_t(unsigned int, len, sizeof(uf)); |
503 | if (copy_from_user(&uf, optval, len)) { | 512 | if (copy_from_user(&uf, optval, len)) { |
504 | err = -EFAULT; | 513 | err = -EFAULT; |
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 801d687ea4ef..359e3440cf29 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -305,7 +305,7 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
305 | 305 | ||
306 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); | 306 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); |
307 | 307 | ||
308 | dev->class = bt_class; | 308 | dev->bus = &bt_bus; |
309 | dev->parent = hdev->parent; | 309 | dev->parent = hdev->parent; |
310 | 310 | ||
311 | strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); | 311 | strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE); |
@@ -322,6 +322,10 @@ int hci_register_sysfs(struct hci_dev *hdev) | |||
322 | if (device_create_file(dev, bt_attrs[i]) < 0) | 322 | if (device_create_file(dev, bt_attrs[i]) < 0) |
323 | BT_ERR("Failed to create device attribute"); | 323 | BT_ERR("Failed to create device attribute"); |
324 | 324 | ||
325 | if (sysfs_create_link(&bt_class->subsys.kset.kobj, | ||
326 | &dev->kobj, kobject_name(&dev->kobj)) < 0) | ||
327 | BT_ERR("Failed to create class symlink"); | ||
328 | |||
325 | return 0; | 329 | return 0; |
326 | } | 330 | } |
327 | 331 | ||
@@ -329,6 +333,9 @@ void hci_unregister_sysfs(struct hci_dev *hdev) | |||
329 | { | 333 | { |
330 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); | 334 | BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type); |
331 | 335 | ||
336 | sysfs_remove_link(&bt_class->subsys.kset.kobj, | ||
337 | kobject_name(&hdev->dev.kobj)); | ||
338 | |||
332 | device_del(&hdev->dev); | 339 | device_del(&hdev->dev); |
333 | } | 340 | } |
334 | 341 | ||
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index a5867879b615..a59b1fb63b76 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -954,11 +954,17 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch | |||
954 | 954 | ||
955 | switch (optname) { | 955 | switch (optname) { |
956 | case L2CAP_OPTIONS: | 956 | case L2CAP_OPTIONS: |
957 | opts.imtu = l2cap_pi(sk)->imtu; | ||
958 | opts.omtu = l2cap_pi(sk)->omtu; | ||
959 | opts.flush_to = l2cap_pi(sk)->flush_to; | ||
960 | opts.mode = 0x00; | ||
961 | |||
957 | len = min_t(unsigned int, sizeof(opts), optlen); | 962 | len = min_t(unsigned int, sizeof(opts), optlen); |
958 | if (copy_from_user((char *) &opts, optval, len)) { | 963 | if (copy_from_user((char *) &opts, optval, len)) { |
959 | err = -EFAULT; | 964 | err = -EFAULT; |
960 | break; | 965 | break; |
961 | } | 966 | } |
967 | |||
962 | l2cap_pi(sk)->imtu = opts.imtu; | 968 | l2cap_pi(sk)->imtu = opts.imtu; |
963 | l2cap_pi(sk)->omtu = opts.omtu; | 969 | l2cap_pi(sk)->omtu = opts.omtu; |
964 | break; | 970 | break; |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index fe7df90eb707..52e04df323ea 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -622,7 +622,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst | |||
622 | bacpy(&addr.l2_bdaddr, src); | 622 | bacpy(&addr.l2_bdaddr, src); |
623 | addr.l2_family = AF_BLUETOOTH; | 623 | addr.l2_family = AF_BLUETOOTH; |
624 | addr.l2_psm = 0; | 624 | addr.l2_psm = 0; |
625 | *err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr)); | 625 | *err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr)); |
626 | if (*err < 0) | 626 | if (*err < 0) |
627 | goto failed; | 627 | goto failed; |
628 | 628 | ||
@@ -643,7 +643,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst | |||
643 | bacpy(&addr.l2_bdaddr, dst); | 643 | bacpy(&addr.l2_bdaddr, dst); |
644 | addr.l2_family = AF_BLUETOOTH; | 644 | addr.l2_family = AF_BLUETOOTH; |
645 | addr.l2_psm = htobs(RFCOMM_PSM); | 645 | addr.l2_psm = htobs(RFCOMM_PSM); |
646 | *err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); | 646 | *err = kernel_connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK); |
647 | if (*err == 0 || *err == -EINPROGRESS) | 647 | if (*err == 0 || *err == -EINPROGRESS) |
648 | return s; | 648 | return s; |
649 | 649 | ||
@@ -1058,6 +1058,12 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) | |||
1058 | case BT_DISCONN: | 1058 | case BT_DISCONN: |
1059 | d->state = BT_CLOSED; | 1059 | d->state = BT_CLOSED; |
1060 | __rfcomm_dlc_close(d, 0); | 1060 | __rfcomm_dlc_close(d, 0); |
1061 | |||
1062 | if (list_empty(&s->dlcs)) { | ||
1063 | s->state = BT_DISCONN; | ||
1064 | rfcomm_send_disc(s, 0); | ||
1065 | } | ||
1066 | |||
1061 | break; | 1067 | break; |
1062 | } | 1068 | } |
1063 | } else { | 1069 | } else { |
@@ -1067,6 +1073,10 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci) | |||
1067 | s->state = BT_CONNECTED; | 1073 | s->state = BT_CONNECTED; |
1068 | rfcomm_process_connect(s); | 1074 | rfcomm_process_connect(s); |
1069 | break; | 1075 | break; |
1076 | |||
1077 | case BT_DISCONN: | ||
1078 | rfcomm_session_put(s); | ||
1079 | break; | ||
1070 | } | 1080 | } |
1071 | } | 1081 | } |
1072 | return 0; | 1082 | return 0; |
@@ -1757,19 +1767,12 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s) | |||
1757 | 1767 | ||
1758 | BT_DBG("session %p", s); | 1768 | BT_DBG("session %p", s); |
1759 | 1769 | ||
1760 | if (sock_create_lite(PF_BLUETOOTH, sock->type, BTPROTO_L2CAP, &nsock)) | 1770 | err = kernel_accept(sock, &nsock, O_NONBLOCK); |
1771 | if (err < 0) | ||
1761 | return; | 1772 | return; |
1762 | 1773 | ||
1763 | nsock->ops = sock->ops; | ||
1764 | |||
1765 | __module_get(nsock->ops->owner); | 1774 | __module_get(nsock->ops->owner); |
1766 | 1775 | ||
1767 | err = sock->ops->accept(sock, nsock, O_NONBLOCK); | ||
1768 | if (err < 0) { | ||
1769 | sock_release(nsock); | ||
1770 | return; | ||
1771 | } | ||
1772 | |||
1773 | /* Set our callbacks */ | 1776 | /* Set our callbacks */ |
1774 | nsock->sk->sk_data_ready = rfcomm_l2data_ready; | 1777 | nsock->sk->sk_data_ready = rfcomm_l2data_ready; |
1775 | nsock->sk->sk_state_change = rfcomm_l2state_change; | 1778 | nsock->sk->sk_state_change = rfcomm_l2state_change; |
@@ -1885,7 +1888,7 @@ static int rfcomm_add_listener(bdaddr_t *ba) | |||
1885 | bacpy(&addr.l2_bdaddr, ba); | 1888 | bacpy(&addr.l2_bdaddr, ba); |
1886 | addr.l2_family = AF_BLUETOOTH; | 1889 | addr.l2_family = AF_BLUETOOTH; |
1887 | addr.l2_psm = htobs(RFCOMM_PSM); | 1890 | addr.l2_psm = htobs(RFCOMM_PSM); |
1888 | err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr)); | 1891 | err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr)); |
1889 | if (err < 0) { | 1892 | if (err < 0) { |
1890 | BT_ERR("Bind failed %d", err); | 1893 | BT_ERR("Bind failed %d", err); |
1891 | goto failed; | 1894 | goto failed; |
@@ -1898,7 +1901,7 @@ static int rfcomm_add_listener(bdaddr_t *ba) | |||
1898 | release_sock(sk); | 1901 | release_sock(sk); |
1899 | 1902 | ||
1900 | /* Start listening on the socket */ | 1903 | /* Start listening on the socket */ |
1901 | err = sock->ops->listen(sock, 10); | 1904 | err = kernel_listen(sock, 10); |
1902 | if (err) { | 1905 | if (err) { |
1903 | BT_ERR("Listen failed %d", err); | 1906 | BT_ERR("Listen failed %d", err); |
1904 | goto failed; | 1907 | goto failed; |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 9a7a44fc721f..b2b1cceb102a 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -517,9 +517,10 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) | |||
517 | if (dlc->state == BT_CLOSED) { | 517 | if (dlc->state == BT_CLOSED) { |
518 | if (!dev->tty) { | 518 | if (!dev->tty) { |
519 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { | 519 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { |
520 | rfcomm_dev_hold(dev); | 520 | if (rfcomm_dev_get(dev->id) == NULL) |
521 | rfcomm_dev_del(dev); | 521 | return; |
522 | 522 | ||
523 | rfcomm_dev_del(dev); | ||
523 | /* We have to drop DLC lock here, otherwise | 524 | /* We have to drop DLC lock here, otherwise |
524 | rfcomm_dev_put() will dead lock if it's | 525 | rfcomm_dev_put() will dead lock if it's |
525 | the last reference. */ | 526 | the last reference. */ |
@@ -974,8 +975,12 @@ static void rfcomm_tty_hangup(struct tty_struct *tty) | |||
974 | 975 | ||
975 | rfcomm_tty_flush_buffer(tty); | 976 | rfcomm_tty_flush_buffer(tty); |
976 | 977 | ||
977 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) | 978 | if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { |
979 | if (rfcomm_dev_get(dev->id) == NULL) | ||
980 | return; | ||
978 | rfcomm_dev_del(dev); | 981 | rfcomm_dev_del(dev); |
982 | rfcomm_dev_put(dev); | ||
983 | } | ||
979 | } | 984 | } |
980 | 985 | ||
981 | static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) | 986 | static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused) |