]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
apparmor: Simplify obtain the newest label on a cred
authorGaosheng Cui <cuigaosheng1@huawei.com>
Fri, 23 Sep 2022 09:21:18 +0000 (17:21 +0800)
committerJohn Johansen <john.johansen@canonical.com>
Mon, 3 Oct 2022 21:49:04 +0000 (14:49 -0700)
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>
security/apparmor/include/cred.h
security/apparmor/task.c

index 0b9ae4804ef73d10937f166ee08eac6718fb2bb8..58fdc72af66455b78f4fd6df5a3c9a5ffcd1e4d8 100644 (file)
@@ -63,19 +63,6 @@ static inline struct aa_label *aa_get_newest_cred_label(const struct cred *cred)
        return aa_get_newest_label(aa_cred_raw_label(cred));
 }
 
-/**
- * __aa_task_raw_label - retrieve another task's label
- * @task: task to query  (NOT NULL)
- *
- * Returns: @task's label without incrementing its ref count
- *
- * If @task != current needs to be called in RCU safe critical section
- */
-static inline struct aa_label *__aa_task_raw_label(struct task_struct *task)
-{
-       return aa_cred_raw_label(__task_cred(task));
-}
-
 /**
  * aa_current_raw_label - find the current tasks confining label
  *
index 5000cbd055b62dfa17e577b18db429f441fb3c51..84d16a29bfcbc3eab15dec89321690cffc82763a 100644 (file)
@@ -31,7 +31,7 @@ struct aa_label *aa_get_task_label(struct task_struct *task)
        struct aa_label *p;
 
        rcu_read_lock();
-       p = aa_get_newest_label(__aa_task_raw_label(task));
+       p = aa_get_newest_cred_label(__task_cred(task));
        rcu_read_unlock();
 
        return p;