aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Redpath <chris.redpath@arm.com>2014-01-10 10:34:08 +0000
committerJon Medhurst <tixy@linaro.org>2014-01-22 09:50:45 +0000
commitb2fafaba35f490947b78e8d0d4f4264a137e64cd (patch)
tree7c625b41be9e14df3e08a972b31eee550b0de13c
parent5e0791511a938eaf28d9071b411ffa71a79ef8ed (diff)
downloadlinaro-lsk-b2fafaba35f490947b78e8d0d4f4264a137e64cd.tar.gz
sched: hmp: Fix potential task_struct memory leak
We use get_task_struct to increment the ref count on a task_struct so that even if the task dies with a pending migration we are still able to read the memory without causing a fault. In the case of non-running tasks, we forgot to decrement the ref count when we are done with the task. Signed-off-by: Chris Redpath <chris.redpath@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r--kernel/sched/fair.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d89f4a8ddf4..43857fec77b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7027,13 +7027,13 @@ static void hmp_migrate_runnable_task(struct rq *rq)
* with the source rq.
*/
if (src_rq->active_balance)
- return;
+ goto out;
if (src_rq->nr_running <= 1)
- return;
+ goto out;
if (task_rq(p) != src_rq)
- return;
+ goto out;
/*
* Not sure if this applies here but one can never
* be too cautious
@@ -7068,6 +7068,8 @@ static void hmp_migrate_runnable_task(struct rq *rq)
rcu_read_unlock();
double_unlock_balance(src_rq, dst_rq);
+out:
+ put_task_struct(p);
}
static DEFINE_SPINLOCK(hmp_force_migration);