]> 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)
commitd8428c2deb5f3004ff0629277494bfbd87c09f30
tree6e096297e263119d7c6b80f7e8ff538827e04e3f
parent28f5e05edb2d6b7d272e5dce1179451a83d6c155
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: 20e49819c99b ("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