Series short description
Subsystems (3)
cover Series short description
A pair of small fixes for nasty console related bugs from the various tty merges and updates.
Alan
PATCH 1/2 drivers/char/tty_io.c: Avoid panic when no console is configured.
From: \"Will Newton\" <[email protected]>
When no console is configured tty_open tries to call kref_get on a NULL pointer, return ENODEV instead.
Signed-off-by Will Newton <[email protected]>
Signed-off-by Alan Cox <[email protected]>
---
drivers/char/tty_io.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/char/tty_io.c +9 -6
@@ -1793,12 +1793,15 @@ retry_open: }#endif if (device ==MKDEV (TTYAUX_MAJOR ,1 )) { - driver =tty_driver_kref_get (console_device (&index)); -if (driver) { -/* Don't let /dev/console block */ - filp->f_flags |=O_NONBLOCK ; - noctty =1 ; - goto got_driver; +struct tty_driver *console_driver =console_device (&index); +if (console_driver) { + driver =tty_driver_kref_get (console_driver); +if (driver) { +/* Don't let /dev/console block */ + filp->f_flags |=O_NONBLOCK ; + noctty =1 ; + goto got_driver; + } }mutex_unlock (&tty_mutex);return -ENODEV ;
PATCH 2/2 Add kref to fake tty used by USB console
In reply to Alan CoxFrom: Kevin Hao <[email protected]>
We alloc a fake tty in usb serial console setup function. we should init the tty's kref otherwise we will face WARN_ON after following invoke of tty_port_tty_set --> tty_kref_get.
Signed-off-by Kevin Hao <[email protected]>
Signed-off-by Alan Cox <[email protected]>
---
drivers/usb/serial/console.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/usb/serial/console.c +1 -0
@@ -135,6 +135,7 @@ static int usb_console_setup(struct console *co, char *options)err ("no more memory" ); goto reset_open_count; } +kref_init (&tty->kref); termios =kzalloc (sizeof (*termios),GFP_KERNEL );if (!termios) { retval = -ENOMEM ;