public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PPC64: lockfix for rtas error log
@ 2004-06-29 22:50 linas
  2004-06-30  1:17 ` David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: linas @ 2004-06-29 22:50 UTC (permalink / raw)
  To: paulus, paulus; +Cc: linuxppc64-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]


Paul, 

Could you please apply the following path to the ameslab tree, and/or 
forward it to the main 2.6 kernel maintainers.

This patch moves the location of a lock in order to protect
the contents of a buffer until it has been copied to its final
destination. Prior to this, a race existed whereby the buffer
could be filled even while it was being emptied.

Signed-off-by: Linas Vepstas <linas@linas.org>

--linas


[-- Attachment #2: rtas-erbbuf-lockfix.patch --]
[-- Type: text/plain, Size: 857 bytes --]

--- arch/ppc64/kernel/rtas.c.orig-pre-lockfix	2004-06-29 17:02:12.000000000 -0500
+++ arch/ppc64/kernel/rtas.c	2004-06-29 17:14:05.000000000 -0500
@@ -134,9 +134,10 @@ log_rtas_error(void)
 
 	spin_lock_irqsave(&rtas.lock, s);
 	rc = __log_rtas_error();
-	spin_unlock_irqrestore(&rtas.lock, s);
-	if (rc == 0)
+	if (rc == 0) {
 		log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
+	}
+	spin_unlock_irqrestore(&rtas.lock, s);
 }
 
 int
@@ -193,12 +194,13 @@ rtas_call(int token, int nargs, int nret
 			outputs[i] = rtas_args->rets[i+1];
 	ret = (int)((nret > 0) ? rtas_args->rets[0] : 0);
 
+	if (logit) {
+		log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
+	}
+	
 	/* Gotta do something different here, use global lock for now... */
 	spin_unlock_irqrestore(&rtas.lock, s);
 
-	if (logit)
-		log_error(rtas_err_buf, ERR_TYPE_RTAS_LOG, 0);
-
 	return ret;
 }
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-07-01 16:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-29 22:50 [PATCH] PPC64: lockfix for rtas error log linas
2004-06-30  1:17 ` David Gibson
2004-06-30 16:58   ` linas
2004-06-30  1:44 ` Benjamin Herrenschmidt
2004-06-30 17:36   ` linas
2004-06-30 18:47     ` Benjamin Herrenschmidt
2004-06-30 19:02       ` Olof Johansson
2004-06-30 19:02         ` Benjamin Herrenschmidt
2004-06-30 20:31       ` [PATCH] 2.6 PPC64: lockfix for rtas error log (third-times-a-charm?) linas
2004-06-30 11:27 ` [PATCH] PPC64: lockfix for rtas error log Paul Mackerras
2004-06-30 17:50   ` linas
2004-06-30 23:07     ` Paul Mackerras
2004-07-01 16:31       ` Jake Moilanen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox