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: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=851f8a6906b71f7a19043d4d722dd4ffab7aeafc;p=linux-2.6 [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 d2e80e62ff..85e4298843 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: