Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232948
b: refs/heads/master
c: 2edeaa3
h: refs/heads/master
v: v3
  • Loading branch information
Tetsuo Handa authored and Linus Torvalds committed Feb 7, 2011
1 parent ec15fe1 commit f05836d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 257a65d79581880032e0bf0c452f4041b693664c
refs/heads/master: 2edeaa34a6e3f2c43b667f6c4f7b27944b811695
12 changes: 8 additions & 4 deletions trunk/kernel/cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,13 @@ struct cred *cred_alloc_blank(void)
#endif

atomic_set(&new->usage, 1);
#ifdef CONFIG_DEBUG_CREDENTIALS
new->magic = CRED_MAGIC;
#endif

if (security_cred_alloc_blank(new, GFP_KERNEL) < 0)
goto error;

#ifdef CONFIG_DEBUG_CREDENTIALS
new->magic = CRED_MAGIC;
#endif
return new;

error:
Expand Down Expand Up @@ -748,7 +748,11 @@ bool creds_are_invalid(const struct cred *cred)
if (cred->magic != CRED_MAGIC)
return true;
#ifdef CONFIG_SECURITY_SELINUX
if (selinux_is_enabled()) {
/*
* cred->security == NULL if security_cred_alloc_blank() or
* security_prepare_creds() returned an error.
*/
if (selinux_is_enabled() && cred->security) {
if ((unsigned long) cred->security < PAGE_SIZE)
return true;
if ((*(u32 *)cred->security & 0xffffff00) ==
Expand Down
6 changes: 5 additions & 1 deletion trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -3198,7 +3198,11 @@ static void selinux_cred_free(struct cred *cred)
{
struct task_security_struct *tsec = cred->security;

BUG_ON((unsigned long) cred->security < PAGE_SIZE);
/*
* cred->security == NULL if security_cred_alloc_blank() or
* security_prepare_creds() returned an error.
*/
BUG_ON(cred->security && (unsigned long) cred->security < PAGE_SIZE);
cred->security = (void *) 0x7UL;
kfree(tsec);
}
Expand Down

0 comments on commit f05836d

Please sign in to comment.