lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 18 Nov 2014 10:41:00 -0600
From:	Felipe Balbi <balbi@...com>
To:	Alan Stern <stern@...land.harvard.edu>,
	Mathias Nyman <mathias.nyman@...ux.intel.com>
CC:	Kever Yang <kever.yang@...k-chips.com>,
	Paul Zimmerman <paulz@...opsys.com>,
	Felipe Balbi <balbi@...com>,
	Dinh Nguyen <dinguyen@...nsource.altera.com>,
	<romain.perier@...il.com>, Heiko Stuebner <heiko@...ech.de>,
	<dianders@...omium.org>, <sonnyrao@...omium.org>,
	<addy.ke@...k-chips.com>, <cf@...k-chips.com>,
	<wulf@...k-chips.com>, <huangtao@...k-chips.com>,
	<linux-rockchip@...ts.infradead.org>,
	Roy Li <roy.li@...k-chips.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] usb: dwc2: resume root hub when device detect with
 suspend state

On Tue, Nov 18, 2014 at 11:07:34AM -0500, Alan Stern wrote:
> On Tue, 18 Nov 2014, Kever Yang wrote:
> 
> > After we implement the bus_suspend/resume, auto suspend id enabled.
> > The root hub will be auto suspend if there is no device connected,
> > we need to resume the root hub when a device connect detect.
> > 
> > This patch tested on rk3288.
> > 
> > Signed-off-by: Roy Li <roy.li@...k-chips.com>
> > Signed-off-by: Kever Yang <kever.yang@...k-chips.com>
> > ---
> > 
> > Changes in v2:
> > - add definition for hcd structure
> > - remove check for bus->root_hub
> > 
> >  drivers/usb/dwc2/hcd_intr.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
> > index 551ba87..680206f 100644
> > --- a/drivers/usb/dwc2/hcd_intr.c
> > +++ b/drivers/usb/dwc2/hcd_intr.c
> > @@ -329,6 +329,7 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
> >  {
> >  	u32 hprt0;
> >  	u32 hprt0_modify;
> > +	struct usb_hcd *hcd = (struct usb_hcd *)hsotg->priv;
> >  
> >  	dev_vdbg(hsotg->dev, "--Port Interrupt--\n");
> >  
> > @@ -354,6 +355,10 @@ static void dwc2_port_intr(struct dwc2_hsotg *hsotg)
> >  		hsotg->flags.b.port_connect_status = 1;
> >  		hprt0_modify |= HPRT0_CONNDET;
> >  
> > +		/* resume root hub? */
> > +		if (hcd->state == HC_STATE_SUSPENDED)
> > +			usb_hcd_resume_root_hub(hcd);
> 
> You should be aware that it's not safe to use hcd->state for anything 
> in a host controller driver.  That field is owned by usbcore, not by 
> the HCD, and it is not protected by any locks.
> 
> Thus, for example, hcd->state does not get set to HC_STATE_SUSPENDED
> until some time after the bus_suspend routine has returned.  A
> port-change interrupt might occur during that time interval.

In that case, XHCI has a bug :-) Mathias, care to add it to your TODO
list ?

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ