Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:master commit in: 3.2.19/, 2.6.32/, 3.3.8/, 3.3.7/, 3.2.18/
Date: Wed, 06 Jun 2012 20:49:34
Message-Id: 1339015722.e5f84a20682495175b7fd78f3df6f4c0affb3064.blueness@gentoo
1 commit: e5f84a20682495175b7fd78f3df6f4c0affb3064
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 6 20:48:42 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 6 20:48:42 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=e5f84a20
7
8 Grsec/PaX: 2.9-{2.6.32.59,3.2.19,3.3.8}-201206042136
9
10 ---
11 2.6.32/0000_README | 2 +-
12 ...20_grsecurity-2.9-2.6.32.59-201206042134.patch} | 34 +-
13 3.2.18/1016_linux-3.2.17.patch | 5695 --------------------
14 3.2.18/1017_linux-3.2.18.patch | 1791 ------
15 {3.2.18 => 3.2.19}/0000_README | 2 +-
16 .../4420_grsecurity-2.9-3.2.19-201206042135.patch | 800 ++--
17 .../4430_grsec-remove-localversion-grsec.patch | 0
18 {3.2.18 => 3.2.19}/4435_grsec-mute-warnings.patch | 0
19 .../4440_grsec-remove-protected-paths.patch | 0
20 .../4445_grsec-pax-without-grsec.patch | 0
21 .../4450_grsec-kconfig-default-gids.patch | 0
22 {3.2.18 => 3.2.19}/4455_grsec-kconfig-gentoo.patch | 0
23 .../4460-grsec-kconfig-proc-user.patch | 0
24 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
25 {3.2.18 => 3.2.19}/4470_disable-compat_vdso.patch | 0
26 {3.3.7 => 3.3.8}/0000_README | 2 +-
27 .../4420_grsecurity-2.9-3.3.8-201206042136.patch | 612 ++-
28 .../4430_grsec-remove-localversion-grsec.patch | 0
29 {3.3.7 => 3.3.8}/4435_grsec-mute-warnings.patch | 0
30 .../4440_grsec-remove-protected-paths.patch | 0
31 .../4445_grsec-pax-without-grsec.patch | 0
32 .../4450_grsec-kconfig-default-gids.patch | 0
33 {3.3.7 => 3.3.8}/4455_grsec-kconfig-gentoo.patch | 0
34 .../4460-grsec-kconfig-proc-user.patch | 0
35 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
36 {3.3.7 => 3.3.8}/4470_disable-compat_vdso.patch | 0
37 26 files changed, 678 insertions(+), 8260 deletions(-)
38
39 diff --git a/2.6.32/0000_README b/2.6.32/0000_README
40 index 4b5c6dc..1e75c22 100644
41 --- a/2.6.32/0000_README
42 +++ b/2.6.32/0000_README
43 @@ -30,7 +30,7 @@ Patch: 1058_linux-2.6.32.59.patch
44 From: http://www.kernel.org
45 Desc: Linux 2.6.32.59
46
47 -Patch: 4420_grsecurity-2.9-2.6.32.59-201206011934.patch
48 +Patch: 4420_grsecurity-2.9-2.6.32.59-201206042134.patch
49 From: http://www.grsecurity.net
50 Desc: hardened-sources base patch from upstream grsecurity
51
52
53 diff --git a/2.6.32/4420_grsecurity-2.9-2.6.32.59-201206011934.patch b/2.6.32/4420_grsecurity-2.9-2.6.32.59-201206042134.patch
54 similarity index 99%
55 rename from 2.6.32/4420_grsecurity-2.9-2.6.32.59-201206011934.patch
56 rename to 2.6.32/4420_grsecurity-2.9-2.6.32.59-201206042134.patch
57 index d2b4115..9d85b0d 100644
58 --- a/2.6.32/4420_grsecurity-2.9-2.6.32.59-201206011934.patch
59 +++ b/2.6.32/4420_grsecurity-2.9-2.6.32.59-201206042134.patch
60 @@ -26798,7 +26798,7 @@ index f46c3407..f7e72b0 100644
61 }
62 if (mm->get_unmapped_area == arch_get_unmapped_area)
63 diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
64 -index 73ffd55..e2f0e1d 100644
65 +index 73ffd55..2cb04d8 100644
66 --- a/arch/x86/mm/init.c
67 +++ b/arch/x86/mm/init.c
68 @@ -13,6 +13,7 @@
69 @@ -26864,7 +26864,7 @@ index 73ffd55..e2f0e1d 100644
70 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
71 return 0;
72 if (!page_is_ram(pagenr))
73 -@@ -377,8 +396,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
74 +@@ -377,8 +396,116 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
75 #endif
76 }
77
78 @@ -26899,14 +26899,13 @@ index 73ffd55..e2f0e1d 100644
79 + unsigned long addr, limit;
80 + struct desc_struct d;
81 + int cpu;
82 -+#endif
83 -+#endif
84 -+#ifndef CONFIG_X86_PAE
85 ++#else
86 + pgd_t *pgd;
87 + pud_t *pud;
88 + pmd_t *pmd;
89 + unsigned long addr, end;
90 +#endif
91 ++#endif
92 +
93 + gr_init_ebda();
94 +
95 @@ -28968,7 +28967,7 @@ index 21e1aeb..2c0b3c4 100644
96 -}
97 -__setup("vdso=", vdso_setup);
98 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
99 -index 0087b00..eecb34f 100644
100 +index 0087b00..ec5c76f 100644
101 --- a/arch/x86/xen/enlighten.c
102 +++ b/arch/x86/xen/enlighten.c
103 @@ -71,8 +71,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
104 @@ -28989,7 +28988,18 @@ index 0087b00..eecb34f 100644
105 end = start + __get_cpu_var(idt_desc).size + 1;
106
107 xen_mc_flush();
108 -@@ -993,7 +991,7 @@ static const struct pv_apic_ops xen_apic_ops __initdata = {
109 +@@ -945,7 +943,10 @@ static const struct pv_cpu_ops xen_cpu_ops __initdata = {
110 + .wbinvd = native_wbinvd,
111 +
112 + .read_msr = native_read_msr_safe,
113 ++ .rdmsr_regs = native_rdmsr_safe_regs,
114 + .write_msr = xen_write_msr_safe,
115 ++ .wrmsr_regs = native_wrmsr_safe_regs,
116 ++
117 + .read_tsc = native_read_tsc,
118 + .read_pmc = native_read_pmc,
119 +
120 +@@ -993,7 +994,7 @@ static const struct pv_apic_ops xen_apic_ops __initdata = {
121 #endif
122 };
123
124 @@ -28998,7 +29008,7 @@ index 0087b00..eecb34f 100644
125 {
126 struct sched_shutdown r = { .reason = reason };
127
128 -@@ -1001,17 +999,17 @@ static void xen_reboot(int reason)
129 +@@ -1001,17 +1002,17 @@ static void xen_reboot(int reason)
130 BUG();
131 }
132
133 @@ -29019,7 +29029,7 @@ index 0087b00..eecb34f 100644
134 {
135 xen_reboot(SHUTDOWN_poweroff);
136 }
137 -@@ -1095,9 +1093,20 @@ asmlinkage void __init xen_start_kernel(void)
138 +@@ -1095,9 +1096,20 @@ asmlinkage void __init xen_start_kernel(void)
139 */
140 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
141
142 @@ -29042,7 +29052,7 @@ index 0087b00..eecb34f 100644
143 #endif
144
145 xen_setup_features();
146 -@@ -1129,13 +1138,6 @@ asmlinkage void __init xen_start_kernel(void)
147 +@@ -1129,13 +1141,6 @@ asmlinkage void __init xen_start_kernel(void)
148
149 machine_ops = xen_machine_ops;
150
151 @@ -101423,14 +101433,14 @@ index f095659..537313b 100644
152 return -EFAULT;
153
154 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
155 -index ce1ce82..8825bcd 100644
156 +index ce1ce82..218d4fc 100644
157 --- a/net/ipv4/tcp_input.c
158 +++ b/net/ipv4/tcp_input.c
159 @@ -5632,6 +5632,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
160 goto discard;
161
162 if (th->syn) {
163 -+ if (th->fin)
164 ++ if (th->fin || th->urg || th->psh)
165 + goto discard;
166 if (icsk->icsk_af_ops->conn_request(sk, skb) < 0)
167 return 1;
168
169 diff --git a/3.2.18/1016_linux-3.2.17.patch b/3.2.18/1016_linux-3.2.17.patch
170 deleted file mode 100644
171 index 5aeed10..0000000
172 --- a/3.2.18/1016_linux-3.2.17.patch
173 +++ /dev/null
174 @@ -1,5695 +0,0 @@
175 -diff --git a/Makefile b/Makefile
176 -index 3da29cb..4c4efa3 100644
177 ---- a/Makefile
178 -+++ b/Makefile
179 -@@ -1,6 +1,6 @@
180 - VERSION = 3
181 - PATCHLEVEL = 2
182 --SUBLEVEL = 16
183 -+SUBLEVEL = 17
184 - EXTRAVERSION =
185 - NAME = Saber-toothed Squirrel
186 -
187 -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
188 -index ab3740e..ef642a0 100644
189 ---- a/arch/arm/Kconfig
190 -+++ b/arch/arm/Kconfig
191 -@@ -1155,6 +1155,15 @@ if !MMU
192 - source "arch/arm/Kconfig-nommu"
193 - endif
194 -
195 -+config ARM_ERRATA_326103
196 -+ bool "ARM errata: FSR write bit incorrect on a SWP to read-only memory"
197 -+ depends on CPU_V6
198 -+ help
199 -+ Executing a SWP instruction to read-only memory does not set bit 11
200 -+ of the FSR on the ARM 1136 prior to r1p0. This causes the kernel to
201 -+ treat the access as a read, preventing a COW from occurring and
202 -+ causing the faulting task to livelock.
203 -+
204 - config ARM_ERRATA_411920
205 - bool "ARM errata: Invalidation of the Instruction Cache operation can fail"
206 - depends on CPU_V6 || CPU_V6K
207 -diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
208 -index 60843eb..73409e6 100644
209 ---- a/arch/arm/include/asm/tls.h
210 -+++ b/arch/arm/include/asm/tls.h
211 -@@ -7,6 +7,8 @@
212 -
213 - .macro set_tls_v6k, tp, tmp1, tmp2
214 - mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
215 -+ mov \tmp1, #0
216 -+ mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
217 - .endm
218 -
219 - .macro set_tls_v6, tp, tmp1, tmp2
220 -@@ -15,6 +17,8 @@
221 - mov \tmp2, #0xffff0fff
222 - tst \tmp1, #HWCAP_TLS @ hardware TLS available?
223 - mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
224 -+ movne \tmp1, #0
225 -+ mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
226 - streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
227 - .endm
228 -
229 -diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
230 -index 3efd82c..87c8be5 100644
231 ---- a/arch/arm/kernel/irq.c
232 -+++ b/arch/arm/kernel/irq.c
233 -@@ -156,10 +156,10 @@ static bool migrate_one_irq(struct irq_desc *desc)
234 - }
235 -
236 - c = irq_data_get_irq_chip(d);
237 -- if (c->irq_set_affinity)
238 -- c->irq_set_affinity(d, affinity, true);
239 -- else
240 -+ if (!c->irq_set_affinity)
241 - pr_debug("IRQ%u: unable to set affinity\n", d->irq);
242 -+ else if (c->irq_set_affinity(d, affinity, true) == IRQ_SET_MASK_OK && ret)
243 -+ cpumask_copy(d->affinity, affinity);
244 -
245 - return ret;
246 - }
247 -diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
248 -index ef5640b..e10e59a 100644
249 ---- a/arch/arm/kernel/smp.c
250 -+++ b/arch/arm/kernel/smp.c
251 -@@ -297,8 +297,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
252 - struct mm_struct *mm = &init_mm;
253 - unsigned int cpu = smp_processor_id();
254 -
255 -- printk("CPU%u: Booted secondary processor\n", cpu);
256 --
257 - /*
258 - * All kernel threads share the same mm context; grab a
259 - * reference and switch to it.
260 -@@ -310,6 +308,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
261 - enter_lazy_tlb(mm, current);
262 - local_flush_tlb_all();
263 -
264 -+ printk("CPU%u: Booted secondary processor\n", cpu);
265 -+
266 - cpu_init();
267 - preempt_disable();
268 - trace_hardirqs_off();
269 -diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
270 -index d2b1779..76cbb05 100644
271 ---- a/arch/arm/kernel/sys_arm.c
272 -+++ b/arch/arm/kernel/sys_arm.c
273 -@@ -115,7 +115,7 @@ int kernel_execve(const char *filename,
274 - "Ir" (THREAD_START_SP - sizeof(regs)),
275 - "r" (&regs),
276 - "Ir" (sizeof(regs))
277 -- : "r0", "r1", "r2", "r3", "ip", "lr", "memory");
278 -+ : "r0", "r1", "r2", "r3", "r8", "r9", "ip", "lr", "memory");
279 -
280 - out:
281 - return ret;
282 -diff --git a/arch/arm/mach-omap1/timer.c b/arch/arm/mach-omap1/timer.c
283 -index 6e90665..fb202af 100644
284 ---- a/arch/arm/mach-omap1/timer.c
285 -+++ b/arch/arm/mach-omap1/timer.c
286 -@@ -47,9 +47,9 @@ static int omap1_dm_timer_set_src(struct platform_device *pdev,
287 - int n = (pdev->id - 1) << 1;
288 - u32 l;
289 -
290 -- l = __raw_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
291 -+ l = omap_readl(MOD_CONF_CTRL_1) & ~(0x03 << n);
292 - l |= source << n;
293 -- __raw_writel(l, MOD_CONF_CTRL_1);
294 -+ omap_writel(l, MOD_CONF_CTRL_1);
295 -
296 - return 0;
297 - }
298 -diff --git a/arch/arm/mm/abort-ev6.S b/arch/arm/mm/abort-ev6.S
299 -index ff1f7cc..8074199 100644
300 ---- a/arch/arm/mm/abort-ev6.S
301 -+++ b/arch/arm/mm/abort-ev6.S
302 -@@ -26,18 +26,23 @@ ENTRY(v6_early_abort)
303 - mrc p15, 0, r1, c5, c0, 0 @ get FSR
304 - mrc p15, 0, r0, c6, c0, 0 @ get FAR
305 - /*
306 -- * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR (erratum 326103).
307 -- * The test below covers all the write situations, including Java bytecodes
308 -+ * Faulty SWP instruction on 1136 doesn't set bit 11 in DFSR.
309 - */
310 -- bic r1, r1, #1 << 11 @ clear bit 11 of FSR
311 -+#ifdef CONFIG_ARM_ERRATA_326103
312 -+ ldr ip, =0x4107b36
313 -+ mrc p15, 0, r3, c0, c0, 0 @ get processor id
314 -+ teq ip, r3, lsr #4 @ r0 ARM1136?
315 -+ bne do_DataAbort
316 - tst r5, #PSR_J_BIT @ Java?
317 -+ tsteq r5, #PSR_T_BIT @ Thumb?
318 - bne do_DataAbort
319 -- do_thumb_abort fsr=r1, pc=r4, psr=r5, tmp=r3
320 -- ldreq r3, [r4] @ read aborted ARM instruction
321 -+ bic r1, r1, #1 << 11 @ clear bit 11 of FSR
322 -+ ldr r3, [r4] @ read aborted ARM instruction
323 - #ifdef CONFIG_CPU_ENDIAN_BE8
324 -- reveq r3, r3
325 -+ rev r3, r3
326 - #endif
327 - do_ldrd_abort tmp=ip, insn=r3
328 - tst r3, #1 << 20 @ L = 0 -> write
329 - orreq r1, r1, #1 << 11 @ yes.
330 -+#endif
331 - b do_DataAbort
332 -diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
333 -index b1e192b..db7bcc0 100644
334 ---- a/arch/arm/mm/cache-l2x0.c
335 -+++ b/arch/arm/mm/cache-l2x0.c
336 -@@ -32,6 +32,7 @@ static void __iomem *l2x0_base;
337 - static DEFINE_RAW_SPINLOCK(l2x0_lock);
338 - static uint32_t l2x0_way_mask; /* Bitmask of active ways */
339 - static uint32_t l2x0_size;
340 -+static unsigned long sync_reg_offset = L2X0_CACHE_SYNC;
341 -
342 - struct l2x0_regs l2x0_saved_regs;
343 -
344 -@@ -61,12 +62,7 @@ static inline void cache_sync(void)
345 - {
346 - void __iomem *base = l2x0_base;
347 -
348 --#ifdef CONFIG_PL310_ERRATA_753970
349 -- /* write to an unmmapped register */
350 -- writel_relaxed(0, base + L2X0_DUMMY_REG);
351 --#else
352 -- writel_relaxed(0, base + L2X0_CACHE_SYNC);
353 --#endif
354 -+ writel_relaxed(0, base + sync_reg_offset);
355 - cache_wait(base + L2X0_CACHE_SYNC, 1);
356 - }
357 -
358 -@@ -85,10 +81,13 @@ static inline void l2x0_inv_line(unsigned long addr)
359 - }
360 -
361 - #if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915)
362 -+static inline void debug_writel(unsigned long val)
363 -+{
364 -+ if (outer_cache.set_debug)
365 -+ outer_cache.set_debug(val);
366 -+}
367 -
368 --#define debug_writel(val) outer_cache.set_debug(val)
369 --
370 --static void l2x0_set_debug(unsigned long val)
371 -+static void pl310_set_debug(unsigned long val)
372 - {
373 - writel_relaxed(val, l2x0_base + L2X0_DEBUG_CTRL);
374 - }
375 -@@ -98,7 +97,7 @@ static inline void debug_writel(unsigned long val)
376 - {
377 - }
378 -
379 --#define l2x0_set_debug NULL
380 -+#define pl310_set_debug NULL
381 - #endif
382 -
383 - #ifdef CONFIG_PL310_ERRATA_588369
384 -@@ -331,6 +330,11 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
385 - else
386 - ways = 8;
387 - type = "L310";
388 -+#ifdef CONFIG_PL310_ERRATA_753970
389 -+ /* Unmapped register. */
390 -+ sync_reg_offset = L2X0_DUMMY_REG;
391 -+#endif
392 -+ outer_cache.set_debug = pl310_set_debug;
393 - break;
394 - case L2X0_CACHE_ID_PART_L210:
395 - ways = (aux >> 13) & 0xf;
396 -@@ -379,7 +383,6 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
397 - outer_cache.flush_all = l2x0_flush_all;
398 - outer_cache.inv_all = l2x0_inv_all;
399 - outer_cache.disable = l2x0_disable;
400 -- outer_cache.set_debug = l2x0_set_debug;
401 -
402 - printk(KERN_INFO "%s cache controller enabled\n", type);
403 - printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
404 -diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
405 -index 89bbf4e..e77f4e4 100644
406 ---- a/arch/x86/boot/compressed/relocs.c
407 -+++ b/arch/x86/boot/compressed/relocs.c
408 -@@ -402,13 +402,11 @@ static void print_absolute_symbols(void)
409 - for (i = 0; i < ehdr.e_shnum; i++) {
410 - struct section *sec = &secs[i];
411 - char *sym_strtab;
412 -- Elf32_Sym *sh_symtab;
413 - int j;
414 -
415 - if (sec->shdr.sh_type != SHT_SYMTAB) {
416 - continue;
417 - }
418 -- sh_symtab = sec->symtab;
419 - sym_strtab = sec->link->strtab;
420 - for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Sym); j++) {
421 - Elf32_Sym *sym;
422 -diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
423 -index f98d84c..c4e3581 100644
424 ---- a/arch/x86/kernel/apic/apic.c
425 -+++ b/arch/x86/kernel/apic/apic.c
426 -@@ -1577,9 +1577,11 @@ static int __init apic_verify(void)
427 - mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
428 -
429 - /* The BIOS may have set up the APIC at some other address */
430 -- rdmsr(MSR_IA32_APICBASE, l, h);
431 -- if (l & MSR_IA32_APICBASE_ENABLE)
432 -- mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
433 -+ if (boot_cpu_data.x86 >= 6) {
434 -+ rdmsr(MSR_IA32_APICBASE, l, h);
435 -+ if (l & MSR_IA32_APICBASE_ENABLE)
436 -+ mp_lapic_addr = l & MSR_IA32_APICBASE_BASE;
437 -+ }
438 -
439 - pr_info("Found and enabled local APIC!\n");
440 - return 0;
441 -@@ -1597,13 +1599,15 @@ int __init apic_force_enable(unsigned long addr)
442 - * MSR. This can only be done in software for Intel P6 or later
443 - * and AMD K7 (Model > 1) or later.
444 - */
445 -- rdmsr(MSR_IA32_APICBASE, l, h);
446 -- if (!(l & MSR_IA32_APICBASE_ENABLE)) {
447 -- pr_info("Local APIC disabled by BIOS -- reenabling.\n");
448 -- l &= ~MSR_IA32_APICBASE_BASE;
449 -- l |= MSR_IA32_APICBASE_ENABLE | addr;
450 -- wrmsr(MSR_IA32_APICBASE, l, h);
451 -- enabled_via_apicbase = 1;
452 -+ if (boot_cpu_data.x86 >= 6) {
453 -+ rdmsr(MSR_IA32_APICBASE, l, h);
454 -+ if (!(l & MSR_IA32_APICBASE_ENABLE)) {
455 -+ pr_info("Local APIC disabled by BIOS -- reenabling.\n");
456 -+ l &= ~MSR_IA32_APICBASE_BASE;
457 -+ l |= MSR_IA32_APICBASE_ENABLE | addr;
458 -+ wrmsr(MSR_IA32_APICBASE, l, h);
459 -+ enabled_via_apicbase = 1;
460 -+ }
461 - }
462 - return apic_verify();
463 - }
464 -@@ -2149,10 +2153,12 @@ static void lapic_resume(void)
465 - * FIXME! This will be wrong if we ever support suspend on
466 - * SMP! We'll need to do this as part of the CPU restore!
467 - */
468 -- rdmsr(MSR_IA32_APICBASE, l, h);
469 -- l &= ~MSR_IA32_APICBASE_BASE;
470 -- l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
471 -- wrmsr(MSR_IA32_APICBASE, l, h);
472 -+ if (boot_cpu_data.x86 >= 6) {
473 -+ rdmsr(MSR_IA32_APICBASE, l, h);
474 -+ l &= ~MSR_IA32_APICBASE_BASE;
475 -+ l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
476 -+ wrmsr(MSR_IA32_APICBASE, l, h);
477 -+ }
478 - }
479 -
480 - maxlvt = lapic_get_maxlvt();
481 -diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
482 -index 9d46f5e..563a09d 100644
483 ---- a/arch/x86/kernel/microcode_core.c
484 -+++ b/arch/x86/kernel/microcode_core.c
485 -@@ -418,10 +418,8 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
486 - if (err)
487 - return err;
488 -
489 -- if (microcode_init_cpu(cpu) == UCODE_ERROR) {
490 -- sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
491 -+ if (microcode_init_cpu(cpu) == UCODE_ERROR)
492 - return -EINVAL;
493 -- }
494 -
495 - return err;
496 - }
497 -diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
498 -index 71f4727..5a98aa2 100644
499 ---- a/arch/x86/kernel/setup_percpu.c
500 -+++ b/arch/x86/kernel/setup_percpu.c
501 -@@ -185,10 +185,22 @@ void __init setup_per_cpu_areas(void)
502 - #endif
503 - rc = -EINVAL;
504 - if (pcpu_chosen_fc != PCPU_FC_PAGE) {
505 -- const size_t atom_size = cpu_has_pse ? PMD_SIZE : PAGE_SIZE;
506 - const size_t dyn_size = PERCPU_MODULE_RESERVE +
507 - PERCPU_DYNAMIC_RESERVE - PERCPU_FIRST_CHUNK_RESERVE;
508 -+ size_t atom_size;
509 -
510 -+ /*
511 -+ * On 64bit, use PMD_SIZE for atom_size so that embedded
512 -+ * percpu areas are aligned to PMD. This, in the future,
513 -+ * can also allow using PMD mappings in vmalloc area. Use
514 -+ * PAGE_SIZE on 32bit as vmalloc space is highly contended
515 -+ * and large vmalloc area allocs can easily fail.
516 -+ */
517 -+#ifdef CONFIG_X86_64
518 -+ atom_size = PMD_SIZE;
519 -+#else
520 -+ atom_size = PAGE_SIZE;
521 -+#endif
522 - rc = pcpu_embed_first_chunk(PERCPU_FIRST_CHUNK_RESERVE,
523 - dyn_size, atom_size,
524 - pcpu_cpu_distance,
525 -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
526 -index 1f92865..e7c920b 100644
527 ---- a/arch/x86/xen/enlighten.c
528 -+++ b/arch/x86/xen/enlighten.c
529 -@@ -62,6 +62,7 @@
530 - #include <asm/reboot.h>
531 - #include <asm/stackprotector.h>
532 - #include <asm/hypervisor.h>
533 -+#include <asm/pci_x86.h>
534 -
535 - #include "xen-ops.h"
536 - #include "mmu.h"
537 -@@ -1278,8 +1279,10 @@ asmlinkage void __init xen_start_kernel(void)
538 - /* Make sure ACS will be enabled */
539 - pci_request_acs();
540 - }
541 --
542 --
543 -+#ifdef CONFIG_PCI
544 -+ /* PCI BIOS service won't work from a PV guest. */
545 -+ pci_probe &= ~PCI_PROBE_BIOS;
546 -+#endif
547 - xen_raw_console_write("about to get started...\n");
548 -
549 - xen_setup_runstate_info(0);
550 -diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
551 -index 87f6673..ec3d603 100644
552 ---- a/arch/x86/xen/mmu.c
553 -+++ b/arch/x86/xen/mmu.c
554 -@@ -353,8 +353,13 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
555 - {
556 - if (val & _PAGE_PRESENT) {
557 - unsigned long mfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
558 -+ unsigned long pfn = mfn_to_pfn(mfn);
559 -+
560 - pteval_t flags = val & PTE_FLAGS_MASK;
561 -- val = ((pteval_t)mfn_to_pfn(mfn) << PAGE_SHIFT) | flags;
562 -+ if (unlikely(pfn == ~0))
563 -+ val = flags & ~_PAGE_PRESENT;
564 -+ else
565 -+ val = ((pteval_t)pfn << PAGE_SHIFT) | flags;
566 - }
567 -
568 - return val;
569 -diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
570 -index 041d4fe..9a23fff 100644
571 ---- a/arch/x86/xen/smp.c
572 -+++ b/arch/x86/xen/smp.c
573 -@@ -172,6 +172,7 @@ static void __init xen_fill_possible_map(void)
574 - static void __init xen_filter_cpu_maps(void)
575 - {
576 - int i, rc;
577 -+ unsigned int subtract = 0;
578 -
579 - if (!xen_initial_domain())
580 - return;
581 -@@ -186,8 +187,22 @@ static void __init xen_filter_cpu_maps(void)
582 - } else {
583 - set_cpu_possible(i, false);
584 - set_cpu_present(i, false);
585 -+ subtract++;
586 - }
587 - }
588 -+#ifdef CONFIG_HOTPLUG_CPU
589 -+ /* This is akin to using 'nr_cpus' on the Linux command line.
590 -+ * Which is OK as when we use 'dom0_max_vcpus=X' we can only
591 -+ * have up to X, while nr_cpu_ids is greater than X. This
592 -+ * normally is not a problem, except when CPU hotplugging
593 -+ * is involved and then there might be more than X CPUs
594 -+ * in the guest - which will not work as there is no
595 -+ * hypercall to expand the max number of VCPUs an already
596 -+ * running guest has. So cap it up to X. */
597 -+ if (subtract)
598 -+ nr_cpu_ids = nr_cpu_ids - subtract;
599 -+#endif
600 -+
601 - }
602 -
603 - static void __init xen_smp_prepare_boot_cpu(void)
604 -diff --git a/arch/x86/xen/xen-asm.S b/arch/x86/xen/xen-asm.S
605 -index 79d7362..3e45aa0 100644
606 ---- a/arch/x86/xen/xen-asm.S
607 -+++ b/arch/x86/xen/xen-asm.S
608 -@@ -96,7 +96,7 @@ ENTRY(xen_restore_fl_direct)
609 -
610 - /* check for unmasked and pending */
611 - cmpw $0x0001, PER_CPU_VAR(xen_vcpu_info) + XEN_vcpu_info_pending
612 -- jz 1f
613 -+ jnz 1f
614 - 2: call check_events
615 - 1:
616 - ENDPATCH(xen_restore_fl_direct)
617 -diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c
618 -index 107f6f7..dd30f40 100644
619 ---- a/crypto/sha512_generic.c
620 -+++ b/crypto/sha512_generic.c
621 -@@ -174,7 +174,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)
622 - index = sctx->count[0] & 0x7f;
623 -
624 - /* Update number of bytes */
625 -- if (!(sctx->count[0] += len))
626 -+ if ((sctx->count[0] += len) < len)
627 - sctx->count[1]++;
628 -
629 - part_len = 128 - index;
630 -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
631 -index a9b2820..58db834 100644
632 ---- a/drivers/ata/libata-eh.c
633 -+++ b/drivers/ata/libata-eh.c
634 -@@ -3500,7 +3500,8 @@ static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg
635 - u64 now = get_jiffies_64();
636 - int *trials = void_arg;
637 -
638 -- if (ent->timestamp < now - min(now, interval))
639 -+ if ((ent->eflags & ATA_EFLAG_OLD_ER) ||
640 -+ (ent->timestamp < now - min(now, interval)))
641 - return -1;
642 -
643 - (*trials)++;
644 -diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
645 -index 003cd8d..99fefbd 100644
646 ---- a/drivers/bluetooth/ath3k.c
647 -+++ b/drivers/bluetooth/ath3k.c
648 -@@ -73,6 +73,7 @@ static struct usb_device_id ath3k_table[] = {
649 - { USB_DEVICE(0x0CF3, 0x3004) },
650 - { USB_DEVICE(0x0CF3, 0x311D) },
651 - { USB_DEVICE(0x13d3, 0x3375) },
652 -+ { USB_DEVICE(0x04CA, 0x3005) },
653 -
654 - /* Atheros AR5BBU12 with sflash firmware */
655 - { USB_DEVICE(0x0489, 0xE02C) },
656 -@@ -91,6 +92,7 @@ static struct usb_device_id ath3k_blist_tbl[] = {
657 - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
658 - { USB_DEVICE(0x0cf3, 0x311D), .driver_info = BTUSB_ATH3012 },
659 - { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
660 -+ { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
661 -
662 - { } /* Terminating entry */
663 - };
664 -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
665 -index db44ad5..e56da6a 100644
666 ---- a/drivers/bluetooth/btusb.c
667 -+++ b/drivers/bluetooth/btusb.c
668 -@@ -129,6 +129,7 @@ static struct usb_device_id blacklist_table[] = {
669 - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
670 - { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
671 - { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
672 -+ { USB_DEVICE(0x04ca, 0x3005), .driver_info = BTUSB_ATH3012 },
673 -
674 - /* Atheros AR5BBU12 with sflash firmware */
675 - { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE },
676 -diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
677 -index a60adbf..79dcf6e 100644
678 ---- a/drivers/dma/at_hdmac.c
679 -+++ b/drivers/dma/at_hdmac.c
680 -@@ -239,10 +239,6 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first)
681 -
682 - vdbg_dump_regs(atchan);
683 -
684 -- /* clear any pending interrupt */
685 -- while (dma_readl(atdma, EBCISR))
686 -- cpu_relax();
687 --
688 - channel_writel(atchan, SADDR, 0);
689 - channel_writel(atchan, DADDR, 0);
690 - channel_writel(atchan, CTRLA, 0);
691 -diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
692 -index b0a8117..0535c21 100644
693 ---- a/drivers/firmware/efivars.c
694 -+++ b/drivers/firmware/efivars.c
695 -@@ -191,6 +191,190 @@ utf16_strncmp(const efi_char16_t *a, const efi_char16_t *b, size_t len)
696 - }
697 - }
698 -
699 -+static bool
700 -+validate_device_path(struct efi_variable *var, int match, u8 *buffer,
701 -+ unsigned long len)
702 -+{
703 -+ struct efi_generic_dev_path *node;
704 -+ int offset = 0;
705 -+
706 -+ node = (struct efi_generic_dev_path *)buffer;
707 -+
708 -+ if (len < sizeof(*node))
709 -+ return false;
710 -+
711 -+ while (offset <= len - sizeof(*node) &&
712 -+ node->length >= sizeof(*node) &&
713 -+ node->length <= len - offset) {
714 -+ offset += node->length;
715 -+
716 -+ if ((node->type == EFI_DEV_END_PATH ||
717 -+ node->type == EFI_DEV_END_PATH2) &&
718 -+ node->sub_type == EFI_DEV_END_ENTIRE)
719 -+ return true;
720 -+
721 -+ node = (struct efi_generic_dev_path *)(buffer + offset);
722 -+ }
723 -+
724 -+ /*
725 -+ * If we're here then either node->length pointed past the end
726 -+ * of the buffer or we reached the end of the buffer without
727 -+ * finding a device path end node.
728 -+ */
729 -+ return false;
730 -+}
731 -+
732 -+static bool
733 -+validate_boot_order(struct efi_variable *var, int match, u8 *buffer,
734 -+ unsigned long len)
735 -+{
736 -+ /* An array of 16-bit integers */
737 -+ if ((len % 2) != 0)
738 -+ return false;
739 -+
740 -+ return true;
741 -+}
742 -+
743 -+static bool
744 -+validate_load_option(struct efi_variable *var, int match, u8 *buffer,
745 -+ unsigned long len)
746 -+{
747 -+ u16 filepathlength;
748 -+ int i, desclength = 0, namelen;
749 -+
750 -+ namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName));
751 -+
752 -+ /* Either "Boot" or "Driver" followed by four digits of hex */
753 -+ for (i = match; i < match+4; i++) {
754 -+ if (var->VariableName[i] > 127 ||
755 -+ hex_to_bin(var->VariableName[i] & 0xff) < 0)
756 -+ return true;
757 -+ }
758 -+
759 -+ /* Reject it if there's 4 digits of hex and then further content */
760 -+ if (namelen > match + 4)
761 -+ return false;
762 -+
763 -+ /* A valid entry must be at least 8 bytes */
764 -+ if (len < 8)
765 -+ return false;
766 -+
767 -+ filepathlength = buffer[4] | buffer[5] << 8;
768 -+
769 -+ /*
770 -+ * There's no stored length for the description, so it has to be
771 -+ * found by hand
772 -+ */
773 -+ desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2;
774 -+
775 -+ /* Each boot entry must have a descriptor */
776 -+ if (!desclength)
777 -+ return false;
778 -+
779 -+ /*
780 -+ * If the sum of the length of the description, the claimed filepath
781 -+ * length and the original header are greater than the length of the
782 -+ * variable, it's malformed
783 -+ */
784 -+ if ((desclength + filepathlength + 6) > len)
785 -+ return false;
786 -+
787 -+ /*
788 -+ * And, finally, check the filepath
789 -+ */
790 -+ return validate_device_path(var, match, buffer + desclength + 6,
791 -+ filepathlength);
792 -+}
793 -+
794 -+static bool
795 -+validate_uint16(struct efi_variable *var, int match, u8 *buffer,
796 -+ unsigned long len)
797 -+{
798 -+ /* A single 16-bit integer */
799 -+ if (len != 2)
800 -+ return false;
801 -+
802 -+ return true;
803 -+}
804 -+
805 -+static bool
806 -+validate_ascii_string(struct efi_variable *var, int match, u8 *buffer,
807 -+ unsigned long len)
808 -+{
809 -+ int i;
810 -+
811 -+ for (i = 0; i < len; i++) {
812 -+ if (buffer[i] > 127)
813 -+ return false;
814 -+
815 -+ if (buffer[i] == 0)
816 -+ return true;
817 -+ }
818 -+
819 -+ return false;
820 -+}
821 -+
822 -+struct variable_validate {
823 -+ char *name;
824 -+ bool (*validate)(struct efi_variable *var, int match, u8 *data,
825 -+ unsigned long len);
826 -+};
827 -+
828 -+static const struct variable_validate variable_validate[] = {
829 -+ { "BootNext", validate_uint16 },
830 -+ { "BootOrder", validate_boot_order },
831 -+ { "DriverOrder", validate_boot_order },
832 -+ { "Boot*", validate_load_option },
833 -+ { "Driver*", validate_load_option },
834 -+ { "ConIn", validate_device_path },
835 -+ { "ConInDev", validate_device_path },
836 -+ { "ConOut", validate_device_path },
837 -+ { "ConOutDev", validate_device_path },
838 -+ { "ErrOut", validate_device_path },
839 -+ { "ErrOutDev", validate_device_path },
840 -+ { "Timeout", validate_uint16 },
841 -+ { "Lang", validate_ascii_string },
842 -+ { "PlatformLang", validate_ascii_string },
843 -+ { "", NULL },
844 -+};
845 -+
846 -+static bool
847 -+validate_var(struct efi_variable *var, u8 *data, unsigned long len)
848 -+{
849 -+ int i;
850 -+ u16 *unicode_name = var->VariableName;
851 -+
852 -+ for (i = 0; variable_validate[i].validate != NULL; i++) {
853 -+ const char *name = variable_validate[i].name;
854 -+ int match;
855 -+
856 -+ for (match = 0; ; match++) {
857 -+ char c = name[match];
858 -+ u16 u = unicode_name[match];
859 -+
860 -+ /* All special variables are plain ascii */
861 -+ if (u > 127)
862 -+ return true;
863 -+
864 -+ /* Wildcard in the matching name means we've matched */
865 -+ if (c == '*')
866 -+ return variable_validate[i].validate(var,
867 -+ match, data, len);
868 -+
869 -+ /* Case sensitive match */
870 -+ if (c != u)
871 -+ break;
872 -+
873 -+ /* Reached the end of the string while matching */
874 -+ if (!c)
875 -+ return variable_validate[i].validate(var,
876 -+ match, data, len);
877 -+ }
878 -+ }
879 -+
880 -+ return true;
881 -+}
882 -+
883 - static efi_status_t
884 - get_var_data_locked(struct efivars *efivars, struct efi_variable *var)
885 - {
886 -@@ -324,6 +508,12 @@ efivar_store_raw(struct efivar_entry *entry, const char *buf, size_t count)
887 - return -EINVAL;
888 - }
889 -
890 -+ if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
891 -+ validate_var(new_var, new_var->Data, new_var->DataSize) == false) {
892 -+ printk(KERN_ERR "efivars: Malformed variable content\n");
893 -+ return -EINVAL;
894 -+ }
895 -+
896 - spin_lock(&efivars->lock);
897 - status = efivars->ops->set_variable(new_var->VariableName,
898 - &new_var->VendorGuid,
899 -@@ -624,6 +814,12 @@ static ssize_t efivar_create(struct file *filp, struct kobject *kobj,
900 - if (!capable(CAP_SYS_ADMIN))
901 - return -EACCES;
902 -
903 -+ if ((new_var->Attributes & ~EFI_VARIABLE_MASK) != 0 ||
904 -+ validate_var(new_var, new_var->Data, new_var->DataSize) == false) {
905 -+ printk(KERN_ERR "efivars: Malformed variable content\n");
906 -+ return -EINVAL;
907 -+ }
908 -+
909 - spin_lock(&efivars->lock);
910 -
911 - /*
912 -diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
913 -index b9da890..a6c2f7a 100644
914 ---- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
915 -+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
916 -@@ -984,6 +984,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
917 - struct intel_ring_buffer *ring;
918 - u32 exec_start, exec_len;
919 - u32 seqno;
920 -+ u32 mask;
921 - int ret, mode, i;
922 -
923 - if (!i915_gem_check_execbuffer(args)) {
924 -@@ -1021,6 +1022,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
925 - }
926 -
927 - mode = args->flags & I915_EXEC_CONSTANTS_MASK;
928 -+ mask = I915_EXEC_CONSTANTS_MASK;
929 - switch (mode) {
930 - case I915_EXEC_CONSTANTS_REL_GENERAL:
931 - case I915_EXEC_CONSTANTS_ABSOLUTE:
932 -@@ -1034,18 +1036,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
933 - mode == I915_EXEC_CONSTANTS_REL_SURFACE)
934 - return -EINVAL;
935 -
936 -- ret = intel_ring_begin(ring, 4);
937 -- if (ret)
938 -- return ret;
939 --
940 -- intel_ring_emit(ring, MI_NOOP);
941 -- intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
942 -- intel_ring_emit(ring, INSTPM);
943 -- intel_ring_emit(ring,
944 -- I915_EXEC_CONSTANTS_MASK << 16 | mode);
945 -- intel_ring_advance(ring);
946 --
947 -- dev_priv->relative_constants_mode = mode;
948 -+ /* The HW changed the meaning on this bit on gen6 */
949 -+ if (INTEL_INFO(dev)->gen >= 6)
950 -+ mask &= ~I915_EXEC_CONSTANTS_REL_SURFACE;
951 - }
952 - break;
953 - default:
954 -@@ -1064,6 +1057,11 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
955 - return -EINVAL;
956 - }
957 -
958 -+ if (args->num_cliprects > UINT_MAX / sizeof(*cliprects)) {
959 -+ DRM_DEBUG("execbuf with %u cliprects\n",
960 -+ args->num_cliprects);
961 -+ return -EINVAL;
962 -+ }
963 - cliprects = kmalloc(args->num_cliprects * sizeof(*cliprects),
964 - GFP_KERNEL);
965 - if (cliprects == NULL) {
966 -@@ -1176,6 +1174,21 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
967 - }
968 - }
969 -
970 -+ if (ring == &dev_priv->ring[RCS] &&
971 -+ mode != dev_priv->relative_constants_mode) {
972 -+ ret = intel_ring_begin(ring, 4);
973 -+ if (ret)
974 -+ goto err;
975 -+
976 -+ intel_ring_emit(ring, MI_NOOP);
977 -+ intel_ring_emit(ring, MI_LOAD_REGISTER_IMM(1));
978 -+ intel_ring_emit(ring, INSTPM);
979 -+ intel_ring_emit(ring, mask << 16 | mode);
980 -+ intel_ring_advance(ring);
981 -+
982 -+ dev_priv->relative_constants_mode = mode;
983 -+ }
984 -+
985 - trace_i915_gem_ring_dispatch(ring, seqno);
986 -
987 - exec_start = batch_obj->gtt_offset + args->batch_start_offset;
988 -@@ -1314,7 +1327,8 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
989 - struct drm_i915_gem_exec_object2 *exec2_list = NULL;
990 - int ret;
991 -
992 -- if (args->buffer_count < 1) {
993 -+ if (args->buffer_count < 1 ||
994 -+ args->buffer_count > UINT_MAX / sizeof(*exec2_list)) {
995 - DRM_ERROR("execbuf2 with %d buffers\n", args->buffer_count);
996 - return -EINVAL;
997 - }
998 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
999 -index 2f99fd4..cbe5a88 100644
1000 ---- a/drivers/gpu/drm/i915/i915_reg.h
1001 -+++ b/drivers/gpu/drm/i915/i915_reg.h
1002 -@@ -442,6 +442,7 @@
1003 - #define INSTPM_AGPBUSY_DIS (1<<11) /* gen3: when disabled, pending interrupts
1004 - will not assert AGPBUSY# and will only
1005 - be delivered when out of C3. */
1006 -+#define INSTPM_FORCE_ORDERING (1<<7) /* GEN6+ */
1007 - #define ACTHD 0x020c8
1008 - #define FW_BLC 0x020d8
1009 - #define FW_BLC2 0x020dc
1010 -@@ -522,6 +523,7 @@
1011 - #define CM0_MASK_SHIFT 16
1012 - #define CM0_IZ_OPT_DISABLE (1<<6)
1013 - #define CM0_ZR_OPT_DISABLE (1<<5)
1014 -+#define CM0_STC_EVICT_DISABLE_LRA_SNB (1<<5)
1015 - #define CM0_DEPTH_EVICT_DISABLE (1<<4)
1016 - #define CM0_COLOR_EVICT_DISABLE (1<<3)
1017 - #define CM0_DEPTH_WRITE_DISABLE (1<<1)
1018 -diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
1019 -index 64541f7..9cd81ba 100644
1020 ---- a/drivers/gpu/drm/i915/intel_hdmi.c
1021 -+++ b/drivers/gpu/drm/i915/intel_hdmi.c
1022 -@@ -136,7 +136,7 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder,
1023 -
1024 - val &= ~VIDEO_DIP_SELECT_MASK;
1025 -
1026 -- I915_WRITE(VIDEO_DIP_CTL, val | port | flags);
1027 -+ I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags);
1028 -
1029 - for (i = 0; i < len; i += 4) {
1030 - I915_WRITE(VIDEO_DIP_DATA, *data);
1031 -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
1032 -index 8673581..62f9ac5 100644
1033 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c
1034 -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
1035 -@@ -414,6 +414,22 @@ static int init_render_ring(struct intel_ring_buffer *ring)
1036 - return ret;
1037 - }
1038 -
1039 -+
1040 -+ if (IS_GEN6(dev)) {
1041 -+ /* From the Sandybridge PRM, volume 1 part 3, page 24:
1042 -+ * "If this bit is set, STCunit will have LRA as replacement
1043 -+ * policy. [...] This bit must be reset. LRA replacement
1044 -+ * policy is not supported."
1045 -+ */
1046 -+ I915_WRITE(CACHE_MODE_0,
1047 -+ CM0_STC_EVICT_DISABLE_LRA_SNB << CM0_MASK_SHIFT);
1048 -+ }
1049 -+
1050 -+ if (INTEL_INFO(dev)->gen >= 6) {
1051 -+ I915_WRITE(INSTPM,
1052 -+ INSTPM_FORCE_ORDERING << 16 | INSTPM_FORCE_ORDERING);
1053 -+ }
1054 -+
1055 - return ret;
1056 - }
1057 -
1058 -diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
1059 -index e334ec3..8eddcca 100644
1060 ---- a/drivers/gpu/drm/i915/intel_sdvo.c
1061 -+++ b/drivers/gpu/drm/i915/intel_sdvo.c
1062 -@@ -731,6 +731,7 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
1063 - uint16_t width, height;
1064 - uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
1065 - uint16_t h_sync_offset, v_sync_offset;
1066 -+ int mode_clock;
1067 -
1068 - width = mode->crtc_hdisplay;
1069 - height = mode->crtc_vdisplay;
1070 -@@ -745,7 +746,11 @@ static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
1071 - h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
1072 - v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
1073 -
1074 -- dtd->part1.clock = mode->clock / 10;
1075 -+ mode_clock = mode->clock;
1076 -+ mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1;
1077 -+ mode_clock /= 10;
1078 -+ dtd->part1.clock = mode_clock;
1079 -+
1080 - dtd->part1.h_active = width & 0xff;
1081 - dtd->part1.h_blank = h_blank_len & 0xff;
1082 - dtd->part1.h_high = (((width >> 8) & 0xf) << 4) |
1083 -@@ -997,7 +1002,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1084 - struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
1085 - u32 sdvox;
1086 - struct intel_sdvo_in_out_map in_out;
1087 -- struct intel_sdvo_dtd input_dtd;
1088 -+ struct intel_sdvo_dtd input_dtd, output_dtd;
1089 - int pixel_multiplier = intel_mode_get_pixel_multiplier(adjusted_mode);
1090 - int rate;
1091 -
1092 -@@ -1022,20 +1027,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1093 - intel_sdvo->attached_output))
1094 - return;
1095 -
1096 -- /* We have tried to get input timing in mode_fixup, and filled into
1097 -- * adjusted_mode.
1098 -- */
1099 -- if (intel_sdvo->is_tv || intel_sdvo->is_lvds) {
1100 -- input_dtd = intel_sdvo->input_dtd;
1101 -- } else {
1102 -- /* Set the output timing to the screen */
1103 -- if (!intel_sdvo_set_target_output(intel_sdvo,
1104 -- intel_sdvo->attached_output))
1105 -- return;
1106 --
1107 -- intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1108 -- (void) intel_sdvo_set_output_timing(intel_sdvo, &input_dtd);
1109 -- }
1110 -+ /* lvds has a special fixed output timing. */
1111 -+ if (intel_sdvo->is_lvds)
1112 -+ intel_sdvo_get_dtd_from_mode(&output_dtd,
1113 -+ intel_sdvo->sdvo_lvds_fixed_mode);
1114 -+ else
1115 -+ intel_sdvo_get_dtd_from_mode(&output_dtd, mode);
1116 -+ (void) intel_sdvo_set_output_timing(intel_sdvo, &output_dtd);
1117 -
1118 - /* Set the input timing to the screen. Assume always input 0. */
1119 - if (!intel_sdvo_set_target_input(intel_sdvo))
1120 -@@ -1053,6 +1051,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1121 - !intel_sdvo_set_tv_format(intel_sdvo))
1122 - return;
1123 -
1124 -+ /* We have tried to get input timing in mode_fixup, and filled into
1125 -+ * adjusted_mode.
1126 -+ */
1127 -+ intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1128 - (void) intel_sdvo_set_input_timing(intel_sdvo, &input_dtd);
1129 -
1130 - switch (pixel_multiplier) {
1131 -@@ -1219,8 +1221,14 @@ static bool intel_sdvo_get_capabilities(struct intel_sdvo *intel_sdvo, struct in
1132 -
1133 - static int intel_sdvo_supports_hotplug(struct intel_sdvo *intel_sdvo)
1134 - {
1135 -+ struct drm_device *dev = intel_sdvo->base.base.dev;
1136 - u8 response[2];
1137 -
1138 -+ /* HW Erratum: SDVO Hotplug is broken on all i945G chips, there's noise
1139 -+ * on the line. */
1140 -+ if (IS_I945G(dev) || IS_I945GM(dev))
1141 -+ return false;
1142 -+
1143 - return intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HOT_PLUG_SUPPORT,
1144 - &response, 2) && response[0];
1145 - }
1146 -diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
1147 -index 525744d..3df56c7 100644
1148 ---- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
1149 -+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
1150 -@@ -245,7 +245,7 @@ static bool nouveau_dsm_detect(void)
1151 - struct acpi_buffer buffer = {sizeof(acpi_method_name), acpi_method_name};
1152 - struct pci_dev *pdev = NULL;
1153 - int has_dsm = 0;
1154 -- int has_optimus;
1155 -+ int has_optimus = 0;
1156 - int vga_count = 0;
1157 - bool guid_valid;
1158 - int retval;
1159 -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
1160 -index b30081f..757c549 100644
1161 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c
1162 -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
1163 -@@ -917,8 +917,8 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
1164 - break;
1165 - }
1166 -
1167 -- if (radeon_encoder->active_device &
1168 -- (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) {
1169 -+ if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT | ATOM_DEVICE_DFP_SUPPORT)) ||
1170 -+ (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) {
1171 - struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
1172 - struct drm_connector *connector =
1173 - radeon_get_connector_for_encoder(encoder);
1174 -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
1175 -index 104b376..427468f 100644
1176 ---- a/drivers/hwmon/coretemp.c
1177 -+++ b/drivers/hwmon/coretemp.c
1178 -@@ -51,7 +51,7 @@ module_param_named(tjmax, force_tjmax, int, 0444);
1179 - MODULE_PARM_DESC(tjmax, "TjMax value in degrees Celsius");
1180 -
1181 - #define BASE_SYSFS_ATTR_NO 2 /* Sysfs Base attr no for coretemp */
1182 --#define NUM_REAL_CORES 16 /* Number of Real cores per cpu */
1183 -+#define NUM_REAL_CORES 32 /* Number of Real cores per cpu */
1184 - #define CORETEMP_NAME_LENGTH 17 /* String Length of attrs */
1185 - #define MAX_CORE_ATTRS 4 /* Maximum no of basic attrs */
1186 - #define TOTAL_ATTRS (MAX_CORE_ATTRS + 1)
1187 -@@ -705,6 +705,10 @@ static void __cpuinit put_core_offline(unsigned int cpu)
1188 -
1189 - indx = TO_ATTR_NO(cpu);
1190 -
1191 -+ /* The core id is too big, just return */
1192 -+ if (indx > MAX_CORE_DATA - 1)
1193 -+ return;
1194 -+
1195 - if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu)
1196 - coretemp_remove_core(pdata, &pdev->dev, indx);
1197 -
1198 -diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
1199 -index 930370d..9a4c3ab 100644
1200 ---- a/drivers/hwmon/fam15h_power.c
1201 -+++ b/drivers/hwmon/fam15h_power.c
1202 -@@ -122,6 +122,41 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
1203 - return true;
1204 - }
1205 -
1206 -+/*
1207 -+ * Newer BKDG versions have an updated recommendation on how to properly
1208 -+ * initialize the running average range (was: 0xE, now: 0x9). This avoids
1209 -+ * counter saturations resulting in bogus power readings.
1210 -+ * We correct this value ourselves to cope with older BIOSes.
1211 -+ */
1212 -+static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
1213 -+ { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
1214 -+ { 0 }
1215 -+};
1216 -+
1217 -+static void __devinit tweak_runavg_range(struct pci_dev *pdev)
1218 -+{
1219 -+ u32 val;
1220 -+
1221 -+ /*
1222 -+ * let this quirk apply only to the current version of the
1223 -+ * northbridge, since future versions may change the behavior
1224 -+ */
1225 -+ if (!pci_match_id(affected_device, pdev))
1226 -+ return;
1227 -+
1228 -+ pci_bus_read_config_dword(pdev->bus,
1229 -+ PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
1230 -+ REG_TDP_RUNNING_AVERAGE, &val);
1231 -+ if ((val & 0xf) != 0xe)
1232 -+ return;
1233 -+
1234 -+ val &= ~0xf;
1235 -+ val |= 0x9;
1236 -+ pci_bus_write_config_dword(pdev->bus,
1237 -+ PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
1238 -+ REG_TDP_RUNNING_AVERAGE, val);
1239 -+}
1240 -+
1241 - static void __devinit fam15h_power_init_data(struct pci_dev *f4,
1242 - struct fam15h_power_data *data)
1243 - {
1244 -@@ -155,6 +190,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev,
1245 - struct device *dev;
1246 - int err;
1247 -
1248 -+ /*
1249 -+ * though we ignore every other northbridge, we still have to
1250 -+ * do the tweaking on _each_ node in MCM processors as the counters
1251 -+ * are working hand-in-hand
1252 -+ */
1253 -+ tweak_runavg_range(pdev);
1254 -+
1255 - if (!fam15h_power_is_internal_node0(pdev)) {
1256 - err = -ENODEV;
1257 - goto exit;
1258 -diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
1259 -index 04be9f8..eb8ad53 100644
1260 ---- a/drivers/i2c/busses/i2c-pnx.c
1261 -+++ b/drivers/i2c/busses/i2c-pnx.c
1262 -@@ -546,8 +546,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev,
1263 - {
1264 - struct i2c_pnx_algo_data *alg_data = platform_get_drvdata(pdev);
1265 -
1266 -- /* FIXME: shouldn't this be clk_disable? */
1267 -- clk_enable(alg_data->clk);
1268 -+ clk_disable(alg_data->clk);
1269 -
1270 - return 0;
1271 - }
1272 -diff --git a/drivers/md/md.c b/drivers/md/md.c
1273 -index 6f37aa4..065ab4f 100644
1274 ---- a/drivers/md/md.c
1275 -+++ b/drivers/md/md.c
1276 -@@ -8100,7 +8100,8 @@ static int md_notify_reboot(struct notifier_block *this,
1277 -
1278 - for_each_mddev(mddev, tmp) {
1279 - if (mddev_trylock(mddev)) {
1280 -- __md_stop_writes(mddev);
1281 -+ if (mddev->pers)
1282 -+ __md_stop_writes(mddev);
1283 - mddev->safemode = 2;
1284 - mddev_unlock(mddev);
1285 - }
1286 -diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
1287 -index f6431ef..a1f5e3d 100644
1288 ---- a/drivers/media/dvb/frontends/drxk_hard.c
1289 -+++ b/drivers/media/dvb/frontends/drxk_hard.c
1290 -@@ -1523,8 +1523,10 @@ static int scu_command(struct drxk_state *state,
1291 - dprintk(1, "\n");
1292 -
1293 - if ((cmd == 0) || ((parameterLen > 0) && (parameter == NULL)) ||
1294 -- ((resultLen > 0) && (result == NULL)))
1295 -- goto error;
1296 -+ ((resultLen > 0) && (result == NULL))) {
1297 -+ printk(KERN_ERR "drxk: Error %d on %s\n", status, __func__);
1298 -+ return status;
1299 -+ }
1300 -
1301 - mutex_lock(&state->mutex);
1302 -
1303 -diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
1304 -index 13f54b5..a7e7d6f 100644
1305 ---- a/drivers/media/rc/winbond-cir.c
1306 -+++ b/drivers/media/rc/winbond-cir.c
1307 -@@ -1046,6 +1046,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1308 - goto exit_unregister_led;
1309 - }
1310 -
1311 -+ data->dev->driver_type = RC_DRIVER_IR_RAW;
1312 - data->dev->driver_name = WBCIR_NAME;
1313 - data->dev->input_name = WBCIR_NAME;
1314 - data->dev->input_phys = "wbcir/cir0";
1315 -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
1316 -index e15e47d..34416d4 100644
1317 ---- a/drivers/mmc/card/block.c
1318 -+++ b/drivers/mmc/card/block.c
1319 -@@ -799,7 +799,7 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
1320 - {
1321 - struct mmc_blk_data *md = mq->data;
1322 - struct mmc_card *card = md->queue.card;
1323 -- unsigned int from, nr, arg;
1324 -+ unsigned int from, nr, arg, trim_arg, erase_arg;
1325 - int err = 0, type = MMC_BLK_SECDISCARD;
1326 -
1327 - if (!(mmc_can_secure_erase_trim(card) || mmc_can_sanitize(card))) {
1328 -@@ -807,20 +807,26 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
1329 - goto out;
1330 - }
1331 -
1332 -+ from = blk_rq_pos(req);
1333 -+ nr = blk_rq_sectors(req);
1334 -+
1335 - /* The sanitize operation is supported at v4.5 only */
1336 - if (mmc_can_sanitize(card)) {
1337 -- err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1338 -- EXT_CSD_SANITIZE_START, 1, 0);
1339 -- goto out;
1340 -+ erase_arg = MMC_ERASE_ARG;
1341 -+ trim_arg = MMC_TRIM_ARG;
1342 -+ } else {
1343 -+ erase_arg = MMC_SECURE_ERASE_ARG;
1344 -+ trim_arg = MMC_SECURE_TRIM1_ARG;
1345 - }
1346 -
1347 -- from = blk_rq_pos(req);
1348 -- nr = blk_rq_sectors(req);
1349 --
1350 -- if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr))
1351 -- arg = MMC_SECURE_TRIM1_ARG;
1352 -- else
1353 -- arg = MMC_SECURE_ERASE_ARG;
1354 -+ if (mmc_erase_group_aligned(card, from, nr))
1355 -+ arg = erase_arg;
1356 -+ else if (mmc_can_trim(card))
1357 -+ arg = trim_arg;
1358 -+ else {
1359 -+ err = -EINVAL;
1360 -+ goto out;
1361 -+ }
1362 - retry:
1363 - if (card->quirks & MMC_QUIRK_INAND_CMD38) {
1364 - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1365 -@@ -830,25 +836,41 @@ retry:
1366 - INAND_CMD38_ARG_SECERASE,
1367 - 0);
1368 - if (err)
1369 -- goto out;
1370 -+ goto out_retry;
1371 - }
1372 -+
1373 - err = mmc_erase(card, from, nr, arg);
1374 -- if (!err && arg == MMC_SECURE_TRIM1_ARG) {
1375 -+ if (err == -EIO)
1376 -+ goto out_retry;
1377 -+ if (err)
1378 -+ goto out;
1379 -+
1380 -+ if (arg == MMC_SECURE_TRIM1_ARG) {
1381 - if (card->quirks & MMC_QUIRK_INAND_CMD38) {
1382 - err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1383 - INAND_CMD38_ARG_EXT_CSD,
1384 - INAND_CMD38_ARG_SECTRIM2,
1385 - 0);
1386 - if (err)
1387 -- goto out;
1388 -+ goto out_retry;
1389 - }
1390 -+
1391 - err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
1392 -+ if (err == -EIO)
1393 -+ goto out_retry;
1394 -+ if (err)
1395 -+ goto out;
1396 - }
1397 --out:
1398 -- if (err == -EIO && !mmc_blk_reset(md, card->host, type))
1399 -+
1400 -+ if (mmc_can_sanitize(card))
1401 -+ err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
1402 -+ EXT_CSD_SANITIZE_START, 1, 0);
1403 -+out_retry:
1404 -+ if (err && !mmc_blk_reset(md, card->host, type))
1405 - goto retry;
1406 - if (!err)
1407 - mmc_blk_reset_success(md, type);
1408 -+out:
1409 - spin_lock_irq(&md->lock);
1410 - __blk_end_request(req, err, blk_rq_bytes(req));
1411 - spin_unlock_irq(&md->lock);
1412 -diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
1413 -index dcad59c..78690f2 100644
1414 ---- a/drivers/mmc/card/queue.c
1415 -+++ b/drivers/mmc/card/queue.c
1416 -@@ -134,7 +134,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
1417 -
1418 - queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
1419 - q->limits.max_discard_sectors = max_discard;
1420 -- if (card->erased_byte == 0)
1421 -+ if (card->erased_byte == 0 && !mmc_can_discard(card))
1422 - q->limits.discard_zeroes_data = 1;
1423 - q->limits.discard_granularity = card->pref_erase << 9;
1424 - /* granularity must not be greater than max. discard */
1425 -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
1426 -index 950b97d..411a994 100644
1427 ---- a/drivers/mmc/core/core.c
1428 -+++ b/drivers/mmc/core/core.c
1429 -@@ -1516,7 +1516,10 @@ static unsigned int mmc_mmc_erase_timeout(struct mmc_card *card,
1430 - {
1431 - unsigned int erase_timeout;
1432 -
1433 -- if (card->ext_csd.erase_group_def & 1) {
1434 -+ if (arg == MMC_DISCARD_ARG ||
1435 -+ (arg == MMC_TRIM_ARG && card->ext_csd.rev >= 6)) {
1436 -+ erase_timeout = card->ext_csd.trim_timeout;
1437 -+ } else if (card->ext_csd.erase_group_def & 1) {
1438 - /* High Capacity Erase Group Size uses HC timeouts */
1439 - if (arg == MMC_TRIM_ARG)
1440 - erase_timeout = card->ext_csd.trim_timeout;
1441 -@@ -1788,8 +1791,6 @@ int mmc_can_trim(struct mmc_card *card)
1442 - {
1443 - if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN)
1444 - return 1;
1445 -- if (mmc_can_discard(card))
1446 -- return 1;
1447 - return 0;
1448 - }
1449 - EXPORT_SYMBOL(mmc_can_trim);
1450 -@@ -1808,6 +1809,8 @@ EXPORT_SYMBOL(mmc_can_discard);
1451 -
1452 - int mmc_can_sanitize(struct mmc_card *card)
1453 - {
1454 -+ if (!mmc_can_trim(card) && !mmc_can_erase(card))
1455 -+ return 0;
1456 - if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)
1457 - return 1;
1458 - return 0;
1459 -diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
1460 -index 4540e37..1b47937 100644
1461 ---- a/drivers/mmc/host/sdhci-esdhc-imx.c
1462 -+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
1463 -@@ -467,8 +467,7 @@ static int __devinit sdhci_esdhc_imx_probe(struct platform_device *pdev)
1464 - clk_enable(clk);
1465 - pltfm_host->clk = clk;
1466 -
1467 -- if (!is_imx25_esdhc(imx_data))
1468 -- host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
1469 -+ host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
1470 -
1471 - if (is_imx25_esdhc(imx_data) || is_imx35_esdhc(imx_data))
1472 - /* Fix errata ENGcm07207 present on i.MX25 and i.MX35 */
1473 -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1474 -index e58aa2b..f65e0b9 100644
1475 ---- a/drivers/net/bonding/bond_main.c
1476 -+++ b/drivers/net/bonding/bond_main.c
1477 -@@ -2982,7 +2982,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks)
1478 - trans_start + delta_in_ticks)) ||
1479 - bond->curr_active_slave != slave) {
1480 - slave->link = BOND_LINK_UP;
1481 -- bond->current_arp_slave = NULL;
1482 -+ if (bond->current_arp_slave) {
1483 -+ bond_set_slave_inactive_flags(
1484 -+ bond->current_arp_slave);
1485 -+ bond->current_arp_slave = NULL;
1486 -+ }
1487 -
1488 - pr_info("%s: link status definitely up for interface %s.\n",
1489 - bond->dev->name, slave->dev->name);
1490 -diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
1491 -index a7c5e88..eeac9ca 100644
1492 ---- a/drivers/net/dummy.c
1493 -+++ b/drivers/net/dummy.c
1494 -@@ -106,14 +106,14 @@ static int dummy_dev_init(struct net_device *dev)
1495 - return 0;
1496 - }
1497 -
1498 --static void dummy_dev_free(struct net_device *dev)
1499 -+static void dummy_dev_uninit(struct net_device *dev)
1500 - {
1501 - free_percpu(dev->dstats);
1502 -- free_netdev(dev);
1503 - }
1504 -
1505 - static const struct net_device_ops dummy_netdev_ops = {
1506 - .ndo_init = dummy_dev_init,
1507 -+ .ndo_uninit = dummy_dev_uninit,
1508 - .ndo_start_xmit = dummy_xmit,
1509 - .ndo_validate_addr = eth_validate_addr,
1510 - .ndo_set_rx_mode = set_multicast_list,
1511 -@@ -127,7 +127,7 @@ static void dummy_setup(struct net_device *dev)
1512 -
1513 - /* Initialize the device structure. */
1514 - dev->netdev_ops = &dummy_netdev_ops;
1515 -- dev->destructor = dummy_dev_free;
1516 -+ dev->destructor = free_netdev;
1517 -
1518 - /* Fill in device structure with ethernet-generic values. */
1519 - dev->tx_queue_len = 0;
1520 -diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
1521 -index 33a4e35..ee532e1 100644
1522 ---- a/drivers/net/ethernet/atheros/atlx/atl1.c
1523 -+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
1524 -@@ -2473,7 +2473,7 @@ static irqreturn_t atl1_intr(int irq, void *data)
1525 - "pcie phy link down %x\n", status);
1526 - if (netif_running(adapter->netdev)) { /* reset MAC */
1527 - iowrite32(0, adapter->hw.hw_addr + REG_IMR);
1528 -- schedule_work(&adapter->pcie_dma_to_rst_task);
1529 -+ schedule_work(&adapter->reset_dev_task);
1530 - return IRQ_HANDLED;
1531 - }
1532 - }
1533 -@@ -2485,7 +2485,7 @@ static irqreturn_t atl1_intr(int irq, void *data)
1534 - "pcie DMA r/w error (status = 0x%x)\n",
1535 - status);
1536 - iowrite32(0, adapter->hw.hw_addr + REG_IMR);
1537 -- schedule_work(&adapter->pcie_dma_to_rst_task);
1538 -+ schedule_work(&adapter->reset_dev_task);
1539 - return IRQ_HANDLED;
1540 - }
1541 -
1542 -@@ -2630,10 +2630,10 @@ static void atl1_down(struct atl1_adapter *adapter)
1543 - atl1_clean_rx_ring(adapter);
1544 - }
1545 -
1546 --static void atl1_tx_timeout_task(struct work_struct *work)
1547 -+static void atl1_reset_dev_task(struct work_struct *work)
1548 - {
1549 - struct atl1_adapter *adapter =
1550 -- container_of(work, struct atl1_adapter, tx_timeout_task);
1551 -+ container_of(work, struct atl1_adapter, reset_dev_task);
1552 - struct net_device *netdev = adapter->netdev;
1553 -
1554 - netif_device_detach(netdev);
1555 -@@ -3032,12 +3032,10 @@ static int __devinit atl1_probe(struct pci_dev *pdev,
1556 - (unsigned long)adapter);
1557 - adapter->phy_timer_pending = false;
1558 -
1559 -- INIT_WORK(&adapter->tx_timeout_task, atl1_tx_timeout_task);
1560 -+ INIT_WORK(&adapter->reset_dev_task, atl1_reset_dev_task);
1561 -
1562 - INIT_WORK(&adapter->link_chg_task, atlx_link_chg_task);
1563 -
1564 -- INIT_WORK(&adapter->pcie_dma_to_rst_task, atl1_tx_timeout_task);
1565 --
1566 - err = register_netdev(netdev);
1567 - if (err)
1568 - goto err_common;
1569 -diff --git a/drivers/net/ethernet/atheros/atlx/atl1.h b/drivers/net/ethernet/atheros/atlx/atl1.h
1570 -index 109d6da..e04bf4d 100644
1571 ---- a/drivers/net/ethernet/atheros/atlx/atl1.h
1572 -+++ b/drivers/net/ethernet/atheros/atlx/atl1.h
1573 -@@ -758,9 +758,8 @@ struct atl1_adapter {
1574 - u16 link_speed;
1575 - u16 link_duplex;
1576 - spinlock_t lock;
1577 -- struct work_struct tx_timeout_task;
1578 -+ struct work_struct reset_dev_task;
1579 - struct work_struct link_chg_task;
1580 -- struct work_struct pcie_dma_to_rst_task;
1581 -
1582 - struct timer_list phy_config_timer;
1583 - bool phy_timer_pending;
1584 -diff --git a/drivers/net/ethernet/atheros/atlx/atlx.c b/drivers/net/ethernet/atheros/atlx/atlx.c
1585 -index aabcf4b..41c6d83 100644
1586 ---- a/drivers/net/ethernet/atheros/atlx/atlx.c
1587 -+++ b/drivers/net/ethernet/atheros/atlx/atlx.c
1588 -@@ -193,7 +193,7 @@ static void atlx_tx_timeout(struct net_device *netdev)
1589 - {
1590 - struct atlx_adapter *adapter = netdev_priv(netdev);
1591 - /* Do the reset outside of interrupt context */
1592 -- schedule_work(&adapter->tx_timeout_task);
1593 -+ schedule_work(&adapter->reset_dev_task);
1594 - }
1595 -
1596 - /*
1597 -diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
1598 -index d19c849..77241b6 100644
1599 ---- a/drivers/net/ethernet/micrel/ks8851_mll.c
1600 -+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
1601 -@@ -40,7 +40,7 @@
1602 - #define DRV_NAME "ks8851_mll"
1603 -
1604 - static u8 KS_DEFAULT_MAC_ADDRESS[] = { 0x00, 0x10, 0xA1, 0x86, 0x95, 0x11 };
1605 --#define MAX_RECV_FRAMES 32
1606 -+#define MAX_RECV_FRAMES 255
1607 - #define MAX_BUF_SIZE 2048
1608 - #define TX_BUF_SIZE 2000
1609 - #define RX_BUF_SIZE 2000
1610 -diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
1611 -index 7ece990..4b9f4bd 100644
1612 ---- a/drivers/net/ethernet/micrel/ksz884x.c
1613 -+++ b/drivers/net/ethernet/micrel/ksz884x.c
1614 -@@ -5679,7 +5679,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
1615 - memcpy(hw->override_addr, mac->sa_data, MAC_ADDR_LEN);
1616 - }
1617 -
1618 -- memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN);
1619 -+ memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);
1620 -
1621 - interrupt = hw_block_intr(hw);
1622 -
1623 -diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
1624 -index aba4f67..8f47907 100644
1625 ---- a/drivers/net/ethernet/realtek/8139cp.c
1626 -+++ b/drivers/net/ethernet/realtek/8139cp.c
1627 -@@ -961,6 +961,11 @@ static inline void cp_start_hw (struct cp_private *cp)
1628 - cpw8(Cmd, RxOn | TxOn);
1629 - }
1630 -
1631 -+static void cp_enable_irq(struct cp_private *cp)
1632 -+{
1633 -+ cpw16_f(IntrMask, cp_intr_mask);
1634 -+}
1635 -+
1636 - static void cp_init_hw (struct cp_private *cp)
1637 - {
1638 - struct net_device *dev = cp->dev;
1639 -@@ -1000,8 +1005,6 @@ static void cp_init_hw (struct cp_private *cp)
1640 -
1641 - cpw16(MultiIntr, 0);
1642 -
1643 -- cpw16_f(IntrMask, cp_intr_mask);
1644 --
1645 - cpw8_f(Cfg9346, Cfg9346_Lock);
1646 - }
1647 -
1648 -@@ -1133,6 +1136,8 @@ static int cp_open (struct net_device *dev)
1649 - if (rc)
1650 - goto err_out_hw;
1651 -
1652 -+ cp_enable_irq(cp);
1653 -+
1654 - netif_carrier_off(dev);
1655 - mii_check_media(&cp->mii_if, netif_msg_link(cp), true);
1656 - netif_start_queue(dev);
1657 -@@ -2034,6 +2039,7 @@ static int cp_resume (struct pci_dev *pdev)
1658 - /* FIXME: sh*t may happen if the Rx ring buffer is depleted */
1659 - cp_init_rings_index (cp);
1660 - cp_init_hw (cp);
1661 -+ cp_enable_irq(cp);
1662 - netif_start_queue (dev);
1663 -
1664 - spin_lock_irqsave (&cp->lock, flags);
1665 -diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
1666 -index 8843071..8c7dd21 100644
1667 ---- a/drivers/net/ethernet/smsc/smsc911x.c
1668 -+++ b/drivers/net/ethernet/smsc/smsc911x.c
1669 -@@ -1089,10 +1089,8 @@ smsc911x_rx_counterrors(struct net_device *dev, unsigned int rxstat)
1670 -
1671 - /* Quickly dumps bad packets */
1672 - static void
1673 --smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktbytes)
1674 -+smsc911x_rx_fastforward(struct smsc911x_data *pdata, unsigned int pktwords)
1675 - {
1676 -- unsigned int pktwords = (pktbytes + NET_IP_ALIGN + 3) >> 2;
1677 --
1678 - if (likely(pktwords >= 4)) {
1679 - unsigned int timeout = 500;
1680 - unsigned int val;
1681 -@@ -1156,7 +1154,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1682 - continue;
1683 - }
1684 -
1685 -- skb = netdev_alloc_skb(dev, pktlength + NET_IP_ALIGN);
1686 -+ skb = netdev_alloc_skb(dev, pktwords << 2);
1687 - if (unlikely(!skb)) {
1688 - SMSC_WARN(pdata, rx_err,
1689 - "Unable to allocate skb for rx packet");
1690 -@@ -1166,14 +1164,12 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
1691 - break;
1692 - }
1693 -
1694 -- skb->data = skb->head;
1695 -- skb_reset_tail_pointer(skb);
1696 -+ pdata->ops->rx_readfifo(pdata,
1697 -+ (unsigned int *)skb->data, pktwords);
1698 -
1699 - /* Align IP on 16B boundary */
1700 - skb_reserve(skb, NET_IP_ALIGN);
1701 - skb_put(skb, pktlength - 4);
1702 -- pdata->ops->rx_readfifo(pdata,
1703 -- (unsigned int *)skb->head, pktwords);
1704 - skb->protocol = eth_type_trans(skb, dev);
1705 - skb_checksum_none_assert(skb);
1706 - netif_receive_skb(skb);
1707 -@@ -1396,7 +1392,7 @@ static int smsc911x_open(struct net_device *dev)
1708 - smsc911x_reg_write(pdata, FIFO_INT, temp);
1709 -
1710 - /* set RX Data offset to 2 bytes for alignment */
1711 -- smsc911x_reg_write(pdata, RX_CFG, (2 << 8));
1712 -+ smsc911x_reg_write(pdata, RX_CFG, (NET_IP_ALIGN << 8));
1713 -
1714 - /* enable NAPI polling before enabling RX interrupts */
1715 - napi_enable(&pdata->napi);
1716 -diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
1717 -index 7615040..f470ab6 100644
1718 ---- a/drivers/net/ethernet/ti/davinci_mdio.c
1719 -+++ b/drivers/net/ethernet/ti/davinci_mdio.c
1720 -@@ -181,6 +181,11 @@ static inline int wait_for_user_access(struct davinci_mdio_data *data)
1721 - __davinci_mdio_reset(data);
1722 - return -EAGAIN;
1723 - }
1724 -+
1725 -+ reg = __raw_readl(&regs->user[0].access);
1726 -+ if ((reg & USERACCESS_GO) == 0)
1727 -+ return 0;
1728 -+
1729 - dev_err(data->dev, "timed out waiting for user access\n");
1730 - return -ETIMEDOUT;
1731 - }
1732 -diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
1733 -index 486b404..3ed983c 100644
1734 ---- a/drivers/net/ppp/ppp_generic.c
1735 -+++ b/drivers/net/ppp/ppp_generic.c
1736 -@@ -968,7 +968,6 @@ ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
1737 - proto = npindex_to_proto[npi];
1738 - put_unaligned_be16(proto, pp);
1739 -
1740 -- netif_stop_queue(dev);
1741 - skb_queue_tail(&ppp->file.xq, skb);
1742 - ppp_xmit_process(ppp);
1743 - return NETDEV_TX_OK;
1744 -@@ -1063,6 +1062,8 @@ ppp_xmit_process(struct ppp *ppp)
1745 - code that we can accept some more. */
1746 - if (!ppp->xmit_pending && !skb_peek(&ppp->file.xq))
1747 - netif_wake_queue(ppp->dev);
1748 -+ else
1749 -+ netif_stop_queue(ppp->dev);
1750 - }
1751 - ppp_xmit_unlock(ppp);
1752 - }
1753 -diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
1754 -index a5b9b12..7bd219b 100644
1755 ---- a/drivers/net/usb/smsc75xx.c
1756 -+++ b/drivers/net/usb/smsc75xx.c
1757 -@@ -1050,6 +1050,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
1758 - dev->net->ethtool_ops = &smsc75xx_ethtool_ops;
1759 - dev->net->flags |= IFF_MULTICAST;
1760 - dev->net->hard_header_len += SMSC75XX_TX_OVERHEAD;
1761 -+ dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
1762 - return 0;
1763 - }
1764 -
1765 -diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
1766 -index eff6767..55b3218 100644
1767 ---- a/drivers/net/usb/smsc95xx.c
1768 -+++ b/drivers/net/usb/smsc95xx.c
1769 -@@ -1190,7 +1190,7 @@ static const struct driver_info smsc95xx_info = {
1770 - .rx_fixup = smsc95xx_rx_fixup,
1771 - .tx_fixup = smsc95xx_tx_fixup,
1772 - .status = smsc95xx_status,
1773 -- .flags = FLAG_ETHER | FLAG_SEND_ZLP,
1774 -+ .flags = FLAG_ETHER | FLAG_SEND_ZLP | FLAG_LINK_INTR,
1775 - };
1776 -
1777 - static const struct usb_device_id products[] = {
1778 -diff --git a/drivers/net/wimax/i2400m/netdev.c b/drivers/net/wimax/i2400m/netdev.c
1779 -index 64a1106..4697cf3 100644
1780 ---- a/drivers/net/wimax/i2400m/netdev.c
1781 -+++ b/drivers/net/wimax/i2400m/netdev.c
1782 -@@ -607,7 +607,8 @@ static void i2400m_get_drvinfo(struct net_device *net_dev,
1783 - struct i2400m *i2400m = net_dev_to_i2400m(net_dev);
1784 -
1785 - strncpy(info->driver, KBUILD_MODNAME, sizeof(info->driver) - 1);
1786 -- strncpy(info->fw_version, i2400m->fw_name, sizeof(info->fw_version) - 1);
1787 -+ strncpy(info->fw_version,
1788 -+ i2400m->fw_name ? : "", sizeof(info->fw_version) - 1);
1789 - if (net_dev->dev.parent)
1790 - strncpy(info->bus_info, dev_name(net_dev->dev.parent),
1791 - sizeof(info->bus_info) - 1);
1792 -diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
1793 -index 5634d9a..680709c 100644
1794 ---- a/drivers/net/wireless/b43/main.c
1795 -+++ b/drivers/net/wireless/b43/main.c
1796 -@@ -4820,8 +4820,14 @@ static int b43_op_start(struct ieee80211_hw *hw)
1797 - out_mutex_unlock:
1798 - mutex_unlock(&wl->mutex);
1799 -
1800 -- /* reload configuration */
1801 -- b43_op_config(hw, ~0);
1802 -+ /*
1803 -+ * Configuration may have been overwritten during initialization.
1804 -+ * Reload the configuration, but only if initialization was
1805 -+ * successful. Reloading the configuration after a failed init
1806 -+ * may hang the system.
1807 -+ */
1808 -+ if (!err)
1809 -+ b43_op_config(hw, ~0);
1810 -
1811 - return err;
1812 - }
1813 -diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
1814 -index 453f58e..f98becc 100644
1815 ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
1816 -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
1817 -@@ -7865,6 +7865,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
1818 - {
1819 - int len_mpdu;
1820 - struct ieee80211_rx_status rx_status;
1821 -+ struct ieee80211_hdr *hdr;
1822 -
1823 - memset(&rx_status, 0, sizeof(rx_status));
1824 - prep_mac80211_status(wlc, rxh, p, &rx_status);
1825 -@@ -7874,6 +7875,13 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
1826 - skb_pull(p, D11_PHY_HDR_LEN);
1827 - __skb_trim(p, len_mpdu);
1828 -
1829 -+ /* unmute transmit */
1830 -+ if (wlc->hw->suspended_fifos) {
1831 -+ hdr = (struct ieee80211_hdr *)p->data;
1832 -+ if (ieee80211_is_beacon(hdr->frame_control))
1833 -+ brcms_b_mute(wlc->hw, false);
1834 -+ }
1835 -+
1836 - memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
1837 - ieee80211_rx_irqsafe(wlc->pub->ieee_hw, p);
1838 - }
1839 -diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
1840 -index 99a710d..827889b 100644
1841 ---- a/drivers/net/wireless/ipw2x00/ipw2200.c
1842 -+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
1843 -@@ -2183,6 +2183,7 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1844 - {
1845 - int rc = 0;
1846 - unsigned long flags;
1847 -+ unsigned long now, end;
1848 -
1849 - spin_lock_irqsave(&priv->lock, flags);
1850 - if (priv->status & STATUS_HCMD_ACTIVE) {
1851 -@@ -2224,10 +2225,20 @@ static int __ipw_send_cmd(struct ipw_priv *priv, struct host_cmd *cmd)
1852 - }
1853 - spin_unlock_irqrestore(&priv->lock, flags);
1854 -
1855 -+ now = jiffies;
1856 -+ end = now + HOST_COMPLETE_TIMEOUT;
1857 -+again:
1858 - rc = wait_event_interruptible_timeout(priv->wait_command_queue,
1859 - !(priv->
1860 - status & STATUS_HCMD_ACTIVE),
1861 -- HOST_COMPLETE_TIMEOUT);
1862 -+ end - now);
1863 -+ if (rc < 0) {
1864 -+ now = jiffies;
1865 -+ if (time_before(now, end))
1866 -+ goto again;
1867 -+ rc = 0;
1868 -+ }
1869 -+
1870 - if (rc == 0) {
1871 - spin_lock_irqsave(&priv->lock, flags);
1872 - if (priv->status & STATUS_HCMD_ACTIVE) {
1873 -diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c
1874 -index dd008b0..1e6c8cc 100644
1875 ---- a/drivers/net/wireless/iwlwifi/iwl-1000.c
1876 -+++ b/drivers/net/wireless/iwlwifi/iwl-1000.c
1877 -@@ -45,8 +45,8 @@
1878 - #include "iwl-cfg.h"
1879 -
1880 - /* Highest firmware API version supported */
1881 --#define IWL1000_UCODE_API_MAX 6
1882 --#define IWL100_UCODE_API_MAX 6
1883 -+#define IWL1000_UCODE_API_MAX 5
1884 -+#define IWL100_UCODE_API_MAX 5
1885 -
1886 - /* Oldest version we won't warn about */
1887 - #define IWL1000_UCODE_API_OK 5
1888 -@@ -244,5 +244,5 @@ struct iwl_cfg iwl100_bg_cfg = {
1889 - IWL_DEVICE_100,
1890 - };
1891 -
1892 --MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_MAX));
1893 --MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_MAX));
1894 -+MODULE_FIRMWARE(IWL1000_MODULE_FIRMWARE(IWL1000_UCODE_API_OK));
1895 -+MODULE_FIRMWARE(IWL100_MODULE_FIRMWARE(IWL100_UCODE_API_OK));
1896 -diff --git a/drivers/net/wireless/iwlwifi/iwl-2000.c b/drivers/net/wireless/iwlwifi/iwl-2000.c
1897 -index 7943197..9823e41 100644
1898 ---- a/drivers/net/wireless/iwlwifi/iwl-2000.c
1899 -+++ b/drivers/net/wireless/iwlwifi/iwl-2000.c
1900 -@@ -51,10 +51,10 @@
1901 - #define IWL135_UCODE_API_MAX 6
1902 -
1903 - /* Oldest version we won't warn about */
1904 --#define IWL2030_UCODE_API_OK 5
1905 --#define IWL2000_UCODE_API_OK 5
1906 --#define IWL105_UCODE_API_OK 5
1907 --#define IWL135_UCODE_API_OK 5
1908 -+#define IWL2030_UCODE_API_OK 6
1909 -+#define IWL2000_UCODE_API_OK 6
1910 -+#define IWL105_UCODE_API_OK 6
1911 -+#define IWL135_UCODE_API_OK 6
1912 -
1913 - /* Lowest firmware API version supported */
1914 - #define IWL2030_UCODE_API_MIN 5
1915 -@@ -372,7 +372,7 @@ struct iwl_cfg iwl135_bgn_cfg = {
1916 - .ht_params = &iwl2000_ht_params,
1917 - };
1918 -
1919 --MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_MAX));
1920 --MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_MAX));
1921 --MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_MAX));
1922 --MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_MAX));
1923 -+MODULE_FIRMWARE(IWL2000_MODULE_FIRMWARE(IWL2000_UCODE_API_OK));
1924 -+MODULE_FIRMWARE(IWL2030_MODULE_FIRMWARE(IWL2030_UCODE_API_OK));
1925 -+MODULE_FIRMWARE(IWL105_MODULE_FIRMWARE(IWL105_UCODE_API_OK));
1926 -+MODULE_FIRMWARE(IWL135_MODULE_FIRMWARE(IWL135_UCODE_API_OK));
1927 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
1928 -index f55fb2d..606213f 100644
1929 ---- a/drivers/net/wireless/iwlwifi/iwl-5000.c
1930 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
1931 -@@ -50,6 +50,10 @@
1932 - #define IWL5000_UCODE_API_MAX 5
1933 - #define IWL5150_UCODE_API_MAX 2
1934 -
1935 -+/* Oldest version we won't warn about */
1936 -+#define IWL5000_UCODE_API_OK 5
1937 -+#define IWL5150_UCODE_API_OK 2
1938 -+
1939 - /* Lowest firmware API version supported */
1940 - #define IWL5000_UCODE_API_MIN 1
1941 - #define IWL5150_UCODE_API_MIN 1
1942 -@@ -373,6 +377,7 @@ static struct iwl_ht_params iwl5000_ht_params = {
1943 - #define IWL_DEVICE_5000 \
1944 - .fw_name_pre = IWL5000_FW_PRE, \
1945 - .ucode_api_max = IWL5000_UCODE_API_MAX, \
1946 -+ .ucode_api_ok = IWL5000_UCODE_API_OK, \
1947 - .ucode_api_min = IWL5000_UCODE_API_MIN, \
1948 - .eeprom_ver = EEPROM_5000_EEPROM_VERSION, \
1949 - .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, \
1950 -@@ -416,6 +421,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
1951 - .name = "Intel(R) WiMAX/WiFi Link 5350 AGN",
1952 - .fw_name_pre = IWL5000_FW_PRE,
1953 - .ucode_api_max = IWL5000_UCODE_API_MAX,
1954 -+ .ucode_api_ok = IWL5000_UCODE_API_OK,
1955 - .ucode_api_min = IWL5000_UCODE_API_MIN,
1956 - .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
1957 - .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
1958 -@@ -429,6 +435,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
1959 - #define IWL_DEVICE_5150 \
1960 - .fw_name_pre = IWL5150_FW_PRE, \
1961 - .ucode_api_max = IWL5150_UCODE_API_MAX, \
1962 -+ .ucode_api_ok = IWL5150_UCODE_API_OK, \
1963 - .ucode_api_min = IWL5150_UCODE_API_MIN, \
1964 - .eeprom_ver = EEPROM_5050_EEPROM_VERSION, \
1965 - .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION, \
1966 -@@ -450,5 +457,5 @@ struct iwl_cfg iwl5150_abg_cfg = {
1967 - IWL_DEVICE_5150,
1968 - };
1969 -
1970 --MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
1971 --MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_MAX));
1972 -+MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_OK));
1973 -+MODULE_FIRMWARE(IWL5150_MODULE_FIRMWARE(IWL5150_UCODE_API_OK));
1974 -diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
1975 -index c840c78..b4f809c 100644
1976 ---- a/drivers/net/wireless/iwlwifi/iwl-6000.c
1977 -+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
1978 -@@ -46,12 +46,15 @@
1979 - #include "iwl-cfg.h"
1980 -
1981 - /* Highest firmware API version supported */
1982 --#define IWL6000_UCODE_API_MAX 4
1983 -+#define IWL6000_UCODE_API_MAX 6
1984 - #define IWL6050_UCODE_API_MAX 5
1985 - #define IWL6000G2_UCODE_API_MAX 6
1986 -
1987 - /* Oldest version we won't warn about */
1988 -+#define IWL6000_UCODE_API_OK 4
1989 - #define IWL6000G2_UCODE_API_OK 5
1990 -+#define IWL6050_UCODE_API_OK 5
1991 -+#define IWL6000G2B_UCODE_API_OK 6
1992 -
1993 - /* Lowest firmware API version supported */
1994 - #define IWL6000_UCODE_API_MIN 4
1995 -@@ -399,7 +402,7 @@ struct iwl_cfg iwl6005_2agn_d_cfg = {
1996 - #define IWL_DEVICE_6030 \
1997 - .fw_name_pre = IWL6030_FW_PRE, \
1998 - .ucode_api_max = IWL6000G2_UCODE_API_MAX, \
1999 -- .ucode_api_ok = IWL6000G2_UCODE_API_OK, \
2000 -+ .ucode_api_ok = IWL6000G2B_UCODE_API_OK, \
2001 - .ucode_api_min = IWL6000G2_UCODE_API_MIN, \
2002 - .eeprom_ver = EEPROM_6030_EEPROM_VERSION, \
2003 - .eeprom_calib_ver = EEPROM_6030_TX_POWER_VERSION, \
2004 -@@ -479,6 +482,7 @@ struct iwl_cfg iwl130_bg_cfg = {
2005 - #define IWL_DEVICE_6000i \
2006 - .fw_name_pre = IWL6000_FW_PRE, \
2007 - .ucode_api_max = IWL6000_UCODE_API_MAX, \
2008 -+ .ucode_api_ok = IWL6000_UCODE_API_OK, \
2009 - .ucode_api_min = IWL6000_UCODE_API_MIN, \
2010 - .valid_tx_ant = ANT_BC, /* .cfg overwrite */ \
2011 - .valid_rx_ant = ANT_BC, /* .cfg overwrite */ \
2012 -@@ -559,6 +563,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
2013 - .name = "Intel(R) Centrino(R) Ultimate-N 6300 AGN",
2014 - .fw_name_pre = IWL6000_FW_PRE,
2015 - .ucode_api_max = IWL6000_UCODE_API_MAX,
2016 -+ .ucode_api_ok = IWL6000_UCODE_API_OK,
2017 - .ucode_api_min = IWL6000_UCODE_API_MIN,
2018 - .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
2019 - .eeprom_calib_ver = EEPROM_6000_TX_POWER_VERSION,
2020 -@@ -569,7 +574,7 @@ struct iwl_cfg iwl6000_3agn_cfg = {
2021 - .led_mode = IWL_LED_BLINK,
2022 - };
2023 -
2024 --MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
2025 --MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
2026 --MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
2027 --MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
2028 -+MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_OK));
2029 -+MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_OK));
2030 -+MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_OK));
2031 -+MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_OK));
2032 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
2033 -index e0e9a3d..d7d2512 100644
2034 ---- a/drivers/net/wireless/iwlwifi/iwl-agn.c
2035 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
2036 -@@ -1504,7 +1504,6 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)
2037 -
2038 - static void iwlagn_prepare_restart(struct iwl_priv *priv)
2039 - {
2040 -- struct iwl_rxon_context *ctx;
2041 - bool bt_full_concurrent;
2042 - u8 bt_ci_compliance;
2043 - u8 bt_load;
2044 -@@ -1513,8 +1512,6 @@ static void iwlagn_prepare_restart(struct iwl_priv *priv)
2045 -
2046 - lockdep_assert_held(&priv->shrd->mutex);
2047 -
2048 -- for_each_context(priv, ctx)
2049 -- ctx->vif = NULL;
2050 - priv->is_open = 0;
2051 -
2052 - /*
2053 -diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
2054 -index 3d75d4c..832ec4d 100644
2055 ---- a/drivers/net/wireless/iwlwifi/iwl-core.c
2056 -+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
2057 -@@ -1228,6 +1228,7 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
2058 - struct iwl_rxon_context *tmp, *ctx = NULL;
2059 - int err;
2060 - enum nl80211_iftype viftype = ieee80211_vif_type_p2p(vif);
2061 -+ bool reset = false;
2062 -
2063 - IWL_DEBUG_MAC80211(priv, "enter: type %d, addr %pM\n",
2064 - viftype, vif->addr);
2065 -@@ -1249,6 +1250,13 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
2066 - tmp->interface_modes | tmp->exclusive_interface_modes;
2067 -
2068 - if (tmp->vif) {
2069 -+ /* On reset we need to add the same interface again */
2070 -+ if (tmp->vif == vif) {
2071 -+ reset = true;
2072 -+ ctx = tmp;
2073 -+ break;
2074 -+ }
2075 -+
2076 - /* check if this busy context is exclusive */
2077 - if (tmp->exclusive_interface_modes &
2078 - BIT(tmp->vif->type)) {
2079 -@@ -1275,7 +1283,7 @@ int iwlagn_mac_add_interface(struct ieee80211_hw *hw,
2080 - ctx->vif = vif;
2081 -
2082 - err = iwl_setup_interface(priv, ctx);
2083 -- if (!err)
2084 -+ if (!err || reset)
2085 - goto out;
2086 -
2087 - ctx->vif = NULL;
2088 -diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
2089 -index 5bede9d..aae992a 100644
2090 ---- a/drivers/net/wireless/iwlwifi/iwl-fh.h
2091 -+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
2092 -@@ -104,15 +104,29 @@
2093 - * (see struct iwl_tfd_frame). These 16 pointer registers are offset by 0x04
2094 - * bytes from one another. Each TFD circular buffer in DRAM must be 256-byte
2095 - * aligned (address bits 0-7 must be 0).
2096 -+ * Later devices have 20 (5000 series) or 30 (higher) queues, but the registers
2097 -+ * for them are in different places.
2098 - *
2099 - * Bit fields in each pointer register:
2100 - * 27-0: TFD CB physical base address [35:8], must be 256-byte aligned
2101 - */
2102 --#define FH_MEM_CBBC_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
2103 --#define FH_MEM_CBBC_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10)
2104 --
2105 --/* Find TFD CB base pointer for given queue (range 0-15). */
2106 --#define FH_MEM_CBBC_QUEUE(x) (FH_MEM_CBBC_LOWER_BOUND + (x) * 0x4)
2107 -+#define FH_MEM_CBBC_0_15_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0x9D0)
2108 -+#define FH_MEM_CBBC_0_15_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xA10)
2109 -+#define FH_MEM_CBBC_16_19_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xBF0)
2110 -+#define FH_MEM_CBBC_16_19_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xC00)
2111 -+#define FH_MEM_CBBC_20_31_LOWER_BOUND (FH_MEM_LOWER_BOUND + 0xB20)
2112 -+#define FH_MEM_CBBC_20_31_UPPER_BOUND (FH_MEM_LOWER_BOUND + 0xB80)
2113 -+
2114 -+/* Find TFD CB base pointer for given queue */
2115 -+static inline unsigned int FH_MEM_CBBC_QUEUE(unsigned int chnl)
2116 -+{
2117 -+ if (chnl < 16)
2118 -+ return FH_MEM_CBBC_0_15_LOWER_BOUND + 4 * chnl;
2119 -+ if (chnl < 20)
2120 -+ return FH_MEM_CBBC_16_19_LOWER_BOUND + 4 * (chnl - 16);
2121 -+ WARN_ON_ONCE(chnl >= 32);
2122 -+ return FH_MEM_CBBC_20_31_LOWER_BOUND + 4 * (chnl - 20);
2123 -+}
2124 -
2125 -
2126 - /**
2127 -diff --git a/drivers/net/wireless/iwlwifi/iwl-prph.h b/drivers/net/wireless/iwlwifi/iwl-prph.h
2128 -index bebdd82..d9b089e 100644
2129 ---- a/drivers/net/wireless/iwlwifi/iwl-prph.h
2130 -+++ b/drivers/net/wireless/iwlwifi/iwl-prph.h
2131 -@@ -227,12 +227,33 @@
2132 - #define SCD_AIT (SCD_BASE + 0x0c)
2133 - #define SCD_TXFACT (SCD_BASE + 0x10)
2134 - #define SCD_ACTIVE (SCD_BASE + 0x14)
2135 --#define SCD_QUEUE_WRPTR(x) (SCD_BASE + 0x18 + (x) * 4)
2136 --#define SCD_QUEUE_RDPTR(x) (SCD_BASE + 0x68 + (x) * 4)
2137 - #define SCD_QUEUECHAIN_SEL (SCD_BASE + 0xe8)
2138 - #define SCD_AGGR_SEL (SCD_BASE + 0x248)
2139 - #define SCD_INTERRUPT_MASK (SCD_BASE + 0x108)
2140 --#define SCD_QUEUE_STATUS_BITS(x) (SCD_BASE + 0x10c + (x) * 4)
2141 -+
2142 -+static inline unsigned int SCD_QUEUE_WRPTR(unsigned int chnl)
2143 -+{
2144 -+ if (chnl < 20)
2145 -+ return SCD_BASE + 0x18 + chnl * 4;
2146 -+ WARN_ON_ONCE(chnl >= 32);
2147 -+ return SCD_BASE + 0x284 + (chnl - 20) * 4;
2148 -+}
2149 -+
2150 -+static inline unsigned int SCD_QUEUE_RDPTR(unsigned int chnl)
2151 -+{
2152 -+ if (chnl < 20)
2153 -+ return SCD_BASE + 0x68 + chnl * 4;
2154 -+ WARN_ON_ONCE(chnl >= 32);
2155 -+ return SCD_BASE + 0x2B4 + (chnl - 20) * 4;
2156 -+}
2157 -+
2158 -+static inline unsigned int SCD_QUEUE_STATUS_BITS(unsigned int chnl)
2159 -+{
2160 -+ if (chnl < 20)
2161 -+ return SCD_BASE + 0x10c + chnl * 4;
2162 -+ WARN_ON_ONCE(chnl >= 32);
2163 -+ return SCD_BASE + 0x384 + (chnl - 20) * 4;
2164 -+}
2165 -
2166 - /*********************** END TX SCHEDULER *************************************/
2167 -
2168 -diff --git a/drivers/net/wireless/mwifiex/pcie.h b/drivers/net/wireless/mwifiex/pcie.h
2169 -index 445ff21..2f218f9 100644
2170 ---- a/drivers/net/wireless/mwifiex/pcie.h
2171 -+++ b/drivers/net/wireless/mwifiex/pcie.h
2172 -@@ -48,15 +48,15 @@
2173 - #define PCIE_HOST_INT_STATUS_MASK 0xC3C
2174 - #define PCIE_SCRATCH_2_REG 0xC40
2175 - #define PCIE_SCRATCH_3_REG 0xC44
2176 --#define PCIE_SCRATCH_4_REG 0xCC0
2177 --#define PCIE_SCRATCH_5_REG 0xCC4
2178 --#define PCIE_SCRATCH_6_REG 0xCC8
2179 --#define PCIE_SCRATCH_7_REG 0xCCC
2180 --#define PCIE_SCRATCH_8_REG 0xCD0
2181 --#define PCIE_SCRATCH_9_REG 0xCD4
2182 --#define PCIE_SCRATCH_10_REG 0xCD8
2183 --#define PCIE_SCRATCH_11_REG 0xCDC
2184 --#define PCIE_SCRATCH_12_REG 0xCE0
2185 -+#define PCIE_SCRATCH_4_REG 0xCD0
2186 -+#define PCIE_SCRATCH_5_REG 0xCD4
2187 -+#define PCIE_SCRATCH_6_REG 0xCD8
2188 -+#define PCIE_SCRATCH_7_REG 0xCDC
2189 -+#define PCIE_SCRATCH_8_REG 0xCE0
2190 -+#define PCIE_SCRATCH_9_REG 0xCE4
2191 -+#define PCIE_SCRATCH_10_REG 0xCE8
2192 -+#define PCIE_SCRATCH_11_REG 0xCEC
2193 -+#define PCIE_SCRATCH_12_REG 0xCF0
2194 -
2195 - #define CPU_INTR_DNLD_RDY BIT(0)
2196 - #define CPU_INTR_DOOR_BELL BIT(1)
2197 -diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
2198 -index cb71e88..0ffa111 100644
2199 ---- a/drivers/net/wireless/rt2x00/rt2800usb.c
2200 -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
2201 -@@ -914,12 +914,14 @@ static struct usb_device_id rt2800usb_device_table[] = {
2202 - { USB_DEVICE(0x050d, 0x8053) },
2203 - { USB_DEVICE(0x050d, 0x805c) },
2204 - { USB_DEVICE(0x050d, 0x815c) },
2205 -+ { USB_DEVICE(0x050d, 0x825a) },
2206 - { USB_DEVICE(0x050d, 0x825b) },
2207 - { USB_DEVICE(0x050d, 0x935a) },
2208 - { USB_DEVICE(0x050d, 0x935b) },
2209 - /* Buffalo */
2210 - { USB_DEVICE(0x0411, 0x00e8) },
2211 - { USB_DEVICE(0x0411, 0x0158) },
2212 -+ { USB_DEVICE(0x0411, 0x015d) },
2213 - { USB_DEVICE(0x0411, 0x016f) },
2214 - { USB_DEVICE(0x0411, 0x01a2) },
2215 - /* Corega */
2216 -@@ -934,6 +936,8 @@ static struct usb_device_id rt2800usb_device_table[] = {
2217 - { USB_DEVICE(0x07d1, 0x3c0e) },
2218 - { USB_DEVICE(0x07d1, 0x3c0f) },
2219 - { USB_DEVICE(0x07d1, 0x3c11) },
2220 -+ { USB_DEVICE(0x07d1, 0x3c13) },
2221 -+ { USB_DEVICE(0x07d1, 0x3c15) },
2222 - { USB_DEVICE(0x07d1, 0x3c16) },
2223 - { USB_DEVICE(0x2001, 0x3c1b) },
2224 - /* Draytek */
2225 -@@ -944,6 +948,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
2226 - { USB_DEVICE(0x7392, 0x7711) },
2227 - { USB_DEVICE(0x7392, 0x7717) },
2228 - { USB_DEVICE(0x7392, 0x7718) },
2229 -+ { USB_DEVICE(0x7392, 0x7722) },
2230 - /* Encore */
2231 - { USB_DEVICE(0x203d, 0x1480) },
2232 - { USB_DEVICE(0x203d, 0x14a9) },
2233 -@@ -978,6 +983,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
2234 - { USB_DEVICE(0x1737, 0x0070) },
2235 - { USB_DEVICE(0x1737, 0x0071) },
2236 - { USB_DEVICE(0x1737, 0x0077) },
2237 -+ { USB_DEVICE(0x1737, 0x0078) },
2238 - /* Logitec */
2239 - { USB_DEVICE(0x0789, 0x0162) },
2240 - { USB_DEVICE(0x0789, 0x0163) },
2241 -@@ -1001,9 +1007,13 @@ static struct usb_device_id rt2800usb_device_table[] = {
2242 - { USB_DEVICE(0x0db0, 0x871b) },
2243 - { USB_DEVICE(0x0db0, 0x871c) },
2244 - { USB_DEVICE(0x0db0, 0x899a) },
2245 -+ /* Ovislink */
2246 -+ { USB_DEVICE(0x1b75, 0x3071) },
2247 -+ { USB_DEVICE(0x1b75, 0x3072) },
2248 - /* Para */
2249 - { USB_DEVICE(0x20b8, 0x8888) },
2250 - /* Pegatron */
2251 -+ { USB_DEVICE(0x1d4d, 0x0002) },
2252 - { USB_DEVICE(0x1d4d, 0x000c) },
2253 - { USB_DEVICE(0x1d4d, 0x000e) },
2254 - { USB_DEVICE(0x1d4d, 0x0011) },
2255 -@@ -1056,7 +1066,9 @@ static struct usb_device_id rt2800usb_device_table[] = {
2256 - /* Sparklan */
2257 - { USB_DEVICE(0x15a9, 0x0006) },
2258 - /* Sweex */
2259 -+ { USB_DEVICE(0x177f, 0x0153) },
2260 - { USB_DEVICE(0x177f, 0x0302) },
2261 -+ { USB_DEVICE(0x177f, 0x0313) },
2262 - /* U-Media */
2263 - { USB_DEVICE(0x157e, 0x300e) },
2264 - { USB_DEVICE(0x157e, 0x3013) },
2265 -@@ -1140,27 +1152,24 @@ static struct usb_device_id rt2800usb_device_table[] = {
2266 - { USB_DEVICE(0x13d3, 0x3322) },
2267 - /* Belkin */
2268 - { USB_DEVICE(0x050d, 0x1003) },
2269 -- { USB_DEVICE(0x050d, 0x825a) },
2270 - /* Buffalo */
2271 - { USB_DEVICE(0x0411, 0x012e) },
2272 - { USB_DEVICE(0x0411, 0x0148) },
2273 - { USB_DEVICE(0x0411, 0x0150) },
2274 -- { USB_DEVICE(0x0411, 0x015d) },
2275 - /* Corega */
2276 - { USB_DEVICE(0x07aa, 0x0041) },
2277 - { USB_DEVICE(0x07aa, 0x0042) },
2278 - { USB_DEVICE(0x18c5, 0x0008) },
2279 - /* D-Link */
2280 - { USB_DEVICE(0x07d1, 0x3c0b) },
2281 -- { USB_DEVICE(0x07d1, 0x3c13) },
2282 -- { USB_DEVICE(0x07d1, 0x3c15) },
2283 - { USB_DEVICE(0x07d1, 0x3c17) },
2284 - { USB_DEVICE(0x2001, 0x3c17) },
2285 - /* Edimax */
2286 - { USB_DEVICE(0x7392, 0x4085) },
2287 -- { USB_DEVICE(0x7392, 0x7722) },
2288 - /* Encore */
2289 - { USB_DEVICE(0x203d, 0x14a1) },
2290 -+ /* Fujitsu Stylistic 550 */
2291 -+ { USB_DEVICE(0x1690, 0x0761) },
2292 - /* Gemtek */
2293 - { USB_DEVICE(0x15a9, 0x0010) },
2294 - /* Gigabyte */
2295 -@@ -1172,19 +1181,13 @@ static struct usb_device_id rt2800usb_device_table[] = {
2296 - /* LevelOne */
2297 - { USB_DEVICE(0x1740, 0x0605) },
2298 - { USB_DEVICE(0x1740, 0x0615) },
2299 -- /* Linksys */
2300 -- { USB_DEVICE(0x1737, 0x0078) },
2301 - /* Logitec */
2302 - { USB_DEVICE(0x0789, 0x0168) },
2303 - { USB_DEVICE(0x0789, 0x0169) },
2304 - /* Motorola */
2305 - { USB_DEVICE(0x100d, 0x9032) },
2306 -- /* Ovislink */
2307 -- { USB_DEVICE(0x1b75, 0x3071) },
2308 -- { USB_DEVICE(0x1b75, 0x3072) },
2309 - /* Pegatron */
2310 - { USB_DEVICE(0x05a6, 0x0101) },
2311 -- { USB_DEVICE(0x1d4d, 0x0002) },
2312 - { USB_DEVICE(0x1d4d, 0x0010) },
2313 - /* Planex */
2314 - { USB_DEVICE(0x2019, 0x5201) },
2315 -@@ -1203,9 +1206,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
2316 - { USB_DEVICE(0x083a, 0xc522) },
2317 - { USB_DEVICE(0x083a, 0xd522) },
2318 - { USB_DEVICE(0x083a, 0xf511) },
2319 -- /* Sweex */
2320 -- { USB_DEVICE(0x177f, 0x0153) },
2321 -- { USB_DEVICE(0x177f, 0x0313) },
2322 - /* Zyxel */
2323 - { USB_DEVICE(0x0586, 0x341a) },
2324 - #endif
2325 -diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
2326 -index d44d398..47ba0f7 100644
2327 ---- a/drivers/net/wireless/rtlwifi/pci.c
2328 -+++ b/drivers/net/wireless/rtlwifi/pci.c
2329 -@@ -1961,6 +1961,7 @@ void rtl_pci_disconnect(struct pci_dev *pdev)
2330 - rtl_deinit_deferred_work(hw);
2331 - rtlpriv->intf_ops->adapter_stop(hw);
2332 - }
2333 -+ rtlpriv->cfg->ops->disable_interrupt(hw);
2334 -
2335 - /*deinit rfkill */
2336 - rtl_deinit_rfkill(hw);
2337 -diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
2338 -index ba3268e..40c1574 100644
2339 ---- a/drivers/net/wireless/wl1251/main.c
2340 -+++ b/drivers/net/wireless/wl1251/main.c
2341 -@@ -479,6 +479,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
2342 - cancel_work_sync(&wl->irq_work);
2343 - cancel_work_sync(&wl->tx_work);
2344 - cancel_work_sync(&wl->filter_work);
2345 -+ cancel_delayed_work_sync(&wl->elp_work);
2346 -
2347 - mutex_lock(&wl->mutex);
2348 -
2349 -diff --git a/drivers/net/wireless/wl1251/sdio.c b/drivers/net/wireless/wl1251/sdio.c
2350 -index f786942..1b851f6 100644
2351 ---- a/drivers/net/wireless/wl1251/sdio.c
2352 -+++ b/drivers/net/wireless/wl1251/sdio.c
2353 -@@ -315,8 +315,8 @@ static void __devexit wl1251_sdio_remove(struct sdio_func *func)
2354 -
2355 - if (wl->irq)
2356 - free_irq(wl->irq, wl);
2357 -- kfree(wl_sdio);
2358 - wl1251_free_hw(wl);
2359 -+ kfree(wl_sdio);
2360 -
2361 - sdio_claim_host(func);
2362 - sdio_release_irq(func);
2363 -diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2364 -index 6476547..78fda9c 100644
2365 ---- a/drivers/pci/quirks.c
2366 -+++ b/drivers/pci/quirks.c
2367 -@@ -2906,6 +2906,40 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f8, quirk_intel_mc_errata);
2368 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65f9, quirk_intel_mc_errata);
2369 - DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x65fa, quirk_intel_mc_errata);
2370 -
2371 -+/*
2372 -+ * Some BIOS implementations leave the Intel GPU interrupts enabled,
2373 -+ * even though no one is handling them (f.e. i915 driver is never loaded).
2374 -+ * Additionally the interrupt destination is not set up properly
2375 -+ * and the interrupt ends up -somewhere-.
2376 -+ *
2377 -+ * These spurious interrupts are "sticky" and the kernel disables
2378 -+ * the (shared) interrupt line after 100.000+ generated interrupts.
2379 -+ *
2380 -+ * Fix it by disabling the still enabled interrupts.
2381 -+ * This resolves crashes often seen on monitor unplug.
2382 -+ */
2383 -+#define I915_DEIER_REG 0x4400c
2384 -+static void __devinit disable_igfx_irq(struct pci_dev *dev)
2385 -+{
2386 -+ void __iomem *regs = pci_iomap(dev, 0, 0);
2387 -+ if (regs == NULL) {
2388 -+ dev_warn(&dev->dev, "igfx quirk: Can't iomap PCI device\n");
2389 -+ return;
2390 -+ }
2391 -+
2392 -+ /* Check if any interrupt line is still enabled */
2393 -+ if (readl(regs + I915_DEIER_REG) != 0) {
2394 -+ dev_warn(&dev->dev, "BIOS left Intel GPU interrupts enabled; "
2395 -+ "disabling\n");
2396 -+
2397 -+ writel(0, regs + I915_DEIER_REG);
2398 -+ }
2399 -+
2400 -+ pci_iounmap(dev, regs);
2401 -+}
2402 -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
2403 -+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
2404 -+
2405 - static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
2406 - struct pci_fixup *end)
2407 - {
2408 -diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
2409 -index d93e962..1d3bcce 100644
2410 ---- a/drivers/platform/x86/dell-laptop.c
2411 -+++ b/drivers/platform/x86/dell-laptop.c
2412 -@@ -184,6 +184,34 @@ static struct dmi_system_id __devinitdata dell_quirks[] = {
2413 - },
2414 - .driver_data = &quirk_dell_vostro_v130,
2415 - },
2416 -+ {
2417 -+ .callback = dmi_matched,
2418 -+ .ident = "Dell Vostro 3555",
2419 -+ .matches = {
2420 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
2421 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3555"),
2422 -+ },
2423 -+ .driver_data = &quirk_dell_vostro_v130,
2424 -+ },
2425 -+ {
2426 -+ .callback = dmi_matched,
2427 -+ .ident = "Dell Inspiron N311z",
2428 -+ .matches = {
2429 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
2430 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N311z"),
2431 -+ },
2432 -+ .driver_data = &quirk_dell_vostro_v130,
2433 -+ },
2434 -+ {
2435 -+ .callback = dmi_matched,
2436 -+ .ident = "Dell Inspiron M5110",
2437 -+ .matches = {
2438 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
2439 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron M5110"),
2440 -+ },
2441 -+ .driver_data = &quirk_dell_vostro_v130,
2442 -+ },
2443 -+ { }
2444 - };
2445 -
2446 - static struct calling_interface_buffer *buffer;
2447 -@@ -615,6 +643,7 @@ static void touchpad_led_set(struct led_classdev *led_cdev,
2448 - static struct led_classdev touchpad_led = {
2449 - .name = "dell-laptop::touchpad",
2450 - .brightness_set = touchpad_led_set,
2451 -+ .flags = LED_CORE_SUSPENDRESUME,
2452 - };
2453 -
2454 - static int __devinit touchpad_led_init(struct device *dev)
2455 -diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
2456 -index 1b831c5..e48ba4b 100644
2457 ---- a/drivers/scsi/libsas/sas_expander.c
2458 -+++ b/drivers/scsi/libsas/sas_expander.c
2459 -@@ -192,7 +192,14 @@ static void sas_set_ex_phy(struct domain_device *dev, int phy_id,
2460 - phy->attached_sata_ps = dr->attached_sata_ps;
2461 - phy->attached_iproto = dr->iproto << 1;
2462 - phy->attached_tproto = dr->tproto << 1;
2463 -- memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
2464 -+ /* help some expanders that fail to zero sas_address in the 'no
2465 -+ * device' case
2466 -+ */
2467 -+ if (phy->attached_dev_type == NO_DEVICE ||
2468 -+ phy->linkrate < SAS_LINK_RATE_1_5_GBPS)
2469 -+ memset(phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
2470 -+ else
2471 -+ memcpy(phy->attached_sas_addr, dr->attached_sas_addr, SAS_ADDR_SIZE);
2472 - phy->attached_phy_id = dr->attached_phy_id;
2473 - phy->phy_change_count = dr->change_count;
2474 - phy->routing_attr = dr->routing_attr;
2475 -@@ -1643,9 +1650,17 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id,
2476 - int phy_change_count = 0;
2477 -
2478 - res = sas_get_phy_change_count(dev, i, &phy_change_count);
2479 -- if (res)
2480 -- goto out;
2481 -- else if (phy_change_count != ex->ex_phy[i].phy_change_count) {
2482 -+ switch (res) {
2483 -+ case SMP_RESP_PHY_VACANT:
2484 -+ case SMP_RESP_NO_PHY:
2485 -+ continue;
2486 -+ case SMP_RESP_FUNC_ACC:
2487 -+ break;
2488 -+ default:
2489 -+ return res;
2490 -+ }
2491 -+
2492 -+ if (phy_change_count != ex->ex_phy[i].phy_change_count) {
2493 - if (update)
2494 - ex->ex_phy[i].phy_change_count =
2495 - phy_change_count;
2496 -@@ -1653,8 +1668,7 @@ static int sas_find_bcast_phy(struct domain_device *dev, int *phy_id,
2497 - return 0;
2498 - }
2499 - }
2500 --out:
2501 -- return res;
2502 -+ return 0;
2503 - }
2504 -
2505 - static int sas_get_ex_change_count(struct domain_device *dev, int *ecc)
2506 -diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c
2507 -index 24cacff..5f748c0 100644
2508 ---- a/drivers/spi/spi-fsl-spi.c
2509 -+++ b/drivers/spi/spi-fsl-spi.c
2510 -@@ -139,10 +139,12 @@ static void fsl_spi_change_mode(struct spi_device *spi)
2511 - static void fsl_spi_chipselect(struct spi_device *spi, int value)
2512 - {
2513 - struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
2514 -- struct fsl_spi_platform_data *pdata = spi->dev.parent->platform_data;
2515 -+ struct fsl_spi_platform_data *pdata;
2516 - bool pol = spi->mode & SPI_CS_HIGH;
2517 - struct spi_mpc8xxx_cs *cs = spi->controller_state;
2518 -
2519 -+ pdata = spi->dev.parent->parent->platform_data;
2520 -+
2521 - if (value == BITBANG_CS_INACTIVE) {
2522 - if (pdata->cs_control)
2523 - pdata->cs_control(spi, !pol);
2524 -diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
2525 -index 77eae99..b2ccdea 100644
2526 ---- a/drivers/spi/spi.c
2527 -+++ b/drivers/spi/spi.c
2528 -@@ -319,7 +319,7 @@ struct spi_device *spi_alloc_device(struct spi_master *master)
2529 - }
2530 -
2531 - spi->master = master;
2532 -- spi->dev.parent = dev;
2533 -+ spi->dev.parent = &master->dev;
2534 - spi->dev.bus = &spi_bus_type;
2535 - spi->dev.release = spidev_release;
2536 - device_initialize(&spi->dev);
2537 -diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
2538 -index fb11743..4bb2797 100644
2539 ---- a/drivers/staging/rtl8712/os_intfs.c
2540 -+++ b/drivers/staging/rtl8712/os_intfs.c
2541 -@@ -476,9 +476,6 @@ static int netdev_close(struct net_device *pnetdev)
2542 - r8712_free_assoc_resources(padapter);
2543 - /*s2-4.*/
2544 - r8712_free_network_queue(padapter);
2545 -- release_firmware(padapter->fw);
2546 -- /* never exit with a firmware callback pending */
2547 -- wait_for_completion(&padapter->rtl8712_fw_ready);
2548 - return 0;
2549 - }
2550 -
2551 -diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
2552 -index 9bade18..ec41d38 100644
2553 ---- a/drivers/staging/rtl8712/usb_intf.c
2554 -+++ b/drivers/staging/rtl8712/usb_intf.c
2555 -@@ -30,6 +30,7 @@
2556 -
2557 - #include <linux/usb.h>
2558 - #include <linux/module.h>
2559 -+#include <linux/firmware.h>
2560 -
2561 - #include "osdep_service.h"
2562 - #include "drv_types.h"
2563 -@@ -621,6 +622,10 @@ static void r871xu_dev_remove(struct usb_interface *pusb_intf)
2564 - struct _adapter *padapter = netdev_priv(pnetdev);
2565 - struct usb_device *udev = interface_to_usbdev(pusb_intf);
2566 -
2567 -+ if (padapter->fw_found)
2568 -+ release_firmware(padapter->fw);
2569 -+ /* never exit with a firmware callback pending */
2570 -+ wait_for_completion(&padapter->rtl8712_fw_ready);
2571 - usb_set_intfdata(pusb_intf, NULL);
2572 - if (padapter) {
2573 - if (drvpriv.drv_registered == true)
2574 -diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
2575 -index b84c834..8daf073 100644
2576 ---- a/drivers/tty/amiserial.c
2577 -+++ b/drivers/tty/amiserial.c
2578 -@@ -1113,8 +1113,10 @@ static int set_serial_info(struct async_struct * info,
2579 - (new_serial.close_delay != state->close_delay) ||
2580 - (new_serial.xmit_fifo_size != state->xmit_fifo_size) ||
2581 - ((new_serial.flags & ~ASYNC_USR_MASK) !=
2582 -- (state->flags & ~ASYNC_USR_MASK)))
2583 -+ (state->flags & ~ASYNC_USR_MASK))) {
2584 -+ tty_unlock();
2585 - return -EPERM;
2586 -+ }
2587 - state->flags = ((state->flags & ~ASYNC_USR_MASK) |
2588 - (new_serial.flags & ASYNC_USR_MASK));
2589 - info->flags = ((info->flags & ~ASYNC_USR_MASK) |
2590 -diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
2591 -index e6c3dbd..836fe273 100644
2592 ---- a/drivers/tty/serial/clps711x.c
2593 -+++ b/drivers/tty/serial/clps711x.c
2594 -@@ -154,10 +154,9 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
2595 - port->x_char = 0;
2596 - return IRQ_HANDLED;
2597 - }
2598 -- if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
2599 -- clps711xuart_stop_tx(port);
2600 -- return IRQ_HANDLED;
2601 -- }
2602 -+
2603 -+ if (uart_circ_empty(xmit) || uart_tx_stopped(port))
2604 -+ goto disable_tx_irq;
2605 -
2606 - count = port->fifosize >> 1;
2607 - do {
2608 -@@ -171,8 +170,11 @@ static irqreturn_t clps711xuart_int_tx(int irq, void *dev_id)
2609 - if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
2610 - uart_write_wakeup(port);
2611 -
2612 -- if (uart_circ_empty(xmit))
2613 -- clps711xuart_stop_tx(port);
2614 -+ if (uart_circ_empty(xmit)) {
2615 -+ disable_tx_irq:
2616 -+ disable_irq_nosync(TX_IRQ(port));
2617 -+ tx_enabled(port) = 0;
2618 -+ }
2619 -
2620 - return IRQ_HANDLED;
2621 - }
2622 -diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
2623 -index da776a0..a4b192d 100644
2624 ---- a/drivers/tty/serial/pch_uart.c
2625 -+++ b/drivers/tty/serial/pch_uart.c
2626 -@@ -1356,9 +1356,11 @@ static int pch_uart_verify_port(struct uart_port *port,
2627 - __func__);
2628 - return -EOPNOTSUPP;
2629 - #endif
2630 -- priv->use_dma = 1;
2631 - priv->use_dma_flag = 1;
2632 - dev_info(priv->port.dev, "PCH UART : Use DMA Mode\n");
2633 -+ if (!priv->use_dma)
2634 -+ pch_request_dma(port);
2635 -+ priv->use_dma = 1;
2636 - }
2637 -
2638 - return 0;
2639 -diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
2640 -index 9eb71d8..2db0327 100644
2641 ---- a/drivers/usb/class/cdc-wdm.c
2642 -+++ b/drivers/usb/class/cdc-wdm.c
2643 -@@ -108,8 +108,9 @@ static void wdm_out_callback(struct urb *urb)
2644 - spin_lock(&desc->iuspin);
2645 - desc->werr = urb->status;
2646 - spin_unlock(&desc->iuspin);
2647 -- clear_bit(WDM_IN_USE, &desc->flags);
2648 - kfree(desc->outbuf);
2649 -+ desc->outbuf = NULL;
2650 -+ clear_bit(WDM_IN_USE, &desc->flags);
2651 - wake_up(&desc->wait);
2652 - }
2653 -
2654 -@@ -312,7 +313,7 @@ static ssize_t wdm_write
2655 - if (we < 0)
2656 - return -EIO;
2657 -
2658 -- desc->outbuf = buf = kmalloc(count, GFP_KERNEL);
2659 -+ buf = kmalloc(count, GFP_KERNEL);
2660 - if (!buf) {
2661 - rv = -ENOMEM;
2662 - goto outnl;
2663 -@@ -376,10 +377,12 @@ static ssize_t wdm_write
2664 - req->wIndex = desc->inum;
2665 - req->wLength = cpu_to_le16(count);
2666 - set_bit(WDM_IN_USE, &desc->flags);
2667 -+ desc->outbuf = buf;
2668 -
2669 - rv = usb_submit_urb(desc->command, GFP_KERNEL);
2670 - if (rv < 0) {
2671 - kfree(buf);
2672 -+ desc->outbuf = NULL;
2673 - clear_bit(WDM_IN_USE, &desc->flags);
2674 - dev_err(&desc->intf->dev, "Tx URB error: %d\n", rv);
2675 - } else {
2676 -diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
2677 -index 61d08dd..5f1404a 100644
2678 ---- a/drivers/usb/core/hcd-pci.c
2679 -+++ b/drivers/usb/core/hcd-pci.c
2680 -@@ -495,6 +495,15 @@ static int hcd_pci_suspend_noirq(struct device *dev)
2681 -
2682 - pci_save_state(pci_dev);
2683 -
2684 -+ /*
2685 -+ * Some systems crash if an EHCI controller is in D3 during
2686 -+ * a sleep transition. We have to leave such controllers in D0.
2687 -+ */
2688 -+ if (hcd->broken_pci_sleep) {
2689 -+ dev_dbg(dev, "Staying in PCI D0\n");
2690 -+ return retval;
2691 -+ }
2692 -+
2693 - /* If the root hub is dead rather than suspended, disallow remote
2694 - * wakeup. usb_hc_died() should ensure that both hosts are marked as
2695 - * dying, so we only need to check the primary roothub.
2696 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
2697 -index e238b3b..2b0a341 100644
2698 ---- a/drivers/usb/core/hub.c
2699 -+++ b/drivers/usb/core/hub.c
2700 -@@ -1644,7 +1644,6 @@ void usb_disconnect(struct usb_device **pdev)
2701 - {
2702 - struct usb_device *udev = *pdev;
2703 - int i;
2704 -- struct usb_hcd *hcd = bus_to_hcd(udev->bus);
2705 -
2706 - /* mark the device as inactive, so any further urb submissions for
2707 - * this device (and any of its children) will fail immediately.
2708 -@@ -1667,9 +1666,7 @@ void usb_disconnect(struct usb_device **pdev)
2709 - * so that the hardware is now fully quiesced.
2710 - */
2711 - dev_dbg (&udev->dev, "unregistering device\n");
2712 -- mutex_lock(hcd->bandwidth_mutex);
2713 - usb_disable_device(udev, 0);
2714 -- mutex_unlock(hcd->bandwidth_mutex);
2715 - usb_hcd_synchronize_unlinks(udev);
2716 -
2717 - usb_remove_ep_devs(&udev->ep0);
2718 -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
2719 -index aed3e07..ca717da 100644
2720 ---- a/drivers/usb/core/message.c
2721 -+++ b/drivers/usb/core/message.c
2722 -@@ -1136,8 +1136,6 @@ void usb_disable_interface(struct usb_device *dev, struct usb_interface *intf,
2723 - * Deallocates hcd/hardware state for the endpoints (nuking all or most
2724 - * pending urbs) and usbcore state for the interfaces, so that usbcore
2725 - * must usb_set_configuration() before any interfaces could be used.
2726 -- *
2727 -- * Must be called with hcd->bandwidth_mutex held.
2728 - */
2729 - void usb_disable_device(struct usb_device *dev, int skip_ep0)
2730 - {
2731 -@@ -1190,7 +1188,9 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
2732 - usb_disable_endpoint(dev, i + USB_DIR_IN, false);
2733 - }
2734 - /* Remove endpoints from the host controller internal state */
2735 -+ mutex_lock(hcd->bandwidth_mutex);
2736 - usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL);
2737 -+ mutex_unlock(hcd->bandwidth_mutex);
2738 - /* Second pass: remove endpoint pointers */
2739 - }
2740 - for (i = skip_ep0; i < 16; ++i) {
2741 -@@ -1750,7 +1750,6 @@ free_interfaces:
2742 - /* if it's already configured, clear out old state first.
2743 - * getting rid of old interfaces means unbinding their drivers.
2744 - */
2745 -- mutex_lock(hcd->bandwidth_mutex);
2746 - if (dev->state != USB_STATE_ADDRESS)
2747 - usb_disable_device(dev, 1); /* Skip ep0 */
2748 -
2749 -@@ -1763,6 +1762,7 @@ free_interfaces:
2750 - * host controller will not allow submissions to dropped endpoints. If
2751 - * this call fails, the device state is unchanged.
2752 - */
2753 -+ mutex_lock(hcd->bandwidth_mutex);
2754 - ret = usb_hcd_alloc_bandwidth(dev, cp, NULL, NULL);
2755 - if (ret < 0) {
2756 - mutex_unlock(hcd->bandwidth_mutex);
2757 -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
2758 -index 27bd50a..c0dcf69 100644
2759 ---- a/drivers/usb/dwc3/ep0.c
2760 -+++ b/drivers/usb/dwc3/ep0.c
2761 -@@ -572,9 +572,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
2762 - dwc->ep0_bounced = false;
2763 - } else {
2764 - transferred = ur->length - trb.length;
2765 -- ur->actual += transferred;
2766 - }
2767 -
2768 -+ ur->actual += transferred;
2769 -+
2770 - if ((epnum & 1) && ur->actual < ur->length) {
2771 - /* for some reason we did not get everything out */
2772 -
2773 -diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
2774 -index ab8f1b4..527736e 100644
2775 ---- a/drivers/usb/gadget/dummy_hcd.c
2776 -+++ b/drivers/usb/gadget/dummy_hcd.c
2777 -@@ -925,7 +925,6 @@ static int dummy_udc_stop(struct usb_gadget *g,
2778 -
2779 - dum->driver = NULL;
2780 -
2781 -- dummy_pullup(&dum->gadget, 0);
2782 - return 0;
2783 - }
2784 -
2785 -diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
2786 -index acb3800..0e641a1 100644
2787 ---- a/drivers/usb/gadget/f_fs.c
2788 -+++ b/drivers/usb/gadget/f_fs.c
2789 -@@ -712,7 +712,7 @@ static long ffs_ep0_ioctl(struct file *file, unsigned code, unsigned long value)
2790 - if (code == FUNCTIONFS_INTERFACE_REVMAP) {
2791 - struct ffs_function *func = ffs->func;
2792 - ret = func ? ffs_func_revmap_intf(func, value) : -ENODEV;
2793 -- } else if (gadget->ops->ioctl) {
2794 -+ } else if (gadget && gadget->ops->ioctl) {
2795 - ret = gadget->ops->ioctl(gadget, code, value);
2796 - } else {
2797 - ret = -ENOTTY;
2798 -diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
2799 -index 1a6f415..a5570b6 100644
2800 ---- a/drivers/usb/gadget/f_mass_storage.c
2801 -+++ b/drivers/usb/gadget/f_mass_storage.c
2802 -@@ -2182,7 +2182,7 @@ unknown_cmnd:
2803 - common->data_size_from_cmnd = 0;
2804 - sprintf(unknown, "Unknown x%02x", common->cmnd[0]);
2805 - reply = check_command(common, common->cmnd_size,
2806 -- DATA_DIR_UNKNOWN, 0xff, 0, unknown);
2807 -+ DATA_DIR_UNKNOWN, ~0, 0, unknown);
2808 - if (reply == 0) {
2809 - common->curlun->sense_data = SS_INVALID_COMMAND;
2810 - reply = -EINVAL;
2811 -diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
2812 -index 11b5196..db2d607 100644
2813 ---- a/drivers/usb/gadget/file_storage.c
2814 -+++ b/drivers/usb/gadget/file_storage.c
2815 -@@ -2569,7 +2569,7 @@ static int do_scsi_command(struct fsg_dev *fsg)
2816 - fsg->data_size_from_cmnd = 0;
2817 - sprintf(unknown, "Unknown x%02x", fsg->cmnd[0]);
2818 - if ((reply = check_command(fsg, fsg->cmnd_size,
2819 -- DATA_DIR_UNKNOWN, 0xff, 0, unknown)) == 0) {
2820 -+ DATA_DIR_UNKNOWN, ~0, 0, unknown)) == 0) {
2821 - fsg->curlun->sense_data = SS_INVALID_COMMAND;
2822 - reply = -EINVAL;
2823 - }
2824 -diff --git a/drivers/usb/gadget/udc-core.c b/drivers/usb/gadget/udc-core.c
2825 -index 6939e17..901924a 100644
2826 ---- a/drivers/usb/gadget/udc-core.c
2827 -+++ b/drivers/usb/gadget/udc-core.c
2828 -@@ -211,9 +211,9 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
2829 -
2830 - if (udc_is_newstyle(udc)) {
2831 - udc->driver->disconnect(udc->gadget);
2832 -+ usb_gadget_disconnect(udc->gadget);
2833 - udc->driver->unbind(udc->gadget);
2834 - usb_gadget_udc_stop(udc->gadget, udc->driver);
2835 -- usb_gadget_disconnect(udc->gadget);
2836 - } else {
2837 - usb_gadget_stop(udc->gadget, udc->driver);
2838 - }
2839 -@@ -359,9 +359,13 @@ static ssize_t usb_udc_softconn_store(struct device *dev,
2840 - struct usb_udc *udc = container_of(dev, struct usb_udc, dev);
2841 -
2842 - if (sysfs_streq(buf, "connect")) {
2843 -+ if (udc_is_newstyle(udc))
2844 -+ usb_gadget_udc_start(udc->gadget, udc->driver);
2845 - usb_gadget_connect(udc->gadget);
2846 - } else if (sysfs_streq(buf, "disconnect")) {
2847 - usb_gadget_disconnect(udc->gadget);
2848 -+ if (udc_is_newstyle(udc))
2849 -+ usb_gadget_udc_stop(udc->gadget, udc->driver);
2850 - } else {
2851 - dev_err(dev, "unsupported command '%s'\n", buf);
2852 - return -EINVAL;
2853 -diff --git a/drivers/usb/gadget/uvc.h b/drivers/usb/gadget/uvc.h
2854 -index bc78c60..ca4e03a 100644
2855 ---- a/drivers/usb/gadget/uvc.h
2856 -+++ b/drivers/usb/gadget/uvc.h
2857 -@@ -28,7 +28,7 @@
2858 -
2859 - struct uvc_request_data
2860 - {
2861 -- unsigned int length;
2862 -+ __s32 length;
2863 - __u8 data[60];
2864 - };
2865 -
2866 -diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
2867 -index f6e083b..54d7ca5 100644
2868 ---- a/drivers/usb/gadget/uvc_v4l2.c
2869 -+++ b/drivers/usb/gadget/uvc_v4l2.c
2870 -@@ -39,7 +39,7 @@ uvc_send_response(struct uvc_device *uvc, struct uvc_request_data *data)
2871 - if (data->length < 0)
2872 - return usb_ep_set_halt(cdev->gadget->ep0);
2873 -
2874 -- req->length = min(uvc->event_length, data->length);
2875 -+ req->length = min_t(unsigned int, uvc->event_length, data->length);
2876 - req->zero = data->length < uvc->event_length;
2877 - req->dma = DMA_ADDR_INVALID;
2878 -
2879 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
2880 -index 3ff9f82..da2f711 100644
2881 ---- a/drivers/usb/host/ehci-hcd.c
2882 -+++ b/drivers/usb/host/ehci-hcd.c
2883 -@@ -815,8 +815,13 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
2884 - goto dead;
2885 - }
2886 -
2887 -+ /*
2888 -+ * We don't use STS_FLR, but some controllers don't like it to
2889 -+ * remain on, so mask it out along with the other status bits.
2890 -+ */
2891 -+ masked_status = status & (INTR_MASK | STS_FLR);
2892 -+
2893 - /* Shared IRQ? */
2894 -- masked_status = status & INTR_MASK;
2895 - if (!masked_status || unlikely(ehci->rh_state == EHCI_RH_HALTED)) {
2896 - spin_unlock(&ehci->lock);
2897 - return IRQ_NONE;
2898 -@@ -867,7 +872,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
2899 - pcd_status = status;
2900 -
2901 - /* resume root hub? */
2902 -- if (!(cmd & CMD_RUN))
2903 -+ if (ehci->rh_state == EHCI_RH_SUSPENDED)
2904 - usb_hcd_resume_root_hub(hcd);
2905 -
2906 - /* get per-port change detect bits */
2907 -diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
2908 -index f4b627d..971d312 100644
2909 ---- a/drivers/usb/host/ehci-pci.c
2910 -+++ b/drivers/usb/host/ehci-pci.c
2911 -@@ -144,6 +144,14 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
2912 - hcd->has_tt = 1;
2913 - tdi_reset(ehci);
2914 - }
2915 -+ if (pdev->subsystem_vendor == PCI_VENDOR_ID_ASUSTEK) {
2916 -+ /* EHCI #1 or #2 on 6 Series/C200 Series chipset */
2917 -+ if (pdev->device == 0x1c26 || pdev->device == 0x1c2d) {
2918 -+ ehci_info(ehci, "broken D3 during system sleep on ASUS\n");
2919 -+ hcd->broken_pci_sleep = 1;
2920 -+ device_set_wakeup_capable(&pdev->dev, false);
2921 -+ }
2922 -+ }
2923 - break;
2924 - case PCI_VENDOR_ID_TDI:
2925 - if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) {
2926 -diff --git a/drivers/usb/misc/yurex.c b/drivers/usb/misc/yurex.c
2927 -index ac5bfd6..2504694 100644
2928 ---- a/drivers/usb/misc/yurex.c
2929 -+++ b/drivers/usb/misc/yurex.c
2930 -@@ -99,9 +99,7 @@ static void yurex_delete(struct kref *kref)
2931 - usb_put_dev(dev->udev);
2932 - if (dev->cntl_urb) {
2933 - usb_kill_urb(dev->cntl_urb);
2934 -- if (dev->cntl_req)
2935 -- usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
2936 -- dev->cntl_req, dev->cntl_urb->setup_dma);
2937 -+ kfree(dev->cntl_req);
2938 - if (dev->cntl_buffer)
2939 - usb_free_coherent(dev->udev, YUREX_BUF_SIZE,
2940 - dev->cntl_buffer, dev->cntl_urb->transfer_dma);
2941 -@@ -234,9 +232,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
2942 - }
2943 -
2944 - /* allocate buffer for control req */
2945 -- dev->cntl_req = usb_alloc_coherent(dev->udev, YUREX_BUF_SIZE,
2946 -- GFP_KERNEL,
2947 -- &dev->cntl_urb->setup_dma);
2948 -+ dev->cntl_req = kmalloc(YUREX_BUF_SIZE, GFP_KERNEL);
2949 - if (!dev->cntl_req) {
2950 - err("Could not allocate cntl_req");
2951 - goto error;
2952 -@@ -286,7 +282,7 @@ static int yurex_probe(struct usb_interface *interface, const struct usb_device_
2953 - usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr),
2954 - dev->int_buffer, YUREX_BUF_SIZE, yurex_interrupt,
2955 - dev, 1);
2956 -- dev->cntl_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
2957 -+ dev->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
2958 - if (usb_submit_urb(dev->urb, GFP_KERNEL)) {
2959 - retval = -EIO;
2960 - err("Could not submitting URB");
2961 -diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
2962 -index ba85f27..a8f0c09 100644
2963 ---- a/drivers/usb/musb/omap2430.c
2964 -+++ b/drivers/usb/musb/omap2430.c
2965 -@@ -282,7 +282,8 @@ static int musb_otg_notifications(struct notifier_block *nb,
2966 -
2967 - static int omap2430_musb_init(struct musb *musb)
2968 - {
2969 -- u32 l, status = 0;
2970 -+ u32 l;
2971 -+ int status = 0;
2972 - struct device *dev = musb->controller;
2973 - struct musb_hdrc_platform_data *plat = dev->platform_data;
2974 - struct omap_musb_board_data *data = plat->board_data;
2975 -@@ -299,7 +300,7 @@ static int omap2430_musb_init(struct musb *musb)
2976 -
2977 - status = pm_runtime_get_sync(dev);
2978 - if (status < 0) {
2979 -- dev_err(dev, "pm_runtime_get_sync FAILED");
2980 -+ dev_err(dev, "pm_runtime_get_sync FAILED %d\n", status);
2981 - goto err1;
2982 - }
2983 -
2984 -@@ -451,14 +452,14 @@ static int __init omap2430_probe(struct platform_device *pdev)
2985 - goto err2;
2986 - }
2987 -
2988 -+ pm_runtime_enable(&pdev->dev);
2989 -+
2990 - ret = platform_device_add(musb);
2991 - if (ret) {
2992 - dev_err(&pdev->dev, "failed to register musb device\n");
2993 - goto err2;
2994 - }
2995 -
2996 -- pm_runtime_enable(&pdev->dev);
2997 --
2998 - return 0;
2999 -
3000 - err2:
3001 -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
3002 -index 4c12404..f2c57e0 100644
3003 ---- a/drivers/usb/serial/cp210x.c
3004 -+++ b/drivers/usb/serial/cp210x.c
3005 -@@ -285,7 +285,8 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,
3006 - /* Issue the request, attempting to read 'size' bytes */
3007 - result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
3008 - request, REQTYPE_DEVICE_TO_HOST, 0x0000,
3009 -- port_priv->bInterfaceNumber, buf, size, 300);
3010 -+ port_priv->bInterfaceNumber, buf, size,
3011 -+ USB_CTRL_GET_TIMEOUT);
3012 -
3013 - /* Convert data into an array of integers */
3014 - for (i = 0; i < length; i++)
3015 -@@ -335,12 +336,14 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,
3016 - result = usb_control_msg(serial->dev,
3017 - usb_sndctrlpipe(serial->dev, 0),
3018 - request, REQTYPE_HOST_TO_DEVICE, 0x0000,
3019 -- port_priv->bInterfaceNumber, buf, size, 300);
3020 -+ port_priv->bInterfaceNumber, buf, size,
3021 -+ USB_CTRL_SET_TIMEOUT);
3022 - } else {
3023 - result = usb_control_msg(serial->dev,
3024 - usb_sndctrlpipe(serial->dev, 0),
3025 - request, REQTYPE_HOST_TO_DEVICE, data[0],
3026 -- port_priv->bInterfaceNumber, NULL, 0, 300);
3027 -+ port_priv->bInterfaceNumber, NULL, 0,
3028 -+ USB_CTRL_SET_TIMEOUT);
3029 - }
3030 -
3031 - kfree(buf);
3032 -diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
3033 -index 7c3ec9e..e093585 100644
3034 ---- a/drivers/usb/serial/sierra.c
3035 -+++ b/drivers/usb/serial/sierra.c
3036 -@@ -221,7 +221,7 @@ static const struct sierra_iface_info typeB_interface_list = {
3037 - };
3038 -
3039 - /* 'blacklist' of interfaces not served by this driver */
3040 --static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11 };
3041 -+static const u8 direct_ip_non_serial_ifaces[] = { 7, 8, 9, 10, 11, 19, 20 };
3042 - static const struct sierra_iface_info direct_ip_interface_blacklist = {
3043 - .infolen = ARRAY_SIZE(direct_ip_non_serial_ifaces),
3044 - .ifaceinfo = direct_ip_non_serial_ifaces,
3045 -@@ -289,7 +289,6 @@ static const struct usb_device_id id_table[] = {
3046 - { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */
3047 - { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */
3048 - { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */
3049 -- { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */
3050 - /* Sierra Wireless C885 */
3051 - { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)},
3052 - /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
3053 -@@ -299,6 +298,9 @@ static const struct usb_device_id id_table[] = {
3054 - /* Sierra Wireless HSPA Non-Composite Device */
3055 - { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)},
3056 - { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */
3057 -+ { USB_DEVICE(0x1199, 0x68A2), /* Sierra Wireless MC77xx in QMI mode */
3058 -+ .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
3059 -+ },
3060 - { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */
3061 - .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist
3062 - },
3063 -diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
3064 -index 2babcd4..86685e9 100644
3065 ---- a/drivers/uwb/hwa-rc.c
3066 -+++ b/drivers/uwb/hwa-rc.c
3067 -@@ -645,7 +645,8 @@ void hwarc_neep_cb(struct urb *urb)
3068 - dev_err(dev, "NEEP: URB error %d\n", urb->status);
3069 - }
3070 - result = usb_submit_urb(urb, GFP_ATOMIC);
3071 -- if (result < 0) {
3072 -+ if (result < 0 && result != -ENODEV && result != -EPERM) {
3073 -+ /* ignoring unrecoverable errors */
3074 - dev_err(dev, "NEEP: Can't resubmit URB (%d) resetting device\n",
3075 - result);
3076 - goto error;
3077 -diff --git a/drivers/uwb/neh.c b/drivers/uwb/neh.c
3078 -index a269937..8cb71bb 100644
3079 ---- a/drivers/uwb/neh.c
3080 -+++ b/drivers/uwb/neh.c
3081 -@@ -107,6 +107,7 @@ struct uwb_rc_neh {
3082 - u8 evt_type;
3083 - __le16 evt;
3084 - u8 context;
3085 -+ u8 completed;
3086 - uwb_rc_cmd_cb_f cb;
3087 - void *arg;
3088 -
3089 -@@ -409,6 +410,7 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
3090 - struct device *dev = &rc->uwb_dev.dev;
3091 - struct uwb_rc_neh *neh;
3092 - struct uwb_rceb *notif;
3093 -+ unsigned long flags;
3094 -
3095 - if (rceb->bEventContext == 0) {
3096 - notif = kmalloc(size, GFP_ATOMIC);
3097 -@@ -422,7 +424,11 @@ static void uwb_rc_neh_grok_event(struct uwb_rc *rc, struct uwb_rceb *rceb, size
3098 - } else {
3099 - neh = uwb_rc_neh_lookup(rc, rceb);
3100 - if (neh) {
3101 -- del_timer_sync(&neh->timer);
3102 -+ spin_lock_irqsave(&rc->neh_lock, flags);
3103 -+ /* to guard against a timeout */
3104 -+ neh->completed = 1;
3105 -+ del_timer(&neh->timer);
3106 -+ spin_unlock_irqrestore(&rc->neh_lock, flags);
3107 - uwb_rc_neh_cb(neh, rceb, size);
3108 - } else
3109 - dev_warn(dev, "event 0x%02x/%04x/%02x (%zu bytes): nobody cared\n",
3110 -@@ -568,6 +574,10 @@ static void uwb_rc_neh_timer(unsigned long arg)
3111 - unsigned long flags;
3112 -
3113 - spin_lock_irqsave(&rc->neh_lock, flags);
3114 -+ if (neh->completed) {
3115 -+ spin_unlock_irqrestore(&rc->neh_lock, flags);
3116 -+ return;
3117 -+ }
3118 - if (neh->context)
3119 - __uwb_rc_neh_rm(rc, neh);
3120 - else
3121 -diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
3122 -index afca14d..625890c 100644
3123 ---- a/drivers/xen/gntdev.c
3124 -+++ b/drivers/xen/gntdev.c
3125 -@@ -692,7 +692,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
3126 - vma->vm_flags |= VM_RESERVED|VM_DONTEXPAND;
3127 -
3128 - if (use_ptemod)
3129 -- vma->vm_flags |= VM_DONTCOPY|VM_PFNMAP;
3130 -+ vma->vm_flags |= VM_DONTCOPY;
3131 -
3132 - vma->vm_private_data = map;
3133 -
3134 -diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
3135 -index 2f73195..2ce95c0 100644
3136 ---- a/drivers/xen/xenbus/xenbus_probe_frontend.c
3137 -+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
3138 -@@ -129,7 +129,7 @@ static int read_backend_details(struct xenbus_device *xendev)
3139 - return xenbus_read_otherend_details(xendev, "backend-id", "backend");
3140 - }
3141 -
3142 --static int is_device_connecting(struct device *dev, void *data)
3143 -+static int is_device_connecting(struct device *dev, void *data, bool ignore_nonessential)
3144 - {
3145 - struct xenbus_device *xendev = to_xenbus_device(dev);
3146 - struct device_driver *drv = data;
3147 -@@ -146,16 +146,41 @@ static int is_device_connecting(struct device *dev, void *data)
3148 - if (drv && (dev->driver != drv))
3149 - return 0;
3150 -
3151 -+ if (ignore_nonessential) {
3152 -+ /* With older QEMU, for PVonHVM guests the guest config files
3153 -+ * could contain: vfb = [ 'vnc=1, vnclisten=0.0.0.0']
3154 -+ * which is nonsensical as there is no PV FB (there can be
3155 -+ * a PVKB) running as HVM guest. */
3156 -+
3157 -+ if ((strncmp(xendev->nodename, "device/vkbd", 11) == 0))
3158 -+ return 0;
3159 -+
3160 -+ if ((strncmp(xendev->nodename, "device/vfb", 10) == 0))
3161 -+ return 0;
3162 -+ }
3163 - xendrv = to_xenbus_driver(dev->driver);
3164 - return (xendev->state < XenbusStateConnected ||
3165 - (xendev->state == XenbusStateConnected &&
3166 - xendrv->is_ready && !xendrv->is_ready(xendev)));
3167 - }
3168 -+static int essential_device_connecting(struct device *dev, void *data)
3169 -+{
3170 -+ return is_device_connecting(dev, data, true /* ignore PV[KBB+FB] */);
3171 -+}
3172 -+static int non_essential_device_connecting(struct device *dev, void *data)
3173 -+{
3174 -+ return is_device_connecting(dev, data, false);
3175 -+}
3176 -
3177 --static int exists_connecting_device(struct device_driver *drv)
3178 -+static int exists_essential_connecting_device(struct device_driver *drv)
3179 - {
3180 - return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
3181 -- is_device_connecting);
3182 -+ essential_device_connecting);
3183 -+}
3184 -+static int exists_non_essential_connecting_device(struct device_driver *drv)
3185 -+{
3186 -+ return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
3187 -+ non_essential_device_connecting);
3188 - }
3189 -
3190 - static int print_device_status(struct device *dev, void *data)
3191 -@@ -186,6 +211,23 @@ static int print_device_status(struct device *dev, void *data)
3192 - /* We only wait for device setup after most initcalls have run. */
3193 - static int ready_to_wait_for_devices;
3194 -
3195 -+static bool wait_loop(unsigned long start, unsigned int max_delay,
3196 -+ unsigned int *seconds_waited)
3197 -+{
3198 -+ if (time_after(jiffies, start + (*seconds_waited+5)*HZ)) {
3199 -+ if (!*seconds_waited)
3200 -+ printk(KERN_WARNING "XENBUS: Waiting for "
3201 -+ "devices to initialise: ");
3202 -+ *seconds_waited += 5;
3203 -+ printk("%us...", max_delay - *seconds_waited);
3204 -+ if (*seconds_waited == max_delay)
3205 -+ return true;
3206 -+ }
3207 -+
3208 -+ schedule_timeout_interruptible(HZ/10);
3209 -+
3210 -+ return false;
3211 -+}
3212 - /*
3213 - * On a 5-minute timeout, wait for all devices currently configured. We need
3214 - * to do this to guarantee that the filesystems and / or network devices
3215 -@@ -209,19 +251,14 @@ static void wait_for_devices(struct xenbus_driver *xendrv)
3216 - if (!ready_to_wait_for_devices || !xen_domain())
3217 - return;
3218 -
3219 -- while (exists_connecting_device(drv)) {
3220 -- if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
3221 -- if (!seconds_waited)
3222 -- printk(KERN_WARNING "XENBUS: Waiting for "
3223 -- "devices to initialise: ");
3224 -- seconds_waited += 5;
3225 -- printk("%us...", 300 - seconds_waited);
3226 -- if (seconds_waited == 300)
3227 -- break;
3228 -- }
3229 --
3230 -- schedule_timeout_interruptible(HZ/10);
3231 -- }
3232 -+ while (exists_non_essential_connecting_device(drv))
3233 -+ if (wait_loop(start, 30, &seconds_waited))
3234 -+ break;
3235 -+
3236 -+ /* Skips PVKB and PVFB check.*/
3237 -+ while (exists_essential_connecting_device(drv))
3238 -+ if (wait_loop(start, 270, &seconds_waited))
3239 -+ break;
3240 -
3241 - if (seconds_waited)
3242 - printk("\n");
3243 -diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
3244 -index 308a98b..650d520 100644
3245 ---- a/fs/autofs4/autofs_i.h
3246 -+++ b/fs/autofs4/autofs_i.h
3247 -@@ -110,7 +110,6 @@ struct autofs_sb_info {
3248 - int sub_version;
3249 - int min_proto;
3250 - int max_proto;
3251 -- int compat_daemon;
3252 - unsigned long exp_timeout;
3253 - unsigned int type;
3254 - int reghost_enabled;
3255 -@@ -269,6 +268,17 @@ int autofs4_fill_super(struct super_block *, void *, int);
3256 - struct autofs_info *autofs4_new_ino(struct autofs_sb_info *);
3257 - void autofs4_clean_ino(struct autofs_info *);
3258 -
3259 -+static inline int autofs_prepare_pipe(struct file *pipe)
3260 -+{
3261 -+ if (!pipe->f_op || !pipe->f_op->write)
3262 -+ return -EINVAL;
3263 -+ if (!S_ISFIFO(pipe->f_dentry->d_inode->i_mode))
3264 -+ return -EINVAL;
3265 -+ /* We want a packet pipe */
3266 -+ pipe->f_flags |= O_DIRECT;
3267 -+ return 0;
3268 -+}
3269 -+
3270 - /* Queue management functions */
3271 -
3272 - int autofs4_wait(struct autofs_sb_info *,struct dentry *, enum autofs_notify);
3273 -diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c
3274 -index 56bac70..de54271 100644
3275 ---- a/fs/autofs4/dev-ioctl.c
3276 -+++ b/fs/autofs4/dev-ioctl.c
3277 -@@ -376,7 +376,7 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
3278 - err = -EBADF;
3279 - goto out;
3280 - }
3281 -- if (!pipe->f_op || !pipe->f_op->write) {
3282 -+ if (autofs_prepare_pipe(pipe) < 0) {
3283 - err = -EPIPE;
3284 - fput(pipe);
3285 - goto out;
3286 -@@ -385,7 +385,6 @@ static int autofs_dev_ioctl_setpipefd(struct file *fp,
3287 - sbi->pipefd = pipefd;
3288 - sbi->pipe = pipe;
3289 - sbi->catatonic = 0;
3290 -- sbi->compat_daemon = is_compat_task();
3291 - }
3292 - out:
3293 - mutex_unlock(&sbi->wq_mutex);
3294 -diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
3295 -index 98a5695..7b5293e 100644
3296 ---- a/fs/autofs4/inode.c
3297 -+++ b/fs/autofs4/inode.c
3298 -@@ -19,7 +19,6 @@
3299 - #include <linux/parser.h>
3300 - #include <linux/bitops.h>
3301 - #include <linux/magic.h>
3302 --#include <linux/compat.h>
3303 - #include "autofs_i.h"
3304 - #include <linux/module.h>
3305 -
3306 -@@ -225,7 +224,6 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
3307 - set_autofs_type_indirect(&sbi->type);
3308 - sbi->min_proto = 0;
3309 - sbi->max_proto = 0;
3310 -- sbi->compat_daemon = is_compat_task();
3311 - mutex_init(&sbi->wq_mutex);
3312 - spin_lock_init(&sbi->fs_lock);
3313 - sbi->queues = NULL;
3314 -@@ -294,7 +292,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
3315 - printk("autofs: could not open pipe file descriptor\n");
3316 - goto fail_dput;
3317 - }
3318 -- if (!pipe->f_op || !pipe->f_op->write)
3319 -+ if (autofs_prepare_pipe(pipe) < 0)
3320 - goto fail_fput;
3321 - sbi->pipe = pipe;
3322 - sbi->pipefd = pipefd;
3323 -diff --git a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
3324 -index 6861f61..e1fbdee 100644
3325 ---- a/fs/autofs4/waitq.c
3326 -+++ b/fs/autofs4/waitq.c
3327 -@@ -90,24 +90,7 @@ static int autofs4_write(struct file *file, const void *addr, int bytes)
3328 -
3329 - return (bytes > 0);
3330 - }
3331 --
3332 --/*
3333 -- * The autofs_v5 packet was misdesigned.
3334 -- *
3335 -- * The packets are identical on x86-32 and x86-64, but have different
3336 -- * alignment. Which means that 'sizeof()' will give different results.
3337 -- * Fix it up for the case of running 32-bit user mode on a 64-bit kernel.
3338 -- */
3339 --static noinline size_t autofs_v5_packet_size(struct autofs_sb_info *sbi)
3340 --{
3341 -- size_t pktsz = sizeof(struct autofs_v5_packet);
3342 --#if defined(CONFIG_X86_64) && defined(CONFIG_COMPAT)
3343 -- if (sbi->compat_daemon > 0)
3344 -- pktsz -= 4;
3345 --#endif
3346 -- return pktsz;
3347 --}
3348 --
3349 -+
3350 - static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
3351 - struct autofs_wait_queue *wq,
3352 - int type)
3353 -@@ -164,7 +147,8 @@ static void autofs4_notify_daemon(struct autofs_sb_info *sbi,
3354 - {
3355 - struct autofs_v5_packet *packet = &pkt.v5_pkt.v5_packet;
3356 -
3357 -- pktsz = autofs_v5_packet_size(sbi);
3358 -+ pktsz = sizeof(*packet);
3359 -+
3360 - packet->wait_queue_token = wq->wait_queue_token;
3361 - packet->len = wq->name.len;
3362 - memcpy(packet->name, wq->name.name, wq->name.len);
3363 -diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
3364 -index 6738503..83a871f 100644
3365 ---- a/fs/btrfs/ctree.h
3366 -+++ b/fs/btrfs/ctree.h
3367 -@@ -2025,7 +2025,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
3368 -
3369 - static inline bool btrfs_root_readonly(struct btrfs_root *root)
3370 - {
3371 -- return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY;
3372 -+ return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
3373 - }
3374 -
3375 - /* struct btrfs_root_backup */
3376 -diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
3377 -index 0e6adac..e89803b 100644
3378 ---- a/fs/cifs/cifssmb.c
3379 -+++ b/fs/cifs/cifssmb.c
3380 -@@ -4826,8 +4826,12 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
3381 - max_len = data_end - temp;
3382 - node->node_name = cifs_strndup_from_ucs(temp, max_len,
3383 - is_unicode, nls_codepage);
3384 -- if (!node->node_name)
3385 -+ if (!node->node_name) {
3386 - rc = -ENOMEM;
3387 -+ goto parse_DFS_referrals_exit;
3388 -+ }
3389 -+
3390 -+ ref++;
3391 - }
3392 -
3393 - parse_DFS_referrals_exit:
3394 -diff --git a/fs/eventpoll.c b/fs/eventpoll.c
3395 -index ea54cde..4d9d3a4 100644
3396 ---- a/fs/eventpoll.c
3397 -+++ b/fs/eventpoll.c
3398 -@@ -988,6 +988,10 @@ static int path_count[PATH_ARR_SIZE];
3399 -
3400 - static int path_count_inc(int nests)
3401 - {
3402 -+ /* Allow an arbitrary number of depth 1 paths */
3403 -+ if (nests == 0)
3404 -+ return 0;
3405 -+
3406 - if (++path_count[nests] > path_limits[nests])
3407 - return -1;
3408 - return 0;
3409 -diff --git a/fs/exec.c b/fs/exec.c
3410 -index 3625464..160cd2f 100644
3411 ---- a/fs/exec.c
3412 -+++ b/fs/exec.c
3413 -@@ -973,6 +973,9 @@ static int de_thread(struct task_struct *tsk)
3414 - sig->notify_count = 0;
3415 -
3416 - no_thread_group:
3417 -+ /* we have changed execution domain */
3418 -+ tsk->exit_signal = SIGCHLD;
3419 -+
3420 - if (current->mm)
3421 - setmax_mm_hiwater_rss(&sig->maxrss, current->mm);
3422 -
3423 -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
3424 -index c2a2012..54f2bdc 100644
3425 ---- a/fs/ext4/extents.c
3426 -+++ b/fs/ext4/extents.c
3427 -@@ -2812,7 +2812,7 @@ static int ext4_split_extent_at(handle_t *handle,
3428 - if (err)
3429 - goto fix_extent_len;
3430 - /* update the extent length and mark as initialized */
3431 -- ex->ee_len = cpu_to_le32(ee_len);
3432 -+ ex->ee_len = cpu_to_le16(ee_len);
3433 - ext4_ext_try_to_merge(inode, path, ex);
3434 - err = ext4_ext_dirty(handle, inode, path + depth);
3435 - goto out;
3436 -diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c
3437 -index 4dfbfec..ec2a9c2 100644
3438 ---- a/fs/hfsplus/catalog.c
3439 -+++ b/fs/hfsplus/catalog.c
3440 -@@ -366,6 +366,10 @@ int hfsplus_rename_cat(u32 cnid,
3441 - err = hfs_brec_find(&src_fd);
3442 - if (err)
3443 - goto out;
3444 -+ if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
3445 -+ err = -EIO;
3446 -+ goto out;
3447 -+ }
3448 -
3449 - hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
3450 - src_fd.entrylength);
3451 -diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
3452 -index 4536cd3..5adb740 100644
3453 ---- a/fs/hfsplus/dir.c
3454 -+++ b/fs/hfsplus/dir.c
3455 -@@ -150,6 +150,11 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
3456 - filp->f_pos++;
3457 - /* fall through */
3458 - case 1:
3459 -+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
3460 -+ err = -EIO;
3461 -+ goto out;
3462 -+ }
3463 -+
3464 - hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
3465 - fd.entrylength);
3466 - if (be16_to_cpu(entry.type) != HFSPLUS_FOLDER_THREAD) {
3467 -@@ -181,6 +186,12 @@ static int hfsplus_readdir(struct file *filp, void *dirent, filldir_t filldir)
3468 - err = -EIO;
3469 - goto out;
3470 - }
3471 -+
3472 -+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
3473 -+ err = -EIO;
3474 -+ goto out;
3475 -+ }
3476 -+
3477 - hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
3478 - fd.entrylength);
3479 - type = be16_to_cpu(entry.type);
3480 -diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
3481 -index 68d704d..d751f04 100644
3482 ---- a/fs/jbd2/commit.c
3483 -+++ b/fs/jbd2/commit.c
3484 -@@ -683,7 +683,7 @@ start_journal_io:
3485 - if (commit_transaction->t_need_data_flush &&
3486 - (journal->j_fs_dev != journal->j_dev) &&
3487 - (journal->j_flags & JBD2_BARRIER))
3488 -- blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
3489 -+ blkdev_issue_flush(journal->j_fs_dev, GFP_NOFS, NULL);
3490 -
3491 - /* Done it all: now write the commit record asynchronously. */
3492 - if (JBD2_HAS_INCOMPAT_FEATURE(journal,
3493 -@@ -819,7 +819,7 @@ wait_for_iobuf:
3494 - if (JBD2_HAS_INCOMPAT_FEATURE(journal,
3495 - JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
3496 - journal->j_flags & JBD2_BARRIER) {
3497 -- blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL);
3498 -+ blkdev_issue_flush(journal->j_dev, GFP_NOFS, NULL);
3499 - }
3500 -
3501 - if (err)
3502 -diff --git a/fs/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
3503 -index f848b52..046bb77 100644
3504 ---- a/fs/lockd/clnt4xdr.c
3505 -+++ b/fs/lockd/clnt4xdr.c
3506 -@@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
3507 - p = xdr_inline_decode(xdr, 4);
3508 - if (unlikely(p == NULL))
3509 - goto out_overflow;
3510 -- if (unlikely(*p > nlm4_failed))
3511 -+ if (unlikely(ntohl(*p) > ntohl(nlm4_failed)))
3512 - goto out_bad_xdr;
3513 - *stat = *p;
3514 - return 0;
3515 -diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
3516 -index 180ac34..36057ce 100644
3517 ---- a/fs/lockd/clntxdr.c
3518 -+++ b/fs/lockd/clntxdr.c
3519 -@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
3520 - p = xdr_inline_decode(xdr, 4);
3521 - if (unlikely(p == NULL))
3522 - goto out_overflow;
3523 -- if (unlikely(*p > nlm_lck_denied_grace_period))
3524 -+ if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period)))
3525 - goto out_enum;
3526 - *stat = *p;
3527 - return 0;
3528 -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
3529 -index 757293b..51f6a40 100644
3530 ---- a/fs/nfs/nfs4proc.c
3531 -+++ b/fs/nfs/nfs4proc.c
3532 -@@ -4453,7 +4453,9 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
3533 - static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
3534 - {
3535 - struct nfs_server *server = NFS_SERVER(state->inode);
3536 -- struct nfs4_exception exception = { };
3537 -+ struct nfs4_exception exception = {
3538 -+ .inode = state->inode,
3539 -+ };
3540 - int err;
3541 -
3542 - do {
3543 -@@ -4471,7 +4473,9 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
3544 - static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
3545 - {
3546 - struct nfs_server *server = NFS_SERVER(state->inode);
3547 -- struct nfs4_exception exception = { };
3548 -+ struct nfs4_exception exception = {
3549 -+ .inode = state->inode,
3550 -+ };
3551 - int err;
3552 -
3553 - err = nfs4_set_lock_state(state, request);
3554 -@@ -4551,6 +4555,7 @@ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *
3555 - {
3556 - struct nfs4_exception exception = {
3557 - .state = state,
3558 -+ .inode = state->inode,
3559 - };
3560 - int err;
3561 -
3562 -@@ -4596,6 +4601,20 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
3563 -
3564 - if (state == NULL)
3565 - return -ENOLCK;
3566 -+ /*
3567 -+ * Don't rely on the VFS having checked the file open mode,
3568 -+ * since it won't do this for flock() locks.
3569 -+ */
3570 -+ switch (request->fl_type & (F_RDLCK|F_WRLCK|F_UNLCK)) {
3571 -+ case F_RDLCK:
3572 -+ if (!(filp->f_mode & FMODE_READ))
3573 -+ return -EBADF;
3574 -+ break;
3575 -+ case F_WRLCK:
3576 -+ if (!(filp->f_mode & FMODE_WRITE))
3577 -+ return -EBADF;
3578 -+ }
3579 -+
3580 - do {
3581 - status = nfs4_proc_setlk(state, cmd, request);
3582 - if ((status != -EAGAIN) || IS_SETLK(cmd))
3583 -diff --git a/fs/nfs/read.c b/fs/nfs/read.c
3584 -index cfa175c..41bae32 100644
3585 ---- a/fs/nfs/read.c
3586 -+++ b/fs/nfs/read.c
3587 -@@ -324,7 +324,7 @@ out_bad:
3588 - while (!list_empty(res)) {
3589 - data = list_entry(res->next, struct nfs_read_data, list);
3590 - list_del(&data->list);
3591 -- nfs_readdata_free(data);
3592 -+ nfs_readdata_release(data);
3593 - }
3594 - nfs_readpage_release(req);
3595 - return -ENOMEM;
3596 -diff --git a/fs/nfs/super.c b/fs/nfs/super.c
3597 -index 3ada13c..376cd65 100644
3598 ---- a/fs/nfs/super.c
3599 -+++ b/fs/nfs/super.c
3600 -@@ -2708,11 +2708,15 @@ static struct vfsmount *nfs_do_root_mount(struct file_system_type *fs_type,
3601 - char *root_devname;
3602 - size_t len;
3603 -
3604 -- len = strlen(hostname) + 3;
3605 -+ len = strlen(hostname) + 5;
3606 - root_devname = kmalloc(len, GFP_KERNEL);
3607 - if (root_devname == NULL)
3608 - return ERR_PTR(-ENOMEM);
3609 -- snprintf(root_devname, len, "%s:/", hostname);
3610 -+ /* Does hostname needs to be enclosed in brackets? */
3611 -+ if (strchr(hostname, ':'))
3612 -+ snprintf(root_devname, len, "[%s]:/", hostname);
3613 -+ else
3614 -+ snprintf(root_devname, len, "%s:/", hostname);
3615 - root_mnt = vfs_kern_mount(fs_type, flags, root_devname, data);
3616 - kfree(root_devname);
3617 - return root_mnt;
3618 -diff --git a/fs/nfs/write.c b/fs/nfs/write.c
3619 -index 1dda78d..4efd421 100644
3620 ---- a/fs/nfs/write.c
3621 -+++ b/fs/nfs/write.c
3622 -@@ -974,7 +974,7 @@ out_bad:
3623 - while (!list_empty(res)) {
3624 - data = list_entry(res->next, struct nfs_write_data, list);
3625 - list_del(&data->list);
3626 -- nfs_writedata_free(data);
3627 -+ nfs_writedata_release(data);
3628 - }
3629 - nfs_redirty_request(req);
3630 - return -ENOMEM;
3631 -diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
3632 -index 08c6e36..43f46cd 100644
3633 ---- a/fs/nfsd/nfs3xdr.c
3634 -+++ b/fs/nfsd/nfs3xdr.c
3635 -@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
3636 - return p;
3637 - }
3638 -
3639 --static int
3640 -+static __be32
3641 - compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
3642 - const char *name, int namlen)
3643 - {
3644 - struct svc_export *exp;
3645 - struct dentry *dparent, *dchild;
3646 -- int rv = 0;
3647 -+ __be32 rv = nfserr_noent;
3648 -
3649 - dparent = cd->fh.fh_dentry;
3650 - exp = cd->fh.fh_export;
3651 -@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
3652 - if (isdotent(name, namlen)) {
3653 - if (namlen == 2) {
3654 - dchild = dget_parent(dparent);
3655 -- if (dchild == dparent) {
3656 -- /* filesystem root - cannot return filehandle for ".." */
3657 -- dput(dchild);
3658 -- return -ENOENT;
3659 -- }
3660 -+ /* filesystem root - cannot return filehandle for ".." */
3661 -+ if (dchild == dparent)
3662 -+ goto out;
3663 - } else
3664 - dchild = dget(dparent);
3665 - } else
3666 - dchild = lookup_one_len(name, dparent, namlen);
3667 - if (IS_ERR(dchild))
3668 -- return -ENOENT;
3669 -- rv = -ENOENT;
3670 -+ return rv;
3671 - if (d_mountpoint(dchild))
3672 - goto out;
3673 -- rv = fh_compose(fhp, exp, dchild, &cd->fh);
3674 -- if (rv)
3675 -- goto out;
3676 - if (!dchild->d_inode)
3677 - goto out;
3678 -- rv = 0;
3679 -+ rv = fh_compose(fhp, exp, dchild, &cd->fh);
3680 - out:
3681 - dput(dchild);
3682 - return rv;
3683 -@@ -845,7 +839,7 @@ out:
3684 - static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
3685 - {
3686 - struct svc_fh fh;
3687 -- int err;
3688 -+ __be32 err;
3689 -
3690 - fh_init(&fh, NFS3_FHSIZE);
3691 - err = compose_entry_fh(cd, &fh, name, namlen);
3692 -diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
3693 -index fa38336..b8c5538 100644
3694 ---- a/fs/nfsd/nfs4proc.c
3695 -+++ b/fs/nfsd/nfs4proc.c
3696 -@@ -231,17 +231,17 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
3697 - */
3698 - if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
3699 - open->op_bmval[1] = (FATTR4_WORD1_TIME_ACCESS |
3700 -- FATTR4_WORD1_TIME_MODIFY);
3701 -+ FATTR4_WORD1_TIME_MODIFY);
3702 - } else {
3703 - status = nfsd_lookup(rqstp, current_fh,
3704 - open->op_fname.data, open->op_fname.len, &resfh);
3705 - fh_unlock(current_fh);
3706 -- if (status)
3707 -- goto out;
3708 -- status = nfsd_check_obj_isreg(&resfh);
3709 - }
3710 - if (status)
3711 - goto out;
3712 -+ status = nfsd_check_obj_isreg(&resfh);
3713 -+ if (status)
3714 -+ goto out;
3715 -
3716 - if (is_create_with_attrs(open) && open->op_acl != NULL)
3717 - do_set_nfs4_acl(rqstp, &resfh, open->op_acl, open->op_bmval);
3718 -@@ -827,6 +827,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3719 - struct nfsd4_setattr *setattr)
3720 - {
3721 - __be32 status = nfs_ok;
3722 -+ int err;
3723 -
3724 - if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
3725 - nfs4_lock_state();
3726 -@@ -838,9 +839,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3727 - return status;
3728 - }
3729 - }
3730 -- status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
3731 -- if (status)
3732 -- return status;
3733 -+ err = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
3734 -+ if (err)
3735 -+ return nfserrno(err);
3736 - status = nfs_ok;
3737 -
3738 - status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
3739 -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
3740 -index 5abced7..4cfe260 100644
3741 ---- a/fs/nfsd/nfs4state.c
3742 -+++ b/fs/nfsd/nfs4state.c
3743 -@@ -4080,16 +4080,14 @@ out:
3744 - * vfs_test_lock. (Arguably perhaps test_lock should be done with an
3745 - * inode operation.)
3746 - */
3747 --static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
3748 -+static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
3749 - {
3750 - struct file *file;
3751 -- int err;
3752 --
3753 -- err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
3754 -- if (err)
3755 -- return err;
3756 -- err = vfs_test_lock(file, lock);
3757 -- nfsd_close(file);
3758 -+ __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
3759 -+ if (!err) {
3760 -+ err = nfserrno(vfs_test_lock(file, lock));
3761 -+ nfsd_close(file);
3762 -+ }
3763 - return err;
3764 - }
3765 -
3766 -@@ -4103,7 +4101,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3767 - struct inode *inode;
3768 - struct file_lock file_lock;
3769 - struct nfs4_lockowner *lo;
3770 -- int error;
3771 - __be32 status;
3772 -
3773 - if (locks_in_grace())
3774 -@@ -4149,12 +4146,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
3775 -
3776 - nfs4_transform_lock_offset(&file_lock);
3777 -
3778 -- status = nfs_ok;
3779 -- error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
3780 -- if (error) {
3781 -- status = nfserrno(error);
3782 -+ status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
3783 -+ if (status)
3784 - goto out;
3785 -- }
3786 -+
3787 - if (file_lock.fl_type != F_UNLCK) {
3788 - status = nfserr_denied;
3789 - nfs4_set_lock_denied(&file_lock, &lockt->lt_denied);
3790 -diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
3791 -index b6fa792..9cfa60a 100644
3792 ---- a/fs/nfsd/nfs4xdr.c
3793 -+++ b/fs/nfsd/nfs4xdr.c
3794 -@@ -3411,7 +3411,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr,
3795 - nfsd4_decode_stateid(argp, &si);
3796 - valid = nfs4_validate_stateid(cl, &si);
3797 - RESERVE_SPACE(4);
3798 -- *p++ = htonl(valid);
3799 -+ *p++ = valid;
3800 - resp->p = p;
3801 - }
3802 - nfs4_unlock_state();
3803 -diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
3804 -index 7a2e442..5c3cd82 100644
3805 ---- a/fs/nfsd/vfs.c
3806 -+++ b/fs/nfsd/vfs.c
3807 -@@ -1439,7 +1439,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
3808 - switch (createmode) {
3809 - case NFS3_CREATE_UNCHECKED:
3810 - if (! S_ISREG(dchild->d_inode->i_mode))
3811 -- err = nfserr_exist;
3812 -+ goto out;
3813 - else if (truncp) {
3814 - /* in nfsv4, we need to treat this case a little
3815 - * differently. we don't want to truncate the
3816 -diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
3817 -index 3165aeb..31b9463 100644
3818 ---- a/fs/ocfs2/alloc.c
3819 -+++ b/fs/ocfs2/alloc.c
3820 -@@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
3821 - }
3822 -
3823 - el = path_leaf_el(path);
3824 -- rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1];
3825 -+ rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1];
3826 -
3827 - ocfs2_adjust_rightmost_records(handle, et, path, rec);
3828 -
3829 -diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
3830 -index cf78233..9f32d7c 100644
3831 ---- a/fs/ocfs2/refcounttree.c
3832 -+++ b/fs/ocfs2/refcounttree.c
3833 -@@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
3834 -
3835 - tmp_el = left_path->p_node[subtree_root].el;
3836 - blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
3837 -- for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) {
3838 -+ for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) {
3839 - if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
3840 - *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
3841 - break;
3842 - }
3843 - }
3844 -
3845 -- BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec));
3846 -+ BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec));
3847 -
3848 - out:
3849 - ocfs2_free_path(left_path);
3850 -@@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
3851 -
3852 - trace_ocfs2_divide_leaf_refcount_block(
3853 - (unsigned long long)ref_leaf_bh->b_blocknr,
3854 -- le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used));
3855 -+ le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used));
3856 -
3857 - /*
3858 - * XXX: Improvement later.
3859 -@@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
3860 - rb = (struct ocfs2_refcount_block *)
3861 - prev_bh->b_data;
3862 -
3863 -- if (le64_to_cpu(rb->rf_records.rl_used) +
3864 -+ if (le16_to_cpu(rb->rf_records.rl_used) +
3865 - recs_add >
3866 - le16_to_cpu(rb->rf_records.rl_count))
3867 - ref_blocks++;
3868 -@@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
3869 - if (prev_bh) {
3870 - rb = (struct ocfs2_refcount_block *)prev_bh->b_data;
3871 -
3872 -- if (le64_to_cpu(rb->rf_records.rl_used) + recs_add >
3873 -+ if (le16_to_cpu(rb->rf_records.rl_used) + recs_add >
3874 - le16_to_cpu(rb->rf_records.rl_count))
3875 - ref_blocks++;
3876 -
3877 -@@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
3878 - * one will split a refcount rec, so totally we need
3879 - * clusters * 2 new refcount rec.
3880 - */
3881 -- if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 >
3882 -+ if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 >
3883 - le16_to_cpu(rb->rf_records.rl_count))
3884 - ref_blocks++;
3885 -
3886 -diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
3887 -index ba5d97e..f169da4 100644
3888 ---- a/fs/ocfs2/suballoc.c
3889 -+++ b/fs/ocfs2/suballoc.c
3890 -@@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle,
3891 - ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode,
3892 - cluster_ac->ac_bh,
3893 - le64_to_cpu(rec->e_blkno),
3894 -- le32_to_cpu(rec->e_leaf_clusters));
3895 -+ le16_to_cpu(rec->e_leaf_clusters));
3896 - if (ret)
3897 - mlog_errno(ret);
3898 - /* Try all the clusters to free */
3899 -@@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res,
3900 - {
3901 - unsigned int bpc = le16_to_cpu(cl->cl_bpc);
3902 - unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc;
3903 -- unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc;
3904 -+ unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc;
3905 -
3906 - if (res->sr_bit_offset < bitoff)
3907 - return 0;
3908 -diff --git a/fs/pipe.c b/fs/pipe.c
3909 -index 4065f07..05ed5ca 100644
3910 ---- a/fs/pipe.c
3911 -+++ b/fs/pipe.c
3912 -@@ -345,6 +345,16 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = {
3913 - .get = generic_pipe_buf_get,
3914 - };
3915 -
3916 -+static const struct pipe_buf_operations packet_pipe_buf_ops = {
3917 -+ .can_merge = 0,
3918 -+ .map = generic_pipe_buf_map,
3919 -+ .unmap = generic_pipe_buf_unmap,
3920 -+ .confirm = generic_pipe_buf_confirm,
3921 -+ .release = anon_pipe_buf_release,
3922 -+ .steal = generic_pipe_buf_steal,
3923 -+ .get = generic_pipe_buf_get,
3924 -+};
3925 -+
3926 - static ssize_t
3927 - pipe_read(struct kiocb *iocb, const struct iovec *_iov,
3928 - unsigned long nr_segs, loff_t pos)
3929 -@@ -406,6 +416,13 @@ redo:
3930 - ret += chars;
3931 - buf->offset += chars;
3932 - buf->len -= chars;
3933 -+
3934 -+ /* Was it a packet buffer? Clean up and exit */
3935 -+ if (buf->flags & PIPE_BUF_FLAG_PACKET) {
3936 -+ total_len = chars;
3937 -+ buf->len = 0;
3938 -+ }
3939 -+
3940 - if (!buf->len) {
3941 - buf->ops = NULL;
3942 - ops->release(pipe, buf);
3943 -@@ -458,6 +475,11 @@ redo:
3944 - return ret;
3945 - }
3946 -
3947 -+static inline int is_packetized(struct file *file)
3948 -+{
3949 -+ return (file->f_flags & O_DIRECT) != 0;
3950 -+}
3951 -+
3952 - static ssize_t
3953 - pipe_write(struct kiocb *iocb, const struct iovec *_iov,
3954 - unsigned long nr_segs, loff_t ppos)
3955 -@@ -592,6 +614,11 @@ redo2:
3956 - buf->ops = &anon_pipe_buf_ops;
3957 - buf->offset = 0;
3958 - buf->len = chars;
3959 -+ buf->flags = 0;
3960 -+ if (is_packetized(filp)) {
3961 -+ buf->ops = &packet_pipe_buf_ops;
3962 -+ buf->flags = PIPE_BUF_FLAG_PACKET;
3963 -+ }
3964 - pipe->nrbufs = ++bufs;
3965 - pipe->tmp_page = NULL;
3966 -
3967 -@@ -1012,7 +1039,7 @@ struct file *create_write_pipe(int flags)
3968 - goto err_dentry;
3969 - f->f_mapping = inode->i_mapping;
3970 -
3971 -- f->f_flags = O_WRONLY | (flags & O_NONBLOCK);
3972 -+ f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT));
3973 - f->f_version = 0;
3974 -
3975 - return f;
3976 -@@ -1056,7 +1083,7 @@ int do_pipe_flags(int *fd, int flags)
3977 - int error;
3978 - int fdw, fdr;
3979 -
3980 -- if (flags & ~(O_CLOEXEC | O_NONBLOCK))
3981 -+ if (flags & ~(O_CLOEXEC | O_NONBLOCK | O_DIRECT))
3982 - return -EINVAL;
3983 -
3984 - fw = create_write_pipe(flags);
3985 -diff --git a/fs/splice.c b/fs/splice.c
3986 -index fa2defa..6d0dfb8 100644
3987 ---- a/fs/splice.c
3988 -+++ b/fs/splice.c
3989 -@@ -31,6 +31,7 @@
3990 - #include <linux/uio.h>
3991 - #include <linux/security.h>
3992 - #include <linux/gfp.h>
3993 -+#include <linux/socket.h>
3994 -
3995 - /*
3996 - * Attempt to steal a page from a pipe buffer. This should perhaps go into
3997 -@@ -691,7 +692,9 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe,
3998 - if (!likely(file->f_op && file->f_op->sendpage))
3999 - return -EINVAL;
4000 -
4001 -- more = (sd->flags & SPLICE_F_MORE) || sd->len < sd->total_len;
4002 -+ more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0;
4003 -+ if (sd->len < sd->total_len)
4004 -+ more |= MSG_SENDPAGE_NOTLAST;
4005 - return file->f_op->sendpage(file, buf->page, buf->offset,
4006 - sd->len, &pos, more);
4007 - }
4008 -diff --git a/include/asm-generic/statfs.h b/include/asm-generic/statfs.h
4009 -index 0fd28e0..c749af9 100644
4010 ---- a/include/asm-generic/statfs.h
4011 -+++ b/include/asm-generic/statfs.h
4012 -@@ -15,7 +15,7 @@ typedef __kernel_fsid_t fsid_t;
4013 - * with a 10' pole.
4014 - */
4015 - #ifndef __statfs_word
4016 --#if BITS_PER_LONG == 64
4017 -+#if __BITS_PER_LONG == 64
4018 - #define __statfs_word long
4019 - #else
4020 - #define __statfs_word __u32
4021 -diff --git a/include/linux/efi.h b/include/linux/efi.h
4022 -index 2362a0b..1328d8c 100644
4023 ---- a/include/linux/efi.h
4024 -+++ b/include/linux/efi.h
4025 -@@ -383,7 +383,18 @@ extern int __init efi_setup_pcdp_console(char *);
4026 - #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001
4027 - #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
4028 - #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
4029 --
4030 -+#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008
4031 -+#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010
4032 -+#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020
4033 -+#define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040
4034 -+
4035 -+#define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \
4036 -+ EFI_VARIABLE_BOOTSERVICE_ACCESS | \
4037 -+ EFI_VARIABLE_RUNTIME_ACCESS | \
4038 -+ EFI_VARIABLE_HARDWARE_ERROR_RECORD | \
4039 -+ EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \
4040 -+ EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \
4041 -+ EFI_VARIABLE_APPEND_WRITE)
4042 - /*
4043 - * EFI Device Path information
4044 - */
4045 -diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
4046 -index d526231..35410ef 100644
4047 ---- a/include/linux/kvm_host.h
4048 -+++ b/include/linux/kvm_host.h
4049 -@@ -562,6 +562,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
4050 -
4051 - #ifdef CONFIG_IOMMU_API
4052 - int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
4053 -+void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot);
4054 - int kvm_iommu_map_guest(struct kvm *kvm);
4055 - int kvm_iommu_unmap_guest(struct kvm *kvm);
4056 - int kvm_assign_device(struct kvm *kvm,
4057 -@@ -575,6 +576,11 @@ static inline int kvm_iommu_map_pages(struct kvm *kvm,
4058 - return 0;
4059 - }
4060 -
4061 -+static inline void kvm_iommu_unmap_pages(struct kvm *kvm,
4062 -+ struct kvm_memory_slot *slot)
4063 -+{
4064 -+}
4065 -+
4066 - static inline int kvm_iommu_map_guest(struct kvm *kvm)
4067 - {
4068 - return -ENODEV;
4069 -diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
4070 -index a82ad4d..cbeb586 100644
4071 ---- a/include/linux/netdevice.h
4072 -+++ b/include/linux/netdevice.h
4073 -@@ -2536,8 +2536,6 @@ extern void net_disable_timestamp(void);
4074 - extern void *dev_seq_start(struct seq_file *seq, loff_t *pos);
4075 - extern void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos);
4076 - extern void dev_seq_stop(struct seq_file *seq, void *v);
4077 --extern int dev_seq_open_ops(struct inode *inode, struct file *file,
4078 -- const struct seq_operations *ops);
4079 - #endif
4080 -
4081 - extern int netdev_class_create_file(struct class_attribute *class_attr);
4082 -diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
4083 -index 77257c9..0072a53 100644
4084 ---- a/include/linux/pipe_fs_i.h
4085 -+++ b/include/linux/pipe_fs_i.h
4086 -@@ -8,6 +8,7 @@
4087 - #define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
4088 - #define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
4089 - #define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
4090 -+#define PIPE_BUF_FLAG_PACKET 0x08 /* read() as a packet */
4091 -
4092 - /**
4093 - * struct pipe_buffer - a linux kernel pipe buffer
4094 -diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
4095 -index c6db9fb..bb1fac5 100644
4096 ---- a/include/linux/seqlock.h
4097 -+++ b/include/linux/seqlock.h
4098 -@@ -141,7 +141,7 @@ static inline unsigned __read_seqcount_begin(const seqcount_t *s)
4099 - unsigned ret;
4100 -
4101 - repeat:
4102 -- ret = s->sequence;
4103 -+ ret = ACCESS_ONCE(s->sequence);
4104 - if (unlikely(ret & 1)) {
4105 - cpu_relax();
4106 - goto repeat;
4107 -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
4108 -index 6cf8b53..e689b47 100644
4109 ---- a/include/linux/skbuff.h
4110 -+++ b/include/linux/skbuff.h
4111 -@@ -458,6 +458,7 @@ struct sk_buff {
4112 - union {
4113 - __u32 mark;
4114 - __u32 dropcount;
4115 -+ __u32 avail_size;
4116 - };
4117 -
4118 - __u16 vlan_tci;
4119 -@@ -1326,6 +1327,18 @@ static inline int skb_tailroom(const struct sk_buff *skb)
4120 - }
4121 -
4122 - /**
4123 -+ * skb_availroom - bytes at buffer end
4124 -+ * @skb: buffer to check
4125 -+ *
4126 -+ * Return the number of bytes of free space at the tail of an sk_buff
4127 -+ * allocated by sk_stream_alloc()
4128 -+ */
4129 -+static inline int skb_availroom(const struct sk_buff *skb)
4130 -+{
4131 -+ return skb_is_nonlinear(skb) ? 0 : skb->avail_size - skb->len;
4132 -+}
4133 -+
4134 -+/**
4135 - * skb_reserve - adjust headroom
4136 - * @skb: buffer to alter
4137 - * @len: bytes to move
4138 -diff --git a/include/linux/socket.h b/include/linux/socket.h
4139 -index d0e77f6..ad919e0 100644
4140 ---- a/include/linux/socket.h
4141 -+++ b/include/linux/socket.h
4142 -@@ -265,7 +265,7 @@ struct ucred {
4143 - #define MSG_NOSIGNAL 0x4000 /* Do not generate SIGPIPE */
4144 - #define MSG_MORE 0x8000 /* Sender will send more */
4145 - #define MSG_WAITFORONE 0x10000 /* recvmmsg(): block until 1+ packets avail */
4146 --
4147 -+#define MSG_SENDPAGE_NOTLAST 0x20000 /* sendpage() internal : not the last page */
4148 - #define MSG_EOF MSG_FIN
4149 -
4150 - #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file
4151 -diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
4152 -index 03354d5..64cec8d 100644
4153 ---- a/include/linux/usb/hcd.h
4154 -+++ b/include/linux/usb/hcd.h
4155 -@@ -128,6 +128,8 @@ struct usb_hcd {
4156 - unsigned wireless:1; /* Wireless USB HCD */
4157 - unsigned authorized_default:1;
4158 - unsigned has_tt:1; /* Integrated TT in root hub */
4159 -+ unsigned broken_pci_sleep:1; /* Don't put the
4160 -+ controller in PCI-D3 for system sleep */
4161 -
4162 - int irq; /* irq allocated */
4163 - void __iomem *regs; /* device memory/io */
4164 -diff --git a/kernel/exit.c b/kernel/exit.c
4165 -index e6e01b9..5a8a66e 100644
4166 ---- a/kernel/exit.c
4167 -+++ b/kernel/exit.c
4168 -@@ -819,25 +819,6 @@ static void exit_notify(struct task_struct *tsk, int group_dead)
4169 - if (group_dead)
4170 - kill_orphaned_pgrp(tsk->group_leader, NULL);
4171 -
4172 -- /* Let father know we died
4173 -- *
4174 -- * Thread signals are configurable, but you aren't going to use
4175 -- * that to send signals to arbitrary processes.
4176 -- * That stops right now.
4177 -- *
4178 -- * If the parent exec id doesn't match the exec id we saved
4179 -- * when we started then we know the parent has changed security
4180 -- * domain.
4181 -- *
4182 -- * If our self_exec id doesn't match our parent_exec_id then
4183 -- * we have changed execution domain as these two values started
4184 -- * the same after a fork.
4185 -- */
4186 -- if (thread_group_leader(tsk) && tsk->exit_signal != SIGCHLD &&
4187 -- (tsk->parent_exec_id != tsk->real_parent->self_exec_id ||
4188 -- tsk->self_exec_id != tsk->parent_exec_id))
4189 -- tsk->exit_signal = SIGCHLD;
4190 --
4191 - if (unlikely(tsk->ptrace)) {
4192 - int sig = thread_group_leader(tsk) &&
4193 - thread_group_empty(tsk) &&
4194 -diff --git a/kernel/power/swap.c b/kernel/power/swap.c
4195 -index 11a594c..b313086 100644
4196 ---- a/kernel/power/swap.c
4197 -+++ b/kernel/power/swap.c
4198 -@@ -52,6 +52,23 @@
4199 -
4200 - #define MAP_PAGE_ENTRIES (PAGE_SIZE / sizeof(sector_t) - 1)
4201 -
4202 -+/*
4203 -+ * Number of free pages that are not high.
4204 -+ */
4205 -+static inline unsigned long low_free_pages(void)
4206 -+{
4207 -+ return nr_free_pages() - nr_free_highpages();
4208 -+}
4209 -+
4210 -+/*
4211 -+ * Number of pages required to be kept free while writing the image. Always
4212 -+ * half of all available low pages before the writing starts.
4213 -+ */
4214 -+static inline unsigned long reqd_free_pages(void)
4215 -+{
4216 -+ return low_free_pages() / 2;
4217 -+}
4218 -+
4219 - struct swap_map_page {
4220 - sector_t entries[MAP_PAGE_ENTRIES];
4221 - sector_t next_swap;
4222 -@@ -73,7 +90,7 @@ struct swap_map_handle {
4223 - sector_t cur_swap;
4224 - sector_t first_sector;
4225 - unsigned int k;
4226 -- unsigned long nr_free_pages, written;
4227 -+ unsigned long reqd_free_pages;
4228 - u32 crc32;
4229 - };
4230 -
4231 -@@ -317,8 +334,7 @@ static int get_swap_writer(struct swap_map_handle *handle)
4232 - goto err_rel;
4233 - }
4234 - handle->k = 0;
4235 -- handle->nr_free_pages = nr_free_pages() >> 1;
4236 -- handle->written = 0;
4237 -+ handle->reqd_free_pages = reqd_free_pages();
4238 - handle->first_sector = handle->cur_swap;
4239 - return 0;
4240 - err_rel:
4241 -@@ -353,11 +369,11 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf,
4242 - handle->cur_swap = offset;
4243 - handle->k = 0;
4244 - }
4245 -- if (bio_chain && ++handle->written > handle->nr_free_pages) {
4246 -+ if (bio_chain && low_free_pages() <= handle->reqd_free_pages) {
4247 - error = hib_wait_on_bio_chain(bio_chain);
4248 - if (error)
4249 - goto out;
4250 -- handle->written = 0;
4251 -+ handle->reqd_free_pages = reqd_free_pages();
4252 - }
4253 - out:
4254 - return error;
4255 -@@ -619,7 +635,7 @@ static int save_image_lzo(struct swap_map_handle *handle,
4256 - * Adjust number of free pages after all allocations have been done.
4257 - * We don't want to run out of pages when writing.
4258 - */
4259 -- handle->nr_free_pages = nr_free_pages() >> 1;
4260 -+ handle->reqd_free_pages = reqd_free_pages();
4261 -
4262 - /*
4263 - * Start the CRC32 thread.
4264 -diff --git a/kernel/sched.c b/kernel/sched.c
4265 -index d6b149c..299f55c 100644
4266 ---- a/kernel/sched.c
4267 -+++ b/kernel/sched.c
4268 -@@ -3538,13 +3538,10 @@ calc_load_n(unsigned long load, unsigned long exp,
4269 - * Once we've updated the global active value, we need to apply the exponential
4270 - * weights adjusted to the number of cycles missed.
4271 - */
4272 --static void calc_global_nohz(unsigned long ticks)
4273 -+static void calc_global_nohz(void)
4274 - {
4275 - long delta, active, n;
4276 -
4277 -- if (time_before(jiffies, calc_load_update))
4278 -- return;
4279 --
4280 - /*
4281 - * If we crossed a calc_load_update boundary, make sure to fold
4282 - * any pending idle changes, the respective CPUs might have
4283 -@@ -3556,31 +3553,25 @@ static void calc_global_nohz(unsigned long ticks)
4284 - atomic_long_add(delta, &calc_load_tasks);
4285 -
4286 - /*
4287 -- * If we were idle for multiple load cycles, apply them.
4288 -+ * It could be the one fold was all it took, we done!
4289 - */
4290 -- if (ticks >= LOAD_FREQ) {
4291 -- n = ticks / LOAD_FREQ;
4292 -+ if (time_before(jiffies, calc_load_update + 10))
4293 -+ return;
4294 -
4295 -- active = atomic_long_read(&calc_load_tasks);
4296 -- active = active > 0 ? active * FIXED_1 : 0;
4297 -+ /*
4298 -+ * Catch-up, fold however many we are behind still
4299 -+ */
4300 -+ delta = jiffies - calc_load_update - 10;
4301 -+ n = 1 + (delta / LOAD_FREQ);
4302 -
4303 -- avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
4304 -- avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
4305 -- avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
4306 -+ active = atomic_long_read(&calc_load_tasks);
4307 -+ active = active > 0 ? active * FIXED_1 : 0;
4308 -
4309 -- calc_load_update += n * LOAD_FREQ;
4310 -- }
4311 -+ avenrun[0] = calc_load_n(avenrun[0], EXP_1, active, n);
4312 -+ avenrun[1] = calc_load_n(avenrun[1], EXP_5, active, n);
4313 -+ avenrun[2] = calc_load_n(avenrun[2], EXP_15, active, n);
4314 -
4315 -- /*
4316 -- * Its possible the remainder of the above division also crosses
4317 -- * a LOAD_FREQ period, the regular check in calc_global_load()
4318 -- * which comes after this will take care of that.
4319 -- *
4320 -- * Consider us being 11 ticks before a cycle completion, and us
4321 -- * sleeping for 4*LOAD_FREQ + 22 ticks, then the above code will
4322 -- * age us 4 cycles, and the test in calc_global_load() will
4323 -- * pick up the final one.
4324 -- */
4325 -+ calc_load_update += n * LOAD_FREQ;
4326 - }
4327 - #else
4328 - static void calc_load_account_idle(struct rq *this_rq)
4329 -@@ -3592,7 +3583,7 @@ static inline long calc_load_fold_idle(void)
4330 - return 0;
4331 - }
4332 -
4333 --static void calc_global_nohz(unsigned long ticks)
4334 -+static void calc_global_nohz(void)
4335 - {
4336 - }
4337 - #endif
4338 -@@ -3620,8 +3611,6 @@ void calc_global_load(unsigned long ticks)
4339 - {
4340 - long active;
4341 -
4342 -- calc_global_nohz(ticks);
4343 --
4344 - if (time_before(jiffies, calc_load_update + 10))
4345 - return;
4346 -
4347 -@@ -3633,6 +3622,16 @@ void calc_global_load(unsigned long ticks)
4348 - avenrun[2] = calc_load(avenrun[2], EXP_15, active);
4349 -
4350 - calc_load_update += LOAD_FREQ;
4351 -+
4352 -+ /*
4353 -+ * Account one period with whatever state we found before
4354 -+ * folding in the nohz state and ageing the entire idle period.
4355 -+ *
4356 -+ * This avoids loosing a sample when we go idle between
4357 -+ * calc_load_account_active() (10 ticks ago) and now and thus
4358 -+ * under-accounting.
4359 -+ */
4360 -+ calc_global_nohz();
4361 - }
4362 -
4363 - /*
4364 -@@ -7605,16 +7604,26 @@ static void __sdt_free(const struct cpumask *cpu_map)
4365 - struct sd_data *sdd = &tl->data;
4366 -
4367 - for_each_cpu(j, cpu_map) {
4368 -- struct sched_domain *sd = *per_cpu_ptr(sdd->sd, j);
4369 -- if (sd && (sd->flags & SD_OVERLAP))
4370 -- free_sched_groups(sd->groups, 0);
4371 -- kfree(*per_cpu_ptr(sdd->sd, j));
4372 -- kfree(*per_cpu_ptr(sdd->sg, j));
4373 -- kfree(*per_cpu_ptr(sdd->sgp, j));
4374 -+ struct sched_domain *sd;
4375 -+
4376 -+ if (sdd->sd) {
4377 -+ sd = *per_cpu_ptr(sdd->sd, j);
4378 -+ if (sd && (sd->flags & SD_OVERLAP))
4379 -+ free_sched_groups(sd->groups, 0);
4380 -+ kfree(*per_cpu_ptr(sdd->sd, j));
4381 -+ }
4382 -+
4383 -+ if (sdd->sg)
4384 -+ kfree(*per_cpu_ptr(sdd->sg, j));
4385 -+ if (sdd->sgp)
4386 -+ kfree(*per_cpu_ptr(sdd->sgp, j));
4387 - }
4388 - free_percpu(sdd->sd);
4389 -+ sdd->sd = NULL;
4390 - free_percpu(sdd->sg);
4391 -+ sdd->sg = NULL;
4392 - free_percpu(sdd->sgp);
4393 -+ sdd->sgp = NULL;
4394 - }
4395 - }
4396 -
4397 -diff --git a/kernel/signal.c b/kernel/signal.c
4398 -index 2065515..08e0b97 100644
4399 ---- a/kernel/signal.c
4400 -+++ b/kernel/signal.c
4401 -@@ -1610,6 +1610,15 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
4402 - BUG_ON(!tsk->ptrace &&
4403 - (tsk->group_leader != tsk || !thread_group_empty(tsk)));
4404 -
4405 -+ if (sig != SIGCHLD) {
4406 -+ /*
4407 -+ * This is only possible if parent == real_parent.
4408 -+ * Check if it has changed security domain.
4409 -+ */
4410 -+ if (tsk->parent_exec_id != tsk->parent->self_exec_id)
4411 -+ sig = SIGCHLD;
4412 -+ }
4413 -+
4414 - info.si_signo = sig;
4415 - info.si_errno = 0;
4416 - /*
4417 -diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
4418 -index 5199930..1dcf253 100644
4419 ---- a/kernel/trace/trace_output.c
4420 -+++ b/kernel/trace/trace_output.c
4421 -@@ -638,6 +638,8 @@ int trace_print_lat_context(struct trace_iterator *iter)
4422 - {
4423 - u64 next_ts;
4424 - int ret;
4425 -+ /* trace_find_next_entry will reset ent_size */
4426 -+ int ent_size = iter->ent_size;
4427 - struct trace_seq *s = &iter->seq;
4428 - struct trace_entry *entry = iter->ent,
4429 - *next_entry = trace_find_next_entry(iter, NULL,
4430 -@@ -646,6 +648,9 @@ int trace_print_lat_context(struct trace_iterator *iter)
4431 - unsigned long abs_usecs = ns2usecs(iter->ts - iter->tr->time_start);
4432 - unsigned long rel_usecs;
4433 -
4434 -+ /* Restore the original ent_size */
4435 -+ iter->ent_size = ent_size;
4436 -+
4437 - if (!next_entry)
4438 - next_ts = iter->ts;
4439 - rel_usecs = ns2usecs(next_ts - iter->ts);
4440 -diff --git a/mm/swap_state.c b/mm/swap_state.c
4441 -index 78cc4d1..7704d9c 100644
4442 ---- a/mm/swap_state.c
4443 -+++ b/mm/swap_state.c
4444 -@@ -27,7 +27,7 @@
4445 - */
4446 - static const struct address_space_operations swap_aops = {
4447 - .writepage = swap_writepage,
4448 -- .set_page_dirty = __set_page_dirty_nobuffers,
4449 -+ .set_page_dirty = __set_page_dirty_no_writeback,
4450 - .migratepage = migrate_page,
4451 - };
4452 -
4453 -diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
4454 -index e7c69f4..b04a6ef 100644
4455 ---- a/net/ax25/af_ax25.c
4456 -+++ b/net/ax25/af_ax25.c
4457 -@@ -2006,16 +2006,17 @@ static void __exit ax25_exit(void)
4458 - proc_net_remove(&init_net, "ax25_route");
4459 - proc_net_remove(&init_net, "ax25");
4460 - proc_net_remove(&init_net, "ax25_calls");
4461 -- ax25_rt_free();
4462 -- ax25_uid_free();
4463 -- ax25_dev_free();
4464 -
4465 -- ax25_unregister_sysctl();
4466 - unregister_netdevice_notifier(&ax25_dev_notifier);
4467 -+ ax25_unregister_sysctl();
4468 -
4469 - dev_remove_pack(&ax25_packet_type);
4470 -
4471 - sock_unregister(PF_AX25);
4472 - proto_unregister(&ax25_proto);
4473 -+
4474 -+ ax25_rt_free();
4475 -+ ax25_uid_free();
4476 -+ ax25_dev_free();
4477 - }
4478 - module_exit(ax25_exit);
4479 -diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
4480 -index 8eb6b15..5ac1811 100644
4481 ---- a/net/bridge/br_multicast.c
4482 -+++ b/net/bridge/br_multicast.c
4483 -@@ -241,7 +241,6 @@ static void br_multicast_group_expired(unsigned long data)
4484 - hlist_del_rcu(&mp->hlist[mdb->ver]);
4485 - mdb->size--;
4486 -
4487 -- del_timer(&mp->query_timer);
4488 - call_rcu_bh(&mp->rcu, br_multicast_free_group);
4489 -
4490 - out:
4491 -@@ -271,7 +270,6 @@ static void br_multicast_del_pg(struct net_bridge *br,
4492 - rcu_assign_pointer(*pp, p->next);
4493 - hlist_del_init(&p->mglist);
4494 - del_timer(&p->timer);
4495 -- del_timer(&p->query_timer);
4496 - call_rcu_bh(&p->rcu, br_multicast_free_pg);
4497 -
4498 - if (!mp->ports && !mp->mglist &&
4499 -@@ -507,74 +505,6 @@ static struct sk_buff *br_multicast_alloc_query(struct net_bridge *br,
4500 - return NULL;
4501 - }
4502 -
4503 --static void br_multicast_send_group_query(struct net_bridge_mdb_entry *mp)
4504 --{
4505 -- struct net_bridge *br = mp->br;
4506 -- struct sk_buff *skb;
4507 --
4508 -- skb = br_multicast_alloc_query(br, &mp->addr);
4509 -- if (!skb)
4510 -- goto timer;
4511 --
4512 -- netif_rx(skb);
4513 --
4514 --timer:
4515 -- if (++mp->queries_sent < br->multicast_last_member_count)
4516 -- mod_timer(&mp->query_timer,
4517 -- jiffies + br->multicast_last_member_interval);
4518 --}
4519 --
4520 --static void br_multicast_group_query_expired(unsigned long data)
4521 --{
4522 -- struct net_bridge_mdb_entry *mp = (void *)data;
4523 -- struct net_bridge *br = mp->br;
4524 --
4525 -- spin_lock(&br->multicast_lock);
4526 -- if (!netif_running(br->dev) || !mp->mglist ||
4527 -- mp->queries_sent >= br->multicast_last_member_count)
4528 -- goto out;
4529 --
4530 -- br_multicast_send_group_query(mp);
4531 --
4532 --out:
4533 -- spin_unlock(&br->multicast_lock);
4534 --}
4535 --
4536 --static void br_multicast_send_port_group_query(struct net_bridge_port_group *pg)
4537 --{
4538 -- struct net_bridge_port *port = pg->port;
4539 -- struct net_bridge *br = port->br;
4540 -- struct sk_buff *skb;
4541 --
4542 -- skb = br_multicast_alloc_query(br, &pg->addr);
4543 -- if (!skb)
4544 -- goto timer;
4545 --
4546 -- br_deliver(port, skb);
4547 --
4548 --timer:
4549 -- if (++pg->queries_sent < br->multicast_last_member_count)
4550 -- mod_timer(&pg->query_timer,
4551 -- jiffies + br->multicast_last_member_interval);
4552 --}
4553 --
4554 --static void br_multicast_port_group_query_expired(unsigned long data)
4555 --{
4556 -- struct net_bridge_port_group *pg = (void *)data;
4557 -- struct net_bridge_port *port = pg->port;
4558 -- struct net_bridge *br = port->br;
4559 --
4560 -- spin_lock(&br->multicast_lock);
4561 -- if (!netif_running(br->dev) || hlist_unhashed(&pg->mglist) ||
4562 -- pg->queries_sent >= br->multicast_last_member_count)
4563 -- goto out;
4564 --
4565 -- br_multicast_send_port_group_query(pg);
4566 --
4567 --out:
4568 -- spin_unlock(&br->multicast_lock);
4569 --}
4570 --
4571 - static struct net_bridge_mdb_entry *br_multicast_get_group(
4572 - struct net_bridge *br, struct net_bridge_port *port,
4573 - struct br_ip *group, int hash)
4574 -@@ -690,8 +620,6 @@ rehash:
4575 - mp->addr = *group;
4576 - setup_timer(&mp->timer, br_multicast_group_expired,
4577 - (unsigned long)mp);
4578 -- setup_timer(&mp->query_timer, br_multicast_group_query_expired,
4579 -- (unsigned long)mp);
4580 -
4581 - hlist_add_head_rcu(&mp->hlist[mdb->ver], &mdb->mhash[hash]);
4582 - mdb->size++;
4583 -@@ -746,8 +674,6 @@ static int br_multicast_add_group(struct net_bridge *br,
4584 - hlist_add_head(&p->mglist, &port->mglist);
4585 - setup_timer(&p->timer, br_multicast_port_group_expired,
4586 - (unsigned long)p);
4587 -- setup_timer(&p->query_timer, br_multicast_port_group_query_expired,
4588 -- (unsigned long)p);
4589 -
4590 - rcu_assign_pointer(*pp, p);
4591 -
4592 -@@ -1291,9 +1217,6 @@ static void br_multicast_leave_group(struct net_bridge *br,
4593 - time_after(mp->timer.expires, time) :
4594 - try_to_del_timer_sync(&mp->timer) >= 0)) {
4595 - mod_timer(&mp->timer, time);
4596 --
4597 -- mp->queries_sent = 0;
4598 -- mod_timer(&mp->query_timer, now);
4599 - }
4600 -
4601 - goto out;
4602 -@@ -1310,9 +1233,6 @@ static void br_multicast_leave_group(struct net_bridge *br,
4603 - time_after(p->timer.expires, time) :
4604 - try_to_del_timer_sync(&p->timer) >= 0)) {
4605 - mod_timer(&p->timer, time);
4606 --
4607 -- p->queries_sent = 0;
4608 -- mod_timer(&p->query_timer, now);
4609 - }
4610 -
4611 - break;
4612 -@@ -1680,7 +1600,6 @@ void br_multicast_stop(struct net_bridge *br)
4613 - hlist_for_each_entry_safe(mp, p, n, &mdb->mhash[i],
4614 - hlist[ver]) {
4615 - del_timer(&mp->timer);
4616 -- del_timer(&mp->query_timer);
4617 - call_rcu_bh(&mp->rcu, br_multicast_free_group);
4618 - }
4619 - }
4620 -diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
4621 -index d7d6fb0..93264df 100644
4622 ---- a/net/bridge/br_private.h
4623 -+++ b/net/bridge/br_private.h
4624 -@@ -82,9 +82,7 @@ struct net_bridge_port_group {
4625 - struct hlist_node mglist;
4626 - struct rcu_head rcu;
4627 - struct timer_list timer;
4628 -- struct timer_list query_timer;
4629 - struct br_ip addr;
4630 -- u32 queries_sent;
4631 - };
4632 -
4633 - struct net_bridge_mdb_entry
4634 -@@ -94,10 +92,8 @@ struct net_bridge_mdb_entry
4635 - struct net_bridge_port_group __rcu *ports;
4636 - struct rcu_head rcu;
4637 - struct timer_list timer;
4638 -- struct timer_list query_timer;
4639 - struct br_ip addr;
4640 - bool mglist;
4641 -- u32 queries_sent;
4642 - };
4643 -
4644 - struct net_bridge_mdb_htable
4645 -diff --git a/net/core/dev.c b/net/core/dev.c
4646 -index 55cd370..cd5050e 100644
4647 ---- a/net/core/dev.c
4648 -+++ b/net/core/dev.c
4649 -@@ -4102,54 +4102,41 @@ static int dev_ifconf(struct net *net, char __user *arg)
4650 -
4651 - #ifdef CONFIG_PROC_FS
4652 -
4653 --#define BUCKET_SPACE (32 - NETDEV_HASHBITS)
4654 --
4655 --struct dev_iter_state {
4656 -- struct seq_net_private p;
4657 -- unsigned int pos; /* bucket << BUCKET_SPACE + offset */
4658 --};
4659 -+#define BUCKET_SPACE (32 - NETDEV_HASHBITS - 1)
4660 -
4661 - #define get_bucket(x) ((x) >> BUCKET_SPACE)
4662 - #define get_offset(x) ((x) & ((1 << BUCKET_SPACE) - 1))
4663 - #define set_bucket_offset(b, o) ((b) << BUCKET_SPACE | (o))
4664 -
4665 --static inline struct net_device *dev_from_same_bucket(struct seq_file *seq)
4666 -+static inline struct net_device *dev_from_same_bucket(struct seq_file *seq, loff_t *pos)
4667 - {
4668 -- struct dev_iter_state *state = seq->private;
4669 - struct net *net = seq_file_net(seq);
4670 - struct net_device *dev;
4671 - struct hlist_node *p;
4672 - struct hlist_head *h;
4673 -- unsigned int count, bucket, offset;
4674 -+ unsigned int count = 0, offset = get_offset(*pos);
4675 -
4676 -- bucket = get_bucket(state->pos);
4677 -- offset = get_offset(state->pos);
4678 -- h = &net->dev_name_head[bucket];
4679 -- count = 0;
4680 -+ h = &net->dev_name_head[get_bucket(*pos)];
4681 - hlist_for_each_entry_rcu(dev, p, h, name_hlist) {
4682 -- if (count++ == offset) {
4683 -- state->pos = set_bucket_offset(bucket, count);
4684 -+ if (++count == offset)
4685 - return dev;
4686 -- }
4687 - }
4688 -
4689 - return NULL;
4690 - }
4691 -
4692 --static inline struct net_device *dev_from_new_bucket(struct seq_file *seq)
4693 -+static inline struct net_device *dev_from_bucket(struct seq_file *seq, loff_t *pos)
4694 - {
4695 -- struct dev_iter_state *state = seq->private;
4696 - struct net_device *dev;
4697 - unsigned int bucket;
4698 -
4699 -- bucket = get_bucket(state->pos);
4700 - do {
4701 -- dev = dev_from_same_bucket(seq);
4702 -+ dev = dev_from_same_bucket(seq, pos);
4703 - if (dev)
4704 - return dev;
4705 -
4706 -- bucket++;
4707 -- state->pos = set_bucket_offset(bucket, 0);
4708 -+ bucket = get_bucket(*pos) + 1;
4709 -+ *pos = set_bucket_offset(bucket, 1);
4710 - } while (bucket < NETDEV_HASHENTRIES);
4711 -
4712 - return NULL;
4713 -@@ -4162,33 +4149,20 @@ static inline struct net_device *dev_from_new_bucket(struct seq_file *seq)
4714 - void *dev_seq_start(struct seq_file *seq, loff_t *pos)
4715 - __acquires(RCU)
4716 - {
4717 -- struct dev_iter_state *state = seq->private;
4718 --
4719 - rcu_read_lock();
4720 - if (!*pos)
4721 - return SEQ_START_TOKEN;
4722 -
4723 -- /* check for end of the hash */
4724 -- if (state->pos == 0 && *pos > 1)
4725 -+ if (get_bucket(*pos) >= NETDEV_HASHENTRIES)
4726 - return NULL;
4727 -
4728 -- return dev_from_new_bucket(seq);
4729 -+ return dev_from_bucket(seq, pos);
4730 - }
4731 -
4732 - void *dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
4733 - {
4734 -- struct net_device *dev;
4735 --
4736 - ++*pos;
4737 --
4738 -- if (v == SEQ_START_TOKEN)
4739 -- return dev_from_new_bucket(seq);
4740 --
4741 -- dev = dev_from_same_bucket(seq);
4742 -- if (dev)
4743 -- return dev;
4744 --
4745 -- return dev_from_new_bucket(seq);
4746 -+ return dev_from_bucket(seq, pos);
4747 - }
4748 -
4749 - void dev_seq_stop(struct seq_file *seq, void *v)
4750 -@@ -4287,13 +4261,7 @@ static const struct seq_operations dev_seq_ops = {
4751 - static int dev_seq_open(struct inode *inode, struct file *file)
4752 - {
4753 - return seq_open_net(inode, file, &dev_seq_ops,
4754 -- sizeof(struct dev_iter_state));
4755 --}
4756 --
4757 --int dev_seq_open_ops(struct inode *inode, struct file *file,
4758 -- const struct seq_operations *ops)
4759 --{
4760 -- return seq_open_net(inode, file, ops, sizeof(struct dev_iter_state));
4761 -+ sizeof(struct seq_net_private));
4762 - }
4763 -
4764 - static const struct file_operations dev_seq_fops = {
4765 -diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
4766 -index febba51..277faef 100644
4767 ---- a/net/core/dev_addr_lists.c
4768 -+++ b/net/core/dev_addr_lists.c
4769 -@@ -696,7 +696,8 @@ static const struct seq_operations dev_mc_seq_ops = {
4770 -
4771 - static int dev_mc_seq_open(struct inode *inode, struct file *file)
4772 - {
4773 -- return dev_seq_open_ops(inode, file, &dev_mc_seq_ops);
4774 -+ return seq_open_net(inode, file, &dev_mc_seq_ops,
4775 -+ sizeof(struct seq_net_private));
4776 - }
4777 -
4778 - static const struct file_operations dev_mc_seq_fops = {
4779 -diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
4780 -index 0e950fd..31a5ae5 100644
4781 ---- a/net/core/net_namespace.c
4782 -+++ b/net/core/net_namespace.c
4783 -@@ -83,21 +83,29 @@ assign:
4784 -
4785 - static int ops_init(const struct pernet_operations *ops, struct net *net)
4786 - {
4787 -- int err;
4788 -+ int err = -ENOMEM;
4789 -+ void *data = NULL;
4790 -+
4791 - if (ops->id && ops->size) {
4792 -- void *data = kzalloc(ops->size, GFP_KERNEL);
4793 -+ data = kzalloc(ops->size, GFP_KERNEL);
4794 - if (!data)
4795 -- return -ENOMEM;
4796 -+ goto out;
4797 -
4798 - err = net_assign_generic(net, *ops->id, data);
4799 -- if (err) {
4800 -- kfree(data);
4801 -- return err;
4802 -- }
4803 -+ if (err)
4804 -+ goto cleanup;
4805 - }
4806 -+ err = 0;
4807 - if (ops->init)
4808 -- return ops->init(net);
4809 -- return 0;
4810 -+ err = ops->init(net);
4811 -+ if (!err)
4812 -+ return 0;
4813 -+
4814 -+cleanup:
4815 -+ kfree(data);
4816 -+
4817 -+out:
4818 -+ return err;
4819 - }
4820 -
4821 - static void ops_free(const struct pernet_operations *ops, struct net *net)
4822 -@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops)
4823 - static int __register_pernet_operations(struct list_head *list,
4824 - struct pernet_operations *ops)
4825 - {
4826 -- int err = 0;
4827 -- err = ops_init(ops, &init_net);
4828 -- if (err)
4829 -- ops_free(ops, &init_net);
4830 -- return err;
4831 --
4832 -+ return ops_init(ops, &init_net);
4833 - }
4834 -
4835 - static void __unregister_pernet_operations(struct pernet_operations *ops)
4836 -diff --git a/net/core/skbuff.c b/net/core/skbuff.c
4837 -index 3c30ee4..2ec200de 100644
4838 ---- a/net/core/skbuff.c
4839 -+++ b/net/core/skbuff.c
4840 -@@ -903,9 +903,11 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
4841 - goto adjust_others;
4842 - }
4843 -
4844 -- data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask);
4845 -+ data = kmalloc(size + SKB_DATA_ALIGN(sizeof(struct skb_shared_info)),
4846 -+ gfp_mask);
4847 - if (!data)
4848 - goto nodata;
4849 -+ size = SKB_WITH_OVERHEAD(ksize(data));
4850 -
4851 - /* Copy only real data... and, alas, header. This should be
4852 - * optimized for the cases when header is void.
4853 -@@ -3111,6 +3113,8 @@ static void sock_rmem_free(struct sk_buff *skb)
4854 - */
4855 - int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
4856 - {
4857 -+ int len = skb->len;
4858 -+
4859 - if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >=
4860 - (unsigned)sk->sk_rcvbuf)
4861 - return -ENOMEM;
4862 -@@ -3125,7 +3129,7 @@ int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb)
4863 -
4864 - skb_queue_tail(&sk->sk_error_queue, skb);
4865 - if (!sock_flag(sk, SOCK_DEAD))
4866 -- sk->sk_data_ready(sk, skb->len);
4867 -+ sk->sk_data_ready(sk, len);
4868 - return 0;
4869 - }
4870 - EXPORT_SYMBOL(sock_queue_err_skb);
4871 -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
4872 -index 34f5db1..7904db4 100644
4873 ---- a/net/ipv4/tcp.c
4874 -+++ b/net/ipv4/tcp.c
4875 -@@ -701,11 +701,12 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp)
4876 - skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp);
4877 - if (skb) {
4878 - if (sk_wmem_schedule(sk, skb->truesize)) {
4879 -+ skb_reserve(skb, sk->sk_prot->max_header);
4880 - /*
4881 - * Make sure that we have exactly size bytes
4882 - * available to the caller, no more, no less.
4883 - */
4884 -- skb_reserve(skb, skb_tailroom(skb) - size);
4885 -+ skb->avail_size = size;
4886 - return skb;
4887 - }
4888 - __kfree_skb(skb);
4889 -@@ -860,7 +861,7 @@ wait_for_memory:
4890 - }
4891 -
4892 - out:
4893 -- if (copied)
4894 -+ if (copied && !(flags & MSG_SENDPAGE_NOTLAST))
4895 - tcp_push(sk, flags, mss_now, tp->nonagle);
4896 - return copied;
4897 -
4898 -@@ -995,10 +996,9 @@ new_segment:
4899 - copy = seglen;
4900 -
4901 - /* Where to copy to? */
4902 -- if (skb_tailroom(skb) > 0) {
4903 -+ if (skb_availroom(skb) > 0) {
4904 - /* We have some space in skb head. Superb! */
4905 -- if (copy > skb_tailroom(skb))
4906 -- copy = skb_tailroom(skb);
4907 -+ copy = min_t(int, copy, skb_availroom(skb));
4908 - err = skb_add_data_nocache(sk, skb, from, copy);
4909 - if (err)
4910 - goto do_fault;
4911 -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
4912 -index e4d1e4a..daedc07 100644
4913 ---- a/net/ipv4/tcp_input.c
4914 -+++ b/net/ipv4/tcp_input.c
4915 -@@ -334,6 +334,7 @@ static void tcp_grow_window(struct sock *sk, const struct sk_buff *skb)
4916 - incr = __tcp_grow_window(sk, skb);
4917 -
4918 - if (incr) {
4919 -+ incr = max_t(int, incr, 2 * skb->len);
4920 - tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr,
4921 - tp->window_clamp);
4922 - inet_csk(sk)->icsk_ack.quick |= 1;
4923 -@@ -473,8 +474,11 @@ static void tcp_rcv_rtt_update(struct tcp_sock *tp, u32 sample, int win_dep)
4924 - if (!win_dep) {
4925 - m -= (new_sample >> 3);
4926 - new_sample += m;
4927 -- } else if (m < new_sample)
4928 -- new_sample = m << 3;
4929 -+ } else {
4930 -+ m <<= 3;
4931 -+ if (m < new_sample)
4932 -+ new_sample = m;
4933 -+ }
4934 - } else {
4935 - /* No previous measure. */
4936 - new_sample = m << 3;
4937 -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
4938 -index 097e0c7..c51dd5b 100644
4939 ---- a/net/ipv4/tcp_output.c
4940 -+++ b/net/ipv4/tcp_output.c
4941 -@@ -1093,6 +1093,14 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
4942 - {
4943 - int i, k, eat;
4944 -
4945 -+ eat = min_t(int, len, skb_headlen(skb));
4946 -+ if (eat) {
4947 -+ __skb_pull(skb, eat);
4948 -+ skb->avail_size -= eat;
4949 -+ len -= eat;
4950 -+ if (!len)
4951 -+ return;
4952 -+ }
4953 - eat = len;
4954 - k = 0;
4955 - for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
4956 -@@ -1124,11 +1132,7 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
4957 - if (skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
4958 - return -ENOMEM;
4959 -
4960 -- /* If len == headlen, we avoid __skb_pull to preserve alignment. */
4961 -- if (unlikely(len < skb_headlen(skb)))
4962 -- __skb_pull(skb, len);
4963 -- else
4964 -- __pskb_trim_head(skb, len - skb_headlen(skb));
4965 -+ __pskb_trim_head(skb, len);
4966 -
4967 - TCP_SKB_CB(skb)->seq += len;
4968 - skb->ip_summed = CHECKSUM_PARTIAL;
4969 -@@ -2057,7 +2061,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *to,
4970 - /* Punt if not enough space exists in the first SKB for
4971 - * the data in the second
4972 - */
4973 -- if (skb->len > skb_tailroom(to))
4974 -+ if (skb->len > skb_availroom(to))
4975 - break;
4976 -
4977 - if (after(TCP_SKB_CB(skb)->end_seq, tcp_wnd_end(tp)))
4978 -diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
4979 -index 2257366..f2d74ea 100644
4980 ---- a/net/ipv6/mcast.c
4981 -+++ b/net/ipv6/mcast.c
4982 -@@ -2054,7 +2054,7 @@ static int ip6_mc_add_src(struct inet6_dev *idev, const struct in6_addr *pmca,
4983 - if (!delta)
4984 - pmc->mca_sfcount[sfmode]--;
4985 - for (j=0; j<i; j++)
4986 -- (void) ip6_mc_del1_src(pmc, sfmode, &psfsrc[i]);
4987 -+ ip6_mc_del1_src(pmc, sfmode, &psfsrc[j]);
4988 - } else if (isexclude != (pmc->mca_sfcount[MCAST_EXCLUDE] != 0)) {
4989 - struct ip6_sf_list *psf;
4990 -
4991 -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
4992 -index b859e4a..4a56574 100644
4993 ---- a/net/ipv6/tcp_ipv6.c
4994 -+++ b/net/ipv6/tcp_ipv6.c
4995 -@@ -1494,6 +1494,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
4996 - tcp_mtup_init(newsk);
4997 - tcp_sync_mss(newsk, dst_mtu(dst));
4998 - newtp->advmss = dst_metric_advmss(dst);
4999 -+ if (tcp_sk(sk)->rx_opt.user_mss &&
5000 -+ tcp_sk(sk)->rx_opt.user_mss < newtp->advmss)
5001 -+ newtp->advmss = tcp_sk(sk)->rx_opt.user_mss;
5002 -+
5003 - tcp_initialize_rcv_mss(newsk);
5004 - if (tcp_rsk(req)->snt_synack)
5005 - tcp_valid_rtt_meas(newsk,
5006 -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
5007 -index eff1f4e..4ff35bf 100644
5008 ---- a/net/mac80211/tx.c
5009 -+++ b/net/mac80211/tx.c
5010 -@@ -1121,7 +1121,8 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata,
5011 - tx->sta = rcu_dereference(sdata->u.vlan.sta);
5012 - if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr)
5013 - return TX_DROP;
5014 -- } else if (info->flags & IEEE80211_TX_CTL_INJECTED) {
5015 -+ } else if (info->flags & IEEE80211_TX_CTL_INJECTED ||
5016 -+ tx->sdata->control_port_protocol == tx->skb->protocol) {
5017 - tx->sta = sta_info_get_bss(sdata, hdr->addr1);
5018 - }
5019 - if (!tx->sta)
5020 -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
5021 -index 1201b6d..a99fb41 100644
5022 ---- a/net/netlink/af_netlink.c
5023 -+++ b/net/netlink/af_netlink.c
5024 -@@ -830,12 +830,19 @@ int netlink_attachskb(struct sock *sk, struct sk_buff *skb,
5025 - return 0;
5026 - }
5027 -
5028 --int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
5029 -+static int __netlink_sendskb(struct sock *sk, struct sk_buff *skb)
5030 - {
5031 - int len = skb->len;
5032 -
5033 - skb_queue_tail(&sk->sk_receive_queue, skb);
5034 - sk->sk_data_ready(sk, len);
5035 -+ return len;
5036 -+}
5037 -+
5038 -+int netlink_sendskb(struct sock *sk, struct sk_buff *skb)
5039 -+{
5040 -+ int len = __netlink_sendskb(sk, skb);
5041 -+
5042 - sock_put(sk);
5043 - return len;
5044 - }
5045 -@@ -960,8 +967,7 @@ static inline int netlink_broadcast_deliver(struct sock *sk,
5046 - if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf &&
5047 - !test_bit(0, &nlk->state)) {
5048 - skb_set_owner_r(skb, sk);
5049 -- skb_queue_tail(&sk->sk_receive_queue, skb);
5050 -- sk->sk_data_ready(sk, skb->len);
5051 -+ __netlink_sendskb(sk, skb);
5052 - return atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf;
5053 - }
5054 - return -1;
5055 -@@ -1684,10 +1690,8 @@ static int netlink_dump(struct sock *sk)
5056 -
5057 - if (sk_filter(sk, skb))
5058 - kfree_skb(skb);
5059 -- else {
5060 -- skb_queue_tail(&sk->sk_receive_queue, skb);
5061 -- sk->sk_data_ready(sk, skb->len);
5062 -- }
5063 -+ else
5064 -+ __netlink_sendskb(sk, skb);
5065 - return 0;
5066 - }
5067 -
5068 -@@ -1701,10 +1705,8 @@ static int netlink_dump(struct sock *sk)
5069 -
5070 - if (sk_filter(sk, skb))
5071 - kfree_skb(skb);
5072 -- else {
5073 -- skb_queue_tail(&sk->sk_receive_queue, skb);
5074 -- sk->sk_data_ready(sk, skb->len);
5075 -- }
5076 -+ else
5077 -+ __netlink_sendskb(sk, skb);
5078 -
5079 - if (cb->done)
5080 - cb->done(cb);
5081 -diff --git a/net/phonet/pep.c b/net/phonet/pep.c
5082 -index 2ba6e9f..007546d 100644
5083 ---- a/net/phonet/pep.c
5084 -+++ b/net/phonet/pep.c
5085 -@@ -1046,6 +1046,9 @@ static int pep_sendmsg(struct kiocb *iocb, struct sock *sk,
5086 - int flags = msg->msg_flags;
5087 - int err, done;
5088 -
5089 -+ if (len > USHRT_MAX)
5090 -+ return -EMSGSIZE;
5091 -+
5092 - if ((msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_NOSIGNAL|
5093 - MSG_CMSG_COMPAT)) ||
5094 - !(msg->msg_flags & MSG_EOR))
5095 -diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
5096 -index 6cd8ddf..e1afe0c 100644
5097 ---- a/net/sched/sch_gred.c
5098 -+++ b/net/sched/sch_gred.c
5099 -@@ -544,11 +544,8 @@ static int gred_dump(struct Qdisc *sch, struct sk_buff *skb)
5100 - opt.packets = q->packetsin;
5101 - opt.bytesin = q->bytesin;
5102 -
5103 -- if (gred_wred_mode(table)) {
5104 -- q->parms.qidlestart =
5105 -- table->tab[table->def]->parms.qidlestart;
5106 -- q->parms.qavg = table->tab[table->def]->parms.qavg;
5107 -- }
5108 -+ if (gred_wred_mode(table))
5109 -+ gred_load_wred_set(table, q);
5110 -
5111 - opt.qave = red_calc_qavg(&q->parms, q->parms.qavg);
5112 -
5113 -diff --git a/net/sctp/socket.c b/net/sctp/socket.c
5114 -index 54a7cd2..0075554 100644
5115 ---- a/net/sctp/socket.c
5116 -+++ b/net/sctp/socket.c
5117 -@@ -4133,9 +4133,10 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
5118 - static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
5119 - int __user *optlen)
5120 - {
5121 -- if (len < sizeof(struct sctp_event_subscribe))
5122 -+ if (len <= 0)
5123 - return -EINVAL;
5124 -- len = sizeof(struct sctp_event_subscribe);
5125 -+ if (len > sizeof(struct sctp_event_subscribe))
5126 -+ len = sizeof(struct sctp_event_subscribe);
5127 - if (put_user(len, optlen))
5128 - return -EFAULT;
5129 - if (copy_to_user(optval, &sctp_sk(sk)->subscribe, len))
5130 -diff --git a/net/socket.c b/net/socket.c
5131 -index 2dce67a..273cbce 100644
5132 ---- a/net/socket.c
5133 -+++ b/net/socket.c
5134 -@@ -791,9 +791,9 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
5135 -
5136 - sock = file->private_data;
5137 -
5138 -- flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
5139 -- if (more)
5140 -- flags |= MSG_MORE;
5141 -+ flags = (file->f_flags & O_NONBLOCK) ? MSG_DONTWAIT : 0;
5142 -+ /* more is a combination of MSG_MORE and MSG_SENDPAGE_NOTLAST */
5143 -+ flags |= more;
5144 -
5145 - return kernel_sendpage(sock, page, offset, size, flags);
5146 - }
5147 -diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
5148 -index ffafda5..c06c365 100644
5149 ---- a/net/wireless/nl80211.c
5150 -+++ b/net/wireless/nl80211.c
5151 -@@ -1258,6 +1258,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
5152 - goto bad_res;
5153 - }
5154 -
5155 -+ if (!netif_running(netdev)) {
5156 -+ result = -ENETDOWN;
5157 -+ goto bad_res;
5158 -+ }
5159 -+
5160 - nla_for_each_nested(nl_txq_params,
5161 - info->attrs[NL80211_ATTR_WIPHY_TXQ_PARAMS],
5162 - rem_txq_params) {
5163 -@@ -5944,7 +5949,7 @@ static struct genl_ops nl80211_ops[] = {
5164 - .doit = nl80211_get_key,
5165 - .policy = nl80211_policy,
5166 - .flags = GENL_ADMIN_PERM,
5167 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5168 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5169 - NL80211_FLAG_NEED_RTNL,
5170 - },
5171 - {
5172 -@@ -5976,7 +5981,7 @@ static struct genl_ops nl80211_ops[] = {
5173 - .policy = nl80211_policy,
5174 - .flags = GENL_ADMIN_PERM,
5175 - .doit = nl80211_addset_beacon,
5176 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5177 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5178 - NL80211_FLAG_NEED_RTNL,
5179 - },
5180 - {
5181 -@@ -5984,7 +5989,7 @@ static struct genl_ops nl80211_ops[] = {
5182 - .policy = nl80211_policy,
5183 - .flags = GENL_ADMIN_PERM,
5184 - .doit = nl80211_addset_beacon,
5185 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5186 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5187 - NL80211_FLAG_NEED_RTNL,
5188 - },
5189 - {
5190 -@@ -6008,7 +6013,7 @@ static struct genl_ops nl80211_ops[] = {
5191 - .doit = nl80211_set_station,
5192 - .policy = nl80211_policy,
5193 - .flags = GENL_ADMIN_PERM,
5194 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5195 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5196 - NL80211_FLAG_NEED_RTNL,
5197 - },
5198 - {
5199 -@@ -6024,7 +6029,7 @@ static struct genl_ops nl80211_ops[] = {
5200 - .doit = nl80211_del_station,
5201 - .policy = nl80211_policy,
5202 - .flags = GENL_ADMIN_PERM,
5203 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5204 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5205 - NL80211_FLAG_NEED_RTNL,
5206 - },
5207 - {
5208 -@@ -6057,7 +6062,7 @@ static struct genl_ops nl80211_ops[] = {
5209 - .doit = nl80211_del_mpath,
5210 - .policy = nl80211_policy,
5211 - .flags = GENL_ADMIN_PERM,
5212 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5213 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5214 - NL80211_FLAG_NEED_RTNL,
5215 - },
5216 - {
5217 -@@ -6065,7 +6070,7 @@ static struct genl_ops nl80211_ops[] = {
5218 - .doit = nl80211_set_bss,
5219 - .policy = nl80211_policy,
5220 - .flags = GENL_ADMIN_PERM,
5221 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5222 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5223 - NL80211_FLAG_NEED_RTNL,
5224 - },
5225 - {
5226 -@@ -6091,7 +6096,7 @@ static struct genl_ops nl80211_ops[] = {
5227 - .doit = nl80211_get_mesh_config,
5228 - .policy = nl80211_policy,
5229 - /* can be retrieved by unprivileged users */
5230 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5231 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5232 - NL80211_FLAG_NEED_RTNL,
5233 - },
5234 - {
5235 -@@ -6224,7 +6229,7 @@ static struct genl_ops nl80211_ops[] = {
5236 - .doit = nl80211_setdel_pmksa,
5237 - .policy = nl80211_policy,
5238 - .flags = GENL_ADMIN_PERM,
5239 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5240 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5241 - NL80211_FLAG_NEED_RTNL,
5242 - },
5243 - {
5244 -@@ -6232,7 +6237,7 @@ static struct genl_ops nl80211_ops[] = {
5245 - .doit = nl80211_setdel_pmksa,
5246 - .policy = nl80211_policy,
5247 - .flags = GENL_ADMIN_PERM,
5248 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5249 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5250 - NL80211_FLAG_NEED_RTNL,
5251 - },
5252 - {
5253 -@@ -6240,7 +6245,7 @@ static struct genl_ops nl80211_ops[] = {
5254 - .doit = nl80211_flush_pmksa,
5255 - .policy = nl80211_policy,
5256 - .flags = GENL_ADMIN_PERM,
5257 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5258 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5259 - NL80211_FLAG_NEED_RTNL,
5260 - },
5261 - {
5262 -@@ -6328,7 +6333,7 @@ static struct genl_ops nl80211_ops[] = {
5263 - .doit = nl80211_set_wds_peer,
5264 - .policy = nl80211_policy,
5265 - .flags = GENL_ADMIN_PERM,
5266 -- .internal_flags = NL80211_FLAG_NEED_NETDEV |
5267 -+ .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
5268 - NL80211_FLAG_NEED_RTNL,
5269 - },
5270 - {
5271 -diff --git a/net/wireless/util.c b/net/wireless/util.c
5272 -index 4dde429..8bf8902 100644
5273 ---- a/net/wireless/util.c
5274 -+++ b/net/wireless/util.c
5275 -@@ -996,7 +996,7 @@ int cfg80211_can_change_interface(struct cfg80211_registered_device *rdev,
5276 - if (rdev->wiphy.software_iftypes & BIT(iftype))
5277 - continue;
5278 - for (j = 0; j < c->n_limits; j++) {
5279 -- if (!(limits[j].types & iftype))
5280 -+ if (!(limits[j].types & BIT(iftype)))
5281 - continue;
5282 - if (limits[j].max < num[iftype])
5283 - goto cont;
5284 -diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
5285 -index f936d1f..d1d0ae8 100644
5286 ---- a/scripts/mod/file2alias.c
5287 -+++ b/scripts/mod/file2alias.c
5288 -@@ -926,6 +926,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
5289 - if (!sym->st_shndx || get_secindex(info, sym) >= info->num_sections)
5290 - return;
5291 -
5292 -+ /* We're looking for an object */
5293 -+ if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT)
5294 -+ return;
5295 -+
5296 - /* Handle all-NULL symbols allocated into .bss */
5297 - if (info->sechdrs[get_secindex(info, sym)].sh_type & SHT_NOBITS) {
5298 - zeros = calloc(1, sym->st_size);
5299 -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
5300 -index ae94929..51a1afc 100644
5301 ---- a/sound/pci/hda/patch_conexant.c
5302 -+++ b/sound/pci/hda/patch_conexant.c
5303 -@@ -4003,9 +4003,14 @@ static void cx_auto_init_output(struct hda_codec *codec)
5304 - int i;
5305 -
5306 - mute_outputs(codec, spec->multiout.num_dacs, spec->multiout.dac_nids);
5307 -- for (i = 0; i < cfg->hp_outs; i++)
5308 -+ for (i = 0; i < cfg->hp_outs; i++) {
5309 -+ unsigned int val = PIN_OUT;
5310 -+ if (snd_hda_query_pin_caps(codec, cfg->hp_pins[i]) &
5311 -+ AC_PINCAP_HP_DRV)
5312 -+ val |= AC_PINCTL_HP_EN;
5313 - snd_hda_codec_write(codec, cfg->hp_pins[i], 0,
5314 -- AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5315 -+ AC_VERB_SET_PIN_WIDGET_CONTROL, val);
5316 -+ }
5317 - mute_outputs(codec, cfg->hp_outs, cfg->hp_pins);
5318 - mute_outputs(codec, cfg->line_outs, cfg->line_out_pins);
5319 - mute_outputs(codec, cfg->speaker_outs, cfg->speaker_pins);
5320 -@@ -4408,8 +4413,10 @@ static void apply_pin_fixup(struct hda_codec *codec,
5321 -
5322 - enum {
5323 - CXT_PINCFG_LENOVO_X200,
5324 -+ CXT_PINCFG_LENOVO_TP410,
5325 - };
5326 -
5327 -+/* ThinkPad X200 & co with cxt5051 */
5328 - static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
5329 - { 0x16, 0x042140ff }, /* HP (seq# overridden) */
5330 - { 0x17, 0x21a11000 }, /* dock-mic */
5331 -@@ -4417,15 +4424,33 @@ static const struct cxt_pincfg cxt_pincfg_lenovo_x200[] = {
5332 - {}
5333 - };
5334 -
5335 -+/* ThinkPad 410/420/510/520, X201 & co with cxt5066 */
5336 -+static const struct cxt_pincfg cxt_pincfg_lenovo_tp410[] = {
5337 -+ { 0x19, 0x042110ff }, /* HP (seq# overridden) */
5338 -+ { 0x1a, 0x21a190f0 }, /* dock-mic */
5339 -+ { 0x1c, 0x212140ff }, /* dock-HP */
5340 -+ {}
5341 -+};
5342 -+
5343 - static const struct cxt_pincfg *cxt_pincfg_tbl[] = {
5344 - [CXT_PINCFG_LENOVO_X200] = cxt_pincfg_lenovo_x200,
5345 -+ [CXT_PINCFG_LENOVO_TP410] = cxt_pincfg_lenovo_tp410,
5346 - };
5347 -
5348 --static const struct snd_pci_quirk cxt_fixups[] = {
5349 -+static const struct snd_pci_quirk cxt5051_fixups[] = {
5350 - SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT_PINCFG_LENOVO_X200),
5351 - {}
5352 - };
5353 -
5354 -+static const struct snd_pci_quirk cxt5066_fixups[] = {
5355 -+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
5356 -+ SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
5357 -+ SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410),
5358 -+ SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
5359 -+ SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
5360 -+ {}
5361 -+};
5362 -+
5363 - /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
5364 - * can be created (bko#42825)
5365 - */
5366 -@@ -4462,11 +4487,13 @@ static int patch_conexant_auto(struct hda_codec *codec)
5367 - break;
5368 - case 0x14f15051:
5369 - add_cx5051_fake_mutes(codec);
5370 -+ apply_pin_fixup(codec, cxt5051_fixups, cxt_pincfg_tbl);
5371 -+ break;
5372 -+ default:
5373 -+ apply_pin_fixup(codec, cxt5066_fixups, cxt_pincfg_tbl);
5374 - break;
5375 - }
5376 -
5377 -- apply_pin_fixup(codec, cxt_fixups, cxt_pincfg_tbl);
5378 --
5379 - err = cx_auto_search_adcs(codec);
5380 - if (err < 0)
5381 - return err;
5382 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
5383 -index dc8a6fc..0bc5a46 100644
5384 ---- a/sound/pci/hda/patch_realtek.c
5385 -+++ b/sound/pci/hda/patch_realtek.c
5386 -@@ -5032,6 +5032,7 @@ static const struct alc_fixup alc269_fixups[] = {
5387 - };
5388 -
5389 - static const struct snd_pci_quirk alc269_fixup_tbl[] = {
5390 -+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
5391 - SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
5392 - SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
5393 - SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
5394 -diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
5395 -index 336de8f..0e7e26e 100644
5396 ---- a/sound/soc/codecs/tlv320aic23.c
5397 -+++ b/sound/soc/codecs/tlv320aic23.c
5398 -@@ -473,7 +473,7 @@ static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
5399 - static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
5400 - enum snd_soc_bias_level level)
5401 - {
5402 -- u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f;
5403 -+ u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f;
5404 -
5405 - switch (level) {
5406 - case SND_SOC_BIAS_ON:
5407 -@@ -492,7 +492,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
5408 - case SND_SOC_BIAS_OFF:
5409 - /* everything off, dac mute, inactive */
5410 - snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0);
5411 -- snd_soc_write(codec, TLV320AIC23_PWR, 0xffff);
5412 -+ snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff);
5413 - break;
5414 - }
5415 - codec->dapm.bias_level = level;
5416 -diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
5417 -index 2f1f5f8..7806301 100644
5418 ---- a/sound/soc/codecs/wm8994.c
5419 -+++ b/sound/soc/codecs/wm8994.c
5420 -@@ -883,61 +883,170 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec)
5421 - }
5422 - }
5423 -
5424 --static int late_enable_ev(struct snd_soc_dapm_widget *w,
5425 -- struct snd_kcontrol *kcontrol, int event)
5426 -+static int aif1clk_ev(struct snd_soc_dapm_widget *w,
5427 -+ struct snd_kcontrol *kcontrol, int event)
5428 - {
5429 - struct snd_soc_codec *codec = w->codec;
5430 -- struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5431 -+ struct wm8994 *control = codec->control_data;
5432 -+ int mask = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC1R_ENA;
5433 -+ int dac;
5434 -+ int adc;
5435 -+ int val;
5436 -+
5437 -+ switch (control->type) {
5438 -+ case WM8994:
5439 -+ case WM8958:
5440 -+ mask |= WM8994_AIF1DAC2L_ENA | WM8994_AIF1DAC2R_ENA;
5441 -+ break;
5442 -+ default:
5443 -+ break;
5444 -+ }
5445 -
5446 - switch (event) {
5447 - case SND_SOC_DAPM_PRE_PMU:
5448 -- if (wm8994->aif1clk_enable) {
5449 -- snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
5450 -- WM8994_AIF1CLK_ENA_MASK,
5451 -- WM8994_AIF1CLK_ENA);
5452 -- wm8994->aif1clk_enable = 0;
5453 -- }
5454 -- if (wm8994->aif2clk_enable) {
5455 -- snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
5456 -- WM8994_AIF2CLK_ENA_MASK,
5457 -- WM8994_AIF2CLK_ENA);
5458 -- wm8994->aif2clk_enable = 0;
5459 -- }
5460 -+ val = snd_soc_read(codec, WM8994_AIF1_CONTROL_1);
5461 -+ if ((val & WM8994_AIF1ADCL_SRC) &&
5462 -+ (val & WM8994_AIF1ADCR_SRC))
5463 -+ adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA;
5464 -+ else if (!(val & WM8994_AIF1ADCL_SRC) &&
5465 -+ !(val & WM8994_AIF1ADCR_SRC))
5466 -+ adc = WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA;
5467 -+ else
5468 -+ adc = WM8994_AIF1ADC1R_ENA | WM8994_AIF1ADC2R_ENA |
5469 -+ WM8994_AIF1ADC1L_ENA | WM8994_AIF1ADC2L_ENA;
5470 -+
5471 -+ val = snd_soc_read(codec, WM8994_AIF1_CONTROL_2);
5472 -+ if ((val & WM8994_AIF1DACL_SRC) &&
5473 -+ (val & WM8994_AIF1DACR_SRC))
5474 -+ dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA;
5475 -+ else if (!(val & WM8994_AIF1DACL_SRC) &&
5476 -+ !(val & WM8994_AIF1DACR_SRC))
5477 -+ dac = WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA;
5478 -+ else
5479 -+ dac = WM8994_AIF1DAC1R_ENA | WM8994_AIF1DAC2R_ENA |
5480 -+ WM8994_AIF1DAC1L_ENA | WM8994_AIF1DAC2L_ENA;
5481 -+
5482 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
5483 -+ mask, adc);
5484 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5485 -+ mask, dac);
5486 -+ snd_soc_update_bits(codec, WM8994_CLOCKING_1,
5487 -+ WM8994_AIF1DSPCLK_ENA |
5488 -+ WM8994_SYSDSPCLK_ENA,
5489 -+ WM8994_AIF1DSPCLK_ENA |
5490 -+ WM8994_SYSDSPCLK_ENA);
5491 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4, mask,
5492 -+ WM8994_AIF1ADC1R_ENA |
5493 -+ WM8994_AIF1ADC1L_ENA |
5494 -+ WM8994_AIF1ADC2R_ENA |
5495 -+ WM8994_AIF1ADC2L_ENA);
5496 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, mask,
5497 -+ WM8994_AIF1DAC1R_ENA |
5498 -+ WM8994_AIF1DAC1L_ENA |
5499 -+ WM8994_AIF1DAC2R_ENA |
5500 -+ WM8994_AIF1DAC2L_ENA);
5501 -+ break;
5502 -+
5503 -+ case SND_SOC_DAPM_PRE_PMD:
5504 -+ case SND_SOC_DAPM_POST_PMD:
5505 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5506 -+ mask, 0);
5507 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
5508 -+ mask, 0);
5509 -+
5510 -+ val = snd_soc_read(codec, WM8994_CLOCKING_1);
5511 -+ if (val & WM8994_AIF2DSPCLK_ENA)
5512 -+ val = WM8994_SYSDSPCLK_ENA;
5513 -+ else
5514 -+ val = 0;
5515 -+ snd_soc_update_bits(codec, WM8994_CLOCKING_1,
5516 -+ WM8994_SYSDSPCLK_ENA |
5517 -+ WM8994_AIF1DSPCLK_ENA, val);
5518 - break;
5519 - }
5520 -
5521 -- /* We may also have postponed startup of DSP, handle that. */
5522 -- wm8958_aif_ev(w, kcontrol, event);
5523 --
5524 - return 0;
5525 - }
5526 -
5527 --static int late_disable_ev(struct snd_soc_dapm_widget *w,
5528 -- struct snd_kcontrol *kcontrol, int event)
5529 -+static int aif2clk_ev(struct snd_soc_dapm_widget *w,
5530 -+ struct snd_kcontrol *kcontrol, int event)
5531 - {
5532 - struct snd_soc_codec *codec = w->codec;
5533 -- struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5534 -+ int dac;
5535 -+ int adc;
5536 -+ int val;
5537 -
5538 - switch (event) {
5539 -+ case SND_SOC_DAPM_PRE_PMU:
5540 -+ val = snd_soc_read(codec, WM8994_AIF2_CONTROL_1);
5541 -+ if ((val & WM8994_AIF2ADCL_SRC) &&
5542 -+ (val & WM8994_AIF2ADCR_SRC))
5543 -+ adc = WM8994_AIF2ADCR_ENA;
5544 -+ else if (!(val & WM8994_AIF2ADCL_SRC) &&
5545 -+ !(val & WM8994_AIF2ADCR_SRC))
5546 -+ adc = WM8994_AIF2ADCL_ENA;
5547 -+ else
5548 -+ adc = WM8994_AIF2ADCL_ENA | WM8994_AIF2ADCR_ENA;
5549 -+
5550 -+
5551 -+ val = snd_soc_read(codec, WM8994_AIF2_CONTROL_2);
5552 -+ if ((val & WM8994_AIF2DACL_SRC) &&
5553 -+ (val & WM8994_AIF2DACR_SRC))
5554 -+ dac = WM8994_AIF2DACR_ENA;
5555 -+ else if (!(val & WM8994_AIF2DACL_SRC) &&
5556 -+ !(val & WM8994_AIF2DACR_SRC))
5557 -+ dac = WM8994_AIF2DACL_ENA;
5558 -+ else
5559 -+ dac = WM8994_AIF2DACL_ENA | WM8994_AIF2DACR_ENA;
5560 -+
5561 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
5562 -+ WM8994_AIF2ADCL_ENA |
5563 -+ WM8994_AIF2ADCR_ENA, adc);
5564 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5565 -+ WM8994_AIF2DACL_ENA |
5566 -+ WM8994_AIF2DACR_ENA, dac);
5567 -+ snd_soc_update_bits(codec, WM8994_CLOCKING_1,
5568 -+ WM8994_AIF2DSPCLK_ENA |
5569 -+ WM8994_SYSDSPCLK_ENA,
5570 -+ WM8994_AIF2DSPCLK_ENA |
5571 -+ WM8994_SYSDSPCLK_ENA);
5572 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
5573 -+ WM8994_AIF2ADCL_ENA |
5574 -+ WM8994_AIF2ADCR_ENA,
5575 -+ WM8994_AIF2ADCL_ENA |
5576 -+ WM8994_AIF2ADCR_ENA);
5577 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5578 -+ WM8994_AIF2DACL_ENA |
5579 -+ WM8994_AIF2DACR_ENA,
5580 -+ WM8994_AIF2DACL_ENA |
5581 -+ WM8994_AIF2DACR_ENA);
5582 -+ break;
5583 -+
5584 -+ case SND_SOC_DAPM_PRE_PMD:
5585 - case SND_SOC_DAPM_POST_PMD:
5586 -- if (wm8994->aif1clk_disable) {
5587 -- snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
5588 -- WM8994_AIF1CLK_ENA_MASK, 0);
5589 -- wm8994->aif1clk_disable = 0;
5590 -- }
5591 -- if (wm8994->aif2clk_disable) {
5592 -- snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
5593 -- WM8994_AIF2CLK_ENA_MASK, 0);
5594 -- wm8994->aif2clk_disable = 0;
5595 -- }
5596 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5597 -+ WM8994_AIF2DACL_ENA |
5598 -+ WM8994_AIF2DACR_ENA, 0);
5599 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
5600 -+ WM8994_AIF2ADCL_ENA |
5601 -+ WM8994_AIF2ADCR_ENA, 0);
5602 -+
5603 -+ val = snd_soc_read(codec, WM8994_CLOCKING_1);
5604 -+ if (val & WM8994_AIF1DSPCLK_ENA)
5605 -+ val = WM8994_SYSDSPCLK_ENA;
5606 -+ else
5607 -+ val = 0;
5608 -+ snd_soc_update_bits(codec, WM8994_CLOCKING_1,
5609 -+ WM8994_SYSDSPCLK_ENA |
5610 -+ WM8994_AIF2DSPCLK_ENA, val);
5611 - break;
5612 - }
5613 -
5614 - return 0;
5615 - }
5616 -
5617 --static int aif1clk_ev(struct snd_soc_dapm_widget *w,
5618 -- struct snd_kcontrol *kcontrol, int event)
5619 -+static int aif1clk_late_ev(struct snd_soc_dapm_widget *w,
5620 -+ struct snd_kcontrol *kcontrol, int event)
5621 - {
5622 - struct snd_soc_codec *codec = w->codec;
5623 - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5624 -@@ -954,8 +1063,8 @@ static int aif1clk_ev(struct snd_soc_dapm_widget *w,
5625 - return 0;
5626 - }
5627 -
5628 --static int aif2clk_ev(struct snd_soc_dapm_widget *w,
5629 -- struct snd_kcontrol *kcontrol, int event)
5630 -+static int aif2clk_late_ev(struct snd_soc_dapm_widget *w,
5631 -+ struct snd_kcontrol *kcontrol, int event)
5632 - {
5633 - struct snd_soc_codec *codec = w->codec;
5634 - struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5635 -@@ -972,6 +1081,63 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
5636 - return 0;
5637 - }
5638 -
5639 -+static int late_enable_ev(struct snd_soc_dapm_widget *w,
5640 -+ struct snd_kcontrol *kcontrol, int event)
5641 -+{
5642 -+ struct snd_soc_codec *codec = w->codec;
5643 -+ struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5644 -+
5645 -+ switch (event) {
5646 -+ case SND_SOC_DAPM_PRE_PMU:
5647 -+ if (wm8994->aif1clk_enable) {
5648 -+ aif1clk_ev(w, kcontrol, event);
5649 -+ snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
5650 -+ WM8994_AIF1CLK_ENA_MASK,
5651 -+ WM8994_AIF1CLK_ENA);
5652 -+ wm8994->aif1clk_enable = 0;
5653 -+ }
5654 -+ if (wm8994->aif2clk_enable) {
5655 -+ aif2clk_ev(w, kcontrol, event);
5656 -+ snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
5657 -+ WM8994_AIF2CLK_ENA_MASK,
5658 -+ WM8994_AIF2CLK_ENA);
5659 -+ wm8994->aif2clk_enable = 0;
5660 -+ }
5661 -+ break;
5662 -+ }
5663 -+
5664 -+ /* We may also have postponed startup of DSP, handle that. */
5665 -+ wm8958_aif_ev(w, kcontrol, event);
5666 -+
5667 -+ return 0;
5668 -+}
5669 -+
5670 -+static int late_disable_ev(struct snd_soc_dapm_widget *w,
5671 -+ struct snd_kcontrol *kcontrol, int event)
5672 -+{
5673 -+ struct snd_soc_codec *codec = w->codec;
5674 -+ struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
5675 -+
5676 -+ switch (event) {
5677 -+ case SND_SOC_DAPM_POST_PMD:
5678 -+ if (wm8994->aif1clk_disable) {
5679 -+ snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1,
5680 -+ WM8994_AIF1CLK_ENA_MASK, 0);
5681 -+ aif1clk_ev(w, kcontrol, event);
5682 -+ wm8994->aif1clk_disable = 0;
5683 -+ }
5684 -+ if (wm8994->aif2clk_disable) {
5685 -+ snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1,
5686 -+ WM8994_AIF2CLK_ENA_MASK, 0);
5687 -+ aif2clk_ev(w, kcontrol, event);
5688 -+ wm8994->aif2clk_disable = 0;
5689 -+ }
5690 -+ break;
5691 -+ }
5692 -+
5693 -+ return 0;
5694 -+}
5695 -+
5696 - static int adc_mux_ev(struct snd_soc_dapm_widget *w,
5697 - struct snd_kcontrol *kcontrol, int event)
5698 - {
5699 -@@ -1268,9 +1434,9 @@ static const struct snd_kcontrol_new aif2dacr_src_mux =
5700 - SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum);
5701 -
5702 - static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = {
5703 --SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev,
5704 -+SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_late_ev,
5705 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
5706 --SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev,
5707 -+SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_late_ev,
5708 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
5709 -
5710 - SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0,
5711 -@@ -1299,8 +1465,10 @@ SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev)
5712 - };
5713 -
5714 - static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = {
5715 --SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0),
5716 --SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0),
5717 -+SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, aif1clk_ev,
5718 -+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
5719 -+SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, aif2clk_ev,
5720 -+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD),
5721 - SND_SOC_DAPM_PGA("Direct Voice", SND_SOC_NOPM, 0, 0, NULL, 0),
5722 - SND_SOC_DAPM_MIXER("SPKL", WM8994_POWER_MANAGEMENT_3, 8, 0,
5723 - left_speaker_mixer, ARRAY_SIZE(left_speaker_mixer)),
5724 -@@ -1353,30 +1521,30 @@ SND_SOC_DAPM_SUPPLY("VMID", SND_SOC_NOPM, 0, 0, vmid_event,
5725 - SND_SOC_DAPM_SUPPLY("CLK_SYS", SND_SOC_NOPM, 0, 0, clk_sys_event,
5726 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
5727 -
5728 --SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0),
5729 --SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0),
5730 --SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0),
5731 -+SND_SOC_DAPM_SUPPLY("DSP1CLK", SND_SOC_NOPM, 3, 0, NULL, 0),
5732 -+SND_SOC_DAPM_SUPPLY("DSP2CLK", SND_SOC_NOPM, 2, 0, NULL, 0),
5733 -+SND_SOC_DAPM_SUPPLY("DSPINTCLK", SND_SOC_NOPM, 1, 0, NULL, 0),
5734 -
5735 - SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL,
5736 -- 0, WM8994_POWER_MANAGEMENT_4, 9, 0),
5737 -+ 0, SND_SOC_NOPM, 9, 0),
5738 - SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL,
5739 -- 0, WM8994_POWER_MANAGEMENT_4, 8, 0),
5740 -+ 0, SND_SOC_NOPM, 8, 0),
5741 - SND_SOC_DAPM_AIF_IN_E("AIF1DAC1L", NULL, 0,
5742 -- WM8994_POWER_MANAGEMENT_5, 9, 0, wm8958_aif_ev,
5743 -+ SND_SOC_NOPM, 9, 0, wm8958_aif_ev,
5744 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
5745 - SND_SOC_DAPM_AIF_IN_E("AIF1DAC1R", NULL, 0,
5746 -- WM8994_POWER_MANAGEMENT_5, 8, 0, wm8958_aif_ev,
5747 -+ SND_SOC_NOPM, 8, 0, wm8958_aif_ev,
5748 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
5749 -
5750 - SND_SOC_DAPM_AIF_OUT("AIF1ADC2L", NULL,
5751 -- 0, WM8994_POWER_MANAGEMENT_4, 11, 0),
5752 -+ 0, SND_SOC_NOPM, 11, 0),
5753 - SND_SOC_DAPM_AIF_OUT("AIF1ADC2R", NULL,
5754 -- 0, WM8994_POWER_MANAGEMENT_4, 10, 0),
5755 -+ 0, SND_SOC_NOPM, 10, 0),
5756 - SND_SOC_DAPM_AIF_IN_E("AIF1DAC2L", NULL, 0,
5757 -- WM8994_POWER_MANAGEMENT_5, 11, 0, wm8958_aif_ev,
5758 -+ SND_SOC_NOPM, 11, 0, wm8958_aif_ev,
5759 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
5760 - SND_SOC_DAPM_AIF_IN_E("AIF1DAC2R", NULL, 0,
5761 -- WM8994_POWER_MANAGEMENT_5, 10, 0, wm8958_aif_ev,
5762 -+ SND_SOC_NOPM, 10, 0, wm8958_aif_ev,
5763 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
5764 -
5765 - SND_SOC_DAPM_MIXER("AIF1ADC1L Mixer", SND_SOC_NOPM, 0, 0,
5766 -@@ -1403,14 +1571,14 @@ SND_SOC_DAPM_MIXER("DAC1R Mixer", SND_SOC_NOPM, 0, 0,
5767 - dac1r_mix, ARRAY_SIZE(dac1r_mix)),
5768 -
5769 - SND_SOC_DAPM_AIF_OUT("AIF2ADCL", NULL, 0,
5770 -- WM8994_POWER_MANAGEMENT_4, 13, 0),
5771 -+ SND_SOC_NOPM, 13, 0),
5772 - SND_SOC_DAPM_AIF_OUT("AIF2ADCR", NULL, 0,
5773 -- WM8994_POWER_MANAGEMENT_4, 12, 0),
5774 -+ SND_SOC_NOPM, 12, 0),
5775 - SND_SOC_DAPM_AIF_IN_E("AIF2DACL", NULL, 0,
5776 -- WM8994_POWER_MANAGEMENT_5, 13, 0, wm8958_aif_ev,
5777 -+ SND_SOC_NOPM, 13, 0, wm8958_aif_ev,
5778 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
5779 - SND_SOC_DAPM_AIF_IN_E("AIF2DACR", NULL, 0,
5780 -- WM8994_POWER_MANAGEMENT_5, 12, 0, wm8958_aif_ev,
5781 -+ SND_SOC_NOPM, 12, 0, wm8958_aif_ev,
5782 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
5783 -
5784 - SND_SOC_DAPM_AIF_IN("AIF1DACDAT", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0),
5785 -diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
5786 -index ea909c5..90e93bf 100644
5787 ---- a/sound/soc/soc-dapm.c
5788 -+++ b/sound/soc/soc-dapm.c
5789 -@@ -69,6 +69,7 @@ static int dapm_up_seq[] = {
5790 - [snd_soc_dapm_out_drv] = 10,
5791 - [snd_soc_dapm_hp] = 10,
5792 - [snd_soc_dapm_spk] = 10,
5793 -+ [snd_soc_dapm_line] = 10,
5794 - [snd_soc_dapm_post] = 11,
5795 - };
5796 -
5797 -@@ -77,6 +78,7 @@ static int dapm_down_seq[] = {
5798 - [snd_soc_dapm_adc] = 1,
5799 - [snd_soc_dapm_hp] = 2,
5800 - [snd_soc_dapm_spk] = 2,
5801 -+ [snd_soc_dapm_line] = 2,
5802 - [snd_soc_dapm_out_drv] = 2,
5803 - [snd_soc_dapm_pga] = 4,
5804 - [snd_soc_dapm_mixer_named_ctl] = 5,
5805 -diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
5806 -index adb372d..e0a0970 100644
5807 ---- a/tools/perf/util/hist.c
5808 -+++ b/tools/perf/util/hist.c
5809 -@@ -237,8 +237,8 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
5810 - * mis-adjust symbol addresses when computing
5811 - * the history counter to increment.
5812 - */
5813 -- if (he->ms.map != entry->ms.map) {
5814 -- he->ms.map = entry->ms.map;
5815 -+ if (he->ms.map != entry.ms.map) {
5816 -+ he->ms.map = entry.ms.map;
5817 - if (he->ms.map)
5818 - he->ms.map->referenced = true;
5819 - }
5820 -diff --git a/virt/kvm/iommu.c b/virt/kvm/iommu.c
5821 -index a195c07..fd817a2 100644
5822 ---- a/virt/kvm/iommu.c
5823 -+++ b/virt/kvm/iommu.c
5824 -@@ -309,6 +309,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
5825 - }
5826 - }
5827 -
5828 -+void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot)
5829 -+{
5830 -+ kvm_iommu_put_pages(kvm, slot->base_gfn, slot->npages);
5831 -+}
5832 -+
5833 - static int kvm_iommu_unmap_memslots(struct kvm *kvm)
5834 - {
5835 - int i, idx;
5836 -@@ -317,10 +322,9 @@ static int kvm_iommu_unmap_memslots(struct kvm *kvm)
5837 - idx = srcu_read_lock(&kvm->srcu);
5838 - slots = kvm_memslots(kvm);
5839 -
5840 -- for (i = 0; i < slots->nmemslots; i++) {
5841 -- kvm_iommu_put_pages(kvm, slots->memslots[i].base_gfn,
5842 -- slots->memslots[i].npages);
5843 -- }
5844 -+ for (i = 0; i < slots->nmemslots; i++)
5845 -+ kvm_iommu_unmap_pages(kvm, &slots->memslots[i]);
5846 -+
5847 - srcu_read_unlock(&kvm->srcu, idx);
5848 -
5849 - return 0;
5850 -diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
5851 -index d9cfb78..e401c1b 100644
5852 ---- a/virt/kvm/kvm_main.c
5853 -+++ b/virt/kvm/kvm_main.c
5854 -@@ -802,12 +802,13 @@ skip_lpage:
5855 - if (r)
5856 - goto out_free;
5857 -
5858 -- /* map the pages in iommu page table */
5859 -+ /* map/unmap the pages in iommu page table */
5860 - if (npages) {
5861 - r = kvm_iommu_map_pages(kvm, &new);
5862 - if (r)
5863 - goto out_free;
5864 -- }
5865 -+ } else
5866 -+ kvm_iommu_unmap_pages(kvm, &old);
5867 -
5868 - r = -ENOMEM;
5869 - slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);
5870
5871 diff --git a/3.2.18/1017_linux-3.2.18.patch b/3.2.18/1017_linux-3.2.18.patch
5872 deleted file mode 100644
5873 index 7a64c07..0000000
5874 --- a/3.2.18/1017_linux-3.2.18.patch
5875 +++ /dev/null
5876 @@ -1,1791 +0,0 @@
5877 -diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
5878 -index 589f2da..a4399f5 100644
5879 ---- a/Documentation/networking/ip-sysctl.txt
5880 -+++ b/Documentation/networking/ip-sysctl.txt
5881 -@@ -137,7 +137,7 @@ tcp_adv_win_scale - INTEGER
5882 - (if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale),
5883 - if it is <= 0.
5884 - Possible values are [-31, 31], inclusive.
5885 -- Default: 2
5886 -+ Default: 1
5887 -
5888 - tcp_allowed_congestion_control - STRING
5889 - Show/set the congestion control choices available to non-privileged
5890 -@@ -397,7 +397,7 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max
5891 - net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables
5892 - automatic tuning of that socket's receive buffer size, in which
5893 - case this value is ignored.
5894 -- Default: between 87380B and 4MB, depending on RAM size.
5895 -+ Default: between 87380B and 6MB, depending on RAM size.
5896 -
5897 - tcp_sack - BOOLEAN
5898 - Enable select acknowledgments (SACKS).
5899 -diff --git a/Makefile b/Makefile
5900 -index 4c4efa3..add68f1 100644
5901 ---- a/Makefile
5902 -+++ b/Makefile
5903 -@@ -1,6 +1,6 @@
5904 - VERSION = 3
5905 - PATCHLEVEL = 2
5906 --SUBLEVEL = 17
5907 -+SUBLEVEL = 18
5908 - EXTRAVERSION =
5909 - NAME = Saber-toothed Squirrel
5910 -
5911 -diff --git a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
5912 -index 1e2d332..c88420d 100644
5913 ---- a/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
5914 -+++ b/arch/arm/mach-omap2/include/mach/ctrl_module_pad_core_44xx.h
5915 -@@ -941,10 +941,10 @@
5916 - #define OMAP4_DSI2_LANEENABLE_MASK (0x7 << 29)
5917 - #define OMAP4_DSI1_LANEENABLE_SHIFT 24
5918 - #define OMAP4_DSI1_LANEENABLE_MASK (0x1f << 24)
5919 --#define OMAP4_DSI2_PIPD_SHIFT 19
5920 --#define OMAP4_DSI2_PIPD_MASK (0x1f << 19)
5921 --#define OMAP4_DSI1_PIPD_SHIFT 14
5922 --#define OMAP4_DSI1_PIPD_MASK (0x1f << 14)
5923 -+#define OMAP4_DSI1_PIPD_SHIFT 19
5924 -+#define OMAP4_DSI1_PIPD_MASK (0x1f << 19)
5925 -+#define OMAP4_DSI2_PIPD_SHIFT 14
5926 -+#define OMAP4_DSI2_PIPD_MASK (0x1f << 14)
5927 -
5928 - /* CONTROL_MCBSPLP */
5929 - #define OMAP4_ALBCTRLRX_FSX_SHIFT 31
5930 -diff --git a/arch/arm/mach-orion5x/mpp.h b/arch/arm/mach-orion5x/mpp.h
5931 -index eac6897..db70e79 100644
5932 ---- a/arch/arm/mach-orion5x/mpp.h
5933 -+++ b/arch/arm/mach-orion5x/mpp.h
5934 -@@ -65,8 +65,8 @@
5935 - #define MPP8_GIGE MPP(8, 0x1, 0, 0, 1, 1, 1)
5936 -
5937 - #define MPP9_UNUSED MPP(9, 0x0, 0, 0, 1, 1, 1)
5938 --#define MPP9_GPIO MPP(9, 0x0, 0, 0, 1, 1, 1)
5939 --#define MPP9_GIGE MPP(9, 0x1, 1, 1, 1, 1, 1)
5940 -+#define MPP9_GPIO MPP(9, 0x0, 1, 1, 1, 1, 1)
5941 -+#define MPP9_GIGE MPP(9, 0x1, 0, 0, 1, 1, 1)
5942 -
5943 - #define MPP10_UNUSED MPP(10, 0x0, 0, 0, 1, 1, 1)
5944 - #define MPP10_GPIO MPP(10, 0x0, 1, 1, 1, 1, 1)
5945 -diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
5946 -index aa33949..4b0bc37 100644
5947 ---- a/arch/arm/mm/fault.c
5948 -+++ b/arch/arm/mm/fault.c
5949 -@@ -267,7 +267,9 @@ good_area:
5950 - return fault;
5951 -
5952 - check_stack:
5953 -- if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
5954 -+ /* Don't allow expansion below FIRST_USER_ADDRESS */
5955 -+ if (vma->vm_flags & VM_GROWSDOWN &&
5956 -+ addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr))
5957 - goto good_area;
5958 - out:
5959 - return fault;
5960 -diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
5961 -index 8f3ccdd..8ea07e4 100644
5962 ---- a/arch/arm/vfp/vfpmodule.c
5963 -+++ b/arch/arm/vfp/vfpmodule.c
5964 -@@ -11,6 +11,7 @@
5965 - #include <linux/types.h>
5966 - #include <linux/cpu.h>
5967 - #include <linux/cpu_pm.h>
5968 -+#include <linux/hardirq.h>
5969 - #include <linux/kernel.h>
5970 - #include <linux/notifier.h>
5971 - #include <linux/signal.h>
5972 -@@ -428,7 +429,10 @@ void VFP_bounce(u32 trigger, u32 fpexc, struct pt_regs *regs)
5973 -
5974 - static void vfp_enable(void *unused)
5975 - {
5976 -- u32 access = get_copro_access();
5977 -+ u32 access;
5978 -+
5979 -+ BUG_ON(preemptible());
5980 -+ access = get_copro_access();
5981 -
5982 - /*
5983 - * Enable full access to VFP (cp10 and cp11)
5984 -@@ -556,7 +560,7 @@ static int __init vfp_init(void)
5985 - unsigned int cpu_arch = cpu_architecture();
5986 -
5987 - if (cpu_arch >= CPU_ARCH_ARMv6)
5988 -- vfp_enable(NULL);
5989 -+ on_each_cpu(vfp_enable, NULL, 1);
5990 -
5991 - /*
5992 - * First check that there is a VFP that we can use.
5993 -@@ -577,8 +581,6 @@ static int __init vfp_init(void)
5994 - } else {
5995 - hotcpu_notifier(vfp_hotplug, 0);
5996 -
5997 -- smp_call_function(vfp_enable, NULL, 1);
5998 --
5999 - VFP_arch = (vfpsid & FPSID_ARCH_MASK) >> FPSID_ARCH_BIT; /* Extract the architecture version */
6000 - printk("implementor %02x architecture %d part %02x variant %x rev %x\n",
6001 - (vfpsid & FPSID_IMPLEMENTER_MASK) >> FPSID_IMPLEMENTER_BIT,
6002 -diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
6003 -index 7617248..7a3bd25 100644
6004 ---- a/arch/ia64/include/asm/unistd.h
6005 -+++ b/arch/ia64/include/asm/unistd.h
6006 -@@ -323,11 +323,12 @@
6007 - #define __NR_sendmmsg 1331
6008 - #define __NR_process_vm_readv 1332
6009 - #define __NR_process_vm_writev 1333
6010 -+#define __NR_accept4 1334
6011 -
6012 - #ifdef __KERNEL__
6013 -
6014 -
6015 --#define NR_syscalls 310 /* length of syscall table */
6016 -+#define NR_syscalls 311 /* length of syscall table */
6017 -
6018 - /*
6019 - * The following defines stop scripts/checksyscalls.sh from complaining about
6020 -diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
6021 -index 5b31d46..1ccbe12 100644
6022 ---- a/arch/ia64/kernel/entry.S
6023 -+++ b/arch/ia64/kernel/entry.S
6024 -@@ -1779,6 +1779,7 @@ sys_call_table:
6025 - data8 sys_sendmmsg
6026 - data8 sys_process_vm_readv
6027 - data8 sys_process_vm_writev
6028 -+ data8 sys_accept4
6029 -
6030 - .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
6031 - #endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
6032 -diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
6033 -index 38d48a5..9708851 100644
6034 ---- a/arch/sparc/kernel/central.c
6035 -+++ b/arch/sparc/kernel/central.c
6036 -@@ -269,4 +269,4 @@ static int __init sunfire_init(void)
6037 - return 0;
6038 - }
6039 -
6040 --subsys_initcall(sunfire_init);
6041 -+fs_initcall(sunfire_init);
6042 -diff --git a/arch/sparc/mm/ultra.S b/arch/sparc/mm/ultra.S
6043 -index b57a594..874162a 100644
6044 ---- a/arch/sparc/mm/ultra.S
6045 -+++ b/arch/sparc/mm/ultra.S
6046 -@@ -495,11 +495,11 @@ xcall_fetch_glob_regs:
6047 - stx %o7, [%g1 + GR_SNAP_O7]
6048 - stx %i7, [%g1 + GR_SNAP_I7]
6049 - /* Don't try this at home kids... */
6050 -- rdpr %cwp, %g2
6051 -- sub %g2, 1, %g7
6052 -+ rdpr %cwp, %g3
6053 -+ sub %g3, 1, %g7
6054 - wrpr %g7, %cwp
6055 - mov %i7, %g7
6056 -- wrpr %g2, %cwp
6057 -+ wrpr %g3, %cwp
6058 - stx %g7, [%g1 + GR_SNAP_RPC]
6059 - sethi %hi(trap_block), %g7
6060 - or %g7, %lo(trap_block), %g7
6061 -diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
6062 -index a7869ad..41459d8 100644
6063 ---- a/arch/tile/kernel/compat_signal.c
6064 -+++ b/arch/tile/kernel/compat_signal.c
6065 -@@ -406,19 +406,17 @@ int compat_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
6066 - * Set up registers for signal handler.
6067 - * Registers that we don't modify keep the value they had from
6068 - * user-space at the time we took the signal.
6069 -+ * We always pass siginfo and mcontext, regardless of SA_SIGINFO,
6070 -+ * since some things rely on this (e.g. glibc's debug/segfault.c).
6071 - */
6072 - regs->pc = ptr_to_compat_reg(ka->sa.sa_handler);
6073 - regs->ex1 = PL_ICS_EX1(USER_PL, 1); /* set crit sec in handler */
6074 - regs->sp = ptr_to_compat_reg(frame);
6075 - regs->lr = restorer;
6076 - regs->regs[0] = (unsigned long) usig;
6077 --
6078 -- if (ka->sa.sa_flags & SA_SIGINFO) {
6079 -- /* Need extra arguments, so mark to restore caller-saves. */
6080 -- regs->regs[1] = ptr_to_compat_reg(&frame->info);
6081 -- regs->regs[2] = ptr_to_compat_reg(&frame->uc);
6082 -- regs->flags |= PT_FLAGS_CALLER_SAVES;
6083 -- }
6084 -+ regs->regs[1] = ptr_to_compat_reg(&frame->info);
6085 -+ regs->regs[2] = ptr_to_compat_reg(&frame->uc);
6086 -+ regs->flags |= PT_FLAGS_CALLER_SAVES;
6087 -
6088 - /*
6089 - * Notify any tracer that was single-stepping it.
6090 -diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig
6091 -index 6d16b4b..7e3002b 100644
6092 ---- a/drivers/crypto/Kconfig
6093 -+++ b/drivers/crypto/Kconfig
6094 -@@ -173,6 +173,7 @@ config CRYPTO_DEV_MV_CESA
6095 - select CRYPTO_ALGAPI
6096 - select CRYPTO_AES
6097 - select CRYPTO_BLKCIPHER2
6098 -+ select CRYPTO_HASH
6099 - help
6100 - This driver allows you to utilize the Cryptographic Engines and
6101 - Security Accelerator (CESA) which can be found on the Marvell Orion
6102 -diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
6103 -index 461958f..271fd49 100644
6104 ---- a/drivers/gpio/gpio-ml-ioh.c
6105 -+++ b/drivers/gpio/gpio-ml-ioh.c
6106 -@@ -448,6 +448,7 @@ static int __devinit ioh_gpio_probe(struct pci_dev *pdev,
6107 - chip->reg = chip->base;
6108 - chip->ch = i;
6109 - mutex_init(&chip->lock);
6110 -+ spin_lock_init(&chip->spinlock);
6111 - ioh_gpio_setup(chip, num_ports[i]);
6112 - ret = gpiochip_add(&chip->gpio);
6113 - if (ret) {
6114 -diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
6115 -index 801d92d..a417f94 100644
6116 ---- a/drivers/md/dm-mpath.c
6117 -+++ b/drivers/md/dm-mpath.c
6118 -@@ -698,8 +698,8 @@ static int parse_hw_handler(struct dm_arg_set *as, struct multipath *m)
6119 - return 0;
6120 -
6121 - m->hw_handler_name = kstrdup(dm_shift_arg(as), GFP_KERNEL);
6122 -- request_module("scsi_dh_%s", m->hw_handler_name);
6123 -- if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
6124 -+ if (!try_then_request_module(scsi_dh_handler_exist(m->hw_handler_name),
6125 -+ "scsi_dh_%s", m->hw_handler_name)) {
6126 - ti->error = "unknown hardware handler type";
6127 - ret = -EINVAL;
6128 - goto fail;
6129 -diff --git a/drivers/md/md.c b/drivers/md/md.c
6130 -index 065ab4f..adcd850 100644
6131 ---- a/drivers/md/md.c
6132 -+++ b/drivers/md/md.c
6133 -@@ -392,6 +392,8 @@ void mddev_suspend(struct mddev *mddev)
6134 - synchronize_rcu();
6135 - wait_event(mddev->sb_wait, atomic_read(&mddev->active_io) == 0);
6136 - mddev->pers->quiesce(mddev, 1);
6137 -+
6138 -+ del_timer_sync(&mddev->safemode_timer);
6139 - }
6140 - EXPORT_SYMBOL_GPL(mddev_suspend);
6141 -
6142 -diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
6143 -index cf10ecf..ed77c6d 100644
6144 ---- a/drivers/media/rc/ene_ir.c
6145 -+++ b/drivers/media/rc/ene_ir.c
6146 -@@ -1018,22 +1018,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
6147 -
6148 - spin_lock_init(&dev->hw_lock);
6149 -
6150 -- /* claim the resources */
6151 -- error = -EBUSY;
6152 -- dev->hw_io = pnp_port_start(pnp_dev, 0);
6153 -- if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
6154 -- dev->hw_io = -1;
6155 -- dev->irq = -1;
6156 -- goto error;
6157 -- }
6158 --
6159 -- dev->irq = pnp_irq(pnp_dev, 0);
6160 -- if (request_irq(dev->irq, ene_isr,
6161 -- IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
6162 -- dev->irq = -1;
6163 -- goto error;
6164 -- }
6165 --
6166 - pnp_set_drvdata(pnp_dev, dev);
6167 - dev->pnp_dev = pnp_dev;
6168 -
6169 -@@ -1086,6 +1070,22 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
6170 - device_set_wakeup_capable(&pnp_dev->dev, true);
6171 - device_set_wakeup_enable(&pnp_dev->dev, true);
6172 -
6173 -+ /* claim the resources */
6174 -+ error = -EBUSY;
6175 -+ dev->hw_io = pnp_port_start(pnp_dev, 0);
6176 -+ if (!request_region(dev->hw_io, ENE_IO_SIZE, ENE_DRIVER_NAME)) {
6177 -+ dev->hw_io = -1;
6178 -+ dev->irq = -1;
6179 -+ goto error;
6180 -+ }
6181 -+
6182 -+ dev->irq = pnp_irq(pnp_dev, 0);
6183 -+ if (request_irq(dev->irq, ene_isr,
6184 -+ IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) {
6185 -+ dev->irq = -1;
6186 -+ goto error;
6187 -+ }
6188 -+
6189 - error = rc_register_device(rdev);
6190 - if (error < 0)
6191 - goto error;
6192 -diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
6193 -index 7f7079b..4218f73 100644
6194 ---- a/drivers/media/rc/fintek-cir.c
6195 -+++ b/drivers/media/rc/fintek-cir.c
6196 -@@ -504,16 +504,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
6197 -
6198 - spin_lock_init(&fintek->fintek_lock);
6199 -
6200 -- ret = -EBUSY;
6201 -- /* now claim resources */
6202 -- if (!request_region(fintek->cir_addr,
6203 -- fintek->cir_port_len, FINTEK_DRIVER_NAME))
6204 -- goto failure;
6205 --
6206 -- if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
6207 -- FINTEK_DRIVER_NAME, (void *)fintek))
6208 -- goto failure;
6209 --
6210 - pnp_set_drvdata(pdev, fintek);
6211 - fintek->pdev = pdev;
6212 -
6213 -@@ -548,6 +538,16 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
6214 - /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */
6215 - rdev->rx_resolution = US_TO_NS(CIR_SAMPLE_PERIOD);
6216 -
6217 -+ ret = -EBUSY;
6218 -+ /* now claim resources */
6219 -+ if (!request_region(fintek->cir_addr,
6220 -+ fintek->cir_port_len, FINTEK_DRIVER_NAME))
6221 -+ goto failure;
6222 -+
6223 -+ if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
6224 -+ FINTEK_DRIVER_NAME, (void *)fintek))
6225 -+ goto failure;
6226 -+
6227 - ret = rc_register_device(rdev);
6228 - if (ret)
6229 - goto failure;
6230 -diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
6231 -index 682009d..0e49c99 100644
6232 ---- a/drivers/media/rc/ite-cir.c
6233 -+++ b/drivers/media/rc/ite-cir.c
6234 -@@ -1515,16 +1515,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
6235 - /* initialize raw event */
6236 - init_ir_raw_event(&itdev->rawir);
6237 -
6238 -- ret = -EBUSY;
6239 -- /* now claim resources */
6240 -- if (!request_region(itdev->cir_addr,
6241 -- dev_desc->io_region_size, ITE_DRIVER_NAME))
6242 -- goto failure;
6243 --
6244 -- if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
6245 -- ITE_DRIVER_NAME, (void *)itdev))
6246 -- goto failure;
6247 --
6248 - /* set driver data into the pnp device */
6249 - pnp_set_drvdata(pdev, itdev);
6250 - itdev->pdev = pdev;
6251 -@@ -1600,6 +1590,16 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
6252 - rdev->driver_name = ITE_DRIVER_NAME;
6253 - rdev->map_name = RC_MAP_RC6_MCE;
6254 -
6255 -+ ret = -EBUSY;
6256 -+ /* now claim resources */
6257 -+ if (!request_region(itdev->cir_addr,
6258 -+ dev_desc->io_region_size, ITE_DRIVER_NAME))
6259 -+ goto failure;
6260 -+
6261 -+ if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
6262 -+ ITE_DRIVER_NAME, (void *)itdev))
6263 -+ goto failure;
6264 -+
6265 - ret = rc_register_device(rdev);
6266 - if (ret)
6267 - goto failure;
6268 -diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
6269 -index 144f3f5..8b2c071 100644
6270 ---- a/drivers/media/rc/nuvoton-cir.c
6271 -+++ b/drivers/media/rc/nuvoton-cir.c
6272 -@@ -1021,24 +1021,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
6273 - spin_lock_init(&nvt->nvt_lock);
6274 - spin_lock_init(&nvt->tx.lock);
6275 -
6276 -- ret = -EBUSY;
6277 -- /* now claim resources */
6278 -- if (!request_region(nvt->cir_addr,
6279 -- CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
6280 -- goto failure;
6281 --
6282 -- if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
6283 -- NVT_DRIVER_NAME, (void *)nvt))
6284 -- goto failure;
6285 --
6286 -- if (!request_region(nvt->cir_wake_addr,
6287 -- CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
6288 -- goto failure;
6289 --
6290 -- if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
6291 -- NVT_DRIVER_NAME, (void *)nvt))
6292 -- goto failure;
6293 --
6294 - pnp_set_drvdata(pdev, nvt);
6295 - nvt->pdev = pdev;
6296 -
6297 -@@ -1085,6 +1067,24 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
6298 - rdev->tx_resolution = XYZ;
6299 - #endif
6300 -
6301 -+ ret = -EBUSY;
6302 -+ /* now claim resources */
6303 -+ if (!request_region(nvt->cir_addr,
6304 -+ CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
6305 -+ goto failure;
6306 -+
6307 -+ if (request_irq(nvt->cir_irq, nvt_cir_isr, IRQF_SHARED,
6308 -+ NVT_DRIVER_NAME, (void *)nvt))
6309 -+ goto failure;
6310 -+
6311 -+ if (!request_region(nvt->cir_wake_addr,
6312 -+ CIR_IOREG_LENGTH, NVT_DRIVER_NAME))
6313 -+ goto failure;
6314 -+
6315 -+ if (request_irq(nvt->cir_wake_irq, nvt_cir_wake_isr, IRQF_SHARED,
6316 -+ NVT_DRIVER_NAME, (void *)nvt))
6317 -+ goto failure;
6318 -+
6319 - ret = rc_register_device(rdev);
6320 - if (ret)
6321 - goto failure;
6322 -diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
6323 -index a7e7d6f..4591770 100644
6324 ---- a/drivers/media/rc/winbond-cir.c
6325 -+++ b/drivers/media/rc/winbond-cir.c
6326 -@@ -991,39 +991,10 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
6327 - "(w: 0x%lX, e: 0x%lX, s: 0x%lX, i: %u)\n",
6328 - data->wbase, data->ebase, data->sbase, data->irq);
6329 -
6330 -- if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
6331 -- dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6332 -- data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
6333 -- err = -EBUSY;
6334 -- goto exit_free_data;
6335 -- }
6336 --
6337 -- if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
6338 -- dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6339 -- data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
6340 -- err = -EBUSY;
6341 -- goto exit_release_wbase;
6342 -- }
6343 --
6344 -- if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
6345 -- dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6346 -- data->sbase, data->sbase + SP_IOMEM_LEN - 1);
6347 -- err = -EBUSY;
6348 -- goto exit_release_ebase;
6349 -- }
6350 --
6351 -- err = request_irq(data->irq, wbcir_irq_handler,
6352 -- IRQF_DISABLED, DRVNAME, device);
6353 -- if (err) {
6354 -- dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
6355 -- err = -EBUSY;
6356 -- goto exit_release_sbase;
6357 -- }
6358 --
6359 - led_trigger_register_simple("cir-tx", &data->txtrigger);
6360 - if (!data->txtrigger) {
6361 - err = -ENOMEM;
6362 -- goto exit_free_irq;
6363 -+ goto exit_free_data;
6364 - }
6365 -
6366 - led_trigger_register_simple("cir-rx", &data->rxtrigger);
6367 -@@ -1062,9 +1033,38 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
6368 - data->dev->priv = data;
6369 - data->dev->dev.parent = &device->dev;
6370 -
6371 -+ if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
6372 -+ dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6373 -+ data->wbase, data->wbase + WAKEUP_IOMEM_LEN - 1);
6374 -+ err = -EBUSY;
6375 -+ goto exit_free_rc;
6376 -+ }
6377 -+
6378 -+ if (!request_region(data->ebase, EHFUNC_IOMEM_LEN, DRVNAME)) {
6379 -+ dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6380 -+ data->ebase, data->ebase + EHFUNC_IOMEM_LEN - 1);
6381 -+ err = -EBUSY;
6382 -+ goto exit_release_wbase;
6383 -+ }
6384 -+
6385 -+ if (!request_region(data->sbase, SP_IOMEM_LEN, DRVNAME)) {
6386 -+ dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
6387 -+ data->sbase, data->sbase + SP_IOMEM_LEN - 1);
6388 -+ err = -EBUSY;
6389 -+ goto exit_release_ebase;
6390 -+ }
6391 -+
6392 -+ err = request_irq(data->irq, wbcir_irq_handler,
6393 -+ IRQF_DISABLED, DRVNAME, device);
6394 -+ if (err) {
6395 -+ dev_err(dev, "Failed to claim IRQ %u\n", data->irq);
6396 -+ err = -EBUSY;
6397 -+ goto exit_release_sbase;
6398 -+ }
6399 -+
6400 - err = rc_register_device(data->dev);
6401 - if (err)
6402 -- goto exit_free_rc;
6403 -+ goto exit_free_irq;
6404 -
6405 - device_init_wakeup(&device->dev, 1);
6406 -
6407 -@@ -1072,14 +1072,6 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
6408 -
6409 - return 0;
6410 -
6411 --exit_free_rc:
6412 -- rc_free_device(data->dev);
6413 --exit_unregister_led:
6414 -- led_classdev_unregister(&data->led);
6415 --exit_unregister_rxtrigger:
6416 -- led_trigger_unregister_simple(data->rxtrigger);
6417 --exit_unregister_txtrigger:
6418 -- led_trigger_unregister_simple(data->txtrigger);
6419 - exit_free_irq:
6420 - free_irq(data->irq, device);
6421 - exit_release_sbase:
6422 -@@ -1088,6 +1080,14 @@ exit_release_ebase:
6423 - release_region(data->ebase, EHFUNC_IOMEM_LEN);
6424 - exit_release_wbase:
6425 - release_region(data->wbase, WAKEUP_IOMEM_LEN);
6426 -+exit_free_rc:
6427 -+ rc_free_device(data->dev);
6428 -+exit_unregister_led:
6429 -+ led_classdev_unregister(&data->led);
6430 -+exit_unregister_rxtrigger:
6431 -+ led_trigger_unregister_simple(data->rxtrigger);
6432 -+exit_unregister_txtrigger:
6433 -+ led_trigger_unregister_simple(data->txtrigger);
6434 - exit_free_data:
6435 - kfree(data);
6436 - pnp_set_drvdata(device, NULL);
6437 -diff --git a/drivers/media/video/marvell-ccic/mmp-driver.c b/drivers/media/video/marvell-ccic/mmp-driver.c
6438 -index fb0b124..a6b7657 100644
6439 ---- a/drivers/media/video/marvell-ccic/mmp-driver.c
6440 -+++ b/drivers/media/video/marvell-ccic/mmp-driver.c
6441 -@@ -175,7 +175,6 @@ static int mmpcam_probe(struct platform_device *pdev)
6442 - INIT_LIST_HEAD(&cam->devlist);
6443 -
6444 - mcam = &cam->mcam;
6445 -- mcam->platform = MHP_Armada610;
6446 - mcam->plat_power_up = mmpcam_power_up;
6447 - mcam->plat_power_down = mmpcam_power_down;
6448 - mcam->dev = &pdev->dev;
6449 -diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
6450 -index 2cc3b91..327a81f 100644
6451 ---- a/drivers/media/video/s5p-fimc/fimc-capture.c
6452 -+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
6453 -@@ -1304,7 +1304,7 @@ static int fimc_subdev_set_crop(struct v4l2_subdev *sd,
6454 - fimc_capture_try_crop(ctx, r, crop->pad);
6455 -
6456 - if (crop->which == V4L2_SUBDEV_FORMAT_TRY) {
6457 -- mutex_lock(&fimc->lock);
6458 -+ mutex_unlock(&fimc->lock);
6459 - *v4l2_subdev_get_try_crop(fh, crop->pad) = *r;
6460 - return 0;
6461 - }
6462 -diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
6463 -index 3d55883..2dcac28 100644
6464 ---- a/drivers/net/ethernet/broadcom/tg3.c
6465 -+++ b/drivers/net/ethernet/broadcom/tg3.c
6466 -@@ -879,8 +879,13 @@ static inline unsigned int tg3_has_work(struct tg3_napi *tnapi)
6467 - if (sblk->status & SD_STATUS_LINK_CHG)
6468 - work_exists = 1;
6469 - }
6470 -- /* check for RX/TX work to do */
6471 -- if (sblk->idx[0].tx_consumer != tnapi->tx_cons ||
6472 -+
6473 -+ /* check for TX work to do */
6474 -+ if (sblk->idx[0].tx_consumer != tnapi->tx_cons)
6475 -+ work_exists = 1;
6476 -+
6477 -+ /* check for RX work to do */
6478 -+ if (tnapi->rx_rcb_prod_idx &&
6479 - *(tnapi->rx_rcb_prod_idx) != tnapi->rx_rcb_ptr)
6480 - work_exists = 1;
6481 -
6482 -@@ -5895,6 +5900,9 @@ static int tg3_poll_work(struct tg3_napi *tnapi, int work_done, int budget)
6483 - return work_done;
6484 - }
6485 -
6486 -+ if (!tnapi->rx_rcb_prod_idx)
6487 -+ return work_done;
6488 -+
6489 - /* run RX thread, within the bounds set by NAPI.
6490 - * All RX "locking" is done by ensuring outside
6491 - * code synchronizes with tg3->napi.poll()
6492 -@@ -7448,6 +7456,12 @@ static int tg3_alloc_consistent(struct tg3 *tp)
6493 - */
6494 - switch (i) {
6495 - default:
6496 -+ if (tg3_flag(tp, ENABLE_RSS)) {
6497 -+ tnapi->rx_rcb_prod_idx = NULL;
6498 -+ break;
6499 -+ }
6500 -+ /* Fall through */
6501 -+ case 1:
6502 - tnapi->rx_rcb_prod_idx = &sblk->idx[0].rx_producer;
6503 - break;
6504 - case 2:
6505 -diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
6506 -index cf480b5..de00805 100644
6507 ---- a/drivers/net/ethernet/intel/e1000/e1000_main.c
6508 -+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
6509 -@@ -494,7 +494,11 @@ out:
6510 - static void e1000_down_and_stop(struct e1000_adapter *adapter)
6511 - {
6512 - set_bit(__E1000_DOWN, &adapter->flags);
6513 -- cancel_work_sync(&adapter->reset_task);
6514 -+
6515 -+ /* Only kill reset task if adapter is not resetting */
6516 -+ if (!test_bit(__E1000_RESETTING, &adapter->flags))
6517 -+ cancel_work_sync(&adapter->reset_task);
6518 -+
6519 - cancel_delayed_work_sync(&adapter->watchdog_task);
6520 - cancel_delayed_work_sync(&adapter->phy_info_task);
6521 - cancel_delayed_work_sync(&adapter->fifo_stall_task);
6522 -diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
6523 -index 7eb8a00..65c51ff 100644
6524 ---- a/drivers/net/ethernet/marvell/sky2.c
6525 -+++ b/drivers/net/ethernet/marvell/sky2.c
6526 -@@ -2475,8 +2475,13 @@ static struct sk_buff *receive_copy(struct sky2_port *sky2,
6527 - skb_copy_from_linear_data(re->skb, skb->data, length);
6528 - skb->ip_summed = re->skb->ip_summed;
6529 - skb->csum = re->skb->csum;
6530 -+ skb->rxhash = re->skb->rxhash;
6531 -+ skb->vlan_tci = re->skb->vlan_tci;
6532 -+
6533 - pci_dma_sync_single_for_device(sky2->hw->pdev, re->data_addr,
6534 - length, PCI_DMA_FROMDEVICE);
6535 -+ re->skb->vlan_tci = 0;
6536 -+ re->skb->rxhash = 0;
6537 - re->skb->ip_summed = CHECKSUM_NONE;
6538 - skb_put(skb, length);
6539 - }
6540 -@@ -2561,9 +2566,6 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
6541 - struct sk_buff *skb = NULL;
6542 - u16 count = (status & GMR_FS_LEN) >> 16;
6543 -
6544 -- if (status & GMR_FS_VLAN)
6545 -- count -= VLAN_HLEN; /* Account for vlan tag */
6546 --
6547 - netif_printk(sky2, rx_status, KERN_DEBUG, dev,
6548 - "rx slot %u status 0x%x len %d\n",
6549 - sky2->rx_next, status, length);
6550 -@@ -2571,6 +2573,9 @@ static struct sk_buff *sky2_receive(struct net_device *dev,
6551 - sky2->rx_next = (sky2->rx_next + 1) % sky2->rx_pending;
6552 - prefetch(sky2->rx_ring + sky2->rx_next);
6553 -
6554 -+ if (vlan_tx_tag_present(re->skb))
6555 -+ count -= VLAN_HLEN; /* Account for vlan tag */
6556 -+
6557 - /* This chip has hardware problems that generates bogus status.
6558 - * So do only marginal checking and expect higher level protocols
6559 - * to handle crap frames.
6560 -@@ -2628,11 +2633,8 @@ static inline void sky2_tx_done(struct net_device *dev, u16 last)
6561 - }
6562 -
6563 - static inline void sky2_skb_rx(const struct sky2_port *sky2,
6564 -- u32 status, struct sk_buff *skb)
6565 -+ struct sk_buff *skb)
6566 - {
6567 -- if (status & GMR_FS_VLAN)
6568 -- __vlan_hwaccel_put_tag(skb, be16_to_cpu(sky2->rx_tag));
6569 --
6570 - if (skb->ip_summed == CHECKSUM_NONE)
6571 - netif_receive_skb(skb);
6572 - else
6573 -@@ -2686,6 +2688,14 @@ static void sky2_rx_checksum(struct sky2_port *sky2, u32 status)
6574 - }
6575 - }
6576 -
6577 -+static void sky2_rx_tag(struct sky2_port *sky2, u16 length)
6578 -+{
6579 -+ struct sk_buff *skb;
6580 -+
6581 -+ skb = sky2->rx_ring[sky2->rx_next].skb;
6582 -+ __vlan_hwaccel_put_tag(skb, be16_to_cpu(length));
6583 -+}
6584 -+
6585 - static void sky2_rx_hash(struct sky2_port *sky2, u32 status)
6586 - {
6587 - struct sk_buff *skb;
6588 -@@ -2744,8 +2754,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
6589 - }
6590 -
6591 - skb->protocol = eth_type_trans(skb, dev);
6592 --
6593 -- sky2_skb_rx(sky2, status, skb);
6594 -+ sky2_skb_rx(sky2, skb);
6595 -
6596 - /* Stop after net poll weight */
6597 - if (++work_done >= to_do)
6598 -@@ -2753,11 +2762,11 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
6599 - break;
6600 -
6601 - case OP_RXVLAN:
6602 -- sky2->rx_tag = length;
6603 -+ sky2_rx_tag(sky2, length);
6604 - break;
6605 -
6606 - case OP_RXCHKSVLAN:
6607 -- sky2->rx_tag = length;
6608 -+ sky2_rx_tag(sky2, length);
6609 - /* fall through */
6610 - case OP_RXCHKS:
6611 - if (likely(dev->features & NETIF_F_RXCSUM))
6612 -diff --git a/drivers/net/ethernet/marvell/sky2.h b/drivers/net/ethernet/marvell/sky2.h
6613 -index ff6f58b..3c896ce 100644
6614 ---- a/drivers/net/ethernet/marvell/sky2.h
6615 -+++ b/drivers/net/ethernet/marvell/sky2.h
6616 -@@ -2241,7 +2241,6 @@ struct sky2_port {
6617 - u16 rx_pending;
6618 - u16 rx_data_size;
6619 - u16 rx_nfrags;
6620 -- u16 rx_tag;
6621 -
6622 - struct {
6623 - unsigned long last;
6624 -diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
6625 -index 41e6b33..c07cfe9 100644
6626 ---- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
6627 -+++ b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
6628 -@@ -22,6 +22,7 @@
6629 - Author: Giuseppe Cavallaro <peppe.cavallaro@××.com>
6630 - *******************************************************************************/
6631 -
6632 -+#include <linux/kernel.h>
6633 - #include <linux/io.h>
6634 - #include "mmc.h"
6635 -
6636 -diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
6637 -index ceab215..c508d6a 100644
6638 ---- a/drivers/net/ethernet/sun/sungem.c
6639 -+++ b/drivers/net/ethernet/sun/sungem.c
6640 -@@ -2340,7 +2340,7 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
6641 - netif_device_detach(dev);
6642 -
6643 - /* Switch off chip, remember WOL setting */
6644 -- gp->asleep_wol = gp->wake_on_lan;
6645 -+ gp->asleep_wol = !!gp->wake_on_lan;
6646 - gem_do_stop(dev, gp->asleep_wol);
6647 -
6648 - /* Unlock the network stack */
6649 -diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c
6650 -index c81f136..b142300 100644
6651 ---- a/drivers/net/phy/icplus.c
6652 -+++ b/drivers/net/phy/icplus.c
6653 -@@ -150,7 +150,8 @@ static int ip101a_config_init(struct phy_device *phydev)
6654 - /* Enable Auto Power Saving mode */
6655 - c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS);
6656 - c |= IP101A_APS_ON;
6657 -- return c;
6658 -+
6659 -+ return phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c);
6660 - }
6661 -
6662 - static int ip175c_read_status(struct phy_device *phydev)
6663 -diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
6664 -index fda4be2..a9abee8 100644
6665 ---- a/drivers/net/usb/asix.c
6666 -+++ b/drivers/net/usb/asix.c
6667 -@@ -403,7 +403,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
6668 - u32 packet_len;
6669 - u32 padbytes = 0xffff0000;
6670 -
6671 -- padlen = ((skb->len + 4) % 512) ? 0 : 4;
6672 -+ padlen = ((skb->len + 4) & (dev->maxpacket - 1)) ? 0 : 4;
6673 -
6674 - if ((!skb_cloned(skb)) &&
6675 - ((headroom + tailroom) >= (4 + padlen))) {
6676 -@@ -425,7 +425,7 @@ static struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
6677 - cpu_to_le32s(&packet_len);
6678 - skb_copy_to_linear_data(skb, &packet_len, sizeof(packet_len));
6679 -
6680 -- if ((skb->len % 512) == 0) {
6681 -+ if (padlen) {
6682 - cpu_to_le32s(&padbytes);
6683 - memcpy(skb_tail_pointer(skb), &padbytes, sizeof(padbytes));
6684 - skb_put(skb, sizeof(padbytes));
6685 -diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
6686 -index 4fd4144..2ba40cf 100644
6687 ---- a/drivers/net/usb/cdc_ether.c
6688 -+++ b/drivers/net/usb/cdc_ether.c
6689 -@@ -83,6 +83,7 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
6690 - struct cdc_state *info = (void *) &dev->data;
6691 - int status;
6692 - int rndis;
6693 -+ bool android_rndis_quirk = false;
6694 - struct usb_driver *driver = driver_of(intf);
6695 - struct usb_cdc_mdlm_desc *desc = NULL;
6696 - struct usb_cdc_mdlm_detail_desc *detail = NULL;
6697 -@@ -195,6 +196,11 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
6698 - info->control,
6699 - info->u->bSlaveInterface0,
6700 - info->data);
6701 -+ /* fall back to hard-wiring for RNDIS */
6702 -+ if (rndis) {
6703 -+ android_rndis_quirk = true;
6704 -+ goto next_desc;
6705 -+ }
6706 - goto bad_desc;
6707 - }
6708 - if (info->control != intf) {
6709 -@@ -271,11 +277,15 @@ next_desc:
6710 - /* Microsoft ActiveSync based and some regular RNDIS devices lack the
6711 - * CDC descriptors, so we'll hard-wire the interfaces and not check
6712 - * for descriptors.
6713 -+ *
6714 -+ * Some Android RNDIS devices have a CDC Union descriptor pointing
6715 -+ * to non-existing interfaces. Ignore that and attempt the same
6716 -+ * hard-wired 0 and 1 interfaces.
6717 - */
6718 -- if (rndis && !info->u) {
6719 -+ if (rndis && (!info->u || android_rndis_quirk)) {
6720 - info->control = usb_ifnum_to_if(dev->udev, 0);
6721 - info->data = usb_ifnum_to_if(dev->udev, 1);
6722 -- if (!info->control || !info->data) {
6723 -+ if (!info->control || !info->data || info->control != intf) {
6724 - dev_dbg(&intf->dev,
6725 - "rndis: master #0/%p slave #1/%p\n",
6726 - info->control,
6727 -@@ -472,6 +482,7 @@ static const struct driver_info wwan_info = {
6728 - /*-------------------------------------------------------------------------*/
6729 -
6730 - #define HUAWEI_VENDOR_ID 0x12D1
6731 -+#define NOVATEL_VENDOR_ID 0x1410
6732 -
6733 - static const struct usb_device_id products [] = {
6734 - /*
6735 -@@ -589,6 +600,21 @@ static const struct usb_device_id products [] = {
6736 - * because of bugs/quirks in a given product (like Zaurus, above).
6737 - */
6738 - {
6739 -+ /* Novatel USB551L */
6740 -+ /* This match must come *before* the generic CDC-ETHER match so that
6741 -+ * we get FLAG_WWAN set on the device, since it's descriptors are
6742 -+ * generic CDC-ETHER.
6743 -+ */
6744 -+ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
6745 -+ | USB_DEVICE_ID_MATCH_PRODUCT
6746 -+ | USB_DEVICE_ID_MATCH_INT_INFO,
6747 -+ .idVendor = NOVATEL_VENDOR_ID,
6748 -+ .idProduct = 0xB001,
6749 -+ .bInterfaceClass = USB_CLASS_COMM,
6750 -+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
6751 -+ .bInterfaceProtocol = USB_CDC_PROTO_NONE,
6752 -+ .driver_info = (unsigned long)&wwan_info,
6753 -+}, {
6754 - USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
6755 - USB_CDC_PROTO_NONE),
6756 - .driver_info = (unsigned long) &cdc_info,
6757 -diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
6758 -index 750e330..b873b5d 100644
6759 ---- a/drivers/net/usb/usbnet.c
6760 -+++ b/drivers/net/usb/usbnet.c
6761 -@@ -281,17 +281,32 @@ int usbnet_change_mtu (struct net_device *net, int new_mtu)
6762 - }
6763 - EXPORT_SYMBOL_GPL(usbnet_change_mtu);
6764 -
6765 -+/* The caller must hold list->lock */
6766 -+static void __usbnet_queue_skb(struct sk_buff_head *list,
6767 -+ struct sk_buff *newsk, enum skb_state state)
6768 -+{
6769 -+ struct skb_data *entry = (struct skb_data *) newsk->cb;
6770 -+
6771 -+ __skb_queue_tail(list, newsk);
6772 -+ entry->state = state;
6773 -+}
6774 -+
6775 - /*-------------------------------------------------------------------------*/
6776 -
6777 - /* some LK 2.4 HCDs oopsed if we freed or resubmitted urbs from
6778 - * completion callbacks. 2.5 should have fixed those bugs...
6779 - */
6780 -
6781 --static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_head *list)
6782 -+static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb,
6783 -+ struct sk_buff_head *list, enum skb_state state)
6784 - {
6785 - unsigned long flags;
6786 -+ enum skb_state old_state;
6787 -+ struct skb_data *entry = (struct skb_data *) skb->cb;
6788 -
6789 - spin_lock_irqsave(&list->lock, flags);
6790 -+ old_state = entry->state;
6791 -+ entry->state = state;
6792 - __skb_unlink(skb, list);
6793 - spin_unlock(&list->lock);
6794 - spin_lock(&dev->done.lock);
6795 -@@ -299,6 +314,7 @@ static void defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_hea
6796 - if (dev->done.qlen == 1)
6797 - tasklet_schedule(&dev->bh);
6798 - spin_unlock_irqrestore(&dev->done.lock, flags);
6799 -+ return old_state;
6800 - }
6801 -
6802 - /* some work can't be done in tasklets, so we use keventd
6803 -@@ -339,7 +355,6 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
6804 - entry = (struct skb_data *) skb->cb;
6805 - entry->urb = urb;
6806 - entry->dev = dev;
6807 -- entry->state = rx_start;
6808 - entry->length = 0;
6809 -
6810 - usb_fill_bulk_urb (urb, dev->udev, dev->in,
6811 -@@ -371,7 +386,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
6812 - tasklet_schedule (&dev->bh);
6813 - break;
6814 - case 0:
6815 -- __skb_queue_tail (&dev->rxq, skb);
6816 -+ __usbnet_queue_skb(&dev->rxq, skb, rx_start);
6817 - }
6818 - } else {
6819 - netif_dbg(dev, ifdown, dev->net, "rx: stopped\n");
6820 -@@ -422,16 +437,17 @@ static void rx_complete (struct urb *urb)
6821 - struct skb_data *entry = (struct skb_data *) skb->cb;
6822 - struct usbnet *dev = entry->dev;
6823 - int urb_status = urb->status;
6824 -+ enum skb_state state;
6825 -
6826 - skb_put (skb, urb->actual_length);
6827 -- entry->state = rx_done;
6828 -+ state = rx_done;
6829 - entry->urb = NULL;
6830 -
6831 - switch (urb_status) {
6832 - /* success */
6833 - case 0:
6834 - if (skb->len < dev->net->hard_header_len) {
6835 -- entry->state = rx_cleanup;
6836 -+ state = rx_cleanup;
6837 - dev->net->stats.rx_errors++;
6838 - dev->net->stats.rx_length_errors++;
6839 - netif_dbg(dev, rx_err, dev->net,
6840 -@@ -470,7 +486,7 @@ static void rx_complete (struct urb *urb)
6841 - "rx throttle %d\n", urb_status);
6842 - }
6843 - block:
6844 -- entry->state = rx_cleanup;
6845 -+ state = rx_cleanup;
6846 - entry->urb = urb;
6847 - urb = NULL;
6848 - break;
6849 -@@ -481,17 +497,18 @@ block:
6850 - // FALLTHROUGH
6851 -
6852 - default:
6853 -- entry->state = rx_cleanup;
6854 -+ state = rx_cleanup;
6855 - dev->net->stats.rx_errors++;
6856 - netif_dbg(dev, rx_err, dev->net, "rx status %d\n", urb_status);
6857 - break;
6858 - }
6859 -
6860 -- defer_bh(dev, skb, &dev->rxq);
6861 -+ state = defer_bh(dev, skb, &dev->rxq, state);
6862 -
6863 - if (urb) {
6864 - if (netif_running (dev->net) &&
6865 -- !test_bit (EVENT_RX_HALT, &dev->flags)) {
6866 -+ !test_bit (EVENT_RX_HALT, &dev->flags) &&
6867 -+ state != unlink_start) {
6868 - rx_submit (dev, urb, GFP_ATOMIC);
6869 - return;
6870 - }
6871 -@@ -577,16 +594,23 @@ EXPORT_SYMBOL_GPL(usbnet_purge_paused_rxq);
6872 - static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q)
6873 - {
6874 - unsigned long flags;
6875 -- struct sk_buff *skb, *skbnext;
6876 -+ struct sk_buff *skb;
6877 - int count = 0;
6878 -
6879 - spin_lock_irqsave (&q->lock, flags);
6880 -- skb_queue_walk_safe(q, skb, skbnext) {
6881 -+ while (!skb_queue_empty(q)) {
6882 - struct skb_data *entry;
6883 - struct urb *urb;
6884 - int retval;
6885 -
6886 -- entry = (struct skb_data *) skb->cb;
6887 -+ skb_queue_walk(q, skb) {
6888 -+ entry = (struct skb_data *) skb->cb;
6889 -+ if (entry->state != unlink_start)
6890 -+ goto found;
6891 -+ }
6892 -+ break;
6893 -+found:
6894 -+ entry->state = unlink_start;
6895 - urb = entry->urb;
6896 -
6897 - /*
6898 -@@ -1037,8 +1061,7 @@ static void tx_complete (struct urb *urb)
6899 - }
6900 -
6901 - usb_autopm_put_interface_async(dev->intf);
6902 -- entry->state = tx_done;
6903 -- defer_bh(dev, skb, &dev->txq);
6904 -+ (void) defer_bh(dev, skb, &dev->txq, tx_done);
6905 - }
6906 -
6907 - /*-------------------------------------------------------------------------*/
6908 -@@ -1094,7 +1117,6 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
6909 - entry = (struct skb_data *) skb->cb;
6910 - entry->urb = urb;
6911 - entry->dev = dev;
6912 -- entry->state = tx_start;
6913 - entry->length = length;
6914 -
6915 - usb_fill_bulk_urb (urb, dev->udev, dev->out,
6916 -@@ -1153,7 +1175,7 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
6917 - break;
6918 - case 0:
6919 - net->trans_start = jiffies;
6920 -- __skb_queue_tail (&dev->txq, skb);
6921 -+ __usbnet_queue_skb(&dev->txq, skb, tx_start);
6922 - if (dev->txq.qlen >= TX_QLEN (dev))
6923 - netif_stop_queue (net);
6924 - }
6925 -diff --git a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
6926 -index 7f27dbd..0515862 100644
6927 ---- a/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
6928 -+++ b/drivers/net/wireless/brcm80211/brcmsmac/ampdu.c
6929 -@@ -1053,17 +1053,13 @@ brcms_c_ampdu_dotxstatus_complete(struct ampdu_info *ampdu, struct scb *scb,
6930 - }
6931 - /* either retransmit or send bar if ack not recd */
6932 - if (!ack_recd) {
6933 -- struct ieee80211_tx_rate *txrate =
6934 -- tx_info->status.rates;
6935 -- if (retry && (txrate[0].count < (int)retry_limit)) {
6936 -+ if (retry && (ini->txretry[index] < (int)retry_limit)) {
6937 - ini->txretry[index]++;
6938 - ini->tx_in_transit--;
6939 - /*
6940 - * Use high prededence for retransmit to
6941 - * give some punch
6942 - */
6943 -- /* brcms_c_txq_enq(wlc, scb, p,
6944 -- * BRCMS_PRIO_TO_PREC(tid)); */
6945 - brcms_c_txq_enq(wlc, scb, p,
6946 - BRCMS_PRIO_TO_HI_PREC(tid));
6947 - } else {
6948 -diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
6949 -index f98becc..833cbef 100644
6950 ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
6951 -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
6952 -@@ -7879,7 +7879,7 @@ brcms_c_recvctl(struct brcms_c_info *wlc, struct d11rxhdr *rxh,
6953 - if (wlc->hw->suspended_fifos) {
6954 - hdr = (struct ieee80211_hdr *)p->data;
6955 - if (ieee80211_is_beacon(hdr->frame_control))
6956 -- brcms_b_mute(wlc->hw, false);
6957 -+ brcms_b_mute(wlc->hw, false, 0);
6958 - }
6959 -
6960 - memcpy(IEEE80211_SKB_RXCB(p), &rx_status, sizeof(rx_status));
6961 -diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
6962 -index 6176129..8cba82d 100644
6963 ---- a/drivers/regulator/max8997.c
6964 -+++ b/drivers/regulator/max8997.c
6965 -@@ -689,7 +689,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
6966 - }
6967 -
6968 - new_val++;
6969 -- } while (desc->min + desc->step + new_val <= desc->max);
6970 -+ } while (desc->min + desc->step * new_val <= desc->max);
6971 -
6972 - new_idx = tmp_idx;
6973 - new_val = tmp_val;
6974 -diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
6975 -index 54b9d2e..1590dbd 100644
6976 ---- a/drivers/spi/spi-topcliff-pch.c
6977 -+++ b/drivers/spi/spi-topcliff-pch.c
6978 -@@ -196,6 +196,7 @@ struct pch_spi_data {
6979 - struct pch_spi_dma_ctrl dma;
6980 - int use_dma;
6981 - u8 irq_reg_sts;
6982 -+ int save_total_len;
6983 - };
6984 -
6985 - /**
6986 -@@ -823,11 +824,13 @@ static void pch_spi_copy_rx_data_for_dma(struct pch_spi_data *data, int bpw)
6987 - rx_dma_buf = data->dma.rx_buf_virt;
6988 - for (j = 0; j < data->bpw_len; j++)
6989 - *rx_buf++ = *rx_dma_buf++ & 0xFF;
6990 -+ data->cur_trans->rx_buf = rx_buf;
6991 - } else {
6992 - rx_sbuf = data->cur_trans->rx_buf;
6993 - rx_dma_sbuf = data->dma.rx_buf_virt;
6994 - for (j = 0; j < data->bpw_len; j++)
6995 - *rx_sbuf++ = *rx_dma_sbuf++;
6996 -+ data->cur_trans->rx_buf = rx_sbuf;
6997 - }
6998 - }
6999 -
7000 -@@ -853,6 +856,9 @@ static int pch_spi_start_transfer(struct pch_spi_data *data)
7001 - rtn = wait_event_interruptible_timeout(data->wait,
7002 - data->transfer_complete,
7003 - msecs_to_jiffies(2 * HZ));
7004 -+ if (!rtn)
7005 -+ dev_err(&data->master->dev,
7006 -+ "%s wait-event timeout\n", __func__);
7007 -
7008 - dma_sync_sg_for_cpu(&data->master->dev, dma->sg_rx_p, dma->nent,
7009 - DMA_FROM_DEVICE);
7010 -@@ -924,7 +930,8 @@ static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
7011 - dma_cap_set(DMA_SLAVE, mask);
7012 -
7013 - /* Get DMA's dev information */
7014 -- dma_dev = pci_get_bus_and_slot(2, PCI_DEVFN(12, 0));
7015 -+ dma_dev = pci_get_bus_and_slot(data->board_dat->pdev->bus->number,
7016 -+ PCI_DEVFN(12, 0));
7017 -
7018 - /* Set Tx DMA */
7019 - param = &dma->param_tx;
7020 -@@ -988,6 +995,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
7021 - int i;
7022 - int size;
7023 - int rem;
7024 -+ int head;
7025 - unsigned long flags;
7026 - struct pch_spi_dma_ctrl *dma;
7027 -
7028 -@@ -1016,6 +1024,11 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
7029 - }
7030 - data->bpw_len = data->cur_trans->len / (*bpw / 8);
7031 -
7032 -+ if (data->bpw_len > PCH_BUF_SIZE) {
7033 -+ data->bpw_len = PCH_BUF_SIZE;
7034 -+ data->cur_trans->len -= PCH_BUF_SIZE;
7035 -+ }
7036 -+
7037 - /* copy Tx Data */
7038 - if (data->cur_trans->tx_buf != NULL) {
7039 - if (*bpw == 8) {
7040 -@@ -1030,10 +1043,17 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
7041 - *tx_dma_sbuf++ = *tx_sbuf++;
7042 - }
7043 - }
7044 -+
7045 -+ /* Calculate Rx parameter for DMA transmitting */
7046 - if (data->bpw_len > PCH_DMA_TRANS_SIZE) {
7047 -- num = data->bpw_len / PCH_DMA_TRANS_SIZE + 1;
7048 -+ if (data->bpw_len % PCH_DMA_TRANS_SIZE) {
7049 -+ num = data->bpw_len / PCH_DMA_TRANS_SIZE + 1;
7050 -+ rem = data->bpw_len % PCH_DMA_TRANS_SIZE;
7051 -+ } else {
7052 -+ num = data->bpw_len / PCH_DMA_TRANS_SIZE;
7053 -+ rem = PCH_DMA_TRANS_SIZE;
7054 -+ }
7055 - size = PCH_DMA_TRANS_SIZE;
7056 -- rem = data->bpw_len % PCH_DMA_TRANS_SIZE;
7057 - } else {
7058 - num = 1;
7059 - size = data->bpw_len;
7060 -@@ -1093,15 +1113,23 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
7061 - dma->nent = num;
7062 - dma->desc_rx = desc_rx;
7063 -
7064 -- /* TX */
7065 -- if (data->bpw_len > PCH_DMA_TRANS_SIZE) {
7066 -- num = data->bpw_len / PCH_DMA_TRANS_SIZE;
7067 -+ /* Calculate Tx parameter for DMA transmitting */
7068 -+ if (data->bpw_len > PCH_MAX_FIFO_DEPTH) {
7069 -+ head = PCH_MAX_FIFO_DEPTH - PCH_DMA_TRANS_SIZE;
7070 -+ if (data->bpw_len % PCH_DMA_TRANS_SIZE > 4) {
7071 -+ num = data->bpw_len / PCH_DMA_TRANS_SIZE + 1;
7072 -+ rem = data->bpw_len % PCH_DMA_TRANS_SIZE - head;
7073 -+ } else {
7074 -+ num = data->bpw_len / PCH_DMA_TRANS_SIZE;
7075 -+ rem = data->bpw_len % PCH_DMA_TRANS_SIZE +
7076 -+ PCH_DMA_TRANS_SIZE - head;
7077 -+ }
7078 - size = PCH_DMA_TRANS_SIZE;
7079 -- rem = 16;
7080 - } else {
7081 - num = 1;
7082 - size = data->bpw_len;
7083 - rem = data->bpw_len;
7084 -+ head = 0;
7085 - }
7086 -
7087 - dma->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
7088 -@@ -1111,11 +1139,17 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
7089 - for (i = 0; i < num; i++, sg++) {
7090 - if (i == 0) {
7091 - sg->offset = 0;
7092 -+ sg_set_page(sg, virt_to_page(dma->tx_buf_virt), size + head,
7093 -+ sg->offset);
7094 -+ sg_dma_len(sg) = size + head;
7095 -+ } else if (i == (num - 1)) {
7096 -+ sg->offset = head + size * i;
7097 -+ sg->offset = sg->offset * (*bpw / 8);
7098 - sg_set_page(sg, virt_to_page(dma->tx_buf_virt), rem,
7099 - sg->offset);
7100 - sg_dma_len(sg) = rem;
7101 - } else {
7102 -- sg->offset = rem + size * (i - 1);
7103 -+ sg->offset = head + size * i;
7104 - sg->offset = sg->offset * (*bpw / 8);
7105 - sg_set_page(sg, virt_to_page(dma->tx_buf_virt), size,
7106 - sg->offset);
7107 -@@ -1203,6 +1237,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
7108 - data->current_msg->spi->bits_per_word);
7109 - pch_spi_writereg(data->master, PCH_SSNXCR, SSN_NO_CONTROL);
7110 - do {
7111 -+ int cnt;
7112 - /* If we are already processing a message get the next
7113 - transfer structure from the message otherwise retrieve
7114 - the 1st transfer request from the message. */
7115 -@@ -1222,11 +1257,28 @@ static void pch_spi_process_messages(struct work_struct *pwork)
7116 - }
7117 - spin_unlock(&data->lock);
7118 -
7119 -+ if (!data->cur_trans->len)
7120 -+ goto out;
7121 -+ cnt = (data->cur_trans->len - 1) / PCH_BUF_SIZE + 1;
7122 -+ data->save_total_len = data->cur_trans->len;
7123 - if (data->use_dma) {
7124 -- pch_spi_handle_dma(data, &bpw);
7125 -- if (!pch_spi_start_transfer(data))
7126 -- goto out;
7127 -- pch_spi_copy_rx_data_for_dma(data, bpw);
7128 -+ int i;
7129 -+ char *save_rx_buf = data->cur_trans->rx_buf;
7130 -+ for (i = 0; i < cnt; i ++) {
7131 -+ pch_spi_handle_dma(data, &bpw);
7132 -+ if (!pch_spi_start_transfer(data)) {
7133 -+ data->transfer_complete = true;
7134 -+ data->current_msg->status = -EIO;
7135 -+ data->current_msg->complete
7136 -+ (data->current_msg->context);
7137 -+ data->bcurrent_msg_processing = false;
7138 -+ data->current_msg = NULL;
7139 -+ data->cur_trans = NULL;
7140 -+ goto out;
7141 -+ }
7142 -+ pch_spi_copy_rx_data_for_dma(data, bpw);
7143 -+ }
7144 -+ data->cur_trans->rx_buf = save_rx_buf;
7145 - } else {
7146 - pch_spi_set_tx(data, &bpw);
7147 - pch_spi_set_ir(data);
7148 -@@ -1237,6 +1289,7 @@ static void pch_spi_process_messages(struct work_struct *pwork)
7149 - data->pkt_tx_buff = NULL;
7150 - }
7151 - /* increment message count */
7152 -+ data->cur_trans->len = data->save_total_len;
7153 - data->current_msg->actual_length += data->cur_trans->len;
7154 -
7155 - dev_dbg(&data->master->dev,
7156 -@@ -1389,6 +1442,7 @@ static int __devinit pch_spi_pd_probe(struct platform_device *plat_dev)
7157 - master->num_chipselect = PCH_MAX_CS;
7158 - master->setup = pch_spi_setup;
7159 - master->transfer = pch_spi_transfer;
7160 -+ master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_LSB_FIRST;
7161 -
7162 - data->board_dat = board_dat;
7163 - data->plat_dev = plat_dev;
7164 -diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
7165 -index b4864fb..cad8b92 100644
7166 ---- a/drivers/target/target_core_file.c
7167 -+++ b/drivers/target/target_core_file.c
7168 -@@ -170,6 +170,7 @@ static struct se_device *fd_create_virtdevice(
7169 - inode = file->f_mapping->host;
7170 - if (S_ISBLK(inode->i_mode)) {
7171 - struct request_queue *q;
7172 -+ unsigned long long dev_size;
7173 - /*
7174 - * Setup the local scope queue_limits from struct request_queue->limits
7175 - * to pass into transport_add_device_to_core_hba() as struct se_dev_limits.
7176 -@@ -184,13 +185,12 @@ static struct se_device *fd_create_virtdevice(
7177 - * one (1) logical sector from underlying struct block_device
7178 - */
7179 - fd_dev->fd_block_size = bdev_logical_block_size(inode->i_bdev);
7180 -- fd_dev->fd_dev_size = (i_size_read(file->f_mapping->host) -
7181 -+ dev_size = (i_size_read(file->f_mapping->host) -
7182 - fd_dev->fd_block_size);
7183 -
7184 - pr_debug("FILEIO: Using size: %llu bytes from struct"
7185 - " block_device blocks: %llu logical_block_size: %d\n",
7186 -- fd_dev->fd_dev_size,
7187 -- div_u64(fd_dev->fd_dev_size, fd_dev->fd_block_size),
7188 -+ dev_size, div_u64(dev_size, fd_dev->fd_block_size),
7189 - fd_dev->fd_block_size);
7190 - } else {
7191 - if (!(fd_dev->fbd_flags & FBDF_HAS_SIZE)) {
7192 -@@ -606,10 +606,20 @@ static u32 fd_get_device_type(struct se_device *dev)
7193 - static sector_t fd_get_blocks(struct se_device *dev)
7194 - {
7195 - struct fd_dev *fd_dev = dev->dev_ptr;
7196 -- unsigned long long blocks_long = div_u64(fd_dev->fd_dev_size,
7197 -- dev->se_sub_dev->se_dev_attrib.block_size);
7198 -+ struct file *f = fd_dev->fd_file;
7199 -+ struct inode *i = f->f_mapping->host;
7200 -+ unsigned long long dev_size;
7201 -+ /*
7202 -+ * When using a file that references an underlying struct block_device,
7203 -+ * ensure dev_size is always based on the current inode size in order
7204 -+ * to handle underlying block_device resize operations.
7205 -+ */
7206 -+ if (S_ISBLK(i->i_mode))
7207 -+ dev_size = (i_size_read(i) - fd_dev->fd_block_size);
7208 -+ else
7209 -+ dev_size = fd_dev->fd_dev_size;
7210 -
7211 -- return blocks_long;
7212 -+ return div_u64(dev_size, dev->se_sub_dev->se_dev_attrib.block_size);
7213 - }
7214 -
7215 - static struct se_subsystem_api fileio_template = {
7216 -diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c
7217 -index 6cf6ff4..b75bc92 100644
7218 ---- a/drivers/target/target_core_pr.c
7219 -+++ b/drivers/target/target_core_pr.c
7220 -@@ -223,6 +223,9 @@ int target_scsi2_reservation_release(struct se_task *task)
7221 - if (dev->dev_reserved_node_acl != sess->se_node_acl)
7222 - goto out_unlock;
7223 -
7224 -+ if (dev->dev_res_bin_isid != sess->sess_bin_isid)
7225 -+ goto out_unlock;
7226 -+
7227 - dev->dev_reserved_node_acl = NULL;
7228 - dev->dev_flags &= ~DF_SPC2_RESERVATIONS;
7229 - if (dev->dev_flags & DF_SPC2_RESERVATIONS_WITH_ISID) {
7230 -diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
7231 -index 8ddd133..d91fe44 100644
7232 ---- a/drivers/target/target_core_tpg.c
7233 -+++ b/drivers/target/target_core_tpg.c
7234 -@@ -63,7 +63,6 @@ static void core_clear_initiator_node_from_tpg(
7235 - int i;
7236 - struct se_dev_entry *deve;
7237 - struct se_lun *lun;
7238 -- struct se_lun_acl *acl, *acl_tmp;
7239 -
7240 - spin_lock_irq(&nacl->device_list_lock);
7241 - for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) {
7242 -@@ -84,28 +83,7 @@ static void core_clear_initiator_node_from_tpg(
7243 - core_update_device_list_for_node(lun, NULL, deve->mapped_lun,
7244 - TRANSPORT_LUNFLAGS_NO_ACCESS, nacl, tpg, 0);
7245 -
7246 -- spin_lock(&lun->lun_acl_lock);
7247 -- list_for_each_entry_safe(acl, acl_tmp,
7248 -- &lun->lun_acl_list, lacl_list) {
7249 -- if (!strcmp(acl->initiatorname, nacl->initiatorname) &&
7250 -- (acl->mapped_lun == deve->mapped_lun))
7251 -- break;
7252 -- }
7253 --
7254 -- if (!acl) {
7255 -- pr_err("Unable to locate struct se_lun_acl for %s,"
7256 -- " mapped_lun: %u\n", nacl->initiatorname,
7257 -- deve->mapped_lun);
7258 -- spin_unlock(&lun->lun_acl_lock);
7259 -- spin_lock_irq(&nacl->device_list_lock);
7260 -- continue;
7261 -- }
7262 --
7263 -- list_del(&acl->lacl_list);
7264 -- spin_unlock(&lun->lun_acl_lock);
7265 --
7266 - spin_lock_irq(&nacl->device_list_lock);
7267 -- kfree(acl);
7268 - }
7269 - spin_unlock_irq(&nacl->device_list_lock);
7270 - }
7271 -diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
7272 -index 93a00d8..4410ae7 100644
7273 ---- a/fs/ext4/xattr.c
7274 -+++ b/fs/ext4/xattr.c
7275 -@@ -487,18 +487,19 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
7276 - ext4_free_blocks(handle, inode, bh, 0, 1,
7277 - EXT4_FREE_BLOCKS_METADATA |
7278 - EXT4_FREE_BLOCKS_FORGET);
7279 -+ unlock_buffer(bh);
7280 - } else {
7281 - le32_add_cpu(&BHDR(bh)->h_refcount, -1);
7282 -+ if (ce)
7283 -+ mb_cache_entry_release(ce);
7284 -+ unlock_buffer(bh);
7285 - error = ext4_handle_dirty_metadata(handle, inode, bh);
7286 - if (IS_SYNC(inode))
7287 - ext4_handle_sync(handle);
7288 - dquot_free_block(inode, 1);
7289 - ea_bdebug(bh, "refcount now=%d; releasing",
7290 - le32_to_cpu(BHDR(bh)->h_refcount));
7291 -- if (ce)
7292 -- mb_cache_entry_release(ce);
7293 - }
7294 -- unlock_buffer(bh);
7295 - out:
7296 - ext4_std_error(inode->i_sb, error);
7297 - return;
7298 -diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
7299 -index 31dce61..4bbd521 100644
7300 ---- a/fs/jffs2/gc.c
7301 -+++ b/fs/jffs2/gc.c
7302 -@@ -225,8 +225,8 @@ int jffs2_garbage_collect_pass(struct jffs2_sb_info *c)
7303 - return 0;
7304 -
7305 - D1(printk(KERN_DEBUG "No progress from erasing blocks; doing GC anyway\n"));
7306 -- spin_lock(&c->erase_completion_lock);
7307 - mutex_lock(&c->alloc_sem);
7308 -+ spin_lock(&c->erase_completion_lock);
7309 - }
7310 -
7311 - /* First, work out which block we're garbage-collecting */
7312 -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
7313 -index 51f6a40..bab7c58 100644
7314 ---- a/fs/nfs/nfs4proc.c
7315 -+++ b/fs/nfs/nfs4proc.c
7316 -@@ -1802,6 +1802,7 @@ static int _nfs4_do_open(struct inode *dir, struct dentry *dentry, fmode_t fmode
7317 - nfs_setattr_update_inode(state->inode, sattr);
7318 - nfs_post_op_update_inode(state->inode, opendata->o_res.f_attr);
7319 - }
7320 -+ nfs_revalidate_inode(server, state->inode);
7321 - nfs4_opendata_put(opendata);
7322 - nfs4_put_state_owner(sp);
7323 - *res = state;
7324 -diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
7325 -index a9e6ba4..daad4e6 100644
7326 ---- a/include/linux/mtd/map.h
7327 -+++ b/include/linux/mtd/map.h
7328 -@@ -26,7 +26,7 @@
7329 - #include <linux/list.h>
7330 - #include <linux/string.h>
7331 - #include <linux/bug.h>
7332 --
7333 -+#include <linux/kernel.h>
7334 -
7335 - #include <asm/unaligned.h>
7336 - #include <asm/system.h>
7337 -diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
7338 -index 605b0aa..76f4396 100644
7339 ---- a/include/linux/usb/usbnet.h
7340 -+++ b/include/linux/usb/usbnet.h
7341 -@@ -191,7 +191,8 @@ extern void usbnet_cdc_status(struct usbnet *, struct urb *);
7342 - enum skb_state {
7343 - illegal = 0,
7344 - tx_start, tx_done,
7345 -- rx_start, rx_done, rx_cleanup
7346 -+ rx_start, rx_done, rx_cleanup,
7347 -+ unlink_start
7348 - };
7349 -
7350 - struct skb_data { /* skb->cb is one of these */
7351 -diff --git a/kernel/fork.c b/kernel/fork.c
7352 -index 0acf42c0..26f1ab0 100644
7353 ---- a/kernel/fork.c
7354 -+++ b/kernel/fork.c
7355 -@@ -47,6 +47,7 @@
7356 - #include <linux/audit.h>
7357 - #include <linux/memcontrol.h>
7358 - #include <linux/ftrace.h>
7359 -+#include <linux/proc_fs.h>
7360 - #include <linux/profile.h>
7361 - #include <linux/rmap.h>
7362 - #include <linux/ksm.h>
7363 -@@ -1387,6 +1388,8 @@ bad_fork_cleanup_io:
7364 - if (p->io_context)
7365 - exit_io_context(p);
7366 - bad_fork_cleanup_namespaces:
7367 -+ if (unlikely(clone_flags & CLONE_NEWPID))
7368 -+ pid_ns_release_proc(p->nsproxy->pid_ns);
7369 - exit_task_namespaces(p);
7370 - bad_fork_cleanup_mm:
7371 - if (p->mm)
7372 -diff --git a/mm/hugetlb.c b/mm/hugetlb.c
7373 -index bd936ed..7120c2e 100644
7374 ---- a/mm/hugetlb.c
7375 -+++ b/mm/hugetlb.c
7376 -@@ -2405,7 +2405,6 @@ retry_avoidcopy:
7377 - if (outside_reserve) {
7378 - BUG_ON(huge_pte_none(pte));
7379 - if (unmap_ref_private(mm, vma, old_page, address)) {
7380 -- BUG_ON(page_count(old_page) != 1);
7381 - BUG_ON(huge_pte_none(pte));
7382 - spin_lock(&mm->page_table_lock);
7383 - goto retry_avoidcopy;
7384 -diff --git a/mm/nobootmem.c b/mm/nobootmem.c
7385 -index 7fa41b4..07c08c4 100644
7386 ---- a/mm/nobootmem.c
7387 -+++ b/mm/nobootmem.c
7388 -@@ -83,8 +83,7 @@ void __init free_bootmem_late(unsigned long addr, unsigned long size)
7389 -
7390 - static void __init __free_pages_memory(unsigned long start, unsigned long end)
7391 - {
7392 -- int i;
7393 -- unsigned long start_aligned, end_aligned;
7394 -+ unsigned long i, start_aligned, end_aligned;
7395 - int order = ilog2(BITS_PER_LONG);
7396 -
7397 - start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1);
7398 -diff --git a/mm/percpu.c b/mm/percpu.c
7399 -index 716eb4a..5c29750 100644
7400 ---- a/mm/percpu.c
7401 -+++ b/mm/percpu.c
7402 -@@ -1642,6 +1642,16 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
7403 - areas[group] = ptr;
7404 -
7405 - base = min(ptr, base);
7406 -+ }
7407 -+
7408 -+ /*
7409 -+ * Copy data and free unused parts. This should happen after all
7410 -+ * allocations are complete; otherwise, we may end up with
7411 -+ * overlapping groups.
7412 -+ */
7413 -+ for (group = 0; group < ai->nr_groups; group++) {
7414 -+ struct pcpu_group_info *gi = &ai->groups[group];
7415 -+ void *ptr = areas[group];
7416 -
7417 - for (i = 0; i < gi->nr_units; i++, ptr += ai->unit_size) {
7418 - if (gi->cpu_map[i] == NR_CPUS) {
7419 -diff --git a/net/core/dev.c b/net/core/dev.c
7420 -index cd5050e..61a7baa 100644
7421 ---- a/net/core/dev.c
7422 -+++ b/net/core/dev.c
7423 -@@ -1421,14 +1421,34 @@ EXPORT_SYMBOL(register_netdevice_notifier);
7424 - * register_netdevice_notifier(). The notifier is unlinked into the
7425 - * kernel structures and may then be reused. A negative errno code
7426 - * is returned on a failure.
7427 -+ *
7428 -+ * After unregistering unregister and down device events are synthesized
7429 -+ * for all devices on the device list to the removed notifier to remove
7430 -+ * the need for special case cleanup code.
7431 - */
7432 -
7433 - int unregister_netdevice_notifier(struct notifier_block *nb)
7434 - {
7435 -+ struct net_device *dev;
7436 -+ struct net *net;
7437 - int err;
7438 -
7439 - rtnl_lock();
7440 - err = raw_notifier_chain_unregister(&netdev_chain, nb);
7441 -+ if (err)
7442 -+ goto unlock;
7443 -+
7444 -+ for_each_net(net) {
7445 -+ for_each_netdev(net, dev) {
7446 -+ if (dev->flags & IFF_UP) {
7447 -+ nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
7448 -+ nb->notifier_call(nb, NETDEV_DOWN, dev);
7449 -+ }
7450 -+ nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
7451 -+ nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev);
7452 -+ }
7453 -+ }
7454 -+unlock:
7455 - rtnl_unlock();
7456 - return err;
7457 - }
7458 -diff --git a/net/core/pktgen.c b/net/core/pktgen.c
7459 -index 0001c24..df878de 100644
7460 ---- a/net/core/pktgen.c
7461 -+++ b/net/core/pktgen.c
7462 -@@ -1932,7 +1932,7 @@ static int pktgen_device_event(struct notifier_block *unused,
7463 - {
7464 - struct net_device *dev = ptr;
7465 -
7466 -- if (!net_eq(dev_net(dev), &init_net))
7467 -+ if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting)
7468 - return NOTIFY_DONE;
7469 -
7470 - /* It is OK that we do not hold the group lock right now,
7471 -@@ -3758,12 +3758,18 @@ static void __exit pg_cleanup(void)
7472 - {
7473 - struct pktgen_thread *t;
7474 - struct list_head *q, *n;
7475 -+ LIST_HEAD(list);
7476 -
7477 - /* Stop all interfaces & threads */
7478 - pktgen_exiting = true;
7479 -
7480 -- list_for_each_safe(q, n, &pktgen_threads) {
7481 -+ mutex_lock(&pktgen_thread_lock);
7482 -+ list_splice_init(&pktgen_threads, &list);
7483 -+ mutex_unlock(&pktgen_thread_lock);
7484 -+
7485 -+ list_for_each_safe(q, n, &list) {
7486 - t = list_entry(q, struct pktgen_thread, th_list);
7487 -+ list_del(&t->th_list);
7488 - kthread_stop(t->tsk);
7489 - kfree(t);
7490 - }
7491 -diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
7492 -index 7904db4..11ba922 100644
7493 ---- a/net/ipv4/tcp.c
7494 -+++ b/net/ipv4/tcp.c
7495 -@@ -851,8 +851,7 @@ new_segment:
7496 - wait_for_sndbuf:
7497 - set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
7498 - wait_for_memory:
7499 -- if (copied)
7500 -- tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
7501 -+ tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
7502 -
7503 - if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)
7504 - goto do_error;
7505 -@@ -3216,7 +3215,7 @@ void __init tcp_init(void)
7506 - {
7507 - struct sk_buff *skb = NULL;
7508 - unsigned long limit;
7509 -- int i, max_share, cnt;
7510 -+ int i, max_rshare, max_wshare, cnt;
7511 - unsigned long jiffy = jiffies;
7512 -
7513 - BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
7514 -@@ -3280,15 +3279,16 @@ void __init tcp_init(void)
7515 -
7516 - /* Set per-socket limits to no more than 1/128 the pressure threshold */
7517 - limit = ((unsigned long)sysctl_tcp_mem[1]) << (PAGE_SHIFT - 7);
7518 -- max_share = min(4UL*1024*1024, limit);
7519 -+ max_wshare = min(4UL*1024*1024, limit);
7520 -+ max_rshare = min(6UL*1024*1024, limit);
7521 -
7522 - sysctl_tcp_wmem[0] = SK_MEM_QUANTUM;
7523 - sysctl_tcp_wmem[1] = 16*1024;
7524 -- sysctl_tcp_wmem[2] = max(64*1024, max_share);
7525 -+ sysctl_tcp_wmem[2] = max(64*1024, max_wshare);
7526 -
7527 - sysctl_tcp_rmem[0] = SK_MEM_QUANTUM;
7528 - sysctl_tcp_rmem[1] = 87380;
7529 -- sysctl_tcp_rmem[2] = max(87380, max_share);
7530 -+ sysctl_tcp_rmem[2] = max(87380, max_rshare);
7531 -
7532 - printk(KERN_INFO "TCP: Hash tables configured "
7533 - "(established %u bind %u)\n",
7534 -diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
7535 -index daedc07..9726927 100644
7536 ---- a/net/ipv4/tcp_input.c
7537 -+++ b/net/ipv4/tcp_input.c
7538 -@@ -83,7 +83,7 @@ int sysctl_tcp_ecn __read_mostly = 2;
7539 - EXPORT_SYMBOL(sysctl_tcp_ecn);
7540 - int sysctl_tcp_dsack __read_mostly = 1;
7541 - int sysctl_tcp_app_win __read_mostly = 31;
7542 --int sysctl_tcp_adv_win_scale __read_mostly = 2;
7543 -+int sysctl_tcp_adv_win_scale __read_mostly = 1;
7544 - EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);
7545 -
7546 - int sysctl_tcp_stdurg __read_mostly;
7547 -@@ -2868,11 +2868,14 @@ static inline void tcp_complete_cwr(struct sock *sk)
7548 -
7549 - /* Do not moderate cwnd if it's already undone in cwr or recovery. */
7550 - if (tp->undo_marker) {
7551 -- if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR)
7552 -+ if (inet_csk(sk)->icsk_ca_state == TCP_CA_CWR) {
7553 - tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
7554 -- else /* PRR */
7555 -+ tp->snd_cwnd_stamp = tcp_time_stamp;
7556 -+ } else if (tp->snd_ssthresh < TCP_INFINITE_SSTHRESH) {
7557 -+ /* PRR algorithm. */
7558 - tp->snd_cwnd = tp->snd_ssthresh;
7559 -- tp->snd_cwnd_stamp = tcp_time_stamp;
7560 -+ tp->snd_cwnd_stamp = tcp_time_stamp;
7561 -+ }
7562 - }
7563 - tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR);
7564 - }
7565 -diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
7566 -index 55670ec..2a2a3e7 100644
7567 ---- a/net/l2tp/l2tp_ip.c
7568 -+++ b/net/l2tp/l2tp_ip.c
7569 -@@ -441,8 +441,9 @@ static int l2tp_ip_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *m
7570 -
7571 - daddr = lip->l2tp_addr.s_addr;
7572 - } else {
7573 -+ rc = -EDESTADDRREQ;
7574 - if (sk->sk_state != TCP_ESTABLISHED)
7575 -- return -EDESTADDRREQ;
7576 -+ goto out;
7577 -
7578 - daddr = inet->inet_daddr;
7579 - connected = 1;
7580 -diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
7581 -index 7801b15..a489d8b 100644
7582 ---- a/net/sched/sch_netem.c
7583 -+++ b/net/sched/sch_netem.c
7584 -@@ -351,10 +351,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
7585 - if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) {
7586 - if (!(skb = skb_unshare(skb, GFP_ATOMIC)) ||
7587 - (skb->ip_summed == CHECKSUM_PARTIAL &&
7588 -- skb_checksum_help(skb))) {
7589 -- sch->qstats.drops++;
7590 -- return NET_XMIT_DROP;
7591 -- }
7592 -+ skb_checksum_help(skb)))
7593 -+ return qdisc_drop(skb, sch);
7594 -
7595 - skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8);
7596 - }
7597 -diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c
7598 -index 64417a7..d8c670c 100644
7599 ---- a/sound/pci/echoaudio/echoaudio_dsp.c
7600 -+++ b/sound/pci/echoaudio/echoaudio_dsp.c
7601 -@@ -475,7 +475,7 @@ static int load_firmware(struct echoaudio *chip)
7602 - const struct firmware *fw;
7603 - int box_type, err;
7604 -
7605 -- if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page))
7606 -+ if (snd_BUG_ON(!chip->comm_page))
7607 - return -EPERM;
7608 -
7609 - /* See if the ASIC is present and working - only if the DSP is already loaded */
7610 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
7611 -index 192e6c0..53345bc 100644
7612 ---- a/sound/pci/hda/hda_intel.c
7613 -+++ b/sound/pci/hda/hda_intel.c
7614 -@@ -769,11 +769,13 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
7615 - {
7616 - struct azx *chip = bus->private_data;
7617 - unsigned long timeout;
7618 -+ unsigned long loopcounter;
7619 - int do_poll = 0;
7620 -
7621 - again:
7622 - timeout = jiffies + msecs_to_jiffies(1000);
7623 -- for (;;) {
7624 -+
7625 -+ for (loopcounter = 0;; loopcounter++) {
7626 - if (chip->polling_mode || do_poll) {
7627 - spin_lock_irq(&chip->reg_lock);
7628 - azx_update_rirb(chip);
7629 -@@ -789,7 +791,7 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
7630 - }
7631 - if (time_after(jiffies, timeout))
7632 - break;
7633 -- if (bus->needs_damn_long_delay)
7634 -+ if (bus->needs_damn_long_delay || loopcounter > 3000)
7635 - msleep(2); /* temporary workaround */
7636 - else {
7637 - udelay(10);
7638 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
7639 -index ed67698..7b7a516 100644
7640 ---- a/sound/pci/hda/patch_sigmatel.c
7641 -+++ b/sound/pci/hda/patch_sigmatel.c
7642 -@@ -4484,9 +4484,9 @@ static int stac92xx_init(struct hda_codec *codec)
7643 - def_conf = get_defcfg_connect(def_conf);
7644 - /* skip any ports that don't have jacks since presence
7645 - * detection is useless */
7646 -- if (def_conf != AC_JACK_PORT_COMPLEX) {
7647 -- if (def_conf != AC_JACK_PORT_NONE)
7648 -- stac_toggle_power_map(codec, nid, 1);
7649 -+ if (def_conf != AC_JACK_PORT_NONE &&
7650 -+ !is_jack_detectable(codec, nid)) {
7651 -+ stac_toggle_power_map(codec, nid, 1);
7652 - continue;
7653 - }
7654 - if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) {
7655 -diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
7656 -index 7806301..3e7aa22 100644
7657 ---- a/sound/soc/codecs/wm8994.c
7658 -+++ b/sound/soc/codecs/wm8994.c
7659 -@@ -1027,7 +1027,7 @@ static int aif2clk_ev(struct snd_soc_dapm_widget *w,
7660 - snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
7661 - WM8994_AIF2DACL_ENA |
7662 - WM8994_AIF2DACR_ENA, 0);
7663 -- snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5,
7664 -+ snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_4,
7665 - WM8994_AIF2ADCL_ENA |
7666 - WM8994_AIF2ADCR_ENA, 0);
7667 -
7668
7669 diff --git a/3.2.18/0000_README b/3.2.19/0000_README
7670 similarity index 97%
7671 rename from 3.2.18/0000_README
7672 rename to 3.2.19/0000_README
7673 index 9daad3a..d244990 100644
7674 --- a/3.2.18/0000_README
7675 +++ b/3.2.19/0000_README
7676 @@ -10,7 +10,7 @@ Patch: 1017_linux-3.2.18.patch
7677 From: http://www.kernel.org
7678 Desc: Linux 3.2.18
7679
7680 -Patch: 4420_grsecurity-2.9-3.2.18-201206011935.patch
7681 +Patch: 4420_grsecurity-2.9-3.2.19-201206042135.patch
7682 From: http://www.grsecurity.net
7683 Desc: hardened-sources base patch from upstream grsecurity
7684
7685
7686 diff --git a/3.2.18/4420_grsecurity-2.9-3.2.18-201206011935.patch b/3.2.19/4420_grsecurity-2.9-3.2.19-201206042135.patch
7687 similarity index 99%
7688 rename from 3.2.18/4420_grsecurity-2.9-3.2.18-201206011935.patch
7689 rename to 3.2.19/4420_grsecurity-2.9-3.2.19-201206042135.patch
7690 index e73e583..b4e3cb9 100644
7691 --- a/3.2.18/4420_grsecurity-2.9-3.2.18-201206011935.patch
7692 +++ b/3.2.19/4420_grsecurity-2.9-3.2.19-201206042135.patch
7693 @@ -195,7 +195,7 @@ index 81c287f..d456d02 100644
7694
7695 pcd. [PARIDE]
7696 diff --git a/Makefile b/Makefile
7697 -index add68f1..3fac8b3 100644
7698 +index c291184..347a3de 100644
7699 --- a/Makefile
7700 +++ b/Makefile
7701 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
7702 @@ -312,7 +312,7 @@ index add68f1..3fac8b3 100644
7703 prepare: prepare0
7704
7705 # Generate some files
7706 -@@ -1086,6 +1139,8 @@ all: modules
7707 +@@ -1089,6 +1142,8 @@ all: modules
7708 # using awk while concatenating to the final file.
7709
7710 PHONY += modules
7711 @@ -321,7 +321,7 @@ index add68f1..3fac8b3 100644
7712 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
7713 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
7714 @$(kecho) ' Building modules, stage 2.';
7715 -@@ -1101,7 +1156,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
7716 +@@ -1104,7 +1159,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
7717
7718 # Target to prepare building external modules
7719 PHONY += modules_prepare
7720 @@ -330,7 +330,7 @@ index add68f1..3fac8b3 100644
7721
7722 # Target to install modules
7723 PHONY += modules_install
7724 -@@ -1198,6 +1253,7 @@ distclean: mrproper
7725 +@@ -1201,6 +1256,7 @@ distclean: mrproper
7726 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
7727 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
7728 -o -name '.*.rej' \
7729 @@ -338,7 +338,7 @@ index add68f1..3fac8b3 100644
7730 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
7731 -type f -print | xargs rm -f
7732
7733 -@@ -1358,6 +1414,8 @@ PHONY += $(module-dirs) modules
7734 +@@ -1361,6 +1417,8 @@ PHONY += $(module-dirs) modules
7735 $(module-dirs): crmodverdir $(objtree)/Module.symvers
7736 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
7737
7738 @@ -347,7 +347,7 @@ index add68f1..3fac8b3 100644
7739 modules: $(module-dirs)
7740 @$(kecho) ' Building modules, stage 2.';
7741 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
7742 -@@ -1484,17 +1542,21 @@ else
7743 +@@ -1487,17 +1545,21 @@ else
7744 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
7745 endif
7746
7747 @@ -373,7 +373,7 @@ index add68f1..3fac8b3 100644
7748 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
7749 %.symtypes: %.c prepare scripts FORCE
7750 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
7751 -@@ -1504,11 +1566,15 @@ endif
7752 +@@ -1507,11 +1569,15 @@ endif
7753 $(cmd_crmodverdir)
7754 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
7755 $(build)=$(build-dir)
7756 @@ -1325,7 +1325,7 @@ index 75fe66b..2255c86 100644
7757 /*
7758 * Memory returned by kmalloc() may be used for DMA, so we must make
7759 diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
7760 -index d5d8d5c..ad92c96 100644
7761 +index 1252a26..9dc17b5 100644
7762 --- a/arch/arm/include/asm/cacheflush.h
7763 +++ b/arch/arm/include/asm/cacheflush.h
7764 @@ -108,7 +108,7 @@ struct cpu_cache_fns {
7765 @@ -1675,7 +1675,7 @@ index 8fc2c8f..064c150 100644
7766 #endif
7767
7768 diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
7769 -index 99a5727..a3d5bb1 100644
7770 +index 160cb16..c3261f6 100644
7771 --- a/arch/arm/kernel/traps.c
7772 +++ b/arch/arm/kernel/traps.c
7773 @@ -259,6 +259,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
7774 @@ -5053,7 +5053,7 @@ index afeb710..d1d1289 100644
7775 bottomup:
7776 /*
7777 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
7778 -index f92602e..27060b2 100644
7779 +index f210d51..87537e2 100644
7780 --- a/arch/sparc/Kconfig
7781 +++ b/arch/sparc/Kconfig
7782 @@ -31,6 +31,7 @@ config SPARC
7783 @@ -7752,7 +7752,7 @@ index bf56e17..05f9891 100644
7784 This option helps catch unintended modifications to loadable
7785 kernel module's text and read-only data. It also prevents execution
7786 diff --git a/arch/x86/Makefile b/arch/x86/Makefile
7787 -index b02e509..2631e48 100644
7788 +index 03dbc7f5b..4d12eea 100644
7789 --- a/arch/x86/Makefile
7790 +++ b/arch/x86/Makefile
7791 @@ -46,6 +46,7 @@ else
7792 @@ -7763,7 +7763,7 @@ index b02e509..2631e48 100644
7793 KBUILD_AFLAGS += -m64
7794 KBUILD_CFLAGS += -m64
7795
7796 -@@ -195,3 +196,12 @@ define archhelp
7797 +@@ -199,3 +200,12 @@ define archhelp
7798 echo ' FDARGS="..." arguments for the booted kernel'
7799 echo ' FDINITRD=file initrd for the booted kernel'
7800 endef
7801 @@ -7835,7 +7835,7 @@ index c7093bd..d4247ffe0 100644
7802 return diff;
7803 }
7804 diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
7805 -index 09664ef..edc5d03 100644
7806 +index 77453c6..2c6cd1b 100644
7807 --- a/arch/x86/boot/compressed/Makefile
7808 +++ b/arch/x86/boot/compressed/Makefile
7809 @@ -14,6 +14,9 @@ cflags-$(CONFIG_X86_64) := -mcmodel=small
7810 @@ -7924,201 +7924,6 @@ index 3a19d04..7c1d55a 100644
7811 error("Wrong destination address");
7812 #endif
7813
7814 -diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
7815 -index e77f4e4..17e511f 100644
7816 ---- a/arch/x86/boot/compressed/relocs.c
7817 -+++ b/arch/x86/boot/compressed/relocs.c
7818 -@@ -13,8 +13,11 @@
7819 -
7820 - static void die(char *fmt, ...);
7821 -
7822 -+#include "../../../../include/generated/autoconf.h"
7823 -+
7824 - #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
7825 - static Elf32_Ehdr ehdr;
7826 -+static Elf32_Phdr *phdr;
7827 - static unsigned long reloc_count, reloc_idx;
7828 - static unsigned long *relocs;
7829 -
7830 -@@ -270,9 +273,39 @@ static void read_ehdr(FILE *fp)
7831 - }
7832 - }
7833 -
7834 -+static void read_phdrs(FILE *fp)
7835 -+{
7836 -+ unsigned int i;
7837 -+
7838 -+ phdr = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
7839 -+ if (!phdr) {
7840 -+ die("Unable to allocate %d program headers\n",
7841 -+ ehdr.e_phnum);
7842 -+ }
7843 -+ if (fseek(fp, ehdr.e_phoff, SEEK_SET) < 0) {
7844 -+ die("Seek to %d failed: %s\n",
7845 -+ ehdr.e_phoff, strerror(errno));
7846 -+ }
7847 -+ if (fread(phdr, sizeof(*phdr), ehdr.e_phnum, fp) != ehdr.e_phnum) {
7848 -+ die("Cannot read ELF program headers: %s\n",
7849 -+ strerror(errno));
7850 -+ }
7851 -+ for(i = 0; i < ehdr.e_phnum; i++) {
7852 -+ phdr[i].p_type = elf32_to_cpu(phdr[i].p_type);
7853 -+ phdr[i].p_offset = elf32_to_cpu(phdr[i].p_offset);
7854 -+ phdr[i].p_vaddr = elf32_to_cpu(phdr[i].p_vaddr);
7855 -+ phdr[i].p_paddr = elf32_to_cpu(phdr[i].p_paddr);
7856 -+ phdr[i].p_filesz = elf32_to_cpu(phdr[i].p_filesz);
7857 -+ phdr[i].p_memsz = elf32_to_cpu(phdr[i].p_memsz);
7858 -+ phdr[i].p_flags = elf32_to_cpu(phdr[i].p_flags);
7859 -+ phdr[i].p_align = elf32_to_cpu(phdr[i].p_align);
7860 -+ }
7861 -+
7862 -+}
7863 -+
7864 - static void read_shdrs(FILE *fp)
7865 - {
7866 -- int i;
7867 -+ unsigned int i;
7868 - Elf32_Shdr shdr;
7869 -
7870 - secs = calloc(ehdr.e_shnum, sizeof(struct section));
7871 -@@ -307,7 +340,7 @@ static void read_shdrs(FILE *fp)
7872 -
7873 - static void read_strtabs(FILE *fp)
7874 - {
7875 -- int i;
7876 -+ unsigned int i;
7877 - for (i = 0; i < ehdr.e_shnum; i++) {
7878 - struct section *sec = &secs[i];
7879 - if (sec->shdr.sh_type != SHT_STRTAB) {
7880 -@@ -332,7 +365,7 @@ static void read_strtabs(FILE *fp)
7881 -
7882 - static void read_symtabs(FILE *fp)
7883 - {
7884 -- int i,j;
7885 -+ unsigned int i,j;
7886 - for (i = 0; i < ehdr.e_shnum; i++) {
7887 - struct section *sec = &secs[i];
7888 - if (sec->shdr.sh_type != SHT_SYMTAB) {
7889 -@@ -365,7 +398,9 @@ static void read_symtabs(FILE *fp)
7890 -
7891 - static void read_relocs(FILE *fp)
7892 - {
7893 -- int i,j;
7894 -+ unsigned int i,j;
7895 -+ uint32_t base;
7896 -+
7897 - for (i = 0; i < ehdr.e_shnum; i++) {
7898 - struct section *sec = &secs[i];
7899 - if (sec->shdr.sh_type != SHT_REL) {
7900 -@@ -385,9 +420,18 @@ static void read_relocs(FILE *fp)
7901 - die("Cannot read symbol table: %s\n",
7902 - strerror(errno));
7903 - }
7904 -+ base = 0;
7905 -+ for (j = 0; j < ehdr.e_phnum; j++) {
7906 -+ if (phdr[j].p_type != PT_LOAD )
7907 -+ continue;
7908 -+ if (secs[sec->shdr.sh_info].shdr.sh_offset < phdr[j].p_offset || secs[sec->shdr.sh_info].shdr.sh_offset >= phdr[j].p_offset + phdr[j].p_filesz)
7909 -+ continue;
7910 -+ base = CONFIG_PAGE_OFFSET + phdr[j].p_paddr - phdr[j].p_vaddr;
7911 -+ break;
7912 -+ }
7913 - for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
7914 - Elf32_Rel *rel = &sec->reltab[j];
7915 -- rel->r_offset = elf32_to_cpu(rel->r_offset);
7916 -+ rel->r_offset = elf32_to_cpu(rel->r_offset) + base;
7917 - rel->r_info = elf32_to_cpu(rel->r_info);
7918 - }
7919 - }
7920 -@@ -396,13 +440,13 @@ static void read_relocs(FILE *fp)
7921 -
7922 - static void print_absolute_symbols(void)
7923 - {
7924 -- int i;
7925 -+ unsigned int i;
7926 - printf("Absolute symbols\n");
7927 - printf(" Num: Value Size Type Bind Visibility Name\n");
7928 - for (i = 0; i < ehdr.e_shnum; i++) {
7929 - struct section *sec = &secs[i];
7930 - char *sym_strtab;
7931 -- int j;
7932 -+ unsigned int j;
7933 -
7934 - if (sec->shdr.sh_type != SHT_SYMTAB) {
7935 - continue;
7936 -@@ -429,14 +473,14 @@ static void print_absolute_symbols(void)
7937 -
7938 - static void print_absolute_relocs(void)
7939 - {
7940 -- int i, printed = 0;
7941 -+ unsigned int i, printed = 0;
7942 -
7943 - for (i = 0; i < ehdr.e_shnum; i++) {
7944 - struct section *sec = &secs[i];
7945 - struct section *sec_applies, *sec_symtab;
7946 - char *sym_strtab;
7947 - Elf32_Sym *sh_symtab;
7948 -- int j;
7949 -+ unsigned int j;
7950 - if (sec->shdr.sh_type != SHT_REL) {
7951 - continue;
7952 - }
7953 -@@ -497,13 +541,13 @@ static void print_absolute_relocs(void)
7954 -
7955 - static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
7956 - {
7957 -- int i;
7958 -+ unsigned int i;
7959 - /* Walk through the relocations */
7960 - for (i = 0; i < ehdr.e_shnum; i++) {
7961 - char *sym_strtab;
7962 - Elf32_Sym *sh_symtab;
7963 - struct section *sec_applies, *sec_symtab;
7964 -- int j;
7965 -+ unsigned int j;
7966 - struct section *sec = &secs[i];
7967 -
7968 - if (sec->shdr.sh_type != SHT_REL) {
7969 -@@ -528,6 +572,22 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
7970 - !is_rel_reloc(sym_name(sym_strtab, sym))) {
7971 - continue;
7972 - }
7973 -+ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
7974 -+ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
7975 -+ continue;
7976 -+
7977 -+#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
7978 -+ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
7979 -+ if (!strcmp(sec_name(sym->st_shndx), ".module.text") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
7980 -+ continue;
7981 -+ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
7982 -+ continue;
7983 -+ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
7984 -+ continue;
7985 -+ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
7986 -+ continue;
7987 -+#endif
7988 -+
7989 - switch (r_type) {
7990 - case R_386_NONE:
7991 - case R_386_PC32:
7992 -@@ -569,7 +629,7 @@ static int cmp_relocs(const void *va, const void *vb)
7993 -
7994 - static void emit_relocs(int as_text)
7995 - {
7996 -- int i;
7997 -+ unsigned int i;
7998 - /* Count how many relocations I have and allocate space for them. */
7999 - reloc_count = 0;
8000 - walk_relocs(count_reloc);
8001 -@@ -663,6 +723,7 @@ int main(int argc, char **argv)
8002 - fname, strerror(errno));
8003 - }
8004 - read_ehdr(fp);
8005 -+ read_phdrs(fp);
8006 - read_shdrs(fp);
8007 - read_strtabs(fp);
8008 - read_symtabs(fp);
8009 diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
8010 index 4d3ff03..e4972ff 100644
8011 --- a/arch/x86/boot/cpucheck.c
8012 @@ -14351,7 +14156,7 @@ index 5231312..a78a987 100644
8013 }
8014 #endif
8015 diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
8016 -index 2af127d..8ff7ac0 100644
8017 +index b0f1271..1158227 100644
8018 --- a/arch/x86/kernel/cpu/mcheck/mce.c
8019 +++ b/arch/x86/kernel/cpu/mcheck/mce.c
8020 @@ -42,6 +42,7 @@
8021 @@ -14402,7 +14207,7 @@ index 2af127d..8ff7ac0 100644
8022 return;
8023 }
8024 /* First print corrected ones that are still unlogged */
8025 -@@ -610,7 +611,7 @@ static int mce_timed_out(u64 *t)
8026 +@@ -618,7 +619,7 @@ static int mce_timed_out(u64 *t)
8027 * might have been modified by someone else.
8028 */
8029 rmb();
8030 @@ -14411,7 +14216,7 @@ index 2af127d..8ff7ac0 100644
8031 wait_for_panic();
8032 if (!monarch_timeout)
8033 goto out;
8034 -@@ -1398,7 +1399,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
8035 +@@ -1406,7 +1407,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
8036 }
8037
8038 /* Call the installed machine check handler for this CPU setup. */
8039 @@ -14420,7 +14225,7 @@ index 2af127d..8ff7ac0 100644
8040 unexpected_machine_check;
8041
8042 /*
8043 -@@ -1421,7 +1422,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
8044 +@@ -1429,7 +1430,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
8045 return;
8046 }
8047
8048 @@ -14430,7 +14235,7 @@ index 2af127d..8ff7ac0 100644
8049
8050 __mcheck_cpu_init_generic();
8051 __mcheck_cpu_init_vendor(c);
8052 -@@ -1435,7 +1438,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
8053 +@@ -1443,7 +1446,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
8054 */
8055
8056 static DEFINE_SPINLOCK(mce_chrdev_state_lock);
8057 @@ -14439,7 +14244,7 @@ index 2af127d..8ff7ac0 100644
8058 static int mce_chrdev_open_exclu; /* already open exclusive? */
8059
8060 static int mce_chrdev_open(struct inode *inode, struct file *file)
8061 -@@ -1443,7 +1446,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
8062 +@@ -1451,7 +1454,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
8063 spin_lock(&mce_chrdev_state_lock);
8064
8065 if (mce_chrdev_open_exclu ||
8066 @@ -14448,7 +14253,7 @@ index 2af127d..8ff7ac0 100644
8067 spin_unlock(&mce_chrdev_state_lock);
8068
8069 return -EBUSY;
8070 -@@ -1451,7 +1454,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
8071 +@@ -1459,7 +1462,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
8072
8073 if (file->f_flags & O_EXCL)
8074 mce_chrdev_open_exclu = 1;
8075 @@ -14457,7 +14262,7 @@ index 2af127d..8ff7ac0 100644
8076
8077 spin_unlock(&mce_chrdev_state_lock);
8078
8079 -@@ -1462,7 +1465,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
8080 +@@ -1470,7 +1473,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
8081 {
8082 spin_lock(&mce_chrdev_state_lock);
8083
8084 @@ -14466,7 +14271,7 @@ index 2af127d..8ff7ac0 100644
8085 mce_chrdev_open_exclu = 0;
8086
8087 spin_unlock(&mce_chrdev_state_lock);
8088 -@@ -2171,7 +2174,7 @@ struct dentry *mce_get_debugfs_dir(void)
8089 +@@ -2179,7 +2182,7 @@ struct dentry *mce_get_debugfs_dir(void)
8090 static void mce_reset(void)
8091 {
8092 cpu_missing = 0;
8093 @@ -20589,7 +20394,7 @@ index 94a4672..5c6b853 100644
8094
8095 local_irq_disable();
8096 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
8097 -index 4ea7678..b3a7084 100644
8098 +index 7315488..187fb78 100644
8099 --- a/arch/x86/kvm/vmx.c
8100 +++ b/arch/x86/kvm/vmx.c
8101 @@ -1305,7 +1305,11 @@ static void reload_tss(void)
8102 @@ -20627,7 +20432,7 @@ index 4ea7678..b3a7084 100644
8103
8104 rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
8105 vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
8106 -@@ -6169,6 +6176,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8107 +@@ -6171,6 +6178,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8108 "jmp .Lkvm_vmx_return \n\t"
8109 ".Llaunched: " __ex(ASM_VMX_VMRESUME) "\n\t"
8110 ".Lkvm_vmx_return: "
8111 @@ -20640,7 +20445,7 @@ index 4ea7678..b3a7084 100644
8112 /* Save guest registers, load host registers, keep flags */
8113 "mov %0, %c[wordsize](%%"R"sp) \n\t"
8114 "pop %0 \n\t"
8115 -@@ -6217,6 +6230,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8116 +@@ -6219,6 +6232,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8117 #endif
8118 [cr2]"i"(offsetof(struct vcpu_vmx, vcpu.arch.cr2)),
8119 [wordsize]"i"(sizeof(ulong))
8120 @@ -20652,7 +20457,7 @@ index 4ea7678..b3a7084 100644
8121 : "cc", "memory"
8122 , R"ax", R"bx", R"di", R"si"
8123 #ifdef CONFIG_X86_64
8124 -@@ -6245,7 +6263,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8125 +@@ -6247,7 +6265,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
8126 }
8127 }
8128
8129 @@ -20671,7 +20476,7 @@ index 4ea7678..b3a7084 100644
8130
8131 vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
8132 diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
8133 -index e04cae1..b37d0dd 100644
8134 +index 4fc5323..59b259b 100644
8135 --- a/arch/x86/kvm/x86.c
8136 +++ b/arch/x86/kvm/x86.c
8137 @@ -1345,8 +1345,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
8138 @@ -20750,7 +20555,7 @@ index e04cae1..b37d0dd 100644
8139 return -EINVAL;
8140 if (irqchip_in_kernel(vcpu->kvm))
8141 return -ENXIO;
8142 -@@ -5185,7 +5196,7 @@ static void kvm_set_mmio_spte_mask(void)
8143 +@@ -5188,7 +5199,7 @@ static void kvm_set_mmio_spte_mask(void)
8144 kvm_mmu_set_mmio_spte_mask(mask);
8145 }
8146
8147 @@ -24733,7 +24538,7 @@ index f581a18..a269cab 100644
8148 }
8149 if (mm->get_unmapped_area == arch_get_unmapped_area)
8150 diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
8151 -index 87488b9..f6222dc 100644
8152 +index 87488b9..a06f559 100644
8153 --- a/arch/x86/mm/init.c
8154 +++ b/arch/x86/mm/init.c
8155 @@ -15,6 +15,8 @@
8156 @@ -24793,7 +24598,7 @@ index 87488b9..f6222dc 100644
8157 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
8158 return 0;
8159 if (!page_is_ram(pagenr))
8160 -@@ -370,8 +399,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
8161 +@@ -370,8 +399,116 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
8162 #endif
8163 }
8164
8165 @@ -24828,14 +24633,13 @@ index 87488b9..f6222dc 100644
8166 + unsigned long addr, limit;
8167 + struct desc_struct d;
8168 + int cpu;
8169 -+#endif
8170 -+#endif
8171 -+#ifndef CONFIG_X86_PAE
8172 ++#else
8173 + pgd_t *pgd;
8174 + pud_t *pud;
8175 + pmd_t *pmd;
8176 + unsigned long addr, end;
8177 +#endif
8178 ++#endif
8179 +
8180 + gr_init_ebda();
8181 +
8182 @@ -26905,6 +26709,206 @@ index f10c0af..3ec1f95 100644
8183
8184 syscall_init(); /* This sets MSR_*STAR and related */
8185 #endif
8186 +diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
8187 +index e529730..dccc321 100644
8188 +--- a/arch/x86/tools/relocs.c
8189 ++++ b/arch/x86/tools/relocs.c
8190 +@@ -13,8 +13,16 @@
8191 +
8192 + static void die(char *fmt, ...);
8193 +
8194 ++#include "../../../include/generated/autoconf.h"
8195 ++#ifdef CONFIG_X86_32
8196 ++#define __PAGE_OFFSET CONFIG_PAGE_OFFSET
8197 ++#else
8198 ++#define __PAGE_OFFSET 0
8199 ++#endif
8200 ++
8201 + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
8202 + static Elf32_Ehdr ehdr;
8203 ++static Elf32_Phdr *phdr;
8204 + static unsigned long reloc_count, reloc_idx;
8205 + static unsigned long *relocs;
8206 + static unsigned long reloc16_count, reloc16_idx;
8207 +@@ -322,9 +330,39 @@ static void read_ehdr(FILE *fp)
8208 + }
8209 + }
8210 +
8211 ++static void read_phdrs(FILE *fp)
8212 ++{
8213 ++ unsigned int i;
8214 ++
8215 ++ phdr = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
8216 ++ if (!phdr) {
8217 ++ die("Unable to allocate %d program headers\n",
8218 ++ ehdr.e_phnum);
8219 ++ }
8220 ++ if (fseek(fp, ehdr.e_phoff, SEEK_SET) < 0) {
8221 ++ die("Seek to %d failed: %s\n",
8222 ++ ehdr.e_phoff, strerror(errno));
8223 ++ }
8224 ++ if (fread(phdr, sizeof(*phdr), ehdr.e_phnum, fp) != ehdr.e_phnum) {
8225 ++ die("Cannot read ELF program headers: %s\n",
8226 ++ strerror(errno));
8227 ++ }
8228 ++ for(i = 0; i < ehdr.e_phnum; i++) {
8229 ++ phdr[i].p_type = elf32_to_cpu(phdr[i].p_type);
8230 ++ phdr[i].p_offset = elf32_to_cpu(phdr[i].p_offset);
8231 ++ phdr[i].p_vaddr = elf32_to_cpu(phdr[i].p_vaddr);
8232 ++ phdr[i].p_paddr = elf32_to_cpu(phdr[i].p_paddr);
8233 ++ phdr[i].p_filesz = elf32_to_cpu(phdr[i].p_filesz);
8234 ++ phdr[i].p_memsz = elf32_to_cpu(phdr[i].p_memsz);
8235 ++ phdr[i].p_flags = elf32_to_cpu(phdr[i].p_flags);
8236 ++ phdr[i].p_align = elf32_to_cpu(phdr[i].p_align);
8237 ++ }
8238 ++
8239 ++}
8240 ++
8241 + static void read_shdrs(FILE *fp)
8242 + {
8243 +- int i;
8244 ++ unsigned int i;
8245 + Elf32_Shdr shdr;
8246 +
8247 + secs = calloc(ehdr.e_shnum, sizeof(struct section));
8248 +@@ -359,7 +397,7 @@ static void read_shdrs(FILE *fp)
8249 +
8250 + static void read_strtabs(FILE *fp)
8251 + {
8252 +- int i;
8253 ++ unsigned int i;
8254 + for (i = 0; i < ehdr.e_shnum; i++) {
8255 + struct section *sec = &secs[i];
8256 + if (sec->shdr.sh_type != SHT_STRTAB) {
8257 +@@ -384,7 +422,7 @@ static void read_strtabs(FILE *fp)
8258 +
8259 + static void read_symtabs(FILE *fp)
8260 + {
8261 +- int i,j;
8262 ++ unsigned int i,j;
8263 + for (i = 0; i < ehdr.e_shnum; i++) {
8264 + struct section *sec = &secs[i];
8265 + if (sec->shdr.sh_type != SHT_SYMTAB) {
8266 +@@ -417,7 +455,9 @@ static void read_symtabs(FILE *fp)
8267 +
8268 + static void read_relocs(FILE *fp)
8269 + {
8270 +- int i,j;
8271 ++ unsigned int i,j;
8272 ++ uint32_t base;
8273 ++
8274 + for (i = 0; i < ehdr.e_shnum; i++) {
8275 + struct section *sec = &secs[i];
8276 + if (sec->shdr.sh_type != SHT_REL) {
8277 +@@ -437,9 +477,18 @@ static void read_relocs(FILE *fp)
8278 + die("Cannot read symbol table: %s\n",
8279 + strerror(errno));
8280 + }
8281 ++ base = 0;
8282 ++ for (j = 0; j < ehdr.e_phnum; j++) {
8283 ++ if (phdr[j].p_type != PT_LOAD )
8284 ++ continue;
8285 ++ if (secs[sec->shdr.sh_info].shdr.sh_offset < phdr[j].p_offset || secs[sec->shdr.sh_info].shdr.sh_offset >= phdr[j].p_offset + phdr[j].p_filesz)
8286 ++ continue;
8287 ++ base = __PAGE_OFFSET + phdr[j].p_paddr - phdr[j].p_vaddr;
8288 ++ break;
8289 ++ }
8290 + for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
8291 + Elf32_Rel *rel = &sec->reltab[j];
8292 +- rel->r_offset = elf32_to_cpu(rel->r_offset);
8293 ++ rel->r_offset = elf32_to_cpu(rel->r_offset) + base;
8294 + rel->r_info = elf32_to_cpu(rel->r_info);
8295 + }
8296 + }
8297 +@@ -448,13 +497,13 @@ static void read_relocs(FILE *fp)
8298 +
8299 + static void print_absolute_symbols(void)
8300 + {
8301 +- int i;
8302 ++ unsigned int i;
8303 + printf("Absolute symbols\n");
8304 + printf(" Num: Value Size Type Bind Visibility Name\n");
8305 + for (i = 0; i < ehdr.e_shnum; i++) {
8306 + struct section *sec = &secs[i];
8307 + char *sym_strtab;
8308 +- int j;
8309 ++ unsigned int j;
8310 +
8311 + if (sec->shdr.sh_type != SHT_SYMTAB) {
8312 + continue;
8313 +@@ -481,14 +530,14 @@ static void print_absolute_symbols(void)
8314 +
8315 + static void print_absolute_relocs(void)
8316 + {
8317 +- int i, printed = 0;
8318 ++ unsigned int i, printed = 0;
8319 +
8320 + for (i = 0; i < ehdr.e_shnum; i++) {
8321 + struct section *sec = &secs[i];
8322 + struct section *sec_applies, *sec_symtab;
8323 + char *sym_strtab;
8324 + Elf32_Sym *sh_symtab;
8325 +- int j;
8326 ++ unsigned int j;
8327 + if (sec->shdr.sh_type != SHT_REL) {
8328 + continue;
8329 + }
8330 +@@ -550,13 +599,13 @@ static void print_absolute_relocs(void)
8331 + static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
8332 + int use_real_mode)
8333 + {
8334 +- int i;
8335 ++ unsigned int i;
8336 + /* Walk through the relocations */
8337 + for (i = 0; i < ehdr.e_shnum; i++) {
8338 + char *sym_strtab;
8339 + Elf32_Sym *sh_symtab;
8340 + struct section *sec_applies, *sec_symtab;
8341 +- int j;
8342 ++ unsigned int j;
8343 + struct section *sec = &secs[i];
8344 +
8345 + if (sec->shdr.sh_type != SHT_REL) {
8346 +@@ -582,6 +631,22 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
8347 +
8348 + shn_abs = sym->st_shndx == SHN_ABS;
8349 +
8350 ++ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
8351 ++ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
8352 ++ continue;
8353 ++
8354 ++#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
8355 ++ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
8356 ++ if (!strcmp(sec_name(sym->st_shndx), ".module.text") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
8357 ++ continue;
8358 ++ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
8359 ++ continue;
8360 ++ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
8361 ++ continue;
8362 ++ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
8363 ++ continue;
8364 ++#endif
8365 ++
8366 + switch (r_type) {
8367 + case R_386_NONE:
8368 + case R_386_PC32:
8369 +@@ -676,7 +741,7 @@ static int write32(unsigned int v, FILE *f)
8370 +
8371 + static void emit_relocs(int as_text, int use_real_mode)
8372 + {
8373 +- int i;
8374 ++ unsigned int i;
8375 + /* Count how many relocations I have and allocate space for them. */
8376 + reloc_count = 0;
8377 + walk_relocs(count_reloc, use_real_mode);
8378 +@@ -803,6 +868,7 @@ int main(int argc, char **argv)
8379 + fname, strerror(errno));
8380 + }
8381 + read_ehdr(fp);
8382 ++ read_phdrs(fp);
8383 + read_shdrs(fp);
8384 + read_strtabs(fp);
8385 + read_symtabs(fp);
8386 diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
8387 index 5d17950..2253fc9 100644
8388 --- a/arch/x86/vdso/Makefile
8389 @@ -27078,7 +27082,7 @@ index 153407c..611cba9 100644
8390 -}
8391 -__setup("vdso=", vdso_setup);
8392 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
8393 -index e7c920b..c9bdcf7 100644
8394 +index e7c920b..4413fbf 100644
8395 --- a/arch/x86/xen/enlighten.c
8396 +++ b/arch/x86/xen/enlighten.c
8397 @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
8398 @@ -27090,7 +27094,18 @@ index e7c920b..c9bdcf7 100644
8399 RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
8400 __read_mostly int xen_have_vector_callback;
8401 EXPORT_SYMBOL_GPL(xen_have_vector_callback);
8402 -@@ -1030,7 +1028,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
8403 +@@ -982,7 +980,10 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
8404 + .wbinvd = native_wbinvd,
8405 +
8406 + .read_msr = native_read_msr_safe,
8407 ++ .rdmsr_regs = native_rdmsr_safe_regs,
8408 + .write_msr = xen_write_msr_safe,
8409 ++ .wrmsr_regs = native_wrmsr_safe_regs,
8410 ++
8411 + .read_tsc = native_read_tsc,
8412 + .read_pmc = native_read_pmc,
8413 +
8414 +@@ -1030,7 +1031,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
8415 #endif
8416 };
8417
8418 @@ -27099,7 +27114,7 @@ index e7c920b..c9bdcf7 100644
8419 {
8420 struct sched_shutdown r = { .reason = reason };
8421
8422 -@@ -1038,17 +1036,17 @@ static void xen_reboot(int reason)
8423 +@@ -1038,17 +1039,17 @@ static void xen_reboot(int reason)
8424 BUG();
8425 }
8426
8427 @@ -27120,7 +27135,7 @@ index e7c920b..c9bdcf7 100644
8428 {
8429 xen_reboot(SHUTDOWN_poweroff);
8430 }
8431 -@@ -1154,7 +1152,17 @@ asmlinkage void __init xen_start_kernel(void)
8432 +@@ -1154,7 +1155,17 @@ asmlinkage void __init xen_start_kernel(void)
8433 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
8434
8435 /* Work out if we support NX */
8436 @@ -27139,7 +27154,7 @@ index e7c920b..c9bdcf7 100644
8437
8438 xen_setup_features();
8439
8440 -@@ -1185,13 +1193,6 @@ asmlinkage void __init xen_start_kernel(void)
8441 +@@ -1185,13 +1196,6 @@ asmlinkage void __init xen_start_kernel(void)
8442
8443 machine_ops = xen_machine_ops;
8444
8445 @@ -30773,10 +30788,10 @@ index a6c2f7a..0eea25d 100644
8446 for (i = 0; i < count; i++) {
8447 char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr;
8448 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
8449 -index d47a53b..61154c2 100644
8450 +index d3820c2..23c575f 100644
8451 --- a/drivers/gpu/drm/i915/i915_irq.c
8452 +++ b/drivers/gpu/drm/i915/i915_irq.c
8453 -@@ -475,7 +475,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
8454 +@@ -472,7 +472,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
8455 u32 de_iir, gt_iir, de_ier, pch_iir, pm_iir;
8456 struct drm_i915_master_private *master_priv;
8457
8458 @@ -30785,7 +30800,7 @@ index d47a53b..61154c2 100644
8459
8460 /* disable master interrupt before clearing iir */
8461 de_ier = I915_READ(DEIER);
8462 -@@ -566,7 +566,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
8463 +@@ -563,7 +563,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
8464 struct drm_i915_master_private *master_priv;
8465 u32 bsd_usr_interrupt = GT_BSD_USER_INTERRUPT;
8466
8467 @@ -30794,7 +30809,7 @@ index d47a53b..61154c2 100644
8468
8469 if (IS_GEN6(dev))
8470 bsd_usr_interrupt = GT_GEN6_BSD_USER_INTERRUPT;
8471 -@@ -1231,7 +1231,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
8472 +@@ -1228,7 +1228,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
8473 int ret = IRQ_NONE, pipe;
8474 bool blc_event = false;
8475
8476 @@ -30803,7 +30818,7 @@ index d47a53b..61154c2 100644
8477
8478 iir = I915_READ(IIR);
8479
8480 -@@ -1750,7 +1750,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
8481 +@@ -1747,7 +1747,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
8482 {
8483 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
8484
8485 @@ -30812,7 +30827,7 @@ index d47a53b..61154c2 100644
8486
8487 INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
8488 INIT_WORK(&dev_priv->error_work, i915_error_work_func);
8489 -@@ -1938,7 +1938,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
8490 +@@ -1935,7 +1935,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
8491 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
8492 int pipe;
8493
8494 @@ -30822,7 +30837,7 @@ index d47a53b..61154c2 100644
8495 INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
8496 INIT_WORK(&dev_priv->error_work, i915_error_work_func);
8497 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
8498 -index 390768f..172aa06 100644
8499 +index 3ff980d..6efde22 100644
8500 --- a/drivers/gpu/drm/i915/intel_display.c
8501 +++ b/drivers/gpu/drm/i915/intel_display.c
8502 @@ -2230,7 +2230,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
8503 @@ -33765,7 +33780,7 @@ index 4720f68..78d1df7 100644
8504
8505 void dm_uevent_add(struct mapped_device *md, struct list_head *elist)
8506 diff --git a/drivers/md/md.c b/drivers/md/md.c
8507 -index adcd850..e29654d 100644
8508 +index 700ecae..2e5a31a 100644
8509 --- a/drivers/md/md.c
8510 +++ b/drivers/md/md.c
8511 @@ -278,10 +278,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
8512 @@ -34189,7 +34204,7 @@ index 0564192..75b16f5 100644
8513 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
8514 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
8515 diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
8516 -index 16a089f..ab1667d 100644
8517 +index 16a089f..1661b11 100644
8518 --- a/drivers/media/radio/radio-cadet.c
8519 +++ b/drivers/media/radio/radio-cadet.c
8520 @@ -326,6 +326,8 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
8521 @@ -34201,6 +34216,15 @@ index 16a089f..ab1667d 100644
8522 mutex_lock(&dev->lock);
8523 if (dev->rdsstat == 0) {
8524 dev->rdsstat = 1;
8525 +@@ -347,7 +349,7 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
8526 + readbuf[i++] = dev->rdsbuf[dev->rdsout++];
8527 + mutex_unlock(&dev->lock);
8528 +
8529 +- if (copy_to_user(data, readbuf, i))
8530 ++ if (i > sizeof(readbuf) || copy_to_user(data, readbuf, i))
8531 + return -EFAULT;
8532 + return i;
8533 + }
8534 diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
8535 index 61287fc..8b08712 100644
8536 --- a/drivers/media/rc/redrat3.c
8537 @@ -35063,93 +35087,6 @@ index 4d01219..b58d26d 100644
8538 { /* Sometime a Level-One switch card. */
8539 "Winbond W89c840", CanHaveMII | HasBrokenTx | FDXOnNoMII},
8540 { "Winbond W89c840", CanHaveMII | HasBrokenTx},
8541 -diff --git a/drivers/net/ethernet/dlink/dl2k.c b/drivers/net/ethernet/dlink/dl2k.c
8542 -index b2dc2c8..2e09edb 100644
8543 ---- a/drivers/net/ethernet/dlink/dl2k.c
8544 -+++ b/drivers/net/ethernet/dlink/dl2k.c
8545 -@@ -1259,55 +1259,21 @@ rio_ioctl (struct net_device *dev, struct ifreq *rq, int cmd)
8546 - {
8547 - int phy_addr;
8548 - struct netdev_private *np = netdev_priv(dev);
8549 -- struct mii_data *miidata = (struct mii_data *) &rq->ifr_ifru;
8550 --
8551 -- struct netdev_desc *desc;
8552 -- int i;
8553 -+ struct mii_ioctl_data *miidata = if_mii(rq);
8554 -
8555 - phy_addr = np->phy_addr;
8556 - switch (cmd) {
8557 -- case SIOCDEVPRIVATE:
8558 -+ case SIOCGMIIPHY:
8559 -+ miidata->phy_id = phy_addr;
8560 - break;
8561 --
8562 -- case SIOCDEVPRIVATE + 1:
8563 -- miidata->out_value = mii_read (dev, phy_addr, miidata->reg_num);
8564 -+ case SIOCGMIIREG:
8565 -+ miidata->val_out = mii_read (dev, phy_addr, miidata->reg_num);
8566 - break;
8567 -- case SIOCDEVPRIVATE + 2:
8568 -- mii_write (dev, phy_addr, miidata->reg_num, miidata->in_value);
8569 -+ case SIOCSMIIREG:
8570 -+ if (!capable(CAP_NET_ADMIN))
8571 -+ return -EPERM;
8572 -+ mii_write (dev, phy_addr, miidata->reg_num, miidata->val_in);
8573 - break;
8574 -- case SIOCDEVPRIVATE + 3:
8575 -- break;
8576 -- case SIOCDEVPRIVATE + 4:
8577 -- break;
8578 -- case SIOCDEVPRIVATE + 5:
8579 -- netif_stop_queue (dev);
8580 -- break;
8581 -- case SIOCDEVPRIVATE + 6:
8582 -- netif_wake_queue (dev);
8583 -- break;
8584 -- case SIOCDEVPRIVATE + 7:
8585 -- printk
8586 -- ("tx_full=%x cur_tx=%lx old_tx=%lx cur_rx=%lx old_rx=%lx\n",
8587 -- netif_queue_stopped(dev), np->cur_tx, np->old_tx, np->cur_rx,
8588 -- np->old_rx);
8589 -- break;
8590 -- case SIOCDEVPRIVATE + 8:
8591 -- printk("TX ring:\n");
8592 -- for (i = 0; i < TX_RING_SIZE; i++) {
8593 -- desc = &np->tx_ring[i];
8594 -- printk
8595 -- ("%02x:cur:%08x next:%08x status:%08x frag1:%08x frag0:%08x",
8596 -- i,
8597 -- (u32) (np->tx_ring_dma + i * sizeof (*desc)),
8598 -- (u32)le64_to_cpu(desc->next_desc),
8599 -- (u32)le64_to_cpu(desc->status),
8600 -- (u32)(le64_to_cpu(desc->fraginfo) >> 32),
8601 -- (u32)le64_to_cpu(desc->fraginfo));
8602 -- printk ("\n");
8603 -- }
8604 -- printk ("\n");
8605 -- break;
8606 --
8607 - default:
8608 - return -EOPNOTSUPP;
8609 - }
8610 -diff --git a/drivers/net/ethernet/dlink/dl2k.h b/drivers/net/ethernet/dlink/dl2k.h
8611 -index ba0adca..30c2da3 100644
8612 ---- a/drivers/net/ethernet/dlink/dl2k.h
8613 -+++ b/drivers/net/ethernet/dlink/dl2k.h
8614 -@@ -365,13 +365,6 @@ struct ioctl_data {
8615 - char *data;
8616 - };
8617 -
8618 --struct mii_data {
8619 -- __u16 reserved;
8620 -- __u16 reg_num;
8621 -- __u16 in_value;
8622 -- __u16 out_value;
8623 --};
8624 --
8625 - /* The Rx and Tx buffer descriptors. */
8626 - struct netdev_desc {
8627 - __le64 next_desc;
8628 diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c
8629 index dcd7f7a..ecb7fb3 100644
8630 --- a/drivers/net/ethernet/dlink/sundance.c
8631 @@ -36891,7 +36828,7 @@ index 351dc0b..951dc32 100644
8632
8633 /* These three are default values which can be overridden */
8634 diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
8635 -index 865d452..e9b7fa7 100644
8636 +index b4d2c86..094a532 100644
8637 --- a/drivers/scsi/hpsa.c
8638 +++ b/drivers/scsi/hpsa.c
8639 @@ -505,7 +505,7 @@ static inline u32 next_command(struct ctlr_info *h)
8640 @@ -36903,7 +36840,7 @@ index 865d452..e9b7fa7 100644
8641
8642 if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
8643 a = *(h->reply_pool_head); /* Next cmd in ring buffer */
8644 -@@ -2989,7 +2989,7 @@ static void start_io(struct ctlr_info *h)
8645 +@@ -2985,7 +2985,7 @@ static void start_io(struct ctlr_info *h)
8646 while (!list_empty(&h->reqQ)) {
8647 c = list_entry(h->reqQ.next, struct CommandList, list);
8648 /* can't do anything if fifo is full */
8649 @@ -36912,7 +36849,7 @@ index 865d452..e9b7fa7 100644
8650 dev_warn(&h->pdev->dev, "fifo full\n");
8651 break;
8652 }
8653 -@@ -2999,7 +2999,7 @@ static void start_io(struct ctlr_info *h)
8654 +@@ -2995,7 +2995,7 @@ static void start_io(struct ctlr_info *h)
8655 h->Qdepth--;
8656
8657 /* Tell the controller execute command */
8658 @@ -36921,7 +36858,7 @@ index 865d452..e9b7fa7 100644
8659
8660 /* Put job onto the completed Q */
8661 addQ(&h->cmpQ, c);
8662 -@@ -3008,17 +3008,17 @@ static void start_io(struct ctlr_info *h)
8663 +@@ -3004,17 +3004,17 @@ static void start_io(struct ctlr_info *h)
8664
8665 static inline unsigned long get_next_completion(struct ctlr_info *h)
8666 {
8667 @@ -36942,7 +36879,7 @@ index 865d452..e9b7fa7 100644
8668 (h->interrupts_enabled == 0);
8669 }
8670
8671 -@@ -3917,7 +3917,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
8672 +@@ -3913,7 +3913,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
8673 if (prod_index < 0)
8674 return -ENODEV;
8675 h->product_name = products[prod_index].product_name;
8676 @@ -36951,7 +36888,7 @@ index 865d452..e9b7fa7 100644
8677
8678 if (hpsa_board_disabled(h->pdev)) {
8679 dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
8680 -@@ -4162,7 +4162,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
8681 +@@ -4158,7 +4158,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
8682
8683 assert_spin_locked(&lockup_detector_lock);
8684 remove_ctlr_from_lockup_detector_list(h);
8685 @@ -36960,7 +36897,7 @@ index 865d452..e9b7fa7 100644
8686 spin_lock_irqsave(&h->lock, flags);
8687 h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
8688 spin_unlock_irqrestore(&h->lock, flags);
8689 -@@ -4340,7 +4340,7 @@ reinit_after_soft_reset:
8690 +@@ -4336,7 +4336,7 @@ reinit_after_soft_reset:
8691 }
8692
8693 /* make sure the board interrupts are off */
8694 @@ -36969,7 +36906,7 @@ index 865d452..e9b7fa7 100644
8695
8696 if (hpsa_request_irq(h, do_hpsa_intr_msi, do_hpsa_intr_intx))
8697 goto clean2;
8698 -@@ -4374,7 +4374,7 @@ reinit_after_soft_reset:
8699 +@@ -4370,7 +4370,7 @@ reinit_after_soft_reset:
8700 * fake ones to scoop up any residual completions.
8701 */
8702 spin_lock_irqsave(&h->lock, flags);
8703 @@ -36978,7 +36915,7 @@ index 865d452..e9b7fa7 100644
8704 spin_unlock_irqrestore(&h->lock, flags);
8705 free_irq(h->intr[h->intr_mode], h);
8706 rc = hpsa_request_irq(h, hpsa_msix_discard_completions,
8707 -@@ -4393,9 +4393,9 @@ reinit_after_soft_reset:
8708 +@@ -4389,9 +4389,9 @@ reinit_after_soft_reset:
8709 dev_info(&h->pdev->dev, "Board READY.\n");
8710 dev_info(&h->pdev->dev,
8711 "Waiting for stale completions to drain.\n");
8712 @@ -36990,7 +36927,7 @@ index 865d452..e9b7fa7 100644
8713
8714 rc = controller_reset_failed(h->cfgtable);
8715 if (rc)
8716 -@@ -4416,7 +4416,7 @@ reinit_after_soft_reset:
8717 +@@ -4412,7 +4412,7 @@ reinit_after_soft_reset:
8718 }
8719
8720 /* Turn the interrupts on so we can service requests */
8721 @@ -36999,7 +36936,7 @@ index 865d452..e9b7fa7 100644
8722
8723 hpsa_hba_inquiry(h);
8724 hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */
8725 -@@ -4468,7 +4468,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
8726 +@@ -4464,7 +4464,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
8727 * To write all data in the battery backed cache to disks
8728 */
8729 hpsa_flush_cache(h);
8730 @@ -37008,7 +36945,7 @@ index 865d452..e9b7fa7 100644
8731 free_irq(h->intr[h->intr_mode], h);
8732 #ifdef CONFIG_PCI_MSI
8733 if (h->msix_vector)
8734 -@@ -4632,7 +4632,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
8735 +@@ -4628,7 +4628,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
8736 return;
8737 }
8738 /* Change the access methods to the performant access methods */
8739 @@ -42317,7 +42254,7 @@ index 79e2ca7..5828ad1 100644
8740 A.out (Assembler.OUTput) is a set of formats for libraries and
8741 executables used in the earliest versions of UNIX. Linux used
8742 diff --git a/fs/aio.c b/fs/aio.c
8743 -index b9d64d8..86cb1d5 100644
8744 +index 3b65ee7..aa6ec34 100644
8745 --- a/fs/aio.c
8746 +++ b/fs/aio.c
8747 @@ -119,7 +119,7 @@ static int aio_setup_ring(struct kioctx *ctx)
8748 @@ -42329,7 +42266,7 @@ index b9d64d8..86cb1d5 100644
8749 return -EINVAL;
8750
8751 nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
8752 -@@ -1461,22 +1461,27 @@ static ssize_t aio_fsync(struct kiocb *iocb)
8753 +@@ -1461,18 +1461,19 @@ static ssize_t aio_fsync(struct kiocb *iocb)
8754 static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
8755 {
8756 ssize_t ret;
8757 @@ -42351,11 +42288,15 @@ index b9d64d8..86cb1d5 100644
8758 &kiocb->ki_iovec, 1);
8759 if (ret < 0)
8760 goto out;
8761 +@@ -1481,6 +1482,11 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
8762 + if (ret < 0)
8763 + goto out;
8764
8765 + if (kiocb->ki_iovec == &iovstack) {
8766 + kiocb->ki_inline_vec = iovstack;
8767 + kiocb->ki_iovec = &kiocb->ki_inline_vec;
8768 + }
8769 ++
8770 kiocb->ki_nr_segs = kiocb->ki_nbytes;
8771 kiocb->ki_cur_seg = 0;
8772 /* ki_nbytes/left now reflect bytes instead of segs */
8773 @@ -43426,10 +43367,10 @@ index 1bffbe0..c8c283e 100644
8774 goto err;
8775 }
8776 diff --git a/fs/bio.c b/fs/bio.c
8777 -index b1fe82c..08e2e2e 100644
8778 +index 4fc4dbb..d3a5b93 100644
8779 --- a/fs/bio.c
8780 +++ b/fs/bio.c
8781 -@@ -837,7 +837,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
8782 +@@ -838,7 +838,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
8783 /*
8784 * Overflow, abort
8785 */
8786 @@ -43438,7 +43379,7 @@ index b1fe82c..08e2e2e 100644
8787 return ERR_PTR(-EINVAL);
8788
8789 nr_pages += end - start;
8790 -@@ -1233,7 +1233,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
8791 +@@ -1234,7 +1234,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
8792 const int read = bio_data_dir(bio) == READ;
8793 struct bio_map_data *bmd = bio->bi_private;
8794 int i;
8795 @@ -43448,7 +43389,7 @@ index b1fe82c..08e2e2e 100644
8796 __bio_for_each_segment(bvec, bio, i, 0) {
8797 char *addr = page_address(bvec->bv_page);
8798 diff --git a/fs/block_dev.c b/fs/block_dev.c
8799 -index abe9b48..5df59e8 100644
8800 +index 9b98987..fd211e3 100644
8801 --- a/fs/block_dev.c
8802 +++ b/fs/block_dev.c
8803 @@ -681,7 +681,7 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
8804 @@ -43865,7 +43806,7 @@ index 84e8c07..6170d31 100644
8805 }
8806 }
8807 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
8808 -index b4c2c99..50f8767 100644
8809 +index b1451af..9a30647 100644
8810 --- a/fs/cifs/cifsfs.c
8811 +++ b/fs/cifs/cifsfs.c
8812 @@ -989,7 +989,7 @@ cifs_init_request_bufs(void)
8813 @@ -47759,96 +47700,6 @@ index 50a15fa..ca113f9 100644
8814 }
8815
8816 void nfs_fattr_init(struct nfs_fattr *fattr)
8817 -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
8818 -index bab7c58..38bd5f2 100644
8819 ---- a/fs/nfs/nfs4proc.c
8820 -+++ b/fs/nfs/nfs4proc.c
8821 -@@ -3582,19 +3582,23 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
8822 - if (npages == 0)
8823 - npages = 1;
8824 -
8825 -+ /* Add an extra page to handle the bitmap returned */
8826 -+ npages++;
8827 -+
8828 - for (i = 0; i < npages; i++) {
8829 - pages[i] = alloc_page(GFP_KERNEL);
8830 - if (!pages[i])
8831 - goto out_free;
8832 - }
8833 -- if (npages > 1) {
8834 -- /* for decoding across pages */
8835 -- res.acl_scratch = alloc_page(GFP_KERNEL);
8836 -- if (!res.acl_scratch)
8837 -- goto out_free;
8838 -- }
8839 -+
8840 -+ /* for decoding across pages */
8841 -+ res.acl_scratch = alloc_page(GFP_KERNEL);
8842 -+ if (!res.acl_scratch)
8843 -+ goto out_free;
8844 -+
8845 - args.acl_len = npages * PAGE_SIZE;
8846 - args.acl_pgbase = 0;
8847 -+
8848 - /* Let decode_getfacl know not to fail if the ACL data is larger than
8849 - * the page we send as a guess */
8850 - if (buf == NULL)
8851 -diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
8852 -index 68adab4..d7e6f7b 100644
8853 ---- a/fs/nfs/nfs4xdr.c
8854 -+++ b/fs/nfs/nfs4xdr.c
8855 -@@ -4965,11 +4965,19 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
8856 - bitmap[3] = {0};
8857 - struct kvec *iov = req->rq_rcv_buf.head;
8858 - int status;
8859 -+ size_t page_len = xdr->buf->page_len;
8860 -
8861 - res->acl_len = 0;
8862 - if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
8863 - goto out;
8864 -+
8865 - bm_p = xdr->p;
8866 -+ res->acl_data_offset = be32_to_cpup(bm_p) + 2;
8867 -+ res->acl_data_offset <<= 2;
8868 -+ /* Check if the acl data starts beyond the allocated buffer */
8869 -+ if (res->acl_data_offset > page_len)
8870 -+ return -ERANGE;
8871 -+
8872 - if ((status = decode_attr_bitmap(xdr, bitmap)) != 0)
8873 - goto out;
8874 - if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0)
8875 -@@ -4979,28 +4987,24 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
8876 - return -EIO;
8877 - if (likely(bitmap[0] & FATTR4_WORD0_ACL)) {
8878 - size_t hdrlen;
8879 -- u32 recvd;
8880 -
8881 - /* The bitmap (xdr len + bitmaps) and the attr xdr len words
8882 - * are stored with the acl data to handle the problem of
8883 - * variable length bitmaps.*/
8884 - xdr->p = bm_p;
8885 -- res->acl_data_offset = be32_to_cpup(bm_p) + 2;
8886 -- res->acl_data_offset <<= 2;
8887 -
8888 - /* We ignore &savep and don't do consistency checks on
8889 - * the attr length. Let userspace figure it out.... */
8890 - hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base;
8891 - attrlen += res->acl_data_offset;
8892 -- recvd = req->rq_rcv_buf.len - hdrlen;
8893 -- if (attrlen > recvd) {
8894 -+ if (attrlen > page_len) {
8895 - if (res->acl_flags & NFS4_ACL_LEN_REQUEST) {
8896 - /* getxattr interface called with a NULL buf */
8897 - res->acl_len = attrlen;
8898 - goto out;
8899 - }
8900 -- dprintk("NFS: acl reply: attrlen %u > recvd %u\n",
8901 -- attrlen, recvd);
8902 -+ dprintk("NFS: acl reply: attrlen %zu > page_len %u\n",
8903 -+ attrlen, page_len);
8904 - return -EINVAL;
8905 - }
8906 - xdr_read_pages(xdr, attrlen);
8907 diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
8908 index 5c3cd82..ed535e5 100644
8909 --- a/fs/nfsd/vfs.c
8910 @@ -61356,7 +61207,7 @@ index 84ccf8e..2e9b14c 100644
8911 };
8912
8913 diff --git a/include/linux/fs.h b/include/linux/fs.h
8914 -index 11f1951..e3c18da 100644
8915 +index 43d36b7..e5575ee 100644
8916 --- a/include/linux/fs.h
8917 +++ b/include/linux/fs.h
8918 @@ -1614,7 +1614,8 @@ struct file_operations {
8919 @@ -61452,7 +61303,7 @@ index c3da42d..c70e0df 100644
8920 int trace_set_clr_event(const char *system, const char *event, int set);
8921
8922 diff --git a/include/linux/genhd.h b/include/linux/genhd.h
8923 -index c6f7f6a..aa0f7d3 100644
8924 +index 4eec461..84c73cf 100644
8925 --- a/include/linux/genhd.h
8926 +++ b/include/linux/genhd.h
8927 @@ -185,7 +185,7 @@ struct gendisk {
8928 @@ -62775,7 +62626,7 @@ index b16f653..eb908f4 100644
8929 #define request_module_nowait(mod...) __request_module(false, mod)
8930 #define try_then_request_module(x, mod...) \
8931 diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
8932 -index 35410ef..9f98b23 100644
8933 +index 6136821..b3ba6ba 100644
8934 --- a/include/linux/kvm_host.h
8935 +++ b/include/linux/kvm_host.h
8936 @@ -308,7 +308,7 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
8937 @@ -65410,7 +65261,7 @@ index 43298f9..2f56c12 100644
8938 Randomizing heap placement makes heap exploits harder, but it
8939 also breaks ancient binaries (including anything libc5 based).
8940 diff --git a/init/do_mounts.c b/init/do_mounts.c
8941 -index db6e5ee..7677ff7 100644
8942 +index d6c229f..4746631 100644
8943 --- a/init/do_mounts.c
8944 +++ b/init/do_mounts.c
8945 @@ -325,11 +325,11 @@ static void __init get_fs_names(char *page)
8946 @@ -65712,7 +65563,7 @@ index 2531811..040d4d4 100644
8947 next_state = Reset;
8948 return 0;
8949 diff --git a/init/main.c b/init/main.c
8950 -index 217ed23..ec5406f 100644
8951 +index cb08fea2..f5b850d 100644
8952 --- a/init/main.c
8953 +++ b/init/main.c
8954 @@ -96,6 +96,8 @@ static inline void mark_rodata_ro(void) { }
8955 @@ -65774,7 +65625,7 @@ index 217ed23..ec5406f 100644
8956 static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
8957 const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
8958 static const char *panic_later, *panic_param;
8959 -@@ -681,6 +726,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
8960 +@@ -678,6 +723,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
8961 {
8962 int count = preempt_count();
8963 int ret;
8964 @@ -65782,7 +65633,7 @@ index 217ed23..ec5406f 100644
8965
8966 if (initcall_debug)
8967 ret = do_one_initcall_debug(fn);
8968 -@@ -693,15 +739,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
8969 +@@ -690,15 +736,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
8970 sprintf(msgbuf, "error code %d ", ret);
8971
8972 if (preempt_count() != count) {
8973 @@ -65802,7 +65653,7 @@ index 217ed23..ec5406f 100644
8974 }
8975
8976 return ret;
8977 -@@ -820,7 +866,7 @@ static int __init kernel_init(void * unused)
8978 +@@ -821,7 +867,7 @@ static int __init kernel_init(void * unused)
8979 do_basic_setup();
8980
8981 /* Open the /dev/console on the rootfs, this should never fail */
8982 @@ -65811,7 +65662,7 @@ index 217ed23..ec5406f 100644
8983 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
8984
8985 (void) sys_dup(0);
8986 -@@ -833,11 +879,13 @@ static int __init kernel_init(void * unused)
8987 +@@ -834,11 +880,13 @@ static int __init kernel_init(void * unused)
8988 if (!ramdisk_execute_command)
8989 ramdisk_execute_command = "/init";
8990
8991 @@ -66160,7 +66011,7 @@ index b463871..fa3ea1f 100644
8992 * nsown_capable - Check superior capability to one's own user_ns
8993 * @cap: The capability in question
8994 diff --git a/kernel/compat.c b/kernel/compat.c
8995 -index f346ced..aa2b1f4 100644
8996 +index a6d0649..f44fb27 100644
8997 --- a/kernel/compat.c
8998 +++ b/kernel/compat.c
8999 @@ -13,6 +13,7 @@
9000 @@ -66198,18 +66049,7 @@ index f346ced..aa2b1f4 100644
9001 set_fs(old_fs);
9002 if (ret == 0)
9003 ret = put_user(s, set);
9004 -@@ -332,8 +333,8 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
9005 - old_fs = get_fs();
9006 - set_fs(KERNEL_DS);
9007 - ret = sys_sigprocmask(how,
9008 -- set ? (old_sigset_t __user *) &s : NULL,
9009 -- oset ? (old_sigset_t __user *) &s : NULL);
9010 -+ set ? (old_sigset_t __force_user *) &s : NULL,
9011 -+ oset ? (old_sigset_t __force_user *) &s : NULL);
9012 - set_fs(old_fs);
9013 - if (ret == 0)
9014 - if (oset)
9015 -@@ -370,7 +371,7 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
9016 +@@ -399,7 +400,7 @@ asmlinkage long compat_sys_old_getrlimit(unsigned int resource,
9017 mm_segment_t old_fs = get_fs();
9018
9019 set_fs(KERNEL_DS);
9020 @@ -66218,7 +66058,7 @@ index f346ced..aa2b1f4 100644
9021 set_fs(old_fs);
9022
9023 if (!ret) {
9024 -@@ -442,7 +443,7 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
9025 +@@ -471,7 +472,7 @@ asmlinkage long compat_sys_getrusage(int who, struct compat_rusage __user *ru)
9026 mm_segment_t old_fs = get_fs();
9027
9028 set_fs(KERNEL_DS);
9029 @@ -66227,7 +66067,7 @@ index f346ced..aa2b1f4 100644
9030 set_fs(old_fs);
9031
9032 if (ret)
9033 -@@ -469,8 +470,8 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
9034 +@@ -498,8 +499,8 @@ compat_sys_wait4(compat_pid_t pid, compat_uint_t __user *stat_addr, int options,
9035 set_fs (KERNEL_DS);
9036 ret = sys_wait4(pid,
9037 (stat_addr ?
9038 @@ -66238,7 +66078,7 @@ index f346ced..aa2b1f4 100644
9039 set_fs (old_fs);
9040
9041 if (ret > 0) {
9042 -@@ -495,8 +496,8 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid,
9043 +@@ -524,8 +525,8 @@ asmlinkage long compat_sys_waitid(int which, compat_pid_t pid,
9044 memset(&info, 0, sizeof(info));
9045
9046 set_fs(KERNEL_DS);
9047 @@ -66249,7 +66089,7 @@ index f346ced..aa2b1f4 100644
9048 set_fs(old_fs);
9049
9050 if ((ret < 0) || (info.si_signo == 0))
9051 -@@ -626,8 +627,8 @@ long compat_sys_timer_settime(timer_t timer_id, int flags,
9052 +@@ -655,8 +656,8 @@ long compat_sys_timer_settime(timer_t timer_id, int flags,
9053 oldfs = get_fs();
9054 set_fs(KERNEL_DS);
9055 err = sys_timer_settime(timer_id, flags,
9056 @@ -66260,7 +66100,7 @@ index f346ced..aa2b1f4 100644
9057 set_fs(oldfs);
9058 if (!err && old && put_compat_itimerspec(old, &oldts))
9059 return -EFAULT;
9060 -@@ -644,7 +645,7 @@ long compat_sys_timer_gettime(timer_t timer_id,
9061 +@@ -673,7 +674,7 @@ long compat_sys_timer_gettime(timer_t timer_id,
9062 oldfs = get_fs();
9063 set_fs(KERNEL_DS);
9064 err = sys_timer_gettime(timer_id,
9065 @@ -66269,7 +66109,7 @@ index f346ced..aa2b1f4 100644
9066 set_fs(oldfs);
9067 if (!err && put_compat_itimerspec(setting, &ts))
9068 return -EFAULT;
9069 -@@ -663,7 +664,7 @@ long compat_sys_clock_settime(clockid_t which_clock,
9070 +@@ -692,7 +693,7 @@ long compat_sys_clock_settime(clockid_t which_clock,
9071 oldfs = get_fs();
9072 set_fs(KERNEL_DS);
9073 err = sys_clock_settime(which_clock,
9074 @@ -66278,7 +66118,7 @@ index f346ced..aa2b1f4 100644
9075 set_fs(oldfs);
9076 return err;
9077 }
9078 -@@ -678,7 +679,7 @@ long compat_sys_clock_gettime(clockid_t which_clock,
9079 +@@ -707,7 +708,7 @@ long compat_sys_clock_gettime(clockid_t which_clock,
9080 oldfs = get_fs();
9081 set_fs(KERNEL_DS);
9082 err = sys_clock_gettime(which_clock,
9083 @@ -66287,7 +66127,7 @@ index f346ced..aa2b1f4 100644
9084 set_fs(oldfs);
9085 if (!err && put_compat_timespec(&ts, tp))
9086 return -EFAULT;
9087 -@@ -698,7 +699,7 @@ long compat_sys_clock_adjtime(clockid_t which_clock,
9088 +@@ -727,7 +728,7 @@ long compat_sys_clock_adjtime(clockid_t which_clock,
9089
9090 oldfs = get_fs();
9091 set_fs(KERNEL_DS);
9092 @@ -66296,7 +66136,7 @@ index f346ced..aa2b1f4 100644
9093 set_fs(oldfs);
9094
9095 err = compat_put_timex(utp, &txc);
9096 -@@ -718,7 +719,7 @@ long compat_sys_clock_getres(clockid_t which_clock,
9097 +@@ -747,7 +748,7 @@ long compat_sys_clock_getres(clockid_t which_clock,
9098 oldfs = get_fs();
9099 set_fs(KERNEL_DS);
9100 err = sys_clock_getres(which_clock,
9101 @@ -66305,7 +66145,7 @@ index f346ced..aa2b1f4 100644
9102 set_fs(oldfs);
9103 if (!err && tp && put_compat_timespec(&ts, tp))
9104 return -EFAULT;
9105 -@@ -730,9 +731,9 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart)
9106 +@@ -759,9 +760,9 @@ static long compat_clock_nanosleep_restart(struct restart_block *restart)
9107 long err;
9108 mm_segment_t oldfs;
9109 struct timespec tu;
9110 @@ -66317,7 +66157,7 @@ index f346ced..aa2b1f4 100644
9111 oldfs = get_fs();
9112 set_fs(KERNEL_DS);
9113 err = clock_nanosleep_restart(restart);
9114 -@@ -764,8 +765,8 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
9115 +@@ -793,8 +794,8 @@ long compat_sys_clock_nanosleep(clockid_t which_clock, int flags,
9116 oldfs = get_fs();
9117 set_fs(KERNEL_DS);
9118 err = sys_clock_nanosleep(which_clock, flags,
9119 @@ -75100,7 +74940,7 @@ index 55b266d..a532537 100644
9120 }
9121
9122 diff --git a/mm/swapfile.c b/mm/swapfile.c
9123 -index 2015a1e..8a602e9 100644
9124 +index d3955f2..75db55c 100644
9125 --- a/mm/swapfile.c
9126 +++ b/mm/swapfile.c
9127 @@ -61,7 +61,7 @@ static DEFINE_MUTEX(swapon_mutex);
9128 @@ -76711,14 +76551,14 @@ index 94cdbc5..0cb0063 100644
9129 ts = peer->tcp_ts;
9130 tsage = get_seconds() - peer->tcp_ts_stamp;
9131 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
9132 -index 9726927..32e6ca2 100644
9133 +index 9726927..436489e 100644
9134 --- a/net/ipv4/tcp_input.c
9135 +++ b/net/ipv4/tcp_input.c
9136 @@ -5836,6 +5836,8 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
9137 goto discard;
9138
9139 if (th->syn) {
9140 -+ if (th->fin)
9141 ++ if (th->fin || th->urg || th->psh)
9142 + goto discard;
9143 if (icsk->icsk_af_ops->conn_request(sk, skb) < 0)
9144 return 1;
9145 @@ -97832,7 +97672,7 @@ index af0f22f..9a7d479 100644
9146 break;
9147 }
9148 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
9149 -index e401c1b..8d4d5fa 100644
9150 +index ec747dc..da361c4 100644
9151 --- a/virt/kvm/kvm_main.c
9152 +++ b/virt/kvm/kvm_main.c
9153 @@ -75,7 +75,7 @@ LIST_HEAD(vm_list);
9154 @@ -97844,7 +97684,7 @@ index e401c1b..8d4d5fa 100644
9155
9156 struct kmem_cache *kvm_vcpu_cache;
9157 EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
9158 -@@ -2269,7 +2269,7 @@ static void hardware_enable_nolock(void *junk)
9159 +@@ -2274,7 +2274,7 @@ static void hardware_enable_nolock(void *junk)
9160
9161 if (r) {
9162 cpumask_clear_cpu(cpu, cpus_hardware_enabled);
9163 @@ -97853,7 +97693,7 @@ index e401c1b..8d4d5fa 100644
9164 printk(KERN_INFO "kvm: enabling virtualization on "
9165 "CPU%d failed\n", cpu);
9166 }
9167 -@@ -2323,10 +2323,10 @@ static int hardware_enable_all(void)
9168 +@@ -2328,10 +2328,10 @@ static int hardware_enable_all(void)
9169
9170 kvm_usage_count++;
9171 if (kvm_usage_count == 1) {
9172 @@ -97866,7 +97706,7 @@ index e401c1b..8d4d5fa 100644
9173 hardware_disable_all_nolock();
9174 r = -EBUSY;
9175 }
9176 -@@ -2677,7 +2677,7 @@ static void kvm_sched_out(struct preempt_notifier *pn,
9177 +@@ -2682,7 +2682,7 @@ static void kvm_sched_out(struct preempt_notifier *pn,
9178 kvm_arch_vcpu_put(vcpu);
9179 }
9180
9181 @@ -97875,7 +97715,7 @@ index e401c1b..8d4d5fa 100644
9182 struct module *module)
9183 {
9184 int r;
9185 -@@ -2740,7 +2740,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
9186 +@@ -2745,7 +2745,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
9187 if (!vcpu_align)
9188 vcpu_align = __alignof__(struct kvm_vcpu);
9189 kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size, vcpu_align,
9190 @@ -97884,7 +97724,7 @@ index e401c1b..8d4d5fa 100644
9191 if (!kvm_vcpu_cache) {
9192 r = -ENOMEM;
9193 goto out_free_3;
9194 -@@ -2750,9 +2750,11 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
9195 +@@ -2755,9 +2755,11 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
9196 if (r)
9197 goto out_free;
9198
9199
9200 diff --git a/3.2.18/4430_grsec-remove-localversion-grsec.patch b/3.2.19/4430_grsec-remove-localversion-grsec.patch
9201 similarity index 100%
9202 rename from 3.2.18/4430_grsec-remove-localversion-grsec.patch
9203 rename to 3.2.19/4430_grsec-remove-localversion-grsec.patch
9204
9205 diff --git a/3.2.18/4435_grsec-mute-warnings.patch b/3.2.19/4435_grsec-mute-warnings.patch
9206 similarity index 100%
9207 rename from 3.2.18/4435_grsec-mute-warnings.patch
9208 rename to 3.2.19/4435_grsec-mute-warnings.patch
9209
9210 diff --git a/3.2.18/4440_grsec-remove-protected-paths.patch b/3.2.19/4440_grsec-remove-protected-paths.patch
9211 similarity index 100%
9212 rename from 3.2.18/4440_grsec-remove-protected-paths.patch
9213 rename to 3.2.19/4440_grsec-remove-protected-paths.patch
9214
9215 diff --git a/3.2.18/4445_grsec-pax-without-grsec.patch b/3.2.19/4445_grsec-pax-without-grsec.patch
9216 similarity index 100%
9217 rename from 3.2.18/4445_grsec-pax-without-grsec.patch
9218 rename to 3.2.19/4445_grsec-pax-without-grsec.patch
9219
9220 diff --git a/3.2.18/4450_grsec-kconfig-default-gids.patch b/3.2.19/4450_grsec-kconfig-default-gids.patch
9221 similarity index 100%
9222 rename from 3.2.18/4450_grsec-kconfig-default-gids.patch
9223 rename to 3.2.19/4450_grsec-kconfig-default-gids.patch
9224
9225 diff --git a/3.2.18/4455_grsec-kconfig-gentoo.patch b/3.2.19/4455_grsec-kconfig-gentoo.patch
9226 similarity index 100%
9227 rename from 3.2.18/4455_grsec-kconfig-gentoo.patch
9228 rename to 3.2.19/4455_grsec-kconfig-gentoo.patch
9229
9230 diff --git a/3.2.18/4460-grsec-kconfig-proc-user.patch b/3.2.19/4460-grsec-kconfig-proc-user.patch
9231 similarity index 100%
9232 rename from 3.2.18/4460-grsec-kconfig-proc-user.patch
9233 rename to 3.2.19/4460-grsec-kconfig-proc-user.patch
9234
9235 diff --git a/3.2.18/4465_selinux-avc_audit-log-curr_ip.patch b/3.2.19/4465_selinux-avc_audit-log-curr_ip.patch
9236 similarity index 100%
9237 rename from 3.2.18/4465_selinux-avc_audit-log-curr_ip.patch
9238 rename to 3.2.19/4465_selinux-avc_audit-log-curr_ip.patch
9239
9240 diff --git a/3.2.18/4470_disable-compat_vdso.patch b/3.2.19/4470_disable-compat_vdso.patch
9241 similarity index 100%
9242 rename from 3.2.18/4470_disable-compat_vdso.patch
9243 rename to 3.2.19/4470_disable-compat_vdso.patch
9244
9245 diff --git a/3.3.7/0000_README b/3.3.8/0000_README
9246 similarity index 97%
9247 rename from 3.3.7/0000_README
9248 rename to 3.3.8/0000_README
9249 index 4499d08..c4356e4 100644
9250 --- a/3.3.7/0000_README
9251 +++ b/3.3.8/0000_README
9252 @@ -2,7 +2,7 @@ README
9253 -----------------------------------------------------------------------------
9254 Individual Patch Descriptions:
9255 -----------------------------------------------------------------------------
9256 -Patch: 4420_grsecurity-2.9-3.3.7-201206011935.patch
9257 +Patch: 4420_grsecurity-2.9-3.3.8-201206042136.patch
9258 From: http://www.grsecurity.net
9259 Desc: hardened-sources base patch from upstream grsecurity
9260
9261
9262 diff --git a/3.3.7/4420_grsecurity-2.9-3.3.7-201206011935.patch b/3.3.8/4420_grsecurity-2.9-3.3.8-201206042136.patch
9263 similarity index 99%
9264 rename from 3.3.7/4420_grsecurity-2.9-3.3.7-201206011935.patch
9265 rename to 3.3.8/4420_grsecurity-2.9-3.3.8-201206042136.patch
9266 index 8787b62..e7f177d 100644
9267 --- a/3.3.7/4420_grsecurity-2.9-3.3.7-201206011935.patch
9268 +++ b/3.3.8/4420_grsecurity-2.9-3.3.8-201206042136.patch
9269 @@ -195,7 +195,7 @@ index d99fd9c..8689fef 100644
9270
9271 pcd. [PARIDE]
9272 diff --git a/Makefile b/Makefile
9273 -index 073f74f..02aebe9 100644
9274 +index db96149..f101728 100644
9275 --- a/Makefile
9276 +++ b/Makefile
9277 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
9278 @@ -312,7 +312,7 @@ index 073f74f..02aebe9 100644
9279 prepare: prepare0
9280
9281 # Generate some files
9282 -@@ -1089,6 +1142,8 @@ all: modules
9283 +@@ -1092,6 +1145,8 @@ all: modules
9284 # using awk while concatenating to the final file.
9285
9286 PHONY += modules
9287 @@ -321,7 +321,7 @@ index 073f74f..02aebe9 100644
9288 modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
9289 $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
9290 @$(kecho) ' Building modules, stage 2.';
9291 -@@ -1104,7 +1159,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
9292 +@@ -1107,7 +1162,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
9293
9294 # Target to prepare building external modules
9295 PHONY += modules_prepare
9296 @@ -330,7 +330,7 @@ index 073f74f..02aebe9 100644
9297
9298 # Target to install modules
9299 PHONY += modules_install
9300 -@@ -1201,6 +1256,7 @@ distclean: mrproper
9301 +@@ -1204,6 +1259,7 @@ distclean: mrproper
9302 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
9303 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
9304 -o -name '.*.rej' \
9305 @@ -338,7 +338,7 @@ index 073f74f..02aebe9 100644
9306 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
9307 -type f -print | xargs rm -f
9308
9309 -@@ -1361,6 +1417,8 @@ PHONY += $(module-dirs) modules
9310 +@@ -1364,6 +1420,8 @@ PHONY += $(module-dirs) modules
9311 $(module-dirs): crmodverdir $(objtree)/Module.symvers
9312 $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
9313
9314 @@ -347,7 +347,7 @@ index 073f74f..02aebe9 100644
9315 modules: $(module-dirs)
9316 @$(kecho) ' Building modules, stage 2.';
9317 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
9318 -@@ -1487,17 +1545,21 @@ else
9319 +@@ -1490,17 +1548,21 @@ else
9320 target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
9321 endif
9322
9323 @@ -373,7 +373,7 @@ index 073f74f..02aebe9 100644
9324 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
9325 %.symtypes: %.c prepare scripts FORCE
9326 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
9327 -@@ -1507,11 +1569,15 @@ endif
9328 +@@ -1510,11 +1572,15 @@ endif
9329 $(cmd_crmodverdir)
9330 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
9331 $(build)=$(build-dir)
9332 @@ -1325,7 +1325,7 @@ index 75fe66b..2255c86 100644
9333 /*
9334 * Memory returned by kmalloc() may be used for DMA, so we must make
9335 diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
9336 -index d5d8d5c..ad92c96 100644
9337 +index 1252a26..9dc17b5 100644
9338 --- a/arch/arm/include/asm/cacheflush.h
9339 +++ b/arch/arm/include/asm/cacheflush.h
9340 @@ -108,7 +108,7 @@ struct cpu_cache_fns {
9341 @@ -1644,7 +1644,7 @@ index a255c39..4a19b25 100644
9342 #endif
9343
9344 diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
9345 -index f84dfe6..13e94f7 100644
9346 +index 504b28a..62f7a7d 100644
9347 --- a/arch/arm/kernel/traps.c
9348 +++ b/arch/arm/kernel/traps.c
9349 @@ -259,6 +259,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
9350 @@ -7706,7 +7706,7 @@ index e46c214..7c72b55 100644
9351 This option helps catch unintended modifications to loadable
9352 kernel module's text and read-only data. It also prevents execution
9353 diff --git a/arch/x86/Makefile b/arch/x86/Makefile
9354 -index 209ba12..15140db 100644
9355 +index 015f0c5..b405802 100644
9356 --- a/arch/x86/Makefile
9357 +++ b/arch/x86/Makefile
9358 @@ -46,6 +46,7 @@ else
9359 @@ -7717,7 +7717,7 @@ index 209ba12..15140db 100644
9360 KBUILD_AFLAGS += -m64
9361 KBUILD_CFLAGS += -m64
9362
9363 -@@ -201,3 +202,12 @@ define archhelp
9364 +@@ -205,3 +206,12 @@ define archhelp
9365 echo ' FDARGS="..." arguments for the booted kernel'
9366 echo ' FDINITRD=file initrd for the booted kernel'
9367 endef
9368 @@ -7789,7 +7789,7 @@ index c7093bd..d4247ffe0 100644
9369 return diff;
9370 }
9371 diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
9372 -index fd55a2f..217b501 100644
9373 +index e398bb5..3a382ca 100644
9374 --- a/arch/x86/boot/compressed/Makefile
9375 +++ b/arch/x86/boot/compressed/Makefile
9376 @@ -14,6 +14,9 @@ cflags-$(CONFIG_X86_64) := -mcmodel=small
9377 @@ -7898,201 +7898,6 @@ index 7116dcb..d9ae1d7 100644
9378 error("Wrong destination address");
9379 #endif
9380
9381 -diff --git a/arch/x86/boot/compressed/relocs.c b/arch/x86/boot/compressed/relocs.c
9382 -index e77f4e4..17e511f 100644
9383 ---- a/arch/x86/boot/compressed/relocs.c
9384 -+++ b/arch/x86/boot/compressed/relocs.c
9385 -@@ -13,8 +13,11 @@
9386 -
9387 - static void die(char *fmt, ...);
9388 -
9389 -+#include "../../../../include/generated/autoconf.h"
9390 -+
9391 - #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
9392 - static Elf32_Ehdr ehdr;
9393 -+static Elf32_Phdr *phdr;
9394 - static unsigned long reloc_count, reloc_idx;
9395 - static unsigned long *relocs;
9396 -
9397 -@@ -270,9 +273,39 @@ static void read_ehdr(FILE *fp)
9398 - }
9399 - }
9400 -
9401 -+static void read_phdrs(FILE *fp)
9402 -+{
9403 -+ unsigned int i;
9404 -+
9405 -+ phdr = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
9406 -+ if (!phdr) {
9407 -+ die("Unable to allocate %d program headers\n",
9408 -+ ehdr.e_phnum);
9409 -+ }
9410 -+ if (fseek(fp, ehdr.e_phoff, SEEK_SET) < 0) {
9411 -+ die("Seek to %d failed: %s\n",
9412 -+ ehdr.e_phoff, strerror(errno));
9413 -+ }
9414 -+ if (fread(phdr, sizeof(*phdr), ehdr.e_phnum, fp) != ehdr.e_phnum) {
9415 -+ die("Cannot read ELF program headers: %s\n",
9416 -+ strerror(errno));
9417 -+ }
9418 -+ for(i = 0; i < ehdr.e_phnum; i++) {
9419 -+ phdr[i].p_type = elf32_to_cpu(phdr[i].p_type);
9420 -+ phdr[i].p_offset = elf32_to_cpu(phdr[i].p_offset);
9421 -+ phdr[i].p_vaddr = elf32_to_cpu(phdr[i].p_vaddr);
9422 -+ phdr[i].p_paddr = elf32_to_cpu(phdr[i].p_paddr);
9423 -+ phdr[i].p_filesz = elf32_to_cpu(phdr[i].p_filesz);
9424 -+ phdr[i].p_memsz = elf32_to_cpu(phdr[i].p_memsz);
9425 -+ phdr[i].p_flags = elf32_to_cpu(phdr[i].p_flags);
9426 -+ phdr[i].p_align = elf32_to_cpu(phdr[i].p_align);
9427 -+ }
9428 -+
9429 -+}
9430 -+
9431 - static void read_shdrs(FILE *fp)
9432 - {
9433 -- int i;
9434 -+ unsigned int i;
9435 - Elf32_Shdr shdr;
9436 -
9437 - secs = calloc(ehdr.e_shnum, sizeof(struct section));
9438 -@@ -307,7 +340,7 @@ static void read_shdrs(FILE *fp)
9439 -
9440 - static void read_strtabs(FILE *fp)
9441 - {
9442 -- int i;
9443 -+ unsigned int i;
9444 - for (i = 0; i < ehdr.e_shnum; i++) {
9445 - struct section *sec = &secs[i];
9446 - if (sec->shdr.sh_type != SHT_STRTAB) {
9447 -@@ -332,7 +365,7 @@ static void read_strtabs(FILE *fp)
9448 -
9449 - static void read_symtabs(FILE *fp)
9450 - {
9451 -- int i,j;
9452 -+ unsigned int i,j;
9453 - for (i = 0; i < ehdr.e_shnum; i++) {
9454 - struct section *sec = &secs[i];
9455 - if (sec->shdr.sh_type != SHT_SYMTAB) {
9456 -@@ -365,7 +398,9 @@ static void read_symtabs(FILE *fp)
9457 -
9458 - static void read_relocs(FILE *fp)
9459 - {
9460 -- int i,j;
9461 -+ unsigned int i,j;
9462 -+ uint32_t base;
9463 -+
9464 - for (i = 0; i < ehdr.e_shnum; i++) {
9465 - struct section *sec = &secs[i];
9466 - if (sec->shdr.sh_type != SHT_REL) {
9467 -@@ -385,9 +420,18 @@ static void read_relocs(FILE *fp)
9468 - die("Cannot read symbol table: %s\n",
9469 - strerror(errno));
9470 - }
9471 -+ base = 0;
9472 -+ for (j = 0; j < ehdr.e_phnum; j++) {
9473 -+ if (phdr[j].p_type != PT_LOAD )
9474 -+ continue;
9475 -+ if (secs[sec->shdr.sh_info].shdr.sh_offset < phdr[j].p_offset || secs[sec->shdr.sh_info].shdr.sh_offset >= phdr[j].p_offset + phdr[j].p_filesz)
9476 -+ continue;
9477 -+ base = CONFIG_PAGE_OFFSET + phdr[j].p_paddr - phdr[j].p_vaddr;
9478 -+ break;
9479 -+ }
9480 - for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
9481 - Elf32_Rel *rel = &sec->reltab[j];
9482 -- rel->r_offset = elf32_to_cpu(rel->r_offset);
9483 -+ rel->r_offset = elf32_to_cpu(rel->r_offset) + base;
9484 - rel->r_info = elf32_to_cpu(rel->r_info);
9485 - }
9486 - }
9487 -@@ -396,13 +440,13 @@ static void read_relocs(FILE *fp)
9488 -
9489 - static void print_absolute_symbols(void)
9490 - {
9491 -- int i;
9492 -+ unsigned int i;
9493 - printf("Absolute symbols\n");
9494 - printf(" Num: Value Size Type Bind Visibility Name\n");
9495 - for (i = 0; i < ehdr.e_shnum; i++) {
9496 - struct section *sec = &secs[i];
9497 - char *sym_strtab;
9498 -- int j;
9499 -+ unsigned int j;
9500 -
9501 - if (sec->shdr.sh_type != SHT_SYMTAB) {
9502 - continue;
9503 -@@ -429,14 +473,14 @@ static void print_absolute_symbols(void)
9504 -
9505 - static void print_absolute_relocs(void)
9506 - {
9507 -- int i, printed = 0;
9508 -+ unsigned int i, printed = 0;
9509 -
9510 - for (i = 0; i < ehdr.e_shnum; i++) {
9511 - struct section *sec = &secs[i];
9512 - struct section *sec_applies, *sec_symtab;
9513 - char *sym_strtab;
9514 - Elf32_Sym *sh_symtab;
9515 -- int j;
9516 -+ unsigned int j;
9517 - if (sec->shdr.sh_type != SHT_REL) {
9518 - continue;
9519 - }
9520 -@@ -497,13 +541,13 @@ static void print_absolute_relocs(void)
9521 -
9522 - static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
9523 - {
9524 -- int i;
9525 -+ unsigned int i;
9526 - /* Walk through the relocations */
9527 - for (i = 0; i < ehdr.e_shnum; i++) {
9528 - char *sym_strtab;
9529 - Elf32_Sym *sh_symtab;
9530 - struct section *sec_applies, *sec_symtab;
9531 -- int j;
9532 -+ unsigned int j;
9533 - struct section *sec = &secs[i];
9534 -
9535 - if (sec->shdr.sh_type != SHT_REL) {
9536 -@@ -528,6 +572,22 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym))
9537 - !is_rel_reloc(sym_name(sym_strtab, sym))) {
9538 - continue;
9539 - }
9540 -+ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
9541 -+ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
9542 -+ continue;
9543 -+
9544 -+#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
9545 -+ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
9546 -+ if (!strcmp(sec_name(sym->st_shndx), ".module.text") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
9547 -+ continue;
9548 -+ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
9549 -+ continue;
9550 -+ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
9551 -+ continue;
9552 -+ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
9553 -+ continue;
9554 -+#endif
9555 -+
9556 - switch (r_type) {
9557 - case R_386_NONE:
9558 - case R_386_PC32:
9559 -@@ -569,7 +629,7 @@ static int cmp_relocs(const void *va, const void *vb)
9560 -
9561 - static void emit_relocs(int as_text)
9562 - {
9563 -- int i;
9564 -+ unsigned int i;
9565 - /* Count how many relocations I have and allocate space for them. */
9566 - reloc_count = 0;
9567 - walk_relocs(count_reloc);
9568 -@@ -663,6 +723,7 @@ int main(int argc, char **argv)
9569 - fname, strerror(errno));
9570 - }
9571 - read_ehdr(fp);
9572 -+ read_phdrs(fp);
9573 - read_shdrs(fp);
9574 - read_strtabs(fp);
9575 - read_symtabs(fp);
9576 diff --git a/arch/x86/boot/cpucheck.c b/arch/x86/boot/cpucheck.c
9577 index 4d3ff03..e4972ff 100644
9578 --- a/arch/x86/boot/cpucheck.c
9579 @@ -14346,7 +14151,7 @@ index 3e6ff6c..54b4992 100644
9580 }
9581 #endif
9582 diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
9583 -index 5a11ae2..a1a1c8a 100644
9584 +index dee004f..327a57e 100644
9585 --- a/arch/x86/kernel/cpu/mcheck/mce.c
9586 +++ b/arch/x86/kernel/cpu/mcheck/mce.c
9587 @@ -42,6 +42,7 @@
9588 @@ -14397,7 +14202,7 @@ index 5a11ae2..a1a1c8a 100644
9589 return;
9590 }
9591 /* First print corrected ones that are still unlogged */
9592 -@@ -658,7 +659,7 @@ static int mce_timed_out(u64 *t)
9593 +@@ -666,7 +667,7 @@ static int mce_timed_out(u64 *t)
9594 * might have been modified by someone else.
9595 */
9596 rmb();
9597 @@ -14406,7 +14211,7 @@ index 5a11ae2..a1a1c8a 100644
9598 wait_for_panic();
9599 if (!monarch_timeout)
9600 goto out;
9601 -@@ -1446,7 +1447,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
9602 +@@ -1454,7 +1455,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
9603 }
9604
9605 /* Call the installed machine check handler for this CPU setup. */
9606 @@ -14415,7 +14220,7 @@ index 5a11ae2..a1a1c8a 100644
9607 unexpected_machine_check;
9608
9609 /*
9610 -@@ -1469,7 +1470,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
9611 +@@ -1477,7 +1478,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
9612 return;
9613 }
9614
9615 @@ -14425,7 +14230,7 @@ index 5a11ae2..a1a1c8a 100644
9616
9617 __mcheck_cpu_init_generic();
9618 __mcheck_cpu_init_vendor(c);
9619 -@@ -1483,7 +1486,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
9620 +@@ -1491,7 +1494,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
9621 */
9622
9623 static DEFINE_SPINLOCK(mce_chrdev_state_lock);
9624 @@ -14434,7 +14239,7 @@ index 5a11ae2..a1a1c8a 100644
9625 static int mce_chrdev_open_exclu; /* already open exclusive? */
9626
9627 static int mce_chrdev_open(struct inode *inode, struct file *file)
9628 -@@ -1491,7 +1494,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
9629 +@@ -1499,7 +1502,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
9630 spin_lock(&mce_chrdev_state_lock);
9631
9632 if (mce_chrdev_open_exclu ||
9633 @@ -14443,7 +14248,7 @@ index 5a11ae2..a1a1c8a 100644
9634 spin_unlock(&mce_chrdev_state_lock);
9635
9636 return -EBUSY;
9637 -@@ -1499,7 +1502,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
9638 +@@ -1507,7 +1510,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
9639
9640 if (file->f_flags & O_EXCL)
9641 mce_chrdev_open_exclu = 1;
9642 @@ -14452,7 +14257,7 @@ index 5a11ae2..a1a1c8a 100644
9643
9644 spin_unlock(&mce_chrdev_state_lock);
9645
9646 -@@ -1510,7 +1513,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
9647 +@@ -1518,7 +1521,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
9648 {
9649 spin_lock(&mce_chrdev_state_lock);
9650
9651 @@ -14461,7 +14266,7 @@ index 5a11ae2..a1a1c8a 100644
9652 mce_chrdev_open_exclu = 0;
9653
9654 spin_unlock(&mce_chrdev_state_lock);
9655 -@@ -2229,7 +2232,7 @@ struct dentry *mce_get_debugfs_dir(void)
9656 +@@ -2237,7 +2240,7 @@ struct dentry *mce_get_debugfs_dir(void)
9657 static void mce_reset(void)
9658 {
9659 cpu_missing = 0;
9660 @@ -24674,7 +24479,7 @@ index 8ecbb4b..a269cab 100644
9661 }
9662 if (mm->get_unmapped_area == arch_get_unmapped_area)
9663 diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
9664 -index 6cabf65..9976a56 100644
9665 +index 6cabf65..74565da 100644
9666 --- a/arch/x86/mm/init.c
9667 +++ b/arch/x86/mm/init.c
9668 @@ -17,6 +17,8 @@
9669 @@ -24734,7 +24539,7 @@ index 6cabf65..9976a56 100644
9670 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
9671 return 0;
9672 if (!page_is_ram(pagenr))
9673 -@@ -372,8 +401,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
9674 +@@ -372,8 +401,116 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
9675 #endif
9676 }
9677
9678 @@ -24769,14 +24574,13 @@ index 6cabf65..9976a56 100644
9679 + unsigned long addr, limit;
9680 + struct desc_struct d;
9681 + int cpu;
9682 -+#endif
9683 -+#endif
9684 -+#ifndef CONFIG_X86_PAE
9685 ++#else
9686 + pgd_t *pgd;
9687 + pud_t *pud;
9688 + pmd_t *pmd;
9689 + unsigned long addr, end;
9690 +#endif
9691 ++#endif
9692 +
9693 + gr_init_ebda();
9694 +
9695 @@ -26846,6 +26650,206 @@ index f10c0af..3ec1f95 100644
9696
9697 syscall_init(); /* This sets MSR_*STAR and related */
9698 #endif
9699 +diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
9700 +index b685296..5cdc8ad 100644
9701 +--- a/arch/x86/tools/relocs.c
9702 ++++ b/arch/x86/tools/relocs.c
9703 +@@ -14,8 +14,16 @@
9704 +
9705 + static void die(char *fmt, ...);
9706 +
9707 ++#include "../../../include/generated/autoconf.h"
9708 ++#ifdef CONFIG_X86_32
9709 ++#define __PAGE_OFFSET CONFIG_PAGE_OFFSET
9710 ++#else
9711 ++#define __PAGE_OFFSET 0
9712 ++#endif
9713 ++
9714 + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
9715 + static Elf32_Ehdr ehdr;
9716 ++static Elf32_Phdr *phdr;
9717 + static unsigned long reloc_count, reloc_idx;
9718 + static unsigned long *relocs;
9719 + static unsigned long reloc16_count, reloc16_idx;
9720 +@@ -323,9 +331,39 @@ static void read_ehdr(FILE *fp)
9721 + }
9722 + }
9723 +
9724 ++static void read_phdrs(FILE *fp)
9725 ++{
9726 ++ unsigned int i;
9727 ++
9728 ++ phdr = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
9729 ++ if (!phdr) {
9730 ++ die("Unable to allocate %d program headers\n",
9731 ++ ehdr.e_phnum);
9732 ++ }
9733 ++ if (fseek(fp, ehdr.e_phoff, SEEK_SET) < 0) {
9734 ++ die("Seek to %d failed: %s\n",
9735 ++ ehdr.e_phoff, strerror(errno));
9736 ++ }
9737 ++ if (fread(phdr, sizeof(*phdr), ehdr.e_phnum, fp) != ehdr.e_phnum) {
9738 ++ die("Cannot read ELF program headers: %s\n",
9739 ++ strerror(errno));
9740 ++ }
9741 ++ for(i = 0; i < ehdr.e_phnum; i++) {
9742 ++ phdr[i].p_type = elf32_to_cpu(phdr[i].p_type);
9743 ++ phdr[i].p_offset = elf32_to_cpu(phdr[i].p_offset);
9744 ++ phdr[i].p_vaddr = elf32_to_cpu(phdr[i].p_vaddr);
9745 ++ phdr[i].p_paddr = elf32_to_cpu(phdr[i].p_paddr);
9746 ++ phdr[i].p_filesz = elf32_to_cpu(phdr[i].p_filesz);
9747 ++ phdr[i].p_memsz = elf32_to_cpu(phdr[i].p_memsz);
9748 ++ phdr[i].p_flags = elf32_to_cpu(phdr[i].p_flags);
9749 ++ phdr[i].p_align = elf32_to_cpu(phdr[i].p_align);
9750 ++ }
9751 ++
9752 ++}
9753 ++
9754 + static void read_shdrs(FILE *fp)
9755 + {
9756 +- int i;
9757 ++ unsigned int i;
9758 + Elf32_Shdr shdr;
9759 +
9760 + secs = calloc(ehdr.e_shnum, sizeof(struct section));
9761 +@@ -360,7 +398,7 @@ static void read_shdrs(FILE *fp)
9762 +
9763 + static void read_strtabs(FILE *fp)
9764 + {
9765 +- int i;
9766 ++ unsigned int i;
9767 + for (i = 0; i < ehdr.e_shnum; i++) {
9768 + struct section *sec = &secs[i];
9769 + if (sec->shdr.sh_type != SHT_STRTAB) {
9770 +@@ -385,7 +423,7 @@ static void read_strtabs(FILE *fp)
9771 +
9772 + static void read_symtabs(FILE *fp)
9773 + {
9774 +- int i,j;
9775 ++ unsigned int i,j;
9776 + for (i = 0; i < ehdr.e_shnum; i++) {
9777 + struct section *sec = &secs[i];
9778 + if (sec->shdr.sh_type != SHT_SYMTAB) {
9779 +@@ -418,7 +456,9 @@ static void read_symtabs(FILE *fp)
9780 +
9781 + static void read_relocs(FILE *fp)
9782 + {
9783 +- int i,j;
9784 ++ unsigned int i,j;
9785 ++ uint32_t base;
9786 ++
9787 + for (i = 0; i < ehdr.e_shnum; i++) {
9788 + struct section *sec = &secs[i];
9789 + if (sec->shdr.sh_type != SHT_REL) {
9790 +@@ -438,9 +478,18 @@ static void read_relocs(FILE *fp)
9791 + die("Cannot read symbol table: %s\n",
9792 + strerror(errno));
9793 + }
9794 ++ base = 0;
9795 ++ for (j = 0; j < ehdr.e_phnum; j++) {
9796 ++ if (phdr[j].p_type != PT_LOAD )
9797 ++ continue;
9798 ++ if (secs[sec->shdr.sh_info].shdr.sh_offset < phdr[j].p_offset || secs[sec->shdr.sh_info].shdr.sh_offset >= phdr[j].p_offset + phdr[j].p_filesz)
9799 ++ continue;
9800 ++ base = __PAGE_OFFSET + phdr[j].p_paddr - phdr[j].p_vaddr;
9801 ++ break;
9802 ++ }
9803 + for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
9804 + Elf32_Rel *rel = &sec->reltab[j];
9805 +- rel->r_offset = elf32_to_cpu(rel->r_offset);
9806 ++ rel->r_offset = elf32_to_cpu(rel->r_offset) + base;
9807 + rel->r_info = elf32_to_cpu(rel->r_info);
9808 + }
9809 + }
9810 +@@ -449,13 +498,13 @@ static void read_relocs(FILE *fp)
9811 +
9812 + static void print_absolute_symbols(void)
9813 + {
9814 +- int i;
9815 ++ unsigned int i;
9816 + printf("Absolute symbols\n");
9817 + printf(" Num: Value Size Type Bind Visibility Name\n");
9818 + for (i = 0; i < ehdr.e_shnum; i++) {
9819 + struct section *sec = &secs[i];
9820 + char *sym_strtab;
9821 +- int j;
9822 ++ unsigned int j;
9823 +
9824 + if (sec->shdr.sh_type != SHT_SYMTAB) {
9825 + continue;
9826 +@@ -482,14 +531,14 @@ static void print_absolute_symbols(void)
9827 +
9828 + static void print_absolute_relocs(void)
9829 + {
9830 +- int i, printed = 0;
9831 ++ unsigned int i, printed = 0;
9832 +
9833 + for (i = 0; i < ehdr.e_shnum; i++) {
9834 + struct section *sec = &secs[i];
9835 + struct section *sec_applies, *sec_symtab;
9836 + char *sym_strtab;
9837 + Elf32_Sym *sh_symtab;
9838 +- int j;
9839 ++ unsigned int j;
9840 + if (sec->shdr.sh_type != SHT_REL) {
9841 + continue;
9842 + }
9843 +@@ -551,13 +600,13 @@ static void print_absolute_relocs(void)
9844 + static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
9845 + int use_real_mode)
9846 + {
9847 +- int i;
9848 ++ unsigned int i;
9849 + /* Walk through the relocations */
9850 + for (i = 0; i < ehdr.e_shnum; i++) {
9851 + char *sym_strtab;
9852 + Elf32_Sym *sh_symtab;
9853 + struct section *sec_applies, *sec_symtab;
9854 +- int j;
9855 ++ unsigned int j;
9856 + struct section *sec = &secs[i];
9857 +
9858 + if (sec->shdr.sh_type != SHT_REL) {
9859 +@@ -583,6 +632,22 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
9860 +
9861 + shn_abs = sym->st_shndx == SHN_ABS;
9862 +
9863 ++ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
9864 ++ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
9865 ++ continue;
9866 ++
9867 ++#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
9868 ++ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
9869 ++ if (!strcmp(sec_name(sym->st_shndx), ".module.text") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
9870 ++ continue;
9871 ++ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
9872 ++ continue;
9873 ++ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
9874 ++ continue;
9875 ++ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
9876 ++ continue;
9877 ++#endif
9878 ++
9879 + switch (r_type) {
9880 + case R_386_NONE:
9881 + case R_386_PC32:
9882 +@@ -674,7 +739,7 @@ static int write32(unsigned int v, FILE *f)
9883 +
9884 + static void emit_relocs(int as_text, int use_real_mode)
9885 + {
9886 +- int i;
9887 ++ unsigned int i;
9888 + /* Count how many relocations I have and allocate space for them. */
9889 + reloc_count = 0;
9890 + walk_relocs(count_reloc, use_real_mode);
9891 +@@ -801,6 +866,7 @@ int main(int argc, char **argv)
9892 + fname, strerror(errno));
9893 + }
9894 + read_ehdr(fp);
9895 ++ read_phdrs(fp);
9896 + read_shdrs(fp);
9897 + read_strtabs(fp);
9898 + read_symtabs(fp);
9899 diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
9900 index 5d17950..2253fc9 100644
9901 --- a/arch/x86/vdso/Makefile
9902 @@ -27019,7 +27023,7 @@ index 153407c..611cba9 100644
9903 -}
9904 -__setup("vdso=", vdso_setup);
9905 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
9906 -index 4e517d4..68a48f5 100644
9907 +index 4e517d4..8426127 100644
9908 --- a/arch/x86/xen/enlighten.c
9909 +++ b/arch/x86/xen/enlighten.c
9910 @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
9911 @@ -27031,7 +27035,18 @@ index 4e517d4..68a48f5 100644
9912 RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
9913 __read_mostly int xen_have_vector_callback;
9914 EXPORT_SYMBOL_GPL(xen_have_vector_callback);
9915 -@@ -1030,30 +1028,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
9916 +@@ -982,7 +980,10 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
9917 + .wbinvd = native_wbinvd,
9918 +
9919 + .read_msr = native_read_msr_safe,
9920 ++ .rdmsr_regs = native_rdmsr_safe_regs,
9921 + .write_msr = xen_write_msr_safe,
9922 ++ .wrmsr_regs = native_wrmsr_safe_regs,
9923 ++
9924 + .read_tsc = native_read_tsc,
9925 + .read_pmc = native_read_pmc,
9926 +
9927 +@@ -1030,30 +1031,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
9928 #endif
9929 };
9930
9931 @@ -27069,7 +27084,7 @@ index 4e517d4..68a48f5 100644
9932 {
9933 if (pm_power_off)
9934 pm_power_off();
9935 -@@ -1156,7 +1154,17 @@ asmlinkage void __init xen_start_kernel(void)
9936 +@@ -1156,7 +1157,17 @@ asmlinkage void __init xen_start_kernel(void)
9937 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
9938
9939 /* Work out if we support NX */
9940 @@ -27088,7 +27103,7 @@ index 4e517d4..68a48f5 100644
9941
9942 xen_setup_features();
9943
9944 -@@ -1187,13 +1195,6 @@ asmlinkage void __init xen_start_kernel(void)
9945 +@@ -1187,13 +1198,6 @@ asmlinkage void __init xen_start_kernel(void)
9946
9947 machine_ops = xen_machine_ops;
9948
9949 @@ -30642,10 +30657,10 @@ index e159e33..cdcc663 100644
9950 for (i = 0; i < count; i++) {
9951 char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr;
9952 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
9953 -index 5bd4361..0241a42 100644
9954 +index 307c5e6..a1e4216 100644
9955 --- a/drivers/gpu/drm/i915/i915_irq.c
9956 +++ b/drivers/gpu/drm/i915/i915_irq.c
9957 -@@ -475,7 +475,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
9958 +@@ -472,7 +472,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
9959 u32 de_iir, gt_iir, de_ier, pch_iir, pm_iir;
9960 struct drm_i915_master_private *master_priv;
9961
9962 @@ -30654,7 +30669,7 @@ index 5bd4361..0241a42 100644
9963
9964 /* disable master interrupt before clearing iir */
9965 de_ier = I915_READ(DEIER);
9966 -@@ -566,7 +566,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
9967 +@@ -563,7 +563,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
9968 struct drm_i915_master_private *master_priv;
9969 u32 bsd_usr_interrupt = GT_BSD_USER_INTERRUPT;
9970
9971 @@ -30663,7 +30678,7 @@ index 5bd4361..0241a42 100644
9972
9973 if (IS_GEN6(dev))
9974 bsd_usr_interrupt = GT_GEN6_BSD_USER_INTERRUPT;
9975 -@@ -1231,7 +1231,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
9976 +@@ -1228,7 +1228,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
9977 int ret = IRQ_NONE, pipe;
9978 bool blc_event = false;
9979
9980 @@ -30672,7 +30687,7 @@ index 5bd4361..0241a42 100644
9981
9982 iir = I915_READ(IIR);
9983
9984 -@@ -1743,7 +1743,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
9985 +@@ -1740,7 +1740,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
9986 {
9987 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
9988
9989 @@ -30681,7 +30696,7 @@ index 5bd4361..0241a42 100644
9990
9991 INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
9992 INIT_WORK(&dev_priv->error_work, i915_error_work_func);
9993 -@@ -1932,7 +1932,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
9994 +@@ -1929,7 +1929,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
9995 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
9996 int pipe;
9997
9998 @@ -30691,7 +30706,7 @@ index 5bd4361..0241a42 100644
9999 INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
10000 INIT_WORK(&dev_priv->error_work, i915_error_work_func);
10001 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
10002 -index 2163818..cede019 100644
10003 +index 9ab9b16..e5b1b8d 100644
10004 --- a/drivers/gpu/drm/i915/intel_display.c
10005 +++ b/drivers/gpu/drm/i915/intel_display.c
10006 @@ -2238,7 +2238,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
10007 @@ -31446,6 +31461,19 @@ index 75dbe34..f9204a8 100644
10008
10009 hid_debug_register(hdev, dev_name(&hdev->dev));
10010 ret = device_add(&hdev->dev);
10011 +diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
10012 +index 17dabc1..bf248eb 100644
10013 +--- a/drivers/hid/hid-wiimote-debug.c
10014 ++++ b/drivers/hid/hid-wiimote-debug.c
10015 +@@ -72,7 +72,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s,
10016 + else if (size == 0)
10017 + return -EIO;
10018 +
10019 +- if (copy_to_user(u, buf, size))
10020 ++ if (size > sizeof(buf) || copy_to_user(u, buf, size))
10021 + return -EFAULT;
10022 +
10023 + *off += size;
10024 diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
10025 index b1ec0e2..c295a61 100644
10026 --- a/drivers/hid/usbhid/hiddev.c
10027 @@ -33618,7 +33646,7 @@ index b89c548..2af3ce4 100644
10028
10029 void dm_uevent_add(struct mapped_device *md, struct list_head *elist)
10030 diff --git a/drivers/md/md.c b/drivers/md/md.c
10031 -index 363aaf4..d875264 100644
10032 +index 1ae4327..4ecabb5 100644
10033 --- a/drivers/md/md.c
10034 +++ b/drivers/md/md.c
10035 @@ -277,10 +277,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
10036 @@ -34028,7 +34056,7 @@ index 8418c02..8555013 100644
10037 NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
10038 NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
10039 diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
10040 -index 16a089f..ab1667d 100644
10041 +index 16a089f..1661b11 100644
10042 --- a/drivers/media/radio/radio-cadet.c
10043 +++ b/drivers/media/radio/radio-cadet.c
10044 @@ -326,6 +326,8 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
10045 @@ -34040,6 +34068,15 @@ index 16a089f..ab1667d 100644
10046 mutex_lock(&dev->lock);
10047 if (dev->rdsstat == 0) {
10048 dev->rdsstat = 1;
10049 +@@ -347,7 +349,7 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
10050 + readbuf[i++] = dev->rdsbuf[dev->rdsout++];
10051 + mutex_unlock(&dev->lock);
10052 +
10053 +- if (copy_to_user(data, readbuf, i))
10054 ++ if (i > sizeof(readbuf) || copy_to_user(data, readbuf, i))
10055 + return -EFAULT;
10056 + return i;
10057 + }
10058 diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
10059 index 9cde353..8c6a1c3 100644
10060 --- a/drivers/media/video/au0828/au0828.h
10061 @@ -36571,7 +36608,7 @@ index 351dc0b..951dc32 100644
10062
10063 /* These three are default values which can be overridden */
10064 diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
10065 -index b96962c..0c82ec2 100644
10066 +index e640b73..2f68432 100644
10067 --- a/drivers/scsi/hpsa.c
10068 +++ b/drivers/scsi/hpsa.c
10069 @@ -507,7 +507,7 @@ static inline u32 next_command(struct ctlr_info *h)
10070 @@ -36583,7 +36620,7 @@ index b96962c..0c82ec2 100644
10071
10072 if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
10073 a = *(h->reply_pool_head); /* Next cmd in ring buffer */
10074 -@@ -2991,7 +2991,7 @@ static void start_io(struct ctlr_info *h)
10075 +@@ -2987,7 +2987,7 @@ static void start_io(struct ctlr_info *h)
10076 while (!list_empty(&h->reqQ)) {
10077 c = list_entry(h->reqQ.next, struct CommandList, list);
10078 /* can't do anything if fifo is full */
10079 @@ -36592,7 +36629,7 @@ index b96962c..0c82ec2 100644
10080 dev_warn(&h->pdev->dev, "fifo full\n");
10081 break;
10082 }
10083 -@@ -3001,7 +3001,7 @@ static void start_io(struct ctlr_info *h)
10084 +@@ -2997,7 +2997,7 @@ static void start_io(struct ctlr_info *h)
10085 h->Qdepth--;
10086
10087 /* Tell the controller execute command */
10088 @@ -36601,7 +36638,7 @@ index b96962c..0c82ec2 100644
10089
10090 /* Put job onto the completed Q */
10091 addQ(&h->cmpQ, c);
10092 -@@ -3010,17 +3010,17 @@ static void start_io(struct ctlr_info *h)
10093 +@@ -3006,17 +3006,17 @@ static void start_io(struct ctlr_info *h)
10094
10095 static inline unsigned long get_next_completion(struct ctlr_info *h)
10096 {
10097 @@ -36622,7 +36659,7 @@ index b96962c..0c82ec2 100644
10098 (h->interrupts_enabled == 0);
10099 }
10100
10101 -@@ -3919,7 +3919,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
10102 +@@ -3915,7 +3915,7 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
10103 if (prod_index < 0)
10104 return -ENODEV;
10105 h->product_name = products[prod_index].product_name;
10106 @@ -36631,7 +36668,7 @@ index b96962c..0c82ec2 100644
10107
10108 if (hpsa_board_disabled(h->pdev)) {
10109 dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
10110 -@@ -4164,7 +4164,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
10111 +@@ -4160,7 +4160,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
10112
10113 assert_spin_locked(&lockup_detector_lock);
10114 remove_ctlr_from_lockup_detector_list(h);
10115 @@ -36640,7 +36677,7 @@ index b96962c..0c82ec2 100644
10116 spin_lock_irqsave(&h->lock, flags);
10117 h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
10118 spin_unlock_irqrestore(&h->lock, flags);
10119 -@@ -4344,7 +4344,7 @@ reinit_after_soft_reset:
10120 +@@ -4340,7 +4340,7 @@ reinit_after_soft_reset:
10121 }
10122
10123 /* make sure the board interrupts are off */
10124 @@ -36649,7 +36686,7 @@ index b96962c..0c82ec2 100644
10125
10126 if (hpsa_request_irq(h, do_hpsa_intr_msi, do_hpsa_intr_intx))
10127 goto clean2;
10128 -@@ -4378,7 +4378,7 @@ reinit_after_soft_reset:
10129 +@@ -4374,7 +4374,7 @@ reinit_after_soft_reset:
10130 * fake ones to scoop up any residual completions.
10131 */
10132 spin_lock_irqsave(&h->lock, flags);
10133 @@ -36658,7 +36695,7 @@ index b96962c..0c82ec2 100644
10134 spin_unlock_irqrestore(&h->lock, flags);
10135 free_irq(h->intr[h->intr_mode], h);
10136 rc = hpsa_request_irq(h, hpsa_msix_discard_completions,
10137 -@@ -4397,9 +4397,9 @@ reinit_after_soft_reset:
10138 +@@ -4393,9 +4393,9 @@ reinit_after_soft_reset:
10139 dev_info(&h->pdev->dev, "Board READY.\n");
10140 dev_info(&h->pdev->dev,
10141 "Waiting for stale completions to drain.\n");
10142 @@ -36670,7 +36707,7 @@ index b96962c..0c82ec2 100644
10143
10144 rc = controller_reset_failed(h->cfgtable);
10145 if (rc)
10146 -@@ -4420,7 +4420,7 @@ reinit_after_soft_reset:
10147 +@@ -4416,7 +4416,7 @@ reinit_after_soft_reset:
10148 }
10149
10150 /* Turn the interrupts on so we can service requests */
10151 @@ -36679,7 +36716,7 @@ index b96962c..0c82ec2 100644
10152
10153 hpsa_hba_inquiry(h);
10154 hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */
10155 -@@ -4472,7 +4472,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
10156 +@@ -4468,7 +4468,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
10157 * To write all data in the battery backed cache to disks
10158 */
10159 hpsa_flush_cache(h);
10160 @@ -36688,7 +36725,7 @@ index b96962c..0c82ec2 100644
10161 free_irq(h->intr[h->intr_mode], h);
10162 #ifdef CONFIG_PCI_MSI
10163 if (h->msix_vector)
10164 -@@ -4636,7 +4636,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
10165 +@@ -4632,7 +4632,7 @@ static __devinit void hpsa_enter_performant_mode(struct ctlr_info *h,
10166 return;
10167 }
10168 /* Change the access methods to the performant access methods */
10169 @@ -41515,7 +41552,7 @@ index 3c14e43..eafa544 100644
10170 +4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
10171 +4 4 4 4 4 4
10172 diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
10173 -index a40c05e..785c583 100644
10174 +index 5fd95e0..b4a96f8 100644
10175 --- a/drivers/video/udlfb.c
10176 +++ b/drivers/video/udlfb.c
10177 @@ -619,11 +619,11 @@ int dlfb_handle_damage(struct dlfb_data *dev, int x, int y,
10178 @@ -41550,7 +41587,7 @@ index a40c05e..785c583 100644
10179 >> 10)), /* Kcycles */
10180 &dev->cpu_kcycles_used);
10181 }
10182 -@@ -1368,7 +1368,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
10183 +@@ -1371,7 +1371,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
10184 struct fb_info *fb_info = dev_get_drvdata(fbdev);
10185 struct dlfb_data *dev = fb_info->par;
10186 return snprintf(buf, PAGE_SIZE, "%u\n",
10187 @@ -41559,7 +41596,7 @@ index a40c05e..785c583 100644
10188 }
10189
10190 static ssize_t metrics_bytes_identical_show(struct device *fbdev,
10191 -@@ -1376,7 +1376,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev,
10192 +@@ -1379,7 +1379,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev,
10193 struct fb_info *fb_info = dev_get_drvdata(fbdev);
10194 struct dlfb_data *dev = fb_info->par;
10195 return snprintf(buf, PAGE_SIZE, "%u\n",
10196 @@ -41568,7 +41605,7 @@ index a40c05e..785c583 100644
10197 }
10198
10199 static ssize_t metrics_bytes_sent_show(struct device *fbdev,
10200 -@@ -1384,7 +1384,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev,
10201 +@@ -1387,7 +1387,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev,
10202 struct fb_info *fb_info = dev_get_drvdata(fbdev);
10203 struct dlfb_data *dev = fb_info->par;
10204 return snprintf(buf, PAGE_SIZE, "%u\n",
10205 @@ -41577,7 +41614,7 @@ index a40c05e..785c583 100644
10206 }
10207
10208 static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
10209 -@@ -1392,7 +1392,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
10210 +@@ -1395,7 +1395,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
10211 struct fb_info *fb_info = dev_get_drvdata(fbdev);
10212 struct dlfb_data *dev = fb_info->par;
10213 return snprintf(buf, PAGE_SIZE, "%u\n",
10214 @@ -41586,7 +41623,7 @@ index a40c05e..785c583 100644
10215 }
10216
10217 static ssize_t edid_show(
10218 -@@ -1449,10 +1449,10 @@ static ssize_t metrics_reset_store(struct device *fbdev,
10219 +@@ -1452,10 +1452,10 @@ static ssize_t metrics_reset_store(struct device *fbdev,
10220 struct fb_info *fb_info = dev_get_drvdata(fbdev);
10221 struct dlfb_data *dev = fb_info->par;
10222
10223 @@ -41875,7 +41912,7 @@ index e95d1b6..3454244 100644
10224 A.out (Assembler.OUTput) is a set of formats for libraries and
10225 executables used in the earliest versions of UNIX. Linux used
10226 diff --git a/fs/aio.c b/fs/aio.c
10227 -index b9d64d8..86cb1d5 100644
10228 +index 3b65ee7..aa6ec34 100644
10229 --- a/fs/aio.c
10230 +++ b/fs/aio.c
10231 @@ -119,7 +119,7 @@ static int aio_setup_ring(struct kioctx *ctx)
10232 @@ -41887,7 +41924,7 @@ index b9d64d8..86cb1d5 100644
10233 return -EINVAL;
10234
10235 nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
10236 -@@ -1461,22 +1461,27 @@ static ssize_t aio_fsync(struct kiocb *iocb)
10237 +@@ -1461,18 +1461,19 @@ static ssize_t aio_fsync(struct kiocb *iocb)
10238 static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
10239 {
10240 ssize_t ret;
10241 @@ -41909,11 +41946,15 @@ index b9d64d8..86cb1d5 100644
10242 &kiocb->ki_iovec, 1);
10243 if (ret < 0)
10244 goto out;
10245 +@@ -1481,6 +1482,11 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
10246 + if (ret < 0)
10247 + goto out;
10248
10249 + if (kiocb->ki_iovec == &iovstack) {
10250 + kiocb->ki_inline_vec = iovstack;
10251 + kiocb->ki_iovec = &kiocb->ki_inline_vec;
10252 + }
10253 ++
10254 kiocb->ki_nr_segs = kiocb->ki_nbytes;
10255 kiocb->ki_cur_seg = 0;
10256 /* ki_nbytes/left now reflect bytes instead of segs */
10257 @@ -42960,10 +43001,10 @@ index 1bffbe0..c8c283e 100644
10258 goto err;
10259 }
10260 diff --git a/fs/bio.c b/fs/bio.c
10261 -index b980ecd..74800bf 100644
10262 +index 4fc4dbb..d3a5b93 100644
10263 --- a/fs/bio.c
10264 +++ b/fs/bio.c
10265 -@@ -833,7 +833,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
10266 +@@ -838,7 +838,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
10267 /*
10268 * Overflow, abort
10269 */
10270 @@ -42972,7 +43013,7 @@ index b980ecd..74800bf 100644
10271 return ERR_PTR(-EINVAL);
10272
10273 nr_pages += end - start;
10274 -@@ -1229,7 +1229,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
10275 +@@ -1234,7 +1234,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
10276 const int read = bio_data_dir(bio) == READ;
10277 struct bio_map_data *bmd = bio->bi_private;
10278 int i;
10279 @@ -42982,7 +43023,7 @@ index b980ecd..74800bf 100644
10280 __bio_for_each_segment(bvec, bio, i, 0) {
10281 char *addr = page_address(bvec->bv_page);
10282 diff --git a/fs/block_dev.c b/fs/block_dev.c
10283 -index 5e9f198..6bf9b1c 100644
10284 +index 236dd6c..46c6530 100644
10285 --- a/fs/block_dev.c
10286 +++ b/fs/block_dev.c
10287 @@ -703,7 +703,7 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
10288 @@ -44860,6 +44901,19 @@ index cb990b2..4820141 100644
10289 trace_ext4_mballoc_discard(sb, NULL, group, bit, pa->pa_len);
10290
10291 return 0;
10292 +diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
10293 +index f9d948f..8601f4b 100644
10294 +--- a/fs/ext4/resize.c
10295 ++++ b/fs/ext4/resize.c
10296 +@@ -161,6 +161,8 @@ static struct ext4_new_flex_group_data *alloc_flex_gd(unsigned long flexbg_size)
10297 + if (flex_gd == NULL)
10298 + goto out3;
10299 +
10300 ++ if (flexbg_size >= UINT_MAX / sizeof(struct ext4_new_flex_group_data))
10301 ++ goto out2;
10302 + flex_gd->count = flexbg_size;
10303 +
10304 + flex_gd->groups = kmalloc(sizeof(struct ext4_new_group_data) *
10305 diff --git a/fs/fcntl.c b/fs/fcntl.c
10306 index 22764c7..86372c9 100644
10307 --- a/fs/fcntl.c
10308 @@ -60634,7 +60688,7 @@ index 84ccf8e..2e9b14c 100644
10309 };
10310
10311 diff --git a/include/linux/fs.h b/include/linux/fs.h
10312 -index f4b6e06..d6ba573 100644
10313 +index fd65e0d..7232c62 100644
10314 --- a/include/linux/fs.h
10315 +++ b/include/linux/fs.h
10316 @@ -1628,7 +1628,8 @@ struct file_operations {
10317 @@ -60730,7 +60784,7 @@ index c3da42d..c70e0df 100644
10318 int trace_set_clr_event(const char *system, const char *event, int set);
10319
10320 diff --git a/include/linux/genhd.h b/include/linux/genhd.h
10321 -index e61d319..0da8505 100644
10322 +index 017a7fb..33a8507 100644
10323 --- a/include/linux/genhd.h
10324 +++ b/include/linux/genhd.h
10325 @@ -185,7 +185,7 @@ struct gendisk {
10326 @@ -64527,10 +64581,10 @@ index 1c09820..7f5ec79 100644
10327 TP_ARGS(irq, action, ret),
10328
10329 diff --git a/include/video/udlfb.h b/include/video/udlfb.h
10330 -index c41f308..6918de3 100644
10331 +index f9466fa..f4e2b81 100644
10332 --- a/include/video/udlfb.h
10333 +++ b/include/video/udlfb.h
10334 -@@ -52,10 +52,10 @@ struct dlfb_data {
10335 +@@ -53,10 +53,10 @@ struct dlfb_data {
10336 u32 pseudo_palette[256];
10337 int blank_mode; /*one of FB_BLANK_ */
10338 /* blit-only rendering path metrics, exposed through sysfs */
10339 @@ -64881,7 +64935,7 @@ index 8216c30..25e8e32 100644
10340 next_state = Reset;
10341 return 0;
10342 diff --git a/init/main.c b/init/main.c
10343 -index ff49a6d..5fa0429 100644
10344 +index 45a7bf5..7ba1b61 100644
10345 --- a/init/main.c
10346 +++ b/init/main.c
10347 @@ -96,6 +96,8 @@ static inline void mark_rodata_ro(void) { }
10348 @@ -64943,7 +64997,7 @@ index ff49a6d..5fa0429 100644
10349 static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
10350 const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
10351 static const char *panic_later, *panic_param;
10352 -@@ -675,6 +720,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
10353 +@@ -672,6 +717,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
10354 {
10355 int count = preempt_count();
10356 int ret;
10357 @@ -64951,7 +65005,7 @@ index ff49a6d..5fa0429 100644
10358
10359 if (initcall_debug)
10360 ret = do_one_initcall_debug(fn);
10361 -@@ -687,15 +733,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
10362 +@@ -684,15 +730,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
10363 sprintf(msgbuf, "error code %d ", ret);
10364
10365 if (preempt_count() != count) {
10366 @@ -64971,7 +65025,7 @@ index ff49a6d..5fa0429 100644
10367 }
10368
10369 return ret;
10370 -@@ -814,7 +860,7 @@ static int __init kernel_init(void * unused)
10371 +@@ -815,7 +861,7 @@ static int __init kernel_init(void * unused)
10372 do_basic_setup();
10373
10374 /* Open the /dev/console on the rootfs, this should never fail */
10375 @@ -64980,7 +65034,7 @@ index ff49a6d..5fa0429 100644
10376 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
10377
10378 (void) sys_dup(0);
10379 -@@ -827,11 +873,13 @@ static int __init kernel_init(void * unused)
10380 +@@ -828,11 +874,13 @@ static int __init kernel_init(void * unused)
10381 if (!ramdisk_execute_command)
10382 ramdisk_execute_command = "/init";
10383
10384 @@ -71159,10 +71213,10 @@ index 10b4dda..06857f3 100644
10385 * Make sure the vDSO gets into every core dump.
10386 * Dumping its contents makes post-mortem fully interpretable later
10387 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
10388 -index 0a37570..2048346 100644
10389 +index a8f97d5..e2ed444 100644
10390 --- a/mm/mempolicy.c
10391 +++ b/mm/mempolicy.c
10392 -@@ -640,6 +640,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
10393 +@@ -619,6 +619,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
10394 unsigned long vmstart;
10395 unsigned long vmend;
10396
10397 @@ -71173,15 +71227,15 @@ index 0a37570..2048346 100644
10398 vma = find_vma(mm, start);
10399 if (!vma || vma->vm_start > start)
10400 return -EFAULT;
10401 -@@ -679,6 +683,16 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
10402 - err = policy_vma(vma, new_pol);
10403 - if (err)
10404 - goto out;
10405 +@@ -672,6 +676,16 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
10406 + if (err)
10407 + goto out;
10408 + }
10409 +
10410 +#ifdef CONFIG_PAX_SEGMEXEC
10411 + vma_m = pax_find_mirror_vma(vma);
10412 -+ if (vma_m) {
10413 -+ err = policy_vma(vma_m, new_pol);
10414 ++ if (vma_m && vma_m->vm_ops && vma_m->vm_ops->set_policy) {
10415 ++ err = vma_m->vm_ops->set_policy(vma_m, new_pol);
10416 + if (err)
10417 + goto out;
10418 + }
10419 @@ -71190,7 +71244,7 @@ index 0a37570..2048346 100644
10420 }
10421
10422 out:
10423 -@@ -1112,6 +1126,17 @@ static long do_mbind(unsigned long start, unsigned long len,
10424 +@@ -1105,6 +1119,17 @@ static long do_mbind(unsigned long start, unsigned long len,
10425
10426 if (end < start)
10427 return -EINVAL;
10428 @@ -71208,7 +71262,7 @@ index 0a37570..2048346 100644
10429 if (end == start)
10430 return 0;
10431
10432 -@@ -1330,6 +1355,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
10433 +@@ -1323,6 +1348,14 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
10434 if (!mm)
10435 goto out;
10436
10437 @@ -71223,7 +71277,7 @@ index 0a37570..2048346 100644
10438 /*
10439 * Check if this process has the right to modify the specified
10440 * process. The right exists if the process has administrative
10441 -@@ -1339,8 +1372,7 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
10442 +@@ -1332,8 +1365,7 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
10443 rcu_read_lock();
10444 tcred = __task_cred(task);
10445 if (cred->euid != tcred->suid && cred->euid != tcred->uid &&
10446 @@ -74032,7 +74086,7 @@ index 14380e9..e244704 100644
10447 }
10448
10449 diff --git a/mm/swapfile.c b/mm/swapfile.c
10450 -index f31b29d..8bdcae2 100644
10451 +index 099c209..7db7b6f 100644
10452 --- a/mm/swapfile.c
10453 +++ b/mm/swapfile.c
10454 @@ -61,7 +61,7 @@ static DEFINE_MUTEX(swapon_mutex);
10455
10456 diff --git a/3.3.7/4430_grsec-remove-localversion-grsec.patch b/3.3.8/4430_grsec-remove-localversion-grsec.patch
10457 similarity index 100%
10458 rename from 3.3.7/4430_grsec-remove-localversion-grsec.patch
10459 rename to 3.3.8/4430_grsec-remove-localversion-grsec.patch
10460
10461 diff --git a/3.3.7/4435_grsec-mute-warnings.patch b/3.3.8/4435_grsec-mute-warnings.patch
10462 similarity index 100%
10463 rename from 3.3.7/4435_grsec-mute-warnings.patch
10464 rename to 3.3.8/4435_grsec-mute-warnings.patch
10465
10466 diff --git a/3.3.7/4440_grsec-remove-protected-paths.patch b/3.3.8/4440_grsec-remove-protected-paths.patch
10467 similarity index 100%
10468 rename from 3.3.7/4440_grsec-remove-protected-paths.patch
10469 rename to 3.3.8/4440_grsec-remove-protected-paths.patch
10470
10471 diff --git a/3.3.7/4445_grsec-pax-without-grsec.patch b/3.3.8/4445_grsec-pax-without-grsec.patch
10472 similarity index 100%
10473 rename from 3.3.7/4445_grsec-pax-without-grsec.patch
10474 rename to 3.3.8/4445_grsec-pax-without-grsec.patch
10475
10476 diff --git a/3.3.7/4450_grsec-kconfig-default-gids.patch b/3.3.8/4450_grsec-kconfig-default-gids.patch
10477 similarity index 100%
10478 rename from 3.3.7/4450_grsec-kconfig-default-gids.patch
10479 rename to 3.3.8/4450_grsec-kconfig-default-gids.patch
10480
10481 diff --git a/3.3.7/4455_grsec-kconfig-gentoo.patch b/3.3.8/4455_grsec-kconfig-gentoo.patch
10482 similarity index 100%
10483 rename from 3.3.7/4455_grsec-kconfig-gentoo.patch
10484 rename to 3.3.8/4455_grsec-kconfig-gentoo.patch
10485
10486 diff --git a/3.3.7/4460-grsec-kconfig-proc-user.patch b/3.3.8/4460-grsec-kconfig-proc-user.patch
10487 similarity index 100%
10488 rename from 3.3.7/4460-grsec-kconfig-proc-user.patch
10489 rename to 3.3.8/4460-grsec-kconfig-proc-user.patch
10490
10491 diff --git a/3.3.7/4465_selinux-avc_audit-log-curr_ip.patch b/3.3.8/4465_selinux-avc_audit-log-curr_ip.patch
10492 similarity index 100%
10493 rename from 3.3.7/4465_selinux-avc_audit-log-curr_ip.patch
10494 rename to 3.3.8/4465_selinux-avc_audit-log-curr_ip.patch
10495
10496 diff --git a/3.3.7/4470_disable-compat_vdso.patch b/3.3.8/4470_disable-compat_vdso.patch
10497 similarity index 100%
10498 rename from 3.3.7/4470_disable-compat_vdso.patch
10499 rename to 3.3.8/4470_disable-compat_vdso.patch