Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbeb4a9c authored by Serge E. Hallyn's avatar Serge E. Hallyn Committed by James Morris
Browse files

tomoyo: avoid get+put of task_struct



Use task_cred_xxx(task, security) in tomoyo_real_domain() to
avoid a get+put of the target cred.

Signed-off-by: default avatarSerge E. Hallyn <serue@us.ibm.com>
Acked-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent 13b297d9
Loading
Loading
Loading
Loading
+1 −8
Original line number Original line Diff line number Diff line
@@ -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
static inline struct tomoyo_domain_info *tomoyo_real_domain(struct task_struct
							    *task)
							    *task)
{
{
	/***** CRITICAL SECTION START *****/
	return task_cred_xxx(task, security);
	const struct cred *cred = get_task_cred(task);
	struct tomoyo_domain_info *domain = cred->security;

	put_cred(cred);
	return domain;
	/***** CRITICAL SECTION END *****/
}
}


#endif /* !defined(_SECURITY_TOMOYO_TOMOYO_H) */
#endif /* !defined(_SECURITY_TOMOYO_TOMOYO_H) */