Message ID | 20250207140216.3076952-1-lizhi.xu@windriver.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [next] Bluetooth: l2cap: protect conn refcnt under hci dev lock | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/SubjectPrefix | success | Gitlint PASS |
tedd_an/BuildKernel | success | BuildKernel PASS |
tedd_an/CheckAllWarning | warning | CheckSparse WARNING net/bluetooth/l2cap_core.c:7477:27: warning: ‘l2cap_conn_hold_unless_zero’ defined but not used [-Wunused-function] 7477 | static struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ |
tedd_an/CheckSparse | warning | CheckSparse WARNING net/bluetooth/l2cap_core.c:7477:27: warning: ‘l2cap_conn_hold_unless_zero’ defined but not used [-Wunused-function] |
tedd_an/BuildKernel32 | success | BuildKernel32 PASS |
tedd_an/TestRunnerSetup | success | TestRunnerSetup PASS |
tedd_an/TestRunner_l2cap-tester | success | TestRunner PASS |
tedd_an/TestRunner_iso-tester | success | TestRunner PASS |
tedd_an/TestRunner_bnep-tester | success | TestRunner PASS |
tedd_an/TestRunner_mgmt-tester | fail | TestRunner_mgmt-tester: Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4 |
tedd_an/TestRunner_rfcomm-tester | success | TestRunner PASS |
tedd_an/TestRunner_sco-tester | success | TestRunner PASS |
tedd_an/TestRunner_ioctl-tester | success | TestRunner PASS |
tedd_an/TestRunner_mesh-tester | success | TestRunner PASS |
tedd_an/TestRunner_smp-tester | success | TestRunner PASS |
tedd_an/TestRunner_userchan-tester | success | TestRunner PASS |
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=931610 ---Test result--- Test Summary: CheckPatch PENDING 0.37 seconds GitLint PENDING 0.22 seconds SubjectPrefix PASS 0.33 seconds BuildKernel PASS 24.43 seconds CheckAllWarning WARNING 28.01 seconds CheckSparse WARNING 30.70 seconds BuildKernel32 PASS 24.50 seconds TestRunnerSetup PASS 436.27 seconds TestRunner_l2cap-tester PASS 20.35 seconds TestRunner_iso-tester PASS 35.50 seconds TestRunner_bnep-tester PASS 4.81 seconds TestRunner_mgmt-tester FAIL 120.67 seconds TestRunner_rfcomm-tester PASS 7.95 seconds TestRunner_sco-tester PASS 9.82 seconds TestRunner_ioctl-tester PASS 8.15 seconds TestRunner_mesh-tester PASS 6.87 seconds TestRunner_smp-tester PASS 7.01 seconds TestRunner_userchan-tester PASS 5.02 seconds IncrementalBuild PENDING 0.72 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: CheckAllWarning - WARNING Desc: Run linux kernel with all warning enabled Output: net/bluetooth/l2cap_core.c:7477:27: warning: ‘l2cap_conn_hold_unless_zero’ defined but not used [-Wunused-function] 7477 | static struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ############################## Test: CheckSparse - WARNING Desc: Run sparse tool with linux kernel Output: net/bluetooth/l2cap_core.c:7477:27: warning: ‘l2cap_conn_hold_unless_zero’ defined but not used [-Wunused-function] ############################## 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 - Set Flags 3 (2 Devices to RL) Failed 0.194 seconds LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.142 seconds ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
Hi Lizhi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20250207]
url: https://github.com/intel-lab-lkp/linux/commits/Lizhi-Xu/Bluetooth-l2cap-protect-conn-refcnt-under-hci-dev-lock/20250207-221142
base: next-20250207
patch link: https://lore.kernel.org/r/20250207140216.3076952-1-lizhi.xu%40windriver.com
patch subject: [PATCH next] Bluetooth: l2cap: protect conn refcnt under hci dev lock
config: i386-buildonly-randconfig-001-20250208 (https://download.01.org/0day-ci/archive/20250208/202502081633.z7O9VFNy-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250208/202502081633.z7O9VFNy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502081633.z7O9VFNy-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/bluetooth/l2cap_core.c:7477:27: warning: 'l2cap_conn_hold_unless_zero' defined but not used [-Wunused-function]
7477 | static struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/l2cap_conn_hold_unless_zero +7477 net/bluetooth/l2cap_core.c
4d7ea8ee90e42f Luiz Augusto von Dentz 2021-01-13 7476
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 @7477 static struct l2cap_conn *l2cap_conn_hold_unless_zero(struct l2cap_conn *c)
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7478 {
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7479 BT_DBG("conn %p orig refcnt %u", c, kref_read(&c->ref));
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7480
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7481 if (!kref_get_unless_zero(&c->ref))
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7482 return NULL;
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7483
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7484 return c;
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7485 }
6ab54a71718943 Luiz Augusto von Dentz 2025-01-16 7486
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index adb8c33ac595..503626f70be5 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -7497,8 +7497,6 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) if (!conn) conn = l2cap_conn_add(hcon); - conn = l2cap_conn_hold_unless_zero(conn); - hci_dev_unlock(hcon->hdev); if (!conn) @@ -7592,8 +7590,6 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags) break; } - l2cap_conn_put(conn); - drop: kfree_skb(skb); } diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index 46ea0bee2259..2a99394925a5 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c @@ -1359,10 +1359,12 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) l2cap_chan_lock(chan); conn = chan->conn; - if (conn) + l2cap_chan_unlock(chan); + if (conn) { + hci_dev_lock(conn->hcon->hdev); /* prevent conn structure from being freed */ l2cap_conn_get(conn); - l2cap_chan_unlock(chan); + } if (conn) /* mutex lock must be taken before l2cap_chan_lock() */ @@ -1375,6 +1377,7 @@ static int l2cap_sock_shutdown(struct socket *sock, int how) if (conn) { mutex_unlock(&conn->chan_lock); l2cap_conn_put(conn); + hci_dev_unlock(conn->hcon->hdev); } lock_sock(sk);