Skip to content

Commit

Permalink
Bluetooth: Fix removing adv when processing cmd complete
Browse files Browse the repository at this point in the history
If we remove one instance of adv using Set Extended Adv Enable, there
is a possibility of issue occurs when processing the Command Complete
event. Especially, the adv_info might not be found since we already
remove it in hci_req_clear_adv_instance() -> hci_remove_adv_instance().
If that's the case, we will mistakenly proceed to remove all adv
instances instead of just one single instance.

This patch fixes the issue by checking the content of the HCI command
instead of checking whether the adv_info is found.

Signed-off-by: Archie Pusaka <apusaka@chromium.org>
Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
Archie Pusaka authored and Luiz Augusto von Dentz committed Oct 28, 2021
1 parent c603bf1 commit 2128939
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,10 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev,
&conn->le_conn_timeout,
conn->conn_timeout);
} else {
if (adv) {
adv->enabled = false;
if (cp->num_of_sets) {
if (adv)
adv->enabled = false;

/* If just one instance was disabled check if there are
* any other instance enabled before clearing HCI_LE_ADV
*/
Expand Down

0 comments on commit 2128939

Please sign in to comment.