aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-05 15:40:12 -0800
committerZiyan <jaraidaniel@gmail.com>2016-01-08 10:37:08 +0100
commit389c668b6132c28dbbd19ac56c5b2dc112d9f949 (patch)
treeca53b1b6b9af09412afab75e654bef3067c1e2c4 /net/socket.c
parent5d742a3d68160a3d3cecac4cf5c55567c9aebc2d (diff)
downloadkernel_samsung_tuna-389c668b6132c28dbbd19ac56c5b2dc112d9f949.tar.gz
kernel_samsung_tuna-389c668b6132c28dbbd19ac56c5b2dc112d9f949.tar.bz2
kernel_samsung_tuna-389c668b6132c28dbbd19ac56c5b2dc112d9f949.zip
vfs: fix up ENOIOCTLCMD error handling
We're doing some odd things there, which already messes up various users (see the net/socket.c code that this removes), and it was going to add yet more crud to the block layer because of the incorrect error code translation. ENOIOCTLCMD is not an error return that should be returned to user mode from the "ioctl()" system call, but it should *not* be translated as EINVAL ("Invalid argument"). It should be translated as ENOTTY ("Inappropriate ioctl for device"). That EINVAL confusion has apparently so permeated some code that the block layer actually checks for it, which is sad. We continue to do so for now, but add a big comment about how wrong that is, and we should remove it entirely eventually. In the meantime, this tries to keep the changes localized to just the EINVAL -> ENOTTY fix, and removing code that makes it harder to do the right thing. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/net/socket.c b/net/socket.c
index e4c7f90fca1..b2786fe2d01 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2907,7 +2907,7 @@ static int bond_ioctl(struct net *net, unsigned int cmd,
return dev_ioctl(net, cmd, uifr);
default:
- return -EINVAL;
+ return -ENOIOCTLCMD;
}
}
@@ -3234,20 +3234,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
return sock_do_ioctl(net, sock, cmd, arg);
}
- /* Prevent warning from compat_sys_ioctl, these always
- * result in -EINVAL in the native case anyway. */
- switch (cmd) {
- case SIOCRTMSG:
- case SIOCGIFCOUNT:
- case SIOCSRARP:
- case SIOCGRARP:
- case SIOCDRARP:
- case SIOCSIFLINK:
- case SIOCGIFSLAVE:
- case SIOCSIFSLAVE:
- return -EINVAL;
- }
-
return -ENOIOCTLCMD;
}