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.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 01f7769da8e6..989af5e55d1b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1558,29 +1558,20 @@ static ssize_t proc_pid_attr_read(struct file * file, char __user * buf,
1558 size_t count, loff_t *ppos) 1558 size_t count, loff_t *ppos)
1559{ 1559{
1560 struct inode * inode = file->f_path.dentry->d_inode; 1560 struct inode * inode = file->f_path.dentry->d_inode;
1561 unsigned long page; 1561 char *p = NULL;
1562 ssize_t length; 1562 ssize_t length;
1563 struct task_struct *task = get_proc_task(inode); 1563 struct task_struct *task = get_proc_task(inode);
1564 1564
1565 length = -ESRCH;
1566 if (!task) 1565 if (!task)
1567 goto out_no_task; 1566 return -ESRCH;
1568
1569 if (count > PAGE_SIZE)
1570 count = PAGE_SIZE;
1571 length = -ENOMEM;
1572 if (!(page = __get_free_page(GFP_KERNEL)))
1573 goto out;
1574 1567
1575 length = security_getprocattr(task, 1568 length = security_getprocattr(task,
1576 (char*)file->f_path.dentry->d_name.name, 1569 (char*)file->f_path.dentry->d_name.name,
1577 (void*)page, count); 1570 &p);
1578 if (length >= 0)
1579 length = simple_read_from_buffer(buf, count, ppos, (char *)page, length);
1580 free_page(page);
1581out:
1582 put_task_struct(task); 1571 put_task_struct(task);
1583out_no_task: 1572 if (length > 0)
1573 length = simple_read_from_buffer(buf, count, ppos, p, length);
1574 kfree(p);
1584 return length; 1575 return length;
1585} 1576}
1586 1577