Lines Matching defs:dentry
268 static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry);
274 * invalid. The @dentry parameter should be set to a dentry of the inode.
277 struct dentry *dentry,
291 * @opt_dentry is NULL and no dentry for this inode can be
294 inode_doinit_with_dentry(inode, dentry);
323 static struct inode_security_struct *backing_inode_security_novalidate(struct dentry *dentry)
325 struct inode *inode = d_backing_inode(dentry);
331 * Get the security label of a dentry's backing inode.
333 static struct inode_security_struct *backing_inode_security(struct dentry *dentry)
335 struct inode *inode = d_backing_inode(dentry);
337 __inode_security_revalidate(inode, dentry, true);
500 struct dentry *root = sb->s_root;
549 struct dentry *root = sb->s_root;
629 struct dentry *root = sb->s_root;
1105 struct dentry *root = sb->s_root;
1308 static int selinux_genfs_get_sid(struct dentry *dentry,
1314 struct super_block *sb = dentry->d_sb;
1321 path = dentry_path_raw(dentry, buffer, PAGE_SIZE);
1346 static int inode_doinit_use_xattr(struct inode *inode, struct dentry *dentry,
1360 rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, context, len);
1365 rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX, NULL, 0);
1375 rc = __vfs_getxattr(dentry, inode, XATTR_NAME_SELINUX,
1408 static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry)
1414 struct dentry *dentry;
1456 /* Need a dentry, since the xattr API requires one.
1460 dentry = dget(opt_dentry);
1463 * Called from selinux_complete_init, try to find a dentry.
1468 dentry = d_find_alias(inode);
1469 if (!dentry)
1470 dentry = d_find_any_alias(inode);
1472 if (!dentry) {
1476 * may find inodes that have no dentry on the
1479 * inode_doinit with a dentry, before these inodes could
1485 rc = inode_doinit_use_xattr(inode, dentry, sbsec->def_sid,
1487 dput(dentry);
1514 /* We must have a dentry to determine the label on
1519 dentry = dget(opt_dentry);
1522 * find a dentry. Some filesystems really want
1525 dentry = d_find_alias(inode);
1526 if (!dentry)
1527 dentry = d_find_any_alias(inode);
1532 * may find inodes that have no dentry on the
1535 * inode_doinit() with a dentry, before these inodes
1538 if (!dentry)
1540 rc = selinux_genfs_get_sid(dentry, sclass,
1543 dput(dentry);
1549 rc = inode_doinit_use_xattr(inode, dentry,
1552 dput(dentry);
1556 dput(dentry);
1655 data to be passed (e.g. the dentry). */
1674 the dentry to help the auditing code to more easily generate the
1677 struct dentry *dentry,
1680 struct inode *inode = d_backing_inode(dentry);
1684 ad.u.dentry = dentry;
1685 __inode_security_revalidate(inode, dentry, true);
1696 struct inode *inode = d_backing_inode(path->dentry);
1701 __inode_security_revalidate(inode, path->dentry, true);
1796 struct dentry *dentry,
1812 ad.u.dentry = dentry;
1820 rc = selinux_determine_inode_label(tsec, dir, &dentry->d_name, tclass,
1840 struct dentry *dentry,
1851 isec = backing_inode_security(dentry);
1854 ad.u.dentry = dentry;
1883 struct dentry *old_dentry,
1885 struct dentry *new_dentry)
1901 ad.u.dentry = old_dentry;
1917 ad.u.dentry = new_dentry;
2058 struct dentry *dentry = file->f_path.dentry;
2081 if (unlikely(IS_PRIVATE(d_backing_inode(dentry))))
2084 isec = backing_inode_security(dentry);
2176 static int selinux_quota_on(struct dentry *dentry)
2180 return dentry_has_perm(cred, dentry, FILE__QUOTAON);
2729 ad.u.dentry = sb->s_root;
2733 static int selinux_sb_statfs(struct dentry *dentry)
2739 ad.u.dentry = dentry->d_sb->s_root;
2740 return superblock_has_perm(cred, dentry->d_sb, FILESYSTEM__GETATTR, &ad);
2752 return superblock_has_perm(cred, path->dentry->d_sb,
2858 static int selinux_dentry_init_security(struct dentry *dentry, int mode,
2867 d_inode(dentry->d_parent), name,
2880 static int selinux_dentry_create_files_as(struct dentry *dentry, int mode,
2890 d_inode(dentry->d_parent), name,
3002 static int selinux_inode_create(struct inode *dir, struct dentry *dentry, umode_t mode)
3004 return may_create(dir, dentry, SECCLASS_FILE);
3007 static int selinux_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
3012 static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry)
3014 return may_link(dir, dentry, MAY_UNLINK);
3017 static int selinux_inode_symlink(struct inode *dir, struct dentry *dentry, const char *name)
3019 return may_create(dir, dentry, SECCLASS_LNK_FILE);
3022 static int selinux_inode_mkdir(struct inode *dir, struct dentry *dentry, umode_t mask)
3024 return may_create(dir, dentry, SECCLASS_DIR);
3027 static int selinux_inode_rmdir(struct inode *dir, struct dentry *dentry)
3029 return may_link(dir, dentry, MAY_RMDIR);
3032 static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev)
3034 return may_create(dir, dentry, inode_mode_to_security_class(mode));
3037 static int selinux_inode_rename(struct inode *old_inode, struct dentry *old_dentry,
3038 struct inode *new_inode, struct dentry *new_dentry)
3043 static int selinux_inode_readlink(struct dentry *dentry)
3047 return dentry_has_perm(cred, dentry, FILE__READ);
3050 static int selinux_inode_follow_link(struct dentry *dentry, struct inode *inode,
3059 ad.u.dentry = dentry;
3125 static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr)
3128 struct inode *inode = d_backing_inode(dentry);
3142 return dentry_has_perm(cred, dentry, FILE__SETATTR);
3150 return dentry_has_perm(cred, dentry, av);
3171 struct dentry *dentry, const char *name,
3174 struct inode *inode = d_backing_inode(dentry);
3182 rc = cap_inode_setxattr(dentry, name, value, size, flags);
3188 return dentry_has_perm(current_cred(), dentry, FILE__SETATTR);
3202 ad.u.dentry = dentry;
3204 isec = backing_inode_security(dentry);
3263 struct dentry *dentry, const char *acl_name,
3266 return dentry_has_perm(current_cred(), dentry, FILE__SETATTR);
3270 struct dentry *dentry, const char *acl_name)
3272 return dentry_has_perm(current_cred(), dentry, FILE__GETATTR);
3276 struct dentry *dentry, const char *acl_name)
3278 return dentry_has_perm(current_cred(), dentry, FILE__SETATTR);
3281 static void selinux_inode_post_setxattr(struct dentry *dentry, const char *name,
3285 struct inode *inode = d_backing_inode(dentry);
3313 isec = backing_inode_security(dentry);
3321 static int selinux_inode_getxattr(struct dentry *dentry, const char *name)
3325 return dentry_has_perm(cred, dentry, FILE__GETATTR);
3328 static int selinux_inode_listxattr(struct dentry *dentry)
3332 return dentry_has_perm(cred, dentry, FILE__GETATTR);
3336 struct dentry *dentry, const char *name)
3339 int rc = cap_inode_removexattr(idmap, dentry, name);
3345 return dentry_has_perm(current_cred(), dentry, FILE__SETATTR);
3377 ret = superblock_has_perm(current_cred(), path->dentry->d_sb,
3499 static int selinux_inode_copy_up(struct dentry *src, struct cred **new)
6310 static void selinux_d_instantiate(struct dentry *dentry, struct inode *inode)
6313 inode_doinit_with_dentry(inode, dentry);
6546 static int selinux_inode_setsecctx(struct dentry *dentry, void *ctx, u32 ctxlen)
6548 return __vfs_setxattr_noperm(&nop_mnt_idmap, dentry, XATTR_NAME_SELINUX,