All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] printk: Check valid console index for preferred console
@ 2023-10-04  8:54 Tony Lindgren
  2023-10-11  7:34 ` Tony Lindgren
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Lindgren @ 2023-10-04  8:54 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky; +Cc: linux-kernel

Let's check for valid console index values.

Signed-off-by: Tony Lindgren <tony@atomide.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

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

end of thread, other threads:[~2023-10-11  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04  8:54 [PATCH] printk: Check valid console index for preferred console Tony Lindgren
2023-10-11  7:34 ` Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.