From: Venkat Yekkirala Date: Sun, 30 Jul 2006 10:03:18 +0000 (-0700) Subject: [PATCH] selinux: fix bug in security_compute_sid X-Git-Tag: v2.6.18-rc4~139 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=851f8a6906b71f7a19043d4d722dd4ffab7aeafc;p=platform%2Fkernel%2Flinux-3.10.git [PATCH] selinux: fix bug in security_compute_sid Initializes newcontext sooner to allow for its destruction in all cases. Signed-off-by: Venkat Yekkirala Signed-off-by: Stephen Smalley Acked-by: James Morris Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index d2e80e6..85e4298 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -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: