switch simple cases of fget_light to fdget
[linux-2.6-block.git] / fs / ioctl.c
index 29167bebe874049fb847e1f19c2ae220f4ce91f0..3bdad6d1f26844b29c5911396876742f23088140 100644 (file)
@@ -603,21 +603,14 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
 
 SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
 {
-       struct file *filp;
-       int error = -EBADF;
-       int fput_needed;
-
-       filp = fget_light(fd, &fput_needed);
-       if (!filp)
-               goto out;
-
-       error = security_file_ioctl(filp, cmd, arg);
-       if (error)
-               goto out_fput;
-
-       error = do_vfs_ioctl(filp, fd, cmd, arg);
- out_fput:
-       fput_light(filp, fput_needed);
- out:
+       int error;
+       struct fd f = fdget(fd);
+
+       if (!f.file)
+               return -EBADF;
+       error = security_file_ioctl(f.file, cmd, arg);
+       if (!error)
+               error = do_vfs_ioctl(f.file, fd, cmd, arg);
+       fdput(f);
        return error;
 }