|
@@ -55,7 +55,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
|
|
|
#ifdef CONFIG_UNIX98_PTYS
|
|
|
if (tty->driver == ptm_driver) {
|
|
|
mutex_lock(&devpts_mutex);
|
|
|
- devpts_pty_kill(tty->link->driver_data);
|
|
|
+ if (tty->link->driver_data)
|
|
|
+ devpts_pty_kill(tty->link->driver_data);
|
|
|
mutex_unlock(&devpts_mutex);
|
|
|
}
|
|
|
#endif
|
|
@@ -703,6 +704,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
|
|
|
mutex_unlock(&tty_mutex);
|
|
|
|
|
|
set_bit(TTY_PTY_LOCK, &tty->flags); /* LOCK THE SLAVE */
|
|
|
+ tty->driver_data = inode;
|
|
|
|
|
|
tty_add_file(tty, filp);
|
|
|
|
|
@@ -713,14 +715,13 @@ static int ptmx_open(struct inode *inode, struct file *filp)
|
|
|
retval = PTR_ERR(slave_inode);
|
|
|
goto err_release;
|
|
|
}
|
|
|
+ tty->link->driver_data = slave_inode;
|
|
|
|
|
|
retval = ptm_driver->ops->open(tty, filp);
|
|
|
if (retval)
|
|
|
goto err_release;
|
|
|
|
|
|
tty_unlock(tty);
|
|
|
- tty->driver_data = inode;
|
|
|
- tty->link->driver_data = slave_inode;
|
|
|
return 0;
|
|
|
err_release:
|
|
|
tty_unlock(tty);
|