diff options
-rw-r--r-- | drivers/char/tty_io.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 59f472143f08..1412a8d1e58d 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1795,12 +1795,15 @@ retry_open: | |||
1795 | } | 1795 | } |
1796 | #endif | 1796 | #endif |
1797 | if (device == MKDEV(TTYAUX_MAJOR, 1)) { | 1797 | if (device == MKDEV(TTYAUX_MAJOR, 1)) { |
1798 | driver = tty_driver_kref_get(console_device(&index)); | 1798 | struct tty_driver *console_driver = console_device(&index); |
1799 | if (driver) { | 1799 | if (console_driver) { |
1800 | /* Don't let /dev/console block */ | 1800 | driver = tty_driver_kref_get(console_driver); |
1801 | filp->f_flags |= O_NONBLOCK; | 1801 | if (driver) { |
1802 | noctty = 1; | 1802 | /* Don't let /dev/console block */ |
1803 | goto got_driver; | 1803 | filp->f_flags |= O_NONBLOCK; |
1804 | noctty = 1; | ||
1805 | goto got_driver; | ||
1806 | } | ||
1804 | } | 1807 | } |
1805 | mutex_unlock(&tty_mutex); | 1808 | mutex_unlock(&tty_mutex); |
1806 | return -ENODEV; | 1809 | return -ENODEV; |