aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/tty_io.c5
-rw-r--r--fs/proc/proc_tty.c3
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)
3770 if (!driver->put_char) 3770 if (!driver->put_char)
3771 driver->put_char = tty_default_put_char; 3771 driver->put_char = tty_default_put_char;
3772 3772
3773 mutex_lock(&tty_mutex);
3773 list_add(&driver->tty_drivers, &tty_drivers); 3774 list_add(&driver->tty_drivers, &tty_drivers);
3775 mutex_unlock(&tty_mutex);
3774 3776
3775 if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) { 3777 if ( !(driver->flags & TTY_DRIVER_DYNAMIC_DEV) ) {
3776 for(i = 0; i < driver->num; i++) 3778 for(i = 0; i < driver->num; i++)
@@ -3796,8 +3798,9 @@ int tty_unregister_driver(struct tty_driver *driver)
3796 3798
3797 unregister_chrdev_region(MKDEV(driver->major, driver->minor_start), 3799 unregister_chrdev_region(MKDEV(driver->major, driver->minor_start),
3798 driver->num); 3800 driver->num);
3799 3801 mutex_lock(&tty_mutex);
3800 list_del(&driver->tty_drivers); 3802 list_del(&driver->tty_drivers);
3803 mutex_unlock(&tty_mutex);
3801 3804
3802 /* 3805 /*
3803 * Free the termios and termios_locked structures because 3806 * 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)
108{ 108{
109 struct list_head *p; 109 struct list_head *p;
110 loff_t l = *pos; 110 loff_t l = *pos;
111
112 mutex_lock(&tty_mutex);
111 list_for_each(p, &tty_drivers) 113 list_for_each(p, &tty_drivers)
112 if (!l--) 114 if (!l--)
113 return list_entry(p, struct tty_driver, tty_drivers); 115 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)
124 126
125static void t_stop(struct seq_file *m, void *v) 127static void t_stop(struct seq_file *m, void *v)
126{ 128{
129 mutex_unlock(&tty_mutex);
127} 130}
128 131
129static struct seq_operations tty_drivers_op = { 132static struct seq_operations tty_drivers_op = {