linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Force the process of unpair command if disconnect failed
@ 2012-09-18 17:36 Jefferson Delfes
  2012-09-20 11:16 ` Johan Hedberg
  2012-09-27 21:09 ` Gustavo Padovan
  0 siblings, 2 replies; 3+ messages in thread
From: Jefferson Delfes @ 2012-09-18 17:36 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jefferson Delfes

The unpair process tries to disconnect any connection pending with
remote. If there are some connection in connecting state, disconnect
command will fail and unpair mgmt command will stay pending.

That pending mgmt command can cause strange behavior like automatic
unpair after a lost connection.
---
 net/bluetooth/mgmt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 05d4b83..78caef2 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3108,6 +3108,9 @@ int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
 	struct pending_cmd *cmd;
 	int err;
 
+	mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp,
+			     hdev);
+
 	cmd = mgmt_pending_find(MGMT_OP_DISCONNECT, hdev);
 	if (!cmd)
 		return -ENOENT;
@@ -3120,8 +3123,6 @@ int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
 
 	mgmt_pending_remove(cmd);
 
-	mgmt_pending_foreach(MGMT_OP_UNPAIR_DEVICE, hdev, unpair_device_rsp,
-			     hdev);
 	return err;
 }
 
-- 
1.7.12


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

* Re: [PATCH] Bluetooth: Force the process of unpair command if disconnect failed
  2012-09-18 17:36 [PATCH] Bluetooth: Force the process of unpair command if disconnect failed Jefferson Delfes
@ 2012-09-20 11:16 ` Johan Hedberg
  2012-09-27 21:09 ` Gustavo Padovan
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-09-20 11:16 UTC (permalink / raw)
  To: Jefferson Delfes; +Cc: linux-bluetooth

Hi Jefferson,

On Tue, Sep 18, 2012, Jefferson Delfes wrote:
> The unpair process tries to disconnect any connection pending with
> remote. If there are some connection in connecting state, disconnect
> command will fail and unpair mgmt command will stay pending.
> 
> That pending mgmt command can cause strange behavior like automatic
> unpair after a lost connection.
> ---
>  net/bluetooth/mgmt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Acked-by: Johan Hedberg <johan.hedberg@intel.com>

Johan

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

* Re: [PATCH] Bluetooth: Force the process of unpair command if disconnect failed
  2012-09-18 17:36 [PATCH] Bluetooth: Force the process of unpair command if disconnect failed Jefferson Delfes
  2012-09-20 11:16 ` Johan Hedberg
@ 2012-09-27 21:09 ` Gustavo Padovan
  1 sibling, 0 replies; 3+ messages in thread
From: Gustavo Padovan @ 2012-09-27 21:09 UTC (permalink / raw)
  To: Jefferson Delfes; +Cc: linux-bluetooth

Hi Jefferson,

* Jefferson Delfes <jefferson.delfes@openbossa.org> [2012-09-18 13:36:54 -0400]:

> The unpair process tries to disconnect any connection pending with
> remote. If there are some connection in connecting state, disconnect
> command will fail and unpair mgmt command will stay pending.
> 
> That pending mgmt command can cause strange behavior like automatic
> unpair after a lost connection.
> ---
>  net/bluetooth/mgmt.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

	Gustavo

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

end of thread, other threads:[~2012-09-27 21:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-18 17:36 [PATCH] Bluetooth: Force the process of unpair command if disconnect failed Jefferson Delfes
2012-09-20 11:16 ` Johan Hedberg
2012-09-27 21:09 ` Gustavo 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).