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:   Mon, 7 Jun 2021 12:19:27 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Kyle Tso <kyletso@...gle.com>
Cc:     linux@...ck-us.net, gregkh@...uxfoundation.org, robh+dt@...nel.org,
        badhri@...gle.com, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH v3 4/4] usb: typec: tcpm: Fix misuses of AMS invocation

On Tue, Jun 01, 2021 at 08:31:51PM +0800, Kyle Tso wrote:
> tcpm_ams_start is used to initiate an AMS as well as checking Collision
> Avoidance conditions but not for flagging passive AMS (initiated by the
> port partner). Fix the misuses of tcpm_ams_start in tcpm_pd_svdm.
> 
> ATTENTION doesn't need responses so the AMS flag is not needed here.
> 
> Fixes: 0bc3ee92880d ("usb: typec: tcpm: Properly interrupt VDM AMS")
> Signed-off-by: Kyle Tso <kyletso@...gle.com>

Acked-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index ebe490949fa0..c4b02a6ca3d7 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1583,7 +1583,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
>  				svdm_version = PD_VDO_SVDM_VER(p[0]);
>  			}
>  
> -			tcpm_ams_start(port, DISCOVER_IDENTITY);
> +			port->ams = DISCOVER_IDENTITY;
>  			/*
>  			 * PD2.0 Spec 6.10.3: respond with NAK as DFP (data host)
>  			 * PD3.1 Spec 6.4.4.2.5.1: respond with NAK if "invalid field" or
> @@ -1604,19 +1604,18 @@ static int tcpm_pd_svdm(struct tcpm_port *port, struct typec_altmode *adev,
>  			}
>  			break;
>  		case CMD_DISCOVER_SVID:
> -			tcpm_ams_start(port, DISCOVER_SVIDS);
> +			port->ams = DISCOVER_SVIDS;
>  			break;
>  		case CMD_DISCOVER_MODES:
> -			tcpm_ams_start(port, DISCOVER_MODES);
> +			port->ams = DISCOVER_MODES;
>  			break;
>  		case CMD_ENTER_MODE:
> -			tcpm_ams_start(port, DFP_TO_UFP_ENTER_MODE);
> +			port->ams = DFP_TO_UFP_ENTER_MODE;
>  			break;
>  		case CMD_EXIT_MODE:
> -			tcpm_ams_start(port, DFP_TO_UFP_EXIT_MODE);
> +			port->ams = DFP_TO_UFP_EXIT_MODE;
>  			break;
>  		case CMD_ATTENTION:
> -			tcpm_ams_start(port, ATTENTION);
>  			/* Attention command does not have response */
>  			*adev_action = ADEV_ATTENTION;
>  			return 0;
> -- 
> 2.32.0.rc0.204.g9fa02ecfa5-goog

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ