oprofile: fix CPU unplug panic in ppro_stop()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, December 4, 2008 - 10:59 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=9ea84a...
Commit:     9ea84ad77d635bdb76c9a08f44f21a9af98359ee
Parent:     061e41fdb5047b1fb161e89664057835935ca1d2
Author:     Eric Dumazet <dada1@cosmosbay.com>
AuthorDate: Tue Dec 2 07:21:21 2008 +0100
Committer:  Robert Richter <robert.richter@amd.com>
CommitDate: Wed Dec 3 15:58:51 2008 +0100

    oprofile: fix CPU unplug panic in ppro_stop()
    
    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>
    Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 arch/x86/oprofile/op_model_ppro.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

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;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
oprofile: fix CPU unplug panic in ppro_stop(), Linux Kernel Mailing ..., (Thu Dec 4, 10:59 pm)