mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
switch fchmod(2) to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
6b48c5b207
commit
d6483b7a78
12
fs/open.c
12
fs/open.c
@ -582,23 +582,21 @@ SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group
|
|||||||
|
|
||||||
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
|
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
|
||||||
{
|
{
|
||||||
struct file * file;
|
struct file *file;
|
||||||
int error = -EBADF;
|
int error = -EBADF, fput_needed;
|
||||||
struct dentry * dentry;
|
|
||||||
|
|
||||||
file = fget(fd);
|
file = fget_light(fd, &fput_needed);
|
||||||
if (!file)
|
if (!file)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
error = mnt_want_write_file(file);
|
error = mnt_want_write_file(file);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_fput;
|
goto out_fput;
|
||||||
dentry = file->f_path.dentry;
|
audit_inode(NULL, file->f_path.dentry);
|
||||||
audit_inode(NULL, dentry);
|
|
||||||
error = chown_common(&file->f_path, user, group);
|
error = chown_common(&file->f_path, user, group);
|
||||||
mnt_drop_write_file(file);
|
mnt_drop_write_file(file);
|
||||||
out_fput:
|
out_fput:
|
||||||
fput(file);
|
fput_light(file, fput_needed);
|
||||||
out:
|
out:
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user