linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: Prevent kernel crash with nr_uarts=0
@ 2015-05-04 16:01 Jan Kiszka
  2015-05-04 17:02 ` Peter Hurley
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2015-05-04 16:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Linux Kernel Mailing List, linux-serial

When nr_uarts was set to 0 (via config or 8250_core.nr_uarts), we crash
early on x86 because serial8250_isa_init_ports dereferences base_ops
which remains NULL. In fact, there is nothing to do for that function if
there are no uarts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 drivers/tty/serial/8250/8250_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 4506e40..e1363a40 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -3256,7 +3256,7 @@ static void __init serial8250_isa_init_ports(void)
 	static int first = 1;
 	int i, irqflag = 0;
 
-	if (!first)
+	if (!first || nr_uarts == 0)
 		return;
 	first = 0;
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-05  6:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-04 16:01 [PATCH] serial: 8250: Prevent kernel crash with nr_uarts=0 Jan Kiszka
2015-05-04 17:02 ` Peter Hurley
2015-05-04 17:45   ` Jan Kiszka
2015-05-04 18:52     ` Peter Hurley
2015-05-05  6:26       ` [PATCH] serial: 8250: Do nothing if nr_uarts=0 Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).