diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-01 14:45:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-01 14:45:26 -0500 |
commit | ca04d396a3229d37d8151311ad70d1255a5807bd (patch) | |
tree | cd261e4e1215c2af61fe106f7f8265387c4a901e | |
parent | f5eab26701999b1aa26d06772e013b11c4a16f6a (diff) | |
parent | 2459ee8651dc5ab72790c2ffa99af288c7641b64 (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner:
"This set of updates contains:
- Another bugfix for the pathologic vm86 machinery. Clear
thread.vm86 on fork to prevent corrupting the parent state. This
comes along with an update to the vm86 selftest case
- Fix another corner case in the ioapic setup code which causes a
boot crash on some oddball systems
- Fix the fallout from the dma allocation consolidation work, which
leads to a NULL pointer dereference when the allocation code is
called with a NULL device"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/vm86: Set thread.vm86 to NULL on fork/clone
selftests/x86: Add a fork() to entry_from_vm86 to catch fork bugs
x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest()
x86/dma-mapping: Fix arch_dma_alloc_attrs() oops with NULL dev
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 3 | ||||
-rw-r--r-- | tools/testing/selftests/x86/entry_from_vm86.c | 4 |
4 files changed, 13 insertions, 3 deletions
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index bb6bfc01cb82..4f2821527014 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -2547,7 +2547,9 @@ void __init setup_ioapic_dest(void) | |||
2547 | mask = apic->target_cpus(); | 2547 | mask = apic->target_cpus(); |
2548 | 2548 | ||
2549 | chip = irq_data_get_irq_chip(idata); | 2549 | chip = irq_data_get_irq_chip(idata); |
2550 | chip->irq_set_affinity(idata, mask, false); | 2550 | /* Might be lapic_chip for irq 0 */ |
2551 | if (chip->irq_set_affinity) | ||
2552 | chip->irq_set_affinity(idata, mask, false); | ||
2551 | } | 2553 | } |
2552 | } | 2554 | } |
2553 | #endif | 2555 | #endif |
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 1b55de1267cf..cd99433b8ba1 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -131,11 +131,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr, | |||
131 | 131 | ||
132 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp) | 132 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp) |
133 | { | 133 | { |
134 | if (!*dev) | ||
135 | *dev = &x86_dma_fallback_dev; | ||
136 | |||
134 | *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); | 137 | *gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32); |
135 | *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp); | 138 | *gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp); |
136 | 139 | ||
137 | if (!*dev) | ||
138 | *dev = &x86_dma_fallback_dev; | ||
139 | if (!is_device_dma_capable(*dev)) | 140 | if (!is_device_dma_capable(*dev)) |
140 | return false; | 141 | return false; |
141 | return true; | 142 | return true; |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index e28db181e4fc..9f7c21c22477 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -84,6 +84,9 @@ EXPORT_SYMBOL_GPL(idle_notifier_unregister); | |||
84 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | 84 | int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) |
85 | { | 85 | { |
86 | memcpy(dst, src, arch_task_struct_size); | 86 | memcpy(dst, src, arch_task_struct_size); |
87 | #ifdef CONFIG_VM86 | ||
88 | dst->thread.vm86 = NULL; | ||
89 | #endif | ||
87 | 90 | ||
88 | return fpu__copy(&dst->thread.fpu, &src->thread.fpu); | 91 | return fpu__copy(&dst->thread.fpu, &src->thread.fpu); |
89 | } | 92 | } |
diff --git a/tools/testing/selftests/x86/entry_from_vm86.c b/tools/testing/selftests/x86/entry_from_vm86.c index 421c607a8856..d075ea0e5ca1 100644 --- a/tools/testing/selftests/x86/entry_from_vm86.c +++ b/tools/testing/selftests/x86/entry_from_vm86.c | |||
@@ -230,5 +230,9 @@ int main(void) | |||
230 | } | 230 | } |
231 | clearhandler(SIGSEGV); | 231 | clearhandler(SIGSEGV); |
232 | 232 | ||
233 | /* Make sure nothing explodes if we fork. */ | ||
234 | if (fork() > 0) | ||
235 | return 0; | ||
236 | |||
233 | return (nerrs == 0 ? 0 : 1); | 237 | return (nerrs == 0 ? 0 : 1); |
234 | } | 238 | } |