aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2009-11-06 03:09:09 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-07 02:11:15 -0500
commit9177efd3991e2cb3f5643a01d3be22121cab6efc (patch)
tree7bc6d106d4ef26d8012346f74ae0fdbe7ebdf1d3 /net/socket.c
parent6b96018b28bd93274b4b2a4c633a5d373fda0441 (diff)
net, compat_ioctl: handle more ioctls correctly
The MII ioctls and SIOCSIFNAME need to go through ifsioc conversion, which they never did so far. Some others are not implemented in the native path, so we can just return -EINVAL directly. Add IFSLAVE ioctls to the EINVAL list and move it to the end to optimize the code path for the common case. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/net/socket.c b/net/socket.c
index 901d709a7be0..bfbde200b743 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -3069,11 +3069,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3069 return do_siocgstamp(net, sock, cmd, argp); 3069 return do_siocgstamp(net, sock, cmd, argp);
3070 case SIOCGSTAMPNS: 3070 case SIOCGSTAMPNS:
3071 return do_siocgstampns(net, sock, cmd, argp); 3071 return do_siocgstampns(net, sock, cmd, argp);
3072/* Note SIOCRTMSG is no longer, so this is safe and
3073 * the user would have seen just an -EINVAL anyways. */
3074 case SIOCRTMSG:
3075 case SIOCGIFCOUNT:
3076 return -EINVAL;
3077 3072
3078 case FIOSETOWN: 3073 case FIOSETOWN:
3079 case SIOCSPGRP: 3074 case SIOCSPGRP:
@@ -3107,8 +3102,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3107 case SIOCSIFHWBROADCAST: 3102 case SIOCSIFHWBROADCAST:
3108 case SIOCSHWTSTAMP: 3103 case SIOCSHWTSTAMP:
3109 case SIOCDIFADDR: 3104 case SIOCDIFADDR:
3110/* case SIOCSARP: duplicate */
3111/* case SIOCDARP: duplicate */
3112 case SIOCGIFBRDADDR: 3105 case SIOCGIFBRDADDR:
3113 case SIOCSIFBRDADDR: 3106 case SIOCSIFBRDADDR:
3114 case SIOCGIFDSTADDR: 3107 case SIOCGIFDSTADDR:
@@ -3121,7 +3114,12 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3121 case SIOCSIFTXQLEN: 3114 case SIOCSIFTXQLEN:
3122 case SIOCBRADDIF: 3115 case SIOCBRADDIF:
3123 case SIOCBRDELIF: 3116 case SIOCBRDELIF:
3117 case SIOCSIFNAME:
3118 case SIOCGMIIPHY:
3119 case SIOCGMIIREG:
3120 case SIOCSMIIREG:
3124 return dev_ifsioc(net, sock, cmd, argp); 3121 return dev_ifsioc(net, sock, cmd, argp);
3122
3125 case ATM_GETLINKRATE32: 3123 case ATM_GETLINKRATE32:
3126 case ATM_GETNAMES32: 3124 case ATM_GETNAMES32:
3127 case ATM_GETTYPE32: 3125 case ATM_GETTYPE32:
@@ -3168,17 +3166,22 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3168 case SIOCSARP: 3166 case SIOCSARP:
3169 case SIOCGARP: 3167 case SIOCGARP:
3170 case SIOCDARP: 3168 case SIOCDARP:
3171
3172 case SIOCATMARK: 3169 case SIOCATMARK:
3173 case SIOCSIFLINK: 3170 return sock_do_ioctl(net, sock, cmd, arg);
3174 case SIOCSIFNAME: 3171 }
3172
3173 /* Prevent warning from compat_sys_ioctl, these always
3174 * result in -EINVAL in the native case anyway. */
3175 switch (cmd) {
3176 case SIOCRTMSG:
3177 case SIOCGIFCOUNT:
3175 case SIOCSRARP: 3178 case SIOCSRARP:
3176 case SIOCGRARP: 3179 case SIOCGRARP:
3177 case SIOCDRARP: 3180 case SIOCDRARP:
3178 case SIOCGMIIPHY: 3181 case SIOCSIFLINK:
3179 case SIOCGMIIREG: 3182 case SIOCGIFSLAVE:
3180 case SIOCSMIIREG: 3183 case SIOCSIFSLAVE:
3181 return sock_do_ioctl(net, sock, cmd, arg); 3184 return -EINVAL;
3182 } 3185 }
3183 3186
3184 return -ENOIOCTLCMD; 3187 return -ENOIOCTLCMD;