Commit 2f1936b8 authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Al Viro

[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: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent c82e42da
...@@ -893,7 +893,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov, ...@@ -893,7 +893,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
if (count == 0) if (count == 0)
goto out; goto out;
err = remove_suid(file->f_path.dentry); err = file_remove_suid(file);
if (err) if (err)
goto out; goto out;
......
...@@ -2118,7 +2118,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, ...@@ -2118,7 +2118,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,
goto out; goto out;
if (!count) if (!count)
goto out; goto out;
err = remove_suid(file->f_path.dentry); err = file_remove_suid(file);
if (err) if (err)
goto out; goto out;
file_update_time(file); file_update_time(file);
......
...@@ -772,7 +772,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out, ...@@ -772,7 +772,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret; ssize_t ret;
int err; int err;
err = remove_suid(out->f_path.dentry); err = file_remove_suid(out);
if (unlikely(err)) if (unlikely(err))
return err; return err;
...@@ -830,7 +830,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, ...@@ -830,7 +830,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
ssize_t ret; ssize_t ret;
inode_double_lock(inode, pipe->inode); inode_double_lock(inode, pipe->inode);
ret = remove_suid(out->f_path.dentry); ret = file_remove_suid(out);
if (likely(!ret)) if (likely(!ret))
ret = __splice_from_pipe(pipe, &sd, pipe_to_file); ret = __splice_from_pipe(pipe, &sd, pipe_to_file);
inode_double_unlock(inode, pipe->inode); inode_double_unlock(inode, pipe->inode);
......
...@@ -711,7 +711,7 @@ start: ...@@ -711,7 +711,7 @@ start:
!capable(CAP_FSETID)) { !capable(CAP_FSETID)) {
error = xfs_write_clear_setuid(xip); error = xfs_write_clear_setuid(xip);
if (likely(!error)) if (likely(!error))
error = -remove_suid(file->f_path.dentry); error = -file_remove_suid(file);
if (unlikely(error)) { if (unlikely(error)) {
goto out_unlock_internal; goto out_unlock_internal;
} }
......
...@@ -1834,7 +1834,7 @@ extern void clear_inode(struct inode *); ...@@ -1834,7 +1834,7 @@ extern void clear_inode(struct inode *);
extern void destroy_inode(struct inode *); extern void destroy_inode(struct inode *);
extern struct inode *new_inode(struct super_block *); extern struct inode *new_inode(struct super_block *);
extern int should_remove_suid(struct dentry *); extern int should_remove_suid(struct dentry *);
extern int remove_suid(struct dentry *); extern int file_remove_suid(struct file *);
extern void __insert_inode_hash(struct inode *, unsigned long hashval); extern void __insert_inode_hash(struct inode *, unsigned long hashval);
extern void remove_inode_hash(struct inode *); extern void remove_inode_hash(struct inode *);
......
...@@ -1758,8 +1758,9 @@ static int __remove_suid(struct dentry *dentry, int kill) ...@@ -1758,8 +1758,9 @@ static int __remove_suid(struct dentry *dentry, int kill)
return notify_change(dentry, &newattrs); return notify_change(dentry, &newattrs);
} }
int remove_suid(struct dentry *dentry) int file_remove_suid(struct file *file)
{ {
struct dentry *dentry = file->f_path.dentry;
int killsuid = should_remove_suid(dentry); int killsuid = should_remove_suid(dentry);
int killpriv = security_inode_need_killpriv(dentry); int killpriv = security_inode_need_killpriv(dentry);
int error = 0; int error = 0;
...@@ -1773,7 +1774,7 @@ int remove_suid(struct dentry *dentry) ...@@ -1773,7 +1774,7 @@ int remove_suid(struct dentry *dentry)
return error; return error;
} }
EXPORT_SYMBOL(remove_suid); EXPORT_SYMBOL(file_remove_suid);
static size_t __iovec_copy_from_user_inatomic(char *vaddr, static size_t __iovec_copy_from_user_inatomic(char *vaddr,
const struct iovec *iov, size_t base, size_t bytes) 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,7 +2530,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
if (count == 0) if (count == 0)
goto out; goto out;
err = remove_suid(file->f_path.dentry); err = file_remove_suid(file);
if (err) if (err)
goto out; goto out;
......
...@@ -380,7 +380,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, ...@@ -380,7 +380,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len,
if (count == 0) if (count == 0)
goto out_backing; goto out_backing;
ret = remove_suid(filp->f_path.dentry); ret = file_remove_suid(filp);
if (ret) if (ret)
goto out_backing; goto out_backing;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment