mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
a5b470ba06
commit
2903ff019b
44 changed files with 633 additions and 763 deletions
32
fs/fcntl.c
32
fs/fcntl.c
|
|
@ -348,25 +348,23 @@ static int check_fcntl_cmd(unsigned cmd)
|
|||
|
||||
SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
|
||||
{
|
||||
struct file *filp;
|
||||
int fput_needed;
|
||||
struct fd f = fdget_raw(fd);
|
||||
long err = -EBADF;
|
||||
|
||||
filp = fget_raw_light(fd, &fput_needed);
|
||||
if (!filp)
|
||||
if (!f.file)
|
||||
goto out;
|
||||
|
||||
if (unlikely(filp->f_mode & FMODE_PATH)) {
|
||||
if (unlikely(f.file->f_mode & FMODE_PATH)) {
|
||||
if (!check_fcntl_cmd(cmd))
|
||||
goto out1;
|
||||
}
|
||||
|
||||
err = security_file_fcntl(filp, cmd, arg);
|
||||
err = security_file_fcntl(f.file, cmd, arg);
|
||||
if (!err)
|
||||
err = do_fcntl(fd, cmd, arg, filp);
|
||||
err = do_fcntl(fd, cmd, arg, f.file);
|
||||
|
||||
out1:
|
||||
fput_light(filp, fput_needed);
|
||||
fdput(f);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
|
@ -375,38 +373,36 @@ out:
|
|||
SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
|
||||
unsigned long, arg)
|
||||
{
|
||||
struct file * filp;
|
||||
struct fd f = fdget_raw(fd);
|
||||
long err = -EBADF;
|
||||
int fput_needed;
|
||||
|
||||
filp = fget_raw_light(fd, &fput_needed);
|
||||
if (!filp)
|
||||
if (!f.file)
|
||||
goto out;
|
||||
|
||||
if (unlikely(filp->f_mode & FMODE_PATH)) {
|
||||
if (unlikely(f.file->f_mode & FMODE_PATH)) {
|
||||
if (!check_fcntl_cmd(cmd))
|
||||
goto out1;
|
||||
}
|
||||
|
||||
err = security_file_fcntl(filp, cmd, arg);
|
||||
err = security_file_fcntl(f.file, cmd, arg);
|
||||
if (err)
|
||||
goto out1;
|
||||
|
||||
switch (cmd) {
|
||||
case F_GETLK64:
|
||||
err = fcntl_getlk64(filp, (struct flock64 __user *) arg);
|
||||
err = fcntl_getlk64(f.file, (struct flock64 __user *) arg);
|
||||
break;
|
||||
case F_SETLK64:
|
||||
case F_SETLKW64:
|
||||
err = fcntl_setlk64(fd, filp, cmd,
|
||||
err = fcntl_setlk64(fd, f.file, cmd,
|
||||
(struct flock64 __user *) arg);
|
||||
break;
|
||||
default:
|
||||
err = do_fcntl(fd, cmd, arg, filp);
|
||||
err = do_fcntl(fd, cmd, arg, f.file);
|
||||
break;
|
||||
}
|
||||
out1:
|
||||
fput_light(filp, fput_needed);
|
||||
fdput(f);
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue