Skip to content

Commit b56c7b2

Browse files
committed
Bluetooth: Skip vendor diagnostic configuration for HCI User Channel
When the HCI User Channel access is requested, then do not try to undermine it with vendor diagnostic configuration. The exclusive user is required to configure its own vendor diagnostic in that case and can not rely on the host stack support. Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Johan Hedberg <[email protected]>
1 parent 76c4969 commit b56c7b2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

net/bluetooth/hci_core.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,13 @@ static ssize_t vendor_diag_write(struct file *file, const char __user *user_buf,
148148
return -EINVAL;
149149

150150
/* When the diagnostic flags are not persistent and the transport
151-
* is not active, then there is no need for the vendor callback.
152-
*
153-
* Instead just store the desired value. If needed the setting
154-
* will be programmed when the controller gets powered on.
151+
* is not active or in user channel operation, then there is no need
152+
* for the vendor callback. Instead just store the desired value and
153+
* the setting will be programmed when the controller gets powered on.
155154
*/
156155
if (test_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks) &&
157-
!test_bit(HCI_RUNNING, &hdev->flags))
156+
(!test_bit(HCI_RUNNING, &hdev->flags) ||
157+
hci_dev_test_flag(hdev, HCI_USER_CHANNEL)))
158158
goto done;
159159

160160
hci_req_sync_lock(hdev);
@@ -1419,6 +1419,7 @@ static int hci_dev_do_open(struct hci_dev *hdev)
14191419
* completed.
14201420
*/
14211421
if (test_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks) &&
1422+
!hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
14221423
hci_dev_test_flag(hdev, HCI_VENDOR_DIAG) && hdev->set_diag)
14231424
ret = hdev->set_diag(hdev, true);
14241425

0 commit comments

Comments
 (0)