Subject: [PATCH 2.6] fix duart locking

From: Peter Buckingham <[email-masked]>
Date: Wed, 15 Sep 2004 17:19:10 -0700

Hi Ralf,

the duart code tries to hold a spin lock across a call to 
copy_from_user(). This patch releases the spin lock before the call and 
reacquires it afterwards.

peter

Signed-off-by: Peter Buckingham <[email-masked]>
? drivers/i2c/algos/.built-in.o.cmd
? drivers/i2c/algos/.i2c-algo-bit.o.cmd
? drivers/i2c/busses/.built-in.o.cmd
? drivers/i2c/chips/.built-in.o.cmd
? drivers/input/misc/.built-in.o.cmd
? drivers/input/misc/.pcspkr.o.cmd
? drivers/input/misc/.uinput.o.cmd
Index: drivers/char/sb1250_duart.c
===================================================================
RCS file: /home/cvs/linux/drivers/char/sb1250_duart.c,v
retrieving revision 1.23
diff -u -r1.23 sb1250_duart.c
--- drivers/char/sb1250_duart.c	15 Oct 2003 16:19:12 -0000	1.23
+++ drivers/char/sb1250_duart.c	16 Sep 2004 00:10:31 -0000
@@ -326,10 +326,11 @@
 		if (c <= 0) break;
 
 		if (from_user) {
+			spin_unlock_irqrestore(&us->outp_lock, flags);
 			if (copy_from_user(us->outp_buf + us->outp_tail, buf, c)) {
-				spin_unlock_irqrestore(&us->outp_lock, flags);
 				return -EFAULT;
 			}
+			spin_lock_irqsave(&us->outp_lock, flags);
 		} else {
 			memcpy(us->outp_buf + us->outp_tail, buf, c);
 		}