mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Shaohua Li <shli@fb.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Jens Axboe <axboe@kernel.dk>,
	Dmitry Vyukov <dvyukov@google.com>,
	Ingo Molnar <mingo@kernel.org>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH] kthread: move the cgroup info initialization early
Date: Tue, 7 Nov 2017 10:15:35 -0800	[thread overview]
Message-ID: <20171107101535.6d4c3e934d73a6d231af82d0@linux-foundation.org> (raw)
In-Reply-To: <28c1d60a523362bdf7db7a96a6b1ab80c8689141.1510077329.git.shli@fb.com>

On Tue, 7 Nov 2017 09:57:03 -0800 Shaohua Li <shli@fb.com> wrote:

> kthread() could bail out early before we initialize blkcg_css (if the
> kthread is killed very soon), which confuses free_kthread_struct. Move
> the blkcg_css initialization early.

Changelog is... minimal.  I guess it doesn't matter much.

> Reported-by: syzbot <syzkaller@googlegroups.com>
> Fix: 05e3db9(kthread: add a mechanism to store cgroup info)

That's a bit messed up.  Please use

Fixes: 05e3db95ebfc ("kthread: add a mechanism to store cgroup info")

> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -205,6 +205,10 @@ static int kthread(void *_create)
>  	int ret;
>  
>  	self = kmalloc(sizeof(*self), GFP_KERNEL);
> +#ifdef CONFIG_BLK_CGROUP
> +	if (self)
> +		self->blkcg_css = NULL;
> +#endif

Using kzalloc() would be much neater.  That way we get to delete a bit
more code and it doesn't leave me wondering "under what circumstances
is kthread.cpu uninitialized".  At least, not as much as I am wondering
right now.

      parent reply	other threads:[~2017-11-07 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07 17:57 Shaohua Li
2017-11-07 18:05 ` Tejun Heo
2017-11-07 18:15 ` Andrew Morton [this message]

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=20171107101535.6d4c3e934d73a6d231af82d0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=dvyukov@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=shli@fb.com \
    --cc=tj@kernel.org \
    /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®