Bluetooth: Fix usage of __hci_cmd_sync_status

__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: f1a8f402 ("Bluetooth: L2CAP: Fix deadlock")
Reported-by: default avatarPauli Virtanen <pav@iki.fi>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 473a89b4
...@@ -718,8 +718,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) ...@@ -718,8 +718,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
switch (cmd) { switch (cmd) {
case HCISETAUTH: case HCISETAUTH:
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE, err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_AUTH_ENABLE,
1, &dr.dev_opt, HCI_CMD_TIMEOUT); 1, &dr.dev_opt, HCI_CMD_TIMEOUT);
break; break;
case HCISETENCRYPT: case HCISETENCRYPT:
...@@ -730,23 +730,21 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) ...@@ -730,23 +730,21 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
if (!test_bit(HCI_AUTH, &hdev->flags)) { if (!test_bit(HCI_AUTH, &hdev->flags)) {
/* Auth must be enabled first */ /* Auth must be enabled first */
err = __hci_cmd_sync_status(hdev, err = hci_cmd_sync_status(hdev,
HCI_OP_WRITE_AUTH_ENABLE, HCI_OP_WRITE_AUTH_ENABLE,
1, &dr.dev_opt, 1, &dr.dev_opt,
HCI_CMD_TIMEOUT); HCI_CMD_TIMEOUT);
if (err) if (err)
break; break;
} }
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE, err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_ENCRYPT_MODE,
1, &dr.dev_opt, 1, &dr.dev_opt, HCI_CMD_TIMEOUT);
HCI_CMD_TIMEOUT);
break; break;
case HCISETSCAN: case HCISETSCAN:
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE, err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_SCAN_ENABLE,
1, &dr.dev_opt, 1, &dr.dev_opt, HCI_CMD_TIMEOUT);
HCI_CMD_TIMEOUT);
/* Ensure that the connectable and discoverable states /* Ensure that the connectable and discoverable states
* get correctly modified as this was a non-mgmt change. * get correctly modified as this was a non-mgmt change.
...@@ -758,9 +756,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg) ...@@ -758,9 +756,8 @@ int hci_dev_cmd(unsigned int cmd, void __user *arg)
case HCISETLINKPOL: case HCISETLINKPOL:
policy = cpu_to_le16(dr.dev_opt); policy = cpu_to_le16(dr.dev_opt);
err = __hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, err = hci_cmd_sync_status(hdev, HCI_OP_WRITE_DEF_LINK_POLICY,
2, &policy, 2, &policy, HCI_CMD_TIMEOUT);
HCI_CMD_TIMEOUT);
break; break;
case HCISETLINKMODE: case HCISETLINKMODE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment