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]
Message-ID: <CAFv23Qn9h=pwaHkiMB2ci-OaR54gY6fdc1Q_7ZMz5mH7wHr9+w@mail.gmail.com>
Date:   Mon, 23 Dec 2019 12:29:37 +0800
From:   AceLan Kao <acelan.kao@...onical.com>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        Harry Pan <harry.pan@...el.com>,
        David Heinzelmann <heinzelmann.david@...il.com>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
        Mathieu Malaterre <malat@...ian.org>,
        linux-usb@...r.kernel.org,
        "Linux-Kernel@...r. Kernel. Org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: hub: move resume delay at the head of all USB access functions

Alan Stern <stern@...land.harvard.edu> 於 2019年12月20日 週五 下午11:48寫道:
>
> On Fri, 20 Dec 2019, AceLan Kao wrote:
>
> > usb_control_msg() function should be called after the resume delay, or
>
> Which usb_control_msg() call are you referring to?  Is it the call
> under hub_port_status()?
usb_port_resume() -> hub_port_status() -> hub_ext_port_status()
-> get_port_status() -> usb_control_msg()

>
> > you'll encounter the below errors sometime.
> > After the issue happens, have to re-plug the USB cable to recover.
> >
> > [ 837.483573] hub 2-3:1.0: hub_ext_port_status failed (err = -71)
> > [ 837.490889] hub 2-3:1.0: hub_ext_port_status failed (err = -71)
> > [ 837.506780] usb 2-3-port4: cannot disable (err = -71)
>
> You need to do a better job of figuring out why these errors occur.  It
> is not connected to the resume delay; there must be a different reason.
> Hint: This is the sort of error you would expect to see if the kernel
> tried to resume a device while its parent hub was still suspended.
Once this error shows, the USB port doesn't work until re-plug the cable.
I have no idea what else I can do to this, do you have any idea that I
could try?
Thanks.

>
> > Signed-off-by: AceLan Kao <acelan.kao@...onical.com>
> > ---
> >  drivers/usb/core/hub.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> > index f229ad6952c0..2fb2816b0d38 100644
> > --- a/drivers/usb/core/hub.c
> > +++ b/drivers/usb/core/hub.c
> > @@ -3522,6 +3522,7 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
> >               }
> >       }
> >
> > +     msleep(USB_RESUME_TIMEOUT);
>
> This makes no sense at all.  At this point we haven't even started to
> do the resume signalling, so there's no reason to wait for it to
> finish.
I thought the h/w need some time to be back to stable status when resuming.
>
> >       usb_lock_port(port_dev);
> >
> >       /* Skip the initial Clear-Suspend step for a remote wakeup */
> > @@ -3544,7 +3545,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)
> >               /* drive resume for USB_RESUME_TIMEOUT msec */
> >               dev_dbg(&udev->dev, "usb %sresume\n",
> >                               (PMSG_IS_AUTO(msg) ? "auto-" : ""));
> > -             msleep(USB_RESUME_TIMEOUT);
>
> This is wrong also.  At this point the resume signal _is_ being sent,
> and the USB spec requires that we wait a minimum amount of time for the
> device to fully resume.
I don't see the difference that after the delay, it calls hub_port_status(), but
in the beginning of usb_port_resume() it call the same function, too.
So, I think it should be good to move the delay before the first
hub_port_status()
>
> Alan Stern
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ