Skip to content

Commit

Permalink
tomoyo: avoid get+put of task_struct
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Tetsuo Handa <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
Serge E. Hallyn authored and James Morris committed Jun 2, 2009
1 parent 13b297d commit fbeb4a9
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions security/tomoyo/tomoyo.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,10 @@ static inline struct tomoyo_domain_info *tomoyo_domain(void)
return current_cred()->security;
}

/* Caller holds tasklist_lock spinlock. */
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) */

0 comments on commit fbeb4a9

Please sign in to comment.