public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off
@ 2025-04-08  2:46 Shuai Zhang
  2025-04-08  3:48 ` [v1] " bluez.test.bot
  2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
  0 siblings, 2 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-04-08  2:46 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: quic_shuaz, quic_chejiang, quic_jiaymao, quic_chezhou,
	quic_zijuhu, quic_mohamull

If turning off BT during pairing, "hci_acl_create_conn_sync" has chances
to be left in cmd_sync_work_list. Then the driver will try to send
the HCI command of creating connection but failed.

When establishing ACL link, add judgment for BT power off.

Change-Id: I9844a1ce1f207453e4fadeded3da1738eb4660c9
Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
---
 net/bluetooth/hci_sync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index aeeadb45e..fdd57132e 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -6761,7 +6761,7 @@ static int hci_acl_create_conn_sync(struct hci_dev *hdev, void *data)
 	struct hci_cp_create_conn cp;
 	int err;

-	if (!hci_conn_valid(hdev, conn))
+	if (!hci_conn_valid(hdev, conn) || !test_bit(HCI_UP, &hdev->flags))
 		return -ECANCELED;

 	/* Many controllers disallow HCI Create Connection while it is doing
--
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off
  2025-04-08  2:46 [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off Shuai Zhang
@ 2025-04-08  3:48 ` bluez.test.bot
  2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-04-08  3:48 UTC (permalink / raw)
  To: linux-bluetooth, quic_shuaz

[-- Attachment #1: Type: text/plain, Size: 2029 bytes --]

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=950871

---Test result---

Test Summary:
CheckPatch                    PENDING   0.27 seconds
GitLint                       PENDING   0.26 seconds
SubjectPrefix                 PASS      0.10 seconds
BuildKernel                   PASS      24.64 seconds
CheckAllWarning               PASS      26.81 seconds
CheckSparse                   PASS      30.00 seconds
BuildKernel32                 PASS      24.39 seconds
TestRunnerSetup               PASS      432.17 seconds
TestRunner_l2cap-tester       PASS      21.39 seconds
TestRunner_iso-tester         PASS      37.28 seconds
TestRunner_bnep-tester        PASS      4.77 seconds
TestRunner_mgmt-tester        FAIL      123.60 seconds
TestRunner_rfcomm-tester      PASS      7.90 seconds
TestRunner_sco-tester         PASS      12.77 seconds
TestRunner_ioctl-tester       PASS      8.52 seconds
TestRunner_mesh-tester        PASS      6.13 seconds
TestRunner_smp-tester         PASS      7.35 seconds
TestRunner_userchan-tester    PASS      5.13 seconds
IncrementalBuild              PENDING   0.69 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4

Failed Test Cases
LL Privacy - Add Device 2 (2 Devices to AL)          Failed       0.178 seconds
LL Privacy - Add Device 3 (AL is full)               Failed       0.194 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off
  2025-04-08  2:46 [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off Shuai Zhang
  2025-04-08  3:48 ` [v1] " bluez.test.bot
@ 2025-04-08  9:37 ` Paul Menzel
  2025-04-08 10:00   ` Shuai Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2025-04-08  9:37 UTC (permalink / raw)
  To: Shuai Zhang
  Cc: quic_chejiang, quic_jiaymao, quic_chezhou, quic_zijuhu,
	quic_mohamull, linux-bluetooth

Dear Shuai,


Thank you for your patch. Some minor comments.

It’d be great if you made the summary/title a statement about the action 
of the patch and not about the issue. Maybe:

Prohibit establishing of ACL links during poweroff


Am 08.04.25 um 04:46 schrieb Shuai Zhang:
> If turning off BT during pairing, "hci_acl_create_conn_sync" has chances
> to be left in cmd_sync_work_list. Then the driver will try to send
> the HCI command of creating connection but failed.

s/failed/fails/

> When establishing ACL link, add judgment for BT power off.

Maybe:

Check if the device is *not* starting up, that means powering off, when 
establishing the ACL link, and cancel early in this case.


It’d be great if you documented how to reproduce the bug and test the patch.

> Change-Id: I9844a1ce1f207453e4fadeded3da1738eb4660c9
> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
> ---
>   net/bluetooth/hci_sync.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index aeeadb45e..fdd57132e 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -6761,7 +6761,7 @@ static int hci_acl_create_conn_sync(struct hci_dev *hdev, void *data)
>   	struct hci_cp_create_conn cp;
>   	int err;
> 
> -	if (!hci_conn_valid(hdev, conn))
> +	if (!hci_conn_valid(hdev, conn) || !test_bit(HCI_UP, &hdev->flags))
>   		return -ECANCELED;
> 
>   	/* Many controllers disallow HCI Create Connection while it is doing
> --
> 2.34.1

The diff looks reasonable.


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off
  2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
@ 2025-04-08 10:00   ` Shuai Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Shuai Zhang @ 2025-04-08 10:00 UTC (permalink / raw)
  To: Paul Menzel
  Cc: quic_chejiang, quic_jiaymao, quic_chezhou, quic_zijuhu,
	quic_mohamull, linux-bluetooth

Dear Paul

On 4/8/2025 5:37 PM, Paul Menzel wrote:
> Dear Shuai,
> 
> 
> Thank you for your patch. Some minor comments.
> 
> It’d be great if you made the summary/title a statement about the action of the patch and not about the issue. Maybe:
> 
> Prohibit establishing of ACL links during poweroff
> 
> 
> Am 08.04.25 um 04:46 schrieb Shuai Zhang:
>> If turning off BT during pairing, "hci_acl_create_conn_sync" has chances
>> to be left in cmd_sync_work_list. Then the driver will try to send
>> the HCI command of creating connection but failed.
> 
> s/failed/fails/

 Could you please explain what this means?

> 
>> When establishing ACL link, add judgment for BT power off.
> 
> Maybe:
> 
> Check if the device is *not* starting up, that means powering off, when establishing the ACL link, and cancel early in this case.
> 
> 
> It’d be great if you documented how to reproduce the bug and test the patch.
> 

 I will revise the aforementioned issues and publish the updates in version 2. 
 Thank you very much for your suggestions.

>> Change-Id: I9844a1ce1f207453e4fadeded3da1738eb4660c9
>> Signed-off-by: Shuai Zhang <quic_shuaz@quicinc.com>
>> ---
>>   net/bluetooth/hci_sync.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
>> index aeeadb45e..fdd57132e 100644
>> --- a/net/bluetooth/hci_sync.c
>> +++ b/net/bluetooth/hci_sync.c
>> @@ -6761,7 +6761,7 @@ static int hci_acl_create_conn_sync(struct hci_dev *hdev, void *data)
>>       struct hci_cp_create_conn cp;
>>       int err;
>>
>> -    if (!hci_conn_valid(hdev, conn))
>> +    if (!hci_conn_valid(hdev, conn) || !test_bit(HCI_UP, &hdev->flags))
>>           return -ECANCELED;
>>
>>       /* Many controllers disallow HCI Create Connection while it is doing
>> -- 
>> 2.34.1
> 
> The diff looks reasonable.
> 
> 
> Kind regards,
> 
> Paul


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-04-08 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08  2:46 [PATCH v1] Bluetooth: hci_sync: Establishing ACL links is prohibited when power off Shuai Zhang
2025-04-08  3:48 ` [v1] " bluez.test.bot
2025-04-08  9:37 ` [PATCH v1] " Paul Menzel
2025-04-08 10:00   ` Shuai Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox