[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220118023152.1948105-4-sashal@kernel.org>
Date: Mon, 17 Jan 2022 21:28:48 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Archie Pusaka <apusaka@...omium.org>,
Sonny Sasaka <sonnysasaka@...omium.org>,
Luiz Augusto von Dentz <luiz.von.dentz@...el.com>,
Sasha Levin <sashal@...nel.org>, marcel@...tmann.org,
johan.hedberg@...il.com, luiz.dentz@...il.com, davem@...emloft.net,
kuba@...nel.org, linux-bluetooth@...r.kernel.org,
netdev@...r.kernel.org
Subject: [PATCH AUTOSEL 5.15 004/188] Bluetooth: Fix removing adv when processing cmd complete
From: Archie Pusaka <apusaka@...omium.org>
[ Upstream commit 2128939fe2e771645dd88e1938c27fdf96bd1cd0 ]
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@...omium.org>
Reviewed-by: Sonny Sasaka <sonnysasaka@...omium.org>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@...el.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
net/bluetooth/hci_event.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0bca035bf2dcc..75116cf1b173d 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1325,8 +1325,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
*/
--
2.34.1
Powered by blists - more mailing lists