fixup! Bluetooth: hci_core: Fix triggering cmd_timer for HCI_OP_NOP
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH 1/1 fixup! Bluetooth: hci_core: Fix triggering cmd_timer for HCI_OP_NOP
From: Luiz Augusto von Dentz <[email protected]>
--- net/bluetooth/hci_core.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/bluetooth/hci_core.c +10 -9
@@ -4121,7 +4121,7 @@ static void hci_rx_work(struct work_struct *work) } } -static void hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) +static int hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) {int err;
@@ -4133,16 +4133,18 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)if (!hdev->sent_cmd) {skb_queue_head (&hdev->cmd_q, skb);queue_work (hdev->workqueue, &hdev->cmd_work); -return ; +return -EINVAL ; }if (hci_skb_opcode (skb) !=HCI_OP_NOP ) { err =hci_send_frame (hdev, skb);if (err <0 ) {hci_cmd_sync_cancel_sync (hdev, -err); -return ; +return err; }atomic_dec (&hdev->cmd_cnt); + }else { + err = -ENODATA ; } if (hdev->req_status == HCI_REQ_PEND &&
@@ -4150,12 +4152,15 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)kfree_skb (hdev->req_skb); hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL ); } + +return err; }static void hci_cmd_work (struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_work);struct sk_buff *skb; +int err;BT_DBG ("%s cmd_cnt %d cmd queued %d" , hdev->name,atomic_read (&hdev->cmd_cnt),skb_queue_len (&hdev->cmd_q));
@@ -4166,12 +4171,8 @@ static void hci_cmd_work(struct work_struct *work)if (!skb)return ; -hci_send_cmd_sync (hdev, skb); - -/* Don't trigger cmd_timer in case of HCI_OP_NOP since there is -* no command pending. -*/ -if (hci_skb_opcode (skb) ==HCI_OP_NOP ) + err =hci_send_cmd_sync (hdev, skb); +if (err)return ;rcu_read_lock ();
Signature · 1 line
2.51.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=1024481
---Test result---
Test Summary:
CheckPatch PENDING 0.46 seconds GitLint PENDING 0.29 seconds SubjectPrefix PASS 0.08 seconds BuildKernel PASS 25.04 seconds CheckAllWarning PASS 27.39 seconds CheckSparse WARNING 30.75 seconds BuildKernel32 PASS 24.71 seconds TestRunnerSetup PASS 545.49 seconds TestRunner_l2cap-tester PASS 23.71 seconds TestRunner_iso-tester PASS 76.59 seconds TestRunner_bnep-tester PASS 6.03 seconds TestRunner_mgmt-tester FAIL 121.04 seconds TestRunner_rfcomm-tester PASS 12.68 seconds TestRunner_sco-tester PASS 14.21 seconds TestRunner_ioctl-tester PASS 9.79 seconds TestRunner_mesh-tester FAIL 11.52 seconds TestRunner_smp-tester PASS 8.28 seconds TestRunner_userchan-tester PASS 6.43 seconds IncrementalBuild PENDING 0.76 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSparse - WARNING
Desc: Run sparse tool with linux kernel
Output:net/bluetooth/hci_core.c:85:9: warning: context imbalance in '__hci_dev_get' - different lock contexts for basic blocknet/bluetooth/hci_core.c: note: in included file (through include/linux/notifier.h, include/linux/memory_hotplug.h, include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, include/linux/radix-tree.h, ...):
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 488 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.104 seconds LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.141 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.069 seconds Mesh - Send cancel - 2 Timed out 1.997 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
Hi,
17. marraskuuta 2025 20.12.55 UTC Luiz Augusto von Dentz <[email protected]> kirjoitti:
Quoted 32 lines
From: Luiz Augusto von Dentz <[email protected]>
Fixes 486a25d25a4b3 ("Bluetooth: hci_core: Fix triggering cmd_timer for HCI_OP_NOP")Reported-by [email protected]Signed-off-by Pauli Virtanen <[email protected]>Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/hci_core.c| 19 ++++++++++---------1 file changed, 10 insertions(+), 9 deletions(-)net/bluetooth/hci_core.c +2
-2@@ -4121,7 +4121,7 @@ static void hci_rx_work(struct work_struct *work) } } -static void hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) +static int hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) {int err;@@ -4133,16 +4133,18 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)if (!hdev->sent_cmd) {skb_queue_head (&hdev->cmd_q, skb);queue_work (hdev->workqueue, &hdev->cmd_work); -return ; +return -EINVAL ; }
net/bluetooth/hci_core.c static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb) · line 4147
Quoted 10 lines
net/bluetooth/hci_core.c +3
-1if (hci_skb_opcode (skb) !=HCI_OP_NOP ) { err =hci_send_frame (hdev, skb);if (err <0 ) {hci_cmd_sync_cancel_sync (hdev, -err); -return ; +return err; }atomic_dec (&hdev->cmd_cnt); + }else { + err = -ENODATA ;
Change itself is probably OK, but I don't understand based on a quick look what consumes the skb on error / nop (also in the previous code)
Quoted 34 lines
net/bluetooth/hci_core.c +5
-6} if (hdev->req_status == HCI_REQ_PEND &&@@ -4150,12 +4152,15 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)kfree_skb (hdev->req_skb); hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL ); } + +return err; }static void hci_cmd_work (struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_work);struct sk_buff *skb; +int err;BT_DBG ("%s cmd_cnt %d cmd queued %d" , hdev->name,atomic_read (&hdev->cmd_cnt),skb_queue_len (&hdev->cmd_q));@@ -4166,12 +4171,8 @@ static void hci_cmd_work(struct work_struct *work)if (!skb)return ; -hci_send_cmd_sync (hdev, skb); - -/* Don't trigger cmd_timer in case of HCI_OP_NOP since there is -* no command pending. -*/ -if (hci_skb_opcode (skb) ==HCI_OP_NOP ) + err =hci_send_cmd_sync (hdev, skb); +if (err)return ;rcu_read_lock ();
Luiz Augusto von Dentz
maintainerHi Pauli,
Quoted 36 lines · Pauli Virtanen
Hi,
17. marraskuuta 2025 20.12.55 UTC Luiz Augusto von Dentz <[email protected]> kirjoitti:
Quoted 32 lines
From: Luiz Augusto von Dentz <[email protected]>
Fixes 486a25d25a4b3 ("Bluetooth: hci_core: Fix triggering cmd_timer for HCI_OP_NOP")Reported-by [email protected]Signed-off-by Pauli Virtanen <[email protected]>Signed-off-by Luiz Augusto von Dentz <[email protected]>---
net/bluetooth/hci_core.c| 19 ++++++++++---------1 file changed, 10 insertions(+), 9 deletions(-)net/bluetooth/hci_core.c +2
-2@@ -4121,7 +4121,7 @@ static void hci_rx_work(struct work_struct *work) } } -static void hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) +static int hci_send_cmd_sync (struct hci_dev *hdev,struct sk_buff *skb) {int err;@@ -4133,16 +4133,18 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)if (!hdev->sent_cmd) {skb_queue_head (&hdev->cmd_q, skb);queue_work (hdev->workqueue, &hdev->cmd_work); -return ; +return -EINVAL ; }
Quoted 12 lines
net/bluetooth/hci_core.c static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb) · line 4147
Quoted 10 lines
net/bluetooth/hci_core.c +3
-1if (hci_skb_opcode (skb) !=HCI_OP_NOP ) { err =hci_send_frame (hdev, skb);if (err <0 ) {hci_cmd_sync_cancel_sync (hdev, -err); -return ; +return err; }atomic_dec (&hdev->cmd_cnt); + }else { + err = -ENODATA ;Change itself is probably OK, but I don't understand based on a quick look what consumes the skb on error / nop (also in the previous code)
The sent_cmd is consumed on the next time hci_send_cmd_sync is run, that said perhaps you are referring to the original skb which has been cloned but in case of NOP it appears to be leaking since that never reaches the we should perhaps just free it.
Quoted 35 lines
Quoted 35 lines
net/bluetooth/hci_core.c +5
-6} if (hdev->req_status == HCI_REQ_PEND &&@@ -4150,12 +4152,15 @@ static void hci_send_cmd_sync(struct hci_dev *hdev, struct sk_buff *skb)kfree_skb (hdev->req_skb); hdev->req_skb =skb_clone (hdev->sent_cmd,GFP_KERNEL ); } + +return err; }static void hci_cmd_work (struct work_struct *work) { struct hci_dev *hdev = container_of(work, struct hci_dev, cmd_work);struct sk_buff *skb; +int err;BT_DBG ("%s cmd_cnt %d cmd queued %d" , hdev->name,atomic_read (&hdev->cmd_cnt),skb_queue_len (&hdev->cmd_q));@@ -4166,12 +4171,8 @@ static void hci_cmd_work(struct work_struct *work)if (!skb)return ; -hci_send_cmd_sync (hdev, skb); - -/* Don't trigger cmd_timer in case of HCI_OP_NOP since there is -* no command pending. -*/ -if (hci_skb_opcode (skb) ==HCI_OP_NOP ) + err =hci_send_cmd_sync (hdev, skb); +if (err)return ;rcu_read_lock ();
Signature · 1 line
Luiz Augusto von Dentz