コード例 #1
0
/**
 * secfs_policy_procguard_release - process access guard file close
 * @inode: node pointer
 * @file: file pointer
 * 
 * This function is process access guard file close.
 * SECFS_FILENAME_POLICY_PROCESSACCESSGUARD
 *
 * return infomation
 * int:result
 */
static int secfs_policy_procguard_release(
			struct inode *inode,
			struct file *file)
{
	int result = 0;
	int type;
    int idx;
	
	idx = secfunc_lock();
	
	type = secpolicy_getctlfsremove();
	if ((type & CONTROL_FILEREMOVE_TYPE_PROCESS) != 0) {
		g_entry_files[SECFS_KEY_POLICY_PROCESSACCESSGUARD].mExist
								= false;
		securityfs_remove(file->f_dentry);
		type &= ~CONTROL_FILEREMOVE_TYPE_PROCESS;
		secpolicy_setctlfsremove(type);
		if (secfs_count_using_files() == 0) {
			securityfs_remove(secfsdir);
			secfsdir = NULL;
		}
	}
	
	secfunc_unlock(idx);
	
	return result;
}
コード例 #2
0
/**
 * secfs_Init - security file initialize
 * 
 * This function is security file initialize.
 *
 * return infomation
 * int:result
 */
static int __init secfs_Init(void)
{
	int i;
	int result = 0;
	struct secfs_entry_file *pef;

	secfunc_init();
	
	/* create directory */
	secfsdir = securityfs_create_dir(SECFS_FOLDERNAME, NULL);
	if (IS_ERR(secfsdir)) {
		result = PTR_ERR(secfsdir);
	} else {
		struct dentry* pEntry[ARRAY_SIZE(g_entry_files)];
		pef = g_entry_files;
		for (i = 0; i < ARRAY_SIZE(g_entry_files); i++, pef++) {
			pEntry[i] = secfs_create_entry(secfsdir, pef);
			if (IS_ERR(pEntry[i])) {
				result = PTR_ERR(pEntry[i]);
				for (--i; i >= 0; i--) {
					securityfs_remove(pEntry[i]);
				}
				securityfs_remove(secfsdir);
				secfsdir = NULL;
				SECERROR("securityfs_remove");
				break;
			} else {
				pef->mExist = true;
			}
		}
	}
	
	return result;
}
コード例 #3
0
ファイル: ric.c プロジェクト: auras76/aur-kernel-XZxx
static int ric_release(struct inode *inode, struct file *file)
{
	if (security_state) {
		securityfs_remove(ric_entry);
		securityfs_remove(ric_dir);
		ric_entry = NULL;
		ric_dir = NULL;
	}

	return 0;
}
コード例 #4
0
ファイル: apparmorfs.c プロジェクト: nos1609/Chrono_Kernel-1
static void __init aafs_remove(const char *name)
{
	struct dentry *dentry;

	dentry = lookup_one_len(name, aa_fs_dentry, strlen(name));
	if (!IS_ERR(dentry)) {
		securityfs_remove(dentry);
		dput(dentry);
	}
}
コード例 #5
0
ファイル: apparmorfs.c プロジェクト: nos1609/Chrono_Kernel-1
/**
 * aa_destroy_aafs - cleanup and free aafs
 *
 * releases dentries allocated by aa_create_aafs
 */
void __init aa_destroy_aafs(void)
{
	if (aa_fs_dentry) {
		aafs_remove(".remove");
		aafs_remove(".replace");
		aafs_remove(".load");

		securityfs_remove(aa_fs_dentry);
		aa_fs_dentry = NULL;
	}
}
コード例 #6
0
/**
 * aa_destroy_aafs - cleanup and free aafs
 *
 * releases dentries allocated by aa_create_aafs
 */
void __init aa_destroy_aafs(void)
{
	if (aa_fs_dentry) {
		aafs_remove(".remove");
		aafs_remove(".replace");
		aafs_remove(".load");
#ifdef CONFIG_SECURITY_APPARMOR_COMPAT_24
		aafs_remove("profiles");
		aafs_remove("matching");
		aafs_remove("features");
#endif
		securityfs_remove(aa_fs_dentry);
		aa_fs_dentry = NULL;
	}
}
コード例 #7
0
ファイル: root.c プロジェクト: suztomo/hp
int hp_cleanup_sysfs(void)
{
  int i;
  i = hp_cleanup_tty_output_sysfs();
  if (i) {
    alert("cleanup security/hp/tty_output/ failed.\n");
    return -1;
  }
  for (i=0; i<HP_DENTRY_NUM; ++i) {
    /* The root directory ('security/hp/') must be removed at last,
       that is, HP_DENTRY_KEY_ROOT must be 0.
     */
    struct dentry *de = hp_dentries[HP_DENTRY_NUM - i - 1];
    if (de) {
      debug( "removing %s.\n", dentry_fname(de));
      securityfs_remove(de);
    }
  }
  debug("securityfs %s was removed.\n", HP_DIR_NAME);
  /* Succeess */
  return 0;
}