Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

apparmor: Simplify obtain the newest label on a cred

In aa_get_task_label(), aa_get_newest_cred_label(__task_cred(task))
can do the same things as aa_get_newest_label(__aa_task_raw_label(task)),
so we can replace it and remove __aa_task_raw_label() to simplify the code.

Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>

authored by

Gaosheng Cui and committed by
John Johansen
adaa9a3f 1f939c6b

+1 -14
-13
security/apparmor/include/cred.h
··· 64 64 } 65 65 66 66 /** 67 - * __aa_task_raw_label - retrieve another task's label 68 - * @task: task to query (NOT NULL) 69 - * 70 - * Returns: @task's label without incrementing its ref count 71 - * 72 - * If @task != current needs to be called in RCU safe critical section 73 - */ 74 - static inline struct aa_label *__aa_task_raw_label(struct task_struct *task) 75 - { 76 - return aa_cred_raw_label(__task_cred(task)); 77 - } 78 - 79 - /** 80 67 * aa_current_raw_label - find the current tasks confining label 81 68 * 82 69 * Returns: up to date confining label or the ns unconfined label (NOT NULL)
+1 -1
security/apparmor/task.c
··· 31 31 struct aa_label *p; 32 32 33 33 rcu_read_lock(); 34 - p = aa_get_newest_label(__aa_task_raw_label(task)); 34 + p = aa_get_newest_cred_label(__task_cred(task)); 35 35 rcu_read_unlock(); 36 36 37 37 return p;