diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 5f834dcb0b15a5de5607c2b1a5ddd33433760216..d697053f5e429f597c1805a2703c3d5d4e8d1cfb 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;