aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2013-11-18 12:04:58 -0500
committerBen Hutchings <bhutchings@solarflare.com>2013-11-18 18:50:12 -0500
commit417c3522b3202dacce4873cfb0190459fbce95c5 (patch)
treed5b85dd1d60098c6231bfef3af00a4a176fb2a70 /net/socket.c
parente1bd1dc207dae92cdb5b424226f89d1b4e4bb182 (diff)
net/compat: Fix minor information leak in siocdevprivate_ioctl()
We don't need to check that ifr_data itself is a valid user pointer, but we should check &ifr_data is. Thankfully the copy of ifr_name is checked, so this can only leak a few bytes from immediately above the user address limit. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/socket.c b/net/socket.c
index c226aceee65b..fbb6ec13b1f4 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -3015,19 +3015,16 @@ static int siocdevprivate_ioctl(struct net *net, unsigned int cmd,
3015 if (copy_from_user(&tmp_buf[0], &(u_ifreq32->ifr_ifrn.ifrn_name[0]), 3015 if (copy_from_user(&tmp_buf[0], &(u_ifreq32->ifr_ifrn.ifrn_name[0]),
3016 IFNAMSIZ)) 3016 IFNAMSIZ))
3017 return -EFAULT; 3017 return -EFAULT;
3018 if (__get_user(data32, &u_ifreq32->ifr_ifru.ifru_data)) 3018 if (get_user(data32, &u_ifreq32->ifr_ifru.ifru_data))
3019 return -EFAULT; 3019 return -EFAULT;
3020 data64 = compat_ptr(data32); 3020 data64 = compat_ptr(data32);
3021 3021
3022 u_ifreq64 = compat_alloc_user_space(sizeof(*u_ifreq64)); 3022 u_ifreq64 = compat_alloc_user_space(sizeof(*u_ifreq64));
3023 3023
3024 /* Don't check these user accesses, just let that get trapped
3025 * in the ioctl handler instead.
3026 */
3027 if (copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0], 3024 if (copy_to_user(&u_ifreq64->ifr_ifrn.ifrn_name[0], &tmp_buf[0],
3028 IFNAMSIZ)) 3025 IFNAMSIZ))
3029 return -EFAULT; 3026 return -EFAULT;
3030 if (__put_user(data64, &u_ifreq64->ifr_ifru.ifru_data)) 3027 if (put_user(data64, &u_ifreq64->ifr_ifru.ifru_data))
3031 return -EFAULT; 3028 return -EFAULT;
3032 3029
3033 return dev_ioctl(net, cmd, u_ifreq64); 3030 return dev_ioctl(net, cmd, u_ifreq64);