summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/base.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index a11eb7196ec8..2a0f5ee9b623 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1083,15 +1083,9 @@ 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_task_lock;
+ goto err_put_task;
}
/*
@@ -1121,8 +1115,7 @@ 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_task_lock:
- task_unlock(task);
+err_put_task:
put_task_struct(task);
out:
return err < 0 ? err : count;
@@ -1186,15 +1179,9 @@ static ssize_t oom_score_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_task_lock;
+ goto err_put_task;
}
if ((short)oom_score_adj < task->signal->oom_score_adj_min &&
@@ -1210,8 +1197,7 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
err_sighand:
unlock_task_sighand(task, &flags);
-err_task_lock:
- task_unlock(task);
+err_put_task:
put_task_struct(task);
out:
return err < 0 ? err : count;