aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-09-30 19:31:15 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2018-01-24 19:13:45 -0500
commitbf4405737f9f85a06db2b0ce5d76a818b61992e2 (patch)
treecea62cbe494ab18cc187f590aefe66f3914abfba /net/socket.c
parentca25c30040f93c127ff1651aa636c0174f1e0cdb (diff)
kill dev_ifsioc()
Once upon a time net/socket.c:dev_ifsioc() used to handle SIOCSHWTSTAMP and SIOCSIFMAP. These have different native and compat layout, so the format conversion had been needed. In 2009 these two cases had been taken out, turning the rest into a convoluted way to calling sock_do_ioctl(). We copy compat structure into native one, call sock_do_ioctl() on that and copy the result back for the in/out ioctls. No layout transformation anywhere, so we might as well just call sock_do_ioctl() and skip all the headache with copying. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/net/socket.c b/net/socket.c
index 96e5b23a2a2e..fd593a86fa76 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2906,42 +2906,6 @@ static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
2906 return dev_ioctl(net, cmd, u_ifreq64); 2906 return dev_ioctl(net, cmd, u_ifreq64);
2907} 2907}
2908 2908
2909static int dev_ifsioc(struct net *net, struct socket *sock,
2910 unsigned int cmd, struct compat_ifreq __user *uifr32)
2911{
2912 struct ifreq __user *uifr;
2913 int err;
2914
2915 uifr = compat_alloc_user_space(sizeof(*uifr));
2916 if (copy_in_user(uifr, uifr32, sizeof(*uifr32)))
2917 return -EFAULT;
2918
2919 err = sock_do_ioctl(net, sock, cmd, (unsigned long)uifr);
2920
2921 if (!err) {
2922 switch (cmd) {
2923 case SIOCGIFFLAGS:
2924 case SIOCGIFMETRIC:
2925 case SIOCGIFMTU:
2926 case SIOCGIFMEM:
2927 case SIOCGIFHWADDR:
2928 case SIOCGIFINDEX:
2929 case SIOCGIFADDR:
2930 case SIOCGIFBRDADDR:
2931 case SIOCGIFDSTADDR:
2932 case SIOCGIFNETMASK:
2933 case SIOCGIFPFLAGS:
2934 case SIOCGIFTXQLEN:
2935 case SIOCGMIIPHY:
2936 case SIOCGMIIREG:
2937 if (copy_in_user(uifr32, uifr, sizeof(*uifr32)))
2938 err = -EFAULT;
2939 break;
2940 }
2941 }
2942 return err;
2943}
2944
2945static int compat_sioc_ifmap(struct net *net, unsigned int cmd, 2909static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
2946 struct compat_ifreq __user *uifr32) 2910 struct compat_ifreq __user *uifr32)
2947{ 2911{
@@ -3172,8 +3136,6 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
3172 case SIOCGMIIPHY: 3136 case SIOCGMIIPHY:
3173 case SIOCGMIIREG: 3137 case SIOCGMIIREG:
3174 case SIOCSMIIREG: 3138 case SIOCSMIIREG:
3175 return dev_ifsioc(net, sock, cmd, argp);
3176
3177 case SIOCSARP: 3139 case SIOCSARP:
3178 case SIOCGARP: 3140 case SIOCGARP:
3179 case SIOCDARP: 3141 case SIOCDARP: