Re: [patch] SELinux: fix error code in policydb_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wednesday, January 28, 2015 09:42:39 AM Dan Carpenter wrote:
> 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@xxxxxxxxxx>

Merged.  Nice catch, thanks for submitting.

> 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);

-- 
paul moore
www.paul-moore.com

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux