Skip to contentSkip to conversation

Bluetooth: hci_core: Fix missing instances using HCI_MAX_AD_LENGTH

PATCH Applied Luiz Augusto von Dentz 3 participants 3 messages Aug 21, 2023

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/1 Bluetooth: hci_core: Fix missing instances using HCI_MAX_AD_LENGTH

From: Luiz Augusto von Dentz <[email protected]>

There a few instances still using HCI_MAX_AD_LENGTH instead of using max_adv_len which takes care of detecting what is the actual maximum length depending on if the controller supports EA or not.

Fixes 112b5090c219 ("Bluetooth: MGMT: Fix always using HCI_MAX_AD_LENGTH")
---
 include/net/bluetooth/hci_core.h | 6 +++---
 net/bluetooth/eir.c              | 2 +-
 net/bluetooth/mgmt.c             | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)
include/net/bluetooth/hci_core.h +3 -3
index 6fb055e3c595..6e2988b11f99 100644
@@ -83,7 +83,7 @@ struct discovery_state {
 	u8			last_adv_addr_type;
 	s8			last_adv_rssi;
 	u32			last_adv_flags;
-	u8			last_adv_data[HCI_MAX_AD_LENGTH];
+	u8			last_adv_data[HCI_MAX_EXT_AD_LENGTH];
 	u8			last_adv_data_len;
 	bool			report_invalid_rssi;
 	bool			result_filtering;
@@ -290,7 +290,7 @@ struct adv_pattern {
 	__u8 ad_type;
 	__u8 offset;
 	__u8 length;
-	__u8 value[HCI_MAX_AD_LENGTH];
+	__u8 value[HCI_MAX_EXT_AD_LENGTH];
 };
 
 struct adv_rssi_thresholds {
@@ -726,7 +726,7 @@ struct hci_conn {
 	__u16		le_conn_interval;
 	__u16		le_conn_latency;
 	__u16		le_supv_timeout;
-	__u8		le_adv_data[HCI_MAX_AD_LENGTH];
+	__u8		le_adv_data[HCI_MAX_EXT_AD_LENGTH];
 	__u8		le_adv_data_len;
 	__u8		le_per_adv_data[HCI_MAX_PER_AD_LENGTH];
 	__u8		le_per_adv_data_len;
net/bluetooth/eir.c +1 -1
index 8a85f6cdfbc1..9214189279e8 100644
@@ -33,7 +33,7 @@ u8 eir_append_local_name(struct hci_dev *hdev, u8 *ptr, u8 ad_len)
 	size_t complete_len;
 
 	/* no space left for name (+ NULL + type + len) */
-	if ((HCI_MAX_AD_LENGTH - ad_len) < HCI_MAX_SHORT_NAME_LENGTH + 3)
+	if ((max_adv_len(hdev) - ad_len) < HCI_MAX_SHORT_NAME_LENGTH + 3)
 		return ad_len;
 
 	/* use complete name if present and fits */
net/bluetooth/mgmt.c +3 -3
index d6c9b7bc8592..ba2e00646e8e 100644
@@ -5381,9 +5381,9 @@ static u8 parse_adv_monitor_pattern(struct adv_monitor *m, u8 pattern_count,
 	for (i = 0; i < pattern_count; i++) {
 		offset = patterns[i].offset;
 		length = patterns[i].length;
-		if (offset >= HCI_MAX_AD_LENGTH ||
-		    length > HCI_MAX_AD_LENGTH ||
-		    (offset + length) > HCI_MAX_AD_LENGTH)
+		if (offset >= HCI_MAX_EXT_AD_LENGTH ||
+		    length > HCI_MAX_EXT_AD_LENGTH ||
+		    (offset + length) > HCI_MAX_EXT_AD_LENGTH)
 			return MGMT_STATUS_INVALID_PARAMS;
 
 		p = kmalloc(sizeof(*p), GFP_KERNEL);
Signature · 1 line
2.41.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=777973

---Test result---

Test Summary:

CheckPatch                    PASS      1.15 seconds
GitLint                       PASS      0.38 seconds
SubjectPrefix                 PASS      0.54 seconds
BuildKernel                   PASS      38.96 seconds
CheckAllWarning               PASS      43.74 seconds
CheckSparse                   PASS      48.67 seconds
CheckSmatch                   PASS      132.32 seconds
BuildKernel32                 PASS      37.86 seconds
TestRunnerSetup               PASS      575.06 seconds
TestRunner_l2cap-tester       PASS      33.56 seconds
TestRunner_iso-tester         PASS      64.76 seconds
TestRunner_bnep-tester        PASS      13.54 seconds
TestRunner_mgmt-tester        PASS      254.21 seconds
TestRunner_rfcomm-tester      PASS      20.09 seconds
TestRunner_sco-tester         PASS      23.03 seconds
TestRunner_ioctl-tester       PASS      22.94 seconds
TestRunner_mesh-tester        PASS      17.20 seconds
TestRunner_smp-tester         PASS      18.46 seconds
TestRunner_userchan-tester    PASS      14.36 seconds
IncrementalBuild              PASS      36.01 seconds

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 10 lines · On Mon, 21 Aug 2023 11:18:48 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

There a few instances still using HCI_MAX_AD_LENGTH instead of using max_adv_len which takes care of detecting what is the actual maximum length depending on if the controller supports EA or not.

Fixes 112b5090c219 ("Bluetooth: MGMT: Fix always using HCI_MAX_AD_LENGTH")

[...]

Here is the summary with links:
- [v2] Bluetooth: hci_core: Fix missing instances using HCI_MAX_AD_LENGTH

    https://git.kernel.org/bluetooth/bluetooth-next/c/2434f59ffc72

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html