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.c17
1 files changed, 7 insertions, 10 deletions
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,
2365 size_t count, loff_t *ppos) 2365 size_t count, loff_t *ppos)
2366{ 2366{
2367 struct inode * inode = file_inode(file); 2367 struct inode * inode = file_inode(file);
2368 char *page; 2368 void *page;
2369 ssize_t length; 2369 ssize_t length;
2370 struct task_struct *task = get_proc_task(inode); 2370 struct task_struct *task = get_proc_task(inode);
2371 2371
@@ -2380,14 +2380,11 @@ static ssize_t proc_pid_attr_write(struct file * file, const char __user * buf,
2380 if (*ppos != 0) 2380 if (*ppos != 0)
2381 goto out; 2381 goto out;
2382 2382
2383 length = -ENOMEM; 2383 page = memdup_user(buf, count);
2384 page = (char*)__get_free_page(GFP_TEMPORARY); 2384 if (IS_ERR(page)) {
2385 if (!page) 2385 length = PTR_ERR(page);
2386 goto out; 2386 goto out;
2387 2387 }
2388 length = -EFAULT;
2389 if (copy_from_user(page, buf, count))
2390 goto out_free;
2391 2388
2392 /* Guard against adverse ptrace interaction */ 2389 /* Guard against adverse ptrace interaction */
2393 length = mutex_lock_interruptible(&task->signal->cred_guard_mutex); 2390 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,
2396 2393
2397 length = security_setprocattr(task, 2394 length = security_setprocattr(task,
2398 (char*)file->f_path.dentry->d_name.name, 2395 (char*)file->f_path.dentry->d_name.name,
2399 (void*)page, count); 2396 page, count);
2400 mutex_unlock(&task->signal->cred_guard_mutex); 2397 mutex_unlock(&task->signal->cred_guard_mutex);
2401out_free: 2398out_free:
2402 free_page((unsigned long) page); 2399 kfree(page);
2403out: 2400out:
2404 put_task_struct(task); 2401 put_task_struct(task);
2405out_no_task: 2402out_no_task: