All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Set connection state to BT_DISCONN to avoid multiple responses
@ 2011-01-29 13:39 Liang Bao
  2011-01-31  7:57 ` Ville Tervo
  2011-02-02 14:49 ` Gustavo F. Padovan
  0 siblings, 2 replies; 14+ messages in thread
From: Liang Bao @ 2011-01-29 13:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bao Liang

From: Bao Liang <tim.bao@gmail.com>

This patch fixes a minor issue that two connection responses will be sent
for one L2CAP connection request. If the L2CAP connection request is first
blocked due to security reason and responded with reason "security block",
the state of the connection remains BT_CONNECT2. If a pairing procedure
completes successfully before the ACL connection is down, local host will
send another connection complete response. See the following packets
captured by hcidump.

2010-12-07 22:21:24.928096 < ACL data: handle 12 flags 0x00 dlen 16
    0000: 0c 00 01 00 03 19 08 00  41 00 53 00 03 00 00 00  ........A.S.....
... ...

2010-12-07 22:21:35.791747 > HCI Event: Auth Complete (0x06) plen 3
    status 0x00 handle 12
... ...

2010-12-07 22:21:35.872372 > ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0054 scid 0x0040 result 0 status 0
      Connection successful

Signed-off-by: Liang Bao <tim.bao@gmail.com>
---
 net/bluetooth/l2cap.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b..364197d 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -848,6 +848,7 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
 				result = L2CAP_CR_SEC_BLOCK;
 			else
 				result = L2CAP_CR_BAD_PSM;
+			sk->sk_state = BT_DISCONN;
 
 			rsp.scid   = cpu_to_le16(l2cap_pi(sk)->dcid);
 			rsp.dcid   = cpu_to_le16(l2cap_pi(sk)->scid);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH] Set connection state to BT_DISCONN to avoid multiple responses
@ 2011-01-27  1:21 tim.bao
  2011-01-27  7:40 ` Ville Tervo
  0 siblings, 1 reply; 14+ messages in thread
From: tim.bao @ 2011-01-27  1:21 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bao Liang

From: Bao Liang <tim.bao@gmail.com>

This patch fixes a minor issue that two connection responses will be sent
for one L2CAP connection request. If the L2CAP connection request is first
blocked due to security reason and responded with reason "security block",
the state of the connection remains BT_CONNECT2. If a pairing procedure
completes successfully before the ACL connection is down, local host will
send another connection complete response. See the following packets
captured by hcidump.

2010-12-07 22:21:24.928096 < ACL data: handle 12 flags 0x00 dlen 16
    0000: 0c 00 01 00 03 19 08 00  41 00 53 00 03 00 00 00  ........A.S.....
... ...

2010-12-07 22:21:35.791747 > HCI Event: Auth Complete (0x06) plen 3
    status 0x00 handle 12
... ...

2010-12-07 22:21:35.872372 > ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0054 scid 0x0040 result 0 status 0
      Connection successful

Signed-off-by: Bao Liang <tim.bao@gmail.com>
---
 net/bluetooth/l2cap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b..40d70db 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -844,9 +844,10 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
 			struct l2cap_conn_rsp rsp;
 			__u16 result;
 
-			if (bt_sk(sk)->defer_setup)
+			if (bt_sk(sk)->defer_setup) {
+				sk->sk_state = BT_DISCONN;
 				result = L2CAP_CR_SEC_BLOCK;
-			else
+			} else
 				result = L2CAP_CR_BAD_PSM;
 
 			rsp.scid   = cpu_to_le16(l2cap_pi(sk)->dcid);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH] Set connection state to BT_DISCONN to avoid multiple responses
@ 2011-01-19 13:22 tim.bao
  2011-01-19 18:01 ` Gustavo F. Padovan
  2011-01-26 17:18 ` Gustavo F. Padovan
  0 siblings, 2 replies; 14+ messages in thread
From: tim.bao @ 2011-01-19 13:22 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Bao Liang

From: Bao Liang <tim.bao@gmail.com>

This patch fixes a minor issue that two connection responses will be sent
for one L2CAP connection request. If the L2CAP connection request is first
blocked due to security reason and responded with reason "security block",
the state of the connection remains BT_CONNECT2. If a pairing procedure
completes successfully before the ACL connection is down, local host will
send another connection complete response. See the following packets
captured by hcidump.

2010-12-07 22:21:24.928096 < ACL data: handle 12 flags 0x00 dlen 16
    0000: 0c 00 01 00 03 19 08 00  41 00 53 00 03 00 00 00  ........A.S.....
... ...

2010-12-07 22:21:35.791747 > HCI Event: Auth Complete (0x06) plen 3
    status 0x00 handle 12
... ...

2010-12-07 22:21:35.872372 > ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0054 scid 0x0040 result 0 status 0
      Connection successful
---
 net/bluetooth/l2cap.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index fadf26b..40d70db 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -844,9 +844,10 @@ static void __l2cap_sock_close(struct sock *sk, int reason)
 			struct l2cap_conn_rsp rsp;
 			__u16 result;
 
-			if (bt_sk(sk)->defer_setup)
+			if (bt_sk(sk)->defer_setup) {
+				sk->sk_state = BT_DISCONN;
 				result = L2CAP_CR_SEC_BLOCK;
-			else
+			} else
 				result = L2CAP_CR_BAD_PSM;
 
 			rsp.scid   = cpu_to_le16(l2cap_pi(sk)->dcid);
-- 
1.7.1


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

end of thread, other threads:[~2011-02-02 14:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29 13:39 [PATCH] Set connection state to BT_DISCONN to avoid multiple responses Liang Bao
2011-01-31  7:57 ` Ville Tervo
2011-02-01  3:44   ` Liang Bao
2011-02-02 14:49 ` Gustavo F. Padovan
  -- strict thread matches above, loose matches on Subject: below --
2011-01-27  1:21 tim.bao
2011-01-27  7:40 ` Ville Tervo
2011-01-27 14:22   ` Liang Bao
2011-01-27 16:03   ` Gustavo F. Padovan
2011-01-19 13:22 tim.bao
2011-01-19 18:01 ` Gustavo F. Padovan
2011-01-20  2:31   ` Liang Bao
2011-01-24  5:09     ` Liang Bao
2011-01-26 17:18 ` Gustavo F. Padovan
2011-01-26 17:21   ` Gustavo F. 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.