From: Tony Lindgren Date: Wed, 4 Oct 2023 08:55:10 +0000 (+0300) Subject: serial: 8250: Check for valid console index X-Git-Tag: v6.7-rc1~75^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9cbe7e8f27b4e4ab38db5ba5634d12f86574ca7;p=thirdparty%2Fkernel%2Flinux.git serial: 8250: Check for valid console index Let's not allow negative numbers for console index. Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20231004085511.42645-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 904e319e6b4a3..9127331518587 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -611,7 +611,7 @@ static int univ8250_console_setup(struct console *co, char *options) * if so, search for the first available port that does have * console support. */ - if (co->index >= UART_NR) + if (co->index < 0 || co->index >= UART_NR) co->index = 0; /*