diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/splice.c b/fs/splice.c index 59a941d404d9..6bdcb6107bc3 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -824,13 +824,18 @@ generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, | |||
824 | { | 824 | { |
825 | struct address_space *mapping = out->f_mapping; | 825 | struct address_space *mapping = out->f_mapping; |
826 | struct inode *inode = mapping->host; | 826 | struct inode *inode = mapping->host; |
827 | int killsuid, killpriv; | ||
827 | ssize_t ret; | 828 | ssize_t ret; |
828 | int err; | 829 | int err = 0; |
829 | 830 | ||
830 | err = should_remove_suid(out->f_path.dentry); | 831 | killpriv = security_inode_need_killpriv(out->f_path.dentry); |
831 | if (unlikely(err)) { | 832 | killsuid = should_remove_suid(out->f_path.dentry); |
833 | if (unlikely(killsuid || killpriv)) { | ||
832 | mutex_lock(&inode->i_mutex); | 834 | mutex_lock(&inode->i_mutex); |
833 | err = __remove_suid(out->f_path.dentry, err); | 835 | if (killpriv) |
836 | err = security_inode_killpriv(out->f_path.dentry); | ||
837 | if (!err && killsuid) | ||
838 | err = __remove_suid(out->f_path.dentry, killsuid); | ||
834 | mutex_unlock(&inode->i_mutex); | 839 | mutex_unlock(&inode->i_mutex); |
835 | if (err) | 840 | if (err) |
836 | return err; | 841 | return err; |