When reading /proc/pid/pagemap at an offset that
does not contain mapped pages, call pagemap_fill
to fill the buffer with -1 until either the end,
or a valid vma is encountered.

Signed-off-by: Dave Boutcher <[EMAIL PROTECTED]>
---
 fs/proc/task_mmu.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 1f78cb4..3978f31 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -671,10 +671,12 @@ static ssize_t pagemap_read(struct file *file, char 
__user *buf,
                        ret = -EIO;
                        goto out_mm;
                }
-               vend = min(vma->vm_start - 1, end - 1) + 1;
-               ret = pagemap_fill(&pm, vend);
-               if (ret || !pm.count)
-                       break;
+               if (pm.next < vma->vm_start) {
+                       vend = min(vma->vm_start - 1, end - 1) + 1;
+                       pagemap_fill(&pm, vend);
+                       continue;
+               }
+
                vend = min(vma->vm_end - 1, end - 1) + 1;
                ret = walk_page_range(mm, vma->vm_start, vend,
                                      &pagemap_walk, &pm);
-- 
1.4.4.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to