From: Minskey Guo <chaohong_guo@linux.intel.com>
To: mjg@redhat.com
Cc: platform-driver-x86@vger.kernel.org, jbarnes@virtuousgeek.org,
chaohong.guo@intel.com
Subject: Re: [PATCH 4/4] [intel_ips] NULL pointer might be used in ips_monitor()
Date: Sun, 26 Sep 2010 12:27:54 +0800 [thread overview]
Message-ID: <4C9ECBCA.3080809@linux.intel.com> (raw)
In-Reply-To: <1284703407-7802-1-git-send-email-chaohong.guo@linux.intel.com>
Hi,
Ping, any comment for the patches ?
thanks,
-minskey
On 09/17/2010 02:03 PM, minskey guo wrote:
> The patch is to create ips_adjust thread before ips_monitor begins
> to run because the latter will kthread_stop() or wake up the former
> via ips->adjust pointer. Without this change, it is possible that
> ips->adjust is NULL when kthread_stop() or wake_up_process() is
> called in ips_monitor().
>
> Signed-off-by: minskey guo<chaohong.guo@intel.com>
> Acked-by: Jesse Barnes<jbarnes@virtuousgeek.org>
> ---
> drivers/platform/x86/intel_ips.c | 22 +++++++++++++---------
> 1 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
> index 71dcc41..cb59ebd 100644
> --- a/drivers/platform/x86/intel_ips.c
> +++ b/drivers/platform/x86/intel_ips.c
> @@ -940,7 +940,6 @@ static int ips_monitor(void *data)
> kfree(mch_samples);
> kfree(cpu_samples);
> kfree(mchp_samples);
> - kthread_stop(ips->adjust);
> return -ENOMEM;
> }
>
> @@ -1535,19 +1534,24 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
> ips_enable_cpu_turbo(ips);
> ips->cpu_turbo_enabled = true;
>
> - /* Set up the work queue and monitor/adjust threads */
> - ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor");
> - if (IS_ERR(ips->monitor)) {
> + /* Create thermal adjust thread */
> + ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
> + if (IS_ERR(ips->adjust)) {
> dev_err(&dev->dev,
> - "failed to create thermal monitor thread, aborting\n");
> + "failed to create thermal adjust thread, aborting\n");
> ret = -ENOMEM;
> goto error_free_irq;
> +
> }
>
> - ips->adjust = kthread_create(ips_adjust, ips, "ips-adjust");
> - if (IS_ERR(ips->adjust)) {
> + /*
> + * Set up the work queue and monitor thread. The monitor thread
> + * will wake up ips_adjust thread.
> + */
> + ips->monitor = kthread_run(ips_monitor, ips, "ips-monitor");
> + if (IS_ERR(ips->monitor)) {
> dev_err(&dev->dev,
> - "failed to create thermal adjust thread, aborting\n");
> + "failed to create thermal monitor thread, aborting\n");
> ret = -ENOMEM;
> goto error_thread_cleanup;
> }
> @@ -1566,7 +1570,7 @@ static int ips_probe(struct pci_dev *dev, const struct pci_device_id *id)
> return ret;
>
> error_thread_cleanup:
> - kthread_stop(ips->monitor);
> + kthread_stop(ips->adjust);
> error_free_irq:
> free_irq(ips->dev->irq, ips);
> error_unmap:
>
prev parent reply other threads:[~2010-09-26 4:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-17 6:03 [PATCH 4/4] [intel_ips] NULL pointer might be used in ips_monitor() minskey guo
2010-09-26 4:27 ` Minskey Guo [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=4C9ECBCA.3080809@linux.intel.com \
--to=chaohong_guo@linux.intel.com \
--cc=chaohong.guo@intel.com \
--cc=jbarnes@virtuousgeek.org \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
/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).