]> Git Repo - linux.git/commitdiff
procfs: call default get_unmapped_area on MMU-present architectures
authorHATAYAMA Daisuke <[email protected]>
Wed, 16 Oct 2013 20:47:05 +0000 (13:47 -0700)
committerLinus Torvalds <[email protected]>
Thu, 17 Oct 2013 04:35:53 +0000 (21:35 -0700)
Commit c4fe24485729 ("sparc: fix PCI device proc file mmap(2)") added
proc_reg_get_unmapped_area in proc_reg_file_ops and
proc_reg_file_ops_no_compat, by which now mmap always returns EIO if
get_unmapped_area method is not defined for the target procfs file,
which causes regression of mmap on /proc/vmcore.

To address this issue, like get_unmapped_area(), call default
current->mm->get_unmapped_area on MMU-present architectures if
pde->proc_fops->get_unmapped_area, i.e.  the one in actual file
operation in the procfs file, is not defined.

Reported-by: Michael Holzheu <[email protected]>
Signed-off-by: HATAYAMA Daisuke <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: David S. Miller <[email protected]>
Tested-by: Michael Holzheu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/proc/inode.c

index 6c501c4d996de4550a8a012df55ad787b3799bdf..8eaa1ba793fc188879d405e768a81aedbaa4bf76 100644 (file)
@@ -289,9 +289,13 @@ static unsigned long proc_reg_get_unmapped_area(struct file *file, unsigned long
 {
        struct proc_dir_entry *pde = PDE(file_inode(file));
        unsigned long rv = -EIO;
-       unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
+       unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long) = NULL;
        if (use_pde(pde)) {
-               get_unmapped_area = pde->proc_fops->get_unmapped_area;
+#ifdef CONFIG_MMU
+               get_unmapped_area = current->mm->get_unmapped_area;
+#endif
+               if (pde->proc_fops->get_unmapped_area)
+                       get_unmapped_area = pde->proc_fops->get_unmapped_area;
                if (get_unmapped_area)
                        rv = get_unmapped_area(file, orig_addr, len, pgoff, flags);
                unuse_pde(pde);
This page took 0.059551 seconds and 4 git commands to generate.