Commit 851f8a69 authored by Venkat Yekkirala's avatar Venkat Yekkirala Committed by Linus Torvalds

[PATCH] selinux: fix bug in security_compute_sid

Initializes newcontext sooner to allow for its destruction in all cases.
Signed-off-by: default avatarVenkat Yekkirala <vyekkirala@TrustedCS.com>
Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Acked-by: default avatarJames Morris <jmorris@namei.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ddccef3b
...@@ -833,6 +833,8 @@ static int security_compute_sid(u32 ssid, ...@@ -833,6 +833,8 @@ static int security_compute_sid(u32 ssid,
goto out; goto out;
} }
context_init(&newcontext);
POLICY_RDLOCK; POLICY_RDLOCK;
scontext = sidtab_search(&sidtab, ssid); scontext = sidtab_search(&sidtab, ssid);
...@@ -850,8 +852,6 @@ static int security_compute_sid(u32 ssid, ...@@ -850,8 +852,6 @@ static int security_compute_sid(u32 ssid,
goto out_unlock; goto out_unlock;
} }
context_init(&newcontext);
/* Set the user identity. */ /* Set the user identity. */
switch (specified) { switch (specified) {
case AVTAB_TRANSITION: case AVTAB_TRANSITION:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment