Skip to content

Commit 2128939

Browse files
apusakaVudentz
authored andcommitted
Bluetooth: Fix removing adv when processing cmd complete
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 <[email protected]> Reviewed-by: Sonny Sasaka <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent c603bf1 commit 2128939

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/bluetooth/hci_event.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,10 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev,
13261326
&conn->le_conn_timeout,
13271327
conn->conn_timeout);
13281328
} else {
1329-
if (adv) {
1330-
adv->enabled = false;
1329+
if (cp->num_of_sets) {
1330+
if (adv)
1331+
adv->enabled = false;
1332+
13311333
/* If just one instance was disabled check if there are
13321334
* any other instance enabled before clearing HCI_LE_ADV
13331335
*/

0 commit comments

Comments
 (0)