From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: xhci: tegra: Prevent error pointer dereference
Date: Wed, 20 Feb 2019 17:31:47 +0100 [thread overview]
Message-ID: <20190220163147.GA3272@kroah.com> (raw)
On Wed, Feb 20, 2019 at 05:27:02PM +0100, Thierry Reding wrote:
> On Wed, Feb 20, 2019 at 05:16:12PM +0100, Greg Kroah-Hartman wrote:
> > On Wed, Feb 20, 2019 at 02:48:41PM +0100, Thierry Reding wrote:
> > > From: Thierry Reding <treding@nvidia.com>
> > >
> > > During initialization, the host and super-speed power domains will
> > > contain an ERR_PTR() encoded error code rather than being NULL. To
> > > avoid a crash, use a !IS_ERR_OR_NULL() condition during cleanup.
> > >
> > > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > > ---
> > > drivers/usb/host/xhci-tegra.c | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
> > > index 938ff06c0349..efb0cad8710e 100644
> > > --- a/drivers/usb/host/xhci-tegra.c
> > > +++ b/drivers/usb/host/xhci-tegra.c
> > > @@ -941,9 +941,9 @@ static void tegra_xusb_powerdomain_remove(struct device *dev,
> > > device_link_del(tegra->genpd_dl_ss);
> > > if (tegra->genpd_dl_host)
> > > device_link_del(tegra->genpd_dl_host);
> > > - if (tegra->genpd_dev_ss)
> > > + if (!IS_ERR_OR_NULL(tegra->genpd_dev_ss))
> > > dev_pm_domain_detach(tegra->genpd_dev_ss, true);
> > > - if (tegra->genpd_dev_host)
> > > + if (!IS_ERR_OR_NULL(tegra->genpd_dev_host))
> > > dev_pm_domain_detach(tegra->genpd_dev_host, true);
> > > }
> >
> > Should this go to older kernels? If so, any hint as to what commit this
> > "fixes:"?
>
> Technically this:
>
> Fixes: 6494a9ad86de ("usb: xhci: tegra: Add genpd support")
>
> which was merged into v4.20.
>
> However, I have never seen this actually crash on current kernels and
> only came across it while working on a change to reset controls which
> can cause dev_pm_domain_attach_by_name() to fail. That function can't
> fail in current kernels, so I don't think we need to fix this in old
> kernels. So if we can get this into v5.0, that'd be good enough for
> me.
5.0-final is too late, but 5.0.y is doable.
Mathias, want me to take this directly?
thanks,
greg k-h
next reply other threads:[~2019-02-20 16:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 16:31 Greg Kroah-Hartman [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-02-20 16:36 xhci: tegra: Prevent error pointer dereference Mathias Nyman
2019-02-20 16:27 Thierry Reding
2019-02-20 16:16 Greg Kroah-Hartman
2019-02-20 14:41 Jon Hunter
2019-02-20 13:48 Thierry Reding
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=20190220163147.GA3272@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=thierry.reding@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).