diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-19 11:33:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-19 11:33:21 -0400 |
commit | a0340703981baa6cc1e9c7c768095a0a4e718daf (patch) | |
tree | 36486da94ffe0c236b9c98aac58971a9dd8da34b /drivers/tty | |
parent | 5fbe46b67680c27aeb56228dab8cfe25f8f8f83d (diff) |
Revert "TTY: call tty_driver_lookup_tty unconditionally"
This reverts commit 631180aca723cb92e128fdac5fd144e913ca84e5.
It caused problems when /dev/tty is a pty:
https://lkml.org/lkml/2011/10/12/401
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: stable <stable@vger.kernel.org>
Cc: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/tty_io.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 0425170d9ed6..767ecbb4761a 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1821,7 +1821,7 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1821 | 1821 | ||
1822 | static int tty_open(struct inode *inode, struct file *filp) | 1822 | static int tty_open(struct inode *inode, struct file *filp) |
1823 | { | 1823 | { |
1824 | struct tty_struct *tty; | 1824 | struct tty_struct *tty = NULL; |
1825 | int noctty, retval; | 1825 | int noctty, retval; |
1826 | struct tty_driver *driver; | 1826 | struct tty_driver *driver; |
1827 | int index; | 1827 | int index; |
@@ -1892,14 +1892,17 @@ retry_open: | |||
1892 | return -ENODEV; | 1892 | return -ENODEV; |
1893 | } | 1893 | } |
1894 | got_driver: | 1894 | got_driver: |
1895 | /* check whether we're reopening an existing tty */ | 1895 | if (!tty) { |
1896 | tty = tty_driver_lookup_tty(driver, inode, index); | 1896 | /* check whether we're reopening an existing tty */ |
1897 | if (IS_ERR(tty)) { | 1897 | tty = tty_driver_lookup_tty(driver, inode, index); |
1898 | tty_unlock(); | 1898 | |
1899 | mutex_unlock(&tty_mutex); | 1899 | if (IS_ERR(tty)) { |
1900 | tty_driver_kref_put(driver); | 1900 | tty_unlock(); |
1901 | tty_free_file(filp); | 1901 | mutex_unlock(&tty_mutex); |
1902 | return PTR_ERR(tty); | 1902 | tty_driver_kref_put(driver); |
1903 | tty_free_file(filp); | ||
1904 | return PTR_ERR(tty); | ||
1905 | } | ||
1903 | } | 1906 | } |
1904 | 1907 | ||
1905 | if (tty) { | 1908 | if (tty) { |