aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-04-19 07:43:53 -0400
committerGustavo Padovan <gustavo@padovan.org>2012-05-09 00:40:38 -0400
commit8ed21f7eece54bb80eea5e31c3d9c6c7b6517e49 (patch)
tree40fffd8d1177b0cfb938ed86525f8638787d15e5 /net
parentfc50744c1e518adfb4ff2eda156f941e20aea36d (diff)
Bluetooth: Don't check source address in SCO bind function
Checking the source address in SCO bind function will prevent from having an incoming and outgoing SCO socket. However that might be needed in case of multiple SCO connections on a single device. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/sco.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 84d7a8023f80..c75cd7b07d18 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -462,7 +462,6 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
462{ 462{
463 struct sockaddr_sco *sa = (struct sockaddr_sco *) addr; 463 struct sockaddr_sco *sa = (struct sockaddr_sco *) addr;
464 struct sock *sk = sock->sk; 464 struct sock *sk = sock->sk;
465 bdaddr_t *src = &sa->sco_bdaddr;
466 int err = 0; 465 int err = 0;
467 466
468 BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr)); 467 BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr));
@@ -477,17 +476,14 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
477 goto done; 476 goto done;
478 } 477 }
479 478
480 write_lock(&sco_sk_list.lock); 479 if (sk->sk_type != SOCK_SEQPACKET) {
481 480 err = -EINVAL;
482 if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) { 481 goto done;
483 err = -EADDRINUSE;
484 } else {
485 /* Save source address */
486 bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
487 sk->sk_state = BT_BOUND;
488 } 482 }
489 483
490 write_unlock(&sco_sk_list.lock); 484 bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
485
486 sk->sk_state = BT_BOUND;
491 487
492done: 488done:
493 release_sock(sk); 489 release_sock(sk);