Merge branch 'master' of git://git.infradead.org/users/eparis/selinux into next
[linux-2.6.git] / security / selinux / hooks.c
index f2f3cf2..d52a925 100644 (file)
@@ -3234,7 +3234,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);
 }