[SCSI] bnx2i: bug fixes in bnx2i_init_one to handle error conditions
[safe/jmp/linux-2.6] / fs / proc / task_mmu.c
index b0ae0be..9bd8be1 100644 (file)
@@ -119,6 +119,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
        mm = mm_for_maps(priv->task);
        if (!mm)
                return NULL;
+       down_read(&mm->mmap_sem);
 
        tail_vma = get_gate_vma(priv->task);
        priv->tail_vma = tail_vma;
@@ -204,6 +205,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
        struct file *file = vma->vm_file;
        int flags = vma->vm_flags;
        unsigned long ino = 0;
+       unsigned long long pgoff = 0;
        dev_t dev = 0;
        int len;
 
@@ -211,6 +213,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
                struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
                dev = inode->i_sb->s_dev;
                ino = inode->i_ino;
+               pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;
        }
 
        seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu %n",
@@ -220,7 +223,7 @@ static void show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
                        flags & VM_WRITE ? 'w' : '-',
                        flags & VM_EXEC ? 'x' : '-',
                        flags & VM_MAYSHARE ? 's' : 'p',
-                       ((loff_t)vma->vm_pgoff) << PAGE_SHIFT,
+                       pgoff,
                        MAJOR(dev), MINOR(dev), ino, &len);
 
        /*
@@ -663,6 +666,10 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
                goto out_task;
 
        ret = 0;
+
+       if (!count)
+               goto out_task;
+
        mm = get_task_mm(task);
        if (!mm)
                goto out_task;