~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/fix-cleanup-aa_register-2.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: b/security/apparmor/main.c
2
 
===================================================================
3
 
--- a/security/apparmor/main.c
4
 
+++ b/security/apparmor/main.c
5
 
@@ -768,16 +768,17 @@ repeat:
6
 
 }
7
 
 
8
 
 static struct aa_profile *
9
 
-aa_register_find(const char *name, int mandatory, int complain)
10
 
+aa_register_find(struct aa_profile *profile, const char *name, int mandatory,
11
 
+                int complain)
12
 
 {
13
 
-       struct aa_profile *profile;
14
 
+       struct aa_profile *new_profile;
15
 
 
16
 
        /* Locate new profile */
17
 
-       profile = aa_find_profile(name);
18
 
-       if (profile) {
19
 
+       new_profile = aa_find_profile(name);
20
 
+       if (new_profile) {
21
 
                AA_DEBUG("%s: setting profile %s\n",
22
 
-                        __FUNCTION__, profile->name);
23
 
-       } else if (mandatory) {
24
 
+                        __FUNCTION__, new_profile->name);
25
 
+       } else if (mandatory && profile) {
26
 
                if (complain) {
27
 
                        LOG_HINT(profile, GFP_KERNEL, HINT_MANDPROF,
28
 
                                "image=%s pid=%d profile=%s active=%s\n",
29
 
@@ -803,7 +804,7 @@ aa_register_find(const char *name, int m
30
 
                         __FUNCTION__,
31
 
                         name);
32
 
        }
33
 
-       return profile;
34
 
+       return new_profile;
35
 
 }
36
 
 
37
 
 /**
38
 
@@ -860,7 +861,8 @@ repeat:
39
 
                                AA_DEBUG("%s: PROFILE %s\n",
40
 
                                         __FUNCTION__,
41
 
                                         filename);
42
 
-                               new_profile = aa_register_find(filename, 1,
43
 
+                               new_profile = aa_register_find(profile,
44
 
+                                                              filename, 1,
45
 
                                                               complain);
46
 
                                break;
47
 
 
48
 
@@ -897,7 +899,7 @@ repeat:
49
 
                }
50
 
        } else {
51
 
                /* Unconfined task, load profile if it exists */
52
 
-               new_profile = aa_register_find(filename, 0, 0);
53
 
+               new_profile = aa_register_find(NULL, filename, 0, 0);
54
 
                if (new_profile == NULL)
55
 
                        goto cleanup;
56
 
        }
57
 
@@ -926,7 +928,7 @@ repeat:
58
 
         * Cases 2 and 3 are marked as requiring secure exec
59
 
         * (unless policy specified "unsafe exec")
60
 
         */
61
 
-       if (new_profile && !(exec_mode & AA_EXEC_UNSAFE)) {
62
 
+       if (!(exec_mode & AA_EXEC_UNSAFE)) {
63
 
                unsigned long bprm_flags;
64
 
 
65
 
                bprm_flags = AA_SECURE_EXEC_NEEDED;