lkml.org 
[lkml]   [2021]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 248/530] tty: fix return value for unsupported termiox ioctls
    Date
    From: Johan Hovold <johan@kernel.org>

    [ Upstream commit 8871de06ff78e9333d86c87d7071452b690e7c9b ]

    Drivers should return -ENOTTY ("Inappropriate I/O control operation")
    when an ioctl isn't supported, while -EINVAL is used for invalid
    arguments.

    Support for termiox was added by commit 1d65b4a088de ("tty: Add
    termiox") in 2008 but no driver support ever followed and it was
    recently ripped out by commit e0efb3168d34 ("tty: Remove dead termiox
    code").

    Fix the return value for the unsupported termiox ioctls, which have
    always returned -EINVAL, by explicitly returning -ENOTTY rather than
    removing them completely and falling back to the default unrecognised-
    ioctl handling.

    Fixes: 1d65b4a088de ("tty: Add termiox")
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Link: https://lore.kernel.org/r/20210407095208.31838-4-johan@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/tty/tty_ioctl.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
    index 4de1c6ddb8ff..803da2d111c8 100644
    --- a/drivers/tty/tty_ioctl.c
    +++ b/drivers/tty/tty_ioctl.c
    @@ -774,8 +774,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
    case TCSETX:
    case TCSETXW:
    case TCSETXF:
    - return -EINVAL;
    -#endif
    + return -ENOTTY;
    +#endif
    case TIOCGSOFTCAR:
    copy_termios(real_tty, &kterm);
    ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0,
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-05-12 18:31    [W:5.081 / U:0.404 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site