diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:23:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-07 15:23:31 -0400 |
commit | 9fa0853a85a3a4067e4ad0aaa5d90984c2dd21b5 (patch) | |
tree | ac90f6535bc053b3859dc050cbbd577a0a1ef95b /net/bluetooth/rfcomm | |
parent | ef93127e4c7b4b8d46421045641048397eaac43d (diff) | |
parent | cf4328cd949c2086091c62c5685f1580fe9b55e4 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
[NET]: rfkill: add support for input key to control wireless radio
[NET] net/core: Fix error handling
[TG3]: Update version and reldate.
[TG3]: Eliminate spurious interrupts.
[TG3]: Add ASPM workaround.
[Bluetooth] Correct SCO buffer for another Broadcom based dongle
[Bluetooth] Add support for Targus ACB10US USB dongle
[Bluetooth] Disconnect L2CAP connection after last RFCOMM DLC
[Bluetooth] Check that device is in rfcomm_dev_list before deleting
[Bluetooth] Use in-kernel sockets API
[Bluetooth] Attach host adapters to the Bluetooth bus
[Bluetooth] Fix L2CAP and HCI setsockopt() information leaks
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 29 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 11 |
2 files changed, 24 insertions, 16 deletions
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) |