STALE1973d REVIEWED: 1 (0M)

1 review trailer.

[PATCH] mm/oom_kill: fix wild pointer in out_of_memory

From: Jiang Biao <hidden>
Date: 2021-03-13 04:31:12
Also in: lkml
Subsystem: memory management, memory management - oom killer, the rest · Maintainers: Andrew Morton, Michal Hocko, Linus Torvalds

From: Bin Lai <redacted>

From: Bin Lai <redacted>

The oc->chosen is used by oom implementation, and the caller does
not initialize this variable. If the tasks of memcg are all unkillable,
oom_evaluate_task cann't choose any task, and the oc->chosen will be
a wild pointer. So we should initialize oc->chosen before calling
oom_evaluate_task.

Signed-off-by: Bin Lai <redacted>
Reviewed-by: Jiang Biao <redacted>
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 9efaf43..0658a30 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -366,6 +366,7 @@ static int oom_evaluate_task(struct task_struct *task, void *arg)
 static void select_bad_process(struct oom_control *oc)
 {
 	oc->chosen_points = LONG_MIN;
+	oc->chosen = NULL;
 
 	if (is_memcg_oom(oc))
 		mem_cgroup_scan_tasks(oc->memcg, oom_evaluate_task, oc);
-- 
1.8.3.1

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help