]> git.baikalelectronics.ru Git - kernel.git/commit
tty: fix return value for unsupported ioctls
authorJohan Hovold <johan@kernel.org>
Wed, 7 Apr 2021 09:52:02 +0000 (11:52 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Apr 2021 08:36:34 +0000 (10:36 +0200)
commite3833da4a5f96f7ab0d43a18a17e3f90a09549cd
treeff3f74fd6a145199eebc043d4827d7ba39b8dfc8
parent126e9e7bb4567b7aad23fa9c664b810fa99c12da
tty: fix return value for unsupported ioctls

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

Fix up the TIOCMGET, TIOCMSET and TIOCGICOUNT helpers which returned
-EINVAL when a tty driver did not implement the corresponding
operations.

Note that the TIOCMGET and TIOCMSET helpers predate git and do not get a
corresponding Fixes tag below.

Fixes: dc83e2fc1f74 ("tty: Make tiocgicount a handler")
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210407095208.31838-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c
include/linux/tty_driver.h