From: Guenter Roeck <linux@roeck-us.net>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 0/9] thermal/core: Protect thermal device operations against removal
Date: Tue, 15 Nov 2022 05:31:36 -0800 [thread overview]
Message-ID: <20221115133136.GC4189373@roeck-us.net> (raw)
In-Reply-To: <CAJZ5v0j50TWszcRWkb_m4BDQ_gEpCuJDR2EuOJWN8zvBf_KkUw@mail.gmail.com>
On Mon, Nov 14, 2022 at 07:06:57PM +0100, Rafael J. Wysocki wrote:
> On Thu, Nov 10, 2022 at 4:25 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > Accesses to thermal zones, and with it to thermal zone device operations,
> > are still possible after the thermal zone device has been unregistered.
> > For example, thermal_zone_get_temp() can be called from temp_show()
> > in thermal_sysfs.c if the sysfs attribute was opened before the thermal
> > device was unregistered. This is problematic and may result in crashes
> > since the operations data structure and the underlying code may be gone
> > when the calls are made.
> >
> > The following series solves the problem by protecting accesses to thermal
> > device operations with the thermal device mutex, and by verifying that the
> > thermal device is still registered after the mutex has been acquired.
> >
> > This was previously sent as RFC/RFT as single patch [1]. The code was reworked
> > to match thermal subsystem changes made between v6.0 and v6.1, and it was
> > split into several patches to simplify review.
> >
> > [1] https://lore.kernel.org/linux-pm/20221004033936.1047691-1-linux@roeck-us.net/
> >
> > v2: Improved documentation, rearranged code.
> > No functional changes. See individual patches for details.
> >
> > ----------------------------------------------------------------
> > Guenter Roeck (9):
> > thermal/core: Destroy thermal zone device mutex in release function
> > thermal/core: Delete device under thermal device zone lock
> > thermal/core: Ensure that thermal device is registered in thermal_zone_get_temp
> > thermal/core: Move parameter validation from __thermal_zone_get_temp to thermal_zone_get_temp
> > thermal/core: Introduce locked version of thermal_zone_device_update
> > thermal/core: Protect hwmon accesses to thermal operations with thermal zone mutex
> > thermal/core: Protect sysfs accesses to thermal operations with thermal zone mutex
> > thermal/core: Remove thermal_zone_set_trips()
> > thermal/core: Protect thermal device operations against thermal device removal
> >
> > drivers/thermal/thermal_core.c | 76 +++++++++++++++++++++++--------------
> > drivers/thermal/thermal_core.h | 3 +-
> > drivers/thermal/thermal_helpers.c | 67 +++++++++++++++++++++------------
> > drivers/thermal/thermal_hwmon.c | 10 ++++-
> > drivers/thermal/thermal_sysfs.c | 79 ++++++++++++++++++++++++++++++++-------
> > 5 files changed, 168 insertions(+), 67 deletions(-)
>
> All applied as 6.2 material, thanks!
Thanks a lot!
Guenter
prev parent reply other threads:[~2022-11-15 13:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 15:24 [PATCH v2 0/9] thermal/core: Protect thermal device operations against removal Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 1/9] thermal/core: Destroy thermal zone device mutex in release function Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 2/9] thermal/core: Delete device under thermal device zone lock Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 3/9] thermal/core: Ensure that thermal device is registered in thermal_zone_get_temp Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 4/9] thermal/core: Move parameter validation from __thermal_zone_get_temp to thermal_zone_get_temp Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 5/9] thermal/core: Introduce locked version of thermal_zone_device_update Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 6/9] thermal/core: Protect hwmon accesses to thermal operations with thermal zone mutex Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 7/9] thermal/core: Protect sysfs " Guenter Roeck
2022-11-10 15:24 ` [PATCH v2 8/9] thermal/core: Remove thermal_zone_set_trips() Guenter Roeck
2022-11-10 15:25 ` [PATCH v2 9/9] thermal/core: Protect thermal device operations against thermal device removal Guenter Roeck
2022-11-14 18:06 ` [PATCH v2 0/9] thermal/core: Protect thermal device operations against removal Rafael J. Wysocki
2022-11-15 13:31 ` Guenter Roeck [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=20221115133136.GC4189373@roeck-us.net \
--to=linux@roeck-us.net \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@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