函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:fs\inode.c Create Date:2022-07-29 10:38:09
首页 Copyright©Brick

2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
/**
 * inode_owner_or_capable - check current task permissions to inode
 * @inode: inode being checked
 *
 * 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;
 
    ns = current_user_ns();
    if (kuid_has_mapping(ns, inode->i_uid) && ns_capable(ns, CAP_FOWNER))
        return true;
    return false;
}