]> git.baikalelectronics.ru Git - kernel.git/commit
tty: don't crash in tty_init_dev when missing tty_port
authorJiri Slaby <jslaby@suse.cz>
Fri, 22 Nov 2019 10:17:21 +0000 (11:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Nov 2019 10:38:38 +0000 (11:38 +0100)
commitfd4e847e57b4e4a26a1c2856ec442f0624a80441
treeb6431e759d83ae24f77130c75cfe27f8844f2bed
parent6d0382778c91766be47c08c9f3bdce244960e3a1
tty: don't crash in tty_init_dev when missing tty_port

We currently warn the user when tty->port is not set in tty_init_dev
yet. The warning says that the kernel will crash later. And it really
will only few lines below at:
tty->port->itty = tty;

So be nice and avoid the crash -- return an error instead. And update
the warning.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20191122101721.7222-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c