lkml.org 
[lkml]   [2023]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] printk: Check valid console index for preferred console
Date
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
\
 
 \ /
  Last update: 2023-10-04 10:55    [W:0.056 / U:1.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site