[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231004085434.42570-1-tony@atomide.com>
Date: Wed, 4 Oct 2023 11:54:33 +0300
From: Tony Lindgren <tony@...mide.com>
To: Petr Mladek <pmladek@...e.com>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] printk: Check valid console index for preferred console
Let's check for valid console index values.
Signed-off-by: Tony Lindgren <tony@...mide.com>
---
kernel/printk/printk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2410,6 +2410,10 @@ static int __add_preferred_console(char *name, int idx, char *options,
struct console_cmdline *c;
int i;
+ /* See struct console */
+ if (idx > SHRT_MAX)
+ return -EINVAL;
+
/*
* See if this tty is not yet registered, and
* if we have a slot free.
--
2.42.0
Powered by blists - more mailing lists