mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org, Jiri Slaby <jirislaby@gmail.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Rusty Russell <rusty@rustcorp.com.au>
Subject: [PATCH 1/1] cpu: create stop machine in disable_nonboot_cpus
Date: Wed,  7 Jan 2009 16:39:15 +0100	[thread overview]
Message-ID: <1231342755-5122-1-git-send-email-jirislaby@gmail.com> (raw)

Commit
772cd49cfa4002439b16dd6b553a11771ac096fd
(stop_machine: introduce stop_machine_create/destroy.)
introduced stop_machine_create/destroy, but omitted to call them from
disable_nonboot_cpus (it's called only from cpu_down).

Create and destroy the stop machine even in disable_nonboot_cpus
(which calls _cpu_down too) to avoid NULL-pointer dereference oops on
suspend.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
---
 kernel/cpu.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index 30e74dd..79e40f0 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -379,8 +379,11 @@ static cpumask_var_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
 {
-	int cpu, first_cpu, error = 0;
+	int cpu, first_cpu, error;
 
+	error = stop_machine_create();
+	if (error)
+		return error;
 	cpu_maps_update_begin();
 	first_cpu = cpumask_first(cpu_online_mask);
 	/* We take down all of the non-boot CPUs in one shot to avoid races
@@ -409,6 +412,7 @@ int disable_nonboot_cpus(void)
 		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
 	}
 	cpu_maps_update_done();
+	stop_machine_destroy();
 	return error;
 }
 
-- 
1.6.0.6


             reply	other threads:[~2009-01-07 15:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 15:39 Jiri Slaby [this message]
2009-01-07 16:00 ` Heiko Carstens
2009-01-07 16:10   ` Jiri Slaby

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=1231342755-5122-1-git-send-email-jirislaby@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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®