diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-02-04 11:34:30 -0500 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-02-04 11:34:30 -0500 |
commit | 6eb4e2b41b264f57ee02d16ee61683952945484d (patch) | |
tree | 9ab88aee868ae4213a72b880d6e2a381c665e125 | |
parent | d5f3a5f6e7e7822df5680d4fe39bf0b6979a1535 (diff) | |
download | op-kernel-dev-6eb4e2b41b264f57ee02d16ee61683952945484d.zip op-kernel-dev-6eb4e2b41b264f57ee02d16ee61683952945484d.tar.gz |
SELinux: fix error code in policydb_init()
If hashtab_create() returns a NULL pointer then we should return -ENOMEM
but instead the current code returns success.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <pmoore@redhat.com>
-rw-r--r-- | security/selinux/ss/policydb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index bc2a586..74aa224 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -289,12 +289,16 @@ static int policydb_init(struct policydb *p) goto out; p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp, (1 << 10)); - if (!p->filename_trans) + if (!p->filename_trans) { + rc = -ENOMEM; goto out; + } p->range_tr = hashtab_create(rangetr_hash, rangetr_cmp, 256); - if (!p->range_tr) + if (!p->range_tr) { + rc = -ENOMEM; goto out; + } ebitmap_init(&p->filename_trans_ttypes); ebitmap_init(&p->policycaps); |