diff options
-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 | } |