From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Zhang Rui <rui.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: Re: [PATCH v2 2/2] thermal: core: Free tzp copy along with the thermal zone
Date: Fri, 4 Oct 2024 08:57:10 +0100 [thread overview]
Message-ID: <09a3f091-6201-4911-b8bb-21440f38df07@arm.com> (raw)
In-Reply-To: <4623516.LvFx2qVVIh@rjwysocki.net>
On 10/3/24 13:27, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> The object pointed to by tz->tzp may still be accessed after being
> freed in thermal_zone_device_unregister(), so move the freeing of it
> to the point after the removal completion has been completed at which
> it cannot be accessed any more.
>
> Fixes: 3d439b1a2ad3 ("thermal/core: Alloc-copy-free the thermal zone parameters structure")
> Cc: 6.8+ <stable@vger.kernel.org> # 6.8+
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> v1 -> v2: No changes
>
> ---
> drivers/thermal/thermal_core.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> Index: linux-pm/drivers/thermal/thermal_core.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/thermal_core.c
> +++ linux-pm/drivers/thermal/thermal_core.c
> @@ -1606,14 +1606,12 @@ void thermal_zone_device_unregister(stru
> ida_destroy(&tz->ida);
>
> device_del(&tz->device);
> -
> - kfree(tz->tzp);
> -
> put_device(&tz->device);
>
> thermal_notify_tz_delete(tz);
>
> wait_for_completion(&tz->removal);
> + kfree(tz->tzp);
> kfree(tz);
> }
> EXPORT_SYMBOL_GPL(thermal_zone_device_unregister);
>
>
>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
prev parent reply other threads:[~2024-10-04 7:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 12:23 [PATCH v2 0/2] thermal: core: Fix potential use-after-free issues Rafael J. Wysocki
2024-10-03 12:25 ` [PATCH v2 1/2] thermal: core: Reference count the zone in thermal_zone_get_by_id() Rafael J. Wysocki
2024-10-04 8:02 ` Lukasz Luba
2024-10-04 13:25 ` Rafael J. Wysocki
2024-10-04 13:31 ` Lukasz Luba
2024-10-04 13:43 ` Rafael J. Wysocki
2024-10-04 13:48 ` Rafael J. Wysocki
2024-10-04 13:53 ` Lukasz Luba
2024-10-04 16:28 ` Rafael J. Wysocki
2024-10-04 13:33 ` Rafael J. Wysocki
2024-10-03 12:27 ` [PATCH v2 2/2] thermal: core: Free tzp copy along with the thermal zone Rafael J. Wysocki
2024-10-04 7:57 ` Lukasz Luba [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=09a3f091-6201-4911-b8bb-21440f38df07@arm.com \
--to=lukasz.luba@arm.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®