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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025041131-datebook-tumble-a759@gregkh>
Date: Fri, 11 Apr 2025 07:55:09 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Chance Yang <chance.yang@...ron.us>
Cc: Chunfeng Yun <chunfeng.yun@...iatek.com>, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, morgan.chang@...ron.us
Subject: Re: [PATCH] usb: common: usb-conn-gpio: use a unique names for usb
 connector devices

On Fri, Apr 11, 2025 at 11:27:33AM +0800, Chance Yang wrote:
> The current implementation uses "usb-charger" as a generic name for
> usb connector. This prevents us to have two usb connector devices
> attached as the power system will complain about the name which is
> already registered.
> 
> Use an incremental name for each usb connector attached.
> 
> Fixes: 880287910b189 ("usb: common: usb-conn-gpio: fix NULL pointer dereference of charger")
> Signed-off-by: Chance Yang <chance.yang@...ron.us>
> ---
> This patch addresses an issue in the usb-conn-gpio driver where the
> generic "usb-charger" name is used for all USB connector devices. This
> causes conflicts in the power supply subsystem when multiple USB
> connectors are present, as duplicate names are not allowed.
> 
> The fix introduces an incremental naming scheme (e.g., usb-charger-0,
> usb-charger-1) for each USB connector device, ensuring uniqueness and
> preventing registration errors.
> ---
>  drivers/usb/common/usb-conn-gpio.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/common/usb-conn-gpio.c b/drivers/usb/common/usb-conn-gpio.c
> index 1e36be2a28fd5ca5e1495b7923e4d3e25d7cedef..2702e1a26634770500febd567f9d0891e63a8c4c 100644
> --- a/drivers/usb/common/usb-conn-gpio.c
> +++ b/drivers/usb/common/usb-conn-gpio.c
> @@ -155,13 +155,19 @@ static int usb_charger_get_property(struct power_supply *psy,
>  
>  static int usb_conn_psy_register(struct usb_conn_info *info)
>  {
> +	static atomic_t usb_conn_no = ATOMIC_INIT(0);

Please use a proper data structure for this (hint, not an atomic_t, but
rather a idr, or is it ida?)

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ