Commit 282c1f5e authored by Stephen Smalley's avatar Stephen Smalley Committed by Linus Torvalds
Browse files

[PATCH] selinux: Fix NULL deref in policydb_destroy

This patch fixes a possible NULL dereference in policydb_destroy, where
p->type_attr_map can be NULL if policydb_destroy is called to clean up a
partially loaded policy upon an error during policy load.  Please apply.
Signed-off-by: default avatarStephen Smalley <>
Acked-by: default avatarJames Morris <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 8766ce41
...@@ -650,8 +650,10 @@ void policydb_destroy(struct policydb *p) ...@@ -650,8 +650,10 @@ void policydb_destroy(struct policydb *p)
} }
if (lrt) kfree(lrt); if (lrt) kfree(lrt);
if (p->type_attr_map) {
for (i = 0; i < p->p_types.nprim; i++) for (i = 0; i < p->p_types.nprim; i++)
ebitmap_destroy(&p->type_attr_map[i]); ebitmap_destroy(&p->type_attr_map[i]);
kfree(p->type_attr_map); kfree(p->type_attr_map);
return; return;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment