Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

serial8250: sanity check nr_uarts on all paths.

I had 8250.nr_uarts=16 in the boot line of a test kernel and I had a weird
mysterious crash in sysfs. After taking an in-depth look I realized that
CONFIG_SERIAL_8250_NR_UARTS was set to 4 and I was walking off the end of
the serial8250_ports array.

Ouch!!!

Don't let this happen to someone else.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Alan Cox <alan@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Eric W. Biederman and committed by
Linus Torvalds
05d81d22 f31ad92f

+3
+3
drivers/serial/8250.c
··· 2623 2623 2624 2624 static int __init serial8250_console_init(void) 2625 2625 { 2626 + if (nr_uarts > UART_NR) 2627 + nr_uarts = UART_NR; 2628 + 2626 2629 serial8250_isa_init_ports(); 2627 2630 register_console(&serial8250_console); 2628 2631 return 0;