|
@@ -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:
|
|
@@ -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) ==
|