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: <6599ad830809092011x6fce5a70kcd4fb77bf37c46a2@mail.gmail.com>
Date:	Tue, 9 Sep 2008 20:11:39 -0700
From:	"Paul Menage" <menage@...gle.com>
To:	"Lai Jiangshan" <laijs@...fujitsu.com>
Cc:	"Andrew Morton" <akpm@...ux-foundation.org>,
	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>,
	"Greg Kroah-Hartman" <greg@...ah.com>
Subject: Re: [PATCH] cgroups: fix probable race with put_css_set[_taskexit] and find_css_set

On Tue, Sep 9, 2008 at 7:18 PM, Lai Jiangshan <laijs@...fujitsu.com> wrote:
>        hlist_for_each_entry(cg, node, hhead, hlist) {
>                if (!memcmp(template, cg->subsys, sizeof(cg->subsys))) {
>                        /* All subsystems matched */
> +                       if (!kref_get_not_zero(&cg->ref))
> +                               return NULL;

Maybe it would be better to do:

if (!memcmp(...) && kref_get_not_zero(&cg->ref))
  return cg;

so that in the event of a race, we carry on looking in the array.
> + * Return 0 if this refcount is 0, otherwise return 1.
> + */
> +int kref_get_not_zero(struct kref *kref)

Probably clearer to have a bool return type.

Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ