]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/rtas: enture rtas_call is called with MMU enabled
authorNicholas Piggin <npiggin@gmail.com>
Tue, 8 Mar 2022 13:50:46 +0000 (23:50 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 19 May 2022 13:11:27 +0000 (23:11 +1000)
rtas_call must not be called with the MMU disabled because in case
of rtas error, log_error is called which requires MMU enabled. Add
a test and warning for this.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220308135047.478297-14-npiggin@gmail.com
arch/powerpc/kernel/rtas.c

index c1403dc4fd66a49850a709fa884f4c713bb282fe..9bb43aa53d43ec331299a2d378751b694bed609d 100644 (file)
@@ -476,6 +476,11 @@ int rtas_call(int token, int nargs, int nret, int *outputs, ...)
        if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
                return -1;
 
+       if ((mfmsr() & (MSR_IR|MSR_DR)) != (MSR_IR|MSR_DR)) {
+               WARN_ON_ONCE(1);
+               return -1;
+       }
+
        s = lock_rtas();
 
        /* We use the global rtas args buffer */