SELinux: fix error code in policydb_init()
Subsystems (2)
PATCH 1/1 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.
security/selinux/ss/policydb.c +6 -2
@@ -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);
Quoted 4 lines · Dan Carpenter
If
hashtab_create()returns a NULL pointer then we should return-ENOMEMbut instead the current code returns success.Signed-off-by Dan Carpenter <[email protected]>
Quoted 24 lines
security/selinux/ss/policydb.c +6
-2@@ -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);
Quoted 4 lines · Dan Carpenter
If
hashtab_create()returns a NULL pointer then we should return-ENOMEMbut instead the current code returns success.Signed-off-by Dan Carpenter <[email protected]>
Quoted 29 lines
security/selinux/ss/policydb.c +6
-3@@ -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); --To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paul Moore
maintainerQuoted 4 lines · Dan Carpenter
If
hashtab_create()returns a NULL pointer then we should return-ENOMEMbut instead the current code returns success.Signed-off-by Dan Carpenter <[email protected]>
Merged. Nice catch, thanks for submitting.
Quoted 23 lines
security/selinux/ss/policydb.c +6
-1@@ -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);
Signature · 2 lines
paul moore www.paul-moore.com