]> Git Repo - linux.git/commitdiff
selinux: fix GPF on invalid policy
authorStephen Smalley <[email protected]>
Wed, 9 Jan 2019 15:55:10 +0000 (10:55 -0500)
committerPaul Moore <[email protected]>
Fri, 11 Jan 2019 01:23:05 +0000 (20:23 -0500)
levdatum->level can be NULL if we encounter an error while loading
the policy during sens_read prior to initializing it.  Make sure
sens_destroy handles that case correctly.

Reported-by: [email protected]
Signed-off-by: Stephen Smalley <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
security/selinux/ss/policydb.c

index a50d625e7946f1803bf5e8c7a9f02b734fe46bc9..c1c31e33657ae6d6b9f6247a4c7ac29f6026bc4d 100644 (file)
@@ -732,7 +732,8 @@ static int sens_destroy(void *key, void *datum, void *p)
        kfree(key);
        if (datum) {
                levdatum = datum;
-               ebitmap_destroy(&levdatum->level->cat);
+               if (levdatum->level)
+                       ebitmap_destroy(&levdatum->level->cat);
                kfree(levdatum->level);
        }
        kfree(datum);
This page took 0.079965 seconds and 4 git commands to generate.