X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=fs%2Fproc%2Fbase.c;h=2cf5d7e373757d631de6f9d8a174287d46058219;hb=eca56ff906bdd0239485e8b47154a6e73dd9a2f3;hp=55e01f88eac9d1156e240700598fd9688c6c503e;hpb=b4cee21ee057ff3e5c9014fb6a175bd932c5ce62;p=deliverable%2Flinux.git diff --git a/fs/proc/base.c b/fs/proc/base.c index 55e01f88eac9..2cf5d7e37375 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -2365,7 +2365,7 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, size_t count, loff_t *ppos) { struct inode * inode = file_inode(file); - char *page; + void *page; ssize_t length; struct task_struct *task = get_proc_task(inode); @@ -2380,14 +2380,11 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, if (*ppos != 0) goto out; - length = -ENOMEM; - page = (char*)__get_free_page(GFP_TEMPORARY); - if (!page) + page = memdup_user(buf, count); + if (IS_ERR(page)) { + length = PTR_ERR(page); goto out; - - length = -EFAULT; - if (copy_from_user(page, buf, count)) - goto out_free; + } /* Guard against adverse ptrace interaction */ length = mutex_lock_interruptible(&task->signal->cred_guard_mutex); @@ -2396,10 +2393,10 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf, length = security_setprocattr(task, (char*)file->f_path.dentry->d_name.name, - (void*)page, count); + page, count); mutex_unlock(&task->signal->cred_guard_mutex); out_free: - free_page((unsigned long) page); + kfree(page); out: put_task_struct(task); out_no_task: