diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-26 20:22:10 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 21:10:03 -0400 |
commit | d6483b7a78438bc333560d11b69e6a6a6cf55940 (patch) | |
tree | 86111580d45c0d1cad04809c7f619b4d04107d1a /fs/open.c | |
parent | 6b48c5b2079af1f81d8f249ae07a988d8c45b32f (diff) |
switch fchmod(2) to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -582,23 +582,21 @@ SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group | |||
582 | 582 | ||
583 | SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) | 583 | SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group) |
584 | { | 584 | { |
585 | struct file * file; | 585 | struct file *file; |
586 | int error = -EBADF; | 586 | int error = -EBADF, fput_needed; |
587 | struct dentry * dentry; | ||
588 | 587 | ||
589 | file = fget(fd); | 588 | file = fget_light(fd, &fput_needed); |
590 | if (!file) | 589 | if (!file) |
591 | goto out; | 590 | goto out; |
592 | 591 | ||
593 | error = mnt_want_write_file(file); | 592 | error = mnt_want_write_file(file); |
594 | if (error) | 593 | if (error) |
595 | goto out_fput; | 594 | goto out_fput; |
596 | dentry = file->f_path.dentry; | 595 | audit_inode(NULL, file->f_path.dentry); |
597 | audit_inode(NULL, dentry); | ||
598 | error = chown_common(&file->f_path, user, group); | 596 | error = chown_common(&file->f_path, user, group); |
599 | mnt_drop_write_file(file); | 597 | mnt_drop_write_file(file); |
600 | out_fput: | 598 | out_fput: |
601 | fput(file); | 599 | fput_light(file, fput_needed); |
602 | out: | 600 | out: |
603 | return error; | 601 | return error; |
604 | } | 602 | } |