security: remove dead hook sb_umount_close
[safe/jmp/linux-2.6] / security / tomoyo / domain.c
index d60b8a6..66caaa1 100644 (file)
@@ -110,7 +110,7 @@ const char *tomoyo_get_last_name(const struct tomoyo_domain_info *domain)
  * will cause "/usr/sbin/httpd" to belong to "<kernel> /usr/sbin/httpd" domain
  * unless executed from "<kernel> /etc/rc.d/init.d/httpd" domain.
  */
-static LIST_HEAD(tomoyo_domain_initializer_list);
+LIST_HEAD(tomoyo_domain_initializer_list);
 
 /**
  * tomoyo_update_domain_initializer_entry - Update "struct tomoyo_domain_initializer_entry" list.
@@ -136,13 +136,13 @@ static int tomoyo_update_domain_initializer_entry(const char *domainname,
        int error = is_delete ? -ENOENT : -ENOMEM;
        bool is_last_name = false;
 
-       if (!tomoyo_is_correct_path(program, 1, -1, -1, __func__))
+       if (!tomoyo_is_correct_path(program, 1, -1, -1))
                return -EINVAL; /* No patterns allowed. */
        if (domainname) {
                if (!tomoyo_is_domain_def(domainname) &&
-                   tomoyo_is_correct_path(domainname, 1, -1, -1, __func__))
+                   tomoyo_is_correct_path(domainname, 1, -1, -1))
                        is_last_name = true;
-               else if (!tomoyo_is_correct_domain(domainname, __func__))
+               else if (!tomoyo_is_correct_domain(domainname))
                        return -EINVAL;
                saved_domainname = tomoyo_get_name(domainname);
                if (!saved_domainname)
@@ -330,7 +330,7 @@ static bool tomoyo_is_domain_initializer(const struct tomoyo_path_info *
  * "<kernel> /usr/sbin/sshd /bin/bash /usr/bin/passwd" domain, unless
  * explicitly specified by "initialize_domain".
  */
-static LIST_HEAD(tomoyo_domain_keeper_list);
+LIST_HEAD(tomoyo_domain_keeper_list);
 
 /**
  * tomoyo_update_domain_keeper_entry - Update "struct tomoyo_domain_keeper_entry" list.
@@ -357,12 +357,12 @@ static int tomoyo_update_domain_keeper_entry(const char *domainname,
        bool is_last_name = false;
 
        if (!tomoyo_is_domain_def(domainname) &&
-           tomoyo_is_correct_path(domainname, 1, -1, -1, __func__))
+           tomoyo_is_correct_path(domainname, 1, -1, -1))
                is_last_name = true;
-       else if (!tomoyo_is_correct_domain(domainname, __func__))
+       else if (!tomoyo_is_correct_domain(domainname))
                return -EINVAL;
        if (program) {
-               if (!tomoyo_is_correct_path(program, 1, -1, -1, __func__))
+               if (!tomoyo_is_correct_path(program, 1, -1, -1))
                        return -EINVAL;
                saved_program = tomoyo_get_name(program);
                if (!saved_program)
@@ -533,7 +533,7 @@ static bool tomoyo_is_domain_keeper(const struct tomoyo_path_info *domainname,
  * /bin/busybox and domainname which the current process will belong to after
  * execve() succeeds is calculated using /bin/cat rather than /bin/busybox .
  */
-static LIST_HEAD(tomoyo_alias_list);
+LIST_HEAD(tomoyo_alias_list);
 
 /**
  * tomoyo_update_alias_entry - Update "struct tomoyo_alias_entry" list.
@@ -556,8 +556,8 @@ static int tomoyo_update_alias_entry(const char *original_name,
        const struct tomoyo_path_info *saved_aliased_name;
        int error = is_delete ? -ENOENT : -ENOMEM;
 
-       if (!tomoyo_is_correct_path(original_name, 1, -1, -1, __func__) ||
-           !tomoyo_is_correct_path(aliased_name, 1, -1, -1, __func__))
+       if (!tomoyo_is_correct_path(original_name, 1, -1, -1) ||
+           !tomoyo_is_correct_path(aliased_name, 1, -1, -1))
                return -EINVAL; /* No patterns allowed. */
        saved_original_name = tomoyo_get_name(original_name);
        saved_aliased_name = tomoyo_get_name(aliased_name);
@@ -659,7 +659,7 @@ struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char *
        const struct tomoyo_path_info *saved_domainname;
        bool found = false;
 
-       if (!tomoyo_is_correct_domain(domainname, __func__))
+       if (!tomoyo_is_correct_domain(domainname))
                return NULL;
        saved_domainname = tomoyo_get_name(domainname);
        if (!saved_domainname)
@@ -817,6 +817,8 @@ int tomoyo_find_next_domain(struct linux_binprm *bprm)
  out:
        if (!domain)
                domain = old_domain;
+       /* Update reference count on "struct tomoyo_domain_info". */
+       atomic_inc(&domain->users);
        bprm->cred->security = domain;
        kfree(real_program_name);
        kfree(symlink_program_name);