Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: MGMT: Fix always using HCI_MAX_AD_LENGTH

HCI_MAX_AD_LENGTH shall only be used if the controller doesn't support
extended advertising, otherwise HCI_MAX_EXT_AD_LENGTH shall be used
instead.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

+14 -8
+4
include/net/bluetooth/hci_core.h
··· 1801 1801 /* Extended advertising support */ 1802 1802 #define ext_adv_capable(dev) (((dev)->le_features[1] & HCI_LE_EXT_ADV)) 1803 1803 1804 + /* Maximum advertising length */ 1805 + #define max_adv_len(dev) \ 1806 + (ext_adv_capable(dev) ? HCI_MAX_EXT_AD_LENGTH : HCI_MAX_AD_LENGTH) 1807 + 1804 1808 /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 1789: 1805 1809 * 1806 1810 * C24: Mandatory if the LE Controller supports Connection State and either
+7 -5
net/bluetooth/hci_event.c
··· 1747 1747 { 1748 1748 struct discovery_state *d = &hdev->discovery; 1749 1749 1750 - if (len > HCI_MAX_AD_LENGTH) 1750 + if (len > max_adv_len(hdev)) 1751 1751 return; 1752 1752 1753 1753 bacpy(&d->last_adv_addr, bdaddr); ··· 6249 6249 return; 6250 6250 } 6251 6251 6252 - if (!ext_adv && len > HCI_MAX_AD_LENGTH) { 6253 - bt_dev_err_ratelimited(hdev, "legacy adv larger than 31 bytes"); 6252 + if (len > max_adv_len(hdev)) { 6253 + bt_dev_err_ratelimited(hdev, 6254 + "adv larger than maximum supported"); 6254 6255 return; 6255 6256 } 6256 6257 ··· 6316 6315 */ 6317 6316 conn = check_pending_le_conn(hdev, bdaddr, bdaddr_type, bdaddr_resolved, 6318 6317 type); 6319 - if (!ext_adv && conn && type == LE_ADV_IND && len <= HCI_MAX_AD_LENGTH) { 6318 + if (!ext_adv && conn && type == LE_ADV_IND && 6319 + len <= max_adv_len(hdev)) { 6320 6320 /* Store report for later inclusion by 6321 6321 * mgmt_device_connected 6322 6322 */ ··· 6458 6456 info->length + 1)) 6459 6457 break; 6460 6458 6461 - if (info->length <= HCI_MAX_AD_LENGTH) { 6459 + if (info->length <= max_adv_len(hdev)) { 6462 6460 rssi = info->data[info->length]; 6463 6461 process_adv_report(hdev, info->type, &info->bdaddr, 6464 6462 info->bdaddr_type, NULL, 0, rssi,
+3 -3
net/bluetooth/mgmt.c
··· 8428 8428 supported_flags = get_supported_adv_flags(hdev); 8429 8429 8430 8430 rp->supported_flags = cpu_to_le32(supported_flags); 8431 - rp->max_adv_data_len = HCI_MAX_AD_LENGTH; 8432 - rp->max_scan_rsp_len = HCI_MAX_AD_LENGTH; 8431 + rp->max_adv_data_len = max_adv_len(hdev); 8432 + rp->max_scan_rsp_len = max_adv_len(hdev); 8433 8433 rp->max_instances = hdev->le_num_of_adv_sets; 8434 8434 rp->num_instances = hdev->adv_instance_cnt; 8435 8435 ··· 8465 8465 static u8 tlv_data_max_len(struct hci_dev *hdev, u32 adv_flags, 8466 8466 bool is_adv_data) 8467 8467 { 8468 - u8 max_len = HCI_MAX_AD_LENGTH; 8468 + u8 max_len = max_adv_len(hdev); 8469 8469 8470 8470 if (is_adv_data) { 8471 8471 if (adv_flags & (MGMT_ADV_FLAG_DISCOV |