Bluetooth: hci_sync: Fix not clearing cmd_sync_work_list on power off
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 Bluetooth: hci_sync: Fix not clearing cmd_sync_work_list on power off
From: Luiz Augusto von Dentz <[email protected]>
When powering off the cmd_sync_work_list may contain items which shall be cleared during power off as they shouldn't be run during power off sequence.
--- net/bluetooth/hci_sync.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
net/bluetooth/hci_sync.c +15 -5
@@ -648,16 +648,22 @@ static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,kfree (entry); } -void hci_cmd_sync_clear (struct hci_dev *hdev) +/* Clear remaining entries in cmd_sync_work_list */ +static void hci_cmd_sync_list_clear (struct hci_dev *hdev) {struct hci_cmd_sync_work_entry *entry, *tmp; +list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) +_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +} + +void hci_cmd_sync_clear (struct hci_dev *hdev) +{cancel_work_sync (&hdev->cmd_sync_work);cancel_work_sync (&hdev->reenable_adv_work);mutex_lock (&hdev->cmd_sync_work_lock); -list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) -_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +hci_cmd_sync_list_clear (hdev);mutex_unlock (&hdev->cmd_sync_work_lock); }
@@ -678,6 +684,7 @@ EXPORT_SYMBOL(hci_cmd_sync_cancel);* * - Set result and mark status to HCI_REQ_CANCELED * - Wakeup command sync thread +* - Clear cmd_sync_work_list if the interface is down */ void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {
@@ -692,6 +699,9 @@ void hci_cmd_sync_cancel_sync(struct hci_dev *hdev, int err)wake_up_interruptible (&hdev->req_wait_q); } + +if (err ==EHOSTDOWN || err == -EHOSTDOWN ) +hci_cmd_sync_list_clear (hdev); }EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);
@@ -5159,14 +5169,14 @@ int hci_dev_close_sync(struct hci_dev *hdev)disable_delayed_work (&hdev->power_off);disable_delayed_work (&hdev->ncmd_timer);disable_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,ENODEV ); }else {cancel_delayed_work (&hdev->power_off);cancel_delayed_work (&hdev->ncmd_timer);cancel_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,EHOSTDOWN ); } -hci_cmd_sync_cancel_sync (hdev,ENODEV ); -cancel_interleave_scan (hdev);if (hdev->adv_instance_timeout) {
Signature · 1 line
2.49.0
Luiz Augusto von Dentz
maintainerQuoted 78 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
When powering off the
cmd_sync_work_listmay contain items which shall be cleared during power off as they shouldn't be run during power off sequence.Signed-off-by Luiz Augusto von Dentz <[email protected]>--- net/bluetooth/hci_sync.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)net/bluetooth/hci_sync.c +15
-6@@ -648,16 +648,22 @@ static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,kfree (entry); } -void hci_cmd_sync_clear (struct hci_dev *hdev) +/* Clear remaining entries in cmd_sync_work_list */ +static void hci_cmd_sync_list_clear (struct hci_dev *hdev) {struct hci_cmd_sync_work_entry *entry, *tmp; +list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) +_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +} + +void hci_cmd_sync_clear (struct hci_dev *hdev) +{cancel_work_sync (&hdev->cmd_sync_work);cancel_work_sync (&hdev->reenable_adv_work);mutex_lock (&hdev->cmd_sync_work_lock); -list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) -_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +hci_cmd_sync_list_clear (hdev);mutex_unlock (&hdev->cmd_sync_work_lock); }@@ -678,6 +684,7 @@ EXPORT_SYMBOL(hci_cmd_sync_cancel);* * - Set result and mark status to HCI_REQ_CANCELED * - Wakeup command sync thread +* - Clear cmd_sync_work_list if the interface is down */ void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {@@ -692,6 +699,9 @@ void hci_cmd_sync_cancel_sync(struct hci_dev *hdev, int err)wake_up_interruptible (&hdev->req_wait_q); } + +if (err ==EHOSTDOWN || err == -EHOSTDOWN ) +hci_cmd_sync_list_clear (hdev); }EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);@@ -5159,14 +5169,14 @@ int hci_dev_close_sync(struct hci_dev *hdev)disable_delayed_work (&hdev->power_off);disable_delayed_work (&hdev->ncmd_timer);disable_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,ENODEV ); }else {cancel_delayed_work (&hdev->power_off);cancel_delayed_work (&hdev->ncmd_timer);cancel_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,EHOSTDOWN ); } -hci_cmd_sync_cancel_sync (hdev,ENODEV ); -cancel_interleave_scan (hdev);if (hdev->adv_instance_timeout) { --
Quoted 1 line
2.49.0
Have a try with the above changes.
Signature · 1 line
Luiz Augusto von Dentz
Dear Luiz
Quoted 78 lines · Luiz Augusto von Dentz
Quoted 76 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
When powering off the
cmd_sync_work_listmay contain items which shall be cleared during power off as they shouldn't be run during power off sequence.Signed-off-by Luiz Augusto von Dentz <[email protected]>--- net/bluetooth/hci_sync.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)net/bluetooth/hci_sync.c +15
-5@@ -648,16 +648,22 @@ static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,kfree (entry); } -void hci_cmd_sync_clear (struct hci_dev *hdev) +/* Clear remaining entries in cmd_sync_work_list */ +static void hci_cmd_sync_list_clear (struct hci_dev *hdev) {struct hci_cmd_sync_work_entry *entry, *tmp; +list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) +_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +} + +void hci_cmd_sync_clear (struct hci_dev *hdev) +{cancel_work_sync (&hdev->cmd_sync_work);cancel_work_sync (&hdev->reenable_adv_work);mutex_lock (&hdev->cmd_sync_work_lock); -list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) -_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +hci_cmd_sync_list_clear (hdev);mutex_unlock (&hdev->cmd_sync_work_lock); }@@ -678,6 +684,7 @@ EXPORT_SYMBOL(hci_cmd_sync_cancel);* * - Set result and mark status to HCI_REQ_CANCELED * - Wakeup command sync thread +* - Clear cmd_sync_work_list if the interface is down */ void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {@@ -692,6 +699,9 @@ void hci_cmd_sync_cancel_sync(struct hci_dev *hdev, int err)wake_up_interruptible (&hdev->req_wait_q); } + +if (err ==EHOSTDOWN || err == -EHOSTDOWN ) +hci_cmd_sync_list_clear (hdev); }EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);@@ -5159,14 +5169,14 @@ int hci_dev_close_sync(struct hci_dev *hdev)disable_delayed_work (&hdev->power_off);disable_delayed_work (&hdev->ncmd_timer);disable_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,ENODEV ); }else {cancel_delayed_work (&hdev->power_off);cancel_delayed_work (&hdev->ncmd_timer);cancel_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,EHOSTDOWN ); } -hci_cmd_sync_cancel_sync (hdev,ENODEV ); -cancel_interleave_scan (hdev);
Quoted 6 lines
Quoted 3 lines
net/bluetooth/hci_sync.c +0
-1if (hdev->adv_instance_timeout) { --2.49.0
Have a try with the above changes.
I've applied the above changes and it's passed for this case. nice! May I ask if it was you who submitted this change or was it me?
Dear Luiz
Quoted 81 lines · Shuai Zhang
Dear Luiz
Quoted 78 lines · Luiz Augusto von Dentz
Quoted 76 lines · Luiz Augusto von Dentz
From: Luiz Augusto von Dentz <[email protected]>
When powering off the
cmd_sync_work_listmay contain items which shall be cleared during power off as they shouldn't be run during power off sequence.Signed-off-by Luiz Augusto von Dentz <[email protected]>--- net/bluetooth/hci_sync.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)net/bluetooth/hci_sync.c +15
-5@@ -648,16 +648,22 @@ static void _hci_cmd_sync_cancel_entry(struct hci_dev *hdev,kfree (entry); } -void hci_cmd_sync_clear (struct hci_dev *hdev) +/* Clear remaining entries in cmd_sync_work_list */ +static void hci_cmd_sync_list_clear (struct hci_dev *hdev) {struct hci_cmd_sync_work_entry *entry, *tmp; +list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) +_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +} + +void hci_cmd_sync_clear (struct hci_dev *hdev) +{cancel_work_sync (&hdev->cmd_sync_work);cancel_work_sync (&hdev->reenable_adv_work);mutex_lock (&hdev->cmd_sync_work_lock); -list_for_each_entry_safe (entry, tmp, &hdev->cmd_sync_work_list, list) -_hci_cmd_sync_cancel_entry (hdev, entry, -ECANCELED ); +hci_cmd_sync_list_clear (hdev);mutex_unlock (&hdev->cmd_sync_work_lock); }@@ -678,6 +684,7 @@ EXPORT_SYMBOL(hci_cmd_sync_cancel);* * - Set result and mark status to HCI_REQ_CANCELED * - Wakeup command sync thread +* - Clear cmd_sync_work_list if the interface is down */ void hci_cmd_sync_cancel_sync (struct hci_dev *hdev,int err) {@@ -692,6 +699,9 @@ void hci_cmd_sync_cancel_sync(struct hci_dev *hdev, int err)wake_up_interruptible (&hdev->req_wait_q); } + +if (err ==EHOSTDOWN || err == -EHOSTDOWN ) +hci_cmd_sync_list_clear (hdev); }EXPORT_SYMBOL (hci_cmd_sync_cancel_sync);@@ -5159,14 +5169,14 @@ int hci_dev_close_sync(struct hci_dev *hdev)disable_delayed_work (&hdev->power_off);disable_delayed_work (&hdev->ncmd_timer);disable_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,ENODEV ); }else {cancel_delayed_work (&hdev->power_off);cancel_delayed_work (&hdev->ncmd_timer);cancel_delayed_work (&hdev->le_scan_disable); +hci_cmd_sync_cancel_sync (hdev,EHOSTDOWN ); } -hci_cmd_sync_cancel_sync (hdev,ENODEV ); -cancel_interleave_scan (hdev);
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
net/bluetooth/hci_sync.c +0
-1if (hdev->adv_instance_timeout) { --2.49.0
Have a try with the above changes.
I've applied the above changes and it's passed for this case. nice! May I ask if it was you who submitted this change or was it me?
May I inquire what your thoughts are? If you have any questions, please let me know.
thanks,
Shuai
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=951571
---Test result---
Test Summary:
CheckPatch PENDING 0.29 seconds GitLint PENDING 0.24 seconds SubjectPrefix PASS 0.13 seconds BuildKernel PASS 34.02 seconds CheckAllWarning PASS 45.11 seconds CheckSparse PASS 32.33 seconds BuildKernel32 PASS 24.56 seconds TestRunnerSetup PASS 463.45 seconds TestRunner_l2cap-tester PASS 24.52 seconds TestRunner_iso-tester PASS 30.95 seconds TestRunner_bnep-tester PASS 4.79 seconds TestRunner_mgmt-tester FAIL 120.96 seconds TestRunner_rfcomm-tester PASS 7.90 seconds TestRunner_sco-tester PASS 12.65 seconds TestRunner_ioctl-tester PASS 8.48 seconds TestRunner_mesh-tester PASS 6.08 seconds TestRunner_smp-tester PASS 7.17 seconds TestRunner_userchan-tester PASS 5.03 seconds IncrementalBuild PENDING 0.77 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: 483 (98.6%), Failed: 3, Not Run: 4
Failed Test Cases
LL Privacy - Add Device 2 (2 Devices to AL) Failed 0.178 seconds LL Privacy - Set Flags 1 (Add to RL) Failed 0.150 seconds LL Privacy - Set Flags 3 (2 Devices to RL) Failed 0.181 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth