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: <9a8a5084-589d-4c45-a011-5bf4d0dfc8ba@app.fastmail.com>
Date: Fri, 14 Feb 2025 21:18:10 -0500
From: "Mark Pearson" <mpearson-lenovo@...ebb.ca>
To: "Kurt Borja" <kuurtb@...il.com>, "Rafael J. Wysocki" <rafael@...nel.org>
Cc: "Len Brown" <lenb@...nel.org>,
 Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
 "Limonciello, Mario" <mario.limonciello@....com>,
 "Armin Wolf" <W_Armin@....de>, "Gergo Koteles" <soyer@....hu>,
 "linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI: platform_profile: Fix memory leak in
 profile_class_is_visible()


On Wed, Feb 12, 2025, at 2:30 PM, Kurt Borja wrote:
> If class_find_device() finds a device it's reference count is
> incremented. Call put_device() to drop this reference before returning.
>
> Fixes: 77be5cacb2c2 ("ACPI: platform_profile: Create class for ACPI 
> platform profile")
> Signed-off-by: Kurt Borja <kuurtb@...il.com>
> ---
>  drivers/acpi/platform_profile.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/platform_profile.c 
> b/drivers/acpi/platform_profile.c
> index fc92e43d0fe9..2ad53cc6aae5 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -417,8 +417,14 @@ static int profile_class_registered(struct device 
> *dev, const void *data)
> 
>  static umode_t profile_class_is_visible(struct kobject *kobj, struct 
> attribute *attr, int idx)
>  {
> -	if (!class_find_device(&platform_profile_class, NULL, NULL, 
> profile_class_registered))
> +	struct device *dev;
> +
> +	dev = class_find_device(&platform_profile_class, NULL, NULL, 
> profile_class_registered);
> +	if (!dev)
>  		return 0;
> +
> +	put_device(dev);
> +
>  	return attr->mode;
>  }
> 
>
> base-commit: 3e3e377dd1f300bbdd230533686ce9c9f4f8a90d
> -- 
> 2.48.1
Good find. Looks good to me.
Reviewed-by: Mark Pearson <mpearson-lenovo@...ebb.ca>

Mark

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ