Skip to content

Commit

Permalink
[PATCH] selinux: fix bug in security_compute_sid
Browse files Browse the repository at this point in the history
Initializes newcontext sooner to allow for its destruction in all cases.

Signed-off-by: Venkat Yekkirala <[email protected]>
Signed-off-by: Stephen Smalley <[email protected]>
Acked-by: James Morris <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Venkat Yekkirala authored and Linus Torvalds committed Jul 31, 2006
1 parent ddccef3 commit 851f8a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,8 @@ static int security_compute_sid(u32 ssid,
goto out;
}

context_init(&newcontext);

POLICY_RDLOCK;

scontext = sidtab_search(&sidtab, ssid);
Expand All @@ -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:
Expand Down

0 comments on commit 851f8a6

Please sign in to comment.