Module Name: src Committed By: rin Date: Sun Jul 21 16:10:37 UTC 2019
Modified Files: src/sys/dev/ic: z8530tty.c Log Message: Fix panic due to inconsistent lock states of tty_lock in zsparam(). Tested on mac68k. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.133 src/sys/dev/ic/z8530tty.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/z8530tty.c diff -u src/sys/dev/ic/z8530tty.c:1.132 src/sys/dev/ic/z8530tty.c:1.133 --- src/sys/dev/ic/z8530tty.c:1.132 Tue Oct 31 10:45:19 2017 +++ src/sys/dev/ic/z8530tty.c Sun Jul 21 16:10:37 2019 @@ -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 @@ zsopen(dev_t dev, int flags, int mode, s /* 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 @@ zstty_stsoft(struct zstty_softc *zst, st /* * 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)) {