Commit bdbe8503 authored by Kan Liang's avatar Kan Liang Committed by Greg Kroah-Hartman

perf/x86/intel/uncore: Fix wrong box pointer check

commit 80c65fdb upstream.

Should not init a NULL box. It will cause system crash.
The issue looks like caused by a typo.

This was not noticed because there is no NULL box. Also, for most
boxes, they are enabled by default. The init code is not critical.

Fixes: fff4b87e ("perf/x86/intel/uncore: Make package handling more robust")
Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170629190926.2456-1-kan.liang@intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 60c9685b
...@@ -1170,7 +1170,7 @@ static int uncore_event_cpu_online(unsigned int cpu) ...@@ -1170,7 +1170,7 @@ static int uncore_event_cpu_online(unsigned int cpu)
pmu = type->pmus; pmu = type->pmus;
for (i = 0; i < type->num_boxes; i++, pmu++) { for (i = 0; i < type->num_boxes; i++, pmu++) {
box = pmu->boxes[pkg]; box = pmu->boxes[pkg];
if (!box && atomic_inc_return(&box->refcnt) == 1) if (box && atomic_inc_return(&box->refcnt) == 1)
uncore_box_init(box); uncore_box_init(box);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment