Subject: [PATCH] powerpc/32: Fix early access to cpu_spec relocation

From: Benjamin Herrenschmidt <[email-masked]>
Date: Tue, 02 Aug 2016 15:53:01 +1000

Commit 9402c684613163888714df0955fa1f17142b08bf introduced a subtle bug
on 32-bit. When reading the cpu spec from the global, we not only need
to do a pointer relocation on the global address but also on the pointer
we read from it.

This fixes crashes reported on MPC5200 based machines.

Signed-off-by: Benjamin Herrenschmidt <[email-masked]>
Fixes: 9402c684613163888714df0955fa1f17142b08bf
--
diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
index defb299..fd36e13 100644
--- a/arch/powerpc/lib/feature-fixups.c
+++ b/arch/powerpc/lib/feature-fixups.c
@@ -154,7 +154,7 @@ static void do_final_fixups(void)
 
 void apply_feature_fixups(void)
 {
-	struct cpu_spec *spec = *PTRRELOC(&cur_cpu_spec);
+	struct cpu_spec *spec = PTRRELOC(*PTRRELOC(&cur_cpu_spec));
 
 	/*
 	 * Apply the CPU-specific and firmware specific fixups to kernel text