* [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function
@ 2012-04-19 11:43 Marcel Holtmann
2012-04-19 14:52 ` Gustavo Padovan
2012-04-20 17:20 ` Gustavo Padovan
0 siblings, 2 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-04-19 11:43 UTC (permalink / raw)
To: linux-bluetooth
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>
---
net/bluetooth/sco.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 2fb9636..8b2548c 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -463,7 +463,6 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
{
struct sockaddr_sco *sa = (struct sockaddr_sco *) addr;
struct sock *sk = sock->sk;
- bdaddr_t *src = &sa->sco_bdaddr;
int err = 0;
BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr));
@@ -478,17 +477,14 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
goto done;
}
- write_lock(&sco_sk_list.lock);
-
- if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
- err = -EADDRINUSE;
- } else {
- /* Save source address */
- bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
- sk->sk_state = BT_BOUND;
+ if (sk->sk_type != SOCK_SEQPACKET) {
+ err = -EINVAL;
+ goto done;
}
- write_unlock(&sco_sk_list.lock);
+ bacpy(&bt_sk(sk)->src, &sa->sco_bdaddr);
+
+ sk->sk_state = BT_BOUND;
done:
release_sock(sk);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function
2012-04-19 11:43 [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function Marcel Holtmann
@ 2012-04-19 14:52 ` Gustavo Padovan
2012-04-19 15:53 ` Marcel Holtmann
2012-04-20 17:20 ` Gustavo Padovan
1 sibling, 1 reply; 4+ messages in thread
From: Gustavo Padovan @ 2012-04-19 14:52 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2012-04-19 13:43:53 +0200]:
> 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.
>=20
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/sco.c | 16 ++++++----------
> 1 files changed, 6 insertions(+), 10 deletions(-)
>=20
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 2fb9636..8b2548c 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -463,7 +463,6 @@ static int sco_sock_bind(struct socket *sock, struct =
sockaddr *addr, int addr_le
> {
> struct sockaddr_sco *sa =3D (struct sockaddr_sco *) addr;
> struct sock *sk =3D sock->sk;
> - bdaddr_t *src =3D &sa->sco_bdaddr;
> int err =3D 0;
> =20
> BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr));
> @@ -478,17 +477,14 @@ static int sco_sock_bind(struct socket *sock, struc=
t sockaddr *addr, int addr_le
> goto done;
> }
> =20
> - write_lock(&sco_sk_list.lock);
> -
> - if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
> - err =3D -EADDRINUSE;
this patch adds a compiling warning:
CC [M] net/bluetooth/sco.o
net/bluetooth/sco.c:277:21: warning: =E2=80=98__sco_get_sock_by_addr=E2=
=80=99 defined
but not used [-Wunused-function]
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function
2012-04-19 14:52 ` Gustavo Padovan
@ 2012-04-19 15:53 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-04-19 15:53 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth
Hi Gustavo,
> * Marcel Holtmann <marcel@holtmann.org> [2012-04-19 13:43:53 +0200]:
>
> > 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>
> > ---
> > net/bluetooth/sco.c | 16 ++++++----------
> > 1 files changed, 6 insertions(+), 10 deletions(-)
> >
> > diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> > index 2fb9636..8b2548c 100644
> > --- a/net/bluetooth/sco.c
> > +++ b/net/bluetooth/sco.c
> > @@ -463,7 +463,6 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
> > {
> > struct sockaddr_sco *sa = (struct sockaddr_sco *) addr;
> > struct sock *sk = sock->sk;
> > - bdaddr_t *src = &sa->sco_bdaddr;
> > int err = 0;
> >
> > BT_DBG("sk %p %s", sk, batostr(&sa->sco_bdaddr));
> > @@ -478,17 +477,14 @@ static int sco_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le
> > goto done;
> > }
> >
> > - write_lock(&sco_sk_list.lock);
> > -
> > - if (bacmp(src, BDADDR_ANY) && __sco_get_sock_by_addr(src)) {
> > - err = -EADDRINUSE;
>
> this patch adds a compiling warning:
>
> CC [M] net/bluetooth/sco.o
> net/bluetooth/sco.c:277:21: warning: ‘__sco_get_sock_by_addr’ defined
> but not used [-Wunused-function]
I am fixing that with the next patch. I just ended up splitting them
into two to get this logical correct.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function
2012-04-19 11:43 [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function Marcel Holtmann
2012-04-19 14:52 ` Gustavo Padovan
@ 2012-04-20 17:20 ` Gustavo Padovan
1 sibling, 0 replies; 4+ messages in thread
From: Gustavo Padovan @ 2012-04-20 17:20 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
* Marcel Holtmann <marcel@holtmann.org> [2012-04-19 13:43:53 +0200]:
> 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>
> ---
> net/bluetooth/sco.c | 16 ++++++----------
> 1 files changed, 6 insertions(+), 10 deletions(-)
Patch has been applied. Thanks.
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-04-20 17:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-19 11:43 [PATCH 3/3] Bluetooth: Don't check source address in SCO bind function Marcel Holtmann
2012-04-19 14:52 ` Gustavo Padovan
2012-04-19 15:53 ` Marcel Holtmann
2012-04-20 17:20 ` Gustavo Padovan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.