linux-mips
[Top] [All Lists]

[PATCH 2.6] fix duart locking

To: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: [PATCH 2.6] fix duart locking
From: Peter Buckingham <peter@pantasys.com>
Date: Wed, 15 Sep 2004 17:19:10 -0700
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040820 Debian/1.7.2-4
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 <peter@pantasys.com>
? 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);
                }
<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 2.6] fix duart locking, Peter Buckingham <=