mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 03:30:52 +07:00
[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>
This commit is contained in:
parent
c82e42da8a
commit
2f1936b877
@ -893,7 +893,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||
if (count == 0)
|
||||
goto out;
|
||||
|
||||
err = remove_suid(file->f_path.dentry);
|
||||
err = file_remove_suid(file);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
@ -2118,7 +2118,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,
|
||||
goto out;
|
||||
if (!count)
|
||||
goto out;
|
||||
err = remove_suid(file->f_path.dentry);
|
||||
err = file_remove_suid(file);
|
||||
if (err)
|
||||
goto out;
|
||||
file_update_time(file);
|
||||
|
@ -772,7 +772,7 @@ generic_file_splice_write_nolock(struct pipe_inode_info *pipe, struct file *out,
|
||||
ssize_t ret;
|
||||
int err;
|
||||
|
||||
err = remove_suid(out->f_path.dentry);
|
||||
err = file_remove_suid(out);
|
||||
if (unlikely(err))
|
||||
return err;
|
||||
|
||||
@ -830,7 +830,7 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
|
||||
ssize_t ret;
|
||||
|
||||
inode_double_lock(inode, pipe->inode);
|
||||
ret = remove_suid(out->f_path.dentry);
|
||||
ret = file_remove_suid(out);
|
||||
if (likely(!ret))
|
||||
ret = __splice_from_pipe(pipe, &sd, pipe_to_file);
|
||||
inode_double_unlock(inode, pipe->inode);
|
||||
|
@ -711,7 +711,7 @@ xfs_write(
|
||||
!capable(CAP_FSETID)) {
|
||||
error = xfs_write_clear_setuid(xip);
|
||||
if (likely(!error))
|
||||
error = -remove_suid(file->f_path.dentry);
|
||||
error = -file_remove_suid(file);
|
||||
if (unlikely(error)) {
|
||||
goto out_unlock_internal;
|
||||
}
|
||||
|
@ -1834,7 +1834,7 @@ extern void clear_inode(struct inode *);
|
||||
extern void destroy_inode(struct inode *);
|
||||
extern struct inode *new_inode(struct super_block *);
|
||||
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 remove_inode_hash(struct inode *);
|
||||
|
@ -1758,8 +1758,9 @@ static int __remove_suid(struct dentry *dentry, int kill)
|
||||
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 killpriv = security_inode_need_killpriv(dentry);
|
||||
int error = 0;
|
||||
@ -1773,7 +1774,7 @@ int remove_suid(struct dentry *dentry)
|
||||
|
||||
return error;
|
||||
}
|
||||
EXPORT_SYMBOL(remove_suid);
|
||||
EXPORT_SYMBOL(file_remove_suid);
|
||||
|
||||
static size_t __iovec_copy_from_user_inatomic(char *vaddr,
|
||||
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,
|
||||
if (count == 0)
|
||||
goto out;
|
||||
|
||||
err = remove_suid(file->f_path.dentry);
|
||||
err = file_remove_suid(file);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
|
@ -380,7 +380,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len,
|
||||
if (count == 0)
|
||||
goto out_backing;
|
||||
|
||||
ret = remove_suid(filp->f_path.dentry);
|
||||
ret = file_remove_suid(filp);
|
||||
if (ret)
|
||||
goto out_backing;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user