[PATCH] selinux: fix bug in security_compute_sid

Initializes newcontext sooner to allow for its destruction in all cases.

Signed-off-by: Venkat Yekkirala <vyekkirala@TrustedCS.com>
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Acked-by: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Venkat Yekkirala 2006-07-30 03:03:18 -07:00 committed by Linus Torvalds
parent ddccef3b5e
commit 851f8a6906

View File

@ -833,6 +833,8 @@ static int security_compute_sid(u32 ssid,
goto out;
}
context_init(&newcontext);
POLICY_RDLOCK;
scontext = sidtab_search(&sidtab, ssid);
@ -850,8 +852,6 @@ static int security_compute_sid(u32 ssid,
goto out_unlock;
}
context_init(&newcontext);
/* Set the user identity. */
switch (specified) {
case AVTAB_TRANSITION: