From: Alan Stern <stern@rowland.harvard.edu>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, wu000273@umn.edu,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Eugeniu Rosca <erosca@de.adit-jv.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
"Lee, Chiasheng" <chiasheng.lee@intel.com>,
David Heinzelmann <heinzelmann.david@gmail.com>,
Hardik Gajjar <hgajjar@de.adit-jv.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: core: fix reference count leak in usb_port_resume
Date: Sun, 14 Jun 2020 09:42:07 -0400 [thread overview]
Message-ID: <20200614134207.GA17297@rowland.harvard.edu> (raw)
In-Reply-To: <20200614033355.129442-1-pakki001@umn.edu>
On Sat, Jun 13, 2020 at 10:33:53PM -0500, Aditya Pakki wrote:
> usb_port_resume() calls pm_runtime_get_sync() that increments
> the reference counter. In case of failure, decrement the reference
> count and return the error.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
> drivers/usb/core/hub.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index b1e14beaac5f..a9231f27144e 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -3542,6 +3542,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
> if (status < 0) {
> dev_dbg(&udev->dev, "can't resume usb port, status %d\n",
> status);
> + pm_runtime_put_sync(&port_dev->dev);
This is wrong; you need to do test_and_clear_bit(port1,
hub->child_usage_bits) before calling pm_runtime_put_sync(). Otherwise
the child_usage_bits value will get out of sync with the port's runtime
status.
Alan Stern
prev parent reply other threads:[~2020-06-14 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-14 3:33 Aditya Pakki
2020-06-14 13:42 ` Alan Stern [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=20200614134207.GA17297@rowland.harvard.edu \
--to=stern@rowland.harvard.edu \
--cc=akpm@linux-foundation.org \
--cc=chiasheng.lee@intel.com \
--cc=erosca@de.adit-jv.com \
--cc=gregkh@linuxfoundation.org \
--cc=heinzelmann.david@gmail.com \
--cc=hgajjar@de.adit-jv.com \
--cc=kai.heng.feng@canonical.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=pakki001@umn.edu \
--cc=wu000273@umn.edu \
/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®