X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=fs%2Fremap_range.c;h=e4a5fdd7ad7b095dd089477f361c7c8d7f0fc653;hb=470ec4ed8c91b4db398ad607c700e9ce88365202;hp=77dba3a49e658aa9c9484b9938cc3b81ac2de05f;hpb=dc5771dfb27d6da7c8d866a358ff5c86e95f06c6;p=linux-2.6-microblaze.git diff --git a/fs/remap_range.c b/fs/remap_range.c index 77dba3a49e65..e4a5fdd7ad7b 100644 --- a/fs/remap_range.c +++ b/fs/remap_range.c @@ -432,13 +432,16 @@ EXPORT_SYMBOL(vfs_clone_file_range); /* Check whether we are allowed to dedupe the destination file */ static bool allow_file_dedupe(struct file *file) { + struct user_namespace *mnt_userns = file_mnt_user_ns(file); + struct inode *inode = file_inode(file); + if (capable(CAP_SYS_ADMIN)) return true; if (file->f_mode & FMODE_WRITE) return true; - if (uid_eq(current_fsuid(), file_inode(file)->i_uid)) + if (uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) return true; - if (!inode_permission(file_inode(file), MAY_WRITE)) + if (!inode_permission(mnt_userns, inode, MAY_WRITE)) return true; return false; }