From: Jefferson Delfes Date: Tue, 18 Sep 2012 17:36:54 +0000 (-0400) Subject: Bluetooth: Force the process of unpair command if disconnect failed X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=36a75f1b3ecf94dcf140b9d3d2f7a03b7e258480;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git Bluetooth: Force the process of unpair command if disconnect failed 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. Signed-off-by: Jefferson Delfes Acked-by: Johan Hedberg Signed-off-by: Gustavo Padovan --- diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 8934343be0ea..b127b88015c9 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3109,6 +3109,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; @@ -3121,8 +3124,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; }