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: <aFpr4ZRczYeLDgsv@kuha.fi.intel.com>
Date: Tue, 24 Jun 2025 12:12:01 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
	Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
	Bjorn Andersson <andersson@...nel.org>,
	Konrad Dybcio <konradybcio@...nel.org>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 4/8] usb: typec: ucsi: yoga-c630: remove extra AltModes
 for port 1

On Sat, Jun 21, 2025 at 09:12:59PM +0300, Dmitry Baryshkov wrote:
> On Lenovo Yoga C630 the EC firmware is buggy and it cat return altmodes
> for a device pushed into the port 0 (right) when the driver asks for
> altmodes for port 1 (left). Since the left Type-C port doesn't support
> DP anyway, ignore all UCSI_GET_ALTERNATE_MODES commands destined to the
> port 1.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@....qualcomm.com>

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

> ---
>  drivers/usb/typec/ucsi/ucsi_yoga_c630.c | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> index 7cc1342d6e2f1d2c6f5b95caa48a711a280b91d3..2005f64ebfe43ca2bcada2231ff99c578fdce877 100644
> --- a/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> +++ b/drivers/usb/typec/ucsi/ucsi_yoga_c630.c
> @@ -71,6 +71,27 @@ static int yoga_c630_ucsi_async_control(struct ucsi *ucsi, u64 command)
>  	return yoga_c630_ec_ucsi_write(uec->ec, (u8*)&command);
>  }
>  
> +static int yoga_c630_ucsi_sync_control(struct ucsi *ucsi,
> +				       u64 command,
> +				       u32 *cci,
> +				       void *data, size_t size)
> +{
> +	/*
> +	 * EC can return AltModes present on CON1 (port0, right) for CON2
> +	 * (port1, left) too. Ignore all requests going to CON2 (it doesn't
> +	 * support DP anyway).
> +	 */
> +	if (UCSI_COMMAND(command) == UCSI_GET_ALTERNATE_MODES &&
> +	    UCSI_GET_ALTMODE_GET_CONNECTOR_NUMBER(command) == 2) {
> +		dev_dbg(ucsi->dev, "ignoring altmodes for con2\n");
> +		memset(data, 0, size);
> +		*cci = UCSI_CCI_COMMAND_COMPLETE;
> +		return 0;
> +	}
> +
> +	return ucsi_sync_control_common(ucsi, command, cci, data, size);
> +}
> +
>  static bool yoga_c630_ucsi_update_altmodes(struct ucsi *ucsi,
>  					   u8 recipient,
>  					   struct ucsi_altmode *orig,
> @@ -98,7 +119,7 @@ static const struct ucsi_operations yoga_c630_ucsi_ops = {
>  	.read_cci = yoga_c630_ucsi_read_cci,
>  	.poll_cci = yoga_c630_ucsi_read_cci,
>  	.read_message_in = yoga_c630_ucsi_read_message_in,
> -	.sync_control = ucsi_sync_control_common,
> +	.sync_control = yoga_c630_ucsi_sync_control,
>  	.async_control = yoga_c630_ucsi_async_control,
>  	.update_altmodes = yoga_c630_ucsi_update_altmodes,
>  };
> 
> -- 
> 2.39.5

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ