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: <ZnoUS1kOL3aYar-Q@google.com>
Date: Tue, 25 Jun 2024 00:50:19 +0000
From: Benson Leung <bleung@...gle.com>
To: Jameson Thies <jthies@...gle.com>
Cc: heikki.krogerus@...ux.intel.com, linux-usb@...r.kernel.org,
	jonathanh@...dia.com, abhishekpandit@...omium.org,
	andersson@...nel.org, dmitry.baryshkov@...aro.org,
	fabrice.gasnier@...s.st.com, gregkh@...uxfoundation.org,
	hdegoede@...hat.com, neil.armstrong@...aro.org,
	rajaram.regupathy@...el.com, saranya.gopal@...el.com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] usb: typec: ucsi: Only set number of plug altmodes
 after registration

Hi Jameson,

On Tue, Jun 25, 2024 at 12:46:07AM +0000, Jameson Thies wrote:
> Move the setting of the plug's number of alternate modes into the
> same condition as the plug's registration to prevent dereferencing the
> connector's plug pointer while it is null.
> 
> Fixes: c313a44ac9cd ("usb: typec: ucsi: Always set number of alternate modes")
> Suggested-by: Jon Hunter <jonathanh@...dia.com>
> Signed-off-by: Jameson Thies <jthies@...gle.com>

Reviewed-by: Benson Leung <bleung@...omium.org>

Thanks,
Benson

> ---
>  drivers/usb/typec/ucsi/ucsi.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 76c48d873b2a..77e46bf4a098 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1180,13 +1180,13 @@ static int ucsi_check_cable(struct ucsi_connector *con)
>  		ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_SOP_P);
>  		if (ret < 0)
>  			return ret;
> -	}
>  
> -	if (con->plug_altmode[0]) {
> -		num_plug_am = ucsi_get_num_altmode(con->plug_altmode);
> -		typec_plug_set_num_altmodes(con->plug, num_plug_am);
> -	} else {
> -		typec_plug_set_num_altmodes(con->plug, 0);
> +		if (con->plug_altmode[0]) {
> +			num_plug_am = ucsi_get_num_altmode(con->plug_altmode);
> +			typec_plug_set_num_altmodes(con->plug, num_plug_am);
> +		} else {
> +			typec_plug_set_num_altmodes(con->plug, 0);
> +		}
>  	}
>  
>  	return 0;
> 
> base-commit: 819984a0dd3606b7c46fe156cd56a0dc0d604788
> -- 
> 2.45.2.741.gdbec12cfda-goog
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ