mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul Menage" <menage@google.com>
To: "KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>
Cc: linux-kernel@vger.kernel.org, "Li Zefan" <lizf@cn.fujitsu.com>
Subject: Re: [PATCH] cgroup: list_for_each cleanup
Date: Wed, 4 Jun 2008 02:11:39 -0700	[thread overview]
Message-ID: <6599ad830806040211t31d86c57o6836f7cc34faf7f7@mail.gmail.com> (raw)
In-Reply-To: <20080604172812.941C.KOSAKI.MOTOHIRO@jp.fujitsu.com>

Hi Kosaki,

On Wed, Jun 4, 2008 at 1:36 AM, KOSAKI Motohiro
<kosaki.motohiro@jp.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

  reply	other threads:[~2008-06-04  9:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-04  8:36 KOSAKI Motohiro
2008-06-04  9:11 ` Paul Menage [this message]
2008-06-04  9:20   ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6599ad830806040211t31d86c57o6836f7cc34faf7f7@mail.gmail.com \
    --to=menage@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®