diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-08-31 09:06:04 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2021-08-31 09:06:04 -0700 |
commit | 29ce8f9701072fc221d9c38ad952de1a9578f95c (patch) | |
tree | 054ead168bcd34a90ba924a22d94eeeffd79167c /net/socket.c | |
parent | c3496da580b0fc10fdeba8f6a5e6aef4c78b5598 (diff) | |
parent | 57f780f1c43362b86fd23d20bd940e2468237716 (diff) | |
download | lwn-29ce8f9701072fc221d9c38ad952de1a9578f95c.tar.gz lwn-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.c | 5 |
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; |