Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix panic due to inconsistent lock states of tty_...



details:   https://anonhg.NetBSD.org/src/rev/9194a29d1121
branches:  trunk
changeset: 457813:9194a29d1121
user:      rin <rin%NetBSD.org@localhost>
date:      Sun Jul 21 16:10:37 2019 +0000

description:
Fix panic due to inconsistent lock states of tty_lock in zsparam().
Tested on mac68k.

diffstat:

 sys/dev/ic/z8530tty.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 8c75163944c9 -r 9194a29d1121 sys/dev/ic/z8530tty.c
--- a/sys/dev/ic/z8530tty.c     Sun Jul 21 16:08:13 2019 +0000
+++ b/sys/dev/ic/z8530tty.c     Sun Jul 21 16:10:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: z8530tty.c,v 1.132 2017/10/31 10:45:19 martin Exp $    */
+/*     $NetBSD: z8530tty.c,v 1.133 2019/07/21 16:10:37 rin Exp $       */
 
 /*-
  * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -137,7 +137,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.132 2017/10/31 10:45:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.133 2019/07/21 16:10:37 rin Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_ntp.h"
@@ -629,7 +629,9 @@
 
                /* Make sure zsparam will see changes. */
                tp->t_ospeed = 0;
+               mutex_spin_exit(&tty_lock);
                (void) zsparam(tp, &t);
+               mutex_spin_enter(&tty_lock);
 
                /*
                 * Note: zsparam has done: cflag, ispeed, ospeed
@@ -1672,9 +1674,7 @@
                /*
                 * Inform the tty layer that carrier detect changed.
                 */
-               mutex_spin_exit(&tty_lock);
                (void) (*tp->t_linesw->l_modem)(tp, ISSET(rr0, ZSRR0_DCD));
-               mutex_spin_enter(&tty_lock);
        }
 
        if (ISSET(delta, cs->cs_rr0_cts)) {



Home | Main Index | Thread Index | Old Index