1
Remove get_task_activeptr_rcu() and get_activeptr_rcu(). Remove the
2
tiny optimization in aa_simple_write_to_buffer(): I bet it doesn't
5
Index: b/security/apparmor/inline.h
6
===================================================================
7
--- a/security/apparmor/inline.h
8
+++ b/security/apparmor/inline.h
9
@@ -34,38 +34,17 @@ static inline void put_aa_profile(struct
10
kref_put(&BASE_PROFILE(p)->count, free_aa_profile_kref);
14
- * get_task_activeptr_rcu - get pointer to @tsk's active profile.
15
- * @tsk: task to get active profile from
17
- * Requires rcu_read_lock is held
19
-static inline struct aa_profile *get_task_activeptr_rcu(struct task_struct *tsk)
21
- struct aa_task_context *cxt = aa_task_context(tsk);
22
- struct aa_profile *active = NULL;
25
- active = (struct aa_profile *) rcu_dereference(cxt->active);
31
- * get_activeptr_rcu - get pointer to current task's active profile
32
- * Requires rcu_read_lock is held
34
-static inline struct aa_profile *get_activeptr_rcu(void)
36
- return get_task_activeptr_rcu(current);
39
static inline struct aa_profile *aa_get_profile(struct task_struct *task)
41
- struct aa_profile *active;
42
+ struct aa_task_context *cxt;
43
+ struct aa_profile *active = NULL;
46
- active = aa_dup_profile(get_task_activeptr_rcu(task));
47
+ cxt = aa_task_context(task);
49
+ active = (struct aa_profile *)rcu_dereference(cxt->active);
50
+ aa_dup_profile(active);
55
Index: b/security/apparmor/apparmorfs.c
56
===================================================================
57
--- a/security/apparmor/apparmorfs.c
58
+++ b/security/apparmor/apparmorfs.c
59
@@ -164,18 +164,17 @@ static char *aa_simple_write_to_buffer(c
60
* No sane person would add rules allowing this to a profile
61
* but we enforce the restriction anyways.
64
- active = get_activeptr_rcu();
65
+ active = aa_get_profile(current);
67
AA_WARN("REJECTING access to profile %s (%s(%d) "
68
"profile %s active %s)\n",
69
msg, current->comm, current->pid,
70
BASE_PROFILE(active)->name, active->name);
71
+ put_aa_profile(active);
73
data = ERR_PTR(-EPERM);
78
data = vmalloc(alloc_size);