ANDROID: mm, oom: Fix select_bad_process customization
Patch 'ANDROID: mm, oom: Avoid killing tasks with negative ADJ scores' does not handle a special case when oom_evaluate_task is aborted and sets oc->chosen to -1. Check for this condition to avoid invalid memory access. Bug: 179177151 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: Id9a3f1b824c6a81d157782b8cb18115b3c577a50
This commit is contained in:
@@ -404,7 +404,8 @@ static void select_bad_process(struct oom_control *oc)
|
|||||||
* a postive ADJ to kill, kill the task with the positive ADJ
|
* a postive ADJ to kill, kill the task with the positive ADJ
|
||||||
* instead.
|
* instead.
|
||||||
*/
|
*/
|
||||||
if (oc->chosen && oc->chosen->signal->oom_score_adj < 0) {
|
if (oc->chosen && oc->chosen != (void *)-1UL &&
|
||||||
|
oc->chosen->signal->oom_score_adj < 0) {
|
||||||
put_task_struct(oc->chosen);
|
put_task_struct(oc->chosen);
|
||||||
oc->chosen = oc->chosen_non_negative_adj;
|
oc->chosen = oc->chosen_non_negative_adj;
|
||||||
oc->chosen_points = oc->chosen_non_negative_adj_points;
|
oc->chosen_points = oc->chosen_non_negative_adj_points;
|
||||||
|
Reference in New Issue
Block a user