]> Git Repo - linux.git/commitdiff
tty: fix return value for unsupported termiox ioctls
authorJohan Hovold <[email protected]>
Wed, 7 Apr 2021 09:52:03 +0000 (11:52 +0200)
committerGreg Kroah-Hartman <[email protected]>
Sat, 10 Apr 2021 08:36:34 +0000 (10:36 +0200)
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/tty/tty_ioctl.c

index deffaefcf41d661d3297036cd5e417b171ed287d..420e7678330fc74089fa9173ff5e1dbaa5456c9f 100644 (file)
@@ -773,8 +773,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,
This page took 0.055748 seconds and 4 git commands to generate.