From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Udipto Goswami <quic_ugoswami@quicinc.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Pratham Pratap <quic_ppratap@quicinc.com>,
Jack Pham <quic_jackp@quicinc.com>,
linux-usb@vger.kernel.org
Subject: Re: [PATCH v3] usb: dwc3: debugfs: Prevent any register access when devices is runtime suspended
Date: Thu, 16 Mar 2023 12:17:17 +0100 [thread overview]
Message-ID: <ZBL6vT4OzdbfW+ZR@kroah.com> (raw)
In-Reply-To: <20230316065858.12687-1-quic_ugoswami@quicinc.com>
On Thu, Mar 16, 2023 at 12:28:58PM +0530, Udipto Goswami wrote:
> When the dwc3 device is runtime suspended, various required clocks would
> get disabled and it is not guaranteed that access to any registers would
> work. Depending on the SoC glue, a register read could be as benign as
> returning 0 or be fatal enough to hang the system.
>
> In order to prevent such scenarios of fatal errors, bail out of debugfs
> function is dwc3 is suspended.
>
> Signed-off-by: Udipto Goswami <quic_ugoswami@quicinc.com>
> ---
> v3: Replace pr_err to dev_err.
>
> drivers/usb/dwc3/debugfs.c | 60 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c
> index 850df0e6bcab..4a9d0994f3b4 100644
> --- a/drivers/usb/dwc3/debugfs.c
> +++ b/drivers/usb/dwc3/debugfs.c
> @@ -544,6 +544,12 @@ static int dwc3_link_state_show(struct seq_file *s, void *unused)
> u32 reg;
> u8 speed;
>
> + if (pm_runtime_suspended(dwc->dev)) {
> + dev_err(dwc->dev,
> + "Invalid operation, DWC3 suspended!");
> + return -EINVAL;
> + }
What prevents the device from being suspened right after you check this?
thanks,
greg k-h
next prev parent reply other threads:[~2023-03-16 11:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 6:58 [PATCH v3] usb: dwc3: debugfs: Prevent any register access when devices is runtime suspended Udipto Goswami
2023-03-16 11:17 ` Greg Kroah-Hartman [this message]
2023-03-16 11:36 ` Oliver Neukum
2023-03-17 11:56 ` Udipto Goswami
2023-03-30 6:29 ` Udipto Goswami
2023-03-30 9:58 ` Udipto Goswami
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=ZBL6vT4OzdbfW+ZR@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=Thinh.Nguyen@synopsys.com \
--cc=linux-usb@vger.kernel.org \
--cc=quic_jackp@quicinc.com \
--cc=quic_ppratap@quicinc.com \
--cc=quic_ugoswami@quicinc.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.