Commit 8d9df9f0 authored by Xiaotian Feng's avatar Xiaotian Feng Committed by Tejun Heo

workqueue: free rescuer on destroy_workqueue

wq->rescuer is not freed when wq is destroyed, leads a memory leak
then. This patch also remove a redundant line.
Signed-off-by: default avatarXiaotian Feng <dfeng@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Oleg Nesterov <oleg@redhat.com>
parent da5cabf8
...@@ -2782,7 +2782,6 @@ struct workqueue_struct *__alloc_workqueue_key(const char *name, ...@@ -2782,7 +2782,6 @@ struct workqueue_struct *__alloc_workqueue_key(const char *name,
if (IS_ERR(rescuer->task)) if (IS_ERR(rescuer->task))
goto err; goto err;
wq->rescuer = rescuer;
rescuer->task->flags |= PF_THREAD_BOUND; rescuer->task->flags |= PF_THREAD_BOUND;
wake_up_process(rescuer->task); wake_up_process(rescuer->task);
} }
...@@ -2848,6 +2847,7 @@ void destroy_workqueue(struct workqueue_struct *wq) ...@@ -2848,6 +2847,7 @@ void destroy_workqueue(struct workqueue_struct *wq)
if (wq->flags & WQ_RESCUER) { if (wq->flags & WQ_RESCUER) {
kthread_stop(wq->rescuer->task); kthread_stop(wq->rescuer->task);
free_mayday_mask(wq->mayday_mask); free_mayday_mask(wq->mayday_mask);
kfree(wq->rescuer);
} }
free_cwqs(wq); free_cwqs(wq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment