From: Peter Chen <peter.chen@kernel.org>
To: WenTao Liang <vulab@iscas.ac.cn>
Cc: gregkh@linuxfoundation.org, thierry.reding@kernel.org,
jonathanh@nvidia.com, linux-usb@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: chipidea: tegra: fix refcount leak in tegra_usb_reset_controller()
Date: Fri, 26 Jun 2026 09:23:47 +0800 [thread overview]
Message-ID: <aj3Uo2P0LJp1KSPZ@QCOM-gEdNzOMOFu.na.qualcomm.com> (raw)
In-Reply-To: <20260611124940.80010-1-vulab@iscas.ac.cn>
On 26-06-11 20:49:40, WenTao Liang wrote:
> In tegra_usb_reset_controller(), reset_control_deassert() is called on
> a shared reset control to increment its deassert_count before toggling
> the reset line. If the subsequent reset_control_assert() call fails
> (e.g. due to a missing reset controller device or an invalid internal
> state), the function returns an error without ever balancing the prior
> deassert. Since the reset control is shared, the leaked deassert_count
> remains elevated, preventing future reset_control_assert() calls from
> taking effect on the reset line and leaving the USB controller in an
> inconsistent state.
>
> Fix the leak by calling reset_control_deassert() in the error path of
> reset_control_assert(), ensuring the usage counter is properly balanced
> before returning the error.
>
> Cc: stable@vger.kernel.org
> Fixes: fc53d5279094 ("usb: chipidea: tegra: Support host mode")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
> ---
> drivers/usb/chipidea/ci_hdrc_tegra.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/chipidea/ci_hdrc_tegra.c b/drivers/usb/chipidea/ci_hdrc_tegra.c
> index 372788f0f970..8d313345665c 100644
> --- a/drivers/usb/chipidea/ci_hdrc_tegra.c
> +++ b/drivers/usb/chipidea/ci_hdrc_tegra.c
> @@ -138,8 +138,10 @@ static int tegra_usb_reset_controller(struct device *dev)
> return err;
>
> err = reset_control_assert(rst);
> - if (err)
> + if (err) {
> + reset_control_deassert(rst);
Could not understand why doing that, there is already a reset_control_deassert
calling before that.
--
Thanks,
Peter Chen
prev parent reply other threads:[~2026-06-26 1:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 12:49 [PATCH] usb: chipidea: tegra: fix refcount leak in tegra_usb_reset_controller() WenTao Liang
2026-06-26 1:23 ` Peter Chen [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=aj3Uo2P0LJp1KSPZ@QCOM-gEdNzOMOFu.na.qualcomm.com \
--to=peter.chen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=thierry.reding@kernel.org \
--cc=vulab@iscas.ac.cn \
/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