]> git.baikalelectronics.ru Git - kernel.git/commit
kthread: zero the kthread data structure
authorShaohua Li <shli@fb.com>
Tue, 7 Nov 2017 19:09:50 +0000 (11:09 -0800)
committerJens Axboe <axboe@kernel.dk>
Sat, 11 Nov 2017 02:53:25 +0000 (19:53 -0700)
commit91440a6d81a9c6de3d90ef0082743a0c26f3758d
tree6e096297e263119d7c6b80f7e8ff538827e04e3f
parenta07e40388d3cd49589c3321025fa31fdefea7092
kthread: zero the kthread data structure

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@googlegroups.com>
Fixes: cded3eece267 ("kthread: add a mechanism to store cgroup info")
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/kthread.c