Re: [PATCH V2] kthread: zero the kthread data structure

From: Tejun Heo
Date: Tue Nov 07 2017 - 14:33:04 EST


On Tue, Nov 07, 2017 at 11:09:50AM -0800, Shaohua Li wrote:
> kthread() could bail out early before we initialize blkcg_css (if the
> kthread is killed very early. Please see xchg() statement in kthread()),
> which confuses free_kthread_struct. Instead of moving the blkcg_css
> initialization early, we simply zero the whole 'self' data structure,
> which doesn't sound much overhead.
>
> Reported-by: syzbot <syzkaller@xxxxxxxxxxxxxxxx>
> Fixes: 05e3db95ebfc ("kthread: add a mechanism to store cgroup info")
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> Signed-off-by: Shaohua Li <shli@xxxxxx>

Acked-by: Tejun Heo <tj@xxxxxxxxxx>

Thanks.

--
tejun