summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-03-06 12:43:51 +0800
committerMark Brown <broonie@linaro.org>2014-03-06 12:43:51 +0800
commite37912fd0bdf174e934af6cfb0002a077867b644 (patch)
treec661c8a6e20e013abf4dd5ac27b9a70f218ff290 /kernel/workqueue.c
parent8535736c27cc4e25b9948d857138315f45b6fa34 (diff)
parent37f204164dfb0186a0caf20bc3e3120080bcd788 (diff)
downloadcachepc-linux-e37912fd0bdf174e934af6cfb0002a077867b644.tar.gz
cachepc-linux-e37912fd0bdf174e934af6cfb0002a077867b644.zip
Merge branch 'pm-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm into spi-pl022
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 82ef9f3b7473..193e977a10ea 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1851,6 +1851,12 @@ static void destroy_worker(struct worker *worker)
if (worker->flags & WORKER_IDLE)
pool->nr_idle--;
+ /*
+ * Once WORKER_DIE is set, the kworker may destroy itself at any
+ * point. Pin to ensure the task stays until we're done with it.
+ */
+ get_task_struct(worker->task);
+
list_del_init(&worker->entry);
worker->flags |= WORKER_DIE;
@@ -1859,6 +1865,7 @@ static void destroy_worker(struct worker *worker)
spin_unlock_irq(&pool->lock);
kthread_stop(worker->task);
+ put_task_struct(worker->task);
kfree(worker);
spin_lock_irq(&pool->lock);