Skip to content

Commit 2ab216a

Browse files
committed
Bluetooth: Check for supported white list before issuing commands
The white list commands might not be implemented if the controller does not actually support the white list. So check the supported commands first before issuing these commands. Not supporting the white list is the same as supporting a white list with zero size. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent f6fc86f commit 2ab216a

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎net/bluetooth/hci_core.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,6 @@ static void le_setup(struct hci_request *req)
508508
/* Read LE Supported States */
509509
hci_req_add(req, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL);
510510

511-
/* Read LE White List Size */
512-
hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE, 0, NULL);
513-
514-
/* Clear LE White List */
515-
hci_req_add(req, HCI_OP_LE_CLEAR_WHITE_LIST, 0, NULL);
516-
517511
/* LE-only controllers have LE implicitly enabled */
518512
if (!lmp_bredr_capable(hdev))
519513
hci_dev_set_flag(hdev, HCI_LE_ENABLED);
@@ -832,6 +826,17 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt)
832826
hci_req_add(req, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL);
833827
}
834828

829+
if (hdev->commands[26] & 0x40) {
830+
/* Read LE White List Size */
831+
hci_req_add(req, HCI_OP_LE_READ_WHITE_LIST_SIZE,
832+
0, NULL);
833+
}
834+
835+
if (hdev->commands[26] & 0x80) {
836+
/* Clear LE White List */
837+
hci_req_add(req, HCI_OP_LE_CLEAR_WHITE_LIST, 0, NULL);
838+
}
839+
835840
if (hdev->le_features[0] & HCI_LE_DATA_LEN_EXT) {
836841
/* Read LE Maximum Data Length */
837842
hci_req_add(req, HCI_OP_LE_READ_MAX_DATA_LEN, 0, NULL);

0 commit comments

Comments
 (0)