Commit 8871de06 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

tty: fix return value for unsupported termiox ioctls

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 1d65b4a0 ("tty: Add
termiox") in 2008 but no driver support ever followed and it was
recently ripped out by commit e0efb316 ("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: 1d65b4a0 ("tty: Add termiox")
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210407095208.31838-4-johan@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1b8b2086
...@@ -773,8 +773,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file, ...@@ -773,8 +773,8 @@ int tty_mode_ioctl(struct tty_struct *tty, struct file *file,
case TCSETX: case TCSETX:
case TCSETXW: case TCSETXW:
case TCSETXF: case TCSETXF:
return -EINVAL; return -ENOTTY;
#endif #endif
case TIOCGSOFTCAR: case TIOCGSOFTCAR:
copy_termios(real_tty, &kterm); copy_termios(real_tty, &kterm);
ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0, ret = put_user((kterm.c_cflag & CLOCAL) ? 1 : 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment