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] [day] [month] [year] [list]
Date:   Wed, 20 Mar 2019 15:55:02 +0200
From:   Mathias Nyman <mathias.nyman@...ux.intel.com>
To:     Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
        Oliver Neukum <oneukum@...e.com>,
        Mathias Nyman <mathias.nyman@...el.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [RFC] xhci: clear port_remote_wakeup on device disconnection

On 19.3.2019 16.54, Nicolas Saenz Julienne wrote:
> Hi Oliver, thanks for the review!
> 
> On Tue, 2019-03-19 at 12:01 +0100, Oliver Neukum wrote:
>> On Mo, 2019-03-18 at 18:00 +0100, Nicolas Saenz Julienne wrote:
>>> This patch clears "port_remote_wakeup" upon detecting a device
>>> disconnection. Making sure the above mentioned situation doesn't trigger
>>> a PM busyloop.
>>
>> Hi,
>>
>> that is an interesting race condition.
>>

Turns out that port_remote_wakeup was only properly cleared in case of a
successful resume where port stays in U0, or in case of an error where port
goes to inactive state.

In all other cases port_remote_wakeup bit was left uncleared.

>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@...e.de>
>>> ---
>>>   drivers/usb/host/xhci-hub.c | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
>>> index e2eece693655..bea853f45aec 100644
>>> --- a/drivers/usb/host/xhci-hub.c
>>> +++ b/drivers/usb/host/xhci-hub.c
>>> @@ -942,6 +942,9 @@ static void xhci_get_usb3_port_status(struct xhci_port
>>> *port, u32 *status,
>>>   			bus_state->suspended_ports &= ~(1 << portnum);
>>>   	}
>>>   
>>> +	if (!(portsc & PORT_CONNECT))
>>> +		bus_state->port_remote_wakeup &= ~(1 << portnum);
>>> +

A check like this should cover the failing resume cases, thanks

We also saw a case when a successful resume was missed as port went into U1
Link power save state (resume->U0->U1) before xhci driver read the port status.

A patch adding U1 and U2 to successful resume states is pending in my for-usb-linus
branch for this.

>>
>> Why are you putting that logic into xhci_get_usb3_port_status()?
>> It looks to me like there is already something related in the caller
> 
> You're right, xhci_get_usb3_port_status() is not the ideal spot I'll move the
> code there.
> 

Sounds good, thanks

-Mathias

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ