diff options
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r-- | fs/proc/inode.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 8eaa1ba793fc..124fc43c7090 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -285,19 +285,27 @@ static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) | |||
285 | return rv; | 285 | return rv; |
286 | } | 286 | } |
287 | 287 | ||
288 | static unsigned long proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) | 288 | static unsigned long |
289 | proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | ||
290 | unsigned long len, unsigned long pgoff, | ||
291 | unsigned long flags) | ||
289 | { | 292 | { |
290 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
291 | unsigned long rv = -EIO; | 294 | unsigned long rv = -EIO; |
292 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long) = NULL; | 295 | |
293 | if (use_pde(pde)) { | 296 | if (use_pde(pde)) { |
297 | typeof(proc_reg_get_unmapped_area) *get_area; | ||
298 | |||
299 | get_area = pde->proc_fops->get_unmapped_area; | ||
294 | #ifdef CONFIG_MMU | 300 | #ifdef CONFIG_MMU |
295 | get_unmapped_area = current->mm->get_unmapped_area; | 301 | if (!get_area) |
302 | get_area = current->mm->get_unmapped_area; | ||
296 | #endif | 303 | #endif |
297 | if (pde->proc_fops->get_unmapped_area) | 304 | |
298 | get_unmapped_area = pde->proc_fops->get_unmapped_area; | 305 | if (get_area) |
299 | if (get_unmapped_area) | 306 | rv = get_area(file, orig_addr, len, pgoff, flags); |
300 | rv = get_unmapped_area(file, orig_addr, len, pgoff, flags); | 307 | else |
308 | rv = orig_addr; | ||
301 | unuse_pde(pde); | 309 | unuse_pde(pde); |
302 | } | 310 | } |
303 | return rv; | 311 | return rv; |