[PATCH] powerpc: fix crash in rtas during early boot.

Linas Vepstas linas at austin.ibm.com
Thu Oct 4 04:35:43 EST 2007


RTAS messages can occur very early during boot, before the error
message buffer has been allocated. The current code will lead to 
a null-pointer deref. Explicitly protect against this.

Signed-off-by: Linas Vepstas <linas at austin.ibm.com>
Cc: Andy Whitcroft <apw at shadowen.org>
----

Andy Whitcroft's crash was appearently due to firmware complaining
about lost power, (actually, lost power supply redundancy!), which
occurred very early during boot. 

    Type                00000040 (EPOW)
    Status:             bypassed new
    Residual error from previous boot.
    EPOW Sensor Value:  00000002
    EPOW warning due to loss of redundancy.
    EPOW general power fault.

I've no clue why firmware thought it was OK to report this 
during one of the earliest calls to RTAS; I'm still investiigating 
that.

 arch/powerpc/platforms/pseries/rtasd.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-2.6.23-rc8-mm1/arch/powerpc/platforms/pseries/rtasd.c
===================================================================
--- linux-2.6.23-rc8-mm1.orig/arch/powerpc/platforms/pseries/rtasd.c	2007-09-26 15:06:49.000000000 -0500
+++ linux-2.6.23-rc8-mm1/arch/powerpc/platforms/pseries/rtasd.c	2007-10-03 11:58:09.000000000 -0500
@@ -235,6 +235,12 @@ void pSeries_log_error(char *buf, unsign
 		return;
 	}
 
+	/* During early boot, the log buffer hasn't been allocted yet. */
+	if (rtas_log_buf == NULL) {
+		spin_unlock_irqrestore(&rtasd_log_lock, s);
+		return;
+	}
+
 	/* call type specific method for error */
 	switch (err_type & ERR_TYPE_MASK) {
 	case ERR_TYPE_RTAS_LOG:



More information about the Linuxppc-dev mailing list