diff options
author | Alexandre Courbot <gnurou@gmail.com> | 2011-02-08 22:18:46 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-03-31 01:33:22 -0400 |
commit | b2267a6b095afb84b5766d6646e581b9054704d9 (patch) | |
tree | 1acfe545a09b8ba9fb0c01a30ed465d1be3a9b7f /drivers/tty/serial/sh-sci.c | |
parent | ff7690b48ae8571d930a2621e21f6e5a41e42b6d (diff) |
serial: sh-sci: prevent setup of uninitialized serial console
Commit 906b17dc089f7fa87e37a9cfe6ee185efc90e0da introduced a condition
where the kernel will crash unless a earlyprintk parameter is specified.
Without this parameter, sci_console_init is called during early console
setup without any port being initialized, and the kernel crashes a
little bit later when uart_set_options attemps to invoke set_termios on a
port with an ops member equal to NULL.
This patch just checks in sci_console_init that the port is properly
initialized, and aborts the early console setup if it is not.
Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index eb7958c675a8..264209c32675 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -1836,6 +1836,12 @@ static int __devinit serial_console_setup(struct console *co, char *options) | |||
1836 | sci_port = &sci_ports[co->index]; | 1836 | sci_port = &sci_ports[co->index]; |
1837 | port = &sci_port->port; | 1837 | port = &sci_port->port; |
1838 | 1838 | ||
1839 | /* | ||
1840 | * Refuse to handle uninitialized ports. | ||
1841 | */ | ||
1842 | if (!port->ops) | ||
1843 | return -ENODEV; | ||
1844 | |||
1839 | ret = sci_remap_port(port); | 1845 | ret = sci_remap_port(port); |
1840 | if (unlikely(ret != 0)) | 1846 | if (unlikely(ret != 0)) |
1841 | return ret; | 1847 | return ret; |