linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Bluetooth: Fix not setting the chan state
@ 2011-06-18  1:46 Vinicius Costa Gomes
  2011-06-18  1:46 ` [PATCH 2/3] Bluetooth: Fix crash when setting a LE socket to ready Vinicius Costa Gomes
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Vinicius Costa Gomes @ 2011-06-18  1:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

When the connection is ready we should set the connection
to CONNECTED so userspace can use it.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
---
 net/bluetooth/l2cap_core.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 25f31f4..4af61fb 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -895,8 +895,7 @@ static void l2cap_chan_ready(struct sock *sk)
 	chan->conf_state = 0;
 	__clear_chan_timer(chan);
 
-	sk->sk_state = BT_CONNECTED;
-	sk->sk_state_change(sk);
+	l2cap_state_change(chan, BT_CONNECTED);
 
 	if (parent)
 		parent->sk_data_ready(parent, 0);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/3] Bluetooth: Fix crash when setting a LE socket to ready
  2011-06-18  1:46 [PATCH 1/3] Bluetooth: Fix not setting the chan state Vinicius Costa Gomes
@ 2011-06-18  1:46 ` Vinicius Costa Gomes
  2011-06-18  1:46 ` [PATCH 3/3] Bluetooth: Remove useless access to the socket Vinicius Costa Gomes
  2011-06-20 19:31 ` [PATCH 1/3] Bluetooth: Fix not setting the chan state Gustavo F. Padovan
  2 siblings, 0 replies; 7+ messages in thread
From: Vinicius Costa Gomes @ 2011-06-18  1:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

We should not try to do any other type of configuration for
LE links when they become ready.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
---
 net/bluetooth/l2cap_core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 4af61fb..bbe5306 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -917,11 +917,11 @@ static void l2cap_conn_ready(struct l2cap_conn *conn)
 
 		bh_lock_sock(sk);
 
-		if (conn->hcon->type == LE_LINK)
+		if (conn->hcon->type == LE_LINK) {
 			if (smp_conn_security(conn, chan->sec_level))
 				l2cap_chan_ready(sk);
 
-		if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
+		} else if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
 			__clear_chan_timer(chan);
 			l2cap_state_change(chan, BT_CONNECTED);
 			sk->sk_state_change(sk);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Bluetooth: Remove useless access to the socket
  2011-06-18  1:46 [PATCH 1/3] Bluetooth: Fix not setting the chan state Vinicius Costa Gomes
  2011-06-18  1:46 ` [PATCH 2/3] Bluetooth: Fix crash when setting a LE socket to ready Vinicius Costa Gomes
@ 2011-06-18  1:46 ` Vinicius Costa Gomes
  2011-06-20 19:32   ` Gustavo F. Padovan
  2011-06-20 19:31 ` [PATCH 1/3] Bluetooth: Fix not setting the chan state Gustavo F. Padovan
  2 siblings, 1 reply; 7+ messages in thread
From: Vinicius Costa Gomes @ 2011-06-18  1:46 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Vinicius Costa Gomes

We already have access to the chan, we don't have to access the
socket to get its imtu.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
---
 net/bluetooth/l2cap_core.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index bbe5306..904b177 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3964,7 +3964,7 @@ static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, str
 	if (chan->state != BT_BOUND && chan->state != BT_CONNECTED)
 		goto drop;
 
-	if (l2cap_pi(sk)->chan->imtu < skb->len)
+	if (chan->imtu < skb->len)
 		goto drop;
 
 	if (!chan->ops->recv(chan->data, skb))
@@ -3997,7 +3997,7 @@ static inline int l2cap_att_channel(struct l2cap_conn *conn, __le16 cid, struct
 	if (chan->state != BT_BOUND && chan->state != BT_CONNECTED)
 		goto drop;
 
-	if (l2cap_pi(sk)->chan->imtu < skb->len)
+	if (chan->imtu < skb->len)
 		goto drop;
 
 	if (!chan->ops->recv(chan->data, skb))
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] Bluetooth: Fix not setting the chan state
  2011-06-18  1:46 [PATCH 1/3] Bluetooth: Fix not setting the chan state Vinicius Costa Gomes
  2011-06-18  1:46 ` [PATCH 2/3] Bluetooth: Fix crash when setting a LE socket to ready Vinicius Costa Gomes
  2011-06-18  1:46 ` [PATCH 3/3] Bluetooth: Remove useless access to the socket Vinicius Costa Gomes
@ 2011-06-20 19:31 ` Gustavo F. Padovan
  2011-06-20 20:01   ` Vinicius Costa Gomes
  2 siblings, 1 reply; 7+ messages in thread
From: Gustavo F. Padovan @ 2011-06-20 19:31 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth

* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-06-17 22:46:25 -0300]:

> When the connection is ready we should set the connection
> to CONNECTED so userspace can use it.
> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>  net/bluetooth/l2cap_core.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 25f31f4..4af61fb 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -895,8 +895,7 @@ static void l2cap_chan_ready(struct sock *sk)
>  	chan->conf_state = 0;
>  	__clear_chan_timer(chan);
>  
> -	sk->sk_state = BT_CONNECTED;
> -	sk->sk_state_change(sk);
> +	l2cap_state_change(chan, BT_CONNECTED);

Why are you removing the sk->sk_state_change() ?

	Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 3/3] Bluetooth: Remove useless access to the socket
  2011-06-18  1:46 ` [PATCH 3/3] Bluetooth: Remove useless access to the socket Vinicius Costa Gomes
@ 2011-06-20 19:32   ` Gustavo F. Padovan
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2011-06-20 19:32 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth

* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-06-17 22:46:27 -0300]:

> We already have access to the chan, we don't have to access the
> socket to get its imtu.
> 
> Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> ---
>  net/bluetooth/l2cap_core.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Patches 2 and 3 are applied. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] Bluetooth: Fix not setting the chan state
  2011-06-20 19:31 ` [PATCH 1/3] Bluetooth: Fix not setting the chan state Gustavo F. Padovan
@ 2011-06-20 20:01   ` Vinicius Costa Gomes
  2011-06-20 20:03     ` Gustavo F. Padovan
  0 siblings, 1 reply; 7+ messages in thread
From: Vinicius Costa Gomes @ 2011-06-20 20:01 UTC (permalink / raw)
  To: linux-bluetooth

Hi Gustavo,

On 16:31 Mon 20 Jun, Gustavo F. Padovan wrote:
> * Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-06-17 22:46:25 -0300]:
> 
> > When the connection is ready we should set the connection
> > to CONNECTED so userspace can use it.
> > 
> > Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> > ---
> >  net/bluetooth/l2cap_core.c |    3 +--
> >  1 files changed, 1 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > index 25f31f4..4af61fb 100644
> > --- a/net/bluetooth/l2cap_core.c
> > +++ b/net/bluetooth/l2cap_core.c
> > @@ -895,8 +895,7 @@ static void l2cap_chan_ready(struct sock *sk)
> >  	chan->conf_state = 0;
> >  	__clear_chan_timer(chan);
> >  
> > -	sk->sk_state = BT_CONNECTED;
> > -	sk->sk_state_change(sk);
> > +	l2cap_state_change(chan, BT_CONNECTED);
> 
> Why are you removing the sk->sk_state_change() ?

I was thinking that l2cap_state_change() would do this for me. May I ask
why it doesn't call sk->sk_state_change()?

But will send a fixed version anyway.

> 
> 	Gustavo

Cheers,
-- 
Vinicius

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/3] Bluetooth: Fix not setting the chan state
  2011-06-20 20:01   ` Vinicius Costa Gomes
@ 2011-06-20 20:03     ` Gustavo F. Padovan
  0 siblings, 0 replies; 7+ messages in thread
From: Gustavo F. Padovan @ 2011-06-20 20:03 UTC (permalink / raw)
  To: Vinicius Costa Gomes; +Cc: linux-bluetooth

Hi Vinicius,

* Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-06-20 17:01:56 -0300]:

> Hi Gustavo,
> 
> On 16:31 Mon 20 Jun, Gustavo F. Padovan wrote:
> > * Vinicius Costa Gomes <vinicius.gomes@openbossa.org> [2011-06-17 22:46:25 -0300]:
> > 
> > > When the connection is ready we should set the connection
> > > to CONNECTED so userspace can use it.
> > > 
> > > Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
> > > ---
> > >  net/bluetooth/l2cap_core.c |    3 +--
> > >  1 files changed, 1 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > > index 25f31f4..4af61fb 100644
> > > --- a/net/bluetooth/l2cap_core.c
> > > +++ b/net/bluetooth/l2cap_core.c
> > > @@ -895,8 +895,7 @@ static void l2cap_chan_ready(struct sock *sk)
> > >  	chan->conf_state = 0;
> > >  	__clear_chan_timer(chan);
> > >  
> > > -	sk->sk_state = BT_CONNECTED;
> > > -	sk->sk_state_change(sk);
> > > +	l2cap_state_change(chan, BT_CONNECTED);
> > 
> > Why are you removing the sk->sk_state_change() ?
> 
> I was thinking that l2cap_state_change() would do this for me. May I ask
> why it doesn't call sk->sk_state_change()?

Because we don't call sk->sk_state_change() every time the state changes.

	Gustavo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-20 20:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-18  1:46 [PATCH 1/3] Bluetooth: Fix not setting the chan state Vinicius Costa Gomes
2011-06-18  1:46 ` [PATCH 2/3] Bluetooth: Fix crash when setting a LE socket to ready Vinicius Costa Gomes
2011-06-18  1:46 ` [PATCH 3/3] Bluetooth: Remove useless access to the socket Vinicius Costa Gomes
2011-06-20 19:32   ` Gustavo F. Padovan
2011-06-20 19:31 ` [PATCH 1/3] Bluetooth: Fix not setting the chan state Gustavo F. Padovan
2011-06-20 20:01   ` Vinicius Costa Gomes
2011-06-20 20:03     ` Gustavo F. Padovan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).