diff options
-rw-r--r-- | mm/vmalloc.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index bba06c41fc59..f018d7e0addb 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -168,6 +168,21 @@ int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages) | |||
168 | } | 168 | } |
169 | EXPORT_SYMBOL_GPL(map_vm_area); | 169 | EXPORT_SYMBOL_GPL(map_vm_area); |
170 | 170 | ||
171 | static inline int is_vmalloc_or_module_addr(const void *x) | ||
172 | { | ||
173 | /* | ||
174 | * x86-64 and sparc64 put modules in a special place, | ||
175 | * and fall back on vmalloc() if that fails. Others | ||
176 | * just put it in the vmalloc space. | ||
177 | */ | ||
178 | #if defined(CONFIG_MODULES) && defined(MODULES_VADDR) | ||
179 | unsigned long addr = (unsigned long)x; | ||
180 | if (addr >= MODULES_VADDR && addr < MODULES_END) | ||
181 | return 1; | ||
182 | #endif | ||
183 | return is_vmalloc_addr(x); | ||
184 | } | ||
185 | |||
171 | /* | 186 | /* |
172 | * Map a vmalloc()-space virtual address to the physical page. | 187 | * Map a vmalloc()-space virtual address to the physical page. |
173 | */ | 188 | */ |
@@ -184,8 +199,7 @@ struct page *vmalloc_to_page(const void *vmalloc_addr) | |||
184 | * XXX we might need to change this if we add VIRTUAL_BUG_ON for | 199 | * XXX we might need to change this if we add VIRTUAL_BUG_ON for |
185 | * architectures that do not vmalloc module space | 200 | * architectures that do not vmalloc module space |
186 | */ | 201 | */ |
187 | VIRTUAL_BUG_ON(!is_vmalloc_addr(vmalloc_addr) && | 202 | VIRTUAL_BUG_ON(!is_vmalloc_or_module_addr(vmalloc_addr)); |
188 | !is_module_address(addr)); | ||
189 | 203 | ||
190 | if (!pgd_none(*pgd)) { | 204 | if (!pgd_none(*pgd)) { |
191 | pud = pud_offset(pgd, addr); | 205 | pud = pud_offset(pgd, addr); |