Commit bbb63c51 authored by Wanlong Gao's avatar Wanlong Gao Committed by Greg Kroah-Hartman

drivers:tty:fix up ENOIOCTLCMD error handling

At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.
For example:
	fd = open("/dev/tty", O_RDWR);
	ioctl(fd, -1, &argp);

then the errno should be ENOTTY but not EINVAL.
Signed-off-by: default avatarWanlong Gao <>
Acked-by: default avatarAlan Cox <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent fd7c81f8
......@@ -2774,7 +2774,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (ld->ops->ioctl) {
retval = ld->ops->ioctl(tty, file, cmd, arg);
if (retval == -ENOIOCTLCMD)
retval = -EINVAL;
retval = -ENOTTY;
return retval;
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