diff mbox series

[04/10] kill dev_ifsioc()

Message ID 20180118193755.19997-4-viro@ZenIV.linux.org.uk
State Accepted, archived
Delegated to: David Miller
Headers show
Series [01/10] net: separate SIOCGIFCONF handling from dev_ioctl() | expand

Commit Message

Al Viro Jan. 18, 2018, 7:37 p.m. UTC
From: Al Viro <viro@zeniv.linux.org.uk>

it's been equivalent to sock_do_ioctl() since 2009...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 net/socket.c | 38 --------------------------------------
 1 file changed, 38 deletions(-)

Comments

Christoph Hellwig Jan. 22, 2018, 4:47 p.m. UTC | #1
On Thu, Jan 18, 2018 at 07:37:49PM +0000, Al Viro wrote:
> From: Al Viro <viro@zeniv.linux.org.uk>
> 
> it's been equivalent to sock_do_ioctl() since 2009...
> 
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Note that we have two different dev_ifsioc() defintions, which
is a little weird.

But the net/socket.c one does indeed seem superflous as there is no
point in doing the compat_alloc_user_space / copy_in_user as far
as I can tell.  compat_ifreq differs from ifreq in the size of
ifru_data, but it seems none of these ioctls actually use it.

A better changelog would be nice, though.
diff mbox series

Patch

diff --git a/net/socket.c b/net/socket.c
index 112216c537e7..f280258bd6a4 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2915,42 +2915,6 @@  static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
 	return dev_ioctl(net, cmd, u_ifreq64);
 }
 
-static int dev_ifsioc(struct net *net, struct socket *sock,
-			 unsigned int cmd, struct compat_ifreq __user *uifr32)
-{
-	struct ifreq __user *uifr;
-	int err;
-
-	uifr = compat_alloc_user_space(sizeof(*uifr));
-	if (copy_in_user(uifr, uifr32, sizeof(*uifr32)))
-		return -EFAULT;
-
-	err = sock_do_ioctl(net, sock, cmd, (unsigned long)uifr);
-
-	if (!err) {
-		switch (cmd) {
-		case SIOCGIFFLAGS:
-		case SIOCGIFMETRIC:
-		case SIOCGIFMTU:
-		case SIOCGIFMEM:
-		case SIOCGIFHWADDR:
-		case SIOCGIFINDEX:
-		case SIOCGIFADDR:
-		case SIOCGIFBRDADDR:
-		case SIOCGIFDSTADDR:
-		case SIOCGIFNETMASK:
-		case SIOCGIFPFLAGS:
-		case SIOCGIFTXQLEN:
-		case SIOCGMIIPHY:
-		case SIOCGMIIREG:
-			if (copy_in_user(uifr32, uifr, sizeof(*uifr32)))
-				err = -EFAULT;
-			break;
-		}
-	}
-	return err;
-}
-
 static int compat_sioc_ifmap(struct net *net, unsigned int cmd,
 			struct compat_ifreq __user *uifr32)
 {
@@ -3181,8 +3145,6 @@  static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
 	case SIOCGMIIPHY:
 	case SIOCGMIIREG:
 	case SIOCSMIIREG:
-		return dev_ifsioc(net, sock, cmd, argp);
-
 	case SIOCSARP:
 	case SIOCGARP:
 	case SIOCDARP: