From c1bd453f7f2fea16a1d744eb548fc3607655e22a Mon Sep 17 00:00:00 2001 From: Hong-Mei Li Date: Fri, 27 Mar 2015 14:15:25 -0700 Subject: 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 Reviewed-on: http://gerrit.mot.com/729547 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Yi-Wei Zhao Submit-Approved: Jira Key --- drivers/staging/android/lowmemorykiller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- cgit v1.2.3