Commit 5d14a573 authored by David Rientjes's avatar David Rientjes Committed by Greg Kroah-Hartman

Staging: android: lowmemorykiller: fix possible android low memory killer NULL pointer

get_mm_rss() atomically dereferences the actual without checking for a
NULL pointer, which is possible since task_lock() is not held.

Cc: San Mehat <san@android.com>
Cc: Arve Hjønnevåg <arve@android.com>
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 34006e11
...@@ -92,12 +92,18 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask) ...@@ -92,12 +92,18 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
for_each_process(p) { for_each_process(p) {
int oom_adj; int oom_adj;
if (!p->mm) task_lock(p);
if (!p->mm) {
task_unlock(p);
continue; continue;
}
oom_adj = p->oomkilladj; oom_adj = p->oomkilladj;
if (oom_adj < min_adj) if (oom_adj < min_adj) {
task_unlock(p);
continue; continue;
}
tasksize = get_mm_rss(p->mm); tasksize = get_mm_rss(p->mm);
task_unlock(p);
if (tasksize <= 0) if (tasksize <= 0)
continue; continue;
if (selected) { if (selected) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment