From: Lukasz Luba <lukasz.luba@arm.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Linux ACPI <linux-acpi@vger.kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Armin Wolf <w_armin@gmx.de>, Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 1/2] Revert "thermal/drivers/hwmon: Cleanup coding style a bit"
Date: Wed, 5 Aug 2026 11:32:30 +0100 [thread overview]
Message-ID: <7011fec6-f2ac-4ceb-bdb9-adbccdabf6d8@arm.com> (raw)
In-Reply-To: <5123895.31r3eYUQgx@rafael.j.wysocki>
On 8/4/26 21:09, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Revert commit 030a48b0f6ce ("thermal/drivers/hwmon: Cleanup coding style
> a bit") that introduced a use-after-free into the error path of
> thermal_add_hwmon_sysfs() by removing a valid check from it.
>
> Link: https://lore.kernel.org/linux-hwmon/20260803183915.4ED7D1F000E9@smtp.kernel.org/
> Cc: All applicable <stable@vger.kernel.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/thermal/thermal_hwmon.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
> index 597c33c8a555..ec73d03a1e60 100644
> --- a/drivers/thermal/thermal_hwmon.c
> +++ b/drivers/thermal/thermal_hwmon.c
> @@ -212,7 +212,8 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
> if (new_hwmon_device)
> hwmon_device_unregister(hwmon->device);
> free_mem:
> - kfree(hwmon);
> + if (new_hwmon_device)
> + kfree(hwmon);
>
> return result;
> }
LGTM, a tricky plumbing. I'm sorry for being late with review.
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
next prev parent reply other threads:[~2026-08-05 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 20:06 [PATCH v2 0/2] thermal: hwmon: Fix thermal zone removal deadlock Rafael J. Wysocki
2026-08-04 20:09 ` [PATCH v2 1/2] Revert "thermal/drivers/hwmon: Cleanup coding style a bit" Rafael J. Wysocki
2026-08-05 10:32 ` Lukasz Luba [this message]
2026-08-05 11:53 ` Rafael J. Wysocki (Intel)
2026-08-04 20:11 ` [PATCH v2 2/2] thermal: hwmon: Remove hwmon class device along with its parent Rafael J. Wysocki
2026-08-05 10:40 ` Lukasz Luba
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=7011fec6-f2ac-4ceb-bdb9-adbccdabf6d8@arm.com \
--to=lukasz.luba@arm.com \
--cc=daniel.lezcano@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rafael@kernel.org \
--cc=w_armin@gmx.de \
/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