Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern In ttymalloc() explicitly initialize t_dev to NODEV.
details: https://anonhg.NetBSD.org/src/rev/86c35f49553d
branches: trunk
changeset: 763970:86c35f49553d
user: martin <martin%NetBSD.org@localhost>
date: Sat Apr 09 06:34:06 2011 +0000
description:
In ttymalloc() explicitly initialize t_dev to NODEV.
In ptcwakeup() do not bother to wake up a client side if it has not been
opened yet.
The old code would spuriously wakeup the client minor(0) [i.e. ttyp0
typically] or crash the kernel if that wasn't open, see PR kern/40688.
(Old names used to match the PR and test case, adjust names for
/dev/ptm[x] resp. /dev/pts/* accordingly)
diffstat:
sys/kern/tty.c | 5 +++--
sys/kern/tty_pty.c | 10 +++++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diffs (57 lines):
diff -r 5cd82551553a -r 86c35f49553d sys/kern/tty.c
--- a/sys/kern/tty.c Sat Apr 09 00:26:52 2011 +0000
+++ b/sys/kern/tty.c Sat Apr 09 06:34:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.242 2011/02/02 03:00:44 christos Exp $ */
+/* $NetBSD: tty.c,v 1.243 2011/04/09 06:34:06 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.242 2011/02/02 03:00:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.243 2011/04/09 06:34:06 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -2695,6 +2695,7 @@
cv_init(&tp->t_outcvf, "ttyoutf");
/* Set default line discipline. */
tp->t_linesw = ttyldisc_default();
+ tp->t_dev = NODEV;
selinit(&tp->t_rsel);
selinit(&tp->t_wsel);
for (i = 0; i < TTYSIG_COUNT; i++)
diff -r 5cd82551553a -r 86c35f49553d sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c Sat Apr 09 00:26:52 2011 +0000
+++ b/sys/kern/tty_pty.c Sat Apr 09 06:34:06 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_pty.c,v 1.124 2010/11/16 23:58:11 dyoung Exp $ */
+/* $NetBSD: tty_pty.c,v 1.125 2011/04/09 06:34:06 martin Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.124 2010/11/16 23:58:11 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.125 2011/04/09 06:34:06 martin Exp $");
#include "opt_ptm.h"
@@ -523,7 +523,11 @@
void
ptcwakeup(struct tty *tp, int flag)
{
- struct pt_softc *pti = pt_softc[minor(tp->t_dev)];
+ struct pt_softc *pti = NULL;
+
+ if (tp->t_dev == NODEV) return;
+
+ pti = pt_softc[minor(tp->t_dev)];
mutex_spin_enter(&tty_lock);
if (flag & FREAD) {
Home |
Main Index |
Thread Index |
Old Index