From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Zhang Rui <rui.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Linux ACPI <linux-acpi@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] int340X/processor_thermal_device: Fix proc_thermal_rapl_remove()
Date: Tue, 23 Jul 2019 09:30:22 +0200 [thread overview]
Message-ID: <CAJZ5v0ik4b0LZ_WwscvZ_WibaN89DWCy-J1KZCJCCkh5TiGXAg@mail.gmail.com> (raw)
In-Reply-To: <3270289.QqOHTbhTGK@kreacher>
On Mon, Jul 22, 2019 at 12:23 PM Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Passing 0 to cpuhp_remove_state() triggers the BUG_ON() in
> __cpuhp_remove_state_cpuslocked() and the argument passed to
> powercap_unregister_control_type() is expected to be a valid
> pointer, so avoid calling these functions with incorrect
> arguments from proc_thermal_rapl_remove().
>
> Fixes: 555c45fe0d04 ("int340X/processor_thermal_device: add support for MMIO RAPL")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Any comments?
If not, I'll queue this up along with the other RAPL-related fix
(https://patchwork.kernel.org/patch/11050999/).
> ---
> drivers/thermal/intel/int340x_thermal/processor_thermal_device.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> Index: linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> ===================================================================
> --- linux-pm.orig/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++ linux-pm/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -487,6 +487,7 @@ static int proc_thermal_rapl_add(struct
> rapl_mmio_cpu_online, rapl_mmio_cpu_down_prep);
> if (ret < 0) {
> powercap_unregister_control_type(rapl_mmio_priv.control_type);
> + rapl_mmio_priv.control_type = NULL;
> return ret;
> }
> rapl_mmio_priv.pcap_rapl_online = ret;
> @@ -496,6 +497,9 @@ static int proc_thermal_rapl_add(struct
>
> static void proc_thermal_rapl_remove(void)
> {
> + if (IS_ERR_OR_NULL(rapl_mmio_priv.control_type))
> + return;
> +
> cpuhp_remove_state(rapl_mmio_priv.pcap_rapl_online);
> powercap_unregister_control_type(rapl_mmio_priv.control_type);
> }
>
>
>
next prev parent reply other threads:[~2019-07-23 7:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 10:22 [PATCH] int340X/processor_thermal_device: Fix proc_thermal_rapl_remove() Rafael J. Wysocki
2019-07-23 7:30 ` Rafael J. Wysocki [this message]
2019-07-23 7:32 ` Zhang Rui
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=CAJZ5v0ik4b0LZ_WwscvZ_WibaN89DWCy-J1KZCJCCkh5TiGXAg@mail.gmail.com \
--to=rafael@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).