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: <20190128170733.GK18982@uda0271908>
Date:   Mon, 28 Jan 2019 11:07:33 -0600
From:   Bin Liu <b-liu@...com>
To:     Sasha Levin <sashal@...nel.org>
CC:     <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-usb@...r.kernel.org>
Subject: Re: [PATCH AUTOSEL 4.19 176/258] usb: musb: dsps: fix otg state
 machine

Hi Sasha,

On Mon, Jan 28, 2019 at 10:58:02AM -0500, Sasha Levin wrote:
> From: Bin Liu <b-liu@...com>
> 
> [ Upstream commit 6010abf2c2c0e382d7e8ee44bd11f343aae90cce ]
> 
> Due to lack of ID pin interrupt event on AM335x devices, the musb dsps
> driver uses polling to detect usb device attach for dual-role port.
> 
> But in the case if a micro-A cable adapter is attached without a USB device
> attached to the cable, the musb state machine gets stuck in a_wait_vrise
> state waiting for the MUSB_CONNECT interrupt which won't happen due to the
> usb device is not attached. The state is stuck in a_wait_vrise even after
> the micro-A cable is detached, which could cause VBUS retention if then the
> dual-role port is attached to a host port.
> 
> To fix the problem, make a_wait_vrise as a transient state, then move the
> state to either a_wait_bcon for host port or a_idle state for dual-role
> port, if no usb device is attached to the port.
> 
> Signed-off-by: Bin Liu <b-liu@...com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
>  drivers/usb/musb/musb_dsps.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
> index 23a0df79ef21..1e6d78b1334e 100644
> --- a/drivers/usb/musb/musb_dsps.c
> +++ b/drivers/usb/musb/musb_dsps.c
> @@ -227,8 +227,13 @@ static int dsps_check_status(struct musb *musb, void *unused)
>  
>  	switch (musb->xceiv->otg->state) {
>  	case OTG_STATE_A_WAIT_VRISE:
> -		dsps_mod_timer_optional(glue);
> -		break;
> +		if (musb->port_mode == MUSB_HOST) {
> +			musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
> +			dsps_mod_timer_optional(glue);
> +			break;
> +		}
> +		/* fall through */
> +
>  	case OTG_STATE_A_WAIT_BCON:
>  		/* keep VBUS on for host-only mode */
>  		if (musb->port_mode == MUSB_HOST) {

This backport won't apply to stables cleanly. I have sent the manual
backport [1] for v4.9+ a few weeks ago.

[1] https://marc.info/?l=linux-usb&m=154696800204159&w=2

Regards,
-Bin,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ