diff options
-rw-r--r-- | drivers/tty/pty.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c index e198996c5b83..9e45c5728d9b 100644 --- a/drivers/tty/pty.c +++ b/drivers/tty/pty.c @@ -667,8 +667,11 @@ static void pty_unix98_remove(struct tty_driver *driver, struct tty_struct *tty) fsi = tty->driver_data; else fsi = tty->link->driver_data; - devpts_kill_index(fsi, tty->index); - devpts_put_ref(fsi); + + if (fsi) { + devpts_kill_index(fsi, tty->index); + devpts_put_ref(fsi); + } } static const struct tty_operations ptm_unix98_ops = { |