[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20171107101535.6d4c3e934d73a6d231af82d0@linux-foundation.org>
Date: Tue, 7 Nov 2017 10:15:35 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Shaohua Li <shli@...com>
Cc: LKML <linux-kernel@...r.kernel.org>, Jens Axboe <axboe@...nel.dk>,
Dmitry Vyukov <dvyukov@...gle.com>,
Ingo Molnar <mingo@...nel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH] kthread: move the cgroup info initialization early
On Tue, 7 Nov 2017 09:57:03 -0800 Shaohua Li <shli@...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@...glegroups.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.
Powered by blists - more mailing lists