oprofile: fix CPU unplug panic in ppro_stop()
authorEric Dumazet <dada1@cosmosbay.com>
Tue, 2 Dec 2008 06:21:21 +0000 (07:21 +0100)
committerRobert Richter <robert.richter@amd.com>
Wed, 3 Dec 2008 14:58:51 +0000 (15:58 +0100)
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

index 716d26f..e9f80c7 100644 (file)
@@ -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;