From: Johan Hovold <johan@kernel.org>
To: WenTao Liang <vulab@iscas.ac.cn>
Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: xhci: fix refcount leak in xhci_port_bw_show()
Date: Fri, 12 Jun 2026 11:18:22 +0200 [thread overview]
Message-ID: <aivO3rqbF6Mkjoxs@hovoldconsulting.com> (raw)
In-Reply-To: <20260611132120.83185-1-vulab@iscas.ac.cn>
On Thu, Jun 11, 2026 at 09:21:20PM +0800, WenTao Liang wrote:
> If xhci_port_bw_show() calls pm_runtime_get_sync() and it fails with
> a negative return value, the function returns the error directly without
> calling pm_runtime_put_sync(). This leaks the runtime PM usage count,
> preventing the device from ever suspending again.
A failure to resume to the device will generally prevent the device from
ever resuming again in itself.
> pm_runtime_get_sync() unconditionally increments dev->power.usage_count
> before calling rpm_resume(). If rpm_resume() fails, the usage count is
> not decremented — a well-known API pitfall. Add a pm_runtime_put_sync()
You are using pm_runtime_put_noidle() (as you should), not _sync().
> call on the error path to balance the reference.
>
> Cc: stable@vger.kernel.org
> Fixes: 59d50e53e070 ("usb: xhci: Add debugfs support for xHCI port bandwidth")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
Again, how was this issue found?
Also, "refcount" in the summary is a bit misleading as it makes it
sounds like you're fixing a memory leak. Please use something like
"runtime pm (reference) leak" instead.
Johan
prev parent reply other threads:[~2026-06-12 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-11 13:21 [PATCH] usb: xhci: fix refcount leak in xhci_port_bw_show() WenTao Liang
2026-06-12 9:18 ` Johan Hovold [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=aivO3rqbF6Mkjoxs@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=stable@vger.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