Skip to contentSkip to conversation

Bluetooth: hci_conn: Use disable_delayed_work_sync

PATCH Applied Luiz Augusto von Dentz 3 participants 4 messages Oct 1, 2024

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: hci_conn: Use disable_delayed_work_sync

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

---
 net/bluetooth/hci_conn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index 0c01ece500a9..fb0946eac8a4 100644
@@ -1124,9 +1124,9 @@ void hci_conn_del(struct hci_conn *conn)
 
 	hci_conn_unlink(conn);
 
-	cancel_delayed_work_sync(&conn->disc_work);
-	cancel_delayed_work_sync(&conn->auto_accept_work);
-	cancel_delayed_work_sync(&conn->idle_work);
+	disable_delayed_work_sync(&conn->disc_work);
+	disable_delayed_work_sync(&conn->auto_accept_work);
+	disable_delayed_work_sync(&conn->idle_work);
 
 	if (conn->type == ACL_LINK) {
 		/* Unacked frames */
Signature · 1 line
2.46.1
author maintainer
#1 lore raw
Quoted 33 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

---
 net/bluetooth/hci_conn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -4
index 0c01ece500a9..fb0946eac8a4 100644
@@ -1124,9 +1124,9 @@ void hci_conn_del(struct hci_conn *conn)
 
        hci_conn_unlink(conn);
 
-       cancel_delayed_work_sync(&conn->disc_work);
-       cancel_delayed_work_sync(&conn->auto_accept_work);
-       cancel_delayed_work_sync(&conn->idle_work);
+       disable_delayed_work_sync(&conn->disc_work);
+       disable_delayed_work_sync(&conn->auto_accept_work);
+       disable_delayed_work_sync(&conn->idle_work);
 
        if (conn->type == ACL_LINK) {
                /* Unacked frames */
--
Quoted 2 lines

2.46.1

#syz test

Signature · 1 line
Luiz Augusto von Dentz

From db0befd94b95e2607b950b09707a422622e27f59 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <[email protected]>
Date: Tue, 1 Oct 2024 12:34:06 -0400
Subject: [PATCH v1] Bluetooth: hci_conn: Use disable_delayed_work_sync

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

---
 net/bluetooth/hci_conn.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/bluetooth/hci_conn.c +3 -3
index 0c01ece500a9..fb0946eac8a4 100644
@@ -1124,9 +1124,9 @@ void hci_conn_del(struct hci_conn *conn)
 
 	hci_conn_unlink(conn);
 
-	cancel_delayed_work_sync(&conn->disc_work);
-	cancel_delayed_work_sync(&conn->auto_accept_work);
-	cancel_delayed_work_sync(&conn->idle_work);
+	disable_delayed_work_sync(&conn->disc_work);
+	disable_delayed_work_sync(&conn->auto_accept_work);
+	disable_delayed_work_sync(&conn->idle_work);
 
 	if (conn->type == ACL_LINK) {
 		/* Unacked frames */
Signature · 1 line
2.46.1
syzbot Tested-by
#2 lore raw

Re: [syzbot] [bluetooth?] WARNING in hci_conn_timeout

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Tested on:

commit:         e32cde8d Merge tag 'sched_ext-for-6.12-rc1-fixes-1' of..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14d28927980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=3fccdad3e2ebaa0c
dashboard link: https://syzkaller.appspot.com/bug?extid=2446dd3cb07277388db6
compiler:       gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14060307980000

Note: testing is done by a robot and is best-effort only.

#3 lore raw
In reply to Luiz Augusto von Dentz
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 1 Oct 2024 12:50:55 -0400 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This makes use of disable_delayed_work_sync instead cancel_delayed_work_sync as it not only cancel the ongoing work but also disables new submit which is disarable since the object holding the work is about to be freed.

[...]

Here is the summary with links:
- [v1] Bluetooth: hci_conn: Use disable_delayed_work_sync

    https://git.kernel.org/bluetooth/bluetooth-next/c/6774cca543da

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html