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: <fb4e29fa-36e4-45ff-979b-2497ec3d946b@arm.com>
Date: Thu, 25 Apr 2024 23:02:37 +0100
From: Lukasz Luba <lukasz.luba@....com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
Cc: Linux PM <linux-pm@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>
Subject: Re: [PATCH v1 1/3] thermal/debugfs: Free all thermal zone debug
 memory on zone removal



On 4/25/24 14:49, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Because thermal_debug_tz_remove() does not free all memory allocated for
> thermal zone diagnostics, some of that memory becomes unreachable after
> freeing the thermal zone's struct thermal_debugfs object.
> 
> Address this by making thermal_debug_tz_remove() free all of the memory
> in question.
> 
> Fixes: 7ef01f228c9f ("thermal/debugfs: Add thermal debugfs information for mitigation episodes")
> Cc :6.8+ <stable@...r.kernel.org> # 6.8+
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> ---
>   drivers/thermal/thermal_debugfs.c |   13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> Index: linux-pm/drivers/thermal/thermal_debugfs.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_debugfs.c
> +++ linux-pm/drivers/thermal/thermal_debugfs.c
> @@ -832,15 +832,28 @@ void thermal_debug_tz_add(struct thermal
>   void thermal_debug_tz_remove(struct thermal_zone_device *tz)
>   {
>   	struct thermal_debugfs *thermal_dbg = tz->debugfs;
> +	struct tz_episode *tze, *tmp;
> +	struct tz_debugfs *tz_dbg;
> +	int *trips_crossed;
>   
>   	if (!thermal_dbg)
>   		return;
>   
> +	tz_dbg = &thermal_dbg->tz_dbg;
> +
>   	mutex_lock(&thermal_dbg->lock);
>   
> +	trips_crossed = tz_dbg->trips_crossed;
> +
> +	list_for_each_entry_safe(tze, tmp, &tz_dbg->tz_episodes, node) {
> +		list_del(&tze->node);
> +		kfree(tze);
> +	}
> +
>   	tz->debugfs = NULL;
>   
>   	mutex_unlock(&thermal_dbg->lock);
>   
>   	thermal_debugfs_remove_id(thermal_dbg);
> +	kfree(trips_crossed);
>   }
> 
> 
> 
> 

Reviewed-by: Lukasz Luba <lukasz.luba@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ