Skip to content

Commit

Permalink
Initialize policydb.process_class eariler.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harry Ciao authored and Eric Paris committed Apr 7, 2011
1 parent eba71de commit 1214eac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 1214eac

Please sign in to comment.