diff options
Diffstat (limited to 'fs/ioctl.c')
| -rw-r--r-- | fs/ioctl.c | 23 | 
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c index 29167bebe87..3bdad6d1f26 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c @@ -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; +	int error; +	struct fd f = fdget(fd); -	error = do_vfs_ioctl(filp, fd, cmd, arg); - out_fput: -	fput_light(filp, fput_needed); - out: +	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;  }  |