Commit 9177efd3 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

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: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6b96018b
...@@ -3069,11 +3069,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3069,11 +3069,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
return do_siocgstamp(net, sock, cmd, argp); return do_siocgstamp(net, sock, cmd, argp);
case SIOCGSTAMPNS: case SIOCGSTAMPNS:
return do_siocgstampns(net, sock, cmd, argp); return do_siocgstampns(net, sock, cmd, argp);
/* Note SIOCRTMSG is no longer, so this is safe and
* the user would have seen just an -EINVAL anyways. */
case SIOCRTMSG:
case SIOCGIFCOUNT:
return -EINVAL;
case FIOSETOWN: case FIOSETOWN:
case SIOCSPGRP: case SIOCSPGRP:
...@@ -3107,8 +3102,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3107,8 +3102,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
case SIOCSIFHWBROADCAST: case SIOCSIFHWBROADCAST:
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
case SIOCDIFADDR: case SIOCDIFADDR:
/* case SIOCSARP: duplicate */
/* case SIOCDARP: duplicate */
case SIOCGIFBRDADDR: case SIOCGIFBRDADDR:
case SIOCSIFBRDADDR: case SIOCSIFBRDADDR:
case SIOCGIFDSTADDR: case SIOCGIFDSTADDR:
...@@ -3121,7 +3114,12 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3121,7 +3114,12 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
case SIOCSIFTXQLEN: case SIOCSIFTXQLEN:
case SIOCBRADDIF: case SIOCBRADDIF:
case SIOCBRDELIF: case SIOCBRDELIF:
case SIOCSIFNAME:
case SIOCGMIIPHY:
case SIOCGMIIREG:
case SIOCSMIIREG:
return dev_ifsioc(net, sock, cmd, argp); return dev_ifsioc(net, sock, cmd, argp);
case ATM_GETLINKRATE32: case ATM_GETLINKRATE32:
case ATM_GETNAMES32: case ATM_GETNAMES32:
case ATM_GETTYPE32: case ATM_GETTYPE32:
...@@ -3168,17 +3166,22 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3168,17 +3166,22 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
case SIOCSARP: case SIOCSARP:
case SIOCGARP: case SIOCGARP:
case SIOCDARP: case SIOCDARP:
case SIOCATMARK: case SIOCATMARK:
case SIOCSIFLINK: return sock_do_ioctl(net, sock, cmd, arg);
case SIOCSIFNAME: }
/* 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 SIOCSRARP:
case SIOCGRARP: case SIOCGRARP:
case SIOCDRARP: case SIOCDRARP:
case SIOCGMIIPHY: case SIOCSIFLINK:
case SIOCGMIIREG: case SIOCGIFSLAVE:
case SIOCSMIIREG: case SIOCSIFSLAVE:
return sock_do_ioctl(net, sock, cmd, arg); return -EINVAL;
} }
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
......
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