lkml.org 
[lkml]   [2009]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 04/11 -mmotm] oom: 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>
Signed-off-by: David Rientjes <rientjes@google.com>
---
drivers/staging/android/lowmemorykiller.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -92,12 +92,18 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
for_each_process(p) {
int oom_adj;

- if (!p->mm)
+ task_lock(p);
+ if (!p->mm) {
+ task_unlock(p);
continue;
+ }
oom_adj = p->oomkilladj;
- if (oom_adj < min_adj)
+ if (oom_adj < min_adj) {
+ task_unlock(p);
continue;
+ }
tasksize = get_mm_rss(p->mm);
+ task_unlock(p);
if (tasksize <= 0)
continue;
if (selected) {

\
 
 \ /
  Last update: 2009-05-11 00:11    [W:0.349 / U:0.804 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site