Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 5f77c8e

Browse files
Vudentzgregkh
authored andcommitted
Bluetooth: Fix usage of __hci_cmd_sync_status
[ Upstream commit 87be7b1 ] __hci_cmd_sync_status shall only be used if hci_req_sync_lock is _not_ required which is not the case of hci_dev_cmd so it needs to use hci_cmd_sync_status which uses hci_req_sync_lock internally. Fixes: f1a8f40 ("Bluetooth: L2CAP: Fix deadlock") Reported-by: Pauli Virtanen <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 66c4360 commit 5f77c8e

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

net/bluetooth/hci_core.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
711711

712712
switch (cmd) {
713713
case HCISETAUTH:
714-
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE,
715-
1, &dr.dev_opt, HCI_CMD_TIMEOUT);
714+
err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE,
715+
1, &dr.dev_opt, HCI_CMD_TIMEOUT);
716716
break;
717717

718718
case HCISETENCRYPT:
@@ -723,23 +723,21 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
723723

724724
if (!test_bit(HCI_AUTH, &hdev->flags)) {
725725
/* Auth must be enabled first */
726-
err = __hci_cmd_sync_status(hdev,
727-
HCI_OP_WRITE_AUTH_ENABLE,
728-
1, &dr.dev_opt,
729-
HCI_CMD_TIMEOUT);
726+
err = hci_cmd_sync_status(hdev,
727+
HCI_OP_WRITE_AUTH_ENABLE,
728+
1, &dr.dev_opt,
729+
HCI_CMD_TIMEOUT);
730730
if (err)
731731
break;
732732
}
733733

734-
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE,
735-
1, &dr.dev_opt,
736-
HCI_CMD_TIMEOUT);
734+
err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE,
735+
1, &dr.dev_opt, HCI_CMD_TIMEOUT);
737736
break;
738737

739738
case HCISETSCAN:
740-
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
741-
1, &dr.dev_opt,
742-
HCI_CMD_TIMEOUT);
739+
err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
740+
1, &dr.dev_opt, HCI_CMD_TIMEOUT);
743741

744742
/* Ensure that the connectable and discoverable states
745743
* get correctly modified as this was a non-mgmt change.
@@ -751,9 +749,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
751749
case HCISETLINKPOL:
752750
policy = cpu_to_le16(dr.dev_opt);
753751

754-
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY,
755-
2, &policy,
756-
HCI_CMD_TIMEOUT);
752+
err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY,
753+
2, &policy, HCI_CMD_TIMEOUT);
757754
break;
758755

759756
case HCISETLINKMODE:

0 commit comments

Comments
 (0)