Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Don't call ureadc() with a spinlock held because ur...



details:   https://anonhg.NetBSD.org/src/rev/e9a449e6b1e4
branches:  trunk
changeset: 781814:e9a449e6b1e4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Oct 02 23:10:34 2012 +0000

description:
Don't call ureadc() with a spinlock held because ureadc() may fault when
writing to userspace.

diffstat:

 sys/kern/tty.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r c5ad970c87d9 -r e9a449e6b1e4 sys/kern/tty.c
--- a/sys/kern/tty.c    Tue Oct 02 17:43:52 2012 +0000
+++ b/sys/kern/tty.c    Tue Oct 02 23:10:34 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.254 2012/09/30 11:49:44 mlelstv Exp $        */
+/*     $NetBSD: tty.c,v 1.255 2012/10/02 23:10:34 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.254 2012/09/30 11:49:44 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.255 2012/10/02 23:10:34 mlelstv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1957,7 +1957,9 @@
                /*
                 * Give user character.
                 */
+               mutex_spin_exit(&tty_lock);
                error = ureadc(c, uio);
+               mutex_spin_enter(&tty_lock);
                if (error)
                        break;
                if (uio->uio_resid == 0)



Home | Main Index | Thread Index | Old Index