Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
oom: Restore locking for oom_adj
Browse files Browse the repository at this point in the history
Change-Id: If7de08df1785c6aaad3c3da27f26b6ed4b625e47
  • Loading branch information
vware committed Dec 1, 2022
1 parent c74f78e commit e8d6998
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,9 +1110,15 @@ static ssize_t oom_adj_write(struct file *file, const char __user *buf,
goto out;
}

task_lock(task);
if (!task->mm) {
err = -EINVAL;
goto err_task_lock;
}

if (!lock_task_sighand(task, &flags)) {
err = -ESRCH;
goto err_put_task;
goto err_task_lock;
}

/*
Expand Down Expand Up @@ -1142,7 +1148,8 @@ static ssize_t oom_adj_write(struct file *file, const char __user *buf,
trace_oom_score_adj_update(task);
err_sighand:
unlock_task_sighand(task, &flags);
err_put_task:
err_task_lock:
task_unlock(task);
put_task_struct(task);
out:
return err < 0 ? err : count;
Expand Down

0 comments on commit e8d6998

Please sign in to comment.