Skip to contentSkip to conversation

TTY: pmac_zilog, check existence of ports in pmz_console_init()

PATCH In review Geert Uytterhoeven 4 participants 6 messages Nov 22, 2013 – Mar 30, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 TTY: pmac_zilog, check existence of ports in pmz_console_init()

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0" on the kernel command line, it crashes with:

Unable to handle kernel NULL pointer dereference at virtual address   (null)
Oops: 00000000
PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
...
Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4

The normal tty driver doesn't crash, because init_pmz() checks pmz_ports_count again after calling pmz_probe().

In the serial console initialization path, pmz_console_init() doesn't do this, causing the driver to crash later.

Add a check for pmz_ports_count to fix this.

Cc Finn Thain <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>
---
 drivers/tty/serial/pmac_zilog.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/tty/serial/pmac_zilog.c +3 -0
index 481b781b26e3..e9d420ff3931 100644
@@ -2052,6 +2052,9 @@ static int __init pmz_console_init(void)
 	/* Probe ports */
 	pmz_probe();
 
+	if (pmz_ports_count == 0)
+		return -ENODEV;
+
 	/* TODO: Autoprobe console based on OF */
 	/* pmz_console.index = i; */
 	register_console(&pmz_console);
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 TTY: amiserial, add missing platform check

When booting a multi-platform m68k kernel on a non-Amiga with "console=ttyS0" on the kernel command line, it crashes with:

Unable to handle kernel access at virtual address 81dff01c
Oops: 00000000
PC: [<001e09a8>] serial_console_write+0xc/0x70

Add the missing platform check to amiserial_console_init() to fix this.

---
 drivers/tty/amiserial.c |    3 +++
 1 file changed, 3 insertions(+)
drivers/tty/amiserial.c +3 -0
index 2b86f8e0fb58..71630a2af42c 100644
@@ -1855,6 +1855,9 @@ static struct console sercons = {
  */
 static int __init amiserial_console_init(void)
 {
+	if (!MACH_IS_AMIGA)
+		return -ENODEV;
+
 	register_console(&sercons);
 	return 0;
 }
Signature · 1 line
1.7.9.5
#2 lore raw
In reply to Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0" on the kernel command line, it crashes with:

Can we please get this in stable, too?

commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a

Thanks!

Quoted 9 lines
Unable to handle kernel NULL pointer dereference at virtual address   (null)
Oops: 00000000
PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
...
Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4

The normal tty driver doesn't crash, because init_pmz() checks pmz_ports_count again after calling pmz_probe().

Quoted 8 lines

In the serial console initialization path, pmz_console_init() doesn't do this, causing the driver to crash later.

Add a check for pmz_ports_count to fix this.

Cc Finn Thain <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw
Quoted 8 lines · Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0" on the kernel command line, it crashes with:

Can we please get this in stable, too?

commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a

Now applied, thanks.

greg k-h

#4 lore raw
In reply to Geert Uytterhoeven
Quoted 10 lines · Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0" on the kernel command line, it crashes with:

Can we please get this in stable, too?

commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a

Thanks!

Thanks Geert, I'm queuing it for the 3.5 and 3.11 kernels as well.

Cheers,
--
Luis

Quoted 32 lines
Quoted 9 lines
Unable to handle kernel NULL pointer dereference at virtual address   (null)
Oops: 00000000
PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
...
Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4

The normal tty driver doesn't crash, because init_pmz() checks pmz_ports_count again after calling pmz_probe().

Quoted 8 lines

In the serial console initialization path, pmz_console_init() doesn't do this, causing the driver to crash later.

Add a check for pmz_ports_count to fix this.

Cc Finn Thain <[email protected]>
Cc Benjamin Herrenschmidt <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Geert Uytterhoeven
Quoted 8 lines · Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0" on the kernel command line, it crashes with:

Can we please get this in stable, too?

commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a

[...]

I've queued this up for 3.2; sorry for the delay.

Ben.

Signature · 2 lines
Ben Hutchings
If more than one person is responsible for a bug, no one is at fault.