From: David Medina via B4 Relay <devnull+b2amedina.gmail.com@kernel.org>
To: Andreas Noever <andreas.noever@gmail.com>,
Mika Westerberg <westeri@kernel.org>,
Yehezkel Bernat <YehezkelShB@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, David Medina <b2amedina@gmail.com>
Subject: [PATCH] thunderbolt: Fix domain reference leak on DPRX work cancel
Date: Wed, 30 Sep 2026 22:16:35 -0400 [thread overview]
Message-ID: <20260930-tb-dprx-fix-v1-1-da92659e491a@gmail.com> (raw)
From: David Medina <b2amedina@gmail.com>
tb_dp_dprx_start() takes an additional reference to the domain with
tb_domain_get() and passes it as callback_data to tb_tunnel_alloc_dp().
That reference is only released by the callback, tb_dp_tunnel_active(),
which tb_dp_dprx_work() invokes once the DPRX capabilities read completes
or times out.
If the tunnel is deactivated before the DPRX work runs to completion,
tb_dp_dprx_stop() cancels the still pending work. The callback is then
never called and the domain reference held in callback_data leaks. The
domain's reference count never reaches zero, so tb_domain_release() never
runs and a subsequent shutdown/reboot hangs waiting for the domain to be
released.
Release the callback_data domain reference in tb_dp_dprx_stop() when the
DPRX work is canceled, mirroring the release done by the callback.
Fixes: d6d458d42e1e ("thunderbolt: Handle DisplayPort tunnel activation asynchronously")
Cc: stable@vger.kernel.org
Signed-off-by: David Medina <b2amedina@gmail.com>
---
drivers/thunderbolt/tunnel.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 7e8284575dff..971e9a5f8c5c 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -1139,8 +1139,18 @@ static void tb_dp_dprx_stop(struct tb_tunnel *tunnel)
if (tunnel->dprx_started) {
tunnel->dprx_started = false;
tunnel->dprx_canceled = true;
- if (cancel_delayed_work(&tunnel->dprx_work))
+ if (cancel_delayed_work(&tunnel->dprx_work)) {
+ /*
+ * The DPRX work was canceled before it ran to
+ * completion, so the callback (tb_dp_tunnel_active)
+ * never got a chance to release the domain reference
+ * passed in callback_data. Release it here to keep the
+ * reference balanced.
+ */
+ if (tunnel->callback_data)
+ tb_domain_put(tunnel->callback_data);
tb_tunnel_put(tunnel);
+ }
}
}
---
base-commit: 551c722f40809618230001baccf219193e22fc5a
change-id: 20260930-tb-dprx-fix-9c05d3b88476
Best regards,
--
David Medina <b2amedina@gmail.com>
next reply other threads:[~2026-10-01 2:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 2:16 David Medina via B4 Relay [this message]
2026-10-01 3:48 ` Mika Westerberg
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=20260930-tb-dprx-fix-v1-1-da92659e491a@gmail.com \
--to=devnull+b2amedina.gmail.com@kernel.org \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=b2amedina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=westeri@kernel.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
all inboxes | Powered by JetHome®