diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/sco.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index dea40d4bb6f5..71df982c09c9 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -857,10 +857,30 @@ done: | |||
857 | /* ----- SCO interface with lower layer (HCI) ----- */ | 857 | /* ----- SCO interface with lower layer (HCI) ----- */ |
858 | static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) | 858 | static int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 type) |
859 | { | 859 | { |
860 | register struct sock *sk; | ||
861 | struct hlist_node *node; | ||
862 | int lm = 0; | ||
863 | |||
864 | if (type != SCO_LINK && type != ESCO_LINK) | ||
865 | return 0; | ||
866 | |||
860 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); | 867 | BT_DBG("hdev %s, bdaddr %s", hdev->name, batostr(bdaddr)); |
861 | 868 | ||
862 | /* Always accept connection */ | 869 | /* Find listening sockets */ |
863 | return HCI_LM_ACCEPT; | 870 | read_lock(&sco_sk_list.lock); |
871 | sk_for_each(sk, node, &sco_sk_list.head) { | ||
872 | if (sk->sk_state != BT_LISTEN) | ||
873 | continue; | ||
874 | |||
875 | if (!bacmp(&bt_sk(sk)->src, &hdev->bdaddr) || | ||
876 | !bacmp(&bt_sk(sk)->src, BDADDR_ANY)) { | ||
877 | lm |= HCI_LM_ACCEPT; | ||
878 | break; | ||
879 | } | ||
880 | } | ||
881 | read_unlock(&sco_sk_list.lock); | ||
882 | |||
883 | return lm; | ||
864 | } | 884 | } |
865 | 885 | ||
866 | static int sco_connect_cfm(struct hci_conn *hcon, __u8 status) | 886 | static int sco_connect_cfm(struct hci_conn *hcon, __u8 status) |