lkml.org 
[lkml]   [2022]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 2/2] tty/vt: prevent registration of console with invalid number
    Date
    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>
    ---
    drivers/tty/vt/vt.c | 6 ++++++
    1 file changed, 6 insertions(+)

    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,
    --
    2.34.1
    \
     
     \ /
      Last update: 2022-12-09 12:29    [W:7.915 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site