]> Git Repo - J-linux.git/commitdiff
Bluetooth: Attempt to clear HCI_LE_ADV on adv set terminated error event
authorArchie Pusaka <[email protected]>
Thu, 11 Nov 2021 05:20:54 +0000 (13:20 +0800)
committerMarcel Holtmann <[email protected]>
Tue, 16 Nov 2021 14:17:51 +0000 (15:17 +0100)
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 <[email protected]>
Reviewed-by: Miao-chen Chou <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
net/bluetooth/hci_event.c

index 8eae38129a6eb163096c30ea426c8ee39db34c14..efc5458b13456c49c42ba5328edf689009ecb883 100644 (file)
@@ -5527,7 +5527,7 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct hci_evt_le_ext_adv_set_term *ev = (void *) skb->data;
        struct hci_conn *conn;
-       struct adv_info *adv;
+       struct adv_info *adv, *n;
 
        BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
 
@@ -5553,6 +5553,13 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)
                hci_remove_adv_instance(hdev, ev->handle);
                mgmt_advertising_removed(NULL, hdev, ev->handle);
 
+               list_for_each_entry_safe(adv, n, &hdev->adv_instances, list) {
+                       if (adv->enabled)
+                               return;
+               }
+
+               /* We are no longer advertising, clear HCI_LE_ADV */
+               hci_dev_clear_flag(hdev, HCI_LE_ADV);
                return;
        }
 
This page took 0.053554 seconds and 4 git commands to generate.