tomoyo: avoid get+put of task_struct
authorSerge E. Hallyn <serue@us.ibm.com>
Tue, 2 Jun 2009 03:47:19 +0000 (22:47 -0500)
committerJames Morris <jmorris@namei.org>
Tue, 2 Jun 2009 05:13:13 +0000 (15:13 +1000)
Use task_cred_xxx(task, security) in tomoyo_real_domain() to
avoid a get+put of the target cred.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
security/tomoyo/tomoyo.h

index 41c6eba..f12d5ad 100644 (file)
@@ -90,17 +90,10 @@ static inline struct tomoyo_domain_info *tomoyo_domain(void)
        return current_cred()->security;
 }
 
        return current_cred()->security;
 }
 
-/* Caller holds tasklist_lock spinlock. */
 static inline struct tomoyo_domain_info *tomoyo_real_domain(struct task_struct
                                                            *task)
 {
 static inline struct tomoyo_domain_info *tomoyo_real_domain(struct task_struct
                                                            *task)
 {
-       /***** CRITICAL SECTION START *****/
-       const struct cred *cred = get_task_cred(task);
-       struct tomoyo_domain_info *domain = cred->security;
-
-       put_cred(cred);
-       return domain;
-       /***** CRITICAL SECTION END *****/
+       return task_cred_xxx(task, security);
 }
 
 #endif /* !defined(_SECURITY_TOMOYO_TOMOYO_H) */
 }
 
 #endif /* !defined(_SECURITY_TOMOYO_TOMOYO_H) */