aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorHong-Mei Li <a21834@motorola.com>2015-03-27 14:15:25 -0700
committerMister Oyster <oysterized@gmail.com>2017-04-17 11:51:53 +0200
commitc1bd453f7f2fea16a1d744eb548fc3607655e22a (patch)
treea02b9e44ccb2e22a61e0b3ad6998d50ae21390c4 /drivers
parent5b6c8937233e2945a5fe70152ace3b7e0a8d804b (diff)
drivers:lmk: Fix null pointer issue
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. Change-Id: If28d9a2d3160177f682c08f62421c20eb0cb5e81 Signed-off-by: Hong-Mei Li <a21834@motorola.com> Reviewed-on: http://gerrit.mot.com/729547 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Yi-Wei Zhao <gbjc64@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/android/lowmemorykiller.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 114c6a5ec..634de6f00 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -136,7 +136,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) {