powerpc/32: Fix early access to cpu_spec relocation
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 2 Aug 2016 05:53:01 +0000 (15:53 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 3 Aug 2016 05:43:16 +0000 (15:43 +1000)
Commit 9402c6846131 ("powerpc: Factor do_feature_fixup calls")
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.

Fixes: 9402c6846131 ("powerpc: Factor do_feature_fixup calls")
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/lib/feature-fixups.c

index 077fa0ce3382c5430773346a631e59cf2ab3aa75..74145f02ad417b496ceba07b0f114a2bbd77bc75 100644 (file)
@@ -161,7 +161,7 @@ static unsigned long __initdata saved_firmware_features;
 
 void __init apply_feature_fixups(void)
 {
-       struct cpu_spec *spec = *PTRRELOC(&cur_cpu_spec);
+       struct cpu_spec *spec = PTRRELOC(*PTRRELOC(&cur_cpu_spec));
 
        *PTRRELOC(&saved_cpu_features) = spec->cpu_features;
        *PTRRELOC(&saved_mmu_features) = spec->mmu_features;