Skip to content

Commit 6eb5fcc

Browse files
committed
Bluetooth: MGMT: Fix failing to MGMT_OP_ADD_UUID/MGMT_OP_REMOVE_UUID
These commands don't require the adapter to be up and running so don't use hci_cmd_sync_queue which would check that flag, instead use hci_cmd_sync_submit which would ensure mgmt_class_complete is set properly regardless if any command was actually run or not. Link: bluez/bluez#809 Fixes: d883a46 ("Bluetooth: hci_sync: Only allow hci_cmd_sync_queue if running") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 32868e1 commit 6eb5fcc

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

net/bluetooth/mgmt.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,11 @@ static int add_uuid(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
26232623
goto failed;
26242624
}
26252625

2626-
err = hci_cmd_sync_queue(hdev, add_uuid_sync, cmd, mgmt_class_complete);
2626+
/* MGMT_OP_ADD_UUID don't require adapter the UP/Running so use
2627+
* hci_cmd_sync_submit instead of hci_cmd_sync_queue.
2628+
*/
2629+
err = hci_cmd_sync_submit(hdev, add_uuid_sync, cmd,
2630+
mgmt_class_complete);
26272631
if (err < 0) {
26282632
mgmt_pending_free(cmd);
26292633
goto failed;
@@ -2717,8 +2721,11 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data,
27172721
goto unlock;
27182722
}
27192723

2720-
err = hci_cmd_sync_queue(hdev, remove_uuid_sync, cmd,
2721-
mgmt_class_complete);
2724+
/* MGMT_OP_REMOVE_UUID don't require adapter the UP/Running so use
2725+
* hci_cmd_sync_submit instead of hci_cmd_sync_queue.
2726+
*/
2727+
err = hci_cmd_sync_submit(hdev, remove_uuid_sync, cmd,
2728+
mgmt_class_complete);
27222729
if (err < 0)
27232730
mgmt_pending_free(cmd);
27242731

@@ -2784,8 +2791,11 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
27842791
goto unlock;
27852792
}
27862793

2787-
err = hci_cmd_sync_queue(hdev, set_class_sync, cmd,
2788-
mgmt_class_complete);
2794+
/* MGMT_OP_SET_DEV_CLASS don't require adapter the UP/Running so use
2795+
* hci_cmd_sync_submit instead of hci_cmd_sync_queue.
2796+
*/
2797+
err = hci_cmd_sync_submit(hdev, set_class_sync, cmd,
2798+
mgmt_class_complete);
27892799
if (err < 0)
27902800
mgmt_pending_free(cmd);
27912801

0 commit comments

Comments
 (0)