public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] oprofile: fix CPU unplug panic in ppro_stop()
@ 2008-12-02  6:21 Eric Dumazet
  2008-12-02  8:17 ` Ingo Molnar
  2008-12-04  0:04 ` Robert Richter
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2008-12-02  6:21 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Ingo Molnar, linux kernel, Robert Richter

[-- Attachment #1: Type: text/plain, Size: 265 bytes --]

If oprofile statically compiled in kernel, a cpu unplug triggers
a panic in ppro_stop(), because a NULL pointer is dereferenced.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
 arch/x86/oprofile/op_model_ppro.c |    4 ++++
 1 files changed, 4 insertions(+)

[-- Attachment #2: ppro_stop.patch --]
[-- Type: text/plain, Size: 660 bytes --]

diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 716d26f..e9f80c7 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -156,6 +156,8 @@ static void ppro_start(struct op_msrs const * const msrs)
 	unsigned int low, high;
 	int i;
 
+	if (!reset_value)
+		return;
 	for (i = 0; i < num_counters; ++i) {
 		if (reset_value[i]) {
 			CTRL_READ(low, high, msrs, i);
@@ -171,6 +173,8 @@ static void ppro_stop(struct op_msrs const * const msrs)
 	unsigned int low, high;
 	int i;
 
+	if (!reset_value)
+		return;
 	for (i = 0; i < num_counters; ++i) {
 		if (!reset_value[i])
 			continue;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-12-04  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02  6:21 [PATCH] oprofile: fix CPU unplug panic in ppro_stop() Eric Dumazet
2008-12-02  8:17 ` Ingo Molnar
2008-12-03 11:59   ` Robert Richter
2008-12-03 14:08     ` Andi Kleen
2008-12-04  0:04 ` Robert Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox