From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: WenTao Liang <vulab@iscas.ac.cn>
Cc: andreas.noever@gmail.com, westeri@kernel.org,
YehezkelShB@gmail.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] fix: drivers/thunderbolt: tb_tunnel_pci: missing tb_tunnel_put on success path
Date: Mon, 27 Jul 2026 12:19:09 +0200 [thread overview]
Message-ID: <20260727101909.GC2365036@black.igk.intel.com> (raw)
In-Reply-To: <20260627024640.57118-1-vulab@iscas.ac.cn>
Your $subject is not following the conventions. Look at the existing
commits in given subsystem to see how they should look like. Here we like
"thunderbolt: ...".
On Sat, Jun 27, 2026 at 10:46:40AM +0800, WenTao Liang wrote:
> In tb_tunnel_pci(), tb_tunnel_alloc_pci() allocates a tunnel with kref
> initialized to 1. On the success path, the tunnel is added to the tunnel
> list via list_add_tail() but tb_tunnel_put() is never called to release
> the initial reference. On the error path (tb_tunnel_activate failure),
> tb_tunnel_put() is correctly called.
>
> Add tb_tunnel_put(tunnel) after list_add_tail() on the success path.
>
> Cc: stable@vger.kernel.org
> Fixes: 99cabbb006f1 ("thunderbolt: Add support for full PCIe daisy chains")
This is wrong commit.
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> drivers/thunderbolt/tb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index c69c323e6952..57c9839b133f 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -2313,6 +2313,7 @@ static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw)
> tb_sw_warn(sw, "failed to connect xHCI\n");
>
> list_add_tail(&tunnel->list, &tcm->tunnel_list);
> + tb_tunnel_put(tunnel);
This will release the tunnel once it is in the list e.g causing
use-after-free later.
> return 0;
> }
>
> --
> 2.39.5 (Apple Git-154)
prev parent reply other threads:[~2026-07-27 10:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-27 2:46 WenTao Liang
2026-07-27 10:19 ` Mika Westerberg [this message]
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=20260727101909.GC2365036@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=YehezkelShB@gmail.com \
--cc=andreas.noever@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
--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®