Bluetooth: btnxpuart: Simplify ACL handling and fix skb leak
Subsystems (2)
v3 cover Bluetooth: btnxpuart: Simplify ACL handling and fix skb leak
This series simplifies ACL handle extraction in btnxpuart and fixes an skb leak when devcoredump support is disabled, — all simple.
---
Changes in v3:
- Use IS_ENABLED(CONFIG_DEV_COREDUMP) instead of #ifdef, per Luiz.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Add a minor ACL handle-extraction simplification in btnxpuart.
- Fix the skb leak in btnxpuart when devcoredump support is disabled.
- Link to v1: https://patch.msgid.link/[email protected]
---
Zijun Hu (2):
Bluetooth: btnxpuart: Simplify nxp_recv_acl_pkt() by hci_acl_handle()
Bluetooth: btnxpuart: Fix skb leak in nxp_process_fw_dump()
drivers/bluetooth/btnxpuart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
---
base-commit: 2e63b55654e0ea35cbc4fae20244026718f56755
change-id: 20260913-misc_fix-6f6f518fe6b5
Best regards,
Signature · 1 line
Zijun Hu <[email protected]>
PATCH v3 1/2 Bluetooth: btnxpuart: Simplify nxp_recv_acl_pkt() by hci_acl_handle()
Simplify nxp_recv_acl_pkt() by using hci_acl_handle() instead of:
__u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); ... (handle & 0x0FFF) ...
--- drivers/bluetooth/btnxpuart.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/bluetooth/btnxpuart.c +1 -3
@@ -1400,20 +1400,18 @@ static int nxp_process_fw_dump(struct hci_dev *hdev, struct sk_buff *skb) free_skb:kfree_skb (skb);return 0 ; }static int nxp_recv_acl_pkt (struct hci_dev *hdev,struct sk_buff *skb) { -__u16 handle =__le16_to_cpu (hci_acl_hdr (skb)->handle); -/* FW dump chunks are ACL packets with conn handle 0xfff */ -if ((handle &0x0FFF ) ==0xFFF ) +if (hci_acl_handle (skb) ==0xFFF )return nxp_process_fw_dump (hdev, skb);else return hci_recv_frame (hdev, skb); }static int nxp_set_bdaddr (struct hci_dev *hdev,const bdaddr_t *bdaddr) {union nxp_set_bd_addr_payload pcmd;
Signature · 1 line
2.34.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/series/1166013/
---Test result---
Test Summary:
CheckPatch PASS 1.08 seconds VerifyFixes PASS 0.08 seconds VerifySignedoff PASS 0.08 seconds GitLint PASS 0.50 seconds SubjectPrefix PASS 0.56 seconds BuildKernel PASS 26.24 seconds CheckAllWarning PASS 31.20 seconds CheckSparse PASS 33.19 seconds BuildKernel32 PASS 26.67 seconds CheckKernelLLVM PASS 30.04 seconds TestRunnerSetup PASS 673.08 seconds IncrementalBuild PASS 26.61 seconds
https://github.com/bluez/bluetooth-next/pull/780
---
Regards,
Linux Bluetooth
PATCH v3 2/2 Bluetooth: btnxpuart: Fix skb leak in nxp_process_fw_dump()
In reply to Zijun HuWhen CONFIG_DEV_COREDUMP=n, hci_devcd_append() returns -EOPNOTSUPP without freeing its skb argument. This leaks the cloned skb and also prevents nxp_set_ind_reset() from being called to perform recovery.
Fix by guarding the hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC)) call with IS_ENABLED(CONFIG_DEV_COREDUMP).
--- drivers/bluetooth/btnxpuart.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/btnxpuart.c +5 -3
@@ -1383,19 +1383,21 @@ static int nxp_process_fw_dump(struct hci_dev *hdev, struct sk_buff *skb) err =hci_devcd_init (hdev,NXP_FW_DUMP_SIZE );if (err <0 ) goto free_skb;schedule_delayed_work (&hdev->dump.dump_timeout,msecs_to_jiffies (20000 )); } - err =hci_devcd_append (hdev,skb_clone (skb,GFP_ATOMIC )); -if (err <0 ) - goto free_skb; +if (IS_ENABLED (CONFIG_DEV_COREDUMP )) { + err =hci_devcd_append (hdev,skb_clone (skb,GFP_ATOMIC )); +if (err <0 ) + goto free_skb; + }if (buf_len ==0 ) {bt_dev_warn (hdev,"==== FW dump complete ===" );hci_devcd_complete (hdev);nxp_set_ind_reset (hdev,NULL ); } free_skb:
Signature · 1 line
2.34.1