Skip to content

Commit 2da8eb8

Browse files
Zhengping JiangVudentz
authored andcommitted
Bluetooth: hci_sync: hold hdev->lock when cleanup hci_conn
When disconnecting all devices, hci_conn_failed is used to cleanup hci_conn object when the hci_conn object cannot be aborted. The function hci_conn_failed requires the caller holds hdev->lock. Fixes: 9b3628d ("Bluetooth: hci_sync: Cleanup hci_conn if it cannot be aborted") Signed-off-by: Zhengping Jiang <jiangzp@google.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent cb0d160 commit 2da8eb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/bluetooth/hci_sync.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4773,9 +4773,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)
47734773
/* Cleanup hci_conn object if it cannot be cancelled as it
47744774
* likelly means the controller and host stack are out of sync.
47754775
*/
4776-
if (err)
4776+
if (err) {
4777+
hci_dev_lock(hdev);
47774778
hci_conn_failed(conn, err);
4778-
4779+
hci_dev_unlock(hdev);
4780+
}
47794781
return err;
47804782
case BT_CONNECT2:
47814783
return hci_reject_conn_sync(hdev, conn, reason);

0 commit comments

Comments
 (0)