X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=fs%2Finode.c;h=e846a32e8d6e6bb4a7d4468a9587359c3ff76a94;hb=5c5739e16d3b0a7eccff0cd945733b3762c44db9;hp=4bcdad3c93612920e809da639ff933e5af08d0f7;hpb=cb1fbad7ec250ac408a4682d38b205958a17a02b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git diff --git a/fs/inode.c b/fs/inode.c index 4bcdad3..e846a32 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1840,14 +1840,18 @@ EXPORT_SYMBOL(inode_init_owner); * inode_owner_or_capable - check current task permissions to inode * @inode: inode being checked * - * Return true if current either has CAP_FOWNER to the inode, or - * owns the file. + * Return true if current either has CAP_FOWNER in a namespace with the + * inode owner uid mapped, or owns the file. */ bool inode_owner_or_capable(const struct inode *inode) { + struct user_namespace *ns; + if (uid_eq(current_fsuid(), inode->i_uid)) return true; - if (inode_capable(inode, CAP_FOWNER)) + + ns = current_user_ns(); + if (ns_capable(ns, CAP_FOWNER) && kuid_has_mapping(ns, inode->i_uid)) return true; return false; }