Commit d7b068e5 authored by Johannes Berg's avatar Johannes Berg Committed by Greg Kroah-Hartman

Revert "socket: fix struct ifreq size in compat ioctl"

[ Upstream commit 63ff03ab ]

This reverts commit 1cebf8f1 ("socket: fix struct ifreq
size in compat ioctl"), it's a bugfix for another commit that
I'll revert next.

This is not a 'perfect' revert, I'm keeping some coding style
intact rather than revert to the state with indentation errors.

Cc: [email protected]
Fixes: 1cebf8f1 ("socket: fix struct ifreq size in compat ioctl")
Signed-off-by: default avatarJohannes Berg <[email protected]>
Signed-off-by: default avatarDavid S. Miller <[email protected]>
Signed-off-by: default avatarGreg Kroah-Hartman <[email protected]>
parent 28f7d528
...@@ -941,8 +941,7 @@ void dlci_ioctl_set(int (*hook) (unsigned int, void __user *)) ...@@ -941,8 +941,7 @@ void dlci_ioctl_set(int (*hook) (unsigned int, void __user *))
EXPORT_SYMBOL(dlci_ioctl_set); EXPORT_SYMBOL(dlci_ioctl_set);
static long sock_do_ioctl(struct net *net, struct socket *sock, static long sock_do_ioctl(struct net *net, struct socket *sock,
unsigned int cmd, unsigned long arg, unsigned int cmd, unsigned long arg)
unsigned int ifreq_size)
{ {
int err; int err;
void __user *argp = (void __user *)arg; void __user *argp = (void __user *)arg;
...@@ -968,11 +967,11 @@ static long sock_do_ioctl(struct net *net, struct socket *sock, ...@@ -968,11 +967,11 @@ static long sock_do_ioctl(struct net *net, struct socket *sock,
} else { } else {
struct ifreq ifr; struct ifreq ifr;
bool need_copyout; bool need_copyout;
if (copy_from_user(&ifr, argp, ifreq_size)) if (copy_from_user(&ifr, argp, sizeof(struct ifreq)))
return -EFAULT; return -EFAULT;
err = dev_ioctl(net, cmd, &ifr, &need_copyout); err = dev_ioctl(net, cmd, &ifr, &need_copyout);
if (!err && need_copyout) if (!err && need_copyout)
if (copy_to_user(argp, &ifr, ifreq_size)) if (copy_to_user(argp, &ifr, sizeof(struct ifreq)))
return -EFAULT; return -EFAULT;
} }
return err; return err;
...@@ -1071,8 +1070,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) ...@@ -1071,8 +1070,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
err = open_related_ns(&net->ns, get_net_ns); err = open_related_ns(&net->ns, get_net_ns);
break; break;
default: default:
err = sock_do_ioctl(net, sock, cmd, arg, err = sock_do_ioctl(net, sock, cmd, arg);
sizeof(struct ifreq));
break; break;
} }
return err; return err;
...@@ -2750,8 +2748,7 @@ static int do_siocgstamp(struct net *net, struct socket *sock, ...@@ -2750,8 +2748,7 @@ static int do_siocgstamp(struct net *net, struct socket *sock,
int err; int err;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv, err = sock_do_ioctl(net, sock, cmd, (unsigned long)&ktv);
sizeof(struct compat_ifreq));
set_fs(old_fs); set_fs(old_fs);
if (!err) if (!err)
err = compat_put_timeval(&ktv, up); err = compat_put_timeval(&ktv, up);
...@@ -2767,8 +2764,7 @@ static int do_siocgstampns(struct net *net, struct socket *sock, ...@@ -2767,8 +2764,7 @@ static int do_siocgstampns(struct net *net, struct socket *sock,
int err; int err;
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts, err = sock_do_ioctl(net, sock, cmd, (unsigned long)&kts);
sizeof(struct compat_ifreq));
set_fs(old_fs); set_fs(old_fs);
if (!err) if (!err)
err = compat_put_timespec(&kts, up); err = compat_put_timespec(&kts, up);
...@@ -3079,8 +3075,7 @@ static int routing_ioctl(struct net *net, struct socket *sock, ...@@ -3079,8 +3075,7 @@ static int routing_ioctl(struct net *net, struct socket *sock,
} }
set_fs(KERNEL_DS); set_fs(KERNEL_DS);
ret = sock_do_ioctl(net, sock, cmd, (unsigned long) r, ret = sock_do_ioctl(net, sock, cmd, (unsigned long) r);
sizeof(struct compat_ifreq));
set_fs(old_fs); set_fs(old_fs);
out: out:
...@@ -3193,8 +3188,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, ...@@ -3193,8 +3188,7 @@ static int compat_sock_ioctl_trans(struct file *file, struct socket *sock,
case SIOCBONDSETHWADDR: case SIOCBONDSETHWADDR:
case SIOCBONDCHANGEACTIVE: case SIOCBONDCHANGEACTIVE:
case SIOCGIFNAME: case SIOCGIFNAME:
return sock_do_ioctl(net, sock, cmd, arg, return sock_do_ioctl(net, sock, cmd, arg);
sizeof(struct compat_ifreq));
} }
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