Skip to content

Commit 1f9d565

Browse files
apusakaholtmann
authored andcommitted
Bluetooth: Attempt to clear HCI_LE_ADV on adv set terminated error event
We should clear the flag if the adv instance removed due to receiving this error status is the last one we have. Signed-off-by: Archie Pusaka <apusaka@chromium.org> Reviewed-by: Miao-chen Chou <mcchou@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 0f281a5 commit 1f9d565

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/bluetooth/hci_event.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5527,7 +5527,7 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)
55275527
{
55285528
struct hci_evt_le_ext_adv_set_term *ev = (void *) skb->data;
55295529
struct hci_conn *conn;
5530-
struct adv_info *adv;
5530+
struct adv_info *adv, *n;
55315531

55325532
BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
55335533

@@ -5553,6 +5553,13 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)
55535553
hci_remove_adv_instance(hdev, ev->handle);
55545554
mgmt_advertising_removed(NULL, hdev, ev->handle);
55555555

5556+
list_for_each_entry_safe(adv, n, &hdev->adv_instances, list) {
5557+
if (adv->enabled)
5558+
return;
5559+
}
5560+
5561+
/* We are no longer advertising, clear HCI_LE_ADV */
5562+
hci_dev_clear_flag(hdev, HCI_LE_ADV);
55565563
return;
55575564
}
55585565

0 commit comments

Comments
 (0)