diff options
-rw-r--r-- | drivers/tty/pty.c | 8 | ||||
-rw-r--r-- | drivers/tty/tty_io.c | 12 | ||||
-rw-r--r-- | include/linux/tty.h | 3 |
3 files changed, 6 insertions, 17 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index d8653ab..03147fa 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -515,10 +515,8 @@ static int pty_unix98_ioctl(struct tty_struct *tty, static struct tty_struct *ptm_unix98_lookup(struct tty_driver *driver, struct inode *ptm_inode, int idx) { - struct tty_struct *tty = devpts_get_tty(ptm_inode, idx); - if (tty) - tty = tty->link; - return tty; + /* Master must be open via /dev/ptmx */ + return ERR_PTR(-EIO); } /** @@ -677,7 +675,7 @@ static int ptmx_open(struct inode *inode, struct file *filp) mutex_lock(&tty_mutex); tty_lock(); - tty = tty_init_dev(ptm_driver, index, 1); + tty = tty_init_dev(ptm_driver, index); mutex_unlock(&tty_mutex); if (IS_ERR(tty)) { diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index e41b9bb..fbcc140 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -1365,7 +1365,6 @@ static int tty_reopen(struct tty_struct *tty) * @driver: tty driver we are opening a device on * @idx: device index * @ret_tty: returned tty structure - * @first_ok: ok to open a new device (used by ptmx) * * Prepare a tty device. This may not be a "new" clean device but * could also be an active device. The pty drivers require special @@ -1385,18 +1384,11 @@ static int tty_reopen(struct tty_struct *tty) * relaxed for the (most common) case of reopening a tty. */ -struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, - int first_ok) +struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx) { struct tty_struct *tty; int retval; - /* Check if pty master is being opened multiple times */ - if (driver->subtype == PTY_TYPE_MASTER && - (driver->flags & TTY_DRIVER_DEVPTS_MEM) && !first_ok) { - return ERR_PTR(-EIO); - } - /* * First time open is complex, especially for PTY devices. * This code guarantees that either everything succeeds and the @@ -1950,7 +1942,7 @@ retry_open: if (retval) tty = ERR_PTR(retval); } else - tty = tty_init_dev(driver, index, 0); + tty = tty_init_dev(driver, index); mutex_unlock(&tty_mutex); if (driver) diff --git a/include/linux/tty.h b/include/linux/tty.h index 5dbb3cb..d3ebd76 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -480,8 +480,7 @@ extern void free_tty_struct(struct tty_struct *tty); extern void initialize_tty_struct(struct tty_struct *tty, struct tty_driver *driver, int idx); extern void deinitialize_tty_struct(struct tty_struct *tty); -extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx, - int first_ok); +extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); extern int tty_release(struct inode *inode, struct file *filp); extern int tty_init_termios(struct tty_struct *tty); |