[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171107180558.GA4164960@devbig577.frc2.facebook.com>
Date: Tue, 7 Nov 2017 10:05:58 -0800
From: Tejun Heo <tj@...nel.org>
To: Shaohua Li <shli@...com>
Cc: LKML <linux-kernel@...r.kernel.org>, Jens Axboe <axboe@...nel.dk>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] kthread: move the cgroup info initialization early
On Tue, Nov 07, 2017 at 09:57:03AM -0800, Shaohua Li 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.
>
> Reported-by: syzbot <syzkaller@...glegroups.com>
> Fix: 05e3db9(kthread: add a mechanism to store cgroup info)
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Tejun Heo <tj@...nel.org>
> Signed-off-by: Shaohua Li <shli@...com>
> ---
> kernel/kthread.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index f87cd8b4..cf5c113 100644
> --- 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
That's not a big struct and I can't imagine that avoiding zeroing it
matters in anyway. Can't we just use kzalloc() instead and drop the
ugly ifdef?
Thanks.
--
tejun
Powered by blists - more mailing lists