diff options
author | Chris Redpath <chris.redpath@arm.com> | 2015-02-04 14:44:53 +0900 |
---|---|---|
committer | Seung-Woo Kim <sw0312.kim@samsung.com> | 2016-12-14 13:41:56 +0900 |
commit | 9d689693034a6339256161ef701a1880115c7c6d (patch) | |
tree | e42226ff217fd900814c96ac468b318bf73745a9 /kernel | |
parent | b7bc96922082d895df72eba74adc268dea14a799 (diff) |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/fair.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2e2dc55bd189..d34aa933d646 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9101,13 +9101,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 @@ -9142,6 +9142,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); |