x86: fix "BUG: sleeping function called from invalid context" in print_vma_addr()
[sfrench/cifs-2.6.git] / mm / memory.c
index 717aa0e3be2d7d9b0385411257a89d50f6ea3afc..55b97ef6de11f6cbb11bcb3ecd9ca34b8b140246 100644 (file)
@@ -2711,6 +2711,13 @@ void print_vma_addr(char *prefix, unsigned long ip)
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
 
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma;
 
+       /*
+        * Do not print if we are in atomic
+        * contexts (in exception stacks, etc.):
+        */
+       if (preempt_count())
+               return;
+
        down_read(&mm->mmap_sem);
        vma = find_vma(mm, ip);
        if (vma && vma->vm_file) {
        down_read(&mm->mmap_sem);
        vma = find_vma(mm, ip);
        if (vma && vma->vm_file) {