Commit 2f1936b87783a3a56c9441b27b9ba7a747f11e8e

Authored by Miklos Szeredi
Committed by Al Viro
1 parent c82e42da8a

[patch 3/5] vfs: change remove_suid() to file_remove_suid()

All calls to remove_suid() are made with a file pointer, because
(similarly to file_update_time) it is called when the file is written.

Clean up callers by passing in a file instead of a dentry.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

Showing 7 changed files with 11 additions and 10 deletions Side-by-side Diff

... ... @@ -893,7 +893,7 @@
893 893 if (count == 0)
894 894 goto out;
895 895  
896   - err = remove_suid(file->f_path.dentry);
  896 + err = file_remove_suid(file);
897 897 if (err)
898 898 goto out;
899 899  
... ... @@ -2118,7 +2118,7 @@
2118 2118 goto out;
2119 2119 if (!count)
2120 2120 goto out;
2121   - err = remove_suid(file->f_path.dentry);
  2121 + err = file_remove_suid(file);
2122 2122 if (err)
2123 2123 goto out;
2124 2124 file_update_time(file);
... ... @@ -772,7 +772,7 @@
772 772 ssize_t ret;
773 773 int err;
774 774  
775   - err = remove_suid(out->f_path.dentry);
  775 + err = file_remove_suid(out);
776 776 if (unlikely(err))
777 777 return err;
778 778  
... ... @@ -830,7 +830,7 @@
830 830 ssize_t ret;
831 831  
832 832 inode_double_lock(inode, pipe->inode);
833   - ret = remove_suid(out->f_path.dentry);
  833 + ret = file_remove_suid(out);
834 834 if (likely(!ret))
835 835 ret = __splice_from_pipe(pipe, &sd, pipe_to_file);
836 836 inode_double_unlock(inode, pipe->inode);
fs/xfs/linux-2.6/xfs_lrw.c
... ... @@ -711,7 +711,7 @@
711 711 !capable(CAP_FSETID)) {
712 712 error = xfs_write_clear_setuid(xip);
713 713 if (likely(!error))
714   - error = -remove_suid(file->f_path.dentry);
  714 + error = -file_remove_suid(file);
715 715 if (unlikely(error)) {
716 716 goto out_unlock_internal;
717 717 }
... ... @@ -1834,7 +1834,7 @@
1834 1834 extern void destroy_inode(struct inode *);
1835 1835 extern struct inode *new_inode(struct super_block *);
1836 1836 extern int should_remove_suid(struct dentry *);
1837   -extern int remove_suid(struct dentry *);
  1837 +extern int file_remove_suid(struct file *);
1838 1838  
1839 1839 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1840 1840 extern void remove_inode_hash(struct inode *);
... ... @@ -1758,8 +1758,9 @@
1758 1758 return notify_change(dentry, &newattrs);
1759 1759 }
1760 1760  
1761   -int remove_suid(struct dentry *dentry)
  1761 +int file_remove_suid(struct file *file)
1762 1762 {
  1763 + struct dentry *dentry = file->f_path.dentry;
1763 1764 int killsuid = should_remove_suid(dentry);
1764 1765 int killpriv = security_inode_need_killpriv(dentry);
1765 1766 int error = 0;
... ... @@ -1773,7 +1774,7 @@
1773 1774  
1774 1775 return error;
1775 1776 }
1776   -EXPORT_SYMBOL(remove_suid);
  1777 +EXPORT_SYMBOL(file_remove_suid);
1777 1778  
1778 1779 static size_t __iovec_copy_from_user_inatomic(char *vaddr,
1779 1780 const struct iovec *iov, size_t base, size_t bytes)
... ... @@ -2529,7 +2530,7 @@
2529 2530 if (count == 0)
2530 2531 goto out;
2531 2532  
2532   - err = remove_suid(file->f_path.dentry);
  2533 + err = file_remove_suid(file);
2533 2534 if (err)
2534 2535 goto out;
2535 2536  
... ... @@ -380,7 +380,7 @@
380 380 if (count == 0)
381 381 goto out_backing;
382 382  
383   - ret = remove_suid(filp->f_path.dentry);
  383 + ret = file_remove_suid(filp);
384 384 if (ret)
385 385 goto out_backing;
386 386