aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/alternative.c6
-rw-r--r--mm/vmalloc.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index a84ac7b570e6..6907b8e85d52 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -498,12 +498,12 @@ void *text_poke_early(void *addr, const void *opcode, size_t len)
498 */ 498 */
499void *__kprobes text_poke(void *addr, const void *opcode, size_t len) 499void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
500{ 500{
501 unsigned long flags;
502 char *vaddr; 501 char *vaddr;
503 int nr_pages = 2; 502 int nr_pages = 2;
504 struct page *pages[2]; 503 struct page *pages[2];
505 int i; 504 int i;
506 505
506 might_sleep();
507 if (!core_kernel_text((unsigned long)addr)) { 507 if (!core_kernel_text((unsigned long)addr)) {
508 pages[0] = vmalloc_to_page(addr); 508 pages[0] = vmalloc_to_page(addr);
509 pages[1] = vmalloc_to_page(addr + PAGE_SIZE); 509 pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
@@ -517,9 +517,9 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
517 nr_pages = 1; 517 nr_pages = 1;
518 vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL); 518 vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
519 BUG_ON(!vaddr); 519 BUG_ON(!vaddr);
520 local_irq_save(flags); 520 local_irq_disable();
521 memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len); 521 memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
522 local_irq_restore(flags); 522 local_irq_enable();
523 vunmap(vaddr); 523 vunmap(vaddr);
524 sync_core(); 524 sync_core();
525 /* Could also do a CLFLUSH here to speed up CPU recovery; but 525 /* Could also do a CLFLUSH here to speed up CPU recovery; but
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 4dd2636d0b92..f83a70167b99 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1257,6 +1257,7 @@ EXPORT_SYMBOL(vfree);
1257void vunmap(const void *addr) 1257void vunmap(const void *addr)
1258{ 1258{
1259 BUG_ON(in_interrupt()); 1259 BUG_ON(in_interrupt());
1260 might_sleep();
1260 __vunmap(addr, 0); 1261 __vunmap(addr, 0);
1261} 1262}
1262EXPORT_SYMBOL(vunmap); 1263EXPORT_SYMBOL(vunmap);
@@ -1276,6 +1277,8 @@ void *vmap(struct page **pages, unsigned int count,
1276{ 1277{
1277 struct vm_struct *area; 1278 struct vm_struct *area;
1278 1279
1280 might_sleep();
1281
1279 if (count > num_physpages) 1282 if (count > num_physpages)
1280 return NULL; 1283 return NULL;
1281 1284