Commit a648a316 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

ipipe: fix bad reference to invalid percpu data

Since debug_smp_processor_id() can be called very early during the
boot process when CONFIG_DEBUG_PREEMPT is enabled, testing
ipipe_root_p() may be invalid on architectures with late percpu memory
fixups such as ppc64.

Prevent bad references to invalid percpu memory by checking for
disabled hard IRQs first, which denotes a non-preemptible context, and
always evaluates to true during the early boot phase mentioned above.
parent 5a2a0eff
......@@ -12,13 +12,16 @@ notrace static unsigned int check_preemption_disabled(const char *what1,
int this_cpu = raw_smp_processor_id();
if (hard_irqs_disabled())
goto out;
if (!ipipe_root_p)
goto out;
if (likely(preempt_count()))
goto out;
if (irqs_disabled() || hard_irqs_disabled())
if (irqs_disabled())
goto out;
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