Module Name: src
Committed By: pgoyette
Date: Fri Jul 29 02:19:52 UTC 2016
Modified Files:
src/sys/kern [pgoyette-localcount]: tty_pty.c
Log Message:
Add a note to revisit the locking for this device.
To generate a diff of this commit:
cvs rdiff -u -r1.142.2.5 -r1.142.2.6 src/sys/kern/tty_pty.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/kern/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.142.2.5 src/sys/kern/tty_pty.c:1.142.2.6
--- src/sys/kern/tty_pty.c:1.142.2.5 Fri Jul 29 01:49:39 2016
+++ src/sys/kern/tty_pty.c Fri Jul 29 02:19:52 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $ */
+/* $NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.5 2016/07/29 01:49:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.142.2.6 2016/07/29 02:19:52 pgoyette Exp $");
#include "opt_ptm.h"
@@ -1046,6 +1046,12 @@ ptytty(dev_t dev)
int
ptyioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
{
+/*
+ * XXX We really should use device_lookup_acquire(...) to lock the
+ * XXX device before fetching its softc pointer. Acquiring the
+ * XXX cdevsw prevents the driver from being detached, but doesn't
+ * XXX prevent the specific instance/unit from disappearing.
+ */
struct pt_softc *pti = pt_softc[minor(dev)];
struct tty *tp = pti->pt_tty;
const struct cdevsw *cdev;