X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;ds=sidebyside;f=kernel%2Fcapability.c;h=493d97259484cfef006c59b934be4fcf9663d1ac;hb=c83119a980166539bc14033d89e83cd2e4f2da52;hp=cc5f0718215dc418dc116da6ba2e0148445f0158;hpb=1a48e2ac034d47ed843081c4523b63c46b46888b;p=~andy%2Flinux diff --git a/kernel/capability.c b/kernel/capability.c index cc5f0718215..493d9725948 100644 --- a/kernel/capability.c +++ b/kernel/capability.c @@ -429,12 +429,14 @@ bool nsown_capable(int cap) * targeted at it's own user namespace and that the given inode is owned * by the current user namespace or a child namespace. * - * Currently inodes can only be owned by the initial user namespace. + * Currently we check to see if an inode is owned by the current + * user namespace by seeing if the inode's owner maps into the + * current user namespace. * */ bool inode_capable(const struct inode *inode, int cap) { struct user_namespace *ns = current_user_ns(); - return ns_capable(ns, cap) && (ns == &init_user_ns); + return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid); }