Skip to content

Commit

Permalink
drivers:lmk: Fix null pointer issue
Browse files Browse the repository at this point in the history
On some race, the tsk that lmk is using may be deleted from the RB tree
by other thread, and rb_next would return a NULL if we use this tsk to
get next. For this case, we need to skip this round of shrink and wait
for the next turn. Otherwise, tsk would trigger NULL pointer panic.

Signed-off-by: Hong-Mei Li <[email protected]>
Reviewed-on: http://gerrit.mot.com/729556
SLTApproved: Slta Waiver <[email protected]>
SME-Granted: SME Approvals Granted
Tested-by: Jira Key <[email protected]>
Reviewed-by: Yi-Wei Zhao <[email protected]>
Submit-Approved: Jira Key <[email protected]>
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
Hong-Mei Li authored and neobuddy89 committed Jul 13, 2015
1 parent 5151542 commit 07ac14e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/android/lowmemorykiller.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc)
rcu_read_lock();
#ifdef CONFIG_ANDROID_LMK_ADJ_RBTREE
for (tsk = pick_first_task();
tsk != pick_last_task();
tsk != pick_last_task() && tsk != NULL;
tsk = pick_next_from_adj_tree(tsk)) {
#else
for_each_process(tsk) {
Expand Down

0 comments on commit 07ac14e

Please sign in to comment.