Initialize policydb.process_class eariler.
authorHarry Ciao <qingtao.cao@windriver.com>
Thu, 7 Apr 2011 06:12:57 +0000 (14:12 +0800)
committerEric Paris <eparis@redhat.com>
Thu, 7 Apr 2011 16:00:26 +0000 (12:00 -0400)
Initialize policydb.process_class once all symtabs read from policy image,
so that it could be used to setup the role_trans.tclass field when a lower
version policy.X is loaded.

Signed-off-by: Harry Ciao <qingtao.cao@windriver.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
security/selinux/ss/policydb.c

index a493eae24e0ac76ddeaff78c722ab88d31594b83..82373eb2dc977a56048b1acc163730cc0d375014 100644 (file)
@@ -2275,6 +2275,11 @@ int policydb_read(struct policydb *p, void *fp)
                p->symtab[i].nprim = nprim;
        }
 
+       rc = -EINVAL;
+       p->process_class = string_to_security_class(p, "process");
+       if (!p->process_class)
+               goto bad;
+
        rc = avtab_read(&p->te_avtab, fp, p);
        if (rc)
                goto bad;
@@ -2358,11 +2363,6 @@ int policydb_read(struct policydb *p, void *fp)
        if (rc)
                goto bad;
 
-       rc = -EINVAL;
-       p->process_class = string_to_security_class(p, "process");
-       if (!p->process_class)
-               goto bad;
-
        rc = -EINVAL;
        p->process_trans_perms = string_to_av_perm(p, p->process_class, "transition");
        p->process_trans_perms |= string_to_av_perm(p, p->process_class, "dyntransition");