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]
Message-ID: <f6f48b25-f3db-4e22-ba32-5a8f6f743df2@kernel.org>
Date: Mon, 24 Nov 2025 00:38:17 +0900
From: Chanwoo Choi <chanwoo@...nel.org>
To: Michael Wu <michael@...winnertech.com>, myungjoo.ham@...sung.com,
 cw00.choi@...sung.com, andriy.shevchenko@...ux.intel.com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] extcon: Fixed sysfs duplicate filename issue

25. 10. 24. 11:49에 Michael Wu 이(가) 쓴 글:
> With current extcon_dev_unregister() timing, ida_free is before
> device_unregister(), that may cause current id re-alloc to another
> device in extcon_dev_register() context but sysfs filename path not
> removal completed yet.
> 
> The right timing shows below:
> on extcon_dev_register: ida_alloc() -> device_register()
> on extcon_dev_unregister: device_unregister() -> ida_free()
> 
> stack information when an error occurs:
> sysfs: cannot create duplicate filename '/class/extcon/extcon1'
> Call trace:
>  sysfs_warn_dup+0x68/0x88
>  sysfs_do_create_link_sd+0x94/0xdc
>  sysfs_create_link+0x30/0x48
>  device_add_class_symlinks+0xb4/0x12c
>  device_add+0x1e0/0x48c
>  device_register+0x20/0x34
>  extcon_dev_register+0x3b8/0x5c4
> 
> Fixes: 7bba9e81a6fb ("extcon: Use unique number for the extcon device ID")
> Acked-by: MyungJoo Ham <myungjoo.ham@...sung.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Signed-off-by: Michael Wu <michael@...winnertech.com>
> ---
> ChangeLog:
> V2 -> V3: Dropped some noisy lines in commit messages, suggested by Andy Shevchenko
> V1 -> V2: Update commit msg, suggested by Markus Elfring
> V1: https://lore.kernel.org/all/20251011053719.87055-1-michael@allwinnertech.com/
> ---
> ---
>  drivers/extcon/extcon.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index e7f55c021e562..c08f642d7f5ee 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -1371,10 +1371,10 @@ void extcon_dev_unregister(struct extcon_dev *edev)
>  		return;
>  	}
>  
> -	ida_free(&extcon_dev_ids, edev->id);
> -
>  	device_unregister(&edev->dev);
>  
> +	ida_free(&extcon_dev_ids, edev->id);
> +
>  	if (edev->mutually_exclusive && edev->max_supported) {
>  		for (index = 0; edev->mutually_exclusive[index];
>  				index++)

Applied it. Thanks.

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ