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]
Date:   Fri, 27 Jan 2017 17:09:58 -0500
From:   Tejun Heo <tj@...nel.org>
To:     Douglas Miller <dougmill@...ux.vnet.ibm.com>
Cc:     linux-kernel@...r.kernel.org, Christoph Lameter <cl@...ux.com>,
        linux-block@...r.kernel.org,
        Guilherme Piccoli <gpiccoli@...ibm.com>
Subject: Re: [PATCH 1/1] percpu-refcount: fix reference leak during
 percpu-atomic transition

Hello, Douglas.

On Fri, Jan 27, 2017 at 02:59:08PM -0600, Douglas Miller wrote:
> @@ -212,7 +212,7 @@ static inline bool percpu_ref_tryget(struct percpu_ref *ref)
>  		this_cpu_inc(*percpu_count);
>  		ret = true;
>  	} else {
> -		ret = atomic_long_inc_not_zero(&ref->count);
> +		ret = (atomic_long_inc_not_zero(&ref->count) != 0);
>  	}
>  
>  	rcu_read_unlock_sched();
> @@ -246,7 +246,7 @@ static inline bool percpu_ref_tryget_live(struct percpu_ref *ref)
>  		this_cpu_inc(*percpu_count);
>  		ret = true;
>  	} else if (!(ref->percpu_count_ptr & __PERCPU_REF_DEAD)) {
> -		ret = atomic_long_inc_not_zero(&ref->count);
> +		ret = (atomic_long_inc_not_zero(&ref->count) != 0);

Ugh.... Damn it.  This is why we use bools instead of ints for these
things.  For some reason, we're returning bools but using an integer
variable to cache the result.  :(

Can you please convert the local variable to bool instead?

Thanks a lot for spotting this.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ