[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830806040211t31d86c57o6836f7cc34faf7f7@mail.gmail.com>
Date: Wed, 4 Jun 2008 02:11:39 -0700
From: "Paul Menage" <menage@...gle.com>
To: "KOSAKI Motohiro" <kosaki.motohiro@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org, "Li Zefan" <lizf@...fujitsu.com>
Subject: Re: [PATCH] cgroup: list_for_each cleanup
Hi Kosaki,
On Wed, Jun 4, 2008 at 1:36 AM, KOSAKI Motohiro
<kosaki.motohiro@...fujitsu.com> wrote:
> @@ -3072,16 +3070,19 @@ void __css_put(struct cgroup_subsys_stat
> */
> static void cgroup_release_agent(struct work_struct *work)
> {
> + struct cgroup *cgrp;
> + struct cgroup *saved_cgrp;
> +
> BUG_ON(work != &release_agent_work);
> mutex_lock(&cgroup_mutex);
> spin_lock(&release_list_lock);
> - while (!list_empty(&release_list)) {
> +
> + list_for_each_entry_safe(cgrp, saved_cgrp, &release_list,
> + release_list) {
> char *argv[3], *envp[3];
> int i;
> char *pathbuf;
> - struct cgroup *cgrp = list_entry(release_list.next,
> - struct cgroup,
> - release_list);
> +
> list_del_init(&cgrp->release_list);
> spin_unlock(&release_list_lock);
> pathbuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
>
I don't think that list_for_each_entry_safe() is still safe when we've
dropped release_list_lock. saved_cgroup could end up pointing to a
cgroup that's freed while we're forking the usermode helper.
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