Skip to content

Commit b828854

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 a112ff2 commit b828854

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
@@ -5034,9 +5034,11 @@ int hci_abort_conn_sync(struct hci_dev *hdev, struct hci_conn *conn, u8 reason)
50345034
/* Cleanup hci_conn object if it cannot be cancelled as it
50355035
* likelly means the controller and host stack are out of sync.
50365036
*/
5037-
if (err)
5037+
if (err) {
5038+
hci_dev_lock(hdev);
50385039
hci_conn_failed(conn, err);
5039-
5040+
hci_dev_unlock(hdev);
5041+
}
50405042
return err;
50415043
case BT_CONNECT2:
50425044
return hci_reject_conn_sync(hdev, conn, reason);

0 commit comments

Comments
 (0)