* [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer
@ 2026-09-01 21:05 Pauli Virtanen
2026-09-01 23:07 ` [BlueZ,v3] " bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Pauli Virtanen @ 2026-09-01 21:05 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Pauli Virtanen
Add test that does defer accept with ECRED with 2 SCIDs, and
accepts + closes the first before accepting the second. This triggers
deadlock on some kernel versions.
L2CAP Ext-Flowctl Server - Accept 2 Close 1
---
Notes:
v3:
- resend the deadlock test, now that it's fixed in bluetooth-next/master
commit 62df5992 ("Bluetooth: L2CAP: hold conn->lock for __l2cap_ecred_conn_rsp_defer")
v2:
- new test
Lockdep fails to print a splat for this deadlock, since l2cap_sock.c is
mixing lock_sock(sk) == lock_sock(sk, 0) and lock_sock_nested, and the
normal sockets are at nesting level 1...
tools/l2cap-tester.c | 66 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 37b21a88a..f2d3e56b8 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1153,6 +1153,24 @@ static const struct l2cap_data ext_flowctl_server_nval_conn_req_test = {
.mode = BT_MODE_EXT_FLOWCTL,
};
+static const uint8_t ecred_connect_req_2[] = {
+ 0x80, 0x00, /* PSM */
+ 0x40, 0x00, /* MTU */
+ 0x40, 0x00, /* MPS */
+ 0x05, 0x00, /* Credits */
+ 0x41, 0x00, /* SCID #1 */
+ 0x42, 0x00, /* SCID #2 */
+};
+
+static const struct l2cap_data ext_flowctl_server_accept_2_close_1_test = {
+ .server_psm = 0x0080,
+ .defer = true,
+ .mode = BT_MODE_EXT_FLOWCTL,
+ .send_cmd_code = BT_L2CAP_PDU_ECRED_CONN_REQ,
+ .send_cmd = ecred_connect_req_2,
+ .send_cmd_len = ARRAY_SIZE(ecred_connect_req_2)
+};
+
static const struct l2cap_data ext_flowctl_server_phy_test = {
.server_psm = 0x0080,
.send_cmd_code = BT_L2CAP_PDU_ECRED_CONN_REQ,
@@ -3283,6 +3301,50 @@ static void test_server(const void *test_data)
start_test_server(test_data, send_req_new_conn, l2cap_listen_cb);
}
+static gboolean ext_flowctl_accept_2_close_1_listen_cb(GIOChannel *io,
+ GIOCondition cond, gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ int sk, new_sk;
+ int err = 0;
+
+ sk = g_io_channel_unix_get_fd(io);
+
+ new_sk = accept(sk, NULL, NULL);
+ if (err < 0) {
+ tester_warn("accept failed: %s (%u)", strerror(errno), errno);
+ tester_test_failed();
+ return FALSE;
+ }
+
+ if (!defer_accept(data, g_io_channel_unix_new(new_sk), NULL))
+ goto fail;
+
+ close(new_sk);
+
+ if (data->step--)
+ return TRUE;
+
+ tester_test_passed();
+
+ data->io_id = 0;
+ return FALSE;
+
+fail:
+ tester_test_failed();
+ close(new_sk);
+ return FALSE;
+}
+
+static void test_ext_flowctl_server_accept_2_close_1(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+
+ data->step = 1;
+ start_test_server(test_data, send_req_new_conn,
+ ext_flowctl_accept_2_close_1_listen_cb);
+}
+
static gboolean ext_flowctl_nval_conn_req_ready_cb(gpointer ptr)
{
struct test_data *data = tester_get_data();
@@ -3777,6 +3839,10 @@ int main(int argc, char *argv[])
test_l2cap_le("L2CAP Ext-Flowctl Server - Nval SCID",
&ext_flowctl_server_nval_scid_test,
setup_powered_server, test_server);
+ test_l2cap_le("L2CAP Ext-Flowctl Server - Accept 2 Close 1",
+ &ext_flowctl_server_accept_2_close_1_test,
+ setup_powered_server,
+ test_ext_flowctl_server_accept_2_close_1);
test_l2cap_le("L2CAP Ext-Flowctl Server - PHY",
&ext_flowctl_server_phy_test,
setup_powered_server, test_server);
--
2.55.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v3] tools/l2cap-tester: test closing sockets with ECRED defer
2026-09-01 21:05 [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer Pauli Virtanen
@ 2026-09-01 23:07 ` bluez.test.bot
2026-09-16 23:43 ` bluez.test.bot
2026-09-17 17:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-09-01 23:07 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]
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=1155668
---Test result---
Test Summary:
CheckPatch PASS 0.35 seconds
GitLint FAIL 0.22 seconds
BuildEll PASS 15.86 seconds
BluezMake PASS 507.90 seconds
CheckSmatch PASS 229.69 seconds
bluezmakeextell PASS 73.75 seconds
IncrementalBuild PASS 434.74 seconds
ScanBuild PASS 680.79 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v3] tools/l2cap-tester: test closing sockets with ECRED defer
13: B1 Line exceeds max length (92>80): " commit 62df5992 ("Bluetooth: L2CAP: hold conn->lock for __l2cap_ecred_conn_rsp_defer")"
14: B2 Line has trailing whitespace: " "
17: B2 Line has trailing whitespace: " "
https://github.com/bluez/bluez/pull/2468
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [BlueZ,v3] tools/l2cap-tester: test closing sockets with ECRED defer
2026-09-01 21:05 [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer Pauli Virtanen
2026-09-01 23:07 ` [BlueZ,v3] " bluez.test.bot
@ 2026-09-16 23:43 ` bluez.test.bot
2026-09-17 17:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-09-16 23:43 UTC (permalink / raw)
To: linux-bluetooth, pav
[-- Attachment #1: Type: text/plain, Size: 708 bytes --]
This is an automated email and please do not reply to this email.
Dear Submitter,
This series was picked up by the CI more than 2 weeks ago and the pull
request created for it is still open, which means the series was never
applied to the tree.
Series: [BlueZ,v3] tools/l2cap-tester: test closing sockets with ECRED defer
Pull Request: https://github.com/bluez/bluez/pull/2468
Created: 2026-09-01 22:34:21+00:00
The pull request has been closed and no further action is taken on this
series.
If the change should still be considered, it must be resent to the Linux
Bluetooth mailing list (linux-bluetooth@vger.kernel.org) so that it is
picked up again.
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer
2026-09-01 21:05 [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer Pauli Virtanen
2026-09-01 23:07 ` [BlueZ,v3] " bluez.test.bot
2026-09-16 23:43 ` bluez.test.bot
@ 2026-09-17 17:30 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-17 17:30 UTC (permalink / raw)
To: Pauli Virtanen; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Wed, 2 Sep 2026 00:05:06 +0300 you wrote:
> Add test that does defer accept with ECRED with 2 SCIDs, and
> accepts + closes the first before accepting the second. This triggers
> deadlock on some kernel versions.
>
> L2CAP Ext-Flowctl Server - Accept 2 Close 1
> ---
>
> [...]
Here is the summary with links:
- [BlueZ,v3] tools/l2cap-tester: test closing sockets with ECRED defer
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=e9b6ee3808ab
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-17 17:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 21:05 [PATCH BlueZ v3] tools/l2cap-tester: test closing sockets with ECRED defer Pauli Virtanen
2026-09-01 23:07 ` [BlueZ,v3] " bluez.test.bot
2026-09-16 23:43 ` bluez.test.bot
2026-09-17 17:30 ` [PATCH BlueZ v3] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox