Skip to content

Commit 23837a6

Browse files
Vudentzholtmann
authored andcommitted
Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
Error status of this event means that it has ended due reasons other than a connection: 'If advertising has terminated as a result of the advertising duration elapsing, the Status parameter shall be set to the error code Advertising Timeout (0x3C).' 'If advertising has terminated because the Max_Extended_Advertising_Events was reached, the Status parameter shall be set to the error code Limit Reached (0x43).' Fixes: acf0aea ("Bluetooth: Handle ADv set terminated event") Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 43e59cb commit 23837a6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

net/bluetooth/hci_event.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5322,8 +5322,19 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)
53225322

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

5325-
if (ev->status)
5325+
if (ev->status) {
5326+
struct adv_info *adv;
5327+
5328+
adv = hci_find_adv_instance(hdev, ev->handle);
5329+
if (!adv)
5330+
return;
5331+
5332+
/* Remove advertising as it has been terminated */
5333+
hci_remove_adv_instance(hdev, ev->handle);
5334+
mgmt_advertising_removed(NULL, hdev, ev->handle);
5335+
53265336
return;
5337+
}
53275338

53285339
conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle));
53295340
if (conn) {

0 commit comments

Comments
 (0)