Magellan Linux

Annotation of /trunk/kernel26-magellan/patches-2.6.35-r3/0101-2.6.35.2-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1136 - (hide annotations) (download)
Sat Sep 18 11:01:49 2010 UTC (13 years, 8 months ago) by niro
File size: 94083 byte(s)
-2.6.35-magellan-r3; added patch to fix CVE-2010-3301
1 niro 1136 diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
2     index 98922f7..4824fb4 100644
3     --- a/arch/arm/Kconfig
4     +++ b/arch/arm/Kconfig
5     @@ -1027,6 +1027,18 @@ config PL310_ERRATA_588369
6     is not correctly implemented in PL310 as clean lines are not
7     invalidated as a result of these operations. Note that this errata
8     uses Texas Instrument's secure monitor api.
9     +
10     +config ARM_ERRATA_720789
11     + bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
12     + depends on CPU_V7 && SMP
13     + help
14     + This option enables the workaround for the 720789 Cortex-A9 (prior to
15     + r2p0) erratum. A faulty ASID can be sent to the other CPUs for the
16     + broadcasted CP15 TLB maintenance operations TLBIASIDIS and TLBIMVAIS.
17     + As a consequence of this erratum, some TLB entries which should be
18     + invalidated are not, resulting in an incoherency in the system page
19     + tables. The workaround changes the TLB flushing routines to invalidate
20     + entries regardless of the ASID.
21     endmenu
22    
23     source "arch/arm/common/Kconfig"
24     diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
25     index bd863d8..33b546a 100644
26     --- a/arch/arm/include/asm/tlbflush.h
27     +++ b/arch/arm/include/asm/tlbflush.h
28     @@ -378,7 +378,11 @@ static inline void local_flush_tlb_mm(struct mm_struct *mm)
29     if (tlb_flag(TLB_V6_I_ASID))
30     asm("mcr p15, 0, %0, c8, c5, 2" : : "r" (asid) : "cc");
31     if (tlb_flag(TLB_V7_UIS_ASID))
32     +#ifdef CONFIG_ARM_ERRATA_720789
33     + asm("mcr p15, 0, %0, c8, c3, 0" : : "r" (zero) : "cc");
34     +#else
35     asm("mcr p15, 0, %0, c8, c3, 2" : : "r" (asid) : "cc");
36     +#endif
37    
38     if (tlb_flag(TLB_BTB)) {
39     /* flush the branch target cache */
40     @@ -424,7 +428,11 @@ local_flush_tlb_page(struct vm_area_struct *vma, unsigned long uaddr)
41     if (tlb_flag(TLB_V6_I_PAGE))
42     asm("mcr p15, 0, %0, c8, c5, 1" : : "r" (uaddr) : "cc");
43     if (tlb_flag(TLB_V7_UIS_PAGE))
44     +#ifdef CONFIG_ARM_ERRATA_720789
45     + asm("mcr p15, 0, %0, c8, c3, 3" : : "r" (uaddr & PAGE_MASK) : "cc");
46     +#else
47     asm("mcr p15, 0, %0, c8, c3, 1" : : "r" (uaddr) : "cc");
48     +#endif
49    
50     if (tlb_flag(TLB_BTB)) {
51     /* flush the branch target cache */
52     diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
53     index fdda6be..d717b49 100644
54     --- a/arch/arm/mach-pxa/cm-x300.c
55     +++ b/arch/arm/mach-pxa/cm-x300.c
56     @@ -745,9 +745,10 @@ static void __init cm_x300_init(void)
57     {
58     cm_x300_init_mfp();
59    
60     - pxa_set_ffuart_info(NULL);
61     pxa_set_btuart_info(NULL);
62     pxa_set_stuart_info(NULL);
63     + if (cpu_is_pxa300())
64     + pxa_set_ffuart_info(NULL);
65    
66     cm_x300_init_da9030();
67     cm_x300_init_dm9000();
68     diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
69     index 6bd932c..7a0dc5a 100644
70     --- a/arch/arm/plat-mxc/include/mach/gpio.h
71     +++ b/arch/arm/plat-mxc/include/mach/gpio.h
72     @@ -19,6 +19,7 @@
73     #ifndef __ASM_ARCH_MXC_GPIO_H__
74     #define __ASM_ARCH_MXC_GPIO_H__
75    
76     +#include <linux/spinlock.h>
77     #include <mach/hardware.h>
78     #include <asm-generic/gpio.h>
79    
80     diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
81     index 77cfe7a..5d2f17d 100644
82     --- a/arch/powerpc/Makefile
83     +++ b/arch/powerpc/Makefile
84     @@ -163,9 +163,11 @@ drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
85     # Default to zImage, override when needed
86     all: zImage
87    
88     -BOOT_TARGETS = zImage zImage.initrd uImage zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
89     +# With make 3.82 we cannot mix normal and wildcard targets
90     +BOOT_TARGETS1 := zImage zImage.initrd uImaged
91     +BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.%
92    
93     -PHONY += $(BOOT_TARGETS)
94     +PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
95    
96     boot := arch/$(ARCH)/boot
97    
98     @@ -180,10 +182,16 @@ relocs_check: arch/powerpc/relocs_check.pl vmlinux
99     zImage: relocs_check
100     endif
101    
102     -$(BOOT_TARGETS): vmlinux
103     +$(BOOT_TARGETS1): vmlinux
104     + $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
105     +$(BOOT_TARGETS2): vmlinux
106     + $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
107     +
108     +
109     +bootwrapper_install:
110     $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
111    
112     -bootwrapper_install %.dtb:
113     +%.dtb:
114     $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
115    
116     define archhelp
117     diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
118     index babccee..4339d20 100644
119     --- a/arch/powerpc/kernel/perf_event_fsl_emb.c
120     +++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
121     @@ -569,6 +569,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
122     struct perf_sample_data data;
123    
124     perf_sample_data_init(&data, 0);
125     + data.period = event->hw.last_period;
126    
127     if (perf_event_overflow(event, nmi, &data, regs)) {
128     /*
129     diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
130     index 8859e12..c1cf59d 100644
131     --- a/arch/x86/include/asm/cmpxchg_32.h
132     +++ b/arch/x86/include/asm/cmpxchg_32.h
133     @@ -27,20 +27,20 @@ struct __xchg_dummy {
134     switch (size) { \
135     case 1: \
136     asm volatile("xchgb %b0,%1" \
137     - : "=q" (__x) \
138     - : "m" (*__xg(ptr)), "0" (__x) \
139     + : "=q" (__x), "+m" (*__xg(ptr)) \
140     + : "0" (__x) \
141     : "memory"); \
142     break; \
143     case 2: \
144     asm volatile("xchgw %w0,%1" \
145     - : "=r" (__x) \
146     - : "m" (*__xg(ptr)), "0" (__x) \
147     + : "=r" (__x), "+m" (*__xg(ptr)) \
148     + : "0" (__x) \
149     : "memory"); \
150     break; \
151     case 4: \
152     asm volatile("xchgl %0,%1" \
153     - : "=r" (__x) \
154     - : "m" (*__xg(ptr)), "0" (__x) \
155     + : "=r" (__x), "+m" (*__xg(ptr)) \
156     + : "0" (__x) \
157     : "memory"); \
158     break; \
159     default: \
160     @@ -70,14 +70,14 @@ static inline void __set_64bit(unsigned long long *ptr,
161     unsigned int low, unsigned int high)
162     {
163     asm volatile("\n1:\t"
164     - "movl (%0), %%eax\n\t"
165     - "movl 4(%0), %%edx\n\t"
166     - LOCK_PREFIX "cmpxchg8b (%0)\n\t"
167     + "movl (%1), %%eax\n\t"
168     + "movl 4(%1), %%edx\n\t"
169     + LOCK_PREFIX "cmpxchg8b (%1)\n\t"
170     "jnz 1b"
171     - : /* no outputs */
172     - : "D"(ptr),
173     - "b"(low),
174     - "c"(high)
175     + : "=m" (*ptr)
176     + : "D" (ptr),
177     + "b" (low),
178     + "c" (high)
179     : "ax", "dx", "memory");
180     }
181    
182     @@ -121,21 +121,21 @@ extern void __cmpxchg_wrong_size(void);
183     __typeof__(*(ptr)) __new = (new); \
184     switch (size) { \
185     case 1: \
186     - asm volatile(lock "cmpxchgb %b1,%2" \
187     - : "=a"(__ret) \
188     - : "q"(__new), "m"(*__xg(ptr)), "0"(__old) \
189     + asm volatile(lock "cmpxchgb %b2,%1" \
190     + : "=a" (__ret), "+m" (*__xg(ptr)) \
191     + : "q" (__new), "0" (__old) \
192     : "memory"); \
193     break; \
194     case 2: \
195     - asm volatile(lock "cmpxchgw %w1,%2" \
196     - : "=a"(__ret) \
197     - : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \
198     + asm volatile(lock "cmpxchgw %w2,%1" \
199     + : "=a" (__ret), "+m" (*__xg(ptr)) \
200     + : "r" (__new), "0" (__old) \
201     : "memory"); \
202     break; \
203     case 4: \
204     - asm volatile(lock "cmpxchgl %1,%2" \
205     - : "=a"(__ret) \
206     - : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \
207     + asm volatile(lock "cmpxchgl %2,%1" \
208     + : "=a" (__ret), "+m" (*__xg(ptr)) \
209     + : "r" (__new), "0" (__old) \
210     : "memory"); \
211     break; \
212     default: \
213     @@ -180,12 +180,12 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr,
214     unsigned long long new)
215     {
216     unsigned long long prev;
217     - asm volatile(LOCK_PREFIX "cmpxchg8b %3"
218     - : "=A"(prev)
219     - : "b"((unsigned long)new),
220     - "c"((unsigned long)(new >> 32)),
221     - "m"(*__xg(ptr)),
222     - "0"(old)
223     + asm volatile(LOCK_PREFIX "cmpxchg8b %1"
224     + : "=A" (prev),
225     + "+m" (*__xg(ptr))
226     + : "b" ((unsigned long)new),
227     + "c" ((unsigned long)(new >> 32)),
228     + "0" (old)
229     : "memory");
230     return prev;
231     }
232     @@ -195,12 +195,12 @@ static inline unsigned long long __cmpxchg64_local(volatile void *ptr,
233     unsigned long long new)
234     {
235     unsigned long long prev;
236     - asm volatile("cmpxchg8b %3"
237     - : "=A"(prev)
238     - : "b"((unsigned long)new),
239     - "c"((unsigned long)(new >> 32)),
240     - "m"(*__xg(ptr)),
241     - "0"(old)
242     + asm volatile("cmpxchg8b %1"
243     + : "=A" (prev),
244     + "+m" (*__xg(ptr))
245     + : "b" ((unsigned long)new),
246     + "c" ((unsigned long)(new >> 32)),
247     + "0" (old)
248     : "memory");
249     return prev;
250     }
251     diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
252     index 485ae41..b92f147 100644
253     --- a/arch/x86/include/asm/cmpxchg_64.h
254     +++ b/arch/x86/include/asm/cmpxchg_64.h
255     @@ -26,26 +26,26 @@ extern void __cmpxchg_wrong_size(void);
256     switch (size) { \
257     case 1: \
258     asm volatile("xchgb %b0,%1" \
259     - : "=q" (__x) \
260     - : "m" (*__xg(ptr)), "0" (__x) \
261     + : "=q" (__x), "+m" (*__xg(ptr)) \
262     + : "0" (__x) \
263     : "memory"); \
264     break; \
265     case 2: \
266     asm volatile("xchgw %w0,%1" \
267     - : "=r" (__x) \
268     - : "m" (*__xg(ptr)), "0" (__x) \
269     + : "=r" (__x), "+m" (*__xg(ptr)) \
270     + : "0" (__x) \
271     : "memory"); \
272     break; \
273     case 4: \
274     asm volatile("xchgl %k0,%1" \
275     - : "=r" (__x) \
276     - : "m" (*__xg(ptr)), "0" (__x) \
277     + : "=r" (__x), "+m" (*__xg(ptr)) \
278     + : "0" (__x) \
279     : "memory"); \
280     break; \
281     case 8: \
282     asm volatile("xchgq %0,%1" \
283     - : "=r" (__x) \
284     - : "m" (*__xg(ptr)), "0" (__x) \
285     + : "=r" (__x), "+m" (*__xg(ptr)) \
286     + : "0" (__x) \
287     : "memory"); \
288     break; \
289     default: \
290     @@ -71,27 +71,27 @@ extern void __cmpxchg_wrong_size(void);
291     __typeof__(*(ptr)) __new = (new); \
292     switch (size) { \
293     case 1: \
294     - asm volatile(lock "cmpxchgb %b1,%2" \
295     - : "=a"(__ret) \
296     - : "q"(__new), "m"(*__xg(ptr)), "0"(__old) \
297     + asm volatile(lock "cmpxchgb %b2,%1" \
298     + : "=a" (__ret), "+m" (*__xg(ptr)) \
299     + : "q" (__new), "0" (__old) \
300     : "memory"); \
301     break; \
302     case 2: \
303     - asm volatile(lock "cmpxchgw %w1,%2" \
304     - : "=a"(__ret) \
305     - : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \
306     + asm volatile(lock "cmpxchgw %w2,%1" \
307     + : "=a" (__ret), "+m" (*__xg(ptr)) \
308     + : "r" (__new), "0" (__old) \
309     : "memory"); \
310     break; \
311     case 4: \
312     - asm volatile(lock "cmpxchgl %k1,%2" \
313     - : "=a"(__ret) \
314     - : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \
315     + asm volatile(lock "cmpxchgl %k2,%1" \
316     + : "=a" (__ret), "+m" (*__xg(ptr)) \
317     + : "r" (__new), "0" (__old) \
318     : "memory"); \
319     break; \
320     case 8: \
321     - asm volatile(lock "cmpxchgq %1,%2" \
322     - : "=a"(__ret) \
323     - : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \
324     + asm volatile(lock "cmpxchgq %2,%1" \
325     + : "=a" (__ret), "+m" (*__xg(ptr)) \
326     + : "r" (__new), "0" (__old) \
327     : "memory"); \
328     break; \
329     default: \
330     diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
331     index 79556bd..01c0f3e 100644
332     --- a/arch/x86/kernel/cpu/mtrr/main.c
333     +++ b/arch/x86/kernel/cpu/mtrr/main.c
334     @@ -35,6 +35,7 @@
335    
336     #include <linux/types.h> /* FIXME: kvm_para.h needs this */
337    
338     +#include <linux/stop_machine.h>
339     #include <linux/kvm_para.h>
340     #include <linux/uaccess.h>
341     #include <linux/module.h>
342     @@ -143,22 +144,28 @@ struct set_mtrr_data {
343     mtrr_type smp_type;
344     };
345    
346     +static DEFINE_PER_CPU(struct cpu_stop_work, mtrr_work);
347     +
348     /**
349     - * ipi_handler - Synchronisation handler. Executed by "other" CPUs.
350     + * mtrr_work_handler - Synchronisation handler. Executed by "other" CPUs.
351     * @info: pointer to mtrr configuration data
352     *
353     * Returns nothing.
354     */
355     -static void ipi_handler(void *info)
356     +static int mtrr_work_handler(void *info)
357     {
358     #ifdef CONFIG_SMP
359     struct set_mtrr_data *data = info;
360     unsigned long flags;
361    
362     + atomic_dec(&data->count);
363     + while (!atomic_read(&data->gate))
364     + cpu_relax();
365     +
366     local_irq_save(flags);
367    
368     atomic_dec(&data->count);
369     - while (!atomic_read(&data->gate))
370     + while (atomic_read(&data->gate))
371     cpu_relax();
372    
373     /* The master has cleared me to execute */
374     @@ -173,12 +180,13 @@ static void ipi_handler(void *info)
375     }
376    
377     atomic_dec(&data->count);
378     - while (atomic_read(&data->gate))
379     + while (!atomic_read(&data->gate))
380     cpu_relax();
381    
382     atomic_dec(&data->count);
383     local_irq_restore(flags);
384     #endif
385     + return 0;
386     }
387    
388     static inline int types_compatible(mtrr_type type1, mtrr_type type2)
389     @@ -198,7 +206,7 @@ static inline int types_compatible(mtrr_type type1, mtrr_type type2)
390     *
391     * This is kinda tricky, but fortunately, Intel spelled it out for us cleanly:
392     *
393     - * 1. Send IPI to do the following:
394     + * 1. Queue work to do the following on all processors:
395     * 2. Disable Interrupts
396     * 3. Wait for all procs to do so
397     * 4. Enter no-fill cache mode
398     @@ -215,14 +223,17 @@ static inline int types_compatible(mtrr_type type1, mtrr_type type2)
399     * 15. Enable interrupts.
400     *
401     * What does that mean for us? Well, first we set data.count to the number
402     - * of CPUs. As each CPU disables interrupts, it'll decrement it once. We wait
403     - * until it hits 0 and proceed. We set the data.gate flag and reset data.count.
404     - * Meanwhile, they are waiting for that flag to be set. Once it's set, each
405     + * of CPUs. As each CPU announces that it started the rendezvous handler by
406     + * decrementing the count, We reset data.count and set the data.gate flag
407     + * allowing all the cpu's to proceed with the work. As each cpu disables
408     + * interrupts, it'll decrement data.count once. We wait until it hits 0 and
409     + * proceed. We clear the data.gate flag and reset data.count. Meanwhile, they
410     + * are waiting for that flag to be cleared. Once it's cleared, each
411     * CPU goes through the transition of updating MTRRs.
412     * The CPU vendors may each do it differently,
413     * so we call mtrr_if->set() callback and let them take care of it.
414     * When they're done, they again decrement data->count and wait for data.gate
415     - * to be reset.
416     + * to be set.
417     * When we finish, we wait for data.count to hit 0 and toggle the data.gate flag
418     * Everyone then enables interrupts and we all continue on.
419     *
420     @@ -234,6 +245,9 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
421     {
422     struct set_mtrr_data data;
423     unsigned long flags;
424     + int cpu;
425     +
426     + preempt_disable();
427    
428     data.smp_reg = reg;
429     data.smp_base = base;
430     @@ -246,10 +260,15 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
431     atomic_set(&data.gate, 0);
432    
433     /* Start the ball rolling on other CPUs */
434     - if (smp_call_function(ipi_handler, &data, 0) != 0)
435     - panic("mtrr: timed out waiting for other CPUs\n");
436     + for_each_online_cpu(cpu) {
437     + struct cpu_stop_work *work = &per_cpu(mtrr_work, cpu);
438     +
439     + if (cpu == smp_processor_id())
440     + continue;
441     +
442     + stop_one_cpu_nowait(cpu, mtrr_work_handler, &data, work);
443     + }
444    
445     - local_irq_save(flags);
446    
447     while (atomic_read(&data.count))
448     cpu_relax();
449     @@ -259,6 +278,16 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
450     smp_wmb();
451     atomic_set(&data.gate, 1);
452    
453     + local_irq_save(flags);
454     +
455     + while (atomic_read(&data.count))
456     + cpu_relax();
457     +
458     + /* Ok, reset count and toggle gate */
459     + atomic_set(&data.count, num_booting_cpus() - 1);
460     + smp_wmb();
461     + atomic_set(&data.gate, 0);
462     +
463     /* Do our MTRR business */
464    
465     /*
466     @@ -279,7 +308,7 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
467    
468     atomic_set(&data.count, num_booting_cpus() - 1);
469     smp_wmb();
470     - atomic_set(&data.gate, 0);
471     + atomic_set(&data.gate, 1);
472    
473     /*
474     * Wait here for everyone to have seen the gate change
475     @@ -289,6 +318,7 @@ set_mtrr(unsigned int reg, unsigned long base, unsigned long size, mtrr_type typ
476     cpu_relax();
477    
478     local_irq_restore(flags);
479     + preempt_enable();
480     }
481    
482     /**
483     diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
484     index b9d1ff5..227b044 100644
485     --- a/arch/x86/kernel/cpu/vmware.c
486     +++ b/arch/x86/kernel/cpu/vmware.c
487     @@ -51,7 +51,7 @@ static inline int __vmware_platform(void)
488    
489     static unsigned long vmware_get_tsc_khz(void)
490     {
491     - uint64_t tsc_hz;
492     + uint64_t tsc_hz, lpj;
493     uint32_t eax, ebx, ecx, edx;
494    
495     VMWARE_PORT(GETHZ, eax, ebx, ecx, edx);
496     @@ -62,6 +62,13 @@ static unsigned long vmware_get_tsc_khz(void)
497     printk(KERN_INFO "TSC freq read from hypervisor : %lu.%03lu MHz\n",
498     (unsigned long) tsc_hz / 1000,
499     (unsigned long) tsc_hz % 1000);
500     +
501     + if (!preset_lpj) {
502     + lpj = ((u64)tsc_hz * 1000);
503     + do_div(lpj, HZ);
504     + preset_lpj = lpj;
505     + }
506     +
507     return tsc_hz;
508     }
509    
510     diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
511     index c4f33b2..11015fd 100644
512     --- a/arch/x86/kernel/smpboot.c
513     +++ b/arch/x86/kernel/smpboot.c
514     @@ -816,6 +816,13 @@ do_rest:
515     if (cpumask_test_cpu(cpu, cpu_callin_mask))
516     break; /* It has booted */
517     udelay(100);
518     + /*
519     + * Allow other tasks to run while we wait for the
520     + * AP to come online. This also gives a chance
521     + * for the MTRR work(triggered by the AP coming online)
522     + * to be completed in the stop machine context.
523     + */
524     + schedule();
525     }
526    
527     if (cpumask_test_cpu(cpu, cpu_callin_mask))
528     diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
529     index f627779..4c4508e 100644
530     --- a/arch/x86/mm/fault.c
531     +++ b/arch/x86/mm/fault.c
532     @@ -802,8 +802,10 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
533     up_read(&mm->mmap_sem);
534    
535     /* Kernel mode? Handle exceptions or die: */
536     - if (!(error_code & PF_USER))
537     + if (!(error_code & PF_USER)) {
538     no_context(regs, error_code, address);
539     + return;
540     + }
541    
542     /* User-space => ok to do another page fault: */
543     if (is_prefetch(regs, error_code, address))
544     diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
545     index 5d0e67f..e5d5e2c 100644
546     --- a/arch/x86/mm/kmmio.c
547     +++ b/arch/x86/mm/kmmio.c
548     @@ -45,6 +45,8 @@ struct kmmio_fault_page {
549     * Protected by kmmio_lock, when linked into kmmio_page_table.
550     */
551     int count;
552     +
553     + bool scheduled_for_release;
554     };
555    
556     struct kmmio_delayed_release {
557     @@ -398,8 +400,11 @@ static void release_kmmio_fault_page(unsigned long page,
558     BUG_ON(f->count < 0);
559     if (!f->count) {
560     disarm_kmmio_fault_page(f);
561     - f->release_next = *release_list;
562     - *release_list = f;
563     + if (!f->scheduled_for_release) {
564     + f->release_next = *release_list;
565     + *release_list = f;
566     + f->scheduled_for_release = true;
567     + }
568     }
569     }
570    
571     @@ -471,8 +476,10 @@ static void remove_kmmio_fault_pages(struct rcu_head *head)
572     prevp = &f->release_next;
573     } else {
574     *prevp = f->release_next;
575     + f->release_next = NULL;
576     + f->scheduled_for_release = false;
577     }
578     - f = f->release_next;
579     + f = *prevp;
580     }
581     spin_unlock_irqrestore(&kmmio_lock, flags);
582    
583     @@ -510,6 +517,9 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
584     kmmio_count--;
585     spin_unlock_irqrestore(&kmmio_lock, flags);
586    
587     + if (!release_list)
588     + return;
589     +
590     drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC);
591     if (!drelease) {
592     pr_crit("leaking kmmio_fault_page objects.\n");
593     diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c
594     index 8565d94..38868ad 100644
595     --- a/arch/x86/mm/testmmiotrace.c
596     +++ b/arch/x86/mm/testmmiotrace.c
597     @@ -90,6 +90,27 @@ static void do_test(unsigned long size)
598     iounmap(p);
599     }
600    
601     +/*
602     + * Tests how mmiotrace behaves in face of multiple ioremap / iounmaps in
603     + * a short time. We had a bug in deferred freeing procedure which tried
604     + * to free this region multiple times (ioremap can reuse the same address
605     + * for many mappings).
606     + */
607     +static void do_test_bulk_ioremapping(void)
608     +{
609     + void __iomem *p;
610     + int i;
611     +
612     + for (i = 0; i < 10; ++i) {
613     + p = ioremap_nocache(mmio_address, PAGE_SIZE);
614     + if (p)
615     + iounmap(p);
616     + }
617     +
618     + /* Force freeing. If it will crash we will know why. */
619     + synchronize_rcu();
620     +}
621     +
622     static int __init init(void)
623     {
624     unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
625     @@ -104,6 +125,7 @@ static int __init init(void)
626     "and writing 16 kB of rubbish in there.\n",
627     size >> 10, mmio_address);
628     do_test(size);
629     + do_test_bulk_ioremapping();
630     pr_info("All done.\n");
631     return 0;
632     }
633     diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
634     index 2ec04c4..15466c0 100644
635     --- a/arch/x86/pci/acpi.c
636     +++ b/arch/x86/pci/acpi.c
637     @@ -34,6 +34,15 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = {
638     DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
639     },
640     },
641     + /* https://bugzilla.kernel.org/show_bug.cgi?id=16007 */
642     + /* 2006 AMD HT/VIA system with two host bridges */
643     + {
644     + .callback = set_use_crs,
645     + .ident = "ASRock ALiveSATA2-GLAN",
646     + .matches = {
647     + DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"),
648     + },
649     + },
650     {}
651     };
652    
653     diff --git a/crypto/Kconfig b/crypto/Kconfig
654     index 9d9434f..df332c1 100644
655     --- a/crypto/Kconfig
656     +++ b/crypto/Kconfig
657     @@ -96,6 +96,14 @@ config CRYPTO_MANAGER2
658     select CRYPTO_BLKCIPHER2
659     select CRYPTO_PCOMP
660    
661     +config CRYPTO_MANAGER_TESTS
662     + bool "Run algolithms' self-tests"
663     + default y
664     + depends on CRYPTO_MANAGER2
665     + help
666     + Run cryptomanager's tests for the new crypto algorithms being
667     + registered.
668     +
669     config CRYPTO_GF128MUL
670     tristate "GF(2^128) multiplication functions (EXPERIMENTAL)"
671     depends on EXPERIMENTAL
672     diff --git a/crypto/algboss.c b/crypto/algboss.c
673     index c3c196b..40bd391 100644
674     --- a/crypto/algboss.c
675     +++ b/crypto/algboss.c
676     @@ -206,6 +206,7 @@ err:
677     return NOTIFY_OK;
678     }
679    
680     +#ifdef CONFIG_CRYPTO_MANAGER_TESTS
681     static int cryptomgr_test(void *data)
682     {
683     struct crypto_test_param *param = data;
684     @@ -266,6 +267,7 @@ err_put_module:
685     err:
686     return NOTIFY_OK;
687     }
688     +#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
689    
690     static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
691     void *data)
692     @@ -273,8 +275,10 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
693     switch (msg) {
694     case CRYPTO_MSG_ALG_REQUEST:
695     return cryptomgr_schedule_probe(data);
696     +#ifdef CONFIG_CRYPTO_MANAGER_TESTS
697     case CRYPTO_MSG_ALG_REGISTER:
698     return cryptomgr_schedule_test(data);
699     +#endif
700     }
701    
702     return NOTIFY_DONE;
703     diff --git a/crypto/testmgr.c b/crypto/testmgr.c
704     index 5c8aaa0..abd980c 100644
705     --- a/crypto/testmgr.c
706     +++ b/crypto/testmgr.c
707     @@ -22,6 +22,17 @@
708     #include <crypto/rng.h>
709    
710     #include "internal.h"
711     +
712     +#ifndef CONFIG_CRYPTO_MANAGER_TESTS
713     +
714     +/* a perfect nop */
715     +int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
716     +{
717     + return 0;
718     +}
719     +
720     +#else
721     +
722     #include "testmgr.h"
723    
724     /*
725     @@ -2530,4 +2541,7 @@ notest:
726     non_fips_alg:
727     return -EINVAL;
728     }
729     +
730     +#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
731     +
732     EXPORT_SYMBOL_GPL(alg_test);
733     diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
734     index 7409f98..3971bc0 100644
735     --- a/drivers/ata/ata_piix.c
736     +++ b/drivers/ata/ata_piix.c
737     @@ -158,6 +158,7 @@ struct piix_map_db {
738     struct piix_host_priv {
739     const int *map;
740     u32 saved_iocfg;
741     + spinlock_t sidpr_lock; /* FIXME: remove once locking in EH is fixed */
742     void __iomem *sidpr;
743     };
744    
745     @@ -951,12 +952,15 @@ static int piix_sidpr_scr_read(struct ata_link *link,
746     unsigned int reg, u32 *val)
747     {
748     struct piix_host_priv *hpriv = link->ap->host->private_data;
749     + unsigned long flags;
750    
751     if (reg >= ARRAY_SIZE(piix_sidx_map))
752     return -EINVAL;
753    
754     + spin_lock_irqsave(&hpriv->sidpr_lock, flags);
755     piix_sidpr_sel(link, reg);
756     *val = ioread32(hpriv->sidpr + PIIX_SIDPR_DATA);
757     + spin_unlock_irqrestore(&hpriv->sidpr_lock, flags);
758     return 0;
759     }
760    
761     @@ -964,12 +968,15 @@ static int piix_sidpr_scr_write(struct ata_link *link,
762     unsigned int reg, u32 val)
763     {
764     struct piix_host_priv *hpriv = link->ap->host->private_data;
765     + unsigned long flags;
766    
767     if (reg >= ARRAY_SIZE(piix_sidx_map))
768     return -EINVAL;
769    
770     + spin_lock_irqsave(&hpriv->sidpr_lock, flags);
771     piix_sidpr_sel(link, reg);
772     iowrite32(val, hpriv->sidpr + PIIX_SIDPR_DATA);
773     + spin_unlock_irqrestore(&hpriv->sidpr_lock, flags);
774     return 0;
775     }
776    
777     @@ -1566,6 +1573,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev,
778     hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
779     if (!hpriv)
780     return -ENOMEM;
781     + spin_lock_init(&hpriv->sidpr_lock);
782    
783     /* Save IOCFG, this will be used for cable detection, quirk
784     * detection and restoration on detach. This is necessary
785     diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
786     index ded76c4..3613422 100644
787     --- a/drivers/atm/solos-pci.c
788     +++ b/drivers/atm/solos-pci.c
789     @@ -781,7 +781,8 @@ static struct atm_vcc *find_vcc(struct atm_dev *dev, short vpi, int vci)
790     sk_for_each(s, node, head) {
791     vcc = atm_sk(s);
792     if (vcc->dev == dev && vcc->vci == vci &&
793     - vcc->vpi == vpi && vcc->qos.rxtp.traffic_class != ATM_NONE)
794     + vcc->vpi == vpi && vcc->qos.rxtp.traffic_class != ATM_NONE &&
795     + test_bit(ATM_VF_READY, &vcc->flags))
796     goto out;
797     }
798     vcc = NULL;
799     @@ -907,6 +908,10 @@ static void pclose(struct atm_vcc *vcc)
800     clear_bit(ATM_VF_ADDR, &vcc->flags);
801     clear_bit(ATM_VF_READY, &vcc->flags);
802    
803     + /* Hold up vcc_destroy_socket() (our caller) until solos_bh() in the
804     + tasklet has finished processing any incoming packets (and, more to
805     + the point, using the vcc pointer). */
806     + tasklet_unlock_wait(&card->tlet);
807     return;
808     }
809    
810     diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
811     index 7258c95..60bbfcf 100644
812     --- a/drivers/block/drbd/drbd_main.c
813     +++ b/drivers/block/drbd/drbd_main.c
814     @@ -2371,11 +2371,7 @@ static int _drbd_send_zc_ee(struct drbd_conf *mdev, struct drbd_epoch_entry *e)
815    
816     static void consider_delay_probes(struct drbd_conf *mdev)
817     {
818     - if (mdev->state.conn != C_SYNC_SOURCE || mdev->agreed_pro_version < 93)
819     - return;
820     -
821     - if (mdev->dp_volume_last + mdev->sync_conf.dp_volume * 2 < mdev->send_cnt)
822     - drbd_send_delay_probes(mdev);
823     + return;
824     }
825    
826     static int w_delay_probes(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
827     @@ -2660,9 +2656,24 @@ static void drbd_unplug_fn(struct request_queue *q)
828    
829     static void drbd_set_defaults(struct drbd_conf *mdev)
830     {
831     - mdev->sync_conf.after = DRBD_AFTER_DEF;
832     - mdev->sync_conf.rate = DRBD_RATE_DEF;
833     - mdev->sync_conf.al_extents = DRBD_AL_EXTENTS_DEF;
834     + /* This way we get a compile error when sync_conf grows,
835     + and we forgot to initialize it here */
836     + mdev->sync_conf = (struct syncer_conf) {
837     + /* .rate = */ DRBD_RATE_DEF,
838     + /* .after = */ DRBD_AFTER_DEF,
839     + /* .al_extents = */ DRBD_AL_EXTENTS_DEF,
840     + /* .dp_volume = */ DRBD_DP_VOLUME_DEF,
841     + /* .dp_interval = */ DRBD_DP_INTERVAL_DEF,
842     + /* .throttle_th = */ DRBD_RS_THROTTLE_TH_DEF,
843     + /* .hold_off_th = */ DRBD_RS_HOLD_OFF_TH_DEF,
844     + /* .verify_alg = */ {}, 0,
845     + /* .cpu_mask = */ {}, 0,
846     + /* .csums_alg = */ {}, 0,
847     + /* .use_rle = */ 0
848     + };
849     +
850     + /* Have to use that way, because the layout differs between
851     + big endian and little endian */
852     mdev->state = (union drbd_state) {
853     { .role = R_SECONDARY,
854     .peer = R_UNKNOWN,
855     diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
856     index 5d9cc53..6fcb971 100644
857     --- a/drivers/bluetooth/btusb.c
858     +++ b/drivers/bluetooth/btusb.c
859     @@ -59,6 +59,9 @@ static struct usb_device_id btusb_table[] = {
860     /* Generic Bluetooth USB device */
861     { USB_DEVICE_INFO(0xe0, 0x01, 0x01) },
862    
863     + /* Apple iMac11,1 */
864     + { USB_DEVICE(0x05ac, 0x8215) },
865     +
866     /* AVM BlueFRITZ! USB v2.0 */
867     { USB_DEVICE(0x057c, 0x3800) },
868    
869     diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
870     index 094bdc3..ff68e7c 100644
871     --- a/drivers/char/ipmi/ipmi_si_intf.c
872     +++ b/drivers/char/ipmi/ipmi_si_intf.c
873     @@ -2176,6 +2176,14 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev,
874     info->io.addr_data = res->start;
875    
876     info->io.regspacing = DEFAULT_REGSPACING;
877     + res = pnp_get_resource(dev,
878     + (info->io.addr_type == IPMI_IO_ADDR_SPACE) ?
879     + IORESOURCE_IO : IORESOURCE_MEM,
880     + 1);
881     + if (res) {
882     + if (res->start > info->io.addr_data)
883     + info->io.regspacing = res->start - info->io.addr_data;
884     + }
885     info->io.regsize = DEFAULT_REGSPACING;
886     info->io.regshift = 0;
887    
888     diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
889     index a663800..18af923 100644
890     --- a/drivers/char/nozomi.c
891     +++ b/drivers/char/nozomi.c
892     @@ -1611,6 +1611,8 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty)
893     ret = tty_init_termios(tty);
894     if (ret == 0) {
895     tty_driver_kref_get(driver);
896     + tty->count++;
897     + tty->driver_data = port;
898     driver->ttys[tty->index] = tty;
899     }
900     return ret;
901     @@ -1639,7 +1641,7 @@ static int ntty_activate(struct tty_port *tport, struct tty_struct *tty)
902    
903     static int ntty_open(struct tty_struct *tty, struct file *filp)
904     {
905     - struct port *port = get_port_by_tty(tty);
906     + struct port *port = tty->driver_data;
907     return tty_port_open(&port->port, tty, filp);
908     }
909    
910     diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
911     index 6d3a73b..5216c8a 100644
912     --- a/drivers/dma/ioat/dma.h
913     +++ b/drivers/dma/ioat/dma.h
914     @@ -97,6 +97,7 @@ struct ioat_chan_common {
915     #define IOAT_RESET_PENDING 2
916     #define IOAT_KOBJ_INIT_FAIL 3
917     #define IOAT_RESHAPE_PENDING 4
918     + #define IOAT_RUN 5
919     struct timer_list timer;
920     #define COMPLETION_TIMEOUT msecs_to_jiffies(100)
921     #define IDLE_TIMEOUT msecs_to_jiffies(2000)
922     diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
923     index 3c8b32a..216f9d3 100644
924     --- a/drivers/dma/ioat/dma_v2.c
925     +++ b/drivers/dma/ioat/dma_v2.c
926     @@ -287,7 +287,10 @@ void ioat2_timer_event(unsigned long data)
927     chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
928     dev_err(to_dev(chan), "%s: Channel halted (%x)\n",
929     __func__, chanerr);
930     - BUG_ON(is_ioat_bug(chanerr));
931     + if (test_bit(IOAT_RUN, &chan->state))
932     + BUG_ON(is_ioat_bug(chanerr));
933     + else /* we never got off the ground */
934     + return;
935     }
936    
937     /* if we haven't made progress and we have already
938     @@ -492,6 +495,8 @@ static struct ioat_ring_ent **ioat2_alloc_ring(struct dma_chan *c, int order, gf
939     return ring;
940     }
941    
942     +void ioat2_free_chan_resources(struct dma_chan *c);
943     +
944     /* ioat2_alloc_chan_resources - allocate/initialize ioat2 descriptor ring
945     * @chan: channel to be initialized
946     */
947     @@ -500,6 +505,7 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
948     struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
949     struct ioat_chan_common *chan = &ioat->base;
950     struct ioat_ring_ent **ring;
951     + u64 status;
952     int order;
953    
954     /* have we already been set up? */
955     @@ -540,7 +546,20 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
956     tasklet_enable(&chan->cleanup_task);
957     ioat2_start_null_desc(ioat);
958    
959     - return 1 << ioat->alloc_order;
960     + /* check that we got off the ground */
961     + udelay(5);
962     + status = ioat_chansts(chan);
963     + if (is_ioat_active(status) || is_ioat_idle(status)) {
964     + set_bit(IOAT_RUN, &chan->state);
965     + return 1 << ioat->alloc_order;
966     + } else {
967     + u32 chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
968     +
969     + dev_WARN(to_dev(chan),
970     + "failed to start channel chanerr: %#x\n", chanerr);
971     + ioat2_free_chan_resources(c);
972     + return -EFAULT;
973     + }
974     }
975    
976     bool reshape_ring(struct ioat2_dma_chan *ioat, int order)
977     @@ -778,6 +797,7 @@ void ioat2_free_chan_resources(struct dma_chan *c)
978     del_timer_sync(&chan->timer);
979     device->cleanup_fn((unsigned long) c);
980     device->reset_hw(chan);
981     + clear_bit(IOAT_RUN, &chan->state);
982    
983     spin_lock_bh(&chan->cleanup_lock);
984     spin_lock_bh(&ioat->prep_lock);
985     diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
986     index 1cdd22e..d0f4990 100644
987     --- a/drivers/dma/ioat/dma_v3.c
988     +++ b/drivers/dma/ioat/dma_v3.c
989     @@ -361,7 +361,10 @@ static void ioat3_timer_event(unsigned long data)
990     chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
991     dev_err(to_dev(chan), "%s: Channel halted (%x)\n",
992     __func__, chanerr);
993     - BUG_ON(is_ioat_bug(chanerr));
994     + if (test_bit(IOAT_RUN, &chan->state))
995     + BUG_ON(is_ioat_bug(chanerr));
996     + else /* we never got off the ground */
997     + return;
998     }
999    
1000     /* if we haven't made progress and we have already
1001     diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
1002     index 64207df..2de76cc 100644
1003     --- a/drivers/ide/ide-cd.c
1004     +++ b/drivers/ide/ide-cd.c
1005     @@ -506,15 +506,22 @@ int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
1006     return (flags & REQ_FAILED) ? -EIO : 0;
1007     }
1008    
1009     -static void ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
1010     +/*
1011     + * returns true if rq has been completed
1012     + */
1013     +static bool ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
1014     {
1015     unsigned int nr_bytes = cmd->nbytes - cmd->nleft;
1016    
1017     if (cmd->tf_flags & IDE_TFLAG_WRITE)
1018     nr_bytes -= cmd->last_xfer_len;
1019    
1020     - if (nr_bytes > 0)
1021     + if (nr_bytes > 0) {
1022     ide_complete_rq(drive, 0, nr_bytes);
1023     + return true;
1024     + }
1025     +
1026     + return false;
1027     }
1028    
1029     static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
1030     @@ -679,7 +686,8 @@ out_end:
1031     }
1032    
1033     if (uptodate == 0 && rq->bio)
1034     - ide_cd_error_cmd(drive, cmd);
1035     + if (ide_cd_error_cmd(drive, cmd))
1036     + return ide_stopped;
1037    
1038     /* make sure it's fully ended */
1039     if (blk_fs_request(rq) == 0) {
1040     diff --git a/drivers/md/md.c b/drivers/md/md.c
1041     index cb20d0b..7476d95 100644
1042     --- a/drivers/md/md.c
1043     +++ b/drivers/md/md.c
1044     @@ -532,13 +532,17 @@ static void mddev_unlock(mddev_t * mddev)
1045     * an access to the files will try to take reconfig_mutex
1046     * while holding the file unremovable, which leads to
1047     * a deadlock.
1048     - * So hold open_mutex instead - we are allowed to take
1049     - * it while holding reconfig_mutex, and md_run can
1050     - * use it to wait for the remove to complete.
1051     + * So hold set sysfs_active while the remove in happeing,
1052     + * and anything else which might set ->to_remove or my
1053     + * otherwise change the sysfs namespace will fail with
1054     + * -EBUSY if sysfs_active is still set.
1055     + * We set sysfs_active under reconfig_mutex and elsewhere
1056     + * test it under the same mutex to ensure its correct value
1057     + * is seen.
1058     */
1059     struct attribute_group *to_remove = mddev->to_remove;
1060     mddev->to_remove = NULL;
1061     - mutex_lock(&mddev->open_mutex);
1062     + mddev->sysfs_active = 1;
1063     mutex_unlock(&mddev->reconfig_mutex);
1064    
1065     if (to_remove != &md_redundancy_group)
1066     @@ -550,7 +554,7 @@ static void mddev_unlock(mddev_t * mddev)
1067     sysfs_put(mddev->sysfs_action);
1068     mddev->sysfs_action = NULL;
1069     }
1070     - mutex_unlock(&mddev->open_mutex);
1071     + mddev->sysfs_active = 0;
1072     } else
1073     mutex_unlock(&mddev->reconfig_mutex);
1074    
1075     @@ -2960,7 +2964,9 @@ level_store(mddev_t *mddev, const char *buf, size_t len)
1076     * - new personality will access other array.
1077     */
1078    
1079     - if (mddev->sync_thread || mddev->reshape_position != MaxSector)
1080     + if (mddev->sync_thread ||
1081     + mddev->reshape_position != MaxSector ||
1082     + mddev->sysfs_active)
1083     return -EBUSY;
1084    
1085     if (!mddev->pers->quiesce) {
1086     @@ -4344,13 +4350,9 @@ static int md_run(mddev_t *mddev)
1087    
1088     if (mddev->pers)
1089     return -EBUSY;
1090     -
1091     - /* These two calls synchronise us with the
1092     - * sysfs_remove_group calls in mddev_unlock,
1093     - * so they must have completed.
1094     - */
1095     - mutex_lock(&mddev->open_mutex);
1096     - mutex_unlock(&mddev->open_mutex);
1097     + /* Cannot run until previous stop completes properly */
1098     + if (mddev->sysfs_active)
1099     + return -EBUSY;
1100    
1101     /*
1102     * Analyze all RAID superblock(s)
1103     @@ -4711,12 +4713,13 @@ out:
1104     */
1105     static int do_md_stop(mddev_t * mddev, int mode, int is_open)
1106     {
1107     - int err = 0;
1108     + int err = 0, revalidate = 0;
1109     struct gendisk *disk = mddev->gendisk;
1110     mdk_rdev_t *rdev;
1111    
1112     mutex_lock(&mddev->open_mutex);
1113     - if (atomic_read(&mddev->openers) > is_open) {
1114     + if (atomic_read(&mddev->openers) > is_open ||
1115     + mddev->sysfs_active) {
1116     printk("md: %s still in use.\n",mdname(mddev));
1117     err = -EBUSY;
1118     } else if (mddev->pers) {
1119     @@ -4740,7 +4743,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
1120     }
1121    
1122     set_capacity(disk, 0);
1123     - revalidate_disk(disk);
1124     + revalidate = 1;
1125    
1126     if (mddev->ro)
1127     mddev->ro = 0;
1128     @@ -4748,6 +4751,8 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
1129     err = 0;
1130     }
1131     mutex_unlock(&mddev->open_mutex);
1132     + if (revalidate)
1133     + revalidate_disk(disk);
1134     if (err)
1135     return err;
1136     /*
1137     diff --git a/drivers/md/md.h b/drivers/md/md.h
1138     index 10597bf..9ec208e 100644
1139     --- a/drivers/md/md.h
1140     +++ b/drivers/md/md.h
1141     @@ -125,6 +125,10 @@ struct mddev_s
1142     int suspended;
1143     atomic_t active_io;
1144     int ro;
1145     + int sysfs_active; /* set when sysfs deletes
1146     + * are happening, so run/
1147     + * takeover/stop are not safe
1148     + */
1149    
1150     struct gendisk *gendisk;
1151    
1152     diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1153     index 42e64e4..d1d6891 100644
1154     --- a/drivers/md/raid10.c
1155     +++ b/drivers/md/raid10.c
1156     @@ -825,11 +825,29 @@ static int make_request(mddev_t *mddev, struct bio * bio)
1157     */
1158     bp = bio_split(bio,
1159     chunk_sects - (bio->bi_sector & (chunk_sects - 1)) );
1160     +
1161     + /* Each of these 'make_request' calls will call 'wait_barrier'.
1162     + * If the first succeeds but the second blocks due to the resync
1163     + * thread raising the barrier, we will deadlock because the
1164     + * IO to the underlying device will be queued in generic_make_request
1165     + * and will never complete, so will never reduce nr_pending.
1166     + * So increment nr_waiting here so no new raise_barriers will
1167     + * succeed, and so the second wait_barrier cannot block.
1168     + */
1169     + spin_lock_irq(&conf->resync_lock);
1170     + conf->nr_waiting++;
1171     + spin_unlock_irq(&conf->resync_lock);
1172     +
1173     if (make_request(mddev, &bp->bio1))
1174     generic_make_request(&bp->bio1);
1175     if (make_request(mddev, &bp->bio2))
1176     generic_make_request(&bp->bio2);
1177    
1178     + spin_lock_irq(&conf->resync_lock);
1179     + conf->nr_waiting--;
1180     + wake_up(&conf->wait_barrier);
1181     + spin_unlock_irq(&conf->resync_lock);
1182     +
1183     bio_pair_release(bp);
1184     return 0;
1185     bad_map:
1186     diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
1187     index 82e9438..8878503 100644
1188     --- a/drivers/mtd/nand/mxc_nand.c
1189     +++ b/drivers/mtd/nand/mxc_nand.c
1190     @@ -604,8 +604,8 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
1191     /* Command pre-processing step */
1192     switch (command) {
1193     case NAND_CMD_RESET:
1194     - send_cmd(host, command, false);
1195     preset(mtd);
1196     + send_cmd(host, command, false);
1197     break;
1198    
1199     case NAND_CMD_STATUS:
1200     diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c
1201     index 8d46731..90e143e 100644
1202     --- a/drivers/mtd/nand/plat_nand.c
1203     +++ b/drivers/mtd/nand/plat_nand.c
1204     @@ -91,7 +91,7 @@ static int __devinit plat_nand_probe(struct platform_device *pdev)
1205     }
1206    
1207     /* Scan to find existance of the device */
1208     - if (nand_scan(&data->mtd, 1)) {
1209     + if (nand_scan(&data->mtd, pdata->chip.nr_chips)) {
1210     err = -ENXIO;
1211     goto out;
1212     }
1213     diff --git a/drivers/net/e100.c b/drivers/net/e100.c
1214     index b194bad..8e2eab4 100644
1215     --- a/drivers/net/e100.c
1216     +++ b/drivers/net/e100.c
1217     @@ -1779,6 +1779,7 @@ static int e100_tx_clean(struct nic *nic)
1218     for (cb = nic->cb_to_clean;
1219     cb->status & cpu_to_le16(cb_complete);
1220     cb = nic->cb_to_clean = cb->next) {
1221     + rmb(); /* read skb after status */
1222     netif_printk(nic, tx_done, KERN_DEBUG, nic->netdev,
1223     "cb[%d]->status = 0x%04X\n",
1224     (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1225     @@ -1927,6 +1928,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1226    
1227     netif_printk(nic, rx_status, KERN_DEBUG, nic->netdev,
1228     "status=0x%04X\n", rfd_status);
1229     + rmb(); /* read size after status bit */
1230    
1231     /* If data isn't ready, nothing to indicate */
1232     if (unlikely(!(rfd_status & cb_complete))) {
1233     diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
1234     index 68a8089..a2680bf 100644
1235     --- a/drivers/net/e1000/e1000_main.c
1236     +++ b/drivers/net/e1000/e1000_main.c
1237     @@ -3448,6 +3448,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter,
1238     while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
1239     (count < tx_ring->count)) {
1240     bool cleaned = false;
1241     + rmb(); /* read buffer_info after eop_desc */
1242     for ( ; !cleaned; count++) {
1243     tx_desc = E1000_TX_DESC(*tx_ring, i);
1244     buffer_info = &tx_ring->buffer_info[i];
1245     @@ -3637,6 +3638,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1246     if (*work_done >= work_to_do)
1247     break;
1248     (*work_done)++;
1249     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1250    
1251     status = rx_desc->status;
1252     skb = buffer_info->skb;
1253     @@ -3843,6 +3845,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
1254     if (*work_done >= work_to_do)
1255     break;
1256     (*work_done)++;
1257     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1258    
1259     status = rx_desc->status;
1260     skb = buffer_info->skb;
1261     diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
1262     index 79e38dc..ba24679 100644
1263     --- a/drivers/net/e1000e/netdev.c
1264     +++ b/drivers/net/e1000e/netdev.c
1265     @@ -774,6 +774,7 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
1266     if (*work_done >= work_to_do)
1267     break;
1268     (*work_done)++;
1269     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1270    
1271     status = rx_desc->status;
1272     skb = buffer_info->skb;
1273     @@ -984,6 +985,7 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter)
1274     while ((eop_desc->upper.data & cpu_to_le32(E1000_TXD_STAT_DD)) &&
1275     (count < tx_ring->count)) {
1276     bool cleaned = false;
1277     + rmb(); /* read buffer_info after eop_desc */
1278     for (; !cleaned; count++) {
1279     tx_desc = E1000_TX_DESC(*tx_ring, i);
1280     buffer_info = &tx_ring->buffer_info[i];
1281     @@ -1080,6 +1082,7 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
1282     break;
1283     (*work_done)++;
1284     skb = buffer_info->skb;
1285     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1286    
1287     /* in the packet split case this is header only */
1288     prefetch(skb->data - NET_IP_ALIGN);
1289     @@ -1279,6 +1282,7 @@ static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
1290     if (*work_done >= work_to_do)
1291     break;
1292     (*work_done)++;
1293     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1294    
1295     status = rx_desc->status;
1296     skb = buffer_info->skb;
1297     diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
1298     index df2a6d7..c9cb9c4 100644
1299     --- a/drivers/net/igb/igb_main.c
1300     +++ b/drivers/net/igb/igb_main.c
1301     @@ -5344,6 +5344,7 @@ static bool igb_clean_tx_irq(struct igb_q_vector *q_vector)
1302    
1303     while ((eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)) &&
1304     (count < tx_ring->count)) {
1305     + rmb(); /* read buffer_info after eop_desc status */
1306     for (cleaned = false; !cleaned; count++) {
1307     tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
1308     buffer_info = &tx_ring->buffer_info[i];
1309     @@ -5549,6 +5550,7 @@ static bool igb_clean_rx_irq_adv(struct igb_q_vector *q_vector,
1310     if (*work_done >= budget)
1311     break;
1312     (*work_done)++;
1313     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1314    
1315     skb = buffer_info->skb;
1316     prefetch(skb->data - NET_IP_ALIGN);
1317     diff --git a/drivers/net/igbvf/netdev.c b/drivers/net/igbvf/netdev.c
1318     index 5e2b2a8..57b5fee 100644
1319     --- a/drivers/net/igbvf/netdev.c
1320     +++ b/drivers/net/igbvf/netdev.c
1321     @@ -248,6 +248,7 @@ static bool igbvf_clean_rx_irq(struct igbvf_adapter *adapter,
1322     if (*work_done >= work_to_do)
1323     break;
1324     (*work_done)++;
1325     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1326    
1327     buffer_info = &rx_ring->buffer_info[i];
1328    
1329     @@ -780,6 +781,7 @@ static bool igbvf_clean_tx_irq(struct igbvf_ring *tx_ring)
1330    
1331     while ((eop_desc->wb.status & cpu_to_le32(E1000_TXD_STAT_DD)) &&
1332     (count < tx_ring->count)) {
1333     + rmb(); /* read buffer_info after eop_desc status */
1334     for (cleaned = false; !cleaned; count++) {
1335     tx_desc = IGBVF_TX_DESC_ADV(*tx_ring, i);
1336     buffer_info = &tx_ring->buffer_info[i];
1337     diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
1338     index c6b75c8..45fc89b 100644
1339     --- a/drivers/net/ixgb/ixgb_main.c
1340     +++ b/drivers/net/ixgb/ixgb_main.c
1341     @@ -1816,6 +1816,7 @@ ixgb_clean_tx_irq(struct ixgb_adapter *adapter)
1342    
1343     while (eop_desc->status & IXGB_TX_DESC_STATUS_DD) {
1344    
1345     + rmb(); /* read buffer_info after eop_desc */
1346     for (cleaned = false; !cleaned; ) {
1347     tx_desc = IXGB_TX_DESC(*tx_ring, i);
1348     buffer_info = &tx_ring->buffer_info[i];
1349     @@ -1976,6 +1977,7 @@ ixgb_clean_rx_irq(struct ixgb_adapter *adapter, int *work_done, int work_to_do)
1350     break;
1351    
1352     (*work_done)++;
1353     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1354     status = rx_desc->status;
1355     skb = buffer_info->skb;
1356     buffer_info->skb = NULL;
1357     diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
1358     index 74d9b6d..649c867 100644
1359     --- a/drivers/net/ixgbe/ixgbe_main.c
1360     +++ b/drivers/net/ixgbe/ixgbe_main.c
1361     @@ -748,6 +748,7 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector,
1362     while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
1363     (count < tx_ring->work_limit)) {
1364     bool cleaned = false;
1365     + rmb(); /* read buffer_info after eop_desc */
1366     for ( ; !cleaned; count++) {
1367     struct sk_buff *skb;
1368     tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
1369     diff --git a/drivers/net/ixgbevf/ixgbevf_main.c b/drivers/net/ixgbevf/ixgbevf_main.c
1370     index a16cff7..3ea59f1 100644
1371     --- a/drivers/net/ixgbevf/ixgbevf_main.c
1372     +++ b/drivers/net/ixgbevf/ixgbevf_main.c
1373     @@ -231,6 +231,7 @@ static bool ixgbevf_clean_tx_irq(struct ixgbevf_adapter *adapter,
1374     while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
1375     (count < tx_ring->work_limit)) {
1376     bool cleaned = false;
1377     + rmb(); /* read buffer_info after eop_desc */
1378     for ( ; !cleaned; count++) {
1379     struct sk_buff *skb;
1380     tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
1381     @@ -518,6 +519,7 @@ static bool ixgbevf_clean_rx_irq(struct ixgbevf_q_vector *q_vector,
1382     break;
1383     (*work_done)++;
1384    
1385     + rmb(); /* read descriptor and rx_buffer_info after status DD */
1386     if (adapter->flags & IXGBE_FLAG_RX_PS_ENABLED) {
1387     hdr_info = le16_to_cpu(ixgbevf_get_hdr_info(rx_desc));
1388     len = (hdr_info & IXGBE_RXDADV_HDRBUFLEN_MASK) >>
1389     diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c
1390     index cc55974..7a7b01a 100644
1391     --- a/drivers/net/smsc911x.c
1392     +++ b/drivers/net/smsc911x.c
1393     @@ -84,8 +84,7 @@ struct smsc911x_data {
1394     */
1395     spinlock_t mac_lock;
1396    
1397     - /* spinlock to ensure 16-bit accesses are serialised.
1398     - * unused with a 32-bit bus */
1399     + /* spinlock to ensure register accesses are serialised */
1400     spinlock_t dev_lock;
1401    
1402     struct phy_device *phy_dev;
1403     @@ -118,37 +117,33 @@ struct smsc911x_data {
1404     unsigned int hashlo;
1405     };
1406    
1407     -/* The 16-bit access functions are significantly slower, due to the locking
1408     - * necessary. If your bus hardware can be configured to do this for you
1409     - * (in response to a single 32-bit operation from software), you should use
1410     - * the 32-bit access functions instead. */
1411     -
1412     -static inline u32 smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
1413     +static inline u32 __smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
1414     {
1415     if (pdata->config.flags & SMSC911X_USE_32BIT)
1416     return readl(pdata->ioaddr + reg);
1417    
1418     - if (pdata->config.flags & SMSC911X_USE_16BIT) {
1419     - u32 data;
1420     - unsigned long flags;
1421     -
1422     - /* these two 16-bit reads must be performed consecutively, so
1423     - * must not be interrupted by our own ISR (which would start
1424     - * another read operation) */
1425     - spin_lock_irqsave(&pdata->dev_lock, flags);
1426     - data = ((readw(pdata->ioaddr + reg) & 0xFFFF) |
1427     + if (pdata->config.flags & SMSC911X_USE_16BIT)
1428     + return ((readw(pdata->ioaddr + reg) & 0xFFFF) |
1429     ((readw(pdata->ioaddr + reg + 2) & 0xFFFF) << 16));
1430     - spin_unlock_irqrestore(&pdata->dev_lock, flags);
1431     -
1432     - return data;
1433     - }
1434    
1435     BUG();
1436     return 0;
1437     }
1438    
1439     -static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
1440     - u32 val)
1441     +static inline u32 smsc911x_reg_read(struct smsc911x_data *pdata, u32 reg)
1442     +{
1443     + u32 data;
1444     + unsigned long flags;
1445     +
1446     + spin_lock_irqsave(&pdata->dev_lock, flags);
1447     + data = __smsc911x_reg_read(pdata, reg);
1448     + spin_unlock_irqrestore(&pdata->dev_lock, flags);
1449     +
1450     + return data;
1451     +}
1452     +
1453     +static inline void __smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
1454     + u32 val)
1455     {
1456     if (pdata->config.flags & SMSC911X_USE_32BIT) {
1457     writel(val, pdata->ioaddr + reg);
1458     @@ -156,44 +151,54 @@ static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
1459     }
1460    
1461     if (pdata->config.flags & SMSC911X_USE_16BIT) {
1462     - unsigned long flags;
1463     -
1464     - /* these two 16-bit writes must be performed consecutively, so
1465     - * must not be interrupted by our own ISR (which would start
1466     - * another read operation) */
1467     - spin_lock_irqsave(&pdata->dev_lock, flags);
1468     writew(val & 0xFFFF, pdata->ioaddr + reg);
1469     writew((val >> 16) & 0xFFFF, pdata->ioaddr + reg + 2);
1470     - spin_unlock_irqrestore(&pdata->dev_lock, flags);
1471     return;
1472     }
1473    
1474     BUG();
1475     }
1476    
1477     +static inline void smsc911x_reg_write(struct smsc911x_data *pdata, u32 reg,
1478     + u32 val)
1479     +{
1480     + unsigned long flags;
1481     +
1482     + spin_lock_irqsave(&pdata->dev_lock, flags);
1483     + __smsc911x_reg_write(pdata, reg, val);
1484     + spin_unlock_irqrestore(&pdata->dev_lock, flags);
1485     +}
1486     +
1487     /* Writes a packet to the TX_DATA_FIFO */
1488     static inline void
1489     smsc911x_tx_writefifo(struct smsc911x_data *pdata, unsigned int *buf,
1490     unsigned int wordcount)
1491     {
1492     + unsigned long flags;
1493     +
1494     + spin_lock_irqsave(&pdata->dev_lock, flags);
1495     +
1496     if (pdata->config.flags & SMSC911X_SWAP_FIFO) {
1497     while (wordcount--)
1498     - smsc911x_reg_write(pdata, TX_DATA_FIFO, swab32(*buf++));
1499     - return;
1500     + __smsc911x_reg_write(pdata, TX_DATA_FIFO,
1501     + swab32(*buf++));
1502     + goto out;
1503     }
1504    
1505     if (pdata->config.flags & SMSC911X_USE_32BIT) {
1506     writesl(pdata->ioaddr + TX_DATA_FIFO, buf, wordcount);
1507     - return;
1508     + goto out;
1509     }
1510    
1511     if (pdata->config.flags & SMSC911X_USE_16BIT) {
1512     while (wordcount--)
1513     - smsc911x_reg_write(pdata, TX_DATA_FIFO, *buf++);
1514     - return;
1515     + __smsc911x_reg_write(pdata, TX_DATA_FIFO, *buf++);
1516     + goto out;
1517     }
1518    
1519     BUG();
1520     +out:
1521     + spin_unlock_irqrestore(&pdata->dev_lock, flags);
1522     }
1523    
1524     /* Reads a packet out of the RX_DATA_FIFO */
1525     @@ -201,24 +206,31 @@ static inline void
1526     smsc911x_rx_readfifo(struct smsc911x_data *pdata, unsigned int *buf,
1527     unsigned int wordcount)
1528     {
1529     + unsigned long flags;
1530     +
1531     + spin_lock_irqsave(&pdata->dev_lock, flags);
1532     +
1533     if (pdata->config.flags & SMSC911X_SWAP_FIFO) {
1534     while (wordcount--)
1535     - *buf++ = swab32(smsc911x_reg_read(pdata, RX_DATA_FIFO));
1536     - return;
1537     + *buf++ = swab32(__smsc911x_reg_read(pdata,
1538     + RX_DATA_FIFO));
1539     + goto out;
1540     }
1541    
1542     if (pdata->config.flags & SMSC911X_USE_32BIT) {
1543     readsl(pdata->ioaddr + RX_DATA_FIFO, buf, wordcount);
1544     - return;
1545     + goto out;
1546     }
1547    
1548     if (pdata->config.flags & SMSC911X_USE_16BIT) {
1549     while (wordcount--)
1550     - *buf++ = smsc911x_reg_read(pdata, RX_DATA_FIFO);
1551     - return;
1552     + *buf++ = __smsc911x_reg_read(pdata, RX_DATA_FIFO);
1553     + goto out;
1554     }
1555    
1556     BUG();
1557     +out:
1558     + spin_unlock_irqrestore(&pdata->dev_lock, flags);
1559     }
1560    
1561     /* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read
1562     diff --git a/drivers/net/wireless/iwlwifi/iwl-devtrace.h b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
1563     index ae7319b..4cf864c 100644
1564     --- a/drivers/net/wireless/iwlwifi/iwl-devtrace.h
1565     +++ b/drivers/net/wireless/iwlwifi/iwl-devtrace.h
1566     @@ -193,7 +193,7 @@ TRACE_EVENT(iwlwifi_dev_tx,
1567     __entry->framelen = buf0_len + buf1_len;
1568     memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
1569     memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
1570     - memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
1571     + memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
1572     ),
1573     TP_printk("[%p] TX %.2x (%zu bytes)",
1574     __entry->priv,
1575     diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c
1576     index 515817d..15f09e8 100644
1577     --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c
1578     +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c
1579     @@ -688,6 +688,8 @@ void rtl8180_beacon_work(struct work_struct *work)
1580    
1581     /* grab a fresh beacon */
1582     skb = ieee80211_beacon_get(dev, vif);
1583     + if (!skb)
1584     + goto resched;
1585    
1586     /*
1587     * update beacon timestamp w/ TSF value
1588     diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
1589     index c9171be..435fbbc 100644
1590     --- a/drivers/pci/intel-iommu.c
1591     +++ b/drivers/pci/intel-iommu.c
1592     @@ -3030,6 +3030,34 @@ static void __init iommu_exit_mempool(void)
1593    
1594     }
1595    
1596     +static void quirk_ioat_snb_local_iommu(struct pci_dev *pdev)
1597     +{
1598     + struct dmar_drhd_unit *drhd;
1599     + u32 vtbar;
1600     + int rc;
1601     +
1602     + /* We know that this device on this chipset has its own IOMMU.
1603     + * If we find it under a different IOMMU, then the BIOS is lying
1604     + * to us. Hope that the IOMMU for this device is actually
1605     + * disabled, and it needs no translation...
1606     + */
1607     + rc = pci_bus_read_config_dword(pdev->bus, PCI_DEVFN(0, 0), 0xb0, &vtbar);
1608     + if (rc) {
1609     + /* "can't" happen */
1610     + dev_info(&pdev->dev, "failed to run vt-d quirk\n");
1611     + return;
1612     + }
1613     + vtbar &= 0xffff0000;
1614     +
1615     + /* we know that the this iommu should be at offset 0xa000 from vtbar */
1616     + drhd = dmar_find_matched_drhd_unit(pdev);
1617     + if (WARN_TAINT_ONCE(!drhd || drhd->reg_base_addr - vtbar != 0xa000,
1618     + TAINT_FIRMWARE_WORKAROUND,
1619     + "BIOS assigned incorrect VT-d unit for Intel(R) QuickData Technology device\n"))
1620     + pdev->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO;
1621     +}
1622     +DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IOAT_SNB, quirk_ioat_snb_local_iommu);
1623     +
1624     static void __init init_no_remapping_devices(void)
1625     {
1626     struct dmar_drhd_unit *drhd;
1627     diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1628     index 477345d..e28524e 100644
1629     --- a/drivers/pci/quirks.c
1630     +++ b/drivers/pci/quirks.c
1631     @@ -2115,6 +2115,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disabl
1632     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3336, quirk_disable_all_msi);
1633     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
1634     DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3364, quirk_disable_all_msi);
1635     +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8380_0, quirk_disable_all_msi);
1636    
1637     /* Disable MSI on chipsets that are known to not support it */
1638     static void __devinit quirk_disable_msi(struct pci_dev *dev)
1639     @@ -2390,6 +2391,9 @@ static void __devinit __nv_msi_ht_cap_quirk(struct pci_dev *dev, int all)
1640     int pos;
1641     int found;
1642    
1643     + if (!pci_msi_enabled())
1644     + return;
1645     +
1646     /* check if there is HT MSI cap or enabled on this device */
1647     found = ht_check_msi_mapping(dev);
1648    
1649     diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
1650     index a4cd9ad..015e274 100644
1651     --- a/drivers/pcmcia/pcmcia_resource.c
1652     +++ b/drivers/pcmcia/pcmcia_resource.c
1653     @@ -651,7 +651,7 @@ EXPORT_SYMBOL(__pcmcia_request_exclusive_irq);
1654     #ifdef CONFIG_PCMCIA_PROBE
1655    
1656     /* mask of IRQs already reserved by other cards, we should avoid using them */
1657     -static u8 pcmcia_used_irq[NR_IRQS];
1658     +static u8 pcmcia_used_irq[32];
1659    
1660     static irqreturn_t test_action(int cpl, void *dev_id)
1661     {
1662     @@ -674,6 +674,9 @@ static int pcmcia_setup_isa_irq(struct pcmcia_device *p_dev, int type)
1663     for (try = 0; try < 64; try++) {
1664     irq = try % 32;
1665    
1666     + if (irq > NR_IRQS)
1667     + continue;
1668     +
1669     /* marked as available by driver, not blocked by userspace? */
1670     if (!((mask >> irq) & 1))
1671     continue;
1672     diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
1673     index 746a446..53be4d3 100644
1674     --- a/drivers/serial/8250_pci.c
1675     +++ b/drivers/serial/8250_pci.c
1676     @@ -994,6 +994,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
1677     #define PCI_DEVICE_ID_TITAN_800E 0xA014
1678     #define PCI_DEVICE_ID_TITAN_200EI 0xA016
1679     #define PCI_DEVICE_ID_TITAN_200EISI 0xA017
1680     +#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538
1681    
1682     /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1683     #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
1684     @@ -1542,6 +1543,8 @@ enum pci_board_num_t {
1685     pbn_b2_4_921600,
1686     pbn_b2_8_921600,
1687    
1688     + pbn_b2_8_1152000,
1689     +
1690     pbn_b2_bt_1_115200,
1691     pbn_b2_bt_2_115200,
1692     pbn_b2_bt_4_115200,
1693     @@ -1960,6 +1963,13 @@ static struct pciserial_board pci_boards[] __devinitdata = {
1694     .uart_offset = 8,
1695     },
1696    
1697     + [pbn_b2_8_1152000] = {
1698     + .flags = FL_BASE2,
1699     + .num_ports = 8,
1700     + .base_baud = 1152000,
1701     + .uart_offset = 8,
1702     + },
1703     +
1704     [pbn_b2_bt_1_115200] = {
1705     .flags = FL_BASE2|FL_BASE_BARS,
1706     .num_ports = 1,
1707     @@ -2875,6 +2885,9 @@ static struct pci_device_id serial_pci_tbl[] = {
1708     { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI952,
1709     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
1710     pbn_b0_bt_2_921600 },
1711     + { PCI_VENDOR_ID_OXSEMI, PCI_DEVICE_ID_OXSEMI_16PCI958,
1712     + PCI_ANY_ID , PCI_ANY_ID, 0, 0,
1713     + pbn_b2_8_1152000 },
1714    
1715     /*
1716     * Oxford Semiconductor Inc. Tornado PCI express device range.
1717     diff --git a/drivers/staging/hv/Kconfig b/drivers/staging/hv/Kconfig
1718     index 97480f5..7455c80 100644
1719     --- a/drivers/staging/hv/Kconfig
1720     +++ b/drivers/staging/hv/Kconfig
1721     @@ -17,7 +17,7 @@ config HYPERV_STORAGE
1722    
1723     config HYPERV_BLOCK
1724     tristate "Microsoft Hyper-V virtual block driver"
1725     - depends on BLOCK && SCSI && LBDAF
1726     + depends on BLOCK && SCSI && (LBDAF || 64BIT)
1727     default HYPERV
1728     help
1729     Select this option to enable the Hyper-V virtual block driver.
1730     diff --git a/drivers/staging/line6/Kconfig b/drivers/staging/line6/Kconfig
1731     index 7852d4a..bc1ffbe 100644
1732     --- a/drivers/staging/line6/Kconfig
1733     +++ b/drivers/staging/line6/Kconfig
1734     @@ -2,6 +2,7 @@ config LINE6_USB
1735     tristate "Line6 USB support"
1736     depends on USB && SND
1737     select SND_RAWMIDI
1738     + select SND_PCM
1739     help
1740     This is a driver for the guitar amp, cab, and effects modeller
1741     PODxt Pro by Line6 (and similar devices), supporting the
1742     diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
1743     index 9ca0e9e..6474c3a 100644
1744     --- a/drivers/staging/panel/panel.c
1745     +++ b/drivers/staging/panel/panel.c
1746     @@ -2179,6 +2179,7 @@ int panel_init(void)
1747     if (pprt) {
1748     parport_release(pprt);
1749     parport_unregister_device(pprt);
1750     + pprt = NULL;
1751     }
1752     parport_unregister_driver(&panel_driver);
1753     printk(KERN_ERR "Panel driver version " PANEL_VERSION
1754     @@ -2228,6 +2229,7 @@ static void __exit panel_cleanup_module(void)
1755     /* TODO: free all input signals */
1756     parport_release(pprt);
1757     parport_unregister_device(pprt);
1758     + pprt = NULL;
1759     }
1760     parport_unregister_driver(&panel_driver);
1761     }
1762     diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c
1763     index 674769d..c48e85d 100644
1764     --- a/drivers/staging/rt2860/usb_main_dev.c
1765     +++ b/drivers/staging/rt2860/usb_main_dev.c
1766     @@ -64,6 +64,7 @@ struct usb_device_id rtusb_usb_id[] = {
1767     {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */
1768     {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */
1769     {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */
1770     + {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */
1771     {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */
1772     {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */
1773     {USB_DEVICE(0x07AA, 0x002F)}, /* Corega */
1774     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1775     index 70cccc7..ffc80e3 100644
1776     --- a/drivers/usb/core/hub.c
1777     +++ b/drivers/usb/core/hub.c
1778     @@ -20,6 +20,7 @@
1779     #include <linux/usb.h>
1780     #include <linux/usbdevice_fs.h>
1781     #include <linux/usb/hcd.h>
1782     +#include <linux/usb/quirks.h>
1783     #include <linux/kthread.h>
1784     #include <linux/mutex.h>
1785     #include <linux/freezer.h>
1786     @@ -1801,7 +1802,6 @@ int usb_new_device(struct usb_device *udev)
1787     pm_runtime_set_active(&udev->dev);
1788     pm_runtime_enable(&udev->dev);
1789    
1790     - usb_detect_quirks(udev);
1791     err = usb_enumerate_device(udev); /* Read descriptors */
1792     if (err < 0)
1793     goto fail;
1794     @@ -3111,6 +3111,10 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
1795     if (status < 0)
1796     goto loop;
1797    
1798     + usb_detect_quirks(udev);
1799     + if (udev->quirks & USB_QUIRK_DELAY_INIT)
1800     + msleep(1000);
1801     +
1802     /* consecutive bus-powered hubs aren't reliable; they can
1803     * violate the voltage drop budget. if the new child has
1804     * a "powered" LED, users should notice we didn't enable it
1805     diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1806     index db99c08..25719da 100644
1807     --- a/drivers/usb/core/quirks.c
1808     +++ b/drivers/usb/core/quirks.c
1809     @@ -38,6 +38,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1810     /* Creative SB Audigy 2 NX */
1811     { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
1812    
1813     + /* Logitech Harmony 700-series */
1814     + { USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
1815     +
1816     /* Philips PSC805 audio device */
1817     { USB_DEVICE(0x0471, 0x0155), .driver_info = USB_QUIRK_RESET_RESUME },
1818    
1819     diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
1820     index 7c05555..419e6b3 100644
1821     --- a/drivers/usb/core/urb.c
1822     +++ b/drivers/usb/core/urb.c
1823     @@ -137,6 +137,16 @@ void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor)
1824     }
1825     EXPORT_SYMBOL_GPL(usb_anchor_urb);
1826    
1827     +/* Callers must hold anchor->lock */
1828     +static void __usb_unanchor_urb(struct urb *urb, struct usb_anchor *anchor)
1829     +{
1830     + urb->anchor = NULL;
1831     + list_del(&urb->anchor_list);
1832     + usb_put_urb(urb);
1833     + if (list_empty(&anchor->urb_list))
1834     + wake_up(&anchor->wait);
1835     +}
1836     +
1837     /**
1838     * usb_unanchor_urb - unanchors an URB
1839     * @urb: pointer to the urb to anchor
1840     @@ -156,17 +166,14 @@ void usb_unanchor_urb(struct urb *urb)
1841     return;
1842    
1843     spin_lock_irqsave(&anchor->lock, flags);
1844     - if (unlikely(anchor != urb->anchor)) {
1845     - /* we've lost the race to another thread */
1846     - spin_unlock_irqrestore(&anchor->lock, flags);
1847     - return;
1848     - }
1849     - urb->anchor = NULL;
1850     - list_del(&urb->anchor_list);
1851     + /*
1852     + * At this point, we could be competing with another thread which
1853     + * has the same intention. To protect the urb from being unanchored
1854     + * twice, only the winner of the race gets the job.
1855     + */
1856     + if (likely(anchor == urb->anchor))
1857     + __usb_unanchor_urb(urb, anchor);
1858     spin_unlock_irqrestore(&anchor->lock, flags);
1859     - usb_put_urb(urb);
1860     - if (list_empty(&anchor->urb_list))
1861     - wake_up(&anchor->wait);
1862     }
1863     EXPORT_SYMBOL_GPL(usb_unanchor_urb);
1864    
1865     @@ -749,20 +756,11 @@ EXPORT_SYMBOL_GPL(usb_unpoison_anchored_urbs);
1866     void usb_unlink_anchored_urbs(struct usb_anchor *anchor)
1867     {
1868     struct urb *victim;
1869     - unsigned long flags;
1870    
1871     - spin_lock_irqsave(&anchor->lock, flags);
1872     - while (!list_empty(&anchor->urb_list)) {
1873     - victim = list_entry(anchor->urb_list.prev, struct urb,
1874     - anchor_list);
1875     - usb_get_urb(victim);
1876     - spin_unlock_irqrestore(&anchor->lock, flags);
1877     - /* this will unanchor the URB */
1878     + while ((victim = usb_get_from_anchor(anchor)) != NULL) {
1879     usb_unlink_urb(victim);
1880     usb_put_urb(victim);
1881     - spin_lock_irqsave(&anchor->lock, flags);
1882     }
1883     - spin_unlock_irqrestore(&anchor->lock, flags);
1884     }
1885     EXPORT_SYMBOL_GPL(usb_unlink_anchored_urbs);
1886    
1887     @@ -799,12 +797,11 @@ struct urb *usb_get_from_anchor(struct usb_anchor *anchor)
1888     victim = list_entry(anchor->urb_list.next, struct urb,
1889     anchor_list);
1890     usb_get_urb(victim);
1891     - spin_unlock_irqrestore(&anchor->lock, flags);
1892     - usb_unanchor_urb(victim);
1893     + __usb_unanchor_urb(victim, anchor);
1894     } else {
1895     - spin_unlock_irqrestore(&anchor->lock, flags);
1896     victim = NULL;
1897     }
1898     + spin_unlock_irqrestore(&anchor->lock, flags);
1899    
1900     return victim;
1901     }
1902     @@ -826,12 +823,7 @@ void usb_scuttle_anchored_urbs(struct usb_anchor *anchor)
1903     while (!list_empty(&anchor->urb_list)) {
1904     victim = list_entry(anchor->urb_list.prev, struct urb,
1905     anchor_list);
1906     - usb_get_urb(victim);
1907     - spin_unlock_irqrestore(&anchor->lock, flags);
1908     - /* this may free the URB */
1909     - usb_unanchor_urb(victim);
1910     - usb_put_urb(victim);
1911     - spin_lock_irqsave(&anchor->lock, flags);
1912     + __usb_unanchor_urb(victim, anchor);
1913     }
1914     spin_unlock_irqrestore(&anchor->lock, flags);
1915     }
1916     diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1917     index d43d176..19f5070 100644
1918     --- a/drivers/usb/host/ehci-pci.c
1919     +++ b/drivers/usb/host/ehci-pci.c
1920     @@ -114,6 +114,7 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
1921     break;
1922     case PCI_VENDOR_ID_INTEL:
1923     ehci->need_io_watchdog = 0;
1924     + ehci->fs_i_thresh = 1;
1925     if (pdev->device == 0x27cc) {
1926     ehci->broken_periodic = 1;
1927     ehci_info(ehci, "using broken periodic workaround\n");
1928     diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
1929     index 805ec63..93f58e5 100644
1930     --- a/drivers/usb/host/ehci-sched.c
1931     +++ b/drivers/usb/host/ehci-sched.c
1932     @@ -1400,7 +1400,6 @@ iso_stream_schedule (
1933     int status;
1934     unsigned mod = ehci->periodic_size << 3;
1935     struct ehci_iso_sched *sched = urb->hcpriv;
1936     - struct pci_dev *pdev;
1937    
1938     if (sched->span > (mod - SCHEDULE_SLOP)) {
1939     ehci_dbg (ehci, "iso request %p too long\n", urb);
1940     @@ -1427,15 +1426,14 @@ iso_stream_schedule (
1941     * slot in the schedule, implicitly assuming URB_ISO_ASAP.
1942     */
1943     if (likely (!list_empty (&stream->td_list))) {
1944     - pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller);
1945     start = stream->next_uframe;
1946    
1947     /* For high speed devices, allow scheduling within the
1948     - * isochronous scheduling threshold. For full speed devices,
1949     - * don't. (Work around for Intel ICH9 bug.)
1950     + * isochronous scheduling threshold. For full speed devices
1951     + * and Intel PCI-based controllers, don't (work around for
1952     + * Intel ICH9 bug).
1953     */
1954     - if (!stream->highspeed &&
1955     - pdev->vendor == PCI_VENDOR_ID_INTEL)
1956     + if (!stream->highspeed && ehci->fs_i_thresh)
1957     next = now + ehci->i_thresh;
1958     else
1959     next = now;
1960     diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
1961     index 650a687..8b3d9c8 100644
1962     --- a/drivers/usb/host/ehci.h
1963     +++ b/drivers/usb/host/ehci.h
1964     @@ -130,6 +130,7 @@ struct ehci_hcd { /* one per controller */
1965     unsigned has_amcc_usb23:1;
1966     unsigned need_io_watchdog:1;
1967     unsigned broken_periodic:1;
1968     + unsigned fs_i_thresh:1; /* Intel iso scheduling */
1969    
1970     /* required for usb32 quirk */
1971     #define OHCI_CTRL_HCFS (3 << 6)
1972     diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
1973     index 16dffe9..c3049c7 100644
1974     --- a/drivers/usb/misc/usbtest.c
1975     +++ b/drivers/usb/misc/usbtest.c
1976     @@ -1378,7 +1378,6 @@ static void iso_callback (struct urb *urb)
1977     break;
1978     }
1979     }
1980     - simple_free_urb (urb);
1981    
1982     ctx->pending--;
1983     if (ctx->pending == 0) {
1984     @@ -1495,6 +1494,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
1985     }
1986    
1987     simple_free_urb (urbs [i]);
1988     + urbs[i] = NULL;
1989     context.pending--;
1990     context.submit_error = 1;
1991     break;
1992     @@ -1504,6 +1504,10 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
1993    
1994     wait_for_completion (&context.done);
1995    
1996     + for (i = 0; i < param->sglen; i++) {
1997     + if (urbs[i])
1998     + simple_free_urb(urbs[i]);
1999     + }
2000     /*
2001     * Isochronous transfers are expected to fail sometimes. As an
2002     * arbitrary limit, we will report an error if any submissions
2003     diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
2004     index 61c76b1..56c93ca 100644
2005     --- a/drivers/usb/mon/mon_bin.c
2006     +++ b/drivers/usb/mon/mon_bin.c
2007     @@ -1009,7 +1009,7 @@ static int mon_bin_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2008    
2009     mutex_lock(&rp->fetch_lock);
2010     spin_lock_irqsave(&rp->b_lock, flags);
2011     - mon_free_buff(rp->b_vec, size/CHUNK_SIZE);
2012     + mon_free_buff(rp->b_vec, rp->b_size/CHUNK_SIZE);
2013     kfree(rp->b_vec);
2014     rp->b_vec = vec;
2015     rp->b_size = size;
2016     diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
2017     index bba76af..c79a5e3 100644
2018     --- a/drivers/usb/musb/musb_debugfs.c
2019     +++ b/drivers/usb/musb/musb_debugfs.c
2020     @@ -92,29 +92,29 @@ static const struct musb_register_map musb_regmap[] = {
2021     { "LS_EOF1", 0x7E, 8 },
2022     { "SOFT_RST", 0x7F, 8 },
2023     { "DMA_CNTLch0", 0x204, 16 },
2024     - { "DMA_ADDRch0", 0x208, 16 },
2025     - { "DMA_COUNTch0", 0x20C, 16 },
2026     + { "DMA_ADDRch0", 0x208, 32 },
2027     + { "DMA_COUNTch0", 0x20C, 32 },
2028     { "DMA_CNTLch1", 0x214, 16 },
2029     - { "DMA_ADDRch1", 0x218, 16 },
2030     - { "DMA_COUNTch1", 0x21C, 16 },
2031     + { "DMA_ADDRch1", 0x218, 32 },
2032     + { "DMA_COUNTch1", 0x21C, 32 },
2033     { "DMA_CNTLch2", 0x224, 16 },
2034     - { "DMA_ADDRch2", 0x228, 16 },
2035     - { "DMA_COUNTch2", 0x22C, 16 },
2036     + { "DMA_ADDRch2", 0x228, 32 },
2037     + { "DMA_COUNTch2", 0x22C, 32 },
2038     { "DMA_CNTLch3", 0x234, 16 },
2039     - { "DMA_ADDRch3", 0x238, 16 },
2040     - { "DMA_COUNTch3", 0x23C, 16 },
2041     + { "DMA_ADDRch3", 0x238, 32 },
2042     + { "DMA_COUNTch3", 0x23C, 32 },
2043     { "DMA_CNTLch4", 0x244, 16 },
2044     - { "DMA_ADDRch4", 0x248, 16 },
2045     - { "DMA_COUNTch4", 0x24C, 16 },
2046     + { "DMA_ADDRch4", 0x248, 32 },
2047     + { "DMA_COUNTch4", 0x24C, 32 },
2048     { "DMA_CNTLch5", 0x254, 16 },
2049     - { "DMA_ADDRch5", 0x258, 16 },
2050     - { "DMA_COUNTch5", 0x25C, 16 },
2051     + { "DMA_ADDRch5", 0x258, 32 },
2052     + { "DMA_COUNTch5", 0x25C, 32 },
2053     { "DMA_CNTLch6", 0x264, 16 },
2054     - { "DMA_ADDRch6", 0x268, 16 },
2055     - { "DMA_COUNTch6", 0x26C, 16 },
2056     + { "DMA_ADDRch6", 0x268, 32 },
2057     + { "DMA_COUNTch6", 0x26C, 32 },
2058     { "DMA_CNTLch7", 0x274, 16 },
2059     - { "DMA_ADDRch7", 0x278, 16 },
2060     - { "DMA_COUNTch7", 0x27C, 16 },
2061     + { "DMA_ADDRch7", 0x278, 32 },
2062     + { "DMA_COUNTch7", 0x27C, 32 },
2063     { } /* Terminating Entry */
2064     };
2065    
2066     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2067     index 8b8c797..2bef441 100644
2068     --- a/drivers/usb/serial/cp210x.c
2069     +++ b/drivers/usb/serial/cp210x.c
2070     @@ -126,6 +126,10 @@ static const struct usb_device_id id_table[] = {
2071     { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
2072     { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
2073     { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
2074     + { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein & Baus GmbH PL512 Power Supply */
2075     + { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein & Baus GmbH RCM Remote Control for MARATON Power Supply */
2076     + { USB_DEVICE(0x16DC, 0x0012) }, /* W-IE-NE-R Plein & Baus GmbH MPOD Multi Channel Power Supply */
2077     + { USB_DEVICE(0x16DC, 0x0015) }, /* W-IE-NE-R Plein & Baus GmbH CML Control, Monitoring and Data Logger */
2078     { } /* Terminating Entry */
2079     };
2080    
2081     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2082     index e298dc4..eb12d9b 100644
2083     --- a/drivers/usb/serial/ftdi_sio.c
2084     +++ b/drivers/usb/serial/ftdi_sio.c
2085     @@ -157,6 +157,9 @@ static struct usb_device_id id_table_combined [] = {
2086     { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_5_PID) },
2087     { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_6_PID) },
2088     { USB_DEVICE(FTDI_VID, FTDI_SCS_DEVICE_7_PID) },
2089     + { USB_DEVICE(FTDI_VID, FTDI_USINT_CAT_PID) },
2090     + { USB_DEVICE(FTDI_VID, FTDI_USINT_WKEY_PID) },
2091     + { USB_DEVICE(FTDI_VID, FTDI_USINT_RS232_PID) },
2092     { USB_DEVICE(FTDI_VID, FTDI_ACTZWAVE_PID) },
2093     { USB_DEVICE(FTDI_VID, FTDI_IRTRANS_PID) },
2094     { USB_DEVICE(FTDI_VID, FTDI_IPLUS_PID) },
2095     @@ -746,6 +749,7 @@ static struct usb_device_id id_table_combined [] = {
2096     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
2097     { USB_DEVICE(FTDI_VID, XVERVE_SIGNALYZER_SH4_PID),
2098     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
2099     + { USB_DEVICE(FTDI_VID, SEGWAY_RMP200_PID) },
2100     { }, /* Optional parameter entry */
2101     { } /* Terminating entry */
2102     };
2103     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
2104     index d01946d..6e612c5 100644
2105     --- a/drivers/usb/serial/ftdi_sio_ids.h
2106     +++ b/drivers/usb/serial/ftdi_sio_ids.h
2107     @@ -40,6 +40,11 @@
2108    
2109     #define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */
2110    
2111     +/* US Interface Navigator (http://www.usinterface.com/) */
2112     +#define FTDI_USINT_CAT_PID 0xb810 /* Navigator CAT and 2nd PTT lines */
2113     +#define FTDI_USINT_WKEY_PID 0xb811 /* Navigator WKEY and FSK lines */
2114     +#define FTDI_USINT_RS232_PID 0xb812 /* Navigator RS232 and CONFIG lines */
2115     +
2116     /* OOCDlink by Joern Kaipf <joernk@web.de>
2117     * (http://www.joernonline.de/dw/doku.php?id=start&idx=projects:oocdlink) */
2118     #define FTDI_OOCDLINK_PID 0xbaf8 /* Amontec JTAGkey */
2119     @@ -1032,3 +1037,8 @@
2120     #define XVERVE_SIGNALYZER_SH2_PID 0xBCA2
2121     #define XVERVE_SIGNALYZER_SH4_PID 0xBCA4
2122    
2123     +/*
2124     + * Segway Robotic Mobility Platform USB interface (using VID 0x0403)
2125     + * Submitted by John G. Rogers
2126     + */
2127     +#define SEGWAY_RMP200_PID 0xe729
2128     diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
2129     index a817ced..ca92f67 100644
2130     --- a/drivers/usb/serial/generic.c
2131     +++ b/drivers/usb/serial/generic.c
2132     @@ -208,18 +208,23 @@ retry:
2133     urb->transfer_buffer_length = count;
2134     usb_serial_debug_data(debug, &port->dev, __func__, count,
2135     urb->transfer_buffer);
2136     + spin_lock_irqsave(&port->lock, flags);
2137     + port->tx_bytes += count;
2138     + spin_unlock_irqrestore(&port->lock, flags);
2139     +
2140     + clear_bit(i, &port->write_urbs_free);
2141     result = usb_submit_urb(urb, GFP_ATOMIC);
2142     if (result) {
2143     dev_err(&port->dev, "%s - error submitting urb: %d\n",
2144     __func__, result);
2145     + set_bit(i, &port->write_urbs_free);
2146     + spin_lock_irqsave(&port->lock, flags);
2147     + port->tx_bytes -= count;
2148     + spin_unlock_irqrestore(&port->lock, flags);
2149     +
2150     clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
2151     return result;
2152     }
2153     - clear_bit(i, &port->write_urbs_free);
2154     -
2155     - spin_lock_irqsave(&port->lock, flags);
2156     - port->tx_bytes += count;
2157     - spin_unlock_irqrestore(&port->lock, flags);
2158    
2159     /* Try sending off another urb, unless in irq context (in which case
2160     * there will be no free urb). */
2161     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2162     index 5cd30e4..5c35b3a 100644
2163     --- a/drivers/usb/serial/option.c
2164     +++ b/drivers/usb/serial/option.c
2165     @@ -145,7 +145,10 @@ static void option_instat_callback(struct urb *urb);
2166     #define HUAWEI_PRODUCT_E143D 0x143D
2167     #define HUAWEI_PRODUCT_E143E 0x143E
2168     #define HUAWEI_PRODUCT_E143F 0x143F
2169     +#define HUAWEI_PRODUCT_K4505 0x1464
2170     +#define HUAWEI_PRODUCT_K3765 0x1465
2171     #define HUAWEI_PRODUCT_E14AC 0x14AC
2172     +#define HUAWEI_PRODUCT_ETS1220 0x1803
2173    
2174     #define QUANTA_VENDOR_ID 0x0408
2175     #define QUANTA_PRODUCT_Q101 0xEA02
2176     @@ -482,6 +485,9 @@ static const struct usb_device_id option_ids[] = {
2177     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
2178     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
2179     { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
2180     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) },
2181     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) },
2182     + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
2183     { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) },
2184     { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_9508) },
2185     { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, /* Novatel Merlin V640/XV620 */
2186     @@ -1017,6 +1023,13 @@ static int option_probe(struct usb_serial *serial,
2187     serial->interface->cur_altsetting->desc.bInterfaceClass != 0xff)
2188     return -ENODEV;
2189    
2190     + /* Don't bind network interfaces on Huawei K3765 & K4505 */
2191     + if (serial->dev->descriptor.idVendor == HUAWEI_VENDOR_ID &&
2192     + (serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K3765 ||
2193     + serial->dev->descriptor.idProduct == HUAWEI_PRODUCT_K4505) &&
2194     + serial->interface->cur_altsetting->desc.bInterfaceNumber == 1)
2195     + return -ENODEV;
2196     +
2197     data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
2198    
2199     if (!data)
2200     diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c
2201     index e66b8b1..d8b12c3 100644
2202     --- a/drivers/video/w100fb.c
2203     +++ b/drivers/video/w100fb.c
2204     @@ -858,9 +858,9 @@ unsigned long w100fb_gpio_read(int port)
2205     void w100fb_gpio_write(int port, unsigned long value)
2206     {
2207     if (port==W100_GPIO_PORT_A)
2208     - value = writel(value, remapped_regs + mmGPIO_DATA);
2209     + writel(value, remapped_regs + mmGPIO_DATA);
2210     else
2211     - value = writel(value, remapped_regs + mmGPIO_DATA2);
2212     + writel(value, remapped_regs + mmGPIO_DATA2);
2213     }
2214     EXPORT_SYMBOL(w100fb_gpio_read);
2215     EXPORT_SYMBOL(w100fb_gpio_write);
2216     diff --git a/drivers/xen/events.c b/drivers/xen/events.c
2217     index db8f506..28f133a 100644
2218     --- a/drivers/xen/events.c
2219     +++ b/drivers/xen/events.c
2220     @@ -536,6 +536,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
2221     if (irq < 0)
2222     return irq;
2223    
2224     + irqflags |= IRQF_NO_SUSPEND;
2225     retval = request_irq(irq, handler, irqflags, devname, dev_id);
2226     if (retval != 0) {
2227     unbind_from_irq(irq);
2228     diff --git a/fs/block_dev.c b/fs/block_dev.c
2229     index b3171fb..4c54c86 100644
2230     --- a/fs/block_dev.c
2231     +++ b/fs/block_dev.c
2232     @@ -1339,10 +1339,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)
2233     /*
2234     * hooks: /n/, see "layering violations".
2235     */
2236     - ret = devcgroup_inode_permission(bdev->bd_inode, perm);
2237     - if (ret != 0) {
2238     - bdput(bdev);
2239     - return ret;
2240     + if (!for_part) {
2241     + ret = devcgroup_inode_permission(bdev->bd_inode, perm);
2242     + if (ret != 0) {
2243     + bdput(bdev);
2244     + return ret;
2245     + }
2246     }
2247    
2248     lock_kernel();
2249     diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
2250     index e8fcf4e..622c9514 100644
2251     --- a/fs/ecryptfs/file.c
2252     +++ b/fs/ecryptfs/file.c
2253     @@ -199,7 +199,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
2254     "the persistent file for the dentry with name "
2255     "[%s]; rc = [%d]\n", __func__,
2256     ecryptfs_dentry->d_name.name, rc);
2257     - goto out;
2258     + goto out_free;
2259     }
2260     }
2261     if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
2262     @@ -207,7 +207,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
2263     rc = -EPERM;
2264     printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
2265     "file must hence be opened RO\n", __func__);
2266     - goto out;
2267     + goto out_free;
2268     }
2269     ecryptfs_set_file_lower(
2270     file, ecryptfs_inode_to_private(inode)->lower_file);
2271     @@ -292,12 +292,40 @@ static int ecryptfs_fasync(int fd, struct file *file, int flag)
2272     return rc;
2273     }
2274    
2275     -static int ecryptfs_ioctl(struct inode *inode, struct file *file,
2276     - unsigned int cmd, unsigned long arg);
2277     +static long
2278     +ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2279     +{
2280     + struct file *lower_file = NULL;
2281     + long rc = -ENOTTY;
2282     +
2283     + if (ecryptfs_file_to_private(file))
2284     + lower_file = ecryptfs_file_to_lower(file);
2285     + if (lower_file && lower_file->f_op && lower_file->f_op->unlocked_ioctl)
2286     + rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
2287     + return rc;
2288     +}
2289     +
2290     +#ifdef CONFIG_COMPAT
2291     +static long
2292     +ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2293     +{
2294     + struct file *lower_file = NULL;
2295     + long rc = -ENOIOCTLCMD;
2296     +
2297     + if (ecryptfs_file_to_private(file))
2298     + lower_file = ecryptfs_file_to_lower(file);
2299     + if (lower_file && lower_file->f_op && lower_file->f_op->compat_ioctl)
2300     + rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg);
2301     + return rc;
2302     +}
2303     +#endif
2304    
2305     const struct file_operations ecryptfs_dir_fops = {
2306     .readdir = ecryptfs_readdir,
2307     - .ioctl = ecryptfs_ioctl,
2308     + .unlocked_ioctl = ecryptfs_unlocked_ioctl,
2309     +#ifdef CONFIG_COMPAT
2310     + .compat_ioctl = ecryptfs_compat_ioctl,
2311     +#endif
2312     .open = ecryptfs_open,
2313     .flush = ecryptfs_flush,
2314     .release = ecryptfs_release,
2315     @@ -313,7 +341,10 @@ const struct file_operations ecryptfs_main_fops = {
2316     .write = do_sync_write,
2317     .aio_write = generic_file_aio_write,
2318     .readdir = ecryptfs_readdir,
2319     - .ioctl = ecryptfs_ioctl,
2320     + .unlocked_ioctl = ecryptfs_unlocked_ioctl,
2321     +#ifdef CONFIG_COMPAT
2322     + .compat_ioctl = ecryptfs_compat_ioctl,
2323     +#endif
2324     .mmap = generic_file_mmap,
2325     .open = ecryptfs_open,
2326     .flush = ecryptfs_flush,
2327     @@ -322,20 +353,3 @@ const struct file_operations ecryptfs_main_fops = {
2328     .fasync = ecryptfs_fasync,
2329     .splice_read = generic_file_splice_read,
2330     };
2331     -
2332     -static int
2333     -ecryptfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
2334     - unsigned long arg)
2335     -{
2336     - int rc = 0;
2337     - struct file *lower_file = NULL;
2338     -
2339     - if (ecryptfs_file_to_private(file))
2340     - lower_file = ecryptfs_file_to_lower(file);
2341     - if (lower_file && lower_file->f_op && lower_file->f_op->ioctl)
2342     - rc = lower_file->f_op->ioctl(ecryptfs_inode_to_lower(inode),
2343     - lower_file, cmd, arg);
2344     - else
2345     - rc = -ENOTTY;
2346     - return rc;
2347     -}
2348     diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
2349     index 31ef525..8cd617b 100644
2350     --- a/fs/ecryptfs/inode.c
2351     +++ b/fs/ecryptfs/inode.c
2352     @@ -264,7 +264,7 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
2353     printk(KERN_ERR "%s: Out of memory whilst attempting "
2354     "to allocate ecryptfs_dentry_info struct\n",
2355     __func__);
2356     - goto out_dput;
2357     + goto out_put;
2358     }
2359     ecryptfs_set_dentry_lower(ecryptfs_dentry, lower_dentry);
2360     ecryptfs_set_dentry_lower_mnt(ecryptfs_dentry, lower_mnt);
2361     @@ -339,8 +339,9 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry,
2362     out_free_kmem:
2363     kmem_cache_free(ecryptfs_header_cache_2, page_virt);
2364     goto out;
2365     -out_dput:
2366     +out_put:
2367     dput(lower_dentry);
2368     + mntput(lower_mnt);
2369     d_drop(ecryptfs_dentry);
2370     out:
2371     return rc;
2372     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
2373     index 4e8983a..a45ced9 100644
2374     --- a/fs/ext4/super.c
2375     +++ b/fs/ext4/super.c
2376     @@ -241,7 +241,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)
2377     if (sb->s_flags & MS_RDONLY)
2378     return ERR_PTR(-EROFS);
2379    
2380     - vfs_check_frozen(sb, SB_FREEZE_WRITE);
2381     + vfs_check_frozen(sb, SB_FREEZE_TRANS);
2382     /* Special case here: if the journal has aborted behind our
2383     * backs (eg. EIO in the commit thread), then we still need to
2384     * take the FS itself readonly cleanly. */
2385     @@ -3491,7 +3491,7 @@ int ext4_force_commit(struct super_block *sb)
2386    
2387     journal = EXT4_SB(sb)->s_journal;
2388     if (journal) {
2389     - vfs_check_frozen(sb, SB_FREEZE_WRITE);
2390     + vfs_check_frozen(sb, SB_FREEZE_TRANS);
2391     ret = ext4_journal_force_commit(journal);
2392     }
2393    
2394     diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c
2395     index fa96bbb..2d7f165 100644
2396     --- a/fs/jfs/xattr.c
2397     +++ b/fs/jfs/xattr.c
2398     @@ -86,46 +86,25 @@ struct ea_buffer {
2399     #define EA_MALLOC 0x0008
2400    
2401    
2402     +static int is_known_namespace(const char *name)
2403     +{
2404     + if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) &&
2405     + strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) &&
2406     + strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
2407     + strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
2408     + return false;
2409     +
2410     + return true;
2411     +}
2412     +
2413     /*
2414     * These three routines are used to recognize on-disk extended attributes
2415     * that are in a recognized namespace. If the attribute is not recognized,
2416     * "os2." is prepended to the name
2417     */
2418     -static inline int is_os2_xattr(struct jfs_ea *ea)
2419     +static int is_os2_xattr(struct jfs_ea *ea)
2420     {
2421     - /*
2422     - * Check for "system."
2423     - */
2424     - if ((ea->namelen >= XATTR_SYSTEM_PREFIX_LEN) &&
2425     - !strncmp(ea->name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2426     - return false;
2427     - /*
2428     - * Check for "user."
2429     - */
2430     - if ((ea->namelen >= XATTR_USER_PREFIX_LEN) &&
2431     - !strncmp(ea->name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
2432     - return false;
2433     - /*
2434     - * Check for "security."
2435     - */
2436     - if ((ea->namelen >= XATTR_SECURITY_PREFIX_LEN) &&
2437     - !strncmp(ea->name, XATTR_SECURITY_PREFIX,
2438     - XATTR_SECURITY_PREFIX_LEN))
2439     - return false;
2440     - /*
2441     - * Check for "trusted."
2442     - */
2443     - if ((ea->namelen >= XATTR_TRUSTED_PREFIX_LEN) &&
2444     - !strncmp(ea->name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
2445     - return false;
2446     - /*
2447     - * Add any other valid namespace prefixes here
2448     - */
2449     -
2450     - /*
2451     - * We assume it's OS/2's flat namespace
2452     - */
2453     - return true;
2454     + return !is_known_namespace(ea->name);
2455     }
2456    
2457     static inline int name_size(struct jfs_ea *ea)
2458     @@ -764,13 +743,23 @@ static int can_set_xattr(struct inode *inode, const char *name,
2459     if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN))
2460     return can_set_system_xattr(inode, name, value, value_len);
2461    
2462     + if (!strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN)) {
2463     + /*
2464     + * This makes sure that we aren't trying to set an
2465     + * attribute in a different namespace by prefixing it
2466     + * with "os2."
2467     + */
2468     + if (is_known_namespace(name + XATTR_OS2_PREFIX_LEN))
2469     + return -EOPNOTSUPP;
2470     + return 0;
2471     + }
2472     +
2473     /*
2474     * Don't allow setting an attribute in an unknown namespace.
2475     */
2476     if (strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) &&
2477     strncmp(name, XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) &&
2478     - strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) &&
2479     - strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN))
2480     + strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN))
2481     return -EOPNOTSUPP;
2482    
2483     return 0;
2484     @@ -952,19 +941,8 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
2485     int xattr_size;
2486     ssize_t size;
2487     int namelen = strlen(name);
2488     - char *os2name = NULL;
2489     char *value;
2490    
2491     - if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) {
2492     - os2name = kmalloc(namelen - XATTR_OS2_PREFIX_LEN + 1,
2493     - GFP_KERNEL);
2494     - if (!os2name)
2495     - return -ENOMEM;
2496     - strcpy(os2name, name + XATTR_OS2_PREFIX_LEN);
2497     - name = os2name;
2498     - namelen -= XATTR_OS2_PREFIX_LEN;
2499     - }
2500     -
2501     down_read(&JFS_IP(inode)->xattr_sem);
2502    
2503     xattr_size = ea_get(inode, &ea_buf, 0);
2504     @@ -1002,8 +980,6 @@ ssize_t __jfs_getxattr(struct inode *inode, const char *name, void *data,
2505     out:
2506     up_read(&JFS_IP(inode)->xattr_sem);
2507    
2508     - kfree(os2name);
2509     -
2510     return size;
2511     }
2512    
2513     @@ -1012,6 +988,19 @@ ssize_t jfs_getxattr(struct dentry *dentry, const char *name, void *data,
2514     {
2515     int err;
2516    
2517     + if (strncmp(name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) {
2518     + /*
2519     + * skip past "os2." prefix
2520     + */
2521     + name += XATTR_OS2_PREFIX_LEN;
2522     + /*
2523     + * Don't allow retrieving properly prefixed attributes
2524     + * by prepending them with "os2."
2525     + */
2526     + if (is_known_namespace(name))
2527     + return -EOPNOTSUPP;
2528     + }
2529     +
2530     err = __jfs_getxattr(dentry->d_inode, name, data, buf_size);
2531    
2532     return err;
2533     diff --git a/fs/namespace.c b/fs/namespace.c
2534     index 88058de..32dcd24 100644
2535     --- a/fs/namespace.c
2536     +++ b/fs/namespace.c
2537     @@ -1984,7 +1984,7 @@ long do_mount(char *dev_name, char *dir_name, char *type_page,
2538     if (flags & MS_RDONLY)
2539     mnt_flags |= MNT_READONLY;
2540    
2541     - flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
2542     + flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
2543     MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
2544     MS_STRICTATIME);
2545    
2546     diff --git a/fs/signalfd.c b/fs/signalfd.c
2547     index f329849c..1c5a6ad 100644
2548     --- a/fs/signalfd.c
2549     +++ b/fs/signalfd.c
2550     @@ -88,6 +88,7 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
2551     err |= __put_user(kinfo->si_tid, &uinfo->ssi_tid);
2552     err |= __put_user(kinfo->si_overrun, &uinfo->ssi_overrun);
2553     err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
2554     + err |= __put_user(kinfo->si_int, &uinfo->ssi_int);
2555     break;
2556     case __SI_POLL:
2557     err |= __put_user(kinfo->si_band, &uinfo->ssi_band);
2558     @@ -111,6 +112,7 @@ static int signalfd_copyinfo(struct signalfd_siginfo __user *uinfo,
2559     err |= __put_user(kinfo->si_pid, &uinfo->ssi_pid);
2560     err |= __put_user(kinfo->si_uid, &uinfo->ssi_uid);
2561     err |= __put_user((long) kinfo->si_ptr, &uinfo->ssi_ptr);
2562     + err |= __put_user(kinfo->si_int, &uinfo->ssi_int);
2563     break;
2564     default:
2565     /*
2566     diff --git a/fs/super.c b/fs/super.c
2567     index 938119a..c7765bd 100644
2568     --- a/fs/super.c
2569     +++ b/fs/super.c
2570     @@ -305,8 +305,13 @@ retry:
2571     if (s) {
2572     up_write(&s->s_umount);
2573     destroy_super(s);
2574     + s = NULL;
2575     }
2576     down_write(&old->s_umount);
2577     + if (unlikely(!(old->s_flags & MS_BORN))) {
2578     + deactivate_locked_super(old);
2579     + goto retry;
2580     + }
2581     return old;
2582     }
2583     }
2584     @@ -909,6 +914,7 @@ vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void
2585     goto out_free_secdata;
2586     BUG_ON(!mnt->mnt_sb);
2587     WARN_ON(!mnt->mnt_sb->s_bdi);
2588     + mnt->mnt_sb->s_flags |= MS_BORN;
2589    
2590     error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
2591     if (error)
2592     diff --git a/include/linux/Kbuild b/include/linux/Kbuild
2593     index 2fc8e14..9aa9bca 100644
2594     --- a/include/linux/Kbuild
2595     +++ b/include/linux/Kbuild
2596     @@ -276,6 +276,7 @@ ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/asm/kvm_para.h \
2597     $(srctree)/include/asm-$(SRCARCH)/kvm_para.h),)
2598     unifdef-y += kvm_para.h
2599     endif
2600     +unifdef-y += l2tp.h
2601     unifdef-y += llc.h
2602     unifdef-y += loop.h
2603     unifdef-y += lp.h
2604     diff --git a/include/linux/fs.h b/include/linux/fs.h
2605     index 68ca1b0..f0f447a 100644
2606     --- a/include/linux/fs.h
2607     +++ b/include/linux/fs.h
2608     @@ -145,11 +145,11 @@ struct inodes_stat_t {
2609     *
2610     */
2611     #define RW_MASK 1
2612     -#define RWA_MASK 2
2613     +#define RWA_MASK 16
2614     #define READ 0
2615     #define WRITE 1
2616     -#define READA 2 /* read-ahead - don't block if no resources */
2617     -#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
2618     +#define READA 16 /* readahead - don't block if no resources */
2619     +#define SWRITE 17 /* for ll_rw_block(), wait for buffer lock */
2620     #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
2621     #define READ_META (READ | (1 << BIO_RW_META))
2622     #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
2623     @@ -209,6 +209,7 @@ struct inodes_stat_t {
2624     #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
2625     #define MS_I_VERSION (1<<23) /* Update inode I_version field */
2626     #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
2627     +#define MS_BORN (1<<29)
2628     #define MS_ACTIVE (1<<30)
2629     #define MS_NOUSER (1<<31)
2630    
2631     diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
2632     index c233113..a0384a4 100644
2633     --- a/include/linux/interrupt.h
2634     +++ b/include/linux/interrupt.h
2635     @@ -53,16 +53,21 @@
2636     * IRQF_ONESHOT - Interrupt is not reenabled after the hardirq handler finished.
2637     * Used by threaded interrupts which need to keep the
2638     * irq line disabled until the threaded handler has been run.
2639     + * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
2640     + *
2641     */
2642     #define IRQF_DISABLED 0x00000020
2643     #define IRQF_SAMPLE_RANDOM 0x00000040
2644     #define IRQF_SHARED 0x00000080
2645     #define IRQF_PROBE_SHARED 0x00000100
2646     -#define IRQF_TIMER 0x00000200
2647     +#define __IRQF_TIMER 0x00000200
2648     #define IRQF_PERCPU 0x00000400
2649     #define IRQF_NOBALANCING 0x00000800
2650     #define IRQF_IRQPOLL 0x00001000
2651     #define IRQF_ONESHOT 0x00002000
2652     +#define IRQF_NO_SUSPEND 0x00004000
2653     +
2654     +#define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND)
2655    
2656     /*
2657     * Bits used by threaded handlers:
2658     diff --git a/include/linux/notifier.h b/include/linux/notifier.h
2659     index 22c2abb..b2f1a4d 100644
2660     --- a/include/linux/notifier.h
2661     +++ b/include/linux/notifier.h
2662     @@ -210,7 +210,7 @@ static inline int notifier_to_errno(int ret)
2663     #define NETDEV_POST_INIT 0x0010
2664     #define NETDEV_UNREGISTER_BATCH 0x0011
2665     #define NETDEV_BONDING_DESLAVE 0x0012
2666     -#define NETDEV_NOTIFY_PEERS 0x0012
2667     +#define NETDEV_NOTIFY_PEERS 0x0013
2668    
2669     #define SYS_DOWN 0x0001 /* Notify of system down */
2670     #define SYS_RESTART SYS_DOWN
2671     diff --git a/include/linux/sched.h b/include/linux/sched.h
2672     index 0478888..5ee397e 100644
2673     --- a/include/linux/sched.h
2674     +++ b/include/linux/sched.h
2675     @@ -274,17 +274,11 @@ extern cpumask_var_t nohz_cpu_mask;
2676     #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ)
2677     extern int select_nohz_load_balancer(int cpu);
2678     extern int get_nohz_load_balancer(void);
2679     -extern int nohz_ratelimit(int cpu);
2680     #else
2681     static inline int select_nohz_load_balancer(int cpu)
2682     {
2683     return 0;
2684     }
2685     -
2686     -static inline int nohz_ratelimit(int cpu)
2687     -{
2688     - return 0;
2689     -}
2690     #endif
2691    
2692     /*
2693     diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
2694     index 16b7f33..3e93de7 100644
2695     --- a/include/linux/usb/quirks.h
2696     +++ b/include/linux/usb/quirks.h
2697     @@ -26,4 +26,8 @@
2698     and can't handle talking to these interfaces */
2699     #define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020
2700    
2701     +/* device needs a pause during initialization, after we read the device
2702     + descriptor */
2703     +#define USB_QUIRK_DELAY_INIT 0x00000040
2704     +
2705     #endif /* __LINUX_USB_QUIRKS_H */
2706     diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
2707     index e149748..c3003e9 100644
2708     --- a/kernel/irq/manage.c
2709     +++ b/kernel/irq/manage.c
2710     @@ -216,7 +216,7 @@ static inline int setup_affinity(unsigned int irq, struct irq_desc *desc)
2711     void __disable_irq(struct irq_desc *desc, unsigned int irq, bool suspend)
2712     {
2713     if (suspend) {
2714     - if (!desc->action || (desc->action->flags & IRQF_TIMER))
2715     + if (!desc->action || (desc->action->flags & IRQF_NO_SUSPEND))
2716     return;
2717     desc->status |= IRQ_SUSPENDED;
2718     }
2719     diff --git a/kernel/sched.c b/kernel/sched.c
2720     index f52a880..63b4a14 100644
2721     --- a/kernel/sched.c
2722     +++ b/kernel/sched.c
2723     @@ -1232,16 +1232,6 @@ void wake_up_idle_cpu(int cpu)
2724     smp_send_reschedule(cpu);
2725     }
2726    
2727     -int nohz_ratelimit(int cpu)
2728     -{
2729     - struct rq *rq = cpu_rq(cpu);
2730     - u64 diff = rq->clock - rq->nohz_stamp;
2731     -
2732     - rq->nohz_stamp = rq->clock;
2733     -
2734     - return diff < (NSEC_PER_SEC / HZ) >> 1;
2735     -}
2736     -
2737     #endif /* CONFIG_NO_HZ */
2738    
2739     static u64 sched_avg_period(void)
2740     diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
2741     index 813993b..f898af6 100644
2742     --- a/kernel/time/tick-sched.c
2743     +++ b/kernel/time/tick-sched.c
2744     @@ -325,7 +325,7 @@ void tick_nohz_stop_sched_tick(int inidle)
2745     } while (read_seqretry(&xtime_lock, seq));
2746    
2747     if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu) ||
2748     - arch_needs_cpu(cpu) || nohz_ratelimit(cpu)) {
2749     + arch_needs_cpu(cpu)) {
2750     next_jiffies = last_jiffies + 1;
2751     delta_jiffies = 1;
2752     } else {
2753     diff --git a/mm/memory.c b/mm/memory.c
2754     index bde42c6..aaaedbd 100644
2755     --- a/mm/memory.c
2756     +++ b/mm/memory.c
2757     @@ -2760,6 +2760,26 @@ out_release:
2758     }
2759    
2760     /*
2761     + * This is like a special single-page "expand_downwards()",
2762     + * except we must first make sure that 'address-PAGE_SIZE'
2763     + * doesn't hit another vma.
2764     + *
2765     + * The "find_vma()" will do the right thing even if we wrap
2766     + */
2767     +static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned long address)
2768     +{
2769     + address &= PAGE_MASK;
2770     + if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) {
2771     + address -= PAGE_SIZE;
2772     + if (find_vma(vma->vm_mm, address) != vma)
2773     + return -ENOMEM;
2774     +
2775     + expand_stack(vma, address);
2776     + }
2777     + return 0;
2778     +}
2779     +
2780     +/*
2781     * We enter with non-exclusive mmap_sem (to exclude vma changes,
2782     * but allow concurrent faults), and pte mapped but not yet locked.
2783     * We return with mmap_sem still held, but pte unmapped and unlocked.
2784     @@ -2772,6 +2792,11 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
2785     spinlock_t *ptl;
2786     pte_t entry;
2787    
2788     + if (check_stack_guard_page(vma, address) < 0) {
2789     + pte_unmap(page_table);
2790     + return VM_FAULT_SIGBUS;
2791     + }
2792     +
2793     if (!(flags & FAULT_FLAG_WRITE)) {
2794     entry = pte_mkspecial(pfn_pte(my_zero_pfn(address),
2795     vma->vm_page_prot));
2796     diff --git a/mm/swapfile.c b/mm/swapfile.c
2797     index 03aa2d5..f08d165 100644
2798     --- a/mm/swapfile.c
2799     +++ b/mm/swapfile.c
2800     @@ -318,8 +318,10 @@ checks:
2801     if (offset > si->highest_bit)
2802     scan_base = offset = si->lowest_bit;
2803    
2804     - /* reuse swap entry of cache-only swap if not busy. */
2805     - if (vm_swap_full() && si->swap_map[offset] == SWAP_HAS_CACHE) {
2806     + /* reuse swap entry of cache-only swap if not hibernation. */
2807     + if (vm_swap_full()
2808     + && usage == SWAP_HAS_CACHE
2809     + && si->swap_map[offset] == SWAP_HAS_CACHE) {
2810     int swap_was_freed;
2811     spin_unlock(&swap_lock);
2812     swap_was_freed = __try_to_reclaim_swap(si, offset);
2813     diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2814     index 596ea2f..aa7cc51 100644
2815     --- a/sound/pci/hda/patch_realtek.c
2816     +++ b/sound/pci/hda/patch_realtek.c
2817     @@ -5183,6 +5183,7 @@ static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
2818    
2819     static struct snd_pci_quirk beep_white_list[] = {
2820     SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
2821     + SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
2822     {}
2823     };
2824