Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8c475d00 authored by Hong-Mei Li's avatar Hong-Mei Li Committed by alexax66
Browse files

kernel: avoid adding non-thread-group task to LMK rbtree



To maintain the task adj RB tree, we add a task to the RB tree when fork,
and delete it when exit. The place is exactly the same as the linear
p->tasks list, only when the task is thread_group_leader.
But to handle the oom_score_adj change case, which did not check the
thread_group_leader, we may del/add a non-leader task to the RB tree.
Finally leave the task in the RB tree, since we would not really delete
a non-leader task from the tree. The orphan task would finally be freed,
and cause later use-after-free panic when accessing RB tree.
Solution:
Move the rbtree adj_node to signal_struct, which is shared between
task and all threads. This can make sure we only add one node for
a thread group.
Change-Id: I1e8dfe490656408863b3726c7bc9e4ee6dc5abc1
Signed-off-by: default avatarHong-Mei Li <a21834@motorola.com>
Reviewed-on: http://gerrit.mot.com/754224


SLTApproved: Slta Waiver <sltawvr@motorola.com>
SME-Granted: SME Approvals Granted
Tested-by: default avatarJira Key <jirakey@motorola.com>
Reviewed-by: default avatarZhi-Ming Yuan <a14194@motorola.com>
Reviewed-by: default avatarYi-Wei Zhao <gbjc64@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>

Used: https://bitbucket.org/arter97/android_kernel_samsung_exynos7420/commits/d0093f289203e4f76160a7e3ea007996c5ecbe76
parent a6d5e566
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment