public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Dudu Lu <phx0fer@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com, Dudu Lu <phx0fer@gmail.com>
Subject: [PATCH] Bluetooth: hci_conn: Use disable_delayed_work_sync for le_conn_timeout
Date: Mon, 13 Apr 2026 16:54:55 +0800	[thread overview]
Message-ID: <20260413085455.74585-1-phx0fer@gmail.com> (raw)

In hci_conn_del(), the LE_LINK case cancels le_conn_timeout using
cancel_delayed_work(), which is non-synchronous. This means the timeout
handler could still be running after the connection is freed, leading to
a use-after-free.

The other three delayed works in the same function (disc_work,
auto_accept_work, idle_work) already use disable_delayed_work_sync().
Change le_conn_timeout to use disable_delayed_work_sync() as well for
consistency and correctness.

Signed-off-by: Dudu Lu <phx0fer@gmail.com>
---
 net/bluetooth/hci_conn.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index e6393f17576b..6e96a8aeebd3 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1201,7 +1201,7 @@ void hci_conn_del(struct hci_conn *conn)
 			hdev->acl_cnt += conn->sent;
 		break;
 	case LE_LINK:
-		cancel_delayed_work(&conn->le_conn_timeout);
+		disable_delayed_work_sync(&conn->le_conn_timeout);
 
 		if (hdev->le_pkts) {
 			if (!hci_conn_num(hdev, LE_LINK) ||
-- 
2.39.3 (Apple Git-145)


             reply	other threads:[~2026-04-13  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13  8:54 Dudu Lu [this message]
2026-04-13  9:40 ` Bluetooth: hci_conn: Use disable_delayed_work_sync for le_conn_timeout bluez.test.bot
2026-04-13 16:56 ` [PATCH] " Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260413085455.74585-1-phx0fer@gmail.com \
    --to=phx0fer@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox