diff options
-rw-r--r-- | drivers/tty/tty_io.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 5f834dcb0b15..d697053f5e42 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -3293,6 +3293,7 @@ struct device *tty_register_device_attr(struct tty_driver *driver, { char name[64]; dev_t devt = MKDEV(driver->major, driver->minor_start) + index; + struct ktermios *tp; struct device *dev; int retval; @@ -3326,6 +3327,16 @@ struct device *tty_register_device_attr(struct tty_driver *driver, goto err_put; if (!(driver->flags & TTY_DRIVER_DYNAMIC_ALLOC)) { + /* + * Free any saved termios data so that the termios state is + * reset when reusing a minor number. + */ + tp = driver->termios[index]; + if (tp) { + driver->termios[index] = NULL; + kfree(tp); + } + retval = tty_cdev_add(driver, devt, index, 1); if (retval) goto err_del; |