diff mbox series

Bluetooth: Fix enabling advertising for central role

Message ID 20210820234038.586979-1-luiz.dentz@gmail.com
State New
Headers show
Series Bluetooth: Fix enabling advertising for central role | expand

Commit Message

Luiz Augusto von Dentz Aug. 20, 2021, 11:40 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

When disconnecting the advertising shall be re-enabled only when the
connection role is slave/peripheral as the central role use advertising
to connect it could end up enabling the instance 0x00 if there are other
advertising instances.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
 net/bluetooth/hci_event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 28, 2021, 1:58 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=535159

---Test result---

Test Summary:
CheckPatch                    PASS      0.53 seconds
GitLint                       PASS      0.10 seconds
BuildKernel                   PASS      575.27 seconds
TestRunner: Setup             PASS      403.74 seconds
TestRunner: l2cap-tester      PASS      3.05 seconds
TestRunner: bnep-tester       PASS      2.19 seconds
TestRunner: mgmt-tester       PASS      33.88 seconds
TestRunner: rfcomm-tester     PASS      2.47 seconds
TestRunner: sco-tester        PASS      2.38 seconds
TestRunner: smp-tester        FAIL      2.38 seconds
TestRunner: userchan-tester   PASS      2.19 seconds

Details
##############################
Test: CheckPatch - PASS - 0.53 seconds
Run checkpatch.pl script with rule in .checkpatch.conf


##############################
Test: GitLint - PASS - 0.10 seconds
Run gitlint with rule in .gitlint


##############################
Test: BuildKernel - PASS - 575.27 seconds
Build Kernel with minimal configuration supports Bluetooth


##############################
Test: TestRunner: Setup - PASS - 403.74 seconds
Setup environment for running Test Runner


##############################
Test: TestRunner: l2cap-tester - PASS - 3.05 seconds
Run test-runner with l2cap-tester
Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: bnep-tester - PASS - 2.19 seconds
Run test-runner with bnep-tester
Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: mgmt-tester - PASS - 33.88 seconds
Run test-runner with mgmt-tester
Total: 452, Passed: 449 (99.3%), Failed: 0, Not Run: 3

##############################
Test: TestRunner: rfcomm-tester - PASS - 2.47 seconds
Run test-runner with rfcomm-tester
Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: sco-tester - PASS - 2.38 seconds
Run test-runner with sco-tester
Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0

##############################
Test: TestRunner: smp-tester - FAIL - 2.38 seconds
Run test-runner with smp-tester
Total: 8, Passed: 7 (87.5%), Failed: 1, Not Run: 0

Failed Test Cases
SMP Client - SC Request 2                            Failed       0.029 seconds

##############################
Test: TestRunner: userchan-tester - PASS - 2.19 seconds
Run test-runner with userchan-tester
Total: 3, Passed: 3 (100.0%), Failed: 0, Not Run: 0



---
Regards,
Linux Bluetooth
Marcel Holtmann Aug. 30, 2021, 2:49 p.m. UTC | #2
Hi Luiz,

> When disconnecting the advertising shall be re-enabled only when the

> connection role is slave/peripheral as the central role use advertising

> to connect it could end up enabling the instance 0x00 if there are other

> advertising instances.

> 

> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

> ---

> net/bluetooth/hci_event.c | 4 ++--

> 1 file changed, 2 insertions(+), 2 deletions(-)


patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0bca035bf2dc..293d4c9c4b09 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -2351,7 +2351,7 @@  static void hci_cs_disconnect(struct hci_dev *hdev, u8 status)
 		mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
 				       conn->dst_type, status);
 
-		if (conn->type == LE_LINK) {
+		if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
 			hdev->cur_adv_instance = conn->adv_instance;
 			hci_req_reenable_advertising(hdev);
 		}
@@ -2961,7 +2961,7 @@  static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 	 * or until a connection is created or until the Advertising
 	 * is timed out due to Directed Advertising."
 	 */
-	if (conn->type == LE_LINK) {
+	if (conn->type == LE_LINK && conn->role == HCI_ROLE_SLAVE) {
 		hdev->cur_adv_instance = conn->adv_instance;
 		hci_req_reenable_advertising(hdev);
 	}