aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-09-12 05:37:03 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:03 -0400
commit32da477a5bfe96b6dfc8960e0d22d89ca09fd10a (patch)
treef4a8e5ec43d0a5ba85a66f12cd23c09a2ab689a7 /fs/compat_ioctl.c
parent890d52d3f1e28888c4122e120426588f5ad63d37 (diff)
[NET]: Don't implement dev_ifname32 inline
The current implementation of dev_ifname makes maintenance difficult because updates to the implementation of the ioctl have to made in two places. So this patch updates dev_ifname32 to do a classic 32/64 structure conversion and call sys_ioctl like the rest of the compat calls do. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 37310b0e8107..d917e4a26a43 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -324,22 +324,21 @@ struct ifconf32 {
324 324
325static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg) 325static int dev_ifname32(unsigned int fd, unsigned int cmd, unsigned long arg)
326{ 326{
327 struct net_device *dev; 327 struct ifreq __user *uifr;
328 struct ifreq32 ifr32;
329 int err; 328 int err;
330 329
331 if (copy_from_user(&ifr32, compat_ptr(arg), sizeof(ifr32))) 330 uifr = compat_alloc_user_space(sizeof(struct ifreq));
331 if (copy_in_user(uifr, compat_ptr(arg), sizeof(struct ifreq32)));
332 return -EFAULT; 332 return -EFAULT;
333 333
334 dev = dev_get_by_index(ifr32.ifr_ifindex); 334 err = sys_ioctl(fd, SIOCGIFNAME, (unsigned long)uifr);
335 if (!dev) 335 if (err)
336 return -ENODEV; 336 return err;
337 337
338 strlcpy(ifr32.ifr_name, dev->name, sizeof(ifr32.ifr_name)); 338 if (copy_in_user(compat_ptr(arg), uifr, sizeof(struct ifreq32)))
339 dev_put(dev); 339 return -EFAULT;
340 340
341 err = copy_to_user(compat_ptr(arg), &ifr32, sizeof(ifr32)); 341 return 0;
342 return (err ? -EFAULT : 0);
343} 342}
344 343
345static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg) 344static int dev_ifconf(unsigned int fd, unsigned int cmd, unsigned long arg)