AppArmor: Move path failure information into aa_get_name and rename
[linux-2.6.git] / security / apparmor / domain.c
index 08bbe63..7c69599 100644 (file)
@@ -62,18 +62,17 @@ static int may_change_ptraced_domain(struct task_struct *task,
                                     struct aa_profile *to_profile)
 {
        struct task_struct *tracer;
-       struct cred *cred = NULL;
+       const struct cred *cred = NULL;
        struct aa_profile *tracerp = NULL;
        int error = 0;
 
        rcu_read_lock();
-       tracer = tracehook_tracer_task(task);
+       tracer = ptrace_parent(task);
        if (tracer) {
                /* released below */
                cred = get_task_cred(tracer);
                tracerp = aa_cred_profile(cred);
        }
-       rcu_read_unlock();
 
        /* not ptraced */
        if (!tracer || unconfined(tracerp))
@@ -82,6 +81,7 @@ static int may_change_ptraced_domain(struct task_struct *task,
        error = aa_may_ptrace(tracer, tracerp, to_profile, PTRACE_MODE_ATTACH);
 
 out:
+       rcu_read_unlock();
        if (cred)
                put_cred(cred);
 
@@ -372,13 +372,12 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
        state = profile->file.start;
 
        /* buffer freed below, name is pointer into buffer */
-       error = aa_get_name(&bprm->file->f_path, profile->path_flags, &buffer,
-                           &name);
+       error = aa_path_name(&bprm->file->f_path, profile->path_flags, &buffer,
+                            &name, &info);
        if (error) {
                if (profile->flags &
                    (PFLAG_IX_ON_NAME_ERROR | PFLAG_UNCONFINED))
                        error = 0;
-               info = "Exec failed name resolution";
                name = bprm->filename;
                goto audit;
        }