Skip to content

Commit 6012b93

Browse files
VudentzJohan Hedberg
authored andcommitted
Bluetooth: Fix advertising duplicated flags
Instances may have flags set as part of its data in which case the code should not attempt to add it again otherwise it can cause duplication: < HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 35 Handle: 0x00 Operation: Complete extended advertising data (0x03) Fragment preference: Minimize fragmentation (0x01) Data length: 0x06 Flags: 0x04 BR/EDR Not Supported Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Johan Hedberg <[email protected]>
1 parent 492ad78 commit 6012b93

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/bluetooth/hci_request.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,14 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
12731273

12741274
instance_flags = get_adv_instance_flags(hdev, instance);
12751275

1276+
/* If instance already has the flags set skip adding it once
1277+
* again.
1278+
*/
1279+
if (adv_instance && eir_get_data(adv_instance->adv_data,
1280+
adv_instance->adv_data_len, EIR_FLAGS,
1281+
NULL))
1282+
goto skip_flags;
1283+
12761284
/* The Add Advertising command allows userspace to set both the general
12771285
* and limited discoverable flags.
12781286
*/
@@ -1305,6 +1313,7 @@ static u8 create_instance_adv_data(struct hci_dev *hdev, u8 instance, u8 *ptr)
13051313
}
13061314
}
13071315

1316+
skip_flags:
13081317
if (adv_instance) {
13091318
memcpy(ptr, adv_instance->adv_data,
13101319
adv_instance->adv_data_len);

0 commit comments

Comments
 (0)