]> Git Repo - linux.git/commit
tty: don't panic on OOM in tty_set_ldisc()
authorDmitry Vyukov <[email protected]>
Sat, 4 Mar 2017 13:55:19 +0000 (14:55 +0100)
committerGreg Kroah-Hartman <[email protected]>
Fri, 17 Mar 2017 05:07:10 +0000 (14:07 +0900)
commit5362544bebe85071188dd9e479b5a5040841c895
treebf7a38ccddbeeb382f2f856a659fef8faf7814f6
parentb767ad726c2aa6219318bf0da83fbe690e653d9a
tty: don't panic on OOM in tty_set_ldisc()

If tty_ldisc_open() fails in tty_set_ldisc(), it tries to go back
to the old discipline or N_TTY. But that can fail as well, in such
case it panics. This is not a graceful way to handle OOM.

Leave ldisc==NULL if all attempts fail instead.
Also use existing tty_ldisc_reinit() helper function instead of
tty_ldisc_restore(). Also don't WARN/BUG in tty_ldisc_reinit()
if N_TTY fails, which would have the same net effect of bringing
kernel down on OOM. Instead print a single line message about
what has happened.

Signed-off-by: Dmitry Vyukov <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Peter Hurley <[email protected]>
Cc: One Thousand Gnomes <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/tty/tty_ldisc.c
This page took 0.052461 seconds and 4 git commands to generate.