lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161031.162931.1238380166136072182.davem@davemloft.net>
Date:   Mon, 31 Oct 2016 16:29:31 -0400 (EDT)
From:   David Miller <davem@...emloft.net>
To:     weiyj.lk@...il.com
Cc:     stephen@...workplumber.org, matti.vaittinen@...ia.com,
        tom@...bertland.com, johannes.berg@...el.com, pshelar@....org,
        tycho.andersen@...onical.com, fw@...len.de, weiyongjun1@...wei.com,
        netdev@...r.kernel.org
Subject: Re: [PATCH net-next] genetlink: fix error return code in
 genl_register_family()

From: Wei Yongjun <weiyj.lk@...il.com>
Date: Mon, 31 Oct 2016 14:53:03 +0000

> From: Wei Yongjun <weiyongjun1@...wei.com>
> 
> Fix to return error code -ENOMEM from the idr_alloc() error handling
> case instead of 0, as done elsewhere in this function.
> 
> Fixes: 2ae0f17df1cd ("genetlink: use idr to track families")
> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
 ...
> @@ -362,8 +362,10 @@ int genl_register_family(struct genl_family *family)
>  
>  	family->id = idr_alloc(&genl_fam_idr, family,
>  			       start, end + 1, GFP_KERNEL);
> -	if (!family->id)
> +	if (!family->id) {
> +		err = -ENOMEM;
>  		goto errout_locked;
> +	}
>  
>  	err = genl_validate_assign_mc_groups(family);
>  	if (err)

idr_alloc() returns negative error codes, not zero, on failure.

So we should return whatever idr_alloc() returns because it has
at least two error return cases (ENOSPC and ENOMEM).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ