2023-05-20 06:01:09

by Yongxin Liu

[permalink] [raw]
Subject: [PATCH] Bluetooth: add missing hci_codec_list_clear() back

hci_codec_list_clear() was missing in commit d0b137062b2d
("Bluetooth: hci_sync: Rework init stages"). Without it, there
are following kernel memory leaks.

unreferenced object 0xffff9fe454c12ca0 (size 32):
comm "kworker/u9:0", pid 82, jiffies 4294756186 (age 75.617s)
hex dump (first 32 bytes):
a8 93 7b 76 e4 9f ff ff e0 2d c1 54 e4 9f ff ff ..{v.....-.T....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff9add1386>] __kmem_cache_alloc_node+0x1e6/0x3d0
[<ffffffff9ad47ea1>] __kmalloc+0x51/0x1a0
[<ffffffff9bd01025>] hci_codec_list_add.isra.0+0x35/0xc0
[<ffffffff9bd011e7>] hci_read_codec_capabilities+0x127/0x1f0
[<ffffffff9bd01465>] hci_read_supported_codecs+0x115/0x1e0
[<ffffffff9bd02658>] hci_read_local_codecs_sync+0x28/0x40
[<ffffffff9bd06f5f>] hci_init_sync+0x14f/0x360
[<ffffffff9bd096b8>] hci_dev_init_sync+0xf8/0x180
[<ffffffff9bd0b67a>] hci_dev_open_sync+0x8a/0x2e0
[<ffffffff9bcadbc0>] hci_power_on+0x60/0x220
[<ffffffff9aad0a37>] process_one_work+0x257/0x580
[<ffffffff9aad0dc8>] worker_thread+0x58/0x3c0
[<ffffffff9aadb97b>] kthread+0x10b/0x140
[<ffffffff9aa023f9>] ret_from_fork+0x29/0x50

Fixes: d0b137062b2d ("Bluetooth: hci_sync: Rework init stages")
Signed-off-by: Yongxin Liu <[email protected]>
---
net/bluetooth/hci_sync.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 647a8ce54062..e94a5648e08a 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4994,6 +4994,7 @@ int hci_dev_close_sync(struct hci_dev *hdev)
memset(hdev->eir, 0, sizeof(hdev->eir));
memset(hdev->dev_class, 0, sizeof(hdev->dev_class));
bacpy(&hdev->random_addr, BDADDR_ANY);
+ hci_codec_list_clear(&hdev->local_codecs);

hci_dev_put(hdev);
return err;
--
2.39.2



2023-05-20 06:39:05

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: add missing hci_codec_list_clear() back

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

---Test result---

Test Summary:
CheckPatch PASS 1.30 seconds
GitLint PASS 1.19 seconds
SubjectPrefix PASS 0.11 seconds
BuildKernel PASS 31.82 seconds
CheckAllWarning PASS 34.70 seconds
CheckSparse PASS 39.90 seconds
CheckSmatch PASS 108.26 seconds
BuildKernel32 PASS 30.79 seconds
TestRunnerSetup PASS 441.08 seconds
TestRunner_l2cap-tester PASS 16.93 seconds
TestRunner_iso-tester PASS 21.39 seconds
TestRunner_bnep-tester PASS 5.63 seconds
TestRunner_mgmt-tester PASS 116.58 seconds
TestRunner_rfcomm-tester PASS 8.91 seconds
TestRunner_sco-tester PASS 8.26 seconds
TestRunner_ioctl-tester PASS 9.76 seconds
TestRunner_mesh-tester PASS 7.09 seconds
TestRunner_smp-tester PASS 8.20 seconds
TestRunner_userchan-tester PASS 5.88 seconds
IncrementalBuild PASS 29.15 seconds



---
Regards,
Linux Bluetooth