Skip to content

Commit

Permalink
Bluetooth: Fix handling of HCI_LE_Advertising_Set_Terminated event
Browse files Browse the repository at this point in the history
[ Upstream commit 23837a6 ]

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 <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Vudentz authored and gregkh committed Jul 14, 2021
1 parent 4f5fc3b commit 7d97522
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -5256,8 +5256,19 @@ static void hci_le_ext_adv_term_evt(struct hci_dev *hdev, struct sk_buff *skb)

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

if (ev->status)
if (ev->status) {
struct adv_info *adv;

adv = hci_find_adv_instance(hdev, ev->handle);
if (!adv)
return;

/* Remove advertising as it has been terminated */
hci_remove_adv_instance(hdev, ev->handle);
mgmt_advertising_removed(NULL, hdev, ev->handle);

return;
}

conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->conn_handle));
if (conn) {
Expand Down

0 comments on commit 7d97522

Please sign in to comment.