diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-06-24 10:50:14 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-07-26 20:53:16 -0400 |
commit | 2f1936b87783a3a56c9441b27b9ba7a747f11e8e (patch) | |
tree | 024a0f3da74ba6365f209d03685133760146149b | |
parent | c82e42da8a6b2f3a85dc4d4278cb8238702f8f64 (diff) |
[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>
-rw-r--r-- | fs/fuse/file.c | 2 | ||||
-rw-r--r-- | fs/ntfs/file.c | 2 | ||||
-rw-r--r-- | fs/splice.c | 4 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | mm/filemap.c | 7 | ||||
-rw-r--r-- | mm/filemap_xip.c | 2 |
7 files changed, 11 insertions, 10 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 67ff2c6a8f63..2bada6bbc317 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -893,7 +893,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
893 | if (count == 0) | 893 | if (count == 0) |
894 | goto out; | 894 | goto out; |
895 | 895 | ||
896 | err = remove_suid(file->f_path.dentry); | 896 | err = file_remove_suid(file); |
897 | if (err) | 897 | if (err) |
898 | goto out; | 898 | goto out; |
899 | 899 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 3c5550cd11d6..d020866d4232 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2118,7 +2118,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, | |||
2118 | goto out; | 2118 | goto out; |
2119 | if (!count) | 2119 | if (!count) |
2120 | goto out; | 2120 | goto out; |
2121 | err = remove_suid(file->f_path.dentry); | 2121 | err = file_remove_suid(file); |
2122 | if (err) | 2122 | if (err) |
2123 | goto out; | 2123 | goto out; |
2124 | file_update_time(file); | 2124 | file_update_time(file); |
diff --git a/fs/splice.c b/fs/splice.c index 47dc1a445d1f..b30311ba8af6 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -772,7 +772,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out, | |||
772 | ssize_t ret; | 772 | ssize_t ret; |
773 | int err; | 773 | int err; |
774 | 774 | ||
775 | err = remove_suid(out->f_path.dentry); | 775 | err = file_remove_suid(out); |
776 | if (unlikely(err)) | 776 | if (unlikely(err)) |
777 | return err; | 777 | return err; |
778 | 778 | ||
@@ -830,7 +830,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
830 | ssize_t ret; | 830 | ssize_t ret; |
831 | 831 | ||
832 | inode_double_lock(inode, pipe->inode); | 832 | inode_double_lock(inode, pipe->inode); |
833 | ret = remove_suid(out->f_path.dentry); | 833 | ret = file_remove_suid(out); |
834 | if (likely(!ret)) | 834 | if (likely(!ret)) |
835 | ret = __splice_from_pipe(pipe, &sd, pipe_to_file); | 835 | ret = __splice_from_pipe(pipe, &sd, pipe_to_file); |
836 | inode_double_unlock(inode, pipe->inode); | 836 | inode_double_unlock(inode, pipe->inode); |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 5e3b57516ec7..82333b3e118e 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -711,7 +711,7 @@ start: | |||
711 | !capable(CAP_FSETID)) { | 711 | !capable(CAP_FSETID)) { |
712 | error = xfs_write_clear_setuid(xip); | 712 | error = xfs_write_clear_setuid(xip); |
713 | if (likely(!error)) | 713 | if (likely(!error)) |
714 | error = -remove_suid(file->f_path.dentry); | 714 | error = -file_remove_suid(file); |
715 | if (unlikely(error)) { | 715 | if (unlikely(error)) { |
716 | goto out_unlock_internal; | 716 | goto out_unlock_internal; |
717 | } | 717 | } |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6c923c9b79bc..1a3546e69f9e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1834,7 +1834,7 @@ extern void clear_inode(struct inode *); | |||
1834 | extern void destroy_inode(struct inode *); | 1834 | extern void destroy_inode(struct inode *); |
1835 | extern struct inode *new_inode(struct super_block *); | 1835 | extern struct inode *new_inode(struct super_block *); |
1836 | extern int should_remove_suid(struct dentry *); | 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 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1839 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1840 | extern void remove_inode_hash(struct inode *); | 1840 | extern void remove_inode_hash(struct inode *); |
diff --git a/mm/filemap.c b/mm/filemap.c index 2ed8b0389c51..5de7633e1dbe 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1758,8 +1758,9 @@ static int __remove_suid(struct dentry *dentry, int kill) | |||
1758 | return notify_change(dentry, &newattrs); | 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 | int killsuid = should_remove_suid(dentry); | 1764 | int killsuid = should_remove_suid(dentry); |
1764 | int killpriv = security_inode_need_killpriv(dentry); | 1765 | int killpriv = security_inode_need_killpriv(dentry); |
1765 | int error = 0; | 1766 | int error = 0; |
@@ -1773,7 +1774,7 @@ int remove_suid(struct dentry *dentry) | |||
1773 | 1774 | ||
1774 | return error; | 1775 | return error; |
1775 | } | 1776 | } |
1776 | EXPORT_SYMBOL(remove_suid); | 1777 | EXPORT_SYMBOL(file_remove_suid); |
1777 | 1778 | ||
1778 | static size_t __iovec_copy_from_user_inatomic(char *vaddr, | 1779 | static size_t __iovec_copy_from_user_inatomic(char *vaddr, |
1779 | const struct iovec *iov, size_t base, size_t bytes) | 1780 | const struct iovec *iov, size_t base, size_t bytes) |
@@ -2529,7 +2530,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov, | |||
2529 | if (count == 0) | 2530 | if (count == 0) |
2530 | goto out; | 2531 | goto out; |
2531 | 2532 | ||
2532 | err = remove_suid(file->f_path.dentry); | 2533 | err = file_remove_suid(file); |
2533 | if (err) | 2534 | if (err) |
2534 | goto out; | 2535 | goto out; |
2535 | 2536 | ||
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index 3e744abcce9d..98a3f31ccd6a 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -380,7 +380,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
380 | if (count == 0) | 380 | if (count == 0) |
381 | goto out_backing; | 381 | goto out_backing; |
382 | 382 | ||
383 | ret = remove_suid(filp->f_path.dentry); | 383 | ret = file_remove_suid(filp); |
384 | if (ret) | 384 | if (ret) |
385 | goto out_backing; | 385 | goto out_backing; |
386 | 386 | ||