summaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-08-31 18:06:04 +0200
committerJakub Kicinski <kuba@kernel.org>2021-08-31 18:06:04 +0200
commit29ce8f9701072fc221d9c38ad952de1a9578f95c (patch)
tree054ead168bcd34a90ba924a22d94eeeffd79167c /net/socket.c
parentnet: Add depends on OF_NET for LiteX's LiteETH (diff)
parentatlantic: Fix driver resume flow. (diff)
downloadlinux-29ce8f9701072fc221d9c38ad952de1a9578f95c.tar.xz
linux-29ce8f9701072fc221d9c38ad952de1a9578f95c.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
include/linux/netdevice.h net/socket.c d0efb16294d1 ("net: don't unconditionally copy_from_user a struct ifreq for socket ioctls") 876f0bf9d0d5 ("net: socket: simplify dev_ifconf handling") 29c4964822aa ("net: socket: rework compat_ifreq_ioctl()") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 3c10504e46d9..83e7ac902f5e 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1124,6 +1124,9 @@ static long sock_do_ioctl(struct net *net, struct socket *sock,
if (err != -ENOIOCTLCMD)
return err;
+ if (!is_socket_ioctl_cmd(cmd))
+ return -ENOTTY;
+
if (get_user_ifreq(&ifr, &data, argp))
return -EFAULT;
err = dev_ioctl(net, cmd, &ifr, data, &need_copyout);
@@ -3218,6 +3221,8 @@ static int compat_ifr_data_ioctl(struct net *net, unsigned int cmd,
struct ifreq ifreq;
void __user *data;
+ if (!is_socket_ioctl_cmd(cmd))
+ return -ENOTTY;
if (get_user_ifreq(&ifreq, &data, u_ifreq32))
return -EFAULT;
ifreq.ifr_data = data;