aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r--fs/proc/base.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 795319c54f72..b859fc749c07 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -683,8 +683,6 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
683 char buffer[PROC_NUMBUF], *end; 683 char buffer[PROC_NUMBUF], *end;
684 int oom_adjust; 684 int oom_adjust;
685 685
686 if (!capable(CAP_SYS_RESOURCE))
687 return -EPERM;
688 memset(buffer, 0, sizeof(buffer)); 686 memset(buffer, 0, sizeof(buffer));
689 if (count > sizeof(buffer) - 1) 687 if (count > sizeof(buffer) - 1)
690 count = sizeof(buffer) - 1; 688 count = sizeof(buffer) - 1;
@@ -699,6 +697,10 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
699 task = get_proc_task(file->f_dentry->d_inode); 697 task = get_proc_task(file->f_dentry->d_inode);
700 if (!task) 698 if (!task)
701 return -ESRCH; 699 return -ESRCH;
700 if (oom_adjust < task->oomkilladj && !capable(CAP_SYS_RESOURCE)) {
701 put_task_struct(task);
702 return -EACCES;
703 }
702 task->oomkilladj = oom_adjust; 704 task->oomkilladj = oom_adjust;
703 put_task_struct(task); 705 put_task_struct(task);
704 if (end - buffer == 0) 706 if (end - buffer == 0)
@@ -1883,8 +1885,9 @@ out:
1883 return; 1885 return;
1884} 1886}
1885 1887
1886struct dentry *proc_pid_instantiate(struct inode *dir, 1888static struct dentry *proc_pid_instantiate(struct inode *dir,
1887 struct dentry * dentry, struct task_struct *task, void *ptr) 1889 struct dentry * dentry,
1890 struct task_struct *task, void *ptr)
1888{ 1891{
1889 struct dentry *error = ERR_PTR(-ENOENT); 1892 struct dentry *error = ERR_PTR(-ENOENT);
1890 struct inode *inode; 1893 struct inode *inode;