summaryrefslogtreecommitdiff
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorSven Schnelle <svens@linux.ibm.com>2022-12-09 12:27:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-19 15:04:56 +0100
commit7370a25f9315e732ab7538d6c7e85208176d8fa2 (patch)
treeed55ba55ea473b35a2072d3a48d57f6a470021dc /drivers/tty/vt
parentdb4df8e9d79e7d37732c1a1b560958e8dadfefa1 (diff)
tty/vt: prevent registration of console with invalid number
If a user specifies an invalid console like 'console=tty3000', the vt driver should prevent setting up a vt entry for that. Suggested-by: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Link: https://lore.kernel.org/r/20221209112737.3222509-3-svens@linux.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 981d2bfcf9a5..62c8a45ad731 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3156,8 +3156,14 @@ static struct tty_driver *vt_console_device(struct console *c, int *index)
return console_driver;
}
+static int vt_console_setup(struct console *co, char *options)
+{
+ return co->index >= MAX_NR_CONSOLES ? -EINVAL : 0;
+}
+
static struct console vt_console_driver = {
.name = "tty",
+ .setup = vt_console_setup,
.write = vt_console_print,
.device = vt_console_device,
.unblank = unblank_screen,