Skip to contentSkip to conversation

Make rtas_call() safe if RTAS hasn't been initialised

PATCH In review Michael Ellerman 1 participant 1 message Jun 23, 2006 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 3/8 Make rtas_call() safe if RTAS hasn't been initialised

Currently it's unsafe to call rtas_call() prior to rtas_initialize(). This is because the rtas.entry value hasn't been setup and so we don't know where to enter, but we just try anyway.

We can't do anything intelligent without rtas.entry, so if it's not set, just return. Code that calls rtas_call() early needs to be aware that the call might fail.

---

 arch/powerpc/kernel/rtas.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/rtas.c +1 -1
Index: to-merge/arch/powerpc/kernel/rtas.c
===================================================================
@@ -328,7 +328,7 @@ int rtas_call(int token, int nargs, int 
 	char *buff_copy = NULL;
 	int ret;
 
-	if (token == RTAS_UNKNOWN_SERVICE)
+	if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
 		return -1;
 
 	/* Gotta do something different here, use global lock for now... */