diff options
-rw-r--r-- | drivers/char/tty_io.c | 5 | ||||
-rw-r--r-- | fs/proc/proc_tty.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 5d405a1bfbe3..7710a6a77d97 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -3770,7 +3770,9 @@ int tty_register_driver(struct tty_driver *driver) if (!driver->put_char) driver->put_char = tty_default_put_char; + mutex_lock(&tty_mutex); list_add(&driver->tty_drivers, &tty_drivers); + mutex_unlock(&tty_mutex); if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) { for(i = 0; i < driver->num; i++) @@ -3796,8 +3798,9 @@ int tty_unregister_driver(struct tty_driver *driver) unregister_chrdev_region(MKDEV(driver->major, driver->minor_start), driver->num); - + mutex_lock(&tty_mutex); list_del(&driver->tty_drivers); + mutex_unlock(&tty_mutex); /* * Free the termios and termios_locked structures because diff --git a/fs/proc/proc_tty.c b/fs/proc/proc_tty.c index c1bbfbeb035e..b3a473b0a191 100644 --- a/fs/proc/proc_tty.c +++ b/fs/proc/proc_tty.c @@ -108,6 +108,8 @@ static void *t_start(struct seq_file *m, loff_t *pos) { struct list_head *p; loff_t l = *pos; + + mutex_lock(&tty_mutex); list_for_each(p, &tty_drivers) if (!l--) return list_entry(p, struct tty_driver, tty_drivers); @@ -124,6 +126,7 @@ static void *t_next(struct seq_file *m, void *v, loff_t *pos) static void t_stop(struct seq_file *m, void *v) { + mutex_unlock(&tty_mutex); } static struct seq_operations tty_drivers_op = { |