diff --git a/fs/proc/base.c b/fs/proc/base.c index 55ce0ee9c5c7..297ea12b3cfd 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2704,6 +2704,10 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, void *page; int rv; + /* A task may only write when it was the opener. */ + if (file->f_cred != current_real_cred()) + return -EPERM; + rcu_read_lock(); task = pid_task(proc_pid(inode), PIDTYPE_PID); if (!task) {