提交 2d8f6131 编写于 作者: O Oleg Nesterov 提交者: Greg Kroah-Hartman

elv_unregister: fix possible crash on module unload

An exiting task or process which didn't do I/O yet have no io context,
elv_unregister() should check it is not NULL.
Signed-off-by: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NJens Axboe <axboe@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 00a2b0f6
......@@ -765,7 +765,8 @@ void elv_unregister(struct elevator_type *e)
read_lock(&tasklist_lock);
do_each_thread(g, p) {
task_lock(p);
e->ops.trim(p->io_context);
if (p->io_context)
e->ops.trim(p->io_context);
task_unlock(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册