Tree has invariant part + two subtrees that get replaced upon each
policy load. Invariant parts stay for the lifetime of filesystem,
these two subdirs - from policy load to policy load (serialized
on lock_rename(root, ...)).
All object creations are via d_alloc_name()+d_add() inside selinuxfs,
all removals are via simple_recursive_removal().
Turn those d_add() into d_make_persistent()+dput() and that's mostly it.
Acked-by: Paul Moore <paul@paul-moore.com>
Reviewed-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Tested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
iput(inode);
return ERR_PTR(-ENOMEM);
}
- d_add(dentry, inode);
+ d_make_persistent(dentry, inode);
+ dput(dentry);
return dentry;
}
/* directory inodes start off with i_nlink == 2 (for "." entry) */
inc_nlink(inode);
inode_lock(sb->s_root->d_inode);
- d_add(dentry, inode);
+ d_make_persistent(dentry, inode);
inc_nlink(sb->s_root->d_inode);
inode_unlock(sb->s_root->d_inode);
- return dentry;
+ dput(dentry);
+ return dentry; // borrowed
}
#define NULL_FILE_NAME "null"
static void sel_kill_sb(struct super_block *sb)
{
selinux_fs_info_free(sb);
- kill_litter_super(sb);
+ kill_anon_super(sb);
}
static struct file_system_type sel_fs_type = {