]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Bluetooth: hci_conn: use mod_delayed_work for active mode timeout
authorStefan Sørensen <ssorensen@roku.com>
Tue, 16 Dec 2025 09:20:09 +0000 (10:20 +0100)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 29 Jan 2026 18:23:26 +0000 (13:23 -0500)
hci_conn_enter_active_mode() uses queue_delayed_work() with the
intention that the work will run after the given timeout. However,
queue_delayed_work() does nothing if the work is already queued, so
depending on the link policy we may end up putting the connection
into idle mode every hdev->idle_timeout ms.

Use mod_delayed_work() instead so the work is queued if not already
queued, and the timeout is updated otherwise.

Signed-off-by: Stefan Sørensen <ssorensen@roku.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/hci_conn.c

index 5a4374ccf8e8405c65a4ecd0edb614c76b235752..1b98b646748545a101a8bf9abf5b17adaa4843cb 100644 (file)
@@ -2619,8 +2619,8 @@ void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active)
 
 timer:
        if (hdev->idle_timeout > 0)
-               queue_delayed_work(hdev->workqueue, &conn->idle_work,
-                                  msecs_to_jiffies(hdev->idle_timeout));
+               mod_delayed_work(hdev->workqueue, &conn->idle_work,
+                                msecs_to_jiffies(hdev->idle_timeout));
 }
 
 /* Drop all connection on the device */