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: <CAJZ5v0hA3eqJEmr=TCdRTQXybdpudLc31Xfre7ea72aHgzpXbw@mail.gmail.com>
Date: Thu, 23 Oct 2025 21:03:15 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Armin Wolf <W_Armin@....de>
Cc: rafael@...nel.org, lenb@...nel.org, linux-acpi@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/6] ACPI: fan: Use platform device for devres-related actions

On Wed, Oct 8, 2025 at 1:42 AM Armin Wolf <W_Armin@....de> wrote:
>
> Device-managed resources are cleaned up when the driver unbinds from
> the underlying device. In our case this is the platform device as this
> driver is a platform driver. Registering device-managed resources on
> the associated ACPI device will thus result in a resource leak when
> this driver unbinds.
>
> Ensure that any device-managed resources are only registered on the
> platform device to ensure that they are cleaned up during removal.
>
> Fixes: 35c50d853adc ("ACPI: fan: Add hwmon support")
> Signed-off-by: Armin Wolf <W_Armin@....de>
> ---
>  drivers/acpi/fan.h       | 4 ++--
>  drivers/acpi/fan_core.c  | 2 +-
>  drivers/acpi/fan_hwmon.c | 8 ++++----
>  3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/fan.h b/drivers/acpi/fan.h
> index 022bc215cdbc..0d73433c3889 100644
> --- a/drivers/acpi/fan.h
> +++ b/drivers/acpi/fan.h
> @@ -98,9 +98,9 @@ int acpi_fan_create_attributes(struct acpi_device *device);
>  void acpi_fan_delete_attributes(struct acpi_device *device);
>
>  #if IS_REACHABLE(CONFIG_HWMON)
> -int devm_acpi_fan_create_hwmon(struct acpi_device *device);
> +int devm_acpi_fan_create_hwmon(struct device *dev);
>  #else
> -static inline int devm_acpi_fan_create_hwmon(struct acpi_device *device) { return 0; };
> +static inline int devm_acpi_fan_create_hwmon(struct device *dev) { return 0; };
>  #endif
>
>  #endif
> diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c
> index ea2c646c470c..46e7fe7a506d 100644
> --- a/drivers/acpi/fan_core.c
> +++ b/drivers/acpi/fan_core.c
> @@ -347,7 +347,7 @@ static int acpi_fan_probe(struct platform_device *pdev)
>         }
>
>         if (fan->has_fst) {
> -               result = devm_acpi_fan_create_hwmon(device);
> +               result = devm_acpi_fan_create_hwmon(&pdev->dev);
>                 if (result)
>                         return result;
>
> diff --git a/drivers/acpi/fan_hwmon.c b/drivers/acpi/fan_hwmon.c
> index 5581aa6fdfa0..47a02ef5a606 100644
> --- a/drivers/acpi/fan_hwmon.c
> +++ b/drivers/acpi/fan_hwmon.c
> @@ -162,12 +162,12 @@ static const struct hwmon_chip_info acpi_fan_hwmon_chip_info = {
>         .info = acpi_fan_hwmon_info,
>  };
>
> -int devm_acpi_fan_create_hwmon(struct acpi_device *device)
> +int devm_acpi_fan_create_hwmon(struct device *dev)
>  {
> -       struct acpi_fan *fan = acpi_driver_data(device);
> +       struct acpi_fan *fan = dev_get_drvdata(dev);
>         struct device *hdev;
>
> -       hdev = devm_hwmon_device_register_with_info(&device->dev, "acpi_fan", fan,
> -                                                   &acpi_fan_hwmon_chip_info, NULL);
> +       hdev = devm_hwmon_device_register_with_info(dev, "acpi_fan", fan, &acpi_fan_hwmon_chip_info,
> +                                                   NULL);
>         return PTR_ERR_OR_ZERO(hdev);
>  }
> --

Applied as 6.18-rc material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ