提交 937fa62e 编写于 作者: M Mike Snitzer

dm rq: clear kworker_task if kthread_run() returned an error

cleanup_mapped_device() calls kthread_stop() if kworker_task is
non-NULL.  Currently the assigned value could be a valid task struct or
an error code (e.g -ENOMEM).  Reset md->kworker_task to NULL if
kthread_run() returned an erorr.

Fixes: 7193a9de ("dm rq: check kthread_run return for .request_fn request-based DM")
Cc: stable@vger.kernel.org # 4.8
Reported-by: NTahsin Erdogan <tahsin@google.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 d09960b0
...@@ -856,8 +856,11 @@ int dm_old_init_request_queue(struct mapped_device *md) ...@@ -856,8 +856,11 @@ int dm_old_init_request_queue(struct mapped_device *md)
init_kthread_worker(&md->kworker); init_kthread_worker(&md->kworker);
md->kworker_task = kthread_run(kthread_worker_fn, &md->kworker, md->kworker_task = kthread_run(kthread_worker_fn, &md->kworker,
"kdmwork-%s", dm_device_name(md)); "kdmwork-%s", dm_device_name(md));
if (IS_ERR(md->kworker_task)) if (IS_ERR(md->kworker_task)) {
return PTR_ERR(md->kworker_task); int error = PTR_ERR(md->kworker_task);
md->kworker_task = NULL;
return error;
}
elv_register_queue(md->queue); elv_register_queue(md->queue);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册