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.33/, 2.6.32/, 3.6.4/, 3.2.32/, 3.6.5/
Date: Thu, 01 Nov 2012 13:10:35
Message-Id: 1351775355.f4907cfe7e0e2c027f6e4dbdd7dbbb7353c4e65e.blueness@gentoo
1 commit: f4907cfe7e0e2c027f6e4dbdd7dbbb7353c4e65e
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 1 13:09:15 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 1 13:09:15 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=f4907cfe
7
8 Grsec/PaX: 2.9.1-{2.6.32.60,3.2.33,3.6.5}-201210312121
9
10 ---
11 2.6.32/0000_README | 2 +-
12 ..._grsecurity-2.9.1-2.6.32.60-201210310820.patch} | 6 +-
13 {3.2.32 => 3.2.33}/0000_README | 6 +-
14 {3.2.32 => 3.2.33}/1021_linux-3.2.22.patch | 0
15 {3.2.32 => 3.2.33}/1022_linux-3.2.23.patch | 0
16 {3.2.32 => 3.2.33}/1023_linux-3.2.24.patch | 0
17 {3.2.32 => 3.2.33}/1024_linux-3.2.25.patch | 0
18 {3.2.32 => 3.2.33}/1025_linux-3.2.26.patch | 0
19 {3.2.32 => 3.2.33}/1026_linux-3.2.27.patch | 0
20 {3.2.32 => 3.2.33}/1027_linux-3.2.28.patch | 0
21 {3.2.32 => 3.2.33}/1028_linux-3.2.29.patch | 0
22 {3.2.32 => 3.2.33}/1029_linux-3.2.30.patch | 0
23 {3.2.32 => 3.2.33}/1030_linux-3.2.31.patch | 0
24 {3.2.32 => 3.2.33}/1031_linux-3.2.32.patch | 0
25 3.2.33/1032_linux-3.2.33.patch | 3450 +++++++++++++++
26 ...4420_grsecurity-2.9.1-3.2.33-201210310843.patch | 260 +-
27 .../4430_grsec-remove-localversion-grsec.patch | 0
28 {3.2.32 => 3.2.33}/4435_grsec-mute-warnings.patch | 0
29 .../4440_grsec-remove-protected-paths.patch | 0
30 .../4450_grsec-kconfig-default-gids.patch | 0
31 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
32 {3.2.32 => 3.2.33}/4470_disable-compat_vdso.patch | 0
33 {3.6.4 => 3.6.5}/0000_README | 6 +-
34 3.6.5/1004_linux-3.6.5.patch | 4649 ++++++++++++++++++++
35 .../4420_grsecurity-2.9.1-3.6.5-201210312121.patch | 188 +-
36 .../4430_grsec-remove-localversion-grsec.patch | 0
37 {3.6.4 => 3.6.5}/4435_grsec-mute-warnings.patch | 0
38 .../4440_grsec-remove-protected-paths.patch | 0
39 .../4450_grsec-kconfig-default-gids.patch | 0
40 .../4465_selinux-avc_audit-log-curr_ip.patch | 0
41 {3.6.4 => 3.6.5}/4470_disable-compat_vdso.patch | 0
42 31 files changed, 8285 insertions(+), 282 deletions(-)
43
44 diff --git a/2.6.32/0000_README b/2.6.32/0000_README
45 index 288d745..77cac16 100644
46 --- a/2.6.32/0000_README
47 +++ b/2.6.32/0000_README
48 @@ -34,7 +34,7 @@ Patch: 1059_linux-2.6.32.60.patch
49 From: http://www.kernel.org
50 Desc: Linux 2.6.32.59
51
52 -Patch: 4420_grsecurity-2.9.1-2.6.32.60-201210291444.patch
53 +Patch: 4420_grsecurity-2.9.1-2.6.32.60-201210310820.patch
54 From: http://www.grsecurity.net
55 Desc: hardened-sources base patch from upstream grsecurity
56
57
58 diff --git a/2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210291444.patch b/2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210310820.patch
59 similarity index 99%
60 rename from 2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210291444.patch
61 rename to 2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210310820.patch
62 index 489cffc..04f2458 100644
63 --- a/2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210291444.patch
64 +++ b/2.6.32/4420_grsecurity-2.9.1-2.6.32.60-201210310820.patch
65 @@ -103771,7 +103771,7 @@ index 5c9dc22..d271117 100644
66 .clock_get = thread_cpu_clock_get,
67 .clock_set = do_posix_clock_nosettime,
68 diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
69 -index 5e76d22..cf1baeb 100644
70 +index 5e76d22..f2d062c 100644
71 --- a/kernel/posix-timers.c
72 +++ b/kernel/posix-timers.c
73 @@ -42,6 +42,7 @@
74 @@ -103817,10 +103817,10 @@ index 5e76d22..cf1baeb 100644
75 return 1;
76 - if (posix_clocks[which_clock].clock_getres != NULL)
77 + if (posix_clocks[which_clock] == NULL)
78 ++ return 1;
79 ++ if (posix_clocks[which_clock]->clock_getres != NULL)
80 return 0;
81 - if (posix_clocks[which_clock].res != 0)
82 -+ if (posix_clocks[which_clock]->clock_getres != NULL)
83 -+ return 0;
84 + if (posix_clocks[which_clock]->res != 0)
85 return 0;
86 return 1;
87
88 diff --git a/3.2.32/0000_README b/3.2.33/0000_README
89 similarity index 94%
90 rename from 3.2.32/0000_README
91 rename to 3.2.33/0000_README
92 index 037da24..245166a 100644
93 --- a/3.2.32/0000_README
94 +++ b/3.2.33/0000_README
95 @@ -46,7 +46,11 @@ Patch: 1031_linux-3.2.32.patch
96 From: http://www.kernel.org
97 Desc: Linux 3.2.32
98
99 -Patch: 4420_grsecurity-2.9.1-3.2.32-201210291445.patch
100 +Patch: 1032_linux-3.2.33.patch
101 +From: http://www.kernel.org
102 +Desc: Linux 3.2.33
103 +
104 +Patch: 4420_grsecurity-2.9.1-3.2.33-201210310843.patch
105 From: http://www.grsecurity.net
106 Desc: hardened-sources base patch from upstream grsecurity
107
108
109 diff --git a/3.2.32/1021_linux-3.2.22.patch b/3.2.33/1021_linux-3.2.22.patch
110 similarity index 100%
111 rename from 3.2.32/1021_linux-3.2.22.patch
112 rename to 3.2.33/1021_linux-3.2.22.patch
113
114 diff --git a/3.2.32/1022_linux-3.2.23.patch b/3.2.33/1022_linux-3.2.23.patch
115 similarity index 100%
116 rename from 3.2.32/1022_linux-3.2.23.patch
117 rename to 3.2.33/1022_linux-3.2.23.patch
118
119 diff --git a/3.2.32/1023_linux-3.2.24.patch b/3.2.33/1023_linux-3.2.24.patch
120 similarity index 100%
121 rename from 3.2.32/1023_linux-3.2.24.patch
122 rename to 3.2.33/1023_linux-3.2.24.patch
123
124 diff --git a/3.2.32/1024_linux-3.2.25.patch b/3.2.33/1024_linux-3.2.25.patch
125 similarity index 100%
126 rename from 3.2.32/1024_linux-3.2.25.patch
127 rename to 3.2.33/1024_linux-3.2.25.patch
128
129 diff --git a/3.2.32/1025_linux-3.2.26.patch b/3.2.33/1025_linux-3.2.26.patch
130 similarity index 100%
131 rename from 3.2.32/1025_linux-3.2.26.patch
132 rename to 3.2.33/1025_linux-3.2.26.patch
133
134 diff --git a/3.2.32/1026_linux-3.2.27.patch b/3.2.33/1026_linux-3.2.27.patch
135 similarity index 100%
136 rename from 3.2.32/1026_linux-3.2.27.patch
137 rename to 3.2.33/1026_linux-3.2.27.patch
138
139 diff --git a/3.2.32/1027_linux-3.2.28.patch b/3.2.33/1027_linux-3.2.28.patch
140 similarity index 100%
141 rename from 3.2.32/1027_linux-3.2.28.patch
142 rename to 3.2.33/1027_linux-3.2.28.patch
143
144 diff --git a/3.2.32/1028_linux-3.2.29.patch b/3.2.33/1028_linux-3.2.29.patch
145 similarity index 100%
146 rename from 3.2.32/1028_linux-3.2.29.patch
147 rename to 3.2.33/1028_linux-3.2.29.patch
148
149 diff --git a/3.2.32/1029_linux-3.2.30.patch b/3.2.33/1029_linux-3.2.30.patch
150 similarity index 100%
151 rename from 3.2.32/1029_linux-3.2.30.patch
152 rename to 3.2.33/1029_linux-3.2.30.patch
153
154 diff --git a/3.2.32/1030_linux-3.2.31.patch b/3.2.33/1030_linux-3.2.31.patch
155 similarity index 100%
156 rename from 3.2.32/1030_linux-3.2.31.patch
157 rename to 3.2.33/1030_linux-3.2.31.patch
158
159 diff --git a/3.2.32/1031_linux-3.2.32.patch b/3.2.33/1031_linux-3.2.32.patch
160 similarity index 100%
161 rename from 3.2.32/1031_linux-3.2.32.patch
162 rename to 3.2.33/1031_linux-3.2.32.patch
163
164 diff --git a/3.2.33/1032_linux-3.2.33.patch b/3.2.33/1032_linux-3.2.33.patch
165 new file mode 100644
166 index 0000000..c32fb75
167 --- /dev/null
168 +++ b/3.2.33/1032_linux-3.2.33.patch
169 @@ -0,0 +1,3450 @@
170 +diff --git a/Makefile b/Makefile
171 +index b6d8282..63ca1ea2 100644
172 +--- a/Makefile
173 ++++ b/Makefile
174 +@@ -1,6 +1,6 @@
175 + VERSION = 3
176 + PATCHLEVEL = 2
177 +-SUBLEVEL = 32
178 ++SUBLEVEL = 33
179 + EXTRAVERSION =
180 + NAME = Saber-toothed Squirrel
181 +
182 +diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
183 +index 3d5fc41..bf53047 100644
184 +--- a/arch/arm/include/asm/vfpmacros.h
185 ++++ b/arch/arm/include/asm/vfpmacros.h
186 +@@ -28,7 +28,7 @@
187 + ldr \tmp, =elf_hwcap @ may not have MVFR regs
188 + ldr \tmp, [\tmp, #0]
189 + tst \tmp, #HWCAP_VFPv3D16
190 +- ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
191 ++ ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
192 + addne \base, \base, #32*4 @ step over unused register space
193 + #else
194 + VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
195 +@@ -52,7 +52,7 @@
196 + ldr \tmp, =elf_hwcap @ may not have MVFR regs
197 + ldr \tmp, [\tmp, #0]
198 + tst \tmp, #HWCAP_VFPv3D16
199 +- stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
200 ++ stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
201 + addne \base, \base, #32*4 @ step over unused register space
202 + #else
203 + VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
204 +diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
205 +index 1d1710e..bfa0eeb 100644
206 +--- a/arch/arm/kernel/smp.c
207 ++++ b/arch/arm/kernel/smp.c
208 +@@ -295,18 +295,24 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
209 + asmlinkage void __cpuinit secondary_start_kernel(void)
210 + {
211 + struct mm_struct *mm = &init_mm;
212 +- unsigned int cpu = smp_processor_id();
213 ++ unsigned int cpu;
214 ++
215 ++ /*
216 ++ * The identity mapping is uncached (strongly ordered), so
217 ++ * switch away from it before attempting any exclusive accesses.
218 ++ */
219 ++ cpu_switch_mm(mm->pgd, mm);
220 ++ enter_lazy_tlb(mm, current);
221 ++ local_flush_tlb_all();
222 +
223 + /*
224 + * All kernel threads share the same mm context; grab a
225 + * reference and switch to it.
226 + */
227 ++ cpu = smp_processor_id();
228 + atomic_inc(&mm->mm_count);
229 + current->active_mm = mm;
230 + cpumask_set_cpu(cpu, mm_cpumask(mm));
231 +- cpu_switch_mm(mm->pgd, mm);
232 +- enter_lazy_tlb(mm, current);
233 +- local_flush_tlb_all();
234 +
235 + printk("CPU%u: Booted secondary processor\n", cpu);
236 +
237 +diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
238 +index f4546e9..23817a6 100644
239 +--- a/arch/mips/kernel/kgdb.c
240 ++++ b/arch/mips/kernel/kgdb.c
241 +@@ -283,6 +283,15 @@ static int kgdb_mips_notify(struct notifier_block *self, unsigned long cmd,
242 + struct pt_regs *regs = args->regs;
243 + int trap = (regs->cp0_cause & 0x7c) >> 2;
244 +
245 ++#ifdef CONFIG_KPROBES
246 ++ /*
247 ++ * Return immediately if the kprobes fault notifier has set
248 ++ * DIE_PAGE_FAULT.
249 ++ */
250 ++ if (cmd == DIE_PAGE_FAULT)
251 ++ return NOTIFY_DONE;
252 ++#endif /* CONFIG_KPROBES */
253 ++
254 + /* Userspace events, ignore. */
255 + if (user_mode(regs))
256 + return NOTIFY_DONE;
257 +diff --git a/arch/s390/boot/compressed/vmlinux.lds.S b/arch/s390/boot/compressed/vmlinux.lds.S
258 +index d80f79d..8e1fb82 100644
259 +--- a/arch/s390/boot/compressed/vmlinux.lds.S
260 ++++ b/arch/s390/boot/compressed/vmlinux.lds.S
261 +@@ -5,7 +5,7 @@ OUTPUT_FORMAT("elf64-s390", "elf64-s390", "elf64-s390")
262 + OUTPUT_ARCH(s390:64-bit)
263 + #else
264 + OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
265 +-OUTPUT_ARCH(s390)
266 ++OUTPUT_ARCH(s390:31-bit)
267 + #endif
268 +
269 + ENTRY(startup)
270 +diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
271 +index e4c79eb..e43d21e 100644
272 +--- a/arch/s390/kernel/vmlinux.lds.S
273 ++++ b/arch/s390/kernel/vmlinux.lds.S
274 +@@ -8,7 +8,7 @@
275 +
276 + #ifndef CONFIG_64BIT
277 + OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
278 +-OUTPUT_ARCH(s390)
279 ++OUTPUT_ARCH(s390:31-bit)
280 + ENTRY(_start)
281 + jiffies = jiffies_64 + 4;
282 + #else
283 +diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
284 +index 614da62..3c8f220 100644
285 +--- a/arch/sparc/kernel/perf_event.c
286 ++++ b/arch/sparc/kernel/perf_event.c
287 +@@ -555,11 +555,13 @@ static u64 nop_for_index(int idx)
288 +
289 + static inline void sparc_pmu_enable_event(struct cpu_hw_events *cpuc, struct hw_perf_event *hwc, int idx)
290 + {
291 +- u64 val, mask = mask_for_index(idx);
292 ++ u64 enc, val, mask = mask_for_index(idx);
293 ++
294 ++ enc = perf_event_get_enc(cpuc->events[idx]);
295 +
296 + val = cpuc->pcr;
297 + val &= ~mask;
298 +- val |= hwc->config;
299 ++ val |= event_encoding(enc, idx);
300 + cpuc->pcr = val;
301 +
302 + pcr_ops->write(cpuc->pcr);
303 +@@ -1422,8 +1424,6 @@ static void perf_callchain_user_64(struct perf_callchain_entry *entry,
304 + {
305 + unsigned long ufp;
306 +
307 +- perf_callchain_store(entry, regs->tpc);
308 +-
309 + ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
310 + do {
311 + struct sparc_stackf *usf, sf;
312 +@@ -1444,8 +1444,6 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
313 + {
314 + unsigned long ufp;
315 +
316 +- perf_callchain_store(entry, regs->tpc);
317 +-
318 + ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
319 + do {
320 + struct sparc_stackf32 *usf, sf;
321 +@@ -1464,6 +1462,11 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry,
322 + void
323 + perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
324 + {
325 ++ perf_callchain_store(entry, regs->tpc);
326 ++
327 ++ if (!current->mm)
328 ++ return;
329 ++
330 + flushw_user();
331 + if (test_thread_flag(TIF_32BIT))
332 + perf_callchain_user_32(entry, regs);
333 +diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
334 +index 441521a..5e4252b 100644
335 +--- a/arch/sparc/kernel/sys_sparc_64.c
336 ++++ b/arch/sparc/kernel/sys_sparc_64.c
337 +@@ -519,12 +519,12 @@ SYSCALL_DEFINE1(sparc64_personality, unsigned long, personality)
338 + {
339 + int ret;
340 +
341 +- if (current->personality == PER_LINUX32 &&
342 +- personality == PER_LINUX)
343 +- personality = PER_LINUX32;
344 ++ if (personality(current->personality) == PER_LINUX32 &&
345 ++ personality(personality) == PER_LINUX)
346 ++ personality |= PER_LINUX32;
347 + ret = sys_personality(personality);
348 +- if (ret == PER_LINUX32)
349 +- ret = PER_LINUX;
350 ++ if (personality(ret) == PER_LINUX32)
351 ++ ret &= ~PER_LINUX32;
352 +
353 + return ret;
354 + }
355 +diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
356 +index 1d7e274..7f5f65d 100644
357 +--- a/arch/sparc/kernel/syscalls.S
358 ++++ b/arch/sparc/kernel/syscalls.S
359 +@@ -212,24 +212,20 @@ linux_sparc_syscall:
360 + 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
361 + ret_sys_call:
362 + ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
363 +- ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
364 + sra %o0, 0, %o0
365 + mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
366 + sllx %g2, 32, %g2
367 +
368 +- /* Check if force_successful_syscall_return()
369 +- * was invoked.
370 +- */
371 +- ldub [%g6 + TI_SYS_NOERROR], %l2
372 +- brnz,a,pn %l2, 80f
373 +- stb %g0, [%g6 + TI_SYS_NOERROR]
374 +-
375 + cmp %o0, -ERESTART_RESTARTBLOCK
376 + bgeu,pn %xcc, 1f
377 +- andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
378 +-80:
379 ++ andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
380 ++ ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
381 ++
382 ++2:
383 ++ stb %g0, [%g6 + TI_SYS_NOERROR]
384 + /* System call success, clear Carry condition code. */
385 + andn %g3, %g2, %g3
386 ++3:
387 + stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
388 + bne,pn %icc, linux_syscall_trace2
389 + add %l1, 0x4, %l2 ! npc = npc+4
390 +@@ -238,20 +234,20 @@ ret_sys_call:
391 + stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
392 +
393 + 1:
394 ++ /* Check if force_successful_syscall_return()
395 ++ * was invoked.
396 ++ */
397 ++ ldub [%g6 + TI_SYS_NOERROR], %l2
398 ++ brnz,pn %l2, 2b
399 ++ ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
400 + /* System call failure, set Carry condition code.
401 + * Also, get abs(errno) to return to the process.
402 + */
403 +- andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
404 + sub %g0, %o0, %o0
405 +- or %g3, %g2, %g3
406 + stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
407 +- stx %g3, [%sp + PTREGS_OFF + PT_V9_TSTATE]
408 +- bne,pn %icc, linux_syscall_trace2
409 +- add %l1, 0x4, %l2 ! npc = npc+4
410 +- stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
411 ++ ba,pt %xcc, 3b
412 ++ or %g3, %g2, %g3
413 +
414 +- b,pt %xcc, rtrap
415 +- stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
416 + linux_syscall_trace2:
417 + call syscall_trace_leave
418 + add %sp, PTREGS_OFF, %o0
419 +diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
420 +index 8e073d8..6ff4d78 100644
421 +--- a/arch/sparc/mm/init_64.c
422 ++++ b/arch/sparc/mm/init_64.c
423 +@@ -2118,6 +2118,9 @@ EXPORT_SYMBOL(_PAGE_CACHE);
424 + #ifdef CONFIG_SPARSEMEM_VMEMMAP
425 + unsigned long vmemmap_table[VMEMMAP_SIZE];
426 +
427 ++static long __meminitdata addr_start, addr_end;
428 ++static int __meminitdata node_start;
429 ++
430 + int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
431 + {
432 + unsigned long vstart = (unsigned long) start;
433 +@@ -2148,15 +2151,30 @@ int __meminit vmemmap_populate(struct page *start, unsigned long nr, int node)
434 +
435 + *vmem_pp = pte_base | __pa(block);
436 +
437 +- printk(KERN_INFO "[%p-%p] page_structs=%lu "
438 +- "node=%d entry=%lu/%lu\n", start, block, nr,
439 +- node,
440 +- addr >> VMEMMAP_CHUNK_SHIFT,
441 +- VMEMMAP_SIZE);
442 ++ /* check to see if we have contiguous blocks */
443 ++ if (addr_end != addr || node_start != node) {
444 ++ if (addr_start)
445 ++ printk(KERN_DEBUG " [%lx-%lx] on node %d\n",
446 ++ addr_start, addr_end-1, node_start);
447 ++ addr_start = addr;
448 ++ node_start = node;
449 ++ }
450 ++ addr_end = addr + VMEMMAP_CHUNK;
451 + }
452 + }
453 + return 0;
454 + }
455 ++
456 ++void __meminit vmemmap_populate_print_last(void)
457 ++{
458 ++ if (addr_start) {
459 ++ printk(KERN_DEBUG " [%lx-%lx] on node %d\n",
460 ++ addr_start, addr_end-1, node_start);
461 ++ addr_start = 0;
462 ++ addr_end = 0;
463 ++ node_start = 0;
464 ++ }
465 ++}
466 + #endif /* CONFIG_SPARSEMEM_VMEMMAP */
467 +
468 + static void prot_init_common(unsigned long page_none,
469 +diff --git a/arch/tile/Makefile b/arch/tile/Makefile
470 +index 17acce7..04c637c 100644
471 +--- a/arch/tile/Makefile
472 ++++ b/arch/tile/Makefile
473 +@@ -26,6 +26,10 @@ $(error Set TILERA_ROOT or CROSS_COMPILE when building $(ARCH) on $(HOST_ARCH))
474 + endif
475 + endif
476 +
477 ++# The tile compiler may emit .eh_frame information for backtracing.
478 ++# In kernel modules, this causes load failures due to unsupported relocations.
479 ++KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
480 ++
481 + ifneq ($(CONFIG_DEBUG_EXTRA_FLAGS),"")
482 + KBUILD_CFLAGS += $(CONFIG_DEBUG_EXTRA_FLAGS)
483 + endif
484 +diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
485 +index bcda816..4893d58 100644
486 +--- a/arch/x86/kernel/entry_32.S
487 ++++ b/arch/x86/kernel/entry_32.S
488 +@@ -1025,7 +1025,7 @@ ENTRY(xen_sysenter_target)
489 +
490 + ENTRY(xen_hypervisor_callback)
491 + CFI_STARTPROC
492 +- pushl_cfi $0
493 ++ pushl_cfi $-1 /* orig_ax = -1 => not a system call */
494 + SAVE_ALL
495 + TRACE_IRQS_OFF
496 +
497 +@@ -1067,14 +1067,16 @@ ENTRY(xen_failsafe_callback)
498 + 2: mov 8(%esp),%es
499 + 3: mov 12(%esp),%fs
500 + 4: mov 16(%esp),%gs
501 ++ /* EAX == 0 => Category 1 (Bad segment)
502 ++ EAX != 0 => Category 2 (Bad IRET) */
503 + testl %eax,%eax
504 + popl_cfi %eax
505 + lea 16(%esp),%esp
506 + CFI_ADJUST_CFA_OFFSET -16
507 + jz 5f
508 + addl $16,%esp
509 +- jmp iret_exc # EAX != 0 => Category 2 (Bad IRET)
510 +-5: pushl_cfi $0 # EAX == 0 => Category 1 (Bad segment)
511 ++ jmp iret_exc
512 ++5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */
513 + SAVE_ALL
514 + jmp ret_from_exception
515 + CFI_ENDPROC
516 +diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
517 +index faf8d5e..6274f5f 100644
518 +--- a/arch/x86/kernel/entry_64.S
519 ++++ b/arch/x86/kernel/entry_64.S
520 +@@ -1303,7 +1303,7 @@ ENTRY(xen_failsafe_callback)
521 + CFI_RESTORE r11
522 + addq $0x30,%rsp
523 + CFI_ADJUST_CFA_OFFSET -0x30
524 +- pushq_cfi $0
525 ++ pushq_cfi $-1 /* orig_ax = -1 => not a system call */
526 + SAVE_ALL
527 + jmp error_exit
528 + CFI_ENDPROC
529 +diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
530 +index 75f9528..6bc0899 100644
531 +--- a/arch/x86/oprofile/nmi_int.c
532 ++++ b/arch/x86/oprofile/nmi_int.c
533 +@@ -55,7 +55,7 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
534 + val |= counter_config->extra;
535 + event &= model->event_mask ? model->event_mask : 0xFF;
536 + val |= event & 0xFF;
537 +- val |= (event & 0x0F00) << 24;
538 ++ val |= (u64)(event & 0x0F00) << 24;
539 +
540 + return val;
541 + }
542 +diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
543 +index a1e21ae..69b9ef6 100644
544 +--- a/arch/x86/xen/enlighten.c
545 ++++ b/arch/x86/xen/enlighten.c
546 +@@ -818,7 +818,16 @@ static void xen_write_cr4(unsigned long cr4)
547 +
548 + native_write_cr4(cr4);
549 + }
550 +-
551 ++#ifdef CONFIG_X86_64
552 ++static inline unsigned long xen_read_cr8(void)
553 ++{
554 ++ return 0;
555 ++}
556 ++static inline void xen_write_cr8(unsigned long val)
557 ++{
558 ++ BUG_ON(val);
559 ++}
560 ++#endif
561 + static int xen_write_msr_safe(unsigned int msr, unsigned low, unsigned high)
562 + {
563 + int ret;
564 +@@ -987,6 +996,11 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
565 + .read_cr4_safe = native_read_cr4_safe,
566 + .write_cr4 = xen_write_cr4,
567 +
568 ++#ifdef CONFIG_X86_64
569 ++ .read_cr8 = xen_read_cr8,
570 ++ .write_cr8 = xen_write_cr8,
571 ++#endif
572 ++
573 + .wbinvd = native_wbinvd,
574 +
575 + .read_msr = native_read_msr_safe,
576 +@@ -997,6 +1011,8 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
577 + .read_tsc = native_read_tsc,
578 + .read_pmc = native_read_pmc,
579 +
580 ++ .read_tscp = native_read_tscp,
581 ++
582 + .iret = xen_iret,
583 + .irq_enable_sysexit = xen_sysexit,
584 + #ifdef CONFIG_X86_64
585 +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
586 +index b19a18d..d2519b2 100644
587 +--- a/drivers/acpi/ec.c
588 ++++ b/drivers/acpi/ec.c
589 +@@ -71,9 +71,6 @@ enum ec_command {
590 + #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
591 + #define ACPI_EC_MSI_UDELAY 550 /* Wait 550us for MSI EC */
592 +
593 +-#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
594 +- per one transaction */
595 +-
596 + enum {
597 + EC_FLAGS_QUERY_PENDING, /* Query is pending */
598 + EC_FLAGS_GPE_STORM, /* GPE storm detected */
599 +@@ -87,6 +84,15 @@ static unsigned int ec_delay __read_mostly = ACPI_EC_DELAY;
600 + module_param(ec_delay, uint, 0644);
601 + MODULE_PARM_DESC(ec_delay, "Timeout(ms) waited until an EC command completes");
602 +
603 ++/*
604 ++ * If the number of false interrupts per one transaction exceeds
605 ++ * this threshold, will think there is a GPE storm happened and
606 ++ * will disable the GPE for normal transaction.
607 ++ */
608 ++static unsigned int ec_storm_threshold __read_mostly = 8;
609 ++module_param(ec_storm_threshold, uint, 0644);
610 ++MODULE_PARM_DESC(ec_storm_threshold, "Maxim false GPE numbers not considered as GPE storm");
611 ++
612 + /* If we find an EC via the ECDT, we need to keep a ptr to its context */
613 + /* External interfaces use first EC only, so remember */
614 + typedef int (*acpi_ec_query_func) (void *data);
615 +@@ -319,7 +325,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
616 + msleep(1);
617 + /* It is safe to enable the GPE outside of the transaction. */
618 + acpi_enable_gpe(NULL, ec->gpe);
619 +- } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
620 ++ } else if (t->irq_count > ec_storm_threshold) {
621 + pr_info(PREFIX "GPE storm detected, "
622 + "transactions will use polling mode\n");
623 + set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
624 +@@ -914,6 +920,17 @@ static int ec_flag_msi(const struct dmi_system_id *id)
625 + return 0;
626 + }
627 +
628 ++/*
629 ++ * Clevo M720 notebook actually works ok with IRQ mode, if we lifted
630 ++ * the GPE storm threshold back to 20
631 ++ */
632 ++static int ec_enlarge_storm_threshold(const struct dmi_system_id *id)
633 ++{
634 ++ pr_debug("Setting the EC GPE storm threshold to 20\n");
635 ++ ec_storm_threshold = 20;
636 ++ return 0;
637 ++}
638 ++
639 + static struct dmi_system_id __initdata ec_dmi_table[] = {
640 + {
641 + ec_skip_dsdt_scan, "Compal JFL92", {
642 +@@ -945,10 +962,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
643 + {
644 + ec_validate_ecdt, "ASUS hardware", {
645 + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc.") }, NULL},
646 ++ {
647 ++ ec_enlarge_storm_threshold, "CLEVO hardware", {
648 ++ DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
649 ++ DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
650 + {},
651 + };
652 +
653 +-
654 + int __init acpi_ec_ecdt_probe(void)
655 + {
656 + acpi_status status;
657 +diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
658 +index 10f92b3..7a987a7 100644
659 +--- a/drivers/bcma/main.c
660 ++++ b/drivers/bcma/main.c
661 +@@ -124,9 +124,10 @@ static int bcma_register_cores(struct bcma_bus *bus)
662 +
663 + static void bcma_unregister_cores(struct bcma_bus *bus)
664 + {
665 +- struct bcma_device *core;
666 ++ struct bcma_device *core, *tmp;
667 +
668 +- list_for_each_entry(core, &bus->cores, list) {
669 ++ list_for_each_entry_safe(core, tmp, &bus->cores, list) {
670 ++ list_del(&core->list);
671 + if (core->dev_registered)
672 + device_unregister(&core->dev);
673 + }
674 +diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
675 +index b366b34..0d91655 100644
676 +--- a/drivers/char/tpm/tpm.c
677 ++++ b/drivers/char/tpm/tpm.c
678 +@@ -1072,17 +1072,20 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
679 + size_t size, loff_t *off)
680 + {
681 + struct tpm_chip *chip = file->private_data;
682 +- size_t in_size = size, out_size;
683 ++ size_t in_size = size;
684 ++ ssize_t out_size;
685 +
686 + /* cannot perform a write until the read has cleared
687 +- either via tpm_read or a user_read_timer timeout */
688 +- while (atomic_read(&chip->data_pending) != 0)
689 +- msleep(TPM_TIMEOUT);
690 +-
691 +- mutex_lock(&chip->buffer_mutex);
692 ++ either via tpm_read or a user_read_timer timeout.
693 ++ This also prevents splitted buffered writes from blocking here.
694 ++ */
695 ++ if (atomic_read(&chip->data_pending) != 0)
696 ++ return -EBUSY;
697 +
698 + if (in_size > TPM_BUFSIZE)
699 +- in_size = TPM_BUFSIZE;
700 ++ return -E2BIG;
701 ++
702 ++ mutex_lock(&chip->buffer_mutex);
703 +
704 + if (copy_from_user
705 + (chip->data_buffer, (void __user *) buf, in_size)) {
706 +@@ -1092,6 +1095,10 @@ ssize_t tpm_write(struct file *file, const char __user *buf,
707 +
708 + /* atomic tpm command send and result receive */
709 + out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
710 ++ if (out_size < 0) {
711 ++ mutex_unlock(&chip->buffer_mutex);
712 ++ return out_size;
713 ++ }
714 +
715 + atomic_set(&chip->data_pending, out_size);
716 + mutex_unlock(&chip->buffer_mutex);
717 +diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
718 +index b7fe343..f6cd315 100644
719 +--- a/drivers/cpufreq/powernow-k8.c
720 ++++ b/drivers/cpufreq/powernow-k8.c
721 +@@ -1216,14 +1216,7 @@ static int powernowk8_target(struct cpufreq_policy *pol,
722 + struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq,
723 + .relation = relation };
724 +
725 +- /*
726 +- * Must run on @pol->cpu. cpufreq core is responsible for ensuring
727 +- * that we're bound to the current CPU and pol->cpu stays online.
728 +- */
729 +- if (smp_processor_id() == pol->cpu)
730 +- return powernowk8_target_fn(&pta);
731 +- else
732 +- return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
733 ++ return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
734 + }
735 +
736 + /* Driver entry point to verify the policy and range of frequencies */
737 +diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
738 +index c9eee6d..a9d5482 100644
739 +--- a/drivers/edac/amd64_edac.c
740 ++++ b/drivers/edac/amd64_edac.c
741 +@@ -170,8 +170,11 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)
742 + * memory controller and apply to register. Search for the first
743 + * bandwidth entry that is greater or equal than the setting requested
744 + * and program that. If at last entry, turn off DRAM scrubbing.
745 ++ *
746 ++ * If no suitable bandwidth is found, turn off DRAM scrubbing entirely
747 ++ * by falling back to the last element in scrubrates[].
748 + */
749 +- for (i = 0; i < ARRAY_SIZE(scrubrates); i++) {
750 ++ for (i = 0; i < ARRAY_SIZE(scrubrates) - 1; i++) {
751 + /*
752 + * skip scrub rates which aren't recommended
753 + * (see F10 BKDG, F3x58)
754 +@@ -181,12 +184,6 @@ static int __amd64_set_scrub_rate(struct pci_dev *ctl, u32 new_bw, u32 min_rate)
755 +
756 + if (scrubrates[i].bandwidth <= new_bw)
757 + break;
758 +-
759 +- /*
760 +- * if no suitable bandwidth found, turn off DRAM scrubbing
761 +- * entirely by falling back to the last element in the
762 +- * scrubrates array.
763 +- */
764 + }
765 +
766 + scrubval = scrubrates[i].scrubval;
767 +diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
768 +index 33e1555..dbe4dbe 100644
769 +--- a/drivers/gpu/drm/i915/i915_gem.c
770 ++++ b/drivers/gpu/drm/i915/i915_gem.c
771 +@@ -999,6 +999,7 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
772 + if (obj->phys_obj)
773 + ret = i915_gem_phys_pwrite(dev, obj, args, file);
774 + else if (obj->gtt_space &&
775 ++ obj->tiling_mode == I915_TILING_NONE &&
776 + obj->base.write_domain != I915_GEM_DOMAIN_CPU) {
777 + ret = i915_gem_object_pin(obj, 0, true);
778 + if (ret)
779 +diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
780 +index f07bde2..57152a7 100644
781 +--- a/drivers/gpu/drm/i915/intel_lvds.c
782 ++++ b/drivers/gpu/drm/i915/intel_lvds.c
783 +@@ -771,6 +771,14 @@ static const struct dmi_system_id intel_no_lvds[] = {
784 + DMI_MATCH(DMI_BOARD_NAME, "MS-7469"),
785 + },
786 + },
787 ++ {
788 ++ .callback = intel_no_lvds_dmi_callback,
789 ++ .ident = "ZOTAC ZBOXSD-ID12/ID13",
790 ++ .matches = {
791 ++ DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"),
792 ++ DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"),
793 ++ },
794 ++ },
795 +
796 + { } /* terminating entry */
797 + };
798 +diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
799 +index 2f46e0c..3ad3cc6 100644
800 +--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
801 ++++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
802 +@@ -973,11 +973,7 @@ static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder,
803 + static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
804 + {
805 + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
806 +- struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv;
807 +- if (tmds) {
808 +- if (tmds->i2c_bus)
809 +- radeon_i2c_destroy(tmds->i2c_bus);
810 +- }
811 ++ /* don't destroy the i2c bus record here, this will be done in radeon_i2c_fini */
812 + kfree(radeon_encoder->enc_priv);
813 + drm_encoder_cleanup(encoder);
814 + kfree(radeon_encoder);
815 +diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
816 +index 4065374..f4c3d28 100644
817 +--- a/drivers/hv/channel.c
818 ++++ b/drivers/hv/channel.c
819 +@@ -146,14 +146,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
820 +
821 + if (ret != 0) {
822 + err = ret;
823 +- goto errorout;
824 ++ goto error0;
825 + }
826 +
827 + ret = hv_ringbuffer_init(
828 + &newchannel->inbound, in, recv_ringbuffer_size);
829 + if (ret != 0) {
830 + err = ret;
831 +- goto errorout;
832 ++ goto error0;
833 + }
834 +
835 +
836 +@@ -168,7 +168,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
837 +
838 + if (ret != 0) {
839 + err = ret;
840 +- goto errorout;
841 ++ goto error0;
842 + }
843 +
844 + /* Create and init the channel open message */
845 +@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
846 + GFP_KERNEL);
847 + if (!open_info) {
848 + err = -ENOMEM;
849 +- goto errorout;
850 ++ goto error0;
851 + }
852 +
853 + init_completion(&open_info->waitevent);
854 +@@ -193,7 +193,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
855 +
856 + if (userdatalen > MAX_USER_DEFINED_BYTES) {
857 + err = -EINVAL;
858 +- goto errorout;
859 ++ goto error0;
860 + }
861 +
862 + if (userdatalen)
863 +@@ -208,19 +208,18 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
864 + sizeof(struct vmbus_channel_open_channel));
865 +
866 + if (ret != 0)
867 +- goto cleanup;
868 ++ goto error1;
869 +
870 + t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ);
871 + if (t == 0) {
872 + err = -ETIMEDOUT;
873 +- goto errorout;
874 ++ goto error1;
875 + }
876 +
877 +
878 + if (open_info->response.open_result.status)
879 + err = open_info->response.open_result.status;
880 +
881 +-cleanup:
882 + spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
883 + list_del(&open_info->msglistentry);
884 + spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
885 +@@ -228,9 +227,12 @@ cleanup:
886 + kfree(open_info);
887 + return err;
888 +
889 +-errorout:
890 +- hv_ringbuffer_cleanup(&newchannel->outbound);
891 +- hv_ringbuffer_cleanup(&newchannel->inbound);
892 ++error1:
893 ++ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
894 ++ list_del(&open_info->msglistentry);
895 ++ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
896 ++
897 ++error0:
898 + free_pages((unsigned long)out,
899 + get_order(send_ringbuffer_size + recv_ringbuffer_size));
900 + kfree(open_info);
901 +diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
902 +index 0634ee5..8f67c4d 100644
903 +--- a/drivers/md/raid10.c
904 ++++ b/drivers/md/raid10.c
905 +@@ -2641,7 +2641,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr,
906 + else {
907 + bad_sectors -= (sector - first_bad);
908 + if (max_sync > bad_sectors)
909 +- max_sync = max_sync;
910 ++ max_sync = bad_sectors;
911 + continue;
912 + }
913 + }
914 +diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
915 +index 0b3e481..eab0641 100644
916 +--- a/drivers/media/video/au0828/au0828-video.c
917 ++++ b/drivers/media/video/au0828/au0828-video.c
918 +@@ -1692,14 +1692,18 @@ static int vidioc_streamoff(struct file *file, void *priv,
919 + (AUVI_INPUT(i).audio_setup)(dev, 0);
920 + }
921 +
922 +- videobuf_streamoff(&fh->vb_vidq);
923 +- res_free(fh, AU0828_RESOURCE_VIDEO);
924 ++ if (res_check(fh, AU0828_RESOURCE_VIDEO)) {
925 ++ videobuf_streamoff(&fh->vb_vidq);
926 ++ res_free(fh, AU0828_RESOURCE_VIDEO);
927 ++ }
928 + } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) {
929 + dev->vbi_timeout_running = 0;
930 + del_timer_sync(&dev->vbi_timeout);
931 +
932 +- videobuf_streamoff(&fh->vb_vbiq);
933 +- res_free(fh, AU0828_RESOURCE_VBI);
934 ++ if (res_check(fh, AU0828_RESOURCE_VBI)) {
935 ++ videobuf_streamoff(&fh->vb_vbiq);
936 ++ res_free(fh, AU0828_RESOURCE_VBI);
937 ++ }
938 + }
939 +
940 + return 0;
941 +diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
942 +index 3ed9c5e..daed698 100644
943 +--- a/drivers/mtd/nand/nand_base.c
944 ++++ b/drivers/mtd/nand/nand_base.c
945 +@@ -2903,9 +2903,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
946 + if (le16_to_cpu(p->features) & 1)
947 + *busw = NAND_BUSWIDTH_16;
948 +
949 +- chip->options &= ~NAND_CHIPOPTIONS_MSK;
950 +- chip->options |= (NAND_NO_READRDY |
951 +- NAND_NO_AUTOINCR) & NAND_CHIPOPTIONS_MSK;
952 ++ chip->options |= NAND_NO_READRDY | NAND_NO_AUTOINCR;
953 +
954 + return 1;
955 + }
956 +@@ -3069,9 +3067,8 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
957 + mtd->erasesize <<= ((id_data[3] & 0x03) << 1);
958 + }
959 + }
960 +- /* Get chip options, preserve non chip based options */
961 +- chip->options &= ~NAND_CHIPOPTIONS_MSK;
962 +- chip->options |= type->options & NAND_CHIPOPTIONS_MSK;
963 ++ /* Get chip options */
964 ++ chip->options |= type->options;
965 +
966 + /*
967 + * Check if chip is not a Samsung device. Do not clear the
968 +diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
969 +index c5f6b0e..6546191 100644
970 +--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
971 ++++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
972 +@@ -168,6 +168,8 @@ static int e1000_82547_fifo_workaround(struct e1000_adapter *adapter,
973 +
974 + static bool e1000_vlan_used(struct e1000_adapter *adapter);
975 + static void e1000_vlan_mode(struct net_device *netdev, u32 features);
976 ++static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
977 ++ bool filter_on);
978 + static void e1000_vlan_rx_add_vid(struct net_device *netdev, u16 vid);
979 + static void e1000_vlan_rx_kill_vid(struct net_device *netdev, u16 vid);
980 + static void e1000_restore_vlan(struct e1000_adapter *adapter);
981 +@@ -1219,7 +1221,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
982 + if (err)
983 + goto err_register;
984 +
985 +- e1000_vlan_mode(netdev, netdev->features);
986 ++ e1000_vlan_filter_on_off(adapter, false);
987 +
988 + /* print bus type/speed/width info */
989 + e_info(probe, "(PCI%s:%dMHz:%d-bit) %pM\n",
990 +@@ -4553,6 +4555,21 @@ static bool e1000_vlan_used(struct e1000_adapter *adapter)
991 + return false;
992 + }
993 +
994 ++static void __e1000_vlan_mode(struct e1000_adapter *adapter, u32 features)
995 ++{
996 ++ struct e1000_hw *hw = &adapter->hw;
997 ++ u32 ctrl;
998 ++
999 ++ ctrl = er32(CTRL);
1000 ++ if (features & NETIF_F_HW_VLAN_RX) {
1001 ++ /* enable VLAN tag insert/strip */
1002 ++ ctrl |= E1000_CTRL_VME;
1003 ++ } else {
1004 ++ /* disable VLAN tag insert/strip */
1005 ++ ctrl &= ~E1000_CTRL_VME;
1006 ++ }
1007 ++ ew32(CTRL, ctrl);
1008 ++}
1009 + static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
1010 + bool filter_on)
1011 + {
1012 +@@ -4562,6 +4579,7 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
1013 + if (!test_bit(__E1000_DOWN, &adapter->flags))
1014 + e1000_irq_disable(adapter);
1015 +
1016 ++ __e1000_vlan_mode(adapter, adapter->netdev->features);
1017 + if (filter_on) {
1018 + /* enable VLAN receive filtering */
1019 + rctl = er32(RCTL);
1020 +@@ -4584,21 +4602,11 @@ static void e1000_vlan_filter_on_off(struct e1000_adapter *adapter,
1021 + static void e1000_vlan_mode(struct net_device *netdev, u32 features)
1022 + {
1023 + struct e1000_adapter *adapter = netdev_priv(netdev);
1024 +- struct e1000_hw *hw = &adapter->hw;
1025 +- u32 ctrl;
1026 +
1027 + if (!test_bit(__E1000_DOWN, &adapter->flags))
1028 + e1000_irq_disable(adapter);
1029 +
1030 +- ctrl = er32(CTRL);
1031 +- if (features & NETIF_F_HW_VLAN_RX) {
1032 +- /* enable VLAN tag insert/strip */
1033 +- ctrl |= E1000_CTRL_VME;
1034 +- } else {
1035 +- /* disable VLAN tag insert/strip */
1036 +- ctrl &= ~E1000_CTRL_VME;
1037 +- }
1038 +- ew32(CTRL, ctrl);
1039 ++ __e1000_vlan_mode(adapter, features);
1040 +
1041 + if (!test_bit(__E1000_DOWN, &adapter->flags))
1042 + e1000_irq_enable(adapter);
1043 +diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
1044 +index dea0cb4..57be855 100644
1045 +--- a/drivers/net/ethernet/marvell/skge.c
1046 ++++ b/drivers/net/ethernet/marvell/skge.c
1047 +@@ -4143,6 +4143,13 @@ static struct dmi_system_id skge_32bit_dma_boards[] = {
1048 + DMI_MATCH(DMI_BOARD_NAME, "nForce"),
1049 + },
1050 + },
1051 ++ {
1052 ++ .ident = "ASUS P5NSLI",
1053 ++ .matches = {
1054 ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1055 ++ DMI_MATCH(DMI_BOARD_NAME, "P5NSLI")
1056 ++ },
1057 ++ },
1058 + {}
1059 + };
1060 +
1061 +diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
1062 +index 026f9de..cc54153 100644
1063 +--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
1064 ++++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
1065 +@@ -835,107 +835,107 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
1066 +
1067 + static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
1068 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
1069 +- {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
1070 +- {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
1071 +- {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
1072 ++ {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
1073 ++ {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
1074 ++ {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
1075 + {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
1076 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
1077 + {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1078 + {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
1079 + {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
1080 + {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
1081 +- {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202},
1082 +- {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400},
1083 +- {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402},
1084 +- {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404},
1085 +- {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603},
1086 +- {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02},
1087 +- {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04},
1088 +- {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20},
1089 +- {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20},
1090 +- {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22},
1091 +- {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24},
1092 +- {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640},
1093 +- {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660},
1094 +- {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861},
1095 +- {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81},
1096 +- {0x0000a54c, 0x5a08442e, 0x5a08442e, 0x47001a83, 0x47001a83},
1097 +- {0x0000a550, 0x5e0a4431, 0x5e0a4431, 0x4a001c84, 0x4a001c84},
1098 +- {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3},
1099 +- {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5},
1100 +- {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9},
1101 +- {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb},
1102 +- {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1103 +- {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1104 +- {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1105 +- {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1106 +- {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1107 +- {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1108 +- {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
1109 ++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
1110 ++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
1111 ++ {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
1112 ++ {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
1113 ++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
1114 ++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
1115 ++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
1116 ++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
1117 ++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
1118 ++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
1119 ++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
1120 ++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
1121 ++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
1122 ++ {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861},
1123 ++ {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81},
1124 ++ {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83},
1125 ++ {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84},
1126 ++ {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3},
1127 ++ {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5},
1128 ++ {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9},
1129 ++ {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb},
1130 ++ {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1131 ++ {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1132 ++ {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1133 ++ {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1134 ++ {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1135 ++ {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1136 ++ {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
1137 + {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
1138 + {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
1139 + {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
1140 + {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
1141 +- {0x0000a590, 0x15800028, 0x15800028, 0x0f800202, 0x0f800202},
1142 +- {0x0000a594, 0x1b80002b, 0x1b80002b, 0x12800400, 0x12800400},
1143 +- {0x0000a598, 0x1f820028, 0x1f820028, 0x16800402, 0x16800402},
1144 +- {0x0000a59c, 0x2582002b, 0x2582002b, 0x19800404, 0x19800404},
1145 +- {0x0000a5a0, 0x2a84002a, 0x2a84002a, 0x1c800603, 0x1c800603},
1146 +- {0x0000a5a4, 0x2e86002a, 0x2e86002a, 0x21800a02, 0x21800a02},
1147 +- {0x0000a5a8, 0x3382202d, 0x3382202d, 0x25800a04, 0x25800a04},
1148 +- {0x0000a5ac, 0x3884202c, 0x3884202c, 0x28800a20, 0x28800a20},
1149 +- {0x0000a5b0, 0x3c86202c, 0x3c86202c, 0x2c800e20, 0x2c800e20},
1150 +- {0x0000a5b4, 0x4188202d, 0x4188202d, 0x30800e22, 0x30800e22},
1151 +- {0x0000a5b8, 0x4586402d, 0x4586402d, 0x34800e24, 0x34800e24},
1152 +- {0x0000a5bc, 0x4986222d, 0x4986222d, 0x38801640, 0x38801640},
1153 +- {0x0000a5c0, 0x4d862231, 0x4d862231, 0x3c801660, 0x3c801660},
1154 +- {0x0000a5c4, 0x50882231, 0x50882231, 0x3f801861, 0x3f801861},
1155 +- {0x0000a5c8, 0x5688422e, 0x5688422e, 0x43801a81, 0x43801a81},
1156 +- {0x0000a5cc, 0x5a88442e, 0x5a88442e, 0x47801a83, 0x47801a83},
1157 +- {0x0000a5d0, 0x5e8a4431, 0x5e8a4431, 0x4a801c84, 0x4a801c84},
1158 +- {0x0000a5d4, 0x648a4432, 0x648a4432, 0x4e801ce3, 0x4e801ce3},
1159 +- {0x0000a5d8, 0x688a4434, 0x688a4434, 0x52801ce5, 0x52801ce5},
1160 +- {0x0000a5dc, 0x6c8a6434, 0x6c8a6434, 0x56801ce9, 0x56801ce9},
1161 +- {0x0000a5e0, 0x6f8a6633, 0x6f8a6633, 0x5a801ceb, 0x5a801ceb},
1162 +- {0x0000a5e4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1163 +- {0x0000a5e8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1164 +- {0x0000a5ec, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1165 +- {0x0000a5f0, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1166 +- {0x0000a5f4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1167 +- {0x0000a5f8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1168 +- {0x0000a5fc, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
1169 ++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
1170 ++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
1171 ++ {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
1172 ++ {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
1173 ++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
1174 ++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
1175 ++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
1176 ++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
1177 ++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
1178 ++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
1179 ++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
1180 ++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
1181 ++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
1182 ++ {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861},
1183 ++ {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81},
1184 ++ {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83},
1185 ++ {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84},
1186 ++ {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3},
1187 ++ {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5},
1188 ++ {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9},
1189 ++ {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb},
1190 ++ {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1191 ++ {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1192 ++ {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1193 ++ {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1194 ++ {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1195 ++ {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1196 ++ {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
1197 + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1198 + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1199 +- {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
1200 +- {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
1201 +- {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
1202 +- {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000},
1203 +- {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501},
1204 +- {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501},
1205 +- {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03},
1206 +- {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
1207 +- {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04},
1208 +- {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
1209 +- {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
1210 +- {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
1211 +- {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
1212 +- {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
1213 +- {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
1214 +- {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
1215 +- {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
1216 ++ {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1217 ++ {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1218 ++ {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
1219 ++ {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000},
1220 ++ {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501},
1221 ++ {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501},
1222 ++ {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03},
1223 ++ {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04},
1224 ++ {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04},
1225 ++ {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
1226 ++ {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
1227 ++ {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
1228 ++ {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
1229 ++ {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
1230 ++ {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
1231 ++ {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
1232 ++ {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
1233 + {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
1234 +- {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
1235 +- {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
1236 +- {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
1237 ++ {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
1238 ++ {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
1239 ++ {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
1240 + {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
1241 + {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
1242 +- {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
1243 ++ {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
1244 + {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
1245 + {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
1246 +- {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
1247 ++ {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
1248 + {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
1249 + {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
1250 +- {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
1251 ++ {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
1252 + {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
1253 + };
1254 +
1255 +diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
1256 +index 56bd370..da567f0 100644
1257 +--- a/drivers/net/wireless/ipw2x00/ipw2200.c
1258 ++++ b/drivers/net/wireless/ipw2x00/ipw2200.c
1259 +@@ -10463,7 +10463,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
1260 + } else
1261 + len = src->len;
1262 +
1263 +- dst = alloc_skb(len + sizeof(*rt_hdr), GFP_ATOMIC);
1264 ++ dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC);
1265 + if (!dst)
1266 + continue;
1267 +
1268 +diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
1269 +index 9b6b010..4ac4ef0 100644
1270 +--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
1271 ++++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
1272 +@@ -193,7 +193,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
1273 + * See iwlagn_mac_channel_switch.
1274 + */
1275 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
1276 +- struct iwl6000_channel_switch_cmd cmd;
1277 ++ struct iwl6000_channel_switch_cmd *cmd;
1278 + const struct iwl_channel_info *ch_info;
1279 + u32 switch_time_in_usec, ucode_switch_time;
1280 + u16 ch;
1281 +@@ -203,18 +203,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
1282 + struct ieee80211_vif *vif = ctx->vif;
1283 + struct iwl_host_cmd hcmd = {
1284 + .id = REPLY_CHANNEL_SWITCH,
1285 +- .len = { sizeof(cmd), },
1286 ++ .len = { sizeof(*cmd), },
1287 + .flags = CMD_SYNC,
1288 +- .data = { &cmd, },
1289 ++ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
1290 + };
1291 ++ int err;
1292 +
1293 +- cmd.band = priv->band == IEEE80211_BAND_2GHZ;
1294 ++ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
1295 ++ if (!cmd)
1296 ++ return -ENOMEM;
1297 ++
1298 ++ hcmd.data[0] = cmd;
1299 ++
1300 ++ cmd->band = priv->band == IEEE80211_BAND_2GHZ;
1301 + ch = ch_switch->channel->hw_value;
1302 + IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
1303 + ctx->active.channel, ch);
1304 +- cmd.channel = cpu_to_le16(ch);
1305 +- cmd.rxon_flags = ctx->staging.flags;
1306 +- cmd.rxon_filter_flags = ctx->staging.filter_flags;
1307 ++ cmd->channel = cpu_to_le16(ch);
1308 ++ cmd->rxon_flags = ctx->staging.flags;
1309 ++ cmd->rxon_filter_flags = ctx->staging.filter_flags;
1310 + switch_count = ch_switch->count;
1311 + tsf_low = ch_switch->timestamp & 0x0ffffffff;
1312 + /*
1313 +@@ -230,30 +237,32 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
1314 + switch_count = 0;
1315 + }
1316 + if (switch_count <= 1)
1317 +- cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
1318 ++ cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time);
1319 + else {
1320 + switch_time_in_usec =
1321 + vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
1322 + ucode_switch_time = iwl_usecs_to_beacons(priv,
1323 + switch_time_in_usec,
1324 + beacon_interval);
1325 +- cmd.switch_time = iwl_add_beacon_time(priv,
1326 +- priv->ucode_beacon_time,
1327 +- ucode_switch_time,
1328 +- beacon_interval);
1329 ++ cmd->switch_time = iwl_add_beacon_time(priv,
1330 ++ priv->ucode_beacon_time,
1331 ++ ucode_switch_time,
1332 ++ beacon_interval);
1333 + }
1334 + IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
1335 +- cmd.switch_time);
1336 ++ cmd->switch_time);
1337 + ch_info = iwl_get_channel_info(priv, priv->band, ch);
1338 + if (ch_info)
1339 +- cmd.expect_beacon = is_channel_radar(ch_info);
1340 ++ cmd->expect_beacon = is_channel_radar(ch_info);
1341 + else {
1342 + IWL_ERR(priv, "invalid channel switch from %u to %u\n",
1343 + ctx->active.channel, ch);
1344 + return -EFAULT;
1345 + }
1346 +
1347 +- return iwl_trans_send_cmd(trans(priv), &hcmd);
1348 ++ err = iwl_trans_send_cmd(trans(priv), &hcmd);
1349 ++ kfree(cmd);
1350 ++ return err;
1351 + }
1352 +
1353 + static struct iwl_lib_ops iwl6000_lib = {
1354 +diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
1355 +index 69ae2fd..b938163 100644
1356 +--- a/drivers/pcmcia/pxa2xx_sharpsl.c
1357 ++++ b/drivers/pcmcia/pxa2xx_sharpsl.c
1358 +@@ -219,7 +219,7 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
1359 + sharpsl_pcmcia_init_reset(skt);
1360 + }
1361 +
1362 +-static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = {
1363 ++static struct pcmcia_low_level sharpsl_pcmcia_ops = {
1364 + .owner = THIS_MODULE,
1365 + .hw_init = sharpsl_pcmcia_hw_init,
1366 + .hw_shutdown = sharpsl_pcmcia_hw_shutdown,
1367 +diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
1368 +index af1e296..21bc1a7 100644
1369 +--- a/drivers/platform/x86/samsung-laptop.c
1370 ++++ b/drivers/platform/x86/samsung-laptop.c
1371 +@@ -21,6 +21,7 @@
1372 + #include <linux/dmi.h>
1373 + #include <linux/platform_device.h>
1374 + #include <linux/rfkill.h>
1375 ++#include <linux/acpi.h>
1376 +
1377 + /*
1378 + * This driver is needed because a number of Samsung laptops do not hook
1379 +@@ -226,6 +227,7 @@ static struct backlight_device *backlight_device;
1380 + static struct mutex sabi_mutex;
1381 + static struct platform_device *sdev;
1382 + static struct rfkill *rfk;
1383 ++static bool handle_backlight;
1384 + static bool has_stepping_quirk;
1385 +
1386 + static int force;
1387 +@@ -602,6 +604,13 @@ static int __init samsung_init(void)
1388 + int retval;
1389 +
1390 + mutex_init(&sabi_mutex);
1391 ++ handle_backlight = true;
1392 ++
1393 ++#ifdef CONFIG_ACPI
1394 ++ /* Don't handle backlight here if the acpi video already handle it */
1395 ++ if (acpi_video_backlight_support())
1396 ++ handle_backlight = false;
1397 ++#endif
1398 +
1399 + if (!force && !dmi_check_system(samsung_dmi_table))
1400 + return -ENODEV;
1401 +@@ -661,7 +670,8 @@ static int __init samsung_init(void)
1402 + printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
1403 + printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface);
1404 +
1405 +- test_backlight();
1406 ++ if (handle_backlight)
1407 ++ test_backlight();
1408 + test_wireless();
1409 +
1410 + retval = sabi_get_command(sabi_config->commands.get_brightness,
1411 +@@ -680,13 +690,23 @@ static int __init samsung_init(void)
1412 + }
1413 +
1414 + /* Check for stepping quirk */
1415 +- check_for_stepping_quirk();
1416 ++ if (handle_backlight)
1417 ++ check_for_stepping_quirk();
1418 ++
1419 ++#ifdef CONFIG_ACPI
1420 ++ /* Only log that if we are really on a sabi platform */
1421 ++ if (acpi_video_backlight_support())
1422 ++ pr_info("Backlight controlled by ACPI video driver\n");
1423 ++#endif
1424 +
1425 + /* knock up a platform device to hang stuff off of */
1426 + sdev = platform_device_register_simple("samsung", -1, NULL, 0);
1427 + if (IS_ERR(sdev))
1428 + goto error_no_platform;
1429 +
1430 ++ if (!handle_backlight)
1431 ++ goto skip_backlight;
1432 ++
1433 + /* create a backlight device to talk to this one */
1434 + memset(&props, 0, sizeof(struct backlight_properties));
1435 + props.type = BACKLIGHT_PLATFORM;
1436 +@@ -702,6 +722,7 @@ static int __init samsung_init(void)
1437 + backlight_device->props.power = FB_BLANK_UNBLANK;
1438 + backlight_update_status(backlight_device);
1439 +
1440 ++skip_backlight:
1441 + retval = init_wireless(sdev);
1442 + if (retval)
1443 + goto error_no_rfk;
1444 +diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
1445 +index d93a960..bc744b4 100644
1446 +--- a/drivers/rtc/rtc-imxdi.c
1447 ++++ b/drivers/rtc/rtc-imxdi.c
1448 +@@ -392,6 +392,8 @@ static int dryice_rtc_probe(struct platform_device *pdev)
1449 + if (imxdi->ioaddr == NULL)
1450 + return -ENOMEM;
1451 +
1452 ++ spin_lock_init(&imxdi->irq_lock);
1453 ++
1454 + imxdi->irq = platform_get_irq(pdev, 0);
1455 + if (imxdi->irq < 0)
1456 + return imxdi->irq;
1457 +diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
1458 +index 6888b2c..b3a729c 100644
1459 +--- a/drivers/scsi/scsi_debug.c
1460 ++++ b/drivers/scsi/scsi_debug.c
1461 +@@ -2045,8 +2045,7 @@ static void unmap_region(sector_t lba, unsigned int len)
1462 + block = lba + alignment;
1463 + rem = do_div(block, granularity);
1464 +
1465 +- if (rem == 0 && lba + granularity <= end &&
1466 +- block < map_size)
1467 ++ if (rem == 0 && lba + granularity < end && block < map_size)
1468 + clear_bit(block, map_storep);
1469 +
1470 + lba += granularity - rem;
1471 +diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
1472 +index 48246cd..b4311bf 100644
1473 +--- a/drivers/staging/comedi/drivers/amplc_pc236.c
1474 ++++ b/drivers/staging/comedi/drivers/amplc_pc236.c
1475 +@@ -470,7 +470,7 @@ static int pc236_detach(struct comedi_device *dev)
1476 + {
1477 + printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
1478 + PC236_DRIVER_NAME);
1479 +- if (devpriv)
1480 ++ if (dev->iobase)
1481 + pc236_intr_disable(dev);
1482 +
1483 + if (dev->irq)
1484 +diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
1485 +index ae8c33e..abc5ac5 100644
1486 +--- a/drivers/staging/hv/storvsc_drv.c
1487 ++++ b/drivers/staging/hv/storvsc_drv.c
1488 +@@ -1043,7 +1043,12 @@ static int storvsc_host_reset(struct hv_device *device)
1489 + /*
1490 + * At this point, all outstanding requests in the adapter
1491 + * should have been flushed out and return to us
1492 ++ * There is a potential race here where the host may be in
1493 ++ * the process of responding when we return from here.
1494 ++ * Just wait for all in-transit packets to be accounted for
1495 ++ * before we return from here.
1496 + */
1497 ++ storvsc_wait_to_drain(stor_device);
1498 +
1499 + cleanup:
1500 + return ret;
1501 +diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
1502 +index dbf7d20..df7f15d 100644
1503 +--- a/drivers/usb/class/cdc-acm.c
1504 ++++ b/drivers/usb/class/cdc-acm.c
1505 +@@ -760,10 +760,6 @@ static const __u32 acm_tty_speed[] = {
1506 + 2500000, 3000000, 3500000, 4000000
1507 + };
1508 +
1509 +-static const __u8 acm_tty_size[] = {
1510 +- 5, 6, 7, 8
1511 +-};
1512 +-
1513 + static void acm_tty_set_termios(struct tty_struct *tty,
1514 + struct ktermios *termios_old)
1515 + {
1516 +@@ -780,7 +776,21 @@ static void acm_tty_set_termios(struct tty_struct *tty,
1517 + newline.bParityType = termios->c_cflag & PARENB ?
1518 + (termios->c_cflag & PARODD ? 1 : 2) +
1519 + (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
1520 +- newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
1521 ++ switch (termios->c_cflag & CSIZE) {
1522 ++ case CS5:
1523 ++ newline.bDataBits = 5;
1524 ++ break;
1525 ++ case CS6:
1526 ++ newline.bDataBits = 6;
1527 ++ break;
1528 ++ case CS7:
1529 ++ newline.bDataBits = 7;
1530 ++ break;
1531 ++ case CS8:
1532 ++ default:
1533 ++ newline.bDataBits = 8;
1534 ++ break;
1535 ++ }
1536 + /* FIXME: Needs to clear unsupported bits in the termios */
1537 + acm->clocal = ((termios->c_cflag & CLOCAL) != 0);
1538 +
1539 +@@ -1172,7 +1182,7 @@ made_compressed_probe:
1540 +
1541 + if (usb_endpoint_xfer_int(epwrite))
1542 + usb_fill_int_urb(snd->urb, usb_dev,
1543 +- usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress),
1544 ++ usb_sndintpipe(usb_dev, epwrite->bEndpointAddress),
1545 + NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval);
1546 + else
1547 + usb_fill_bulk_urb(snd->urb, usb_dev,
1548 +@@ -1496,6 +1506,9 @@ static const struct usb_device_id acm_ids[] = {
1549 + Maybe we should define a new
1550 + quirk for this. */
1551 + },
1552 ++ { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
1553 ++ .driver_info = NO_UNION_NORMAL,
1554 ++ },
1555 + { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
1556 + .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
1557 + },
1558 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1559 +index 52340cc..a9a74d2 100644
1560 +--- a/drivers/usb/core/hub.c
1561 ++++ b/drivers/usb/core/hub.c
1562 +@@ -482,13 +482,16 @@ static void hub_tt_work(struct work_struct *work)
1563 + int limit = 100;
1564 +
1565 + spin_lock_irqsave (&hub->tt.lock, flags);
1566 +- while (--limit && !list_empty (&hub->tt.clear_list)) {
1567 ++ while (!list_empty(&hub->tt.clear_list)) {
1568 + struct list_head *next;
1569 + struct usb_tt_clear *clear;
1570 + struct usb_device *hdev = hub->hdev;
1571 + const struct hc_driver *drv;
1572 + int status;
1573 +
1574 ++ if (!hub->quiescing && --limit < 0)
1575 ++ break;
1576 ++
1577 + next = hub->tt.clear_list.next;
1578 + clear = list_entry (next, struct usb_tt_clear, clear_list);
1579 + list_del (&clear->clear_list);
1580 +@@ -952,7 +955,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
1581 + if (hub->has_indicators)
1582 + cancel_delayed_work_sync(&hub->leds);
1583 + if (hub->tt.hub)
1584 +- cancel_work_sync(&hub->tt.clear_work);
1585 ++ flush_work_sync(&hub->tt.clear_work);
1586 + }
1587 +
1588 + /* caller has locked the hub device */
1589 +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
1590 +index d0ec2f0..c2815a5 100644
1591 +--- a/drivers/usb/host/pci-quirks.c
1592 ++++ b/drivers/usb/host/pci-quirks.c
1593 +@@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = {
1594 + /* Pegatron Lucid (Ordissimo AIRIS) */
1595 + .matches = {
1596 + DMI_MATCH(DMI_BOARD_NAME, "M11JB"),
1597 +- DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"),
1598 ++ DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
1599 ++ },
1600 ++ },
1601 ++ {
1602 ++ /* Pegatron Lucid (Ordissimo) */
1603 ++ .matches = {
1604 ++ DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"),
1605 ++ DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
1606 + },
1607 + },
1608 + { }
1609 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1610 +index 950aef8..0c6fb19 100644
1611 +--- a/drivers/usb/host/xhci-ring.c
1612 ++++ b/drivers/usb/host/xhci-ring.c
1613 +@@ -1212,6 +1212,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd)
1614 + cur_seg = find_trb_seg(xhci->cmd_ring->first_seg,
1615 + xhci->cmd_ring->dequeue, &cycle_state);
1616 +
1617 ++ if (!cur_seg) {
1618 ++ xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n",
1619 ++ xhci->cmd_ring->dequeue,
1620 ++ (unsigned long long)
1621 ++ xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
1622 ++ xhci->cmd_ring->dequeue));
1623 ++ xhci_debug_ring(xhci, xhci->cmd_ring);
1624 ++ xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring);
1625 ++ return;
1626 ++ }
1627 ++
1628 + /* find the command trb matched by cd from command ring */
1629 + for (cmd_trb = xhci->cmd_ring->dequeue;
1630 + cmd_trb != xhci->cmd_ring->enqueue;
1631 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1632 +index f5c0f38..5a23f4d 100644
1633 +--- a/drivers/usb/host/xhci.c
1634 ++++ b/drivers/usb/host/xhci.c
1635 +@@ -471,7 +471,8 @@ static bool compliance_mode_recovery_timer_quirk_check(void)
1636 +
1637 + if (strstr(dmi_product_name, "Z420") ||
1638 + strstr(dmi_product_name, "Z620") ||
1639 +- strstr(dmi_product_name, "Z820"))
1640 ++ strstr(dmi_product_name, "Z820") ||
1641 ++ strstr(dmi_product_name, "Z1"))
1642 + return true;
1643 +
1644 + return false;
1645 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
1646 +index 42de17b..d3addb2 100644
1647 +--- a/drivers/usb/serial/mct_u232.c
1648 ++++ b/drivers/usb/serial/mct_u232.c
1649 +@@ -577,12 +577,14 @@ static void mct_u232_close(struct usb_serial_port *port)
1650 + {
1651 + dbg("%s port %d", __func__, port->number);
1652 +
1653 +- if (port->serial->dev) {
1654 +- /* shutdown our urbs */
1655 +- usb_kill_urb(port->write_urb);
1656 +- usb_kill_urb(port->read_urb);
1657 +- usb_kill_urb(port->interrupt_in_urb);
1658 +- }
1659 ++ /*
1660 ++ * Must kill the read urb as it is actually an interrupt urb, which
1661 ++ * generic close thus fails to kill.
1662 ++ */
1663 ++ usb_kill_urb(port->read_urb);
1664 ++ usb_kill_urb(port->interrupt_in_urb);
1665 ++
1666 ++ usb_serial_generic_close(port);
1667 + } /* mct_u232_close */
1668 +
1669 +
1670 +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
1671 +index b150ed9..d481f80 100644
1672 +--- a/drivers/usb/serial/mos7840.c
1673 ++++ b/drivers/usb/serial/mos7840.c
1674 +@@ -235,12 +235,10 @@ struct moschip_port {
1675 + int port_num; /*Actual port number in the device(1,2,etc) */
1676 + struct urb *write_urb; /* write URB for this port */
1677 + struct urb *read_urb; /* read URB for this port */
1678 +- struct urb *int_urb;
1679 + __u8 shadowLCR; /* last LCR value received */
1680 + __u8 shadowMCR; /* last MCR value received */
1681 + char open;
1682 + char open_ports;
1683 +- char zombie;
1684 + wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */
1685 + wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */
1686 + int delta_msr_cond;
1687 +@@ -505,7 +503,6 @@ static void mos7840_control_callback(struct urb *urb)
1688 + unsigned char *data;
1689 + struct moschip_port *mos7840_port;
1690 + __u8 regval = 0x0;
1691 +- int result = 0;
1692 + int status = urb->status;
1693 +
1694 + mos7840_port = urb->context;
1695 +@@ -524,7 +521,7 @@ static void mos7840_control_callback(struct urb *urb)
1696 + default:
1697 + dbg("%s - nonzero urb status received: %d", __func__,
1698 + status);
1699 +- goto exit;
1700 ++ return;
1701 + }
1702 +
1703 + dbg("%s urb buffer size is %d", __func__, urb->actual_length);
1704 +@@ -537,17 +534,6 @@ static void mos7840_control_callback(struct urb *urb)
1705 + mos7840_handle_new_msr(mos7840_port, regval);
1706 + else if (mos7840_port->MsrLsr == 1)
1707 + mos7840_handle_new_lsr(mos7840_port, regval);
1708 +-
1709 +-exit:
1710 +- spin_lock(&mos7840_port->pool_lock);
1711 +- if (!mos7840_port->zombie)
1712 +- result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC);
1713 +- spin_unlock(&mos7840_port->pool_lock);
1714 +- if (result) {
1715 +- dev_err(&urb->dev->dev,
1716 +- "%s - Error %d submitting interrupt urb\n",
1717 +- __func__, result);
1718 +- }
1719 + }
1720 +
1721 + static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
1722 +@@ -655,14 +641,7 @@ static void mos7840_interrupt_callback(struct urb *urb)
1723 + wreg = MODEM_STATUS_REGISTER;
1724 + break;
1725 + }
1726 +- spin_lock(&mos7840_port->pool_lock);
1727 +- if (!mos7840_port->zombie) {
1728 +- rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data);
1729 +- } else {
1730 +- spin_unlock(&mos7840_port->pool_lock);
1731 +- return;
1732 +- }
1733 +- spin_unlock(&mos7840_port->pool_lock);
1734 ++ rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data);
1735 + }
1736 + }
1737 + }
1738 +@@ -2594,7 +2573,6 @@ error:
1739 + kfree(mos7840_port->ctrl_buf);
1740 + usb_free_urb(mos7840_port->control_urb);
1741 + kfree(mos7840_port);
1742 +- serial->port[i] = NULL;
1743 + }
1744 + return status;
1745 + }
1746 +@@ -2625,9 +2603,6 @@ static void mos7840_disconnect(struct usb_serial *serial)
1747 + mos7840_port = mos7840_get_port_private(serial->port[i]);
1748 + dbg ("mos7840_port %d = %p", i, mos7840_port);
1749 + if (mos7840_port) {
1750 +- spin_lock_irqsave(&mos7840_port->pool_lock, flags);
1751 +- mos7840_port->zombie = 1;
1752 +- spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
1753 + usb_kill_urb(mos7840_port->control_urb);
1754 + }
1755 + }
1756 +@@ -2661,6 +2636,7 @@ static void mos7840_release(struct usb_serial *serial)
1757 + mos7840_port = mos7840_get_port_private(serial->port[i]);
1758 + dbg("mos7840_port %d = %p", i, mos7840_port);
1759 + if (mos7840_port) {
1760 ++ usb_free_urb(mos7840_port->control_urb);
1761 + kfree(mos7840_port->ctrl_buf);
1762 + kfree(mos7840_port->dr);
1763 + kfree(mos7840_port);
1764 +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
1765 +index c248a91..d6c5ed6 100644
1766 +--- a/drivers/usb/serial/opticon.c
1767 ++++ b/drivers/usb/serial/opticon.c
1768 +@@ -160,7 +160,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
1769 + {
1770 + struct usb_serial *serial = port->serial;
1771 + int retval;
1772 +- u8 buffer[2];
1773 ++ u8 *buffer;
1774 ++
1775 ++ buffer = kzalloc(1, GFP_KERNEL);
1776 ++ if (!buffer)
1777 ++ return -ENOMEM;
1778 +
1779 + buffer[0] = val;
1780 + /* Send the message to the vendor control endpoint
1781 +@@ -169,6 +173,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
1782 + requesttype,
1783 + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
1784 + 0, 0, buffer, 1, 0);
1785 ++ kfree(buffer);
1786 +
1787 + return retval;
1788 + }
1789 +@@ -292,7 +297,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
1790 + if (!dr) {
1791 + dev_err(&port->dev, "out of memory\n");
1792 + count = -ENOMEM;
1793 +- goto error;
1794 ++ goto error_no_dr;
1795 + }
1796 +
1797 + dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
1798 +@@ -322,6 +327,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
1799 +
1800 + return count;
1801 + error:
1802 ++ kfree(dr);
1803 ++error_no_dr:
1804 + usb_free_urb(urb);
1805 + error_no_urb:
1806 + kfree(buffer);
1807 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1808 +index 3fd4e6f..c334670 100644
1809 +--- a/drivers/usb/serial/option.c
1810 ++++ b/drivers/usb/serial/option.c
1811 +@@ -503,11 +503,19 @@ static const struct option_blacklist_info net_intf5_blacklist = {
1812 + .reserved = BIT(5),
1813 + };
1814 +
1815 ++static const struct option_blacklist_info net_intf6_blacklist = {
1816 ++ .reserved = BIT(6),
1817 ++};
1818 ++
1819 + static const struct option_blacklist_info zte_mf626_blacklist = {
1820 + .sendsetup = BIT(0) | BIT(1),
1821 + .reserved = BIT(4),
1822 + };
1823 +
1824 ++static const struct option_blacklist_info zte_1255_blacklist = {
1825 ++ .reserved = BIT(3) | BIT(4),
1826 ++};
1827 ++
1828 + static const struct usb_device_id option_ids[] = {
1829 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
1830 + { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
1831 +@@ -853,13 +861,19 @@ static const struct usb_device_id option_ids[] = {
1832 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff),
1833 + .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1834 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) },
1835 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) },
1836 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) },
1837 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff),
1838 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1839 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff),
1840 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1841 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) },
1842 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff) },
1843 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff) },
1844 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff) },
1845 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff) },
1846 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff),
1847 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1848 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff),
1849 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1850 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff),
1851 ++ .driver_info = (kernel_ulong_t)&net_intf6_blacklist },
1852 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff),
1853 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1854 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) },
1855 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) },
1856 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
1857 +@@ -872,7 +886,8 @@ static const struct usb_device_id option_ids[] = {
1858 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
1859 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff),
1860 + .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1861 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) },
1862 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff),
1863 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1864 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
1865 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
1866 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
1867 +@@ -880,13 +895,22 @@ static const struct usb_device_id option_ids[] = {
1868 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) },
1869 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff),
1870 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1871 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0191, 0xff, 0xff, 0xff), /* ZTE EuFi890 */
1872 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1873 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0199, 0xff, 0xff, 0xff), /* ZTE MF820S */
1874 ++ .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1875 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
1876 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1877 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
1878 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1879 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff),
1880 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1881 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
1882 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1883 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
1884 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff),
1885 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1886 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1021, 0xff, 0xff, 0xff),
1887 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1888 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
1889 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
1890 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
1891 +@@ -1002,18 +1026,24 @@ static const struct usb_device_id option_ids[] = {
1892 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1169, 0xff, 0xff, 0xff) },
1893 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1170, 0xff, 0xff, 0xff) },
1894 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1244, 0xff, 0xff, 0xff) },
1895 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff) },
1896 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1245, 0xff, 0xff, 0xff),
1897 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1898 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1246, 0xff, 0xff, 0xff) },
1899 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff) },
1900 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1247, 0xff, 0xff, 0xff),
1901 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1902 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1248, 0xff, 0xff, 0xff) },
1903 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1249, 0xff, 0xff, 0xff) },
1904 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1250, 0xff, 0xff, 0xff) },
1905 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1251, 0xff, 0xff, 0xff) },
1906 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff) },
1907 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1252, 0xff, 0xff, 0xff),
1908 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1909 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1253, 0xff, 0xff, 0xff) },
1910 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff) },
1911 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff) },
1912 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff) },
1913 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1254, 0xff, 0xff, 0xff),
1914 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1915 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1255, 0xff, 0xff, 0xff),
1916 ++ .driver_info = (kernel_ulong_t)&zte_1255_blacklist },
1917 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1256, 0xff, 0xff, 0xff),
1918 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1919 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1257, 0xff, 0xff, 0xff) },
1920 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1258, 0xff, 0xff, 0xff) },
1921 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1259, 0xff, 0xff, 0xff) },
1922 +@@ -1058,8 +1088,16 @@ static const struct usb_device_id option_ids[] = {
1923 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) },
1924 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) },
1925 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) },
1926 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff),
1927 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1928 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff),
1929 + .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1930 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff),
1931 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1932 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff),
1933 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1934 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff), /* ZTE MF91 */
1935 ++ .driver_info = (kernel_ulong_t)&net_intf2_blacklist },
1936 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff,
1937 + 0xff, 0xff), .driver_info = (kernel_ulong_t)&zte_k3765_z_blacklist },
1938 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
1939 +@@ -1071,15 +1109,21 @@ static const struct usb_device_id option_ids[] = {
1940 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
1941 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
1942 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) },
1943 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
1944 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff) },
1945 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
1946 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff),
1947 ++ .driver_info = (kernel_ulong_t)&net_intf1_blacklist },
1948 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0133, 0xff, 0xff, 0xff),
1949 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1950 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff),
1951 ++ .driver_info = (kernel_ulong_t)&net_intf5_blacklist },
1952 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
1953 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
1954 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) },
1955 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff),
1956 ++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1957 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) },
1958 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) },
1959 +- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) },
1960 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff),
1961 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1962 ++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff),
1963 ++ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
1964 +
1965 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
1966 + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
1967 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
1968 +index 535d087..e1f1ebd 100644
1969 +--- a/drivers/usb/serial/sierra.c
1970 ++++ b/drivers/usb/serial/sierra.c
1971 +@@ -171,7 +171,6 @@ static int sierra_probe(struct usb_serial *serial,
1972 + {
1973 + int result = 0;
1974 + struct usb_device *udev;
1975 +- struct sierra_intf_private *data;
1976 + u8 ifnum;
1977 +
1978 + udev = serial->dev;
1979 +@@ -199,11 +198,6 @@ static int sierra_probe(struct usb_serial *serial,
1980 + return -ENODEV;
1981 + }
1982 +
1983 +- data = serial->private = kzalloc(sizeof(struct sierra_intf_private), GFP_KERNEL);
1984 +- if (!data)
1985 +- return -ENOMEM;
1986 +- spin_lock_init(&data->susp_lock);
1987 +-
1988 + return result;
1989 + }
1990 +
1991 +@@ -915,6 +909,7 @@ static void sierra_dtr_rts(struct usb_serial_port *port, int on)
1992 + static int sierra_startup(struct usb_serial *serial)
1993 + {
1994 + struct usb_serial_port *port;
1995 ++ struct sierra_intf_private *intfdata;
1996 + struct sierra_port_private *portdata;
1997 + struct sierra_iface_info *himemoryp = NULL;
1998 + int i;
1999 +@@ -922,6 +917,14 @@ static int sierra_startup(struct usb_serial *serial)
2000 +
2001 + dev_dbg(&serial->dev->dev, "%s\n", __func__);
2002 +
2003 ++ intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL);
2004 ++ if (!intfdata)
2005 ++ return -ENOMEM;
2006 ++
2007 ++ spin_lock_init(&intfdata->susp_lock);
2008 ++
2009 ++ usb_set_serial_data(serial, intfdata);
2010 ++
2011 + /* Set Device mode to D0 */
2012 + sierra_set_power_state(serial->dev, 0x0000);
2013 +
2014 +@@ -937,7 +940,7 @@ static int sierra_startup(struct usb_serial *serial)
2015 + dev_dbg(&port->dev, "%s: kmalloc for "
2016 + "sierra_port_private (%d) failed!\n",
2017 + __func__, i);
2018 +- return -ENOMEM;
2019 ++ goto err;
2020 + }
2021 + spin_lock_init(&portdata->lock);
2022 + init_usb_anchor(&portdata->active);
2023 +@@ -974,6 +977,14 @@ static int sierra_startup(struct usb_serial *serial)
2024 + }
2025 +
2026 + return 0;
2027 ++err:
2028 ++ for (--i; i >= 0; --i) {
2029 ++ portdata = usb_get_serial_port_data(serial->port[i]);
2030 ++ kfree(portdata);
2031 ++ }
2032 ++ kfree(intfdata);
2033 ++
2034 ++ return -ENOMEM;
2035 + }
2036 +
2037 + static void sierra_release(struct usb_serial *serial)
2038 +@@ -993,6 +1004,7 @@ static void sierra_release(struct usb_serial *serial)
2039 + continue;
2040 + kfree(portdata);
2041 + }
2042 ++ kfree(serial->private);
2043 + }
2044 +
2045 + #ifdef CONFIG_PM
2046 +diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
2047 +index 5b073bc..59d646d 100644
2048 +--- a/drivers/usb/serial/whiteheat.c
2049 ++++ b/drivers/usb/serial/whiteheat.c
2050 +@@ -576,6 +576,7 @@ no_firmware:
2051 + "%s: please contact support@×××××××××××.com\n",
2052 + serial->type->description);
2053 + kfree(result);
2054 ++ kfree(command);
2055 + return -ENODEV;
2056 +
2057 + no_command_private:
2058 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
2059 +index 591f57f..fa8a1b2 100644
2060 +--- a/drivers/usb/storage/unusual_devs.h
2061 ++++ b/drivers/usb/storage/unusual_devs.h
2062 +@@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999,
2063 + USB_SC_8070, USB_PR_CB, NULL,
2064 + US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ),
2065 +
2066 ++/* Submitted by Oleksandr Chumachenko <ledest@×××××.com> */
2067 ++UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100,
2068 ++ "Casio",
2069 ++ "EX-N1 DigitalCamera",
2070 ++ USB_SC_8070, USB_PR_DEVICE, NULL, 0),
2071 ++
2072 + /* Submitted by Hartmut Wahl <hwahl@×××××.de>*/
2073 + UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
2074 + "Samsung",
2075 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
2076 +index 882a51f..b76071e 100644
2077 +--- a/drivers/vhost/net.c
2078 ++++ b/drivers/vhost/net.c
2079 +@@ -371,7 +371,8 @@ static void handle_rx(struct vhost_net *net)
2080 + .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE
2081 + };
2082 + size_t total_len = 0;
2083 +- int err, headcount, mergeable;
2084 ++ int err, mergeable;
2085 ++ s16 headcount;
2086 + size_t vhost_hlen, sock_hlen;
2087 + size_t vhost_len, sock_len;
2088 + /* TODO: check that we are running from vhost_worker? */
2089 +diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
2090 +index 41746bb..cb5988f 100644
2091 +--- a/drivers/video/udlfb.c
2092 ++++ b/drivers/video/udlfb.c
2093 +@@ -646,7 +646,7 @@ static ssize_t dlfb_ops_write(struct fb_info *info, const char __user *buf,
2094 + result = fb_sys_write(info, buf, count, ppos);
2095 +
2096 + if (result > 0) {
2097 +- int start = max((int)(offset / info->fix.line_length) - 1, 0);
2098 ++ int start = max((int)(offset / info->fix.line_length), 0);
2099 + int lines = min((u32)((result / info->fix.line_length) + 1),
2100 + (u32)info->var.yres);
2101 +
2102 +diff --git a/drivers/video/via/via_clock.c b/drivers/video/via/via_clock.c
2103 +index af8f26b..db1e392 100644
2104 +--- a/drivers/video/via/via_clock.c
2105 ++++ b/drivers/video/via/via_clock.c
2106 +@@ -25,6 +25,7 @@
2107 +
2108 + #include <linux/kernel.h>
2109 + #include <linux/via-core.h>
2110 ++#include <asm/olpc.h>
2111 + #include "via_clock.h"
2112 + #include "global.h"
2113 + #include "debug.h"
2114 +@@ -289,6 +290,10 @@ static void dummy_set_pll(struct via_pll_config config)
2115 + printk(KERN_INFO "Using undocumented set PLL.\n%s", via_slap);
2116 + }
2117 +
2118 ++static void noop_set_clock_state(u8 state)
2119 ++{
2120 ++}
2121 ++
2122 + void via_clock_init(struct via_clock *clock, int gfx_chip)
2123 + {
2124 + switch (gfx_chip) {
2125 +@@ -346,4 +351,18 @@ void via_clock_init(struct via_clock *clock, int gfx_chip)
2126 + break;
2127 +
2128 + }
2129 ++
2130 ++ if (machine_is_olpc()) {
2131 ++ /* The OLPC XO-1.5 cannot suspend/resume reliably if the
2132 ++ * IGA1/IGA2 clocks are set as on or off (memory rot
2133 ++ * occasionally happens during suspend under such
2134 ++ * configurations).
2135 ++ *
2136 ++ * The only known stable scenario is to leave this bits as-is,
2137 ++ * which in their default states are documented to enable the
2138 ++ * clock only when it is needed.
2139 ++ */
2140 ++ clock->set_primary_clock_state = noop_set_clock_state;
2141 ++ clock->set_secondary_clock_state = noop_set_clock_state;
2142 ++ }
2143 + }
2144 +diff --git a/fs/ceph/export.c b/fs/ceph/export.c
2145 +index 9fbcdec..b001030 100644
2146 +--- a/fs/ceph/export.c
2147 ++++ b/fs/ceph/export.c
2148 +@@ -91,7 +91,7 @@ static int ceph_encode_fh(struct dentry *dentry, u32 *rawfh, int *max_len,
2149 + * FIXME: we should try harder by querying the mds for the ino.
2150 + */
2151 + static struct dentry *__fh_to_dentry(struct super_block *sb,
2152 +- struct ceph_nfs_fh *fh)
2153 ++ struct ceph_nfs_fh *fh, int fh_len)
2154 + {
2155 + struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
2156 + struct inode *inode;
2157 +@@ -99,6 +99,9 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
2158 + struct ceph_vino vino;
2159 + int err;
2160 +
2161 ++ if (fh_len < sizeof(*fh) / 4)
2162 ++ return ERR_PTR(-ESTALE);
2163 ++
2164 + dout("__fh_to_dentry %llx\n", fh->ino);
2165 + vino.ino = fh->ino;
2166 + vino.snap = CEPH_NOSNAP;
2167 +@@ -142,7 +145,7 @@ static struct dentry *__fh_to_dentry(struct super_block *sb,
2168 + * convert connectable fh to dentry
2169 + */
2170 + static struct dentry *__cfh_to_dentry(struct super_block *sb,
2171 +- struct ceph_nfs_confh *cfh)
2172 ++ struct ceph_nfs_confh *cfh, int fh_len)
2173 + {
2174 + struct ceph_mds_client *mdsc = ceph_sb_to_client(sb)->mdsc;
2175 + struct inode *inode;
2176 +@@ -150,6 +153,9 @@ static struct dentry *__cfh_to_dentry(struct super_block *sb,
2177 + struct ceph_vino vino;
2178 + int err;
2179 +
2180 ++ if (fh_len < sizeof(*cfh) / 4)
2181 ++ return ERR_PTR(-ESTALE);
2182 ++
2183 + dout("__cfh_to_dentry %llx (%llx/%x)\n",
2184 + cfh->ino, cfh->parent_ino, cfh->parent_name_hash);
2185 +
2186 +@@ -199,9 +205,11 @@ static struct dentry *ceph_fh_to_dentry(struct super_block *sb, struct fid *fid,
2187 + int fh_len, int fh_type)
2188 + {
2189 + if (fh_type == 1)
2190 +- return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw);
2191 ++ return __fh_to_dentry(sb, (struct ceph_nfs_fh *)fid->raw,
2192 ++ fh_len);
2193 + else
2194 +- return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw);
2195 ++ return __cfh_to_dentry(sb, (struct ceph_nfs_confh *)fid->raw,
2196 ++ fh_len);
2197 + }
2198 +
2199 + /*
2200 +@@ -222,6 +230,8 @@ static struct dentry *ceph_fh_to_parent(struct super_block *sb,
2201 +
2202 + if (fh_type == 1)
2203 + return ERR_PTR(-ESTALE);
2204 ++ if (fh_len < sizeof(*cfh) / 4)
2205 ++ return ERR_PTR(-ESTALE);
2206 +
2207 + pr_debug("fh_to_parent %llx/%d\n", cfh->parent_ino,
2208 + cfh->parent_name_hash);
2209 +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
2210 +index 51352de..f854cf9 100644
2211 +--- a/fs/compat_ioctl.c
2212 ++++ b/fs/compat_ioctl.c
2213 +@@ -210,6 +210,8 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd,
2214 +
2215 + err = get_user(palp, &up->palette);
2216 + err |= get_user(length, &up->length);
2217 ++ if (err)
2218 ++ return -EFAULT;
2219 +
2220 + up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
2221 + err = put_user(compat_ptr(palp), &up_native->palette);
2222 +diff --git a/fs/exec.c b/fs/exec.c
2223 +index 160cd2f..121ccae 100644
2224 +--- a/fs/exec.c
2225 ++++ b/fs/exec.c
2226 +@@ -1095,7 +1095,7 @@ int flush_old_exec(struct linux_binprm * bprm)
2227 + bprm->mm = NULL; /* We're using it now */
2228 +
2229 + set_fs(USER_DS);
2230 +- current->flags &= ~(PF_RANDOMIZE | PF_KTHREAD);
2231 ++ current->flags &= ~(PF_RANDOMIZE | PF_KTHREAD | PF_NOFREEZE);
2232 + flush_thread();
2233 + current->personality &= ~bprm->per_clear;
2234 +
2235 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
2236 +index 54f2bdc..191580a 100644
2237 +--- a/fs/ext4/extents.c
2238 ++++ b/fs/ext4/extents.c
2239 +@@ -2715,6 +2715,9 @@ static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
2240 + #define EXT4_EXT_MARK_UNINIT1 0x2 /* mark first half uninitialized */
2241 + #define EXT4_EXT_MARK_UNINIT2 0x4 /* mark second half uninitialized */
2242 +
2243 ++#define EXT4_EXT_DATA_VALID1 0x8 /* first half contains valid data */
2244 ++#define EXT4_EXT_DATA_VALID2 0x10 /* second half contains valid data */
2245 ++
2246 + /*
2247 + * ext4_split_extent_at() splits an extent at given block.
2248 + *
2249 +@@ -2750,6 +2753,9 @@ static int ext4_split_extent_at(handle_t *handle,
2250 + unsigned int ee_len, depth;
2251 + int err = 0;
2252 +
2253 ++ BUG_ON((split_flag & (EXT4_EXT_DATA_VALID1 | EXT4_EXT_DATA_VALID2)) ==
2254 ++ (EXT4_EXT_DATA_VALID1 | EXT4_EXT_DATA_VALID2));
2255 ++
2256 + ext_debug("ext4_split_extents_at: inode %lu, logical"
2257 + "block %llu\n", inode->i_ino, (unsigned long long)split);
2258 +
2259 +@@ -2808,7 +2814,14 @@ static int ext4_split_extent_at(handle_t *handle,
2260 +
2261 + err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
2262 + if (err == -ENOSPC && (EXT4_EXT_MAY_ZEROOUT & split_flag)) {
2263 +- err = ext4_ext_zeroout(inode, &orig_ex);
2264 ++ if (split_flag & (EXT4_EXT_DATA_VALID1|EXT4_EXT_DATA_VALID2)) {
2265 ++ if (split_flag & EXT4_EXT_DATA_VALID1)
2266 ++ err = ext4_ext_zeroout(inode, ex2);
2267 ++ else
2268 ++ err = ext4_ext_zeroout(inode, ex);
2269 ++ } else
2270 ++ err = ext4_ext_zeroout(inode, &orig_ex);
2271 ++
2272 + if (err)
2273 + goto fix_extent_len;
2274 + /* update the extent length and mark as initialized */
2275 +@@ -2861,12 +2874,13 @@ static int ext4_split_extent(handle_t *handle,
2276 + uninitialized = ext4_ext_is_uninitialized(ex);
2277 +
2278 + if (map->m_lblk + map->m_len < ee_block + ee_len) {
2279 +- split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ?
2280 +- EXT4_EXT_MAY_ZEROOUT : 0;
2281 ++ split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT;
2282 + flags1 = flags | EXT4_GET_BLOCKS_PRE_IO;
2283 + if (uninitialized)
2284 + split_flag1 |= EXT4_EXT_MARK_UNINIT1 |
2285 + EXT4_EXT_MARK_UNINIT2;
2286 ++ if (split_flag & EXT4_EXT_DATA_VALID2)
2287 ++ split_flag1 |= EXT4_EXT_DATA_VALID1;
2288 + err = ext4_split_extent_at(handle, inode, path,
2289 + map->m_lblk + map->m_len, split_flag1, flags1);
2290 + if (err)
2291 +@@ -2879,8 +2893,8 @@ static int ext4_split_extent(handle_t *handle,
2292 + return PTR_ERR(path);
2293 +
2294 + if (map->m_lblk >= ee_block) {
2295 +- split_flag1 = split_flag & EXT4_EXT_MAY_ZEROOUT ?
2296 +- EXT4_EXT_MAY_ZEROOUT : 0;
2297 ++ split_flag1 = split_flag & (EXT4_EXT_MAY_ZEROOUT |
2298 ++ EXT4_EXT_DATA_VALID2);
2299 + if (uninitialized)
2300 + split_flag1 |= EXT4_EXT_MARK_UNINIT1;
2301 + if (split_flag & EXT4_EXT_MARK_UNINIT2)
2302 +@@ -3158,26 +3172,47 @@ static int ext4_split_unwritten_extents(handle_t *handle,
2303 +
2304 + split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0;
2305 + split_flag |= EXT4_EXT_MARK_UNINIT2;
2306 +-
2307 ++ if (flags & EXT4_GET_BLOCKS_CONVERT)
2308 ++ split_flag |= EXT4_EXT_DATA_VALID2;
2309 + flags |= EXT4_GET_BLOCKS_PRE_IO;
2310 + return ext4_split_extent(handle, inode, path, map, split_flag, flags);
2311 + }
2312 +
2313 + static int ext4_convert_unwritten_extents_endio(handle_t *handle,
2314 +- struct inode *inode,
2315 +- struct ext4_ext_path *path)
2316 ++ struct inode *inode,
2317 ++ struct ext4_map_blocks *map,
2318 ++ struct ext4_ext_path *path)
2319 + {
2320 + struct ext4_extent *ex;
2321 ++ ext4_lblk_t ee_block;
2322 ++ unsigned int ee_len;
2323 + int depth;
2324 + int err = 0;
2325 +
2326 + depth = ext_depth(inode);
2327 + ex = path[depth].p_ext;
2328 ++ ee_block = le32_to_cpu(ex->ee_block);
2329 ++ ee_len = ext4_ext_get_actual_len(ex);
2330 +
2331 + ext_debug("ext4_convert_unwritten_extents_endio: inode %lu, logical"
2332 + "block %llu, max_blocks %u\n", inode->i_ino,
2333 +- (unsigned long long)le32_to_cpu(ex->ee_block),
2334 +- ext4_ext_get_actual_len(ex));
2335 ++ (unsigned long long)ee_block, ee_len);
2336 ++
2337 ++ /* If extent is larger than requested then split is required */
2338 ++ if (ee_block != map->m_lblk || ee_len > map->m_len) {
2339 ++ err = ext4_split_unwritten_extents(handle, inode, map, path,
2340 ++ EXT4_GET_BLOCKS_CONVERT);
2341 ++ if (err < 0)
2342 ++ goto out;
2343 ++ ext4_ext_drop_refs(path);
2344 ++ path = ext4_ext_find_extent(inode, map->m_lblk, path);
2345 ++ if (IS_ERR(path)) {
2346 ++ err = PTR_ERR(path);
2347 ++ goto out;
2348 ++ }
2349 ++ depth = ext_depth(inode);
2350 ++ ex = path[depth].p_ext;
2351 ++ }
2352 +
2353 + err = ext4_ext_get_access(handle, inode, path + depth);
2354 + if (err)
2355 +@@ -3479,7 +3514,7 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
2356 + }
2357 + /* IO end_io complete, convert the filled extent to written */
2358 + if ((flags & EXT4_GET_BLOCKS_CONVERT)) {
2359 +- ret = ext4_convert_unwritten_extents_endio(handle, inode,
2360 ++ ret = ext4_convert_unwritten_extents_endio(handle, inode, map,
2361 + path);
2362 + if (ret >= 0) {
2363 + ext4_update_inode_fsync_trans(handle, inode, 1);
2364 +diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c
2365 +index fe9945f..5235d6e 100644
2366 +--- a/fs/gfs2/export.c
2367 ++++ b/fs/gfs2/export.c
2368 +@@ -167,6 +167,8 @@ static struct dentry *gfs2_fh_to_dentry(struct super_block *sb, struct fid *fid,
2369 + case GFS2_SMALL_FH_SIZE:
2370 + case GFS2_LARGE_FH_SIZE:
2371 + case GFS2_OLD_FH_SIZE:
2372 ++ if (fh_len < GFS2_SMALL_FH_SIZE)
2373 ++ return NULL;
2374 + this.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
2375 + this.no_formal_ino |= be32_to_cpu(fh[1]);
2376 + this.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
2377 +@@ -186,6 +188,8 @@ static struct dentry *gfs2_fh_to_parent(struct super_block *sb, struct fid *fid,
2378 + switch (fh_type) {
2379 + case GFS2_LARGE_FH_SIZE:
2380 + case GFS2_OLD_FH_SIZE:
2381 ++ if (fh_len < GFS2_LARGE_FH_SIZE)
2382 ++ return NULL;
2383 + parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
2384 + parent.no_formal_ino |= be32_to_cpu(fh[5]);
2385 + parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
2386 +diff --git a/fs/isofs/export.c b/fs/isofs/export.c
2387 +index dd4687f..516eb21 100644
2388 +--- a/fs/isofs/export.c
2389 ++++ b/fs/isofs/export.c
2390 +@@ -179,7 +179,7 @@ static struct dentry *isofs_fh_to_parent(struct super_block *sb,
2391 + {
2392 + struct isofs_fid *ifid = (struct isofs_fid *)fid;
2393 +
2394 +- if (fh_type != 2)
2395 ++ if (fh_len < 2 || fh_type != 2)
2396 + return NULL;
2397 +
2398 + return isofs_export_iget(sb,
2399 +diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
2400 +index 8799207..931bf95 100644
2401 +--- a/fs/jbd/commit.c
2402 ++++ b/fs/jbd/commit.c
2403 +@@ -86,7 +86,12 @@ nope:
2404 + static void release_data_buffer(struct buffer_head *bh)
2405 + {
2406 + if (buffer_freed(bh)) {
2407 ++ WARN_ON_ONCE(buffer_dirty(bh));
2408 + clear_buffer_freed(bh);
2409 ++ clear_buffer_mapped(bh);
2410 ++ clear_buffer_new(bh);
2411 ++ clear_buffer_req(bh);
2412 ++ bh->b_bdev = NULL;
2413 + release_buffer_page(bh);
2414 + } else
2415 + put_bh(bh);
2416 +@@ -847,17 +852,35 @@ restart_loop:
2417 + * there's no point in keeping a checkpoint record for
2418 + * it. */
2419 +
2420 +- /* A buffer which has been freed while still being
2421 +- * journaled by a previous transaction may end up still
2422 +- * being dirty here, but we want to avoid writing back
2423 +- * that buffer in the future after the "add to orphan"
2424 +- * operation been committed, That's not only a performance
2425 +- * gain, it also stops aliasing problems if the buffer is
2426 +- * left behind for writeback and gets reallocated for another
2427 +- * use in a different page. */
2428 +- if (buffer_freed(bh) && !jh->b_next_transaction) {
2429 +- clear_buffer_freed(bh);
2430 +- clear_buffer_jbddirty(bh);
2431 ++ /*
2432 ++ * A buffer which has been freed while still being journaled by
2433 ++ * a previous transaction.
2434 ++ */
2435 ++ if (buffer_freed(bh)) {
2436 ++ /*
2437 ++ * If the running transaction is the one containing
2438 ++ * "add to orphan" operation (b_next_transaction !=
2439 ++ * NULL), we have to wait for that transaction to
2440 ++ * commit before we can really get rid of the buffer.
2441 ++ * So just clear b_modified to not confuse transaction
2442 ++ * credit accounting and refile the buffer to
2443 ++ * BJ_Forget of the running transaction. If the just
2444 ++ * committed transaction contains "add to orphan"
2445 ++ * operation, we can completely invalidate the buffer
2446 ++ * now. We are rather throughout in that since the
2447 ++ * buffer may be still accessible when blocksize <
2448 ++ * pagesize and it is attached to the last partial
2449 ++ * page.
2450 ++ */
2451 ++ jh->b_modified = 0;
2452 ++ if (!jh->b_next_transaction) {
2453 ++ clear_buffer_freed(bh);
2454 ++ clear_buffer_jbddirty(bh);
2455 ++ clear_buffer_mapped(bh);
2456 ++ clear_buffer_new(bh);
2457 ++ clear_buffer_req(bh);
2458 ++ bh->b_bdev = NULL;
2459 ++ }
2460 + }
2461 +
2462 + if (buffer_jbddirty(bh)) {
2463 +diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
2464 +index 7e59c6e..edac004 100644
2465 +--- a/fs/jbd/transaction.c
2466 ++++ b/fs/jbd/transaction.c
2467 +@@ -1839,15 +1839,16 @@ static int __dispose_buffer(struct journal_head *jh, transaction_t *transaction)
2468 + * We're outside-transaction here. Either or both of j_running_transaction
2469 + * and j_committing_transaction may be NULL.
2470 + */
2471 +-static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2472 ++static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh,
2473 ++ int partial_page)
2474 + {
2475 + transaction_t *transaction;
2476 + struct journal_head *jh;
2477 + int may_free = 1;
2478 +- int ret;
2479 +
2480 + BUFFER_TRACE(bh, "entry");
2481 +
2482 ++retry:
2483 + /*
2484 + * It is safe to proceed here without the j_list_lock because the
2485 + * buffers cannot be stolen by try_to_free_buffers as long as we are
2486 +@@ -1875,10 +1876,18 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2487 + * clear the buffer dirty bit at latest at the moment when the
2488 + * transaction marking the buffer as freed in the filesystem
2489 + * structures is committed because from that moment on the
2490 +- * buffer can be reallocated and used by a different page.
2491 ++ * block can be reallocated and used by a different page.
2492 + * Since the block hasn't been freed yet but the inode has
2493 + * already been added to orphan list, it is safe for us to add
2494 + * the buffer to BJ_Forget list of the newest transaction.
2495 ++ *
2496 ++ * Also we have to clear buffer_mapped flag of a truncated buffer
2497 ++ * because the buffer_head may be attached to the page straddling
2498 ++ * i_size (can happen only when blocksize < pagesize) and thus the
2499 ++ * buffer_head can be reused when the file is extended again. So we end
2500 ++ * up keeping around invalidated buffers attached to transactions'
2501 ++ * BJ_Forget list just to stop checkpointing code from cleaning up
2502 ++ * the transaction this buffer was modified in.
2503 + */
2504 + transaction = jh->b_transaction;
2505 + if (transaction == NULL) {
2506 +@@ -1905,13 +1914,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2507 + * committed, the buffer won't be needed any
2508 + * longer. */
2509 + JBUFFER_TRACE(jh, "checkpointed: add to BJ_Forget");
2510 +- ret = __dispose_buffer(jh,
2511 ++ may_free = __dispose_buffer(jh,
2512 + journal->j_running_transaction);
2513 +- journal_put_journal_head(jh);
2514 +- spin_unlock(&journal->j_list_lock);
2515 +- jbd_unlock_bh_state(bh);
2516 +- spin_unlock(&journal->j_state_lock);
2517 +- return ret;
2518 ++ goto zap_buffer;
2519 + } else {
2520 + /* There is no currently-running transaction. So the
2521 + * orphan record which we wrote for this file must have
2522 +@@ -1919,13 +1924,9 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2523 + * the committing transaction, if it exists. */
2524 + if (journal->j_committing_transaction) {
2525 + JBUFFER_TRACE(jh, "give to committing trans");
2526 +- ret = __dispose_buffer(jh,
2527 ++ may_free = __dispose_buffer(jh,
2528 + journal->j_committing_transaction);
2529 +- journal_put_journal_head(jh);
2530 +- spin_unlock(&journal->j_list_lock);
2531 +- jbd_unlock_bh_state(bh);
2532 +- spin_unlock(&journal->j_state_lock);
2533 +- return ret;
2534 ++ goto zap_buffer;
2535 + } else {
2536 + /* The orphan record's transaction has
2537 + * committed. We can cleanse this buffer */
2538 +@@ -1946,10 +1947,24 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2539 + }
2540 + /*
2541 + * The buffer is committing, we simply cannot touch
2542 +- * it. So we just set j_next_transaction to the
2543 +- * running transaction (if there is one) and mark
2544 +- * buffer as freed so that commit code knows it should
2545 +- * clear dirty bits when it is done with the buffer.
2546 ++ * it. If the page is straddling i_size we have to wait
2547 ++ * for commit and try again.
2548 ++ */
2549 ++ if (partial_page) {
2550 ++ tid_t tid = journal->j_committing_transaction->t_tid;
2551 ++
2552 ++ journal_put_journal_head(jh);
2553 ++ spin_unlock(&journal->j_list_lock);
2554 ++ jbd_unlock_bh_state(bh);
2555 ++ spin_unlock(&journal->j_state_lock);
2556 ++ log_wait_commit(journal, tid);
2557 ++ goto retry;
2558 ++ }
2559 ++ /*
2560 ++ * OK, buffer won't be reachable after truncate. We just set
2561 ++ * j_next_transaction to the running transaction (if there is
2562 ++ * one) and mark buffer as freed so that commit code knows it
2563 ++ * should clear dirty bits when it is done with the buffer.
2564 + */
2565 + set_buffer_freed(bh);
2566 + if (journal->j_running_transaction && buffer_jbddirty(bh))
2567 +@@ -1972,6 +1987,14 @@ static int journal_unmap_buffer(journal_t *journal, struct buffer_head *bh)
2568 + }
2569 +
2570 + zap_buffer:
2571 ++ /*
2572 ++ * This is tricky. Although the buffer is truncated, it may be reused
2573 ++ * if blocksize < pagesize and it is attached to the page straddling
2574 ++ * EOF. Since the buffer might have been added to BJ_Forget list of the
2575 ++ * running transaction, journal_get_write_access() won't clear
2576 ++ * b_modified and credit accounting gets confused. So clear b_modified
2577 ++ * here. */
2578 ++ jh->b_modified = 0;
2579 + journal_put_journal_head(jh);
2580 + zap_buffer_no_jh:
2581 + spin_unlock(&journal->j_list_lock);
2582 +@@ -2020,7 +2043,8 @@ void journal_invalidatepage(journal_t *journal,
2583 + if (offset <= curr_off) {
2584 + /* This block is wholly outside the truncation point */
2585 + lock_buffer(bh);
2586 +- may_free &= journal_unmap_buffer(journal, bh);
2587 ++ may_free &= journal_unmap_buffer(journal, bh,
2588 ++ offset > 0);
2589 + unlock_buffer(bh);
2590 + }
2591 + curr_off = next_off;
2592 +diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
2593 +index 36057ce..6e2a2d5 100644
2594 +--- a/fs/lockd/clntxdr.c
2595 ++++ b/fs/lockd/clntxdr.c
2596 +@@ -223,7 +223,7 @@ static void encode_nlm_stat(struct xdr_stream *xdr,
2597 + {
2598 + __be32 *p;
2599 +
2600 +- BUG_ON(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD);
2601 ++ WARN_ON_ONCE(be32_to_cpu(stat) > NLM_LCK_DENIED_GRACE_PERIOD);
2602 + p = xdr_reserve_space(xdr, 4);
2603 + *p = stat;
2604 + }
2605 +diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
2606 +index df753a1..23d7451 100644
2607 +--- a/fs/lockd/mon.c
2608 ++++ b/fs/lockd/mon.c
2609 +@@ -40,7 +40,6 @@ struct nsm_args {
2610 + u32 proc;
2611 +
2612 + char *mon_name;
2613 +- char *nodename;
2614 + };
2615 +
2616 + struct nsm_res {
2617 +@@ -94,7 +93,6 @@ static int nsm_mon_unmon(struct nsm_handle *nsm, u32 proc, struct nsm_res *res)
2618 + .vers = 3,
2619 + .proc = NLMPROC_NSM_NOTIFY,
2620 + .mon_name = nsm->sm_mon_name,
2621 +- .nodename = utsname()->nodename,
2622 + };
2623 + struct rpc_message msg = {
2624 + .rpc_argp = &args,
2625 +@@ -431,7 +429,7 @@ static void encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp)
2626 + {
2627 + __be32 *p;
2628 +
2629 +- encode_nsm_string(xdr, argp->nodename);
2630 ++ encode_nsm_string(xdr, utsname()->nodename);
2631 + p = xdr_reserve_space(xdr, 4 + 4 + 4);
2632 + *p++ = cpu_to_be32(argp->prog);
2633 + *p++ = cpu_to_be32(argp->vers);
2634 +diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
2635 +index d27aab1..d413af3 100644
2636 +--- a/fs/lockd/svcproc.c
2637 ++++ b/fs/lockd/svcproc.c
2638 +@@ -67,7 +67,8 @@ nlmsvc_retrieve_args(struct svc_rqst *rqstp, struct nlm_args *argp,
2639 +
2640 + /* Obtain file pointer. Not used by FREE_ALL call. */
2641 + if (filp != NULL) {
2642 +- if ((error = nlm_lookup_file(rqstp, &file, &lock->fh)) != 0)
2643 ++ error = cast_status(nlm_lookup_file(rqstp, &file, &lock->fh));
2644 ++ if (error != 0)
2645 + goto no_locks;
2646 + *filp = file;
2647 +
2648 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
2649 +index 4cfe260..d225b51 100644
2650 +--- a/fs/nfsd/nfs4state.c
2651 ++++ b/fs/nfsd/nfs4state.c
2652 +@@ -3673,6 +3673,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2653 + memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
2654 +
2655 + nfsd4_close_open_stateid(stp);
2656 ++ release_last_closed_stateid(oo);
2657 + oo->oo_last_closed_stid = stp;
2658 +
2659 + /* place unused nfs4_stateowners on so_close_lru list to be
2660 +diff --git a/fs/proc/stat.c b/fs/proc/stat.c
2661 +index 0855e6f..4c9a859 100644
2662 +--- a/fs/proc/stat.c
2663 ++++ b/fs/proc/stat.c
2664 +@@ -24,11 +24,14 @@
2665 +
2666 + static cputime64_t get_idle_time(int cpu)
2667 + {
2668 +- u64 idle_time = get_cpu_idle_time_us(cpu, NULL);
2669 ++ u64 idle_time = -1ULL;
2670 + cputime64_t idle;
2671 +
2672 ++ if (cpu_online(cpu))
2673 ++ idle_time = get_cpu_idle_time_us(cpu, NULL);
2674 ++
2675 + if (idle_time == -1ULL) {
2676 +- /* !NO_HZ so we can rely on cpustat.idle */
2677 ++ /* !NO_HZ or cpu offline so we can rely on cpustat.idle */
2678 + idle = kstat_cpu(cpu).cpustat.idle;
2679 + idle = cputime64_add(idle, arch_idle_time(cpu));
2680 + } else
2681 +@@ -39,11 +42,14 @@ static cputime64_t get_idle_time(int cpu)
2682 +
2683 + static cputime64_t get_iowait_time(int cpu)
2684 + {
2685 +- u64 iowait_time = get_cpu_iowait_time_us(cpu, NULL);
2686 ++ u64 iowait_time = -1ULL;
2687 + cputime64_t iowait;
2688 +
2689 ++ if (cpu_online(cpu))
2690 ++ iowait_time = get_cpu_iowait_time_us(cpu, NULL);
2691 ++
2692 + if (iowait_time == -1ULL)
2693 +- /* !NO_HZ so we can rely on cpustat.iowait */
2694 ++ /* !NO_HZ or cpu offline so we can rely on cpustat.iowait */
2695 + iowait = kstat_cpu(cpu).cpustat.iowait;
2696 + else
2697 + iowait = usecs_to_cputime64(iowait_time);
2698 +diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
2699 +index 950f13a..5809abb 100644
2700 +--- a/fs/reiserfs/inode.c
2701 ++++ b/fs/reiserfs/inode.c
2702 +@@ -1573,8 +1573,10 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
2703 + reiserfs_warning(sb, "reiserfs-13077",
2704 + "nfsd/reiserfs, fhtype=%d, len=%d - odd",
2705 + fh_type, fh_len);
2706 +- fh_type = 5;
2707 ++ fh_type = fh_len;
2708 + }
2709 ++ if (fh_len < 2)
2710 ++ return NULL;
2711 +
2712 + return reiserfs_get_dentry(sb, fid->raw[0], fid->raw[1],
2713 + (fh_type == 3 || fh_type >= 5) ? fid->raw[2] : 0);
2714 +@@ -1583,6 +1585,8 @@ struct dentry *reiserfs_fh_to_dentry(struct super_block *sb, struct fid *fid,
2715 + struct dentry *reiserfs_fh_to_parent(struct super_block *sb, struct fid *fid,
2716 + int fh_len, int fh_type)
2717 + {
2718 ++ if (fh_type > fh_len)
2719 ++ fh_type = fh_len;
2720 + if (fh_type < 4)
2721 + return NULL;
2722 +
2723 +diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
2724 +index 7fdf6a7..fabbb81 100644
2725 +--- a/fs/sysfs/dir.c
2726 ++++ b/fs/sysfs/dir.c
2727 +@@ -430,20 +430,18 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
2728 + /**
2729 + * sysfs_pathname - return full path to sysfs dirent
2730 + * @sd: sysfs_dirent whose path we want
2731 +- * @path: caller allocated buffer
2732 ++ * @path: caller allocated buffer of size PATH_MAX
2733 + *
2734 + * Gives the name "/" to the sysfs_root entry; any path returned
2735 + * is relative to wherever sysfs is mounted.
2736 +- *
2737 +- * XXX: does no error checking on @path size
2738 + */
2739 + static char *sysfs_pathname(struct sysfs_dirent *sd, char *path)
2740 + {
2741 + if (sd->s_parent) {
2742 + sysfs_pathname(sd->s_parent, path);
2743 +- strcat(path, "/");
2744 ++ strlcat(path, "/", PATH_MAX);
2745 + }
2746 +- strcat(path, sd->s_name);
2747 ++ strlcat(path, sd->s_name, PATH_MAX);
2748 + return path;
2749 + }
2750 +
2751 +@@ -476,9 +474,11 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
2752 + char *path = kzalloc(PATH_MAX, GFP_KERNEL);
2753 + WARN(1, KERN_WARNING
2754 + "sysfs: cannot create duplicate filename '%s'\n",
2755 +- (path == NULL) ? sd->s_name :
2756 +- strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"),
2757 +- sd->s_name));
2758 ++ (path == NULL) ? sd->s_name
2759 ++ : (sysfs_pathname(acxt->parent_sd, path),
2760 ++ strlcat(path, "/", PATH_MAX),
2761 ++ strlcat(path, sd->s_name, PATH_MAX),
2762 ++ path));
2763 + kfree(path);
2764 + }
2765 +
2766 +diff --git a/fs/xfs/xfs_export.c b/fs/xfs/xfs_export.c
2767 +index 558910f..5703fb8 100644
2768 +--- a/fs/xfs/xfs_export.c
2769 ++++ b/fs/xfs/xfs_export.c
2770 +@@ -195,6 +195,9 @@ xfs_fs_fh_to_parent(struct super_block *sb, struct fid *fid,
2771 + struct xfs_fid64 *fid64 = (struct xfs_fid64 *)fid;
2772 + struct inode *inode = NULL;
2773 +
2774 ++ if (fh_len < xfs_fileid_length(fileid_type))
2775 ++ return NULL;
2776 ++
2777 + switch (fileid_type) {
2778 + case FILEID_INO32_GEN_PARENT:
2779 + inode = xfs_nfs_get_inode(sb, fid->i32.parent_ino,
2780 +diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
2781 +index 12d5543..c944c4f 100644
2782 +--- a/include/linux/if_vlan.h
2783 ++++ b/include/linux/if_vlan.h
2784 +@@ -97,6 +97,8 @@ static inline int is_vlan_dev(struct net_device *dev)
2785 + }
2786 +
2787 + #define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
2788 ++#define vlan_tx_nonzero_tag_present(__skb) \
2789 ++ (vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
2790 + #define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
2791 +
2792 + #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
2793 +@@ -106,7 +108,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
2794 + extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
2795 + extern u16 vlan_dev_vlan_id(const struct net_device *dev);
2796 +
2797 +-extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
2798 ++extern bool vlan_do_receive(struct sk_buff **skb);
2799 + extern struct sk_buff *vlan_untag(struct sk_buff *skb);
2800 +
2801 + #else
2802 +@@ -128,10 +130,8 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
2803 + return 0;
2804 + }
2805 +
2806 +-static inline bool vlan_do_receive(struct sk_buff **skb, bool last_handler)
2807 ++static inline bool vlan_do_receive(struct sk_buff **skb)
2808 + {
2809 +- if (((*skb)->vlan_tci & VLAN_VID_MASK) && last_handler)
2810 +- (*skb)->pkt_type = PACKET_OTHERHOST;
2811 + return false;
2812 + }
2813 +
2814 +diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
2815 +index 904131b..b25b09b 100644
2816 +--- a/include/linux/mtd/nand.h
2817 ++++ b/include/linux/mtd/nand.h
2818 +@@ -215,9 +215,6 @@ typedef enum {
2819 + #define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \
2820 + && (chip->page_shift > 9))
2821 +
2822 +-/* Mask to zero out the chip options, which come from the id table */
2823 +-#define NAND_CHIPOPTIONS_MSK (0x0000ffff & ~NAND_NO_AUTOINCR)
2824 +-
2825 + /* Non chip related options */
2826 + /* This option skips the bbt scan during initialization. */
2827 + #define NAND_SKIP_BBTSCAN 0x00010000
2828 +diff --git a/include/linux/netfilter/xt_set.h b/include/linux/netfilter/xt_set.h
2829 +index c0405ac..e3a9978 100644
2830 +--- a/include/linux/netfilter/xt_set.h
2831 ++++ b/include/linux/netfilter/xt_set.h
2832 +@@ -58,8 +58,8 @@ struct xt_set_info_target_v1 {
2833 + struct xt_set_info_target_v2 {
2834 + struct xt_set_info add_set;
2835 + struct xt_set_info del_set;
2836 +- u32 flags;
2837 +- u32 timeout;
2838 ++ __u32 flags;
2839 ++ __u32 timeout;
2840 + };
2841 +
2842 + #endif /*_XT_SET_H*/
2843 +diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
2844 +index a88fb69..ea6f8a4 100644
2845 +--- a/include/net/netfilter/nf_conntrack_ecache.h
2846 ++++ b/include/net/netfilter/nf_conntrack_ecache.h
2847 +@@ -18,6 +18,7 @@ struct nf_conntrack_ecache {
2848 + u16 ctmask; /* bitmask of ct events to be delivered */
2849 + u16 expmask; /* bitmask of expect events to be delivered */
2850 + u32 pid; /* netlink pid of destroyer */
2851 ++ struct timer_list timeout;
2852 + };
2853 +
2854 + static inline struct nf_conntrack_ecache *
2855 +diff --git a/kernel/cgroup.c b/kernel/cgroup.c
2856 +index cdc0354..6337535 100644
2857 +--- a/kernel/cgroup.c
2858 ++++ b/kernel/cgroup.c
2859 +@@ -1803,9 +1803,8 @@ static int cgroup_task_migrate(struct cgroup *cgrp, struct cgroup *oldcgrp,
2860 + * trading it for newcg is protected by cgroup_mutex, we're safe to drop
2861 + * it here; it will be freed under RCU.
2862 + */
2863 +- put_css_set(oldcg);
2864 +-
2865 + set_bit(CGRP_RELEASABLE, &oldcgrp->flags);
2866 ++ put_css_set(oldcg);
2867 + return 0;
2868 + }
2869 +
2870 +diff --git a/kernel/module.c b/kernel/module.c
2871 +index 6969ef0..6c8fa34 100644
2872 +--- a/kernel/module.c
2873 ++++ b/kernel/module.c
2874 +@@ -2659,6 +2659,10 @@ static int check_module_license_and_versions(struct module *mod)
2875 + if (strcmp(mod->name, "driverloader") == 0)
2876 + add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
2877 +
2878 ++ /* lve claims to be GPL but upstream won't provide source */
2879 ++ if (strcmp(mod->name, "lve") == 0)
2880 ++ add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
2881 ++
2882 + #ifdef CONFIG_MODVERSIONS
2883 + if ((mod->num_syms && !mod->crcs)
2884 + || (mod->num_gpl_syms && !mod->gpl_crcs)
2885 +diff --git a/kernel/sys.c b/kernel/sys.c
2886 +index c504302..d7c4ab0 100644
2887 +--- a/kernel/sys.c
2888 ++++ b/kernel/sys.c
2889 +@@ -1171,15 +1171,16 @@ DECLARE_RWSEM(uts_sem);
2890 + * Work around broken programs that cannot handle "Linux 3.0".
2891 + * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
2892 + */
2893 +-static int override_release(char __user *release, int len)
2894 ++static int override_release(char __user *release, size_t len)
2895 + {
2896 + int ret = 0;
2897 +- char buf[65];
2898 +
2899 + if (current->personality & UNAME26) {
2900 +- char *rest = UTS_RELEASE;
2901 ++ const char *rest = UTS_RELEASE;
2902 ++ char buf[65] = { 0 };
2903 + int ndots = 0;
2904 + unsigned v;
2905 ++ size_t copy;
2906 +
2907 + while (*rest) {
2908 + if (*rest == '.' && ++ndots >= 3)
2909 +@@ -1189,8 +1190,9 @@ static int override_release(char __user *release, int len)
2910 + rest++;
2911 + }
2912 + v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
2913 +- snprintf(buf, len, "2.6.%u%s", v, rest);
2914 +- ret = copy_to_user(release, buf, len);
2915 ++ copy = min(sizeof(buf), max_t(size_t, 1, len));
2916 ++ copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
2917 ++ ret = copy_to_user(release, buf, copy + 1);
2918 + }
2919 + return ret;
2920 + }
2921 +diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
2922 +index 5ee1ac0..cb7f33e 100644
2923 +--- a/kernel/time/timekeeping.c
2924 ++++ b/kernel/time/timekeeping.c
2925 +@@ -992,7 +992,7 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift)
2926 + }
2927 +
2928 + /* Accumulate raw time */
2929 +- raw_nsecs = timekeeper.raw_interval << shift;
2930 ++ raw_nsecs = (u64)timekeeper.raw_interval << shift;
2931 + raw_nsecs += raw_time.tv_nsec;
2932 + if (raw_nsecs >= NSEC_PER_SEC) {
2933 + u64 raw_secs = raw_nsecs;
2934 +diff --git a/kernel/timer.c b/kernel/timer.c
2935 +index 9c3c62b..c219db6 100644
2936 +--- a/kernel/timer.c
2937 ++++ b/kernel/timer.c
2938 +@@ -63,6 +63,7 @@ EXPORT_SYMBOL(jiffies_64);
2939 + #define TVR_SIZE (1 << TVR_BITS)
2940 + #define TVN_MASK (TVN_SIZE - 1)
2941 + #define TVR_MASK (TVR_SIZE - 1)
2942 ++#define MAX_TVAL ((unsigned long)((1ULL << (TVR_BITS + 4*TVN_BITS)) - 1))
2943 +
2944 + struct tvec {
2945 + struct list_head vec[TVN_SIZE];
2946 +@@ -356,11 +357,12 @@ static void internal_add_timer(struct tvec_base *base, struct timer_list *timer)
2947 + vec = base->tv1.vec + (base->timer_jiffies & TVR_MASK);
2948 + } else {
2949 + int i;
2950 +- /* If the timeout is larger than 0xffffffff on 64-bit
2951 +- * architectures then we use the maximum timeout:
2952 ++ /* If the timeout is larger than MAX_TVAL (on 64-bit
2953 ++ * architectures or with CONFIG_BASE_SMALL=1) then we
2954 ++ * use the maximum timeout.
2955 + */
2956 +- if (idx > 0xffffffffUL) {
2957 +- idx = 0xffffffffUL;
2958 ++ if (idx > MAX_TVAL) {
2959 ++ idx = MAX_TVAL;
2960 + expires = idx + base->timer_jiffies;
2961 + }
2962 + i = (expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK;
2963 +diff --git a/lib/genalloc.c b/lib/genalloc.c
2964 +index f352cc4..716f947 100644
2965 +--- a/lib/genalloc.c
2966 ++++ b/lib/genalloc.c
2967 +@@ -176,7 +176,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy
2968 + struct gen_pool_chunk *chunk;
2969 + int nbits = size >> pool->min_alloc_order;
2970 + int nbytes = sizeof(struct gen_pool_chunk) +
2971 +- (nbits + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
2972 ++ BITS_TO_LONGS(nbits) * sizeof(long);
2973 +
2974 + chunk = kmalloc_node(nbytes, GFP_KERNEL | __GFP_ZERO, nid);
2975 + if (unlikely(chunk == NULL))
2976 +diff --git a/mm/rmap.c b/mm/rmap.c
2977 +index a4fd368..8685697 100644
2978 +--- a/mm/rmap.c
2979 ++++ b/mm/rmap.c
2980 +@@ -56,6 +56,7 @@
2981 + #include <linux/mmu_notifier.h>
2982 + #include <linux/migrate.h>
2983 + #include <linux/hugetlb.h>
2984 ++#include <linux/backing-dev.h>
2985 +
2986 + #include <asm/tlbflush.h>
2987 +
2988 +@@ -935,11 +936,8 @@ int page_mkclean(struct page *page)
2989 +
2990 + if (page_mapped(page)) {
2991 + struct address_space *mapping = page_mapping(page);
2992 +- if (mapping) {
2993 ++ if (mapping)
2994 + ret = page_mkclean_file(mapping, page);
2995 +- if (page_test_and_clear_dirty(page_to_pfn(page), 1))
2996 +- ret = 1;
2997 +- }
2998 + }
2999 +
3000 + return ret;
3001 +@@ -1120,6 +1118,8 @@ void page_add_file_rmap(struct page *page)
3002 + */
3003 + void page_remove_rmap(struct page *page)
3004 + {
3005 ++ struct address_space *mapping = page_mapping(page);
3006 ++
3007 + /* page still mapped by someone else? */
3008 + if (!atomic_add_negative(-1, &page->_mapcount))
3009 + return;
3010 +@@ -1130,8 +1130,19 @@ void page_remove_rmap(struct page *page)
3011 + * this if the page is anon, so about to be freed; but perhaps
3012 + * not if it's in swapcache - there might be another pte slot
3013 + * containing the swap entry, but page not yet written to swap.
3014 ++ *
3015 ++ * And we can skip it on file pages, so long as the filesystem
3016 ++ * participates in dirty tracking; but need to catch shm and tmpfs
3017 ++ * and ramfs pages which have been modified since creation by read
3018 ++ * fault.
3019 ++ *
3020 ++ * Note that mapping must be decided above, before decrementing
3021 ++ * mapcount (which luckily provides a barrier): once page is unmapped,
3022 ++ * it could be truncated and page->mapping reset to NULL at any moment.
3023 ++ * Note also that we are relying on page_mapping(page) to set mapping
3024 ++ * to &swapper_space when PageSwapCache(page).
3025 + */
3026 +- if ((!PageAnon(page) || PageSwapCache(page)) &&
3027 ++ if (mapping && !mapping_cap_account_dirty(mapping) &&
3028 + page_test_and_clear_dirty(page_to_pfn(page), 1))
3029 + set_page_dirty(page);
3030 + /*
3031 +diff --git a/mm/shmem.c b/mm/shmem.c
3032 +index 7a82174..126ca35 100644
3033 +--- a/mm/shmem.c
3034 ++++ b/mm/shmem.c
3035 +@@ -1962,12 +1962,14 @@ static struct dentry *shmem_fh_to_dentry(struct super_block *sb,
3036 + {
3037 + struct inode *inode;
3038 + struct dentry *dentry = NULL;
3039 +- u64 inum = fid->raw[2];
3040 +- inum = (inum << 32) | fid->raw[1];
3041 ++ u64 inum;
3042 +
3043 + if (fh_len < 3)
3044 + return NULL;
3045 +
3046 ++ inum = fid->raw[2];
3047 ++ inum = (inum << 32) | fid->raw[1];
3048 ++
3049 + inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]),
3050 + shmem_match, fid->raw);
3051 + if (inode) {
3052 +diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
3053 +index 9ddbd4e..e860a4f 100644
3054 +--- a/net/8021q/vlan_core.c
3055 ++++ b/net/8021q/vlan_core.c
3056 +@@ -5,7 +5,7 @@
3057 + #include <linux/export.h>
3058 + #include "vlan.h"
3059 +
3060 +-bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
3061 ++bool vlan_do_receive(struct sk_buff **skbp)
3062 + {
3063 + struct sk_buff *skb = *skbp;
3064 + u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
3065 +@@ -13,14 +13,8 @@ bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
3066 + struct vlan_pcpu_stats *rx_stats;
3067 +
3068 + vlan_dev = vlan_find_dev(skb->dev, vlan_id);
3069 +- if (!vlan_dev) {
3070 +- /* Only the last call to vlan_do_receive() should change
3071 +- * pkt_type to PACKET_OTHERHOST
3072 +- */
3073 +- if (vlan_id && last_handler)
3074 +- skb->pkt_type = PACKET_OTHERHOST;
3075 ++ if (!vlan_dev)
3076 + return false;
3077 +- }
3078 +
3079 + skb = *skbp = skb_share_check(skb, GFP_ATOMIC);
3080 + if (unlikely(!skb))
3081 +diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
3082 +index c27b4e3..1849ee0 100644
3083 +--- a/net/bluetooth/smp.c
3084 ++++ b/net/bluetooth/smp.c
3085 +@@ -30,6 +30,8 @@
3086 +
3087 + #define SMP_TIMEOUT 30000 /* 30 seconds */
3088 +
3089 ++#define AUTH_REQ_MASK 0x07
3090 ++
3091 + static inline void swap128(u8 src[16], u8 dst[16])
3092 + {
3093 + int i;
3094 +@@ -206,7 +208,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
3095 + req->max_key_size = SMP_MAX_ENC_KEY_SIZE;
3096 + req->init_key_dist = dist_keys;
3097 + req->resp_key_dist = dist_keys;
3098 +- req->auth_req = authreq;
3099 ++ req->auth_req = (authreq & AUTH_REQ_MASK);
3100 + return;
3101 + }
3102 +
3103 +@@ -215,7 +217,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
3104 + rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE;
3105 + rsp->init_key_dist = req->init_key_dist & dist_keys;
3106 + rsp->resp_key_dist = req->resp_key_dist & dist_keys;
3107 +- rsp->auth_req = authreq;
3108 ++ rsp->auth_req = (authreq & AUTH_REQ_MASK);
3109 + }
3110 +
3111 + static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
3112 +diff --git a/net/core/dev.c b/net/core/dev.c
3113 +index abe1147..f500a69 100644
3114 +--- a/net/core/dev.c
3115 ++++ b/net/core/dev.c
3116 +@@ -3278,18 +3278,18 @@ another_round:
3117 + ncls:
3118 + #endif
3119 +
3120 +- rx_handler = rcu_dereference(skb->dev->rx_handler);
3121 + if (vlan_tx_tag_present(skb)) {
3122 + if (pt_prev) {
3123 + ret = deliver_skb(skb, pt_prev, orig_dev);
3124 + pt_prev = NULL;
3125 + }
3126 +- if (vlan_do_receive(&skb, !rx_handler))
3127 ++ if (vlan_do_receive(&skb))
3128 + goto another_round;
3129 + else if (unlikely(!skb))
3130 + goto out;
3131 + }
3132 +
3133 ++ rx_handler = rcu_dereference(skb->dev->rx_handler);
3134 + if (rx_handler) {
3135 + if (pt_prev) {
3136 + ret = deliver_skb(skb, pt_prev, orig_dev);
3137 +@@ -3309,6 +3309,9 @@ ncls:
3138 + }
3139 + }
3140 +
3141 ++ if (vlan_tx_nonzero_tag_present(skb))
3142 ++ skb->pkt_type = PACKET_OTHERHOST;
3143 ++
3144 + /* deliver only exact match when indicated */
3145 + null_or_dev = deliver_exact ? skb->dev : NULL;
3146 +
3147 +diff --git a/net/core/neighbour.c b/net/core/neighbour.c
3148 +index 7aafaed..5b9709f 100644
3149 +--- a/net/core/neighbour.c
3150 ++++ b/net/core/neighbour.c
3151 +@@ -1254,8 +1254,6 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
3152 + if (!dst)
3153 + goto discard;
3154 +
3155 +- __skb_pull(skb, skb_network_offset(skb));
3156 +-
3157 + if (!neigh_event_send(neigh, skb)) {
3158 + int err;
3159 + struct net_device *dev = neigh->dev;
3160 +@@ -1265,6 +1263,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
3161 + neigh_hh_init(neigh, dst);
3162 +
3163 + do {
3164 ++ __skb_pull(skb, skb_network_offset(skb));
3165 + seq = read_seqbegin(&neigh->ha_lock);
3166 + err = dev_hard_header(skb, dev, ntohs(skb->protocol),
3167 + neigh->ha, NULL, skb->len);
3168 +@@ -1295,9 +1294,8 @@ int neigh_connected_output(struct neighbour *neigh, struct sk_buff *skb)
3169 + unsigned int seq;
3170 + int err;
3171 +
3172 +- __skb_pull(skb, skb_network_offset(skb));
3173 +-
3174 + do {
3175 ++ __skb_pull(skb, skb_network_offset(skb));
3176 + seq = read_seqbegin(&neigh->ha_lock);
3177 + err = dev_hard_header(skb, dev, ntohs(skb->protocol),
3178 + neigh->ha, NULL, skb->len);
3179 +diff --git a/net/core/pktgen.c b/net/core/pktgen.c
3180 +index df878de..7bc9991 100644
3181 +--- a/net/core/pktgen.c
3182 ++++ b/net/core/pktgen.c
3183 +@@ -2935,7 +2935,7 @@ static struct sk_buff *fill_packet_ipv6(struct net_device *odev,
3184 + sizeof(struct ipv6hdr) - sizeof(struct udphdr) -
3185 + pkt_dev->pkt_overhead;
3186 +
3187 +- if (datalen < sizeof(struct pktgen_hdr)) {
3188 ++ if (datalen < 0 || datalen < sizeof(struct pktgen_hdr)) {
3189 + datalen = sizeof(struct pktgen_hdr);
3190 + if (net_ratelimit())
3191 + pr_info("increased datalen to %d\n", datalen);
3192 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
3193 +index de69cec..58c09a0 100644
3194 +--- a/net/ipv4/tcp_ipv4.c
3195 ++++ b/net/ipv4/tcp_ipv4.c
3196 +@@ -651,10 +651,11 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
3197 + arg.csumoffset = offsetof(struct tcphdr, check) / 2;
3198 + arg.flags = (sk && inet_sk(sk)->transparent) ? IP_REPLY_ARG_NOSRCCHECK : 0;
3199 + /* When socket is gone, all binding information is lost.
3200 +- * routing might fail in this case. using iif for oif to
3201 +- * make sure we can deliver it
3202 ++ * routing might fail in this case. No choice here, if we choose to force
3203 ++ * input interface, we will misroute in case of asymmetric route.
3204 + */
3205 +- arg.bound_dev_if = sk ? sk->sk_bound_dev_if : inet_iif(skb);
3206 ++ if (sk)
3207 ++ arg.bound_dev_if = sk->sk_bound_dev_if;
3208 +
3209 + net = dev_net(skb_dst(skb)->dev);
3210 + arg.tos = ip_hdr(skb)->tos;
3211 +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
3212 +index 4a56574..ccab3c8 100644
3213 +--- a/net/ipv6/tcp_ipv6.c
3214 ++++ b/net/ipv6/tcp_ipv6.c
3215 +@@ -1048,7 +1048,8 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win,
3216 + __tcp_v6_send_check(buff, &fl6.saddr, &fl6.daddr);
3217 +
3218 + fl6.flowi6_proto = IPPROTO_TCP;
3219 +- fl6.flowi6_oif = inet6_iif(skb);
3220 ++ if (ipv6_addr_type(&fl6.daddr) & IPV6_ADDR_LINKLOCAL)
3221 ++ fl6.flowi6_oif = inet6_iif(skb);
3222 + fl6.fl6_dport = t1->dest;
3223 + fl6.fl6_sport = t1->source;
3224 + security_skb_classify_flow(skb, flowi6_to_flowi(&fl6));
3225 +diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
3226 +index 28a39bb..a582504 100644
3227 +--- a/net/mac80211/wpa.c
3228 ++++ b/net/mac80211/wpa.c
3229 +@@ -106,7 +106,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
3230 + if (status->flag & RX_FLAG_MMIC_ERROR)
3231 + goto mic_fail;
3232 +
3233 +- if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key)
3234 ++ if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
3235 ++ rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
3236 + goto update_iv;
3237 +
3238 + return RX_CONTINUE;
3239 +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
3240 +index 1d15193..7489bd3 100644
3241 +--- a/net/netfilter/nf_conntrack_core.c
3242 ++++ b/net/netfilter/nf_conntrack_core.c
3243 +@@ -247,12 +247,15 @@ static void death_by_event(unsigned long ul_conntrack)
3244 + {
3245 + struct nf_conn *ct = (void *)ul_conntrack;
3246 + struct net *net = nf_ct_net(ct);
3247 ++ struct nf_conntrack_ecache *ecache = nf_ct_ecache_find(ct);
3248 ++
3249 ++ BUG_ON(ecache == NULL);
3250 +
3251 + if (nf_conntrack_event(IPCT_DESTROY, ct) < 0) {
3252 + /* bad luck, let's retry again */
3253 +- ct->timeout.expires = jiffies +
3254 ++ ecache->timeout.expires = jiffies +
3255 + (random32() % net->ct.sysctl_events_retry_timeout);
3256 +- add_timer(&ct->timeout);
3257 ++ add_timer(&ecache->timeout);
3258 + return;
3259 + }
3260 + /* we've got the event delivered, now it's dying */
3261 +@@ -266,6 +269,9 @@ static void death_by_event(unsigned long ul_conntrack)
3262 + void nf_ct_insert_dying_list(struct nf_conn *ct)
3263 + {
3264 + struct net *net = nf_ct_net(ct);
3265 ++ struct nf_conntrack_ecache *ecache = nf_ct_ecache_find(ct);
3266 ++
3267 ++ BUG_ON(ecache == NULL);
3268 +
3269 + /* add this conntrack to the dying list */
3270 + spin_lock_bh(&nf_conntrack_lock);
3271 +@@ -273,10 +279,10 @@ void nf_ct_insert_dying_list(struct nf_conn *ct)
3272 + &net->ct.dying);
3273 + spin_unlock_bh(&nf_conntrack_lock);
3274 + /* set a new timer to retry event delivery */
3275 +- setup_timer(&ct->timeout, death_by_event, (unsigned long)ct);
3276 +- ct->timeout.expires = jiffies +
3277 ++ setup_timer(&ecache->timeout, death_by_event, (unsigned long)ct);
3278 ++ ecache->timeout.expires = jiffies +
3279 + (random32() % net->ct.sysctl_events_retry_timeout);
3280 +- add_timer(&ct->timeout);
3281 ++ add_timer(&ecache->timeout);
3282 + }
3283 + EXPORT_SYMBOL_GPL(nf_ct_insert_dying_list);
3284 +
3285 +diff --git a/net/rds/send.c b/net/rds/send.c
3286 +index 96531d4..88eace5 100644
3287 +--- a/net/rds/send.c
3288 ++++ b/net/rds/send.c
3289 +@@ -1122,7 +1122,7 @@ rds_send_pong(struct rds_connection *conn, __be16 dport)
3290 + rds_stats_inc(s_send_pong);
3291 +
3292 + if (!test_bit(RDS_LL_SEND_FULL, &conn->c_flags))
3293 +- rds_send_xmit(conn);
3294 ++ queue_delayed_work(rds_wq, &conn->c_send_w, 0);
3295 +
3296 + rds_message_put(rm);
3297 + return 0;
3298 +diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
3299 +index 4530a91..237a2ee 100644
3300 +--- a/net/sunrpc/cache.c
3301 ++++ b/net/sunrpc/cache.c
3302 +@@ -1404,11 +1404,11 @@ static ssize_t read_flush(struct file *file, char __user *buf,
3303 + size_t count, loff_t *ppos,
3304 + struct cache_detail *cd)
3305 + {
3306 +- char tbuf[20];
3307 ++ char tbuf[22];
3308 + unsigned long p = *ppos;
3309 + size_t len;
3310 +
3311 +- sprintf(tbuf, "%lu\n", convert_to_wallclock(cd->flush_time));
3312 ++ snprintf(tbuf, sizeof(tbuf), "%lu\n", convert_to_wallclock(cd->flush_time));
3313 + len = strlen(tbuf);
3314 + if (p >= len)
3315 + return 0;
3316 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
3317 +index 10a385b..65fe23b 100644
3318 +--- a/net/sunrpc/xprtsock.c
3319 ++++ b/net/sunrpc/xprtsock.c
3320 +@@ -254,7 +254,6 @@ struct sock_xprt {
3321 + void (*old_data_ready)(struct sock *, int);
3322 + void (*old_state_change)(struct sock *);
3323 + void (*old_write_space)(struct sock *);
3324 +- void (*old_error_report)(struct sock *);
3325 + };
3326 +
3327 + /*
3328 +@@ -737,10 +736,10 @@ static int xs_tcp_send_request(struct rpc_task *task)
3329 + dprintk("RPC: sendmsg returned unrecognized error %d\n",
3330 + -status);
3331 + case -ECONNRESET:
3332 +- case -EPIPE:
3333 + xs_tcp_shutdown(xprt);
3334 + case -ECONNREFUSED:
3335 + case -ENOTCONN:
3336 ++ case -EPIPE:
3337 + clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
3338 + }
3339 +
3340 +@@ -781,7 +780,6 @@ static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk)
3341 + transport->old_data_ready = sk->sk_data_ready;
3342 + transport->old_state_change = sk->sk_state_change;
3343 + transport->old_write_space = sk->sk_write_space;
3344 +- transport->old_error_report = sk->sk_error_report;
3345 + }
3346 +
3347 + static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk)
3348 +@@ -789,7 +787,6 @@ static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *s
3349 + sk->sk_data_ready = transport->old_data_ready;
3350 + sk->sk_state_change = transport->old_state_change;
3351 + sk->sk_write_space = transport->old_write_space;
3352 +- sk->sk_error_report = transport->old_error_report;
3353 + }
3354 +
3355 + static void xs_reset_transport(struct sock_xprt *transport)
3356 +@@ -1465,7 +1462,7 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt)
3357 + xprt_clear_connecting(xprt);
3358 + }
3359 +
3360 +-static void xs_sock_mark_closed(struct rpc_xprt *xprt)
3361 ++static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt)
3362 + {
3363 + smp_mb__before_clear_bit();
3364 + clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
3365 +@@ -1473,6 +1470,11 @@ static void xs_sock_mark_closed(struct rpc_xprt *xprt)
3366 + clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
3367 + clear_bit(XPRT_CLOSING, &xprt->state);
3368 + smp_mb__after_clear_bit();
3369 ++}
3370 ++
3371 ++static void xs_sock_mark_closed(struct rpc_xprt *xprt)
3372 ++{
3373 ++ xs_sock_reset_connection_flags(xprt);
3374 + /* Mark transport as closed and wake up all pending tasks */
3375 + xprt_disconnect_done(xprt);
3376 + }
3377 +@@ -1528,6 +1530,7 @@ static void xs_tcp_state_change(struct sock *sk)
3378 + case TCP_CLOSE_WAIT:
3379 + /* The server initiated a shutdown of the socket */
3380 + xprt->connect_cookie++;
3381 ++ clear_bit(XPRT_CONNECTED, &xprt->state);
3382 + xs_tcp_force_close(xprt);
3383 + case TCP_CLOSING:
3384 + /*
3385 +@@ -1552,25 +1555,6 @@ static void xs_tcp_state_change(struct sock *sk)
3386 + read_unlock_bh(&sk->sk_callback_lock);
3387 + }
3388 +
3389 +-/**
3390 +- * xs_error_report - callback mainly for catching socket errors
3391 +- * @sk: socket
3392 +- */
3393 +-static void xs_error_report(struct sock *sk)
3394 +-{
3395 +- struct rpc_xprt *xprt;
3396 +-
3397 +- read_lock_bh(&sk->sk_callback_lock);
3398 +- if (!(xprt = xprt_from_sock(sk)))
3399 +- goto out;
3400 +- dprintk("RPC: %s client %p...\n"
3401 +- "RPC: error %d\n",
3402 +- __func__, xprt, sk->sk_err);
3403 +- xprt_wake_pending_tasks(xprt, -EAGAIN);
3404 +-out:
3405 +- read_unlock_bh(&sk->sk_callback_lock);
3406 +-}
3407 +-
3408 + static void xs_write_space(struct sock *sk)
3409 + {
3410 + struct socket *sock;
3411 +@@ -1870,7 +1854,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt,
3412 + sk->sk_user_data = xprt;
3413 + sk->sk_data_ready = xs_local_data_ready;
3414 + sk->sk_write_space = xs_udp_write_space;
3415 +- sk->sk_error_report = xs_error_report;
3416 + sk->sk_allocation = GFP_ATOMIC;
3417 +
3418 + xprt_clear_connected(xprt);
3419 +@@ -1959,7 +1942,6 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
3420 + sk->sk_user_data = xprt;
3421 + sk->sk_data_ready = xs_udp_data_ready;
3422 + sk->sk_write_space = xs_udp_write_space;
3423 +- sk->sk_error_report = xs_error_report;
3424 + sk->sk_no_check = UDP_CSUM_NORCV;
3425 + sk->sk_allocation = GFP_ATOMIC;
3426 +
3427 +@@ -2027,10 +2009,8 @@ static void xs_abort_connection(struct sock_xprt *transport)
3428 + any.sa_family = AF_UNSPEC;
3429 + result = kernel_connect(transport->sock, &any, sizeof(any), 0);
3430 + if (!result)
3431 +- xs_sock_mark_closed(&transport->xprt);
3432 +- else
3433 +- dprintk("RPC: AF_UNSPEC connect return code %d\n",
3434 +- result);
3435 ++ xs_sock_reset_connection_flags(&transport->xprt);
3436 ++ dprintk("RPC: AF_UNSPEC connect return code %d\n", result);
3437 + }
3438 +
3439 + static void xs_tcp_reuse_connection(struct sock_xprt *transport)
3440 +@@ -2075,7 +2055,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
3441 + sk->sk_data_ready = xs_tcp_data_ready;
3442 + sk->sk_state_change = xs_tcp_state_change;
3443 + sk->sk_write_space = xs_tcp_write_space;
3444 +- sk->sk_error_report = xs_error_report;
3445 + sk->sk_allocation = GFP_ATOMIC;
3446 +
3447 + /* socket options */
3448 +@@ -2488,6 +2467,7 @@ static struct rpc_xprt_ops xs_tcp_ops = {
3449 + static struct rpc_xprt_ops bc_tcp_ops = {
3450 + .reserve_xprt = xprt_reserve_xprt,
3451 + .release_xprt = xprt_release_xprt,
3452 ++ .alloc_slot = xprt_alloc_slot,
3453 + .buf_alloc = bc_malloc,
3454 + .buf_free = bc_free,
3455 + .send_request = bc_send_request,
3456 +diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
3457 +index fac51ee..1e7cfba 100644
3458 +--- a/sound/pci/ac97/ac97_codec.c
3459 ++++ b/sound/pci/ac97/ac97_codec.c
3460 +@@ -1271,6 +1271,8 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
3461 + tmp.index = ac97->num;
3462 + kctl = snd_ctl_new1(&tmp, ac97);
3463 + }
3464 ++ if (!kctl)
3465 ++ return -ENOMEM;
3466 + if (reg >= AC97_PHONE && reg <= AC97_PCM)
3467 + set_tlv_db_scale(kctl, db_scale_5bit_12db_max);
3468 + else
3469 +diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
3470 +index 6a3e567..d37b946 100644
3471 +--- a/sound/pci/emu10k1/emu10k1_main.c
3472 ++++ b/sound/pci/emu10k1/emu10k1_main.c
3473 +@@ -1416,6 +1416,15 @@ static struct snd_emu_chip_details emu_chip_details[] = {
3474 + .ca0108_chip = 1,
3475 + .spk71 = 1,
3476 + .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 new revision */
3477 ++ /* Tested by Maxim Kachur <mcdebugger@×××××××.ru> 17th Oct 2012. */
3478 ++ /* This is MAEM8986, 0202 is MAEM8980 */
3479 ++ {.vendor = 0x1102, .device = 0x0008, .subsystem = 0x40071102,
3480 ++ .driver = "Audigy2", .name = "E-mu 1010 PCIe [MAEM8986]",
3481 ++ .id = "EMU1010",
3482 ++ .emu10k2_chip = 1,
3483 ++ .ca0108_chip = 1,
3484 ++ .spk71 = 1,
3485 ++ .emu_model = EMU_MODEL_EMU1010B}, /* EMU 1010 PCIe */
3486 + /* Tested by James@×××××××××××.uk 8th July 2005. */
3487 + /* This is MAEM8810, 0202 is MAEM8820 */
3488 + {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x40011102,
3489 +diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
3490 +index ec0518e..e449278 100644
3491 +--- a/sound/pci/hda/patch_cirrus.c
3492 ++++ b/sound/pci/hda/patch_cirrus.c
3493 +@@ -1404,7 +1404,7 @@ static int patch_cs420x(struct hda_codec *codec)
3494 + return 0;
3495 +
3496 + error:
3497 +- kfree(codec->spec);
3498 ++ cs_free(codec);
3499 + codec->spec = NULL;
3500 + return err;
3501 + }
3502 +@@ -1949,7 +1949,7 @@ static int patch_cs421x(struct hda_codec *codec)
3503 + return 0;
3504 +
3505 + error:
3506 +- kfree(codec->spec);
3507 ++ cs_free(codec);
3508 + codec->spec = NULL;
3509 + return err;
3510 + }
3511 +diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
3512 +index 94f0c4a..58c287b 100644
3513 +--- a/sound/pci/hda/patch_conexant.c
3514 ++++ b/sound/pci/hda/patch_conexant.c
3515 +@@ -4463,7 +4463,9 @@ static void apply_fixup(struct hda_codec *codec,
3516 + struct conexant_spec *spec = codec->spec;
3517 +
3518 + quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
3519 +- if (quirk && table[quirk->value]) {
3520 ++ if (!quirk)
3521 ++ return;
3522 ++ if (table[quirk->value]) {
3523 + snd_printdd(KERN_INFO "hda_codec: applying pincfg for %s\n",
3524 + quirk->name);
3525 + apply_pincfg(codec, table[quirk->value]);
3526 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3527 +index 32c8169..c2c7f90 100644
3528 +--- a/sound/pci/hda/patch_realtek.c
3529 ++++ b/sound/pci/hda/patch_realtek.c
3530 +@@ -620,6 +620,8 @@ static void alc_line_automute(struct hda_codec *codec)
3531 + {
3532 + struct alc_spec *spec = codec->spec;
3533 +
3534 ++ if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
3535 ++ return;
3536 + /* check LO jack only when it's different from HP */
3537 + if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0])
3538 + return;
3539 +@@ -2663,8 +2665,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
3540 + return "PCM";
3541 + break;
3542 + }
3543 +- if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name)))
3544 ++ if (ch >= ARRAY_SIZE(channel_name)) {
3545 ++ snd_BUG();
3546 + return "PCM";
3547 ++ }
3548 +
3549 + return channel_name[ch];
3550 + }
3551 +@@ -5080,6 +5084,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
3552 + SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
3553 + SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
3554 + SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
3555 ++ SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
3556 + SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
3557 + SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
3558 + SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
3559 +diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
3560 +index af0f22f..aca6edc 100644
3561 +--- a/usr/gen_init_cpio.c
3562 ++++ b/usr/gen_init_cpio.c
3563 +@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location,
3564 + int retval;
3565 + int rc = -1;
3566 + int namesize;
3567 +- int i;
3568 ++ unsigned int i;
3569 +
3570 + mode |= S_IFREG;
3571 +
3572 +@@ -381,25 +381,28 @@ error:
3573 +
3574 + static char *cpio_replace_env(char *new_location)
3575 + {
3576 +- char expanded[PATH_MAX + 1];
3577 +- char env_var[PATH_MAX + 1];
3578 +- char *start;
3579 +- char *end;
3580 +-
3581 +- for (start = NULL; (start = strstr(new_location, "${")); ) {
3582 +- end = strchr(start, '}');
3583 +- if (start < end) {
3584 +- *env_var = *expanded = '\0';
3585 +- strncat(env_var, start + 2, end - start - 2);
3586 +- strncat(expanded, new_location, start - new_location);
3587 +- strncat(expanded, getenv(env_var), PATH_MAX);
3588 +- strncat(expanded, end + 1, PATH_MAX);
3589 +- strncpy(new_location, expanded, PATH_MAX);
3590 +- } else
3591 +- break;
3592 +- }
3593 +-
3594 +- return new_location;
3595 ++ char expanded[PATH_MAX + 1];
3596 ++ char env_var[PATH_MAX + 1];
3597 ++ char *start;
3598 ++ char *end;
3599 ++
3600 ++ for (start = NULL; (start = strstr(new_location, "${")); ) {
3601 ++ end = strchr(start, '}');
3602 ++ if (start < end) {
3603 ++ *env_var = *expanded = '\0';
3604 ++ strncat(env_var, start + 2, end - start - 2);
3605 ++ strncat(expanded, new_location, start - new_location);
3606 ++ strncat(expanded, getenv(env_var),
3607 ++ PATH_MAX - strlen(expanded));
3608 ++ strncat(expanded, end + 1,
3609 ++ PATH_MAX - strlen(expanded));
3610 ++ strncpy(new_location, expanded, PATH_MAX);
3611 ++ new_location[PATH_MAX] = 0;
3612 ++ } else
3613 ++ break;
3614 ++ }
3615 ++
3616 ++ return new_location;
3617 + }
3618 +
3619 +
3620
3621 diff --git a/3.2.32/4420_grsecurity-2.9.1-3.2.32-201210291445.patch b/3.2.33/4420_grsecurity-2.9.1-3.2.33-201210310843.patch
3622 similarity index 99%
3623 rename from 3.2.32/4420_grsecurity-2.9.1-3.2.32-201210291445.patch
3624 rename to 3.2.33/4420_grsecurity-2.9.1-3.2.33-201210310843.patch
3625 index 7d16a10..81903cd 100644
3626 --- a/3.2.32/4420_grsecurity-2.9.1-3.2.32-201210291445.patch
3627 +++ b/3.2.33/4420_grsecurity-2.9.1-3.2.33-201210310843.patch
3628 @@ -255,7 +255,7 @@ index 88fd7f5..b318a78 100644
3629 ==============================================================
3630
3631 diff --git a/Makefile b/Makefile
3632 -index b6d8282..f804e48 100644
3633 +index 63ca1ea2..811946a 100644
3634 --- a/Makefile
3635 +++ b/Makefile
3636 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
3637 @@ -5996,7 +5996,7 @@ index 42b282f..28ce9f2 100644
3638 addr = vmm->vm_end;
3639 if (flags & MAP_SHARED)
3640 diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
3641 -index 441521a..b767073 100644
3642 +index 5e4252b..cbc22e8 100644
3643 --- a/arch/sparc/kernel/sys_sparc_64.c
3644 +++ b/arch/sparc/kernel/sys_sparc_64.c
3645 @@ -124,7 +124,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
3646 @@ -6147,7 +6147,7 @@ index 441521a..b767073 100644
3647 mm->unmap_area = arch_unmap_area_topdown;
3648 }
3649 diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
3650 -index 1d7e274..b39c527 100644
3651 +index 7f5f65d..3308382 100644
3652 --- a/arch/sparc/kernel/syscalls.S
3653 +++ b/arch/sparc/kernel/syscalls.S
3654 @@ -62,7 +62,7 @@ sys32_rt_sigreturn:
3655 @@ -6177,24 +6177,15 @@ index 1d7e274..b39c527 100644
3656 bne,pn %icc, linux_syscall_trace ! CTI Group
3657 mov %i0, %l5 ! IEU0
3658 2: call %l7 ! CTI Group brk forced
3659 -@@ -226,7 +226,7 @@ ret_sys_call:
3660 +@@ -218,7 +218,7 @@ ret_sys_call:
3661
3662 cmp %o0, -ERESTART_RESTARTBLOCK
3663 bgeu,pn %xcc, 1f
3664 -- andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
3665 -+ andcc %l0, _TIF_WORK_SYSCALL, %l6
3666 - 80:
3667 - /* System call success, clear Carry condition code. */
3668 - andn %g3, %g2, %g3
3669 -@@ -241,7 +241,7 @@ ret_sys_call:
3670 - /* System call failure, set Carry condition code.
3671 - * Also, get abs(errno) to return to the process.
3672 - */
3673 -- andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %l6
3674 -+ andcc %l0, _TIF_WORK_SYSCALL, %l6
3675 - sub %g0, %o0, %o0
3676 - or %g3, %g2, %g3
3677 - stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
3678 +- andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT|_TIF_SYSCALL_TRACEPOINT), %g0
3679 ++ andcc %l0, _TIF_WORK_SYSCALL, %g0
3680 + ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
3681 +
3682 + 2:
3683 diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
3684 index 591f20c..0f1b925 100644
3685 --- a/arch/sparc/kernel/traps_32.c
3686 @@ -15002,7 +14993,7 @@ index cd28a35..c72ed9a 100644
3687 #include <asm/processor.h>
3688 #include <asm/fcntl.h>
3689 diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
3690 -index bcda816..cbab6db 100644
3691 +index 4893d58..0152a42 100644
3692 --- a/arch/x86/kernel/entry_32.S
3693 +++ b/arch/x86/kernel/entry_32.S
3694 @@ -180,13 +180,153 @@
3695 @@ -15685,7 +15676,7 @@ index bcda816..cbab6db 100644
3696 /*
3697 * End of kprobes section
3698 */
3699 -@@ -1112,7 +1377,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
3700 +@@ -1114,7 +1379,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
3701
3702 ENTRY(mcount)
3703 ret
3704 @@ -15694,7 +15685,7 @@ index bcda816..cbab6db 100644
3705
3706 ENTRY(ftrace_caller)
3707 cmpl $0, function_trace_stop
3708 -@@ -1141,7 +1406,7 @@ ftrace_graph_call:
3709 +@@ -1143,7 +1408,7 @@ ftrace_graph_call:
3710 .globl ftrace_stub
3711 ftrace_stub:
3712 ret
3713 @@ -15703,7 +15694,7 @@ index bcda816..cbab6db 100644
3714
3715 #else /* ! CONFIG_DYNAMIC_FTRACE */
3716
3717 -@@ -1177,7 +1442,7 @@ trace:
3718 +@@ -1179,7 +1444,7 @@ trace:
3719 popl %ecx
3720 popl %eax
3721 jmp ftrace_stub
3722 @@ -15712,7 +15703,7 @@ index bcda816..cbab6db 100644
3723 #endif /* CONFIG_DYNAMIC_FTRACE */
3724 #endif /* CONFIG_FUNCTION_TRACER */
3725
3726 -@@ -1198,7 +1463,7 @@ ENTRY(ftrace_graph_caller)
3727 +@@ -1200,7 +1465,7 @@ ENTRY(ftrace_graph_caller)
3728 popl %ecx
3729 popl %eax
3730 ret
3731 @@ -15721,7 +15712,7 @@ index bcda816..cbab6db 100644
3732
3733 .globl return_to_handler
3734 return_to_handler:
3735 -@@ -1212,7 +1477,6 @@ return_to_handler:
3736 +@@ -1214,7 +1479,6 @@ return_to_handler:
3737 jmp *%ecx
3738 #endif
3739
3740 @@ -15729,7 +15720,7 @@ index bcda816..cbab6db 100644
3741 #include "syscall_table_32.S"
3742
3743 syscall_table_size=(.-sys_call_table)
3744 -@@ -1258,15 +1522,18 @@ error_code:
3745 +@@ -1260,15 +1524,18 @@ error_code:
3746 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
3747 REG_TO_PTGS %ecx
3748 SET_KERNEL_GS %ecx
3749 @@ -15750,7 +15741,7 @@ index bcda816..cbab6db 100644
3750
3751 /*
3752 * Debug traps and NMI can happen at the one SYSENTER instruction
3753 -@@ -1308,7 +1575,7 @@ debug_stack_correct:
3754 +@@ -1310,7 +1577,7 @@ debug_stack_correct:
3755 call do_debug
3756 jmp ret_from_exception
3757 CFI_ENDPROC
3758 @@ -15759,7 +15750,7 @@ index bcda816..cbab6db 100644
3759
3760 /*
3761 * NMI is doubly nasty. It can happen _while_ we're handling
3762 -@@ -1345,6 +1612,9 @@ nmi_stack_correct:
3763 +@@ -1347,6 +1614,9 @@ nmi_stack_correct:
3764 xorl %edx,%edx # zero error code
3765 movl %esp,%eax # pt_regs pointer
3766 call do_nmi
3767 @@ -15769,7 +15760,7 @@ index bcda816..cbab6db 100644
3768 jmp restore_all_notrace
3769 CFI_ENDPROC
3770
3771 -@@ -1381,12 +1651,15 @@ nmi_espfix_stack:
3772 +@@ -1383,12 +1653,15 @@ nmi_espfix_stack:
3773 FIXUP_ESPFIX_STACK # %eax == %esp
3774 xorl %edx,%edx # zero error code
3775 call do_nmi
3776 @@ -15786,7 +15777,7 @@ index bcda816..cbab6db 100644
3777
3778 ENTRY(int3)
3779 RING0_INT_FRAME
3780 -@@ -1398,14 +1671,14 @@ ENTRY(int3)
3781 +@@ -1400,14 +1673,14 @@ ENTRY(int3)
3782 call do_int3
3783 jmp ret_from_exception
3784 CFI_ENDPROC
3785 @@ -15803,7 +15794,7 @@ index bcda816..cbab6db 100644
3786
3787 #ifdef CONFIG_KVM_GUEST
3788 ENTRY(async_page_fault)
3789 -@@ -1413,7 +1686,7 @@ ENTRY(async_page_fault)
3790 +@@ -1415,7 +1688,7 @@ ENTRY(async_page_fault)
3791 pushl_cfi $do_async_page_fault
3792 jmp error_code
3793 CFI_ENDPROC
3794 @@ -15813,7 +15804,7 @@ index bcda816..cbab6db 100644
3795
3796 /*
3797 diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
3798 -index faf8d5e..ed7340c 100644
3799 +index 6274f5f..b451ef1 100644
3800 --- a/arch/x86/kernel/entry_64.S
3801 +++ b/arch/x86/kernel/entry_64.S
3802 @@ -55,6 +55,8 @@
3803 @@ -27436,7 +27427,7 @@ index 153407c..611cba9 100644
3804 -}
3805 -__setup("vdso=", vdso_setup);
3806 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
3807 -index a1e21ae..0b6bc7b 100644
3808 +index 69b9ef6..cbe5f3a 100644
3809 --- a/arch/x86/xen/enlighten.c
3810 +++ b/arch/x86/xen/enlighten.c
3811 @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
3812 @@ -27467,7 +27458,7 @@ index a1e21ae..0b6bc7b 100644
3813 }
3814
3815 #endif
3816 -@@ -1041,7 +1039,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
3817 +@@ -1057,7 +1055,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
3818 #endif
3819 };
3820
3821 @@ -27476,7 +27467,7 @@ index a1e21ae..0b6bc7b 100644
3822 {
3823 struct sched_shutdown r = { .reason = reason };
3824
3825 -@@ -1049,17 +1047,17 @@ static void xen_reboot(int reason)
3826 +@@ -1065,17 +1063,17 @@ static void xen_reboot(int reason)
3827 BUG();
3828 }
3829
3830 @@ -27497,7 +27488,7 @@ index a1e21ae..0b6bc7b 100644
3831 {
3832 xen_reboot(SHUTDOWN_poweroff);
3833 }
3834 -@@ -1165,7 +1163,17 @@ asmlinkage void __init xen_start_kernel(void)
3835 +@@ -1181,7 +1179,17 @@ asmlinkage void __init xen_start_kernel(void)
3836 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
3837
3838 /* Work out if we support NX */
3839 @@ -27516,7 +27507,7 @@ index a1e21ae..0b6bc7b 100644
3840
3841 xen_setup_features();
3842
3843 -@@ -1196,13 +1204,6 @@ asmlinkage void __init xen_start_kernel(void)
3844 +@@ -1212,13 +1220,6 @@ asmlinkage void __init xen_start_kernel(void)
3845
3846 machine_ops = xen_machine_ops;
3847
3848 @@ -30155,7 +30146,7 @@ index 1ee8ce7..b778bef 100644
3849
3850 return 0;
3851 diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
3852 -index b366b34..7e61653 100644
3853 +index 0d91655..96118e0 100644
3854 --- a/drivers/char/tpm/tpm.c
3855 +++ b/drivers/char/tpm/tpm.c
3856 @@ -414,7 +414,7 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
3857 @@ -30250,10 +30241,10 @@ index eb1d864..39ee5a7 100644
3858
3859 pr_info("dmatest: Started %u threads using %s\n",
3860 diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
3861 -index c9eee6d..f9d5280 100644
3862 +index a9d5482..376077f 100644
3863 --- a/drivers/edac/amd64_edac.c
3864 +++ b/drivers/edac/amd64_edac.c
3865 -@@ -2685,7 +2685,7 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
3866 +@@ -2682,7 +2682,7 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
3867 * PCI core identifies what devices are on a system during boot, and then
3868 * inquiry this table to see if this driver is for a given device found.
3869 */
3870 @@ -31972,10 +31963,10 @@ index 4ef02b2..8a96831 100644
3871
3872 for (i = 0; i < hid->maxcollection; i++)
3873 diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
3874 -index 4065374..10ed7dc 100644
3875 +index f4c3d28..82f45a9 100644
3876 --- a/drivers/hv/channel.c
3877 +++ b/drivers/hv/channel.c
3878 -@@ -400,8 +400,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
3879 +@@ -402,8 +402,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
3880 int ret = 0;
3881 int t;
3882
3883 @@ -34363,7 +34354,7 @@ index 62306e5..c32000a 100644
3884 "md/raid1:%s: read error corrected "
3885 "(%d sectors at %llu on %s)\n",
3886 diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
3887 -index 0634ee5..1686c46 100644
3888 +index 8f67c4d..cea5925 100644
3889 --- a/drivers/md/raid10.c
3890 +++ b/drivers/md/raid10.c
3891 @@ -1455,7 +1455,7 @@ static void end_sync_read(struct bio *bio, int error)
3892 @@ -42615,7 +42606,7 @@ index 3c14e43..eafa544 100644
3893 +4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
3894 +4 4 4 4 4 4
3895 diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
3896 -index 41746bb..febcb44 100644
3897 +index cb5988f..a44fee7 100644
3898 --- a/drivers/video/udlfb.c
3899 +++ b/drivers/video/udlfb.c
3900 @@ -619,11 +619,11 @@ int dlfb_handle_damage(struct dlfb_data *dev, int x, int y,
3901 @@ -44871,19 +44862,10 @@ index 112e45a..b59845b 100644
3902
3903 /*
3904 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
3905 -index 51352de..93292ff 100644
3906 +index f854cf9..93292ff 100644
3907 --- a/fs/compat_ioctl.c
3908 +++ b/fs/compat_ioctl.c
3909 -@@ -210,6 +210,8 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd,
3910 -
3911 - err = get_user(palp, &up->palette);
3912 - err |= get_user(length, &up->length);
3913 -+ if (err)
3914 -+ return -EFAULT;
3915 -
3916 - up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
3917 - err = put_user(compat_ptr(palp), &up_native->palette);
3918 -@@ -621,7 +623,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
3919 +@@ -623,7 +623,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
3920 return -EFAULT;
3921 if (__get_user(udata, &ss32->iomem_base))
3922 return -EFAULT;
3923 @@ -44892,7 +44874,7 @@ index 51352de..93292ff 100644
3924 if (__get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) ||
3925 __get_user(ss.port_high, &ss32->port_high))
3926 return -EFAULT;
3927 -@@ -796,7 +798,7 @@ static int compat_ioctl_preallocate(struct file *file,
3928 +@@ -798,7 +798,7 @@ static int compat_ioctl_preallocate(struct file *file,
3929 copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) ||
3930 copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) ||
3931 copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) ||
3932 @@ -44901,7 +44883,7 @@ index 51352de..93292ff 100644
3933 return -EFAULT;
3934
3935 return ioctl_preallocate(file, p);
3936 -@@ -1644,8 +1646,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
3937 +@@ -1646,8 +1646,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
3938 static int __init init_sys32_ioctl_cmp(const void *p, const void *q)
3939 {
3940 unsigned int a, b;
3941 @@ -45066,7 +45048,7 @@ index a6f3763..f38ed00 100644
3942
3943 out_free_fd:
3944 diff --git a/fs/exec.c b/fs/exec.c
3945 -index 160cd2f..7f5ba47 100644
3946 +index 121ccae..c12bdc7 100644
3947 --- a/fs/exec.c
3948 +++ b/fs/exec.c
3949 @@ -55,12 +55,33 @@
3950 @@ -47845,7 +47827,7 @@ index ee4e66b..9a39f9c 100644
3951 spin_unlock(&inode->i_lock);
3952 }
3953 diff --git a/fs/isofs/export.c b/fs/isofs/export.c
3954 -index dd4687f..e9b81e0 100644
3955 +index 516eb21..fd88add 100644
3956 --- a/fs/isofs/export.c
3957 +++ b/fs/isofs/export.c
3958 @@ -135,6 +135,7 @@ isofs_export_encode_fh(struct dentry *dentry,
3959 @@ -50947,7 +50929,7 @@ index 014fcb4..980206f 100644
3960
3961 pipe_unlock(ipipe);
3962 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
3963 -index 7fdf6a7..e6cd8ad 100644
3964 +index fabbb81..91a12e3 100644
3965 --- a/fs/sysfs/dir.c
3966 +++ b/fs/sysfs/dir.c
3967 @@ -642,6 +642,18 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
3968 @@ -67493,10 +67475,10 @@ index b463871..fa3ea1f 100644
3969 * nsown_capable - Check superior capability to one's own user_ns
3970 * @cap: The capability in question
3971 diff --git a/kernel/cgroup.c b/kernel/cgroup.c
3972 -index cdc0354..aab57fc 100644
3973 +index 6337535..861ca46 100644
3974 --- a/kernel/cgroup.c
3975 +++ b/kernel/cgroup.c
3976 -@@ -5156,7 +5156,7 @@ static int cgroup_css_links_read(struct cgroup *cont,
3977 +@@ -5155,7 +5155,7 @@ static int cgroup_css_links_read(struct cgroup *cont,
3978 struct css_set *cg = link->cg;
3979 struct task_struct *task;
3980 int count = 0;
3981 @@ -68968,7 +68950,7 @@ index 91c32a0..7b88d63 100644
3982 seq_printf(m, "%40s %14lu %29s %pS\n",
3983 name, stats->contending_point[i],
3984 diff --git a/kernel/module.c b/kernel/module.c
3985 -index 6969ef0..39c391d 100644
3986 +index 6c8fa34..0ab39b6 100644
3987 --- a/kernel/module.c
3988 +++ b/kernel/module.c
3989 @@ -58,6 +58,7 @@
3990 @@ -69486,7 +69468,7 @@ index 6969ef0..39c391d 100644
3991 DEBUGP("\t0x%lx %s\n",
3992 shdr->sh_addr, info->secstrings + shdr->sh_name);
3993 }
3994 -@@ -2688,12 +2787,12 @@ static void flush_module_icache(const struct module *mod)
3995 +@@ -2692,12 +2791,12 @@ static void flush_module_icache(const struct module *mod)
3996 * Do it before processing of module parameters, so the module
3997 * can provide parameter accessor functions of its own.
3998 */
3999 @@ -69505,7 +69487,7 @@ index 6969ef0..39c391d 100644
4000
4001 set_fs(old_fs);
4002 }
4003 -@@ -2773,8 +2872,10 @@ static void module_deallocate(struct module *mod, struct load_info *info)
4004 +@@ -2777,8 +2876,10 @@ static void module_deallocate(struct module *mod, struct load_info *info)
4005 {
4006 kfree(info->strmap);
4007 percpu_modfree(mod);
4008 @@ -69518,7 +69500,7 @@ index 6969ef0..39c391d 100644
4009 }
4010
4011 int __weak module_finalize(const Elf_Ehdr *hdr,
4012 -@@ -2838,9 +2939,38 @@ static struct module *load_module(void __user *umod,
4013 +@@ -2842,9 +2943,38 @@ static struct module *load_module(void __user *umod,
4014 if (err)
4015 goto free_unload;
4016
4017 @@ -69557,7 +69539,7 @@ index 6969ef0..39c391d 100644
4018 /* Fix up syms, so that st_value is a pointer to location. */
4019 err = simplify_symbols(mod, &info);
4020 if (err < 0)
4021 -@@ -2856,13 +2986,6 @@ static struct module *load_module(void __user *umod,
4022 +@@ -2860,13 +2990,6 @@ static struct module *load_module(void __user *umod,
4023
4024 flush_module_icache(mod);
4025
4026 @@ -69571,7 +69553,7 @@ index 6969ef0..39c391d 100644
4027 /* Mark state as coming so strong_try_module_get() ignores us. */
4028 mod->state = MODULE_STATE_COMING;
4029
4030 -@@ -2920,11 +3043,10 @@ static struct module *load_module(void __user *umod,
4031 +@@ -2924,11 +3047,10 @@ static struct module *load_module(void __user *umod,
4032 unlock:
4033 mutex_unlock(&module_mutex);
4034 synchronize_sched();
4035 @@ -69584,7 +69566,7 @@ index 6969ef0..39c391d 100644
4036 free_unload:
4037 module_unload_free(mod);
4038 free_module:
4039 -@@ -2965,16 +3087,16 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
4040 +@@ -2969,16 +3091,16 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
4041 MODULE_STATE_COMING, mod);
4042
4043 /* Set RO and NX regions for core */
4044 @@ -69609,7 +69591,7 @@ index 6969ef0..39c391d 100644
4045
4046 do_mod_ctors(mod);
4047 /* Start the module */
4048 -@@ -3020,11 +3142,12 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
4049 +@@ -3024,11 +3146,12 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
4050 mod->strtab = mod->core_strtab;
4051 #endif
4052 unset_module_init_ro_nx(mod);
4053 @@ -69627,7 +69609,7 @@ index 6969ef0..39c391d 100644
4054 mutex_unlock(&module_mutex);
4055
4056 return 0;
4057 -@@ -3055,10 +3178,16 @@ static const char *get_ksymbol(struct module *mod,
4058 +@@ -3059,10 +3182,16 @@ static const char *get_ksymbol(struct module *mod,
4059 unsigned long nextval;
4060
4061 /* At worse, next value is at end of module */
4062 @@ -69647,7 +69629,7 @@ index 6969ef0..39c391d 100644
4063
4064 /* Scan for closest preceding symbol, and next symbol. (ELF
4065 starts real symbols at 1). */
4066 -@@ -3306,7 +3435,7 @@ static int m_show(struct seq_file *m, void *p)
4067 +@@ -3310,7 +3439,7 @@ static int m_show(struct seq_file *m, void *p)
4068 char buf[8];
4069
4070 seq_printf(m, "%s %u",
4071 @@ -69656,7 +69638,7 @@ index 6969ef0..39c391d 100644
4072 print_unload_info(m, mod);
4073
4074 /* Informative for users. */
4075 -@@ -3315,7 +3444,7 @@ static int m_show(struct seq_file *m, void *p)
4076 +@@ -3319,7 +3448,7 @@ static int m_show(struct seq_file *m, void *p)
4077 mod->state == MODULE_STATE_COMING ? "Loading":
4078 "Live");
4079 /* Used by oprofile and other similar tools. */
4080 @@ -69665,7 +69647,7 @@ index 6969ef0..39c391d 100644
4081
4082 /* Taints info */
4083 if (mod->taints)
4084 -@@ -3351,7 +3480,17 @@ static const struct file_operations proc_modules_operations = {
4085 +@@ -3355,7 +3484,17 @@ static const struct file_operations proc_modules_operations = {
4086
4087 static int __init proc_modules_init(void)
4088 {
4089 @@ -69683,7 +69665,7 @@ index 6969ef0..39c391d 100644
4090 return 0;
4091 }
4092 module_init(proc_modules_init);
4093 -@@ -3410,12 +3549,12 @@ struct module *__module_address(unsigned long addr)
4094 +@@ -3414,12 +3553,12 @@ struct module *__module_address(unsigned long addr)
4095 {
4096 struct module *mod;
4097
4098 @@ -69699,7 +69681,7 @@ index 6969ef0..39c391d 100644
4099 return mod;
4100 return NULL;
4101 }
4102 -@@ -3449,11 +3588,20 @@ bool is_module_text_address(unsigned long addr)
4103 +@@ -3453,11 +3592,20 @@ bool is_module_text_address(unsigned long addr)
4104 */
4105 struct module *__module_text_address(unsigned long addr)
4106 {
4107 @@ -71140,7 +71122,7 @@ index 2c71d91..1021f81 100644
4108 struct tasklet_struct *list;
4109
4110 diff --git a/kernel/sys.c b/kernel/sys.c
4111 -index c504302..b76c328 100644
4112 +index d7c4ab0..fc14d2f 100644
4113 --- a/kernel/sys.c
4114 +++ b/kernel/sys.c
4115 @@ -158,6 +158,12 @@ static int set_one_prio(struct task_struct *p, int niceval, int error)
4116 @@ -71264,35 +71246,7 @@ index c504302..b76c328 100644
4117 abort_creds(new);
4118 return old_fsgid;
4119
4120 -@@ -1171,13 +1207,13 @@ DECLARE_RWSEM(uts_sem);
4121 - * Work around broken programs that cannot handle "Linux 3.0".
4122 - * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
4123 - */
4124 --static int override_release(char __user *release, int len)
4125 -+static int override_release(char __user *release, size_t len)
4126 - {
4127 - int ret = 0;
4128 -- char buf[65];
4129 -
4130 - if (current->personality & UNAME26) {
4131 -- char *rest = UTS_RELEASE;
4132 -+ char buf[65] = { 0 };
4133 -+ const char *rest = UTS_RELEASE;
4134 - int ndots = 0;
4135 - unsigned v;
4136 -
4137 -@@ -1189,7 +1225,10 @@ static int override_release(char __user *release, int len)
4138 - rest++;
4139 - }
4140 - v = ((LINUX_VERSION_CODE >> 8) & 0xff) + 40;
4141 -+ if (sizeof buf < len)
4142 -+ len = sizeof buf;
4143 - snprintf(buf, len, "2.6.%u%s", v, rest);
4144 -+ buf[len - 1] = 0;
4145 - ret = copy_to_user(release, buf, len);
4146 - }
4147 - return ret;
4148 -@@ -1244,19 +1283,19 @@ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
4149 +@@ -1246,19 +1282,19 @@ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
4150 return -EFAULT;
4151
4152 down_read(&uts_sem);
4153 @@ -71317,7 +71271,7 @@ index c504302..b76c328 100644
4154 __OLD_UTS_LEN);
4155 error |= __put_user(0, name->machine + __OLD_UTS_LEN);
4156 up_read(&uts_sem);
4157 -@@ -1721,7 +1760,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
4158 +@@ -1723,7 +1759,7 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
4159 error = get_dumpable(me->mm);
4160 break;
4161 case PR_SET_DUMPABLE:
4162 @@ -71753,7 +71707,7 @@ index fd4a7b1..fae5c2a 100644
4163 cpumask_clear_cpu(cpu, tick_get_broadcast_mask());
4164 tick_broadcast_clear_oneshot(cpu);
4165 diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
4166 -index 5ee1ac0..335188f 100644
4167 +index cb7f33e..7504d61 100644
4168 --- a/kernel/time/timekeeping.c
4169 +++ b/kernel/time/timekeeping.c
4170 @@ -14,6 +14,7 @@
4171 @@ -71892,10 +71846,10 @@ index 0b537f2..40d6c20 100644
4172 return -ENOMEM;
4173 return 0;
4174 diff --git a/kernel/timer.c b/kernel/timer.c
4175 -index 9c3c62b..441690e 100644
4176 +index c219db6..bb98998 100644
4177 --- a/kernel/timer.c
4178 +++ b/kernel/timer.c
4179 -@@ -1304,7 +1304,7 @@ void update_process_times(int user_tick)
4180 +@@ -1306,7 +1306,7 @@ void update_process_times(int user_tick)
4181 /*
4182 * This function runs timers and the timer-tq in bottom half context.
4183 */
4184 @@ -75710,10 +75664,10 @@ index e920aa3..137702a 100644
4185 rc = process_vm_rw_single_vec(
4186 (unsigned long)rvec[i].iov_base, rvec[i].iov_len,
4187 diff --git a/mm/rmap.c b/mm/rmap.c
4188 -index a4fd368..e0ffec7 100644
4189 +index 8685697..b490361 100644
4190 --- a/mm/rmap.c
4191 +++ b/mm/rmap.c
4192 -@@ -152,6 +152,10 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4193 +@@ -153,6 +153,10 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4194 struct anon_vma *anon_vma = vma->anon_vma;
4195 struct anon_vma_chain *avc;
4196
4197 @@ -75724,7 +75678,7 @@ index a4fd368..e0ffec7 100644
4198 might_sleep();
4199 if (unlikely(!anon_vma)) {
4200 struct mm_struct *mm = vma->vm_mm;
4201 -@@ -161,6 +165,12 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4202 +@@ -162,6 +166,12 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4203 if (!avc)
4204 goto out_enomem;
4205
4206 @@ -75737,7 +75691,7 @@ index a4fd368..e0ffec7 100644
4207 anon_vma = find_mergeable_anon_vma(vma);
4208 allocated = NULL;
4209 if (!anon_vma) {
4210 -@@ -174,6 +184,21 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4211 +@@ -175,6 +185,21 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4212 /* page_table_lock to protect against threads */
4213 spin_lock(&mm->page_table_lock);
4214 if (likely(!vma->anon_vma)) {
4215 @@ -75759,7 +75713,7 @@ index a4fd368..e0ffec7 100644
4216 vma->anon_vma = anon_vma;
4217 avc->anon_vma = anon_vma;
4218 avc->vma = vma;
4219 -@@ -187,12 +212,24 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4220 +@@ -188,12 +213,24 @@ int anon_vma_prepare(struct vm_area_struct *vma)
4221
4222 if (unlikely(allocated))
4223 put_anon_vma(allocated);
4224 @@ -75784,7 +75738,7 @@ index a4fd368..e0ffec7 100644
4225 anon_vma_chain_free(avc);
4226 out_enomem:
4227 return -ENOMEM;
4228 -@@ -243,7 +280,7 @@ static void anon_vma_chain_link(struct vm_area_struct *vma,
4229 +@@ -244,7 +281,7 @@ static void anon_vma_chain_link(struct vm_area_struct *vma,
4230 * Attach the anon_vmas from src to dst.
4231 * Returns 0 on success, -ENOMEM on failure.
4232 */
4233 @@ -75793,7 +75747,7 @@ index a4fd368..e0ffec7 100644
4234 {
4235 struct anon_vma_chain *avc, *pavc;
4236 struct anon_vma *root = NULL;
4237 -@@ -276,7 +313,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
4238 +@@ -277,7 +314,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src)
4239 * the corresponding VMA in the parent process is attached to.
4240 * Returns 0 on success, non-zero on failure.
4241 */
4242 @@ -75803,7 +75757,7 @@ index a4fd368..e0ffec7 100644
4243 struct anon_vma_chain *avc;
4244 struct anon_vma *anon_vma;
4245 diff --git a/mm/shmem.c b/mm/shmem.c
4246 -index 7a82174..75d1c8b 100644
4247 +index 126ca35..77e6609 100644
4248 --- a/mm/shmem.c
4249 +++ b/mm/shmem.c
4250 @@ -31,7 +31,7 @@
4251 @@ -75824,7 +75778,7 @@ index 7a82174..75d1c8b 100644
4252
4253 struct shmem_xattr {
4254 struct list_head list; /* anchored by shmem_inode_info->xattr_list */
4255 -@@ -2181,8 +2181,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
4256 +@@ -2183,8 +2183,7 @@ int shmem_fill_super(struct super_block *sb, void *data, int silent)
4257 int err = -ENOMEM;
4258
4259 /* Round up to L1_CACHE_BYTES to resist false sharing */
4260 @@ -77891,7 +77845,7 @@ index 68bbf9f..5ef0d12 100644
4261
4262 return err;
4263 diff --git a/net/core/dev.c b/net/core/dev.c
4264 -index abe1147..d7e4046 100644
4265 +index f500a69..94fbae3 100644
4266 --- a/net/core/dev.c
4267 +++ b/net/core/dev.c
4268 @@ -1142,10 +1142,14 @@ void dev_load(struct net *net, const char *name)
4269 @@ -77954,7 +77908,7 @@ index abe1147..d7e4046 100644
4270 {
4271 struct softnet_data *sd = &__get_cpu_var(softnet_data);
4272
4273 -@@ -3327,7 +3331,7 @@ ncls:
4274 +@@ -3330,7 +3334,7 @@ ncls:
4275 if (pt_prev) {
4276 ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
4277 } else {
4278 @@ -77963,7 +77917,7 @@ index abe1147..d7e4046 100644
4279 kfree_skb(skb);
4280 /* Jamal, now you will not able to escape explaining
4281 * me how you were going to use this. :-)
4282 -@@ -3892,7 +3896,7 @@ void netif_napi_del(struct napi_struct *napi)
4283 +@@ -3895,7 +3899,7 @@ void netif_napi_del(struct napi_struct *napi)
4284 }
4285 EXPORT_SYMBOL(netif_napi_del);
4286
4287 @@ -77972,7 +77926,7 @@ index abe1147..d7e4046 100644
4288 {
4289 struct softnet_data *sd = &__get_cpu_var(softnet_data);
4290 unsigned long time_limit = jiffies + 2;
4291 -@@ -4362,8 +4366,13 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
4292 +@@ -4365,8 +4369,13 @@ static int ptype_seq_show(struct seq_file *seq, void *v)
4293 else
4294 seq_printf(seq, "%04x", ntohs(pt->type));
4295
4296 @@ -77986,7 +77940,7 @@ index abe1147..d7e4046 100644
4297 }
4298
4299 return 0;
4300 -@@ -5920,7 +5929,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
4301 +@@ -5923,7 +5932,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
4302 } else {
4303 netdev_stats_to_stats64(storage, &dev->stats);
4304 }
4305 @@ -78693,7 +78647,7 @@ index a08a621..a1ca37e 100644
4306 if (icsk->icsk_af_ops->conn_request(sk, skb) < 0)
4307 return 1;
4308 diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
4309 -index de69cec..74908e1 100644
4310 +index 58c09a0..b62df0b 100644
4311 --- a/net/ipv4/tcp_ipv4.c
4312 +++ b/net/ipv4/tcp_ipv4.c
4313 @@ -87,6 +87,9 @@ int sysctl_tcp_tw_reuse __read_mostly;
4314 @@ -78706,7 +78660,7 @@ index de69cec..74908e1 100644
4315
4316 #ifdef CONFIG_TCP_MD5SIG
4317 static struct tcp_md5sig_key *tcp_v4_md5_do_lookup(struct sock *sk,
4318 -@@ -1636,6 +1639,9 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
4319 +@@ -1637,6 +1640,9 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
4320 return 0;
4321
4322 reset:
4323 @@ -78716,7 +78670,7 @@ index de69cec..74908e1 100644
4324 tcp_v4_send_reset(rsk, skb);
4325 discard:
4326 kfree_skb(skb);
4327 -@@ -1698,12 +1704,19 @@ int tcp_v4_rcv(struct sk_buff *skb)
4328 +@@ -1699,12 +1705,19 @@ int tcp_v4_rcv(struct sk_buff *skb)
4329 TCP_SKB_CB(skb)->sacked = 0;
4330
4331 sk = __inet_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);
4332 @@ -78739,7 +78693,7 @@ index de69cec..74908e1 100644
4333
4334 if (unlikely(iph->ttl < inet_sk(sk)->min_ttl)) {
4335 NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
4336 -@@ -1753,6 +1766,10 @@ no_tcp_socket:
4337 +@@ -1754,6 +1767,10 @@ no_tcp_socket:
4338 bad_packet:
4339 TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
4340 } else {
4341 @@ -78750,7 +78704,7 @@ index de69cec..74908e1 100644
4342 tcp_v4_send_reset(NULL, skb);
4343 }
4344
4345 -@@ -2413,7 +2430,11 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
4346 +@@ -2414,7 +2431,11 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
4347 0, /* non standard timer */
4348 0, /* open_requests have no inode */
4349 atomic_read(&sk->sk_refcnt),
4350 @@ -78762,7 +78716,7 @@ index de69cec..74908e1 100644
4351 len);
4352 }
4353
4354 -@@ -2463,7 +2484,12 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
4355 +@@ -2464,7 +2485,12 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
4356 sock_i_uid(sk),
4357 icsk->icsk_probes_out,
4358 sock_i_ino(sk),
4359 @@ -78776,7 +78730,7 @@ index de69cec..74908e1 100644
4360 jiffies_to_clock_t(icsk->icsk_rto),
4361 jiffies_to_clock_t(icsk->icsk_ack.ato),
4362 (icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
4363 -@@ -2491,7 +2517,13 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
4364 +@@ -2492,7 +2518,13 @@ static void get_timewait4_sock(const struct inet_timewait_sock *tw,
4365 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK%n",
4366 i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
4367 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
4368 @@ -79188,7 +79142,7 @@ index 6e6c2c4..942cebf 100644
4369
4370 static int raw6_seq_show(struct seq_file *seq, void *v)
4371 diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
4372 -index 4a56574..9745b8a 100644
4373 +index ccab3c8..99f760b 100644
4374 --- a/net/ipv6/tcp_ipv6.c
4375 +++ b/net/ipv6/tcp_ipv6.c
4376 @@ -93,6 +93,10 @@ static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk,
4377 @@ -79202,7 +79156,7 @@ index 4a56574..9745b8a 100644
4378 static void tcp_v6_hash(struct sock *sk)
4379 {
4380 if (sk->sk_state != TCP_CLOSE) {
4381 -@@ -1655,6 +1659,9 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
4382 +@@ -1656,6 +1660,9 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
4383 return 0;
4384
4385 reset:
4386 @@ -79212,7 +79166,7 @@ index 4a56574..9745b8a 100644
4387 tcp_v6_send_reset(sk, skb);
4388 discard:
4389 if (opt_skb)
4390 -@@ -1734,12 +1741,20 @@ static int tcp_v6_rcv(struct sk_buff *skb)
4391 +@@ -1735,12 +1742,20 @@ static int tcp_v6_rcv(struct sk_buff *skb)
4392 TCP_SKB_CB(skb)->sacked = 0;
4393
4394 sk = __inet6_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);
4395 @@ -79235,7 +79189,7 @@ index 4a56574..9745b8a 100644
4396
4397 if (hdr->hop_limit < inet6_sk(sk)->min_hopcount) {
4398 NET_INC_STATS_BH(net, LINUX_MIB_TCPMINTTLDROP);
4399 -@@ -1787,6 +1802,10 @@ no_tcp_socket:
4400 +@@ -1788,6 +1803,10 @@ no_tcp_socket:
4401 bad_packet:
4402 TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
4403 } else {
4404 @@ -79246,7 +79200,7 @@ index 4a56574..9745b8a 100644
4405 tcp_v6_send_reset(NULL, skb);
4406 }
4407
4408 -@@ -2047,7 +2066,13 @@ static void get_openreq6(struct seq_file *seq,
4409 +@@ -2048,7 +2067,13 @@ static void get_openreq6(struct seq_file *seq,
4410 uid,
4411 0, /* non standard timer */
4412 0, /* open_requests have no inode */
4413 @@ -79261,7 +79215,7 @@ index 4a56574..9745b8a 100644
4414 }
4415
4416 static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
4417 -@@ -2097,7 +2122,12 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
4418 +@@ -2098,7 +2123,12 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
4419 sock_i_uid(sp),
4420 icsk->icsk_probes_out,
4421 sock_i_ino(sp),
4422 @@ -79275,7 +79229,7 @@ index 4a56574..9745b8a 100644
4423 jiffies_to_clock_t(icsk->icsk_rto),
4424 jiffies_to_clock_t(icsk->icsk_ack.ato),
4425 (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
4426 -@@ -2132,7 +2162,13 @@ static void get_timewait6_sock(struct seq_file *seq,
4427 +@@ -2133,7 +2163,13 @@ static void get_timewait6_sock(struct seq_file *seq,
4428 dest->s6_addr32[2], dest->s6_addr32[3], destp,
4429 tw->tw_substate, 0, 0,
4430 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
4431 @@ -79897,10 +79851,10 @@ index aa2d720..d8aa111 100644
4432 }
4433
4434 diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
4435 -index 1d15193..257c9255 100644
4436 +index 7489bd3..5f4df88 100644
4437 --- a/net/netfilter/nf_conntrack_core.c
4438 +++ b/net/netfilter/nf_conntrack_core.c
4439 -@@ -1485,6 +1485,10 @@ err_proto:
4440 +@@ -1491,6 +1491,10 @@ err_proto:
4441 #define UNCONFIRMED_NULLS_VAL ((1<<30)+0)
4442 #define DYING_NULLS_VAL ((1<<30)+1)
4443
4444 @@ -79911,7 +79865,7 @@ index 1d15193..257c9255 100644
4445 static int nf_conntrack_init_net(struct net *net)
4446 {
4447 int ret;
4448 -@@ -1498,7 +1502,11 @@ static int nf_conntrack_init_net(struct net *net)
4449 +@@ -1504,7 +1508,11 @@ static int nf_conntrack_init_net(struct net *net)
4450 goto err_stat;
4451 }
4452
4453 @@ -91055,32 +91009,6 @@ index 6789d78..4afd019e 100644
4454 + .endm
4455 +
4456 #endif
4457 -diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
4458 -index af0f22f..9a7d479 100644
4459 ---- a/usr/gen_init_cpio.c
4460 -+++ b/usr/gen_init_cpio.c
4461 -@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location,
4462 - int retval;
4463 - int rc = -1;
4464 - int namesize;
4465 -- int i;
4466 -+ unsigned int i;
4467 -
4468 - mode |= S_IFREG;
4469 -
4470 -@@ -392,9 +392,10 @@ static char *cpio_replace_env(char *new_location)
4471 - *env_var = *expanded = '\0';
4472 - strncat(env_var, start + 2, end - start - 2);
4473 - strncat(expanded, new_location, start - new_location);
4474 -- strncat(expanded, getenv(env_var), PATH_MAX);
4475 -- strncat(expanded, end + 1, PATH_MAX);
4476 -+ strncat(expanded, getenv(env_var), PATH_MAX - strlen(expanded));
4477 -+ strncat(expanded, end + 1, PATH_MAX - strlen(expanded));
4478 - strncpy(new_location, expanded, PATH_MAX);
4479 -+ new_location[PATH_MAX] = 0;
4480 - } else
4481 - break;
4482 - }
4483 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
4484 index ec747dc..d3e1f29 100644
4485 --- a/virt/kvm/kvm_main.c
4486
4487 diff --git a/3.2.32/4430_grsec-remove-localversion-grsec.patch b/3.2.33/4430_grsec-remove-localversion-grsec.patch
4488 similarity index 100%
4489 rename from 3.2.32/4430_grsec-remove-localversion-grsec.patch
4490 rename to 3.2.33/4430_grsec-remove-localversion-grsec.patch
4491
4492 diff --git a/3.2.32/4435_grsec-mute-warnings.patch b/3.2.33/4435_grsec-mute-warnings.patch
4493 similarity index 100%
4494 rename from 3.2.32/4435_grsec-mute-warnings.patch
4495 rename to 3.2.33/4435_grsec-mute-warnings.patch
4496
4497 diff --git a/3.2.32/4440_grsec-remove-protected-paths.patch b/3.2.33/4440_grsec-remove-protected-paths.patch
4498 similarity index 100%
4499 rename from 3.2.32/4440_grsec-remove-protected-paths.patch
4500 rename to 3.2.33/4440_grsec-remove-protected-paths.patch
4501
4502 diff --git a/3.2.32/4450_grsec-kconfig-default-gids.patch b/3.2.33/4450_grsec-kconfig-default-gids.patch
4503 similarity index 100%
4504 rename from 3.2.32/4450_grsec-kconfig-default-gids.patch
4505 rename to 3.2.33/4450_grsec-kconfig-default-gids.patch
4506
4507 diff --git a/3.2.32/4465_selinux-avc_audit-log-curr_ip.patch b/3.2.33/4465_selinux-avc_audit-log-curr_ip.patch
4508 similarity index 100%
4509 rename from 3.2.32/4465_selinux-avc_audit-log-curr_ip.patch
4510 rename to 3.2.33/4465_selinux-avc_audit-log-curr_ip.patch
4511
4512 diff --git a/3.2.32/4470_disable-compat_vdso.patch b/3.2.33/4470_disable-compat_vdso.patch
4513 similarity index 100%
4514 rename from 3.2.32/4470_disable-compat_vdso.patch
4515 rename to 3.2.33/4470_disable-compat_vdso.patch
4516
4517 diff --git a/3.6.4/0000_README b/3.6.5/0000_README
4518 similarity index 91%
4519 rename from 3.6.4/0000_README
4520 rename to 3.6.5/0000_README
4521 index 4789a33..dfd814a 100644
4522 --- a/3.6.4/0000_README
4523 +++ b/3.6.5/0000_README
4524 @@ -2,7 +2,11 @@ README
4525 -----------------------------------------------------------------------------
4526 Individual Patch Descriptions:
4527 -----------------------------------------------------------------------------
4528 -Patch: 4420_grsecurity-2.9.1-3.6.4-201210291446.patch
4529 +Patch: 1004_linux-3.6.5.patch
4530 +From: http://www.kernel.org
4531 +Desc: Linux 3.6.5
4532 +
4533 +Patch: 4420_grsecurity-2.9.1-3.6.5-201210312121.patch
4534 From: http://www.grsecurity.net
4535 Desc: hardened-sources base patch from upstream grsecurity
4536
4537
4538 diff --git a/3.6.5/1004_linux-3.6.5.patch b/3.6.5/1004_linux-3.6.5.patch
4539 new file mode 100644
4540 index 0000000..738b926
4541 --- /dev/null
4542 +++ b/3.6.5/1004_linux-3.6.5.patch
4543 @@ -0,0 +1,4649 @@
4544 +diff --git a/Documentation/devicetree/bindings/arm/atmel-at91.txt b/Documentation/devicetree/bindings/arm/atmel-at91.txt
4545 +index ecc81e3..d187e9f 100644
4546 +--- a/Documentation/devicetree/bindings/arm/atmel-at91.txt
4547 ++++ b/Documentation/devicetree/bindings/arm/atmel-at91.txt
4548 +@@ -8,7 +8,7 @@ PIT Timer required properties:
4549 + shared across all System Controller members.
4550 +
4551 + TC/TCLIB Timer required properties:
4552 +-- compatible: Should be "atmel,<chip>-pit".
4553 ++- compatible: Should be "atmel,<chip>-tcb".
4554 + <chip> can be "at91rm9200" or "at91sam9x5"
4555 + - reg: Should contain registers location and length
4556 + - interrupts: Should contain all interrupts for the TC block
4557 +diff --git a/Makefile b/Makefile
4558 +index dcf132a..6e4a00d 100644
4559 +--- a/Makefile
4560 ++++ b/Makefile
4561 +@@ -1,6 +1,6 @@
4562 + VERSION = 3
4563 + PATCHLEVEL = 6
4564 +-SUBLEVEL = 4
4565 ++SUBLEVEL = 5
4566 + EXTRAVERSION =
4567 + NAME = Terrified Chipmunk
4568 +
4569 +diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
4570 +index ebd8ad2..0181f7e 100644
4571 +--- a/arch/arm/kernel/smp.c
4572 ++++ b/arch/arm/kernel/smp.c
4573 +@@ -222,18 +222,24 @@ static void percpu_timer_setup(void);
4574 + asmlinkage void __cpuinit secondary_start_kernel(void)
4575 + {
4576 + struct mm_struct *mm = &init_mm;
4577 +- unsigned int cpu = smp_processor_id();
4578 ++ unsigned int cpu;
4579 ++
4580 ++ /*
4581 ++ * The identity mapping is uncached (strongly ordered), so
4582 ++ * switch away from it before attempting any exclusive accesses.
4583 ++ */
4584 ++ cpu_switch_mm(mm->pgd, mm);
4585 ++ enter_lazy_tlb(mm, current);
4586 ++ local_flush_tlb_all();
4587 +
4588 + /*
4589 + * All kernel threads share the same mm context; grab a
4590 + * reference and switch to it.
4591 + */
4592 ++ cpu = smp_processor_id();
4593 + atomic_inc(&mm->mm_count);
4594 + current->active_mm = mm;
4595 + cpumask_set_cpu(cpu, mm_cpumask(mm));
4596 +- cpu_switch_mm(mm->pgd, mm);
4597 +- enter_lazy_tlb(mm, current);
4598 +- local_flush_tlb_all();
4599 +
4600 + printk("CPU%u: Booted secondary processor\n", cpu);
4601 +
4602 +diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
4603 +index 01fb732..d5a4913 100644
4604 +--- a/arch/arm/mach-at91/at91rm9200_devices.c
4605 ++++ b/arch/arm/mach-at91/at91rm9200_devices.c
4606 +@@ -463,7 +463,7 @@ static struct i2c_gpio_platform_data pdata = {
4607 +
4608 + static struct platform_device at91rm9200_twi_device = {
4609 + .name = "i2c-gpio",
4610 +- .id = -1,
4611 ++ .id = 0,
4612 + .dev.platform_data = &pdata,
4613 + };
4614 +
4615 +diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
4616 +index bce572a..18ca240 100644
4617 +--- a/arch/arm/mach-at91/at91sam9260_devices.c
4618 ++++ b/arch/arm/mach-at91/at91sam9260_devices.c
4619 +@@ -471,7 +471,7 @@ static struct i2c_gpio_platform_data pdata = {
4620 +
4621 + static struct platform_device at91sam9260_twi_device = {
4622 + .name = "i2c-gpio",
4623 +- .id = -1,
4624 ++ .id = 0,
4625 + .dev.platform_data = &pdata,
4626 + };
4627 +
4628 +diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
4629 +index bc2590d..2495de8 100644
4630 +--- a/arch/arm/mach-at91/at91sam9261_devices.c
4631 ++++ b/arch/arm/mach-at91/at91sam9261_devices.c
4632 +@@ -285,7 +285,7 @@ static struct i2c_gpio_platform_data pdata = {
4633 +
4634 + static struct platform_device at91sam9261_twi_device = {
4635 + .name = "i2c-gpio",
4636 +- .id = -1,
4637 ++ .id = 0,
4638 + .dev.platform_data = &pdata,
4639 + };
4640 +
4641 +diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
4642 +index 9b6ca73..9877963 100644
4643 +--- a/arch/arm/mach-at91/at91sam9263_devices.c
4644 ++++ b/arch/arm/mach-at91/at91sam9263_devices.c
4645 +@@ -542,7 +542,7 @@ static struct i2c_gpio_platform_data pdata = {
4646 +
4647 + static struct platform_device at91sam9263_twi_device = {
4648 + .name = "i2c-gpio",
4649 +- .id = -1,
4650 ++ .id = 0,
4651 + .dev.platform_data = &pdata,
4652 + };
4653 +
4654 +diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
4655 +index b3d365d..c82a427 100644
4656 +--- a/arch/arm/mach-at91/at91sam9rl_devices.c
4657 ++++ b/arch/arm/mach-at91/at91sam9rl_devices.c
4658 +@@ -314,7 +314,7 @@ static struct i2c_gpio_platform_data pdata = {
4659 +
4660 + static struct platform_device at91sam9rl_twi_device = {
4661 + .name = "i2c-gpio",
4662 +- .id = -1,
4663 ++ .id = 0,
4664 + .dev.platform_data = &pdata,
4665 + };
4666 +
4667 +diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
4668 +index 18103c5d..997d359 100644
4669 +--- a/arch/arm/mach-at91/board-neocore926.c
4670 ++++ b/arch/arm/mach-at91/board-neocore926.c
4671 +@@ -129,7 +129,7 @@ static struct spi_board_info neocore926_spi_devices[] = {
4672 + .max_speed_hz = 125000 * 16,
4673 + .bus_num = 0,
4674 + .platform_data = &ads_info,
4675 +- .irq = AT91SAM9263_ID_IRQ1,
4676 ++ .irq = NR_IRQS_LEGACY + AT91SAM9263_ID_IRQ1,
4677 + },
4678 + #endif
4679 + };
4680 +diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
4681 +index 2269be5..17659be 100644
4682 +--- a/arch/arm/mach-at91/board-sam9261ek.c
4683 ++++ b/arch/arm/mach-at91/board-sam9261ek.c
4684 +@@ -309,7 +309,7 @@ static struct spi_board_info ek_spi_devices[] = {
4685 + .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
4686 + .bus_num = 0,
4687 + .platform_data = &ads_info,
4688 +- .irq = AT91SAM9261_ID_IRQ0,
4689 ++ .irq = NR_IRQS_LEGACY + AT91SAM9261_ID_IRQ0,
4690 + .controller_data = (void *) AT91_PIN_PA28, /* CS pin */
4691 + },
4692 + #endif
4693 +diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
4694 +index 82adf58..9e7153b 100644
4695 +--- a/arch/arm/mach-at91/board-sam9263ek.c
4696 ++++ b/arch/arm/mach-at91/board-sam9263ek.c
4697 +@@ -132,7 +132,7 @@ static struct spi_board_info ek_spi_devices[] = {
4698 + .max_speed_hz = 125000 * 26, /* (max sample rate @ 3V) * (cmd + data + overhead) */
4699 + .bus_num = 0,
4700 + .platform_data = &ads_info,
4701 +- .irq = AT91SAM9263_ID_IRQ1,
4702 ++ .irq = NR_IRQS_LEGACY + AT91SAM9263_ID_IRQ1,
4703 + },
4704 + #endif
4705 + };
4706 +diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
4707 +index f496506..b62f560e 100644
4708 +--- a/arch/arm/mach-at91/generic.h
4709 ++++ b/arch/arm/mach-at91/generic.h
4710 +@@ -26,7 +26,8 @@ extern void __init at91_dt_initialize(void);
4711 + extern void __init at91_init_irq_default(void);
4712 + extern void __init at91_init_interrupts(unsigned int priority[]);
4713 + extern void __init at91x40_init_interrupts(unsigned int priority[]);
4714 +-extern void __init at91_aic_init(unsigned int priority[]);
4715 ++extern void __init at91_aic_init(unsigned int priority[],
4716 ++ unsigned int ext_irq_mask);
4717 + extern int __init at91_aic_of_init(struct device_node *node,
4718 + struct device_node *parent);
4719 + extern int __init at91_aic5_of_init(struct device_node *node,
4720 +diff --git a/arch/arm/mach-at91/irq.c b/arch/arm/mach-at91/irq.c
4721 +index 1e02c0e..febc2ee 100644
4722 +--- a/arch/arm/mach-at91/irq.c
4723 ++++ b/arch/arm/mach-at91/irq.c
4724 +@@ -502,14 +502,19 @@ int __init at91_aic5_of_init(struct device_node *node,
4725 + /*
4726 + * Initialize the AIC interrupt controller.
4727 + */
4728 +-void __init at91_aic_init(unsigned int *priority)
4729 ++void __init at91_aic_init(unsigned int *priority, unsigned int ext_irq_mask)
4730 + {
4731 + unsigned int i;
4732 + int irq_base;
4733 +
4734 +- if (at91_aic_pm_init())
4735 ++ at91_extern_irq = kzalloc(BITS_TO_LONGS(n_irqs)
4736 ++ * sizeof(*at91_extern_irq), GFP_KERNEL);
4737 ++
4738 ++ if (at91_aic_pm_init() || at91_extern_irq == NULL)
4739 + panic("Unable to allocate bit maps\n");
4740 +
4741 ++ *at91_extern_irq = ext_irq_mask;
4742 ++
4743 + at91_aic_base = ioremap(AT91_AIC, 512);
4744 + if (!at91_aic_base)
4745 + panic("Unable to ioremap AIC registers\n");
4746 +diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
4747 +index 944bffb..bd0e88c 100644
4748 +--- a/arch/arm/mach-at91/setup.c
4749 ++++ b/arch/arm/mach-at91/setup.c
4750 +@@ -47,7 +47,7 @@ void __init at91_init_irq_default(void)
4751 + void __init at91_init_interrupts(unsigned int *priority)
4752 + {
4753 + /* Initialize the AIC interrupt controller */
4754 +- at91_aic_init(priority);
4755 ++ at91_aic_init(priority, at91_extern_irq);
4756 +
4757 + /* Enable GPIO interrupts */
4758 + at91_gpio_irq_setup();
4759 +@@ -151,7 +151,7 @@ static void __init soc_detect(u32 dbgu_base)
4760 + }
4761 +
4762 + /* at91sam9g10 */
4763 +- if ((cidr & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
4764 ++ if ((socid & ~AT91_CIDR_EXT) == ARCH_ID_AT91SAM9G10) {
4765 + at91_soc_initdata.type = AT91_SOC_SAM9G10;
4766 + at91_boot_soc = at91sam9261_soc;
4767 + }
4768 +diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
4769 +index 4eb39cd..3e02ae6 100644
4770 +--- a/arch/arm/mach-exynos/common.c
4771 ++++ b/arch/arm/mach-exynos/common.c
4772 +@@ -47,6 +47,7 @@
4773 + #include <plat/fimc-core.h>
4774 + #include <plat/iic-core.h>
4775 + #include <plat/tv-core.h>
4776 ++#include <plat/spi-core.h>
4777 + #include <plat/regs-serial.h>
4778 +
4779 + #include "common.h"
4780 +@@ -346,6 +347,8 @@ static void __init exynos4_map_io(void)
4781 +
4782 + s5p_fb_setname(0, "exynos4-fb");
4783 + s5p_hdmi_setname("exynos4-hdmi");
4784 ++
4785 ++ s3c64xx_spi_setname("exynos4210-spi");
4786 + }
4787 +
4788 + static void __init exynos5_map_io(void)
4789 +@@ -366,6 +369,8 @@ static void __init exynos5_map_io(void)
4790 + s3c_i2c0_setname("s3c2440-i2c");
4791 + s3c_i2c1_setname("s3c2440-i2c");
4792 + s3c_i2c2_setname("s3c2440-i2c");
4793 ++
4794 ++ s3c64xx_spi_setname("exynos4210-spi");
4795 + }
4796 +
4797 + static void __init exynos4_init_clocks(int xtal)
4798 +diff --git a/arch/arm/mach-s3c24xx/s3c2416.c b/arch/arm/mach-s3c24xx/s3c2416.c
4799 +index ed5a95ec..77ee0b7 100644
4800 +--- a/arch/arm/mach-s3c24xx/s3c2416.c
4801 ++++ b/arch/arm/mach-s3c24xx/s3c2416.c
4802 +@@ -61,6 +61,7 @@
4803 + #include <plat/nand-core.h>
4804 + #include <plat/adc-core.h>
4805 + #include <plat/rtc-core.h>
4806 ++#include <plat/spi-core.h>
4807 +
4808 + static struct map_desc s3c2416_iodesc[] __initdata = {
4809 + IODESC_ENT(WATCHDOG),
4810 +@@ -132,6 +133,7 @@ void __init s3c2416_map_io(void)
4811 + /* initialize device information early */
4812 + s3c2416_default_sdhci0();
4813 + s3c2416_default_sdhci1();
4814 ++ s3c64xx_spi_setname("s3c2443-spi");
4815 +
4816 + iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
4817 + }
4818 +diff --git a/arch/arm/mach-s3c24xx/s3c2443.c b/arch/arm/mach-s3c24xx/s3c2443.c
4819 +index ab648ad..165b6a6 100644
4820 +--- a/arch/arm/mach-s3c24xx/s3c2443.c
4821 ++++ b/arch/arm/mach-s3c24xx/s3c2443.c
4822 +@@ -43,6 +43,7 @@
4823 + #include <plat/nand-core.h>
4824 + #include <plat/adc-core.h>
4825 + #include <plat/rtc-core.h>
4826 ++#include <plat/spi-core.h>
4827 +
4828 + static struct map_desc s3c2443_iodesc[] __initdata = {
4829 + IODESC_ENT(WATCHDOG),
4830 +@@ -100,6 +101,9 @@ void __init s3c2443_map_io(void)
4831 + s3c24xx_gpiocfg_default.set_pull = s3c2443_gpio_setpull;
4832 + s3c24xx_gpiocfg_default.get_pull = s3c2443_gpio_getpull;
4833 +
4834 ++ /* initialize device information early */
4835 ++ s3c64xx_spi_setname("s3c2443-spi");
4836 ++
4837 + iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc));
4838 + }
4839 +
4840 +diff --git a/arch/arm/mach-s5p64x0/common.c b/arch/arm/mach-s5p64x0/common.c
4841 +index 6e6a0a9..111e404 100644
4842 +--- a/arch/arm/mach-s5p64x0/common.c
4843 ++++ b/arch/arm/mach-s5p64x0/common.c
4844 +@@ -44,6 +44,7 @@
4845 + #include <plat/sdhci.h>
4846 + #include <plat/adc-core.h>
4847 + #include <plat/fb-core.h>
4848 ++#include <plat/spi-core.h>
4849 + #include <plat/gpio-cfg.h>
4850 + #include <plat/regs-irqtype.h>
4851 + #include <plat/regs-serial.h>
4852 +@@ -179,6 +180,7 @@ void __init s5p6440_map_io(void)
4853 + /* initialize any device information early */
4854 + s3c_adc_setname("s3c64xx-adc");
4855 + s3c_fb_setname("s5p64x0-fb");
4856 ++ s3c64xx_spi_setname("s5p64x0-spi");
4857 +
4858 + s5p64x0_default_sdhci0();
4859 + s5p64x0_default_sdhci1();
4860 +@@ -193,6 +195,7 @@ void __init s5p6450_map_io(void)
4861 + /* initialize any device information early */
4862 + s3c_adc_setname("s3c64xx-adc");
4863 + s3c_fb_setname("s5p64x0-fb");
4864 ++ s3c64xx_spi_setname("s5p64x0-spi");
4865 +
4866 + s5p64x0_default_sdhci0();
4867 + s5p64x0_default_sdhci1();
4868 +diff --git a/arch/arm/mach-s5pc100/common.c b/arch/arm/mach-s5pc100/common.c
4869 +index 6219086..cc6e561 100644
4870 +--- a/arch/arm/mach-s5pc100/common.c
4871 ++++ b/arch/arm/mach-s5pc100/common.c
4872 +@@ -45,6 +45,7 @@
4873 + #include <plat/fb-core.h>
4874 + #include <plat/iic-core.h>
4875 + #include <plat/onenand-core.h>
4876 ++#include <plat/spi-core.h>
4877 + #include <plat/regs-serial.h>
4878 + #include <plat/watchdog-reset.h>
4879 +
4880 +@@ -165,6 +166,8 @@ void __init s5pc100_map_io(void)
4881 + s3c_onenand_setname("s5pc100-onenand");
4882 + s3c_fb_setname("s5pc100-fb");
4883 + s3c_cfcon_setname("s5pc100-pata");
4884 ++
4885 ++ s3c64xx_spi_setname("s5pc100-spi");
4886 + }
4887 +
4888 + void __init s5pc100_init_clocks(int xtal)
4889 +diff --git a/arch/arm/mach-s5pv210/common.c b/arch/arm/mach-s5pv210/common.c
4890 +index 4c9e902..a0c50ef 100644
4891 +--- a/arch/arm/mach-s5pv210/common.c
4892 ++++ b/arch/arm/mach-s5pv210/common.c
4893 +@@ -43,6 +43,7 @@
4894 + #include <plat/iic-core.h>
4895 + #include <plat/keypad-core.h>
4896 + #include <plat/tv-core.h>
4897 ++#include <plat/spi-core.h>
4898 + #include <plat/regs-serial.h>
4899 +
4900 + #include "common.h"
4901 +@@ -196,6 +197,8 @@ void __init s5pv210_map_io(void)
4902 +
4903 + /* setup TV devices */
4904 + s5p_hdmi_setname("s5pv210-hdmi");
4905 ++
4906 ++ s3c64xx_spi_setname("s5pv210-spi");
4907 + }
4908 +
4909 + void __init s5pv210_init_clocks(int xtal)
4910 +diff --git a/arch/arm/plat-samsung/include/plat/spi-core.h b/arch/arm/plat-samsung/include/plat/spi-core.h
4911 +new file mode 100644
4912 +index 0000000..0b9428a
4913 +--- /dev/null
4914 ++++ b/arch/arm/plat-samsung/include/plat/spi-core.h
4915 +@@ -0,0 +1,30 @@
4916 ++/*
4917 ++ * Copyright (C) 2012 Heiko Stuebner <heiko@××××××.de>
4918 ++ *
4919 ++ * This program is free software; you can redistribute it and/or modify
4920 ++ * it under the terms of the GNU General Public License version 2 as
4921 ++ * published by the Free Software Foundation.
4922 ++ */
4923 ++
4924 ++#ifndef __PLAT_S3C_SPI_CORE_H
4925 ++#define __PLAT_S3C_SPI_CORE_H
4926 ++
4927 ++/* These functions are only for use with the core support code, such as
4928 ++ * the cpu specific initialisation code
4929 ++ */
4930 ++
4931 ++/* re-define device name depending on support. */
4932 ++static inline void s3c64xx_spi_setname(char *name)
4933 ++{
4934 ++#ifdef CONFIG_S3C64XX_DEV_SPI0
4935 ++ s3c64xx_device_spi0.name = name;
4936 ++#endif
4937 ++#ifdef CONFIG_S3C64XX_DEV_SPI1
4938 ++ s3c64xx_device_spi1.name = name;
4939 ++#endif
4940 ++#ifdef CONFIG_S3C64XX_DEV_SPI2
4941 ++ s3c64xx_device_spi2.name = name;
4942 ++#endif
4943 ++}
4944 ++
4945 ++#endif /* __PLAT_S3C_SPI_CORE_H */
4946 +diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
4947 +index c9dcc18..029189d 100644
4948 +--- a/arch/x86/include/asm/efi.h
4949 ++++ b/arch/x86/include/asm/efi.h
4950 +@@ -98,6 +98,7 @@ extern void efi_set_executable(efi_memory_desc_t *md, bool executable);
4951 + extern int efi_memblock_x86_reserve_range(void);
4952 + extern void efi_call_phys_prelog(void);
4953 + extern void efi_call_phys_epilog(void);
4954 ++extern void efi_unmap_memmap(void);
4955 +
4956 + #ifndef CONFIG_EFI
4957 + /*
4958 +diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
4959 +index ed858e9..df06ade 100644
4960 +--- a/arch/x86/kernel/e820.c
4961 ++++ b/arch/x86/kernel/e820.c
4962 +@@ -1077,6 +1077,9 @@ void __init memblock_x86_fill(void)
4963 + memblock_add(ei->addr, ei->size);
4964 + }
4965 +
4966 ++ /* throw away partial pages */
4967 ++ memblock_trim_memory(PAGE_SIZE);
4968 ++
4969 + memblock_dump_all();
4970 + }
4971 +
4972 +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
4973 +index 198e774..5cee802 100644
4974 +--- a/arch/x86/kernel/setup.c
4975 ++++ b/arch/x86/kernel/setup.c
4976 +@@ -920,18 +920,19 @@ void __init setup_arch(char **cmdline_p)
4977 + #ifdef CONFIG_X86_64
4978 + if (max_pfn > max_low_pfn) {
4979 + int i;
4980 +- for (i = 0; i < e820.nr_map; i++) {
4981 +- struct e820entry *ei = &e820.map[i];
4982 ++ unsigned long start, end;
4983 ++ unsigned long start_pfn, end_pfn;
4984 +
4985 +- if (ei->addr + ei->size <= 1UL << 32)
4986 +- continue;
4987 ++ for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn,
4988 ++ NULL) {
4989 +
4990 +- if (ei->type == E820_RESERVED)
4991 ++ end = PFN_PHYS(end_pfn);
4992 ++ if (end <= (1UL<<32))
4993 + continue;
4994 +
4995 ++ start = PFN_PHYS(start_pfn);
4996 + max_pfn_mapped = init_memory_mapping(
4997 +- ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
4998 +- ei->addr + ei->size);
4999 ++ max((1UL<<32), start), end);
5000 + }
5001 +
5002 + /* can we preseve max_low_pfn ?*/
5003 +@@ -1047,6 +1048,18 @@ void __init setup_arch(char **cmdline_p)
5004 + mcheck_init();
5005 +
5006 + arch_init_ideal_nops();
5007 ++
5008 ++#ifdef CONFIG_EFI
5009 ++ /* Once setup is done above, disable efi_enabled on mismatched
5010 ++ * firmware/kernel archtectures since there is no support for
5011 ++ * runtime services.
5012 ++ */
5013 ++ if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) {
5014 ++ pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
5015 ++ efi_unmap_memmap();
5016 ++ efi_enabled = 0;
5017 ++ }
5018 ++#endif
5019 + }
5020 +
5021 + #ifdef CONFIG_X86_32
5022 +diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
5023 +index ab1f6a9..d7aea41 100644
5024 +--- a/arch/x86/mm/init.c
5025 ++++ b/arch/x86/mm/init.c
5026 +@@ -35,40 +35,44 @@ struct map_range {
5027 + unsigned page_size_mask;
5028 + };
5029 +
5030 +-static void __init find_early_table_space(struct map_range *mr, unsigned long end,
5031 +- int use_pse, int use_gbpages)
5032 ++/*
5033 ++ * First calculate space needed for kernel direct mapping page tables to cover
5034 ++ * mr[0].start to mr[nr_range - 1].end, while accounting for possible 2M and 1GB
5035 ++ * pages. Then find enough contiguous space for those page tables.
5036 ++ */
5037 ++static void __init find_early_table_space(struct map_range *mr, int nr_range)
5038 + {
5039 +- unsigned long puds, pmds, ptes, tables, start = 0, good_end = end;
5040 ++ int i;
5041 ++ unsigned long puds = 0, pmds = 0, ptes = 0, tables;
5042 ++ unsigned long start = 0, good_end;
5043 + phys_addr_t base;
5044 +
5045 +- puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
5046 +- tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
5047 +-
5048 +- if (use_gbpages) {
5049 +- unsigned long extra;
5050 +-
5051 +- extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
5052 +- pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
5053 +- } else
5054 +- pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
5055 ++ for (i = 0; i < nr_range; i++) {
5056 ++ unsigned long range, extra;
5057 +
5058 +- tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
5059 ++ range = mr[i].end - mr[i].start;
5060 ++ puds += (range + PUD_SIZE - 1) >> PUD_SHIFT;
5061 +
5062 +- if (use_pse) {
5063 +- unsigned long extra;
5064 ++ if (mr[i].page_size_mask & (1 << PG_LEVEL_1G)) {
5065 ++ extra = range - ((range >> PUD_SHIFT) << PUD_SHIFT);
5066 ++ pmds += (extra + PMD_SIZE - 1) >> PMD_SHIFT;
5067 ++ } else {
5068 ++ pmds += (range + PMD_SIZE - 1) >> PMD_SHIFT;
5069 ++ }
5070 +
5071 +- extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
5072 ++ if (mr[i].page_size_mask & (1 << PG_LEVEL_2M)) {
5073 ++ extra = range - ((range >> PMD_SHIFT) << PMD_SHIFT);
5074 + #ifdef CONFIG_X86_32
5075 +- extra += PMD_SIZE;
5076 ++ extra += PMD_SIZE;
5077 + #endif
5078 +- /* The first 2/4M doesn't use large pages. */
5079 +- if (mr->start < PMD_SIZE)
5080 +- extra += mr->end - mr->start;
5081 +-
5082 +- ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
5083 +- } else
5084 +- ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
5085 ++ ptes += (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
5086 ++ } else {
5087 ++ ptes += (range + PAGE_SIZE - 1) >> PAGE_SHIFT;
5088 ++ }
5089 ++ }
5090 +
5091 ++ tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
5092 ++ tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
5093 + tables += roundup(ptes * sizeof(pte_t), PAGE_SIZE);
5094 +
5095 + #ifdef CONFIG_X86_32
5096 +@@ -86,7 +90,7 @@ static void __init find_early_table_space(struct map_range *mr, unsigned long en
5097 + pgt_buf_top = pgt_buf_start + (tables >> PAGE_SHIFT);
5098 +
5099 + printk(KERN_DEBUG "kernel direct mapping tables up to %#lx @ [mem %#010lx-%#010lx]\n",
5100 +- end - 1, pgt_buf_start << PAGE_SHIFT,
5101 ++ mr[nr_range - 1].end - 1, pgt_buf_start << PAGE_SHIFT,
5102 + (pgt_buf_top << PAGE_SHIFT) - 1);
5103 + }
5104 +
5105 +@@ -267,7 +271,7 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
5106 + * nodes are discovered.
5107 + */
5108 + if (!after_bootmem)
5109 +- find_early_table_space(&mr[0], end, use_pse, use_gbpages);
5110 ++ find_early_table_space(mr, nr_range);
5111 +
5112 + for (i = 0; i < nr_range; i++)
5113 + ret = kernel_physical_mapping_init(mr[i].start, mr[i].end,
5114 +diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
5115 +index 2b6b4a3..3baff25 100644
5116 +--- a/arch/x86/mm/init_64.c
5117 ++++ b/arch/x86/mm/init_64.c
5118 +@@ -386,7 +386,8 @@ phys_pte_init(pte_t *pte_page, unsigned long addr, unsigned long end,
5119 + * these mappings are more intelligent.
5120 + */
5121 + if (pte_val(*pte)) {
5122 +- pages++;
5123 ++ if (!after_bootmem)
5124 ++ pages++;
5125 + continue;
5126 + }
5127 +
5128 +@@ -451,6 +452,8 @@ phys_pmd_init(pmd_t *pmd_page, unsigned long address, unsigned long end,
5129 + * attributes.
5130 + */
5131 + if (page_size_mask & (1 << PG_LEVEL_2M)) {
5132 ++ if (!after_bootmem)
5133 ++ pages++;
5134 + last_map_addr = next;
5135 + continue;
5136 + }
5137 +@@ -526,6 +529,8 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
5138 + * attributes.
5139 + */
5140 + if (page_size_mask & (1 << PG_LEVEL_1G)) {
5141 ++ if (!after_bootmem)
5142 ++ pages++;
5143 + last_map_addr = next;
5144 + continue;
5145 + }
5146 +diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
5147 +index f55a4ce..72d8899 100644
5148 +--- a/arch/x86/platform/efi/efi.c
5149 ++++ b/arch/x86/platform/efi/efi.c
5150 +@@ -69,11 +69,15 @@ EXPORT_SYMBOL(efi);
5151 + struct efi_memory_map memmap;
5152 +
5153 + bool efi_64bit;
5154 +-static bool efi_native;
5155 +
5156 + static struct efi efi_phys __initdata;
5157 + static efi_system_table_t efi_systab __initdata;
5158 +
5159 ++static inline bool efi_is_native(void)
5160 ++{
5161 ++ return IS_ENABLED(CONFIG_X86_64) == efi_64bit;
5162 ++}
5163 ++
5164 + static int __init setup_noefi(char *arg)
5165 + {
5166 + efi_enabled = 0;
5167 +@@ -419,10 +423,21 @@ void __init efi_reserve_boot_services(void)
5168 + }
5169 + }
5170 +
5171 +-static void __init efi_free_boot_services(void)
5172 ++void __init efi_unmap_memmap(void)
5173 ++{
5174 ++ if (memmap.map) {
5175 ++ early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
5176 ++ memmap.map = NULL;
5177 ++ }
5178 ++}
5179 ++
5180 ++void __init efi_free_boot_services(void)
5181 + {
5182 + void *p;
5183 +
5184 ++ if (!efi_is_native())
5185 ++ return;
5186 ++
5187 + for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
5188 + efi_memory_desc_t *md = p;
5189 + unsigned long long start = md->phys_addr;
5190 +@@ -438,6 +453,8 @@ static void __init efi_free_boot_services(void)
5191 +
5192 + free_bootmem_late(start, size);
5193 + }
5194 ++
5195 ++ efi_unmap_memmap();
5196 + }
5197 +
5198 + static int __init efi_systab_init(void *phys)
5199 +@@ -670,12 +687,10 @@ void __init efi_init(void)
5200 + return;
5201 + }
5202 + efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
5203 +- efi_native = !efi_64bit;
5204 + #else
5205 + efi_phys.systab = (efi_system_table_t *)
5206 + (boot_params.efi_info.efi_systab |
5207 + ((__u64)boot_params.efi_info.efi_systab_hi<<32));
5208 +- efi_native = efi_64bit;
5209 + #endif
5210 +
5211 + if (efi_systab_init(efi_phys.systab)) {
5212 +@@ -709,7 +724,7 @@ void __init efi_init(void)
5213 + * that doesn't match the kernel 32/64-bit mode.
5214 + */
5215 +
5216 +- if (!efi_native)
5217 ++ if (!efi_is_native())
5218 + pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
5219 + else if (efi_runtime_init()) {
5220 + efi_enabled = 0;
5221 +@@ -721,7 +736,7 @@ void __init efi_init(void)
5222 + return;
5223 + }
5224 + #ifdef CONFIG_X86_32
5225 +- if (efi_native) {
5226 ++ if (efi_is_native()) {
5227 + x86_platform.get_wallclock = efi_get_time;
5228 + x86_platform.set_wallclock = efi_set_rtc_mmss;
5229 + }
5230 +@@ -787,8 +802,10 @@ void __init efi_enter_virtual_mode(void)
5231 + * non-native EFI
5232 + */
5233 +
5234 +- if (!efi_native)
5235 +- goto out;
5236 ++ if (!efi_is_native()) {
5237 ++ efi_unmap_memmap();
5238 ++ return;
5239 ++ }
5240 +
5241 + /* Merge contiguous regions of the same type and attribute */
5242 + for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
5243 +@@ -878,13 +895,6 @@ void __init efi_enter_virtual_mode(void)
5244 + }
5245 +
5246 + /*
5247 +- * Thankfully, it does seem that no runtime services other than
5248 +- * SetVirtualAddressMap() will touch boot services code, so we can
5249 +- * get rid of it all at this point
5250 +- */
5251 +- efi_free_boot_services();
5252 +-
5253 +- /*
5254 + * Now that EFI is in virtual mode, update the function
5255 + * pointers in the runtime service table to the new virtual addresses.
5256 + *
5257 +@@ -907,9 +917,6 @@ void __init efi_enter_virtual_mode(void)
5258 + if (__supported_pte_mask & _PAGE_NX)
5259 + runtime_code_page_mkexec();
5260 +
5261 +-out:
5262 +- early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
5263 +- memmap.map = NULL;
5264 + kfree(new_memmap);
5265 + }
5266 +
5267 +diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
5268 +index 758af9c..0059e26 100644
5269 +--- a/drivers/bcma/main.c
5270 ++++ b/drivers/bcma/main.c
5271 +@@ -141,9 +141,10 @@ static int bcma_register_cores(struct bcma_bus *bus)
5272 +
5273 + static void bcma_unregister_cores(struct bcma_bus *bus)
5274 + {
5275 +- struct bcma_device *core;
5276 ++ struct bcma_device *core, *tmp;
5277 +
5278 +- list_for_each_entry(core, &bus->cores, list) {
5279 ++ list_for_each_entry_safe(core, tmp, &bus->cores, list) {
5280 ++ list_del(&core->list);
5281 + if (core->dev_registered)
5282 + device_unregister(&core->dev);
5283 + }
5284 +diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
5285 +index 1a40935..c671369 100644
5286 +--- a/drivers/cpufreq/powernow-k8.c
5287 ++++ b/drivers/cpufreq/powernow-k8.c
5288 +@@ -1223,14 +1223,7 @@ static int powernowk8_target(struct cpufreq_policy *pol,
5289 + struct powernowk8_target_arg pta = { .pol = pol, .targfreq = targfreq,
5290 + .relation = relation };
5291 +
5292 +- /*
5293 +- * Must run on @pol->cpu. cpufreq core is responsible for ensuring
5294 +- * that we're bound to the current CPU and pol->cpu stays online.
5295 +- */
5296 +- if (smp_processor_id() == pol->cpu)
5297 +- return powernowk8_target_fn(&pta);
5298 +- else
5299 +- return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
5300 ++ return work_on_cpu(pol->cpu, powernowk8_target_fn, &pta);
5301 + }
5302 +
5303 + /* Driver entry point to verify the policy and range of frequencies */
5304 +diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
5305 +index 5084975..8aa9113 100644
5306 +--- a/drivers/dma/imx-dma.c
5307 ++++ b/drivers/dma/imx-dma.c
5308 +@@ -474,8 +474,10 @@ static int imxdma_xfer_desc(struct imxdma_desc *d)
5309 + slot = i;
5310 + break;
5311 + }
5312 +- if (slot < 0)
5313 ++ if (slot < 0) {
5314 ++ spin_unlock_irqrestore(&imxdma->lock, flags);
5315 + return -EBUSY;
5316 ++ }
5317 +
5318 + imxdma->slots_2d[slot].xsr = d->x;
5319 + imxdma->slots_2d[slot].ysr = d->y;
5320 +diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
5321 +index 434ad31..c439489 100644
5322 +--- a/drivers/dma/sirf-dma.c
5323 ++++ b/drivers/dma/sirf-dma.c
5324 +@@ -109,7 +109,7 @@ static void sirfsoc_dma_execute(struct sirfsoc_dma_chan *schan)
5325 + sdesc = list_first_entry(&schan->queued, struct sirfsoc_dma_desc,
5326 + node);
5327 + /* Move the first queued descriptor to active list */
5328 +- list_move_tail(&schan->queued, &schan->active);
5329 ++ list_move_tail(&sdesc->node, &schan->active);
5330 +
5331 + /* Start the DMA transfer */
5332 + writel_relaxed(sdesc->width, sdma->base + SIRFSOC_DMA_WIDTH_0 +
5333 +@@ -428,7 +428,7 @@ static struct dma_async_tx_descriptor *sirfsoc_dma_prep_interleaved(
5334 + unsigned long iflags;
5335 + int ret;
5336 +
5337 +- if ((xt->dir != DMA_MEM_TO_DEV) || (xt->dir != DMA_DEV_TO_MEM)) {
5338 ++ if ((xt->dir != DMA_MEM_TO_DEV) && (xt->dir != DMA_DEV_TO_MEM)) {
5339 + ret = -EINVAL;
5340 + goto err_dir;
5341 + }
5342 +diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
5343 +index f6419f9..7dcfb7c 100644
5344 +--- a/drivers/extcon/extcon_class.c
5345 ++++ b/drivers/extcon/extcon_class.c
5346 +@@ -575,6 +575,10 @@ static void extcon_cleanup(struct extcon_dev *edev, bool skip)
5347 + kfree(edev->cables);
5348 + }
5349 +
5350 ++#if defined(CONFIG_ANDROID)
5351 ++ if (switch_class)
5352 ++ class_compat_remove_link(switch_class, edev->dev, NULL);
5353 ++#endif
5354 + device_unregister(edev->dev);
5355 + put_device(edev->dev);
5356 + }
5357 +@@ -821,6 +825,9 @@ module_init(extcon_class_init);
5358 +
5359 + static void __exit extcon_class_exit(void)
5360 + {
5361 ++#if defined(CONFIG_ANDROID)
5362 ++ class_compat_unregister(switch_class);
5363 ++#endif
5364 + class_destroy(extcon_class);
5365 + }
5366 + module_exit(extcon_class_exit);
5367 +diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
5368 +index d883b20..e932810 100644
5369 +--- a/drivers/gpu/drm/radeon/evergreen_cs.c
5370 ++++ b/drivers/gpu/drm/radeon/evergreen_cs.c
5371 +@@ -2829,6 +2829,7 @@ static bool evergreen_vm_reg_valid(u32 reg)
5372 + case CAYMAN_SQ_EX_ALLOC_TABLE_SLOTS:
5373 + return true;
5374 + default:
5375 ++ DRM_ERROR("Invalid register 0x%x in CS\n", reg);
5376 + return false;
5377 + }
5378 + }
5379 +diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
5380 +index 4065374..f4c3d28 100644
5381 +--- a/drivers/hv/channel.c
5382 ++++ b/drivers/hv/channel.c
5383 +@@ -146,14 +146,14 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
5384 +
5385 + if (ret != 0) {
5386 + err = ret;
5387 +- goto errorout;
5388 ++ goto error0;
5389 + }
5390 +
5391 + ret = hv_ringbuffer_init(
5392 + &newchannel->inbound, in, recv_ringbuffer_size);
5393 + if (ret != 0) {
5394 + err = ret;
5395 +- goto errorout;
5396 ++ goto error0;
5397 + }
5398 +
5399 +
5400 +@@ -168,7 +168,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
5401 +
5402 + if (ret != 0) {
5403 + err = ret;
5404 +- goto errorout;
5405 ++ goto error0;
5406 + }
5407 +
5408 + /* Create and init the channel open message */
5409 +@@ -177,7 +177,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
5410 + GFP_KERNEL);
5411 + if (!open_info) {
5412 + err = -ENOMEM;
5413 +- goto errorout;
5414 ++ goto error0;
5415 + }
5416 +
5417 + init_completion(&open_info->waitevent);
5418 +@@ -193,7 +193,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
5419 +
5420 + if (userdatalen > MAX_USER_DEFINED_BYTES) {
5421 + err = -EINVAL;
5422 +- goto errorout;
5423 ++ goto error0;
5424 + }
5425 +
5426 + if (userdatalen)
5427 +@@ -208,19 +208,18 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
5428 + sizeof(struct vmbus_channel_open_channel));
5429 +
5430 + if (ret != 0)
5431 +- goto cleanup;
5432 ++ goto error1;
5433 +
5434 + t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ);
5435 + if (t == 0) {
5436 + err = -ETIMEDOUT;
5437 +- goto errorout;
5438 ++ goto error1;
5439 + }
5440 +
5441 +
5442 + if (open_info->response.open_result.status)
5443 + err = open_info->response.open_result.status;
5444 +
5445 +-cleanup:
5446 + spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
5447 + list_del(&open_info->msglistentry);
5448 + spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
5449 +@@ -228,9 +227,12 @@ cleanup:
5450 + kfree(open_info);
5451 + return err;
5452 +
5453 +-errorout:
5454 +- hv_ringbuffer_cleanup(&newchannel->outbound);
5455 +- hv_ringbuffer_cleanup(&newchannel->inbound);
5456 ++error1:
5457 ++ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
5458 ++ list_del(&open_info->msglistentry);
5459 ++ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
5460 ++
5461 ++error0:
5462 + free_pages((unsigned long)out,
5463 + get_order(send_ringbuffer_size + recv_ringbuffer_size));
5464 + kfree(open_info);
5465 +diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c
5466 +index 4e2a162..4e98100 100644
5467 +--- a/drivers/net/ethernet/tile/tilegx.c
5468 ++++ b/drivers/net/ethernet/tile/tilegx.c
5469 +@@ -1334,11 +1334,11 @@ static int tso_count_edescs(struct sk_buff *skb)
5470 + {
5471 + struct skb_shared_info *sh = skb_shinfo(skb);
5472 + unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
5473 +- unsigned int data_len = skb->data_len + skb->hdr_len - sh_len;
5474 ++ unsigned int data_len = skb->len - sh_len;
5475 + unsigned int p_len = sh->gso_size;
5476 + long f_id = -1; /* id of the current fragment */
5477 +- long f_size = skb->hdr_len; /* size of the current fragment */
5478 +- long f_used = sh_len; /* bytes used from the current fragment */
5479 ++ long f_size = skb_headlen(skb) - sh_len; /* current fragment size */
5480 ++ long f_used = 0; /* bytes used from the current fragment */
5481 + long n; /* size of the current piece of payload */
5482 + int num_edescs = 0;
5483 + int segment;
5484 +@@ -1353,7 +1353,7 @@ static int tso_count_edescs(struct sk_buff *skb)
5485 + /* Advance as needed. */
5486 + while (f_used >= f_size) {
5487 + f_id++;
5488 +- f_size = sh->frags[f_id].size;
5489 ++ f_size = skb_frag_size(&sh->frags[f_id]);
5490 + f_used = 0;
5491 + }
5492 +
5493 +@@ -1384,13 +1384,13 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
5494 + struct iphdr *ih;
5495 + struct tcphdr *th;
5496 + unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
5497 +- unsigned int data_len = skb->data_len + skb->hdr_len - sh_len;
5498 ++ unsigned int data_len = skb->len - sh_len;
5499 + unsigned char *data = skb->data;
5500 + unsigned int ih_off, th_off, p_len;
5501 + unsigned int isum_seed, tsum_seed, id, seq;
5502 + long f_id = -1; /* id of the current fragment */
5503 +- long f_size = skb->hdr_len; /* size of the current fragment */
5504 +- long f_used = sh_len; /* bytes used from the current fragment */
5505 ++ long f_size = skb_headlen(skb) - sh_len; /* current fragment size */
5506 ++ long f_used = 0; /* bytes used from the current fragment */
5507 + long n; /* size of the current piece of payload */
5508 + int segment;
5509 +
5510 +@@ -1405,7 +1405,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
5511 + isum_seed = ((0xFFFF - ih->check) +
5512 + (0xFFFF - ih->tot_len) +
5513 + (0xFFFF - ih->id));
5514 +- tsum_seed = th->check + (0xFFFF ^ htons(sh_len + data_len));
5515 ++ tsum_seed = th->check + (0xFFFF ^ htons(skb->len));
5516 + id = ntohs(ih->id);
5517 + seq = ntohl(th->seq);
5518 +
5519 +@@ -1444,7 +1444,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
5520 + /* Advance as needed. */
5521 + while (f_used >= f_size) {
5522 + f_id++;
5523 +- f_size = sh->frags[f_id].size;
5524 ++ f_size = skb_frag_size(&sh->frags[f_id]);
5525 + f_used = 0;
5526 + }
5527 +
5528 +@@ -1478,14 +1478,14 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue,
5529 + struct tile_net_priv *priv = netdev_priv(dev);
5530 + struct skb_shared_info *sh = skb_shinfo(skb);
5531 + unsigned int sh_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
5532 +- unsigned int data_len = skb->data_len + skb->hdr_len - sh_len;
5533 ++ unsigned int data_len = skb->len - sh_len;
5534 + unsigned int p_len = sh->gso_size;
5535 + gxio_mpipe_edesc_t edesc_head = { { 0 } };
5536 + gxio_mpipe_edesc_t edesc_body = { { 0 } };
5537 + long f_id = -1; /* id of the current fragment */
5538 +- long f_size = skb->hdr_len; /* size of the current fragment */
5539 +- long f_used = sh_len; /* bytes used from the current fragment */
5540 +- void *f_data = skb->data;
5541 ++ long f_size = skb_headlen(skb) - sh_len; /* current fragment size */
5542 ++ long f_used = 0; /* bytes used from the current fragment */
5543 ++ void *f_data = skb->data + sh_len;
5544 + long n; /* size of the current piece of payload */
5545 + unsigned long tx_packets = 0, tx_bytes = 0;
5546 + unsigned int csum_start;
5547 +@@ -1516,15 +1516,18 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue,
5548 +
5549 + /* Egress the payload. */
5550 + while (p_used < p_len) {
5551 ++ void *va;
5552 +
5553 + /* Advance as needed. */
5554 + while (f_used >= f_size) {
5555 + f_id++;
5556 +- f_size = sh->frags[f_id].size;
5557 +- f_used = 0;
5558 ++ f_size = skb_frag_size(&sh->frags[f_id]);
5559 + f_data = tile_net_frag_buf(&sh->frags[f_id]);
5560 ++ f_used = 0;
5561 + }
5562 +
5563 ++ va = f_data + f_used;
5564 ++
5565 + /* Use bytes from the current fragment. */
5566 + n = p_len - p_used;
5567 + if (n > f_size - f_used)
5568 +@@ -1533,7 +1536,7 @@ static void tso_egress(struct net_device *dev, gxio_mpipe_equeue_t *equeue,
5569 + p_used += n;
5570 +
5571 + /* Egress a piece of the payload. */
5572 +- edesc_body.va = va_to_tile_io_addr(f_data) + f_used;
5573 ++ edesc_body.va = va_to_tile_io_addr(va);
5574 + edesc_body.xfer_size = n;
5575 + edesc_body.bound = !(p_used < p_len);
5576 + gxio_mpipe_equeue_put_at(equeue, edesc_body, slot);
5577 +diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
5578 +index a03de71..d012982 100644
5579 +--- a/drivers/net/usb/cdc_ether.c
5580 ++++ b/drivers/net/usb/cdc_ether.c
5581 +@@ -592,6 +592,32 @@ static const struct usb_device_id products [] = {
5582 + .driver_info = 0,
5583 + },
5584 +
5585 ++/* Novatel USB551L and MC551 - handled by qmi_wwan */
5586 ++{
5587 ++ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5588 ++ | USB_DEVICE_ID_MATCH_PRODUCT
5589 ++ | USB_DEVICE_ID_MATCH_INT_INFO,
5590 ++ .idVendor = NOVATEL_VENDOR_ID,
5591 ++ .idProduct = 0xB001,
5592 ++ .bInterfaceClass = USB_CLASS_COMM,
5593 ++ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
5594 ++ .bInterfaceProtocol = USB_CDC_PROTO_NONE,
5595 ++ .driver_info = 0,
5596 ++},
5597 ++
5598 ++/* Novatel E362 - handled by qmi_wwan */
5599 ++{
5600 ++ .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5601 ++ | USB_DEVICE_ID_MATCH_PRODUCT
5602 ++ | USB_DEVICE_ID_MATCH_INT_INFO,
5603 ++ .idVendor = NOVATEL_VENDOR_ID,
5604 ++ .idProduct = 0x9010,
5605 ++ .bInterfaceClass = USB_CLASS_COMM,
5606 ++ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
5607 ++ .bInterfaceProtocol = USB_CDC_PROTO_NONE,
5608 ++ .driver_info = 0,
5609 ++},
5610 ++
5611 + /*
5612 + * WHITELIST!!!
5613 + *
5614 +@@ -604,21 +630,6 @@ static const struct usb_device_id products [] = {
5615 + * because of bugs/quirks in a given product (like Zaurus, above).
5616 + */
5617 + {
5618 +- /* Novatel USB551L */
5619 +- /* This match must come *before* the generic CDC-ETHER match so that
5620 +- * we get FLAG_WWAN set on the device, since it's descriptors are
5621 +- * generic CDC-ETHER.
5622 +- */
5623 +- .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5624 +- | USB_DEVICE_ID_MATCH_PRODUCT
5625 +- | USB_DEVICE_ID_MATCH_INT_INFO,
5626 +- .idVendor = NOVATEL_VENDOR_ID,
5627 +- .idProduct = 0xB001,
5628 +- .bInterfaceClass = USB_CLASS_COMM,
5629 +- .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET,
5630 +- .bInterfaceProtocol = USB_CDC_PROTO_NONE,
5631 +- .driver_info = (unsigned long)&wwan_info,
5632 +-}, {
5633 + /* ZTE (Vodafone) K3805-Z */
5634 + .match_flags = USB_DEVICE_ID_MATCH_VENDOR
5635 + | USB_DEVICE_ID_MATCH_PRODUCT
5636 +diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
5637 +index 3543c9e..3585f93 100644
5638 +--- a/drivers/net/usb/qmi_wwan.c
5639 ++++ b/drivers/net/usb/qmi_wwan.c
5640 +@@ -364,6 +364,20 @@ static const struct usb_device_id products[] = {
5641 + USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, USB_CLASS_VENDOR_SPEC, 1, 57),
5642 + .driver_info = (unsigned long)&qmi_wwan_info,
5643 + },
5644 ++ { /* Novatel USB551L and MC551 */
5645 ++ USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0xb001,
5646 ++ USB_CLASS_COMM,
5647 ++ USB_CDC_SUBCLASS_ETHERNET,
5648 ++ USB_CDC_PROTO_NONE),
5649 ++ .driver_info = (unsigned long)&qmi_wwan_info,
5650 ++ },
5651 ++ { /* Novatel E362 */
5652 ++ USB_DEVICE_AND_INTERFACE_INFO(0x1410, 0x9010,
5653 ++ USB_CLASS_COMM,
5654 ++ USB_CDC_SUBCLASS_ETHERNET,
5655 ++ USB_CDC_PROTO_NONE),
5656 ++ .driver_info = (unsigned long)&qmi_wwan_info,
5657 ++ },
5658 +
5659 + /* 2. Combined interface devices matching on class+protocol */
5660 + { /* Huawei E367 and possibly others in "Windows mode" */
5661 +diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
5662 +index 89bf94d..6f7cf49 100644
5663 +--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
5664 ++++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
5665 +@@ -534,107 +534,107 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
5666 +
5667 + static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
5668 + /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
5669 +- {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
5670 +- {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
5671 +- {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
5672 ++ {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
5673 ++ {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
5674 ++ {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
5675 + {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
5676 + {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
5677 + {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5678 + {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
5679 + {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
5680 + {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
5681 +- {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202},
5682 +- {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400},
5683 +- {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402},
5684 +- {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404},
5685 +- {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603},
5686 +- {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02},
5687 +- {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04},
5688 +- {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20},
5689 +- {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20},
5690 +- {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22},
5691 +- {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24},
5692 +- {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640},
5693 +- {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660},
5694 +- {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861},
5695 +- {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81},
5696 +- {0x0000a54c, 0x5a08442e, 0x5a08442e, 0x47001a83, 0x47001a83},
5697 +- {0x0000a550, 0x5e0a4431, 0x5e0a4431, 0x4a001c84, 0x4a001c84},
5698 +- {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3},
5699 +- {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5},
5700 +- {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9},
5701 +- {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb},
5702 +- {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5703 +- {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5704 +- {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5705 +- {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5706 +- {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5707 +- {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5708 +- {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec},
5709 ++ {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
5710 ++ {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
5711 ++ {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
5712 ++ {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
5713 ++ {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
5714 ++ {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
5715 ++ {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
5716 ++ {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
5717 ++ {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
5718 ++ {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
5719 ++ {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
5720 ++ {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
5721 ++ {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
5722 ++ {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861},
5723 ++ {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81},
5724 ++ {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83},
5725 ++ {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84},
5726 ++ {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3},
5727 ++ {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5},
5728 ++ {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9},
5729 ++ {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb},
5730 ++ {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5731 ++ {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5732 ++ {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5733 ++ {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5734 ++ {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5735 ++ {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5736 ++ {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
5737 + {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
5738 + {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
5739 + {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
5740 + {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
5741 +- {0x0000a590, 0x15800028, 0x15800028, 0x0f800202, 0x0f800202},
5742 +- {0x0000a594, 0x1b80002b, 0x1b80002b, 0x12800400, 0x12800400},
5743 +- {0x0000a598, 0x1f820028, 0x1f820028, 0x16800402, 0x16800402},
5744 +- {0x0000a59c, 0x2582002b, 0x2582002b, 0x19800404, 0x19800404},
5745 +- {0x0000a5a0, 0x2a84002a, 0x2a84002a, 0x1c800603, 0x1c800603},
5746 +- {0x0000a5a4, 0x2e86002a, 0x2e86002a, 0x21800a02, 0x21800a02},
5747 +- {0x0000a5a8, 0x3382202d, 0x3382202d, 0x25800a04, 0x25800a04},
5748 +- {0x0000a5ac, 0x3884202c, 0x3884202c, 0x28800a20, 0x28800a20},
5749 +- {0x0000a5b0, 0x3c86202c, 0x3c86202c, 0x2c800e20, 0x2c800e20},
5750 +- {0x0000a5b4, 0x4188202d, 0x4188202d, 0x30800e22, 0x30800e22},
5751 +- {0x0000a5b8, 0x4586402d, 0x4586402d, 0x34800e24, 0x34800e24},
5752 +- {0x0000a5bc, 0x4986222d, 0x4986222d, 0x38801640, 0x38801640},
5753 +- {0x0000a5c0, 0x4d862231, 0x4d862231, 0x3c801660, 0x3c801660},
5754 +- {0x0000a5c4, 0x50882231, 0x50882231, 0x3f801861, 0x3f801861},
5755 +- {0x0000a5c8, 0x5688422e, 0x5688422e, 0x43801a81, 0x43801a81},
5756 +- {0x0000a5cc, 0x5a88442e, 0x5a88442e, 0x47801a83, 0x47801a83},
5757 +- {0x0000a5d0, 0x5e8a4431, 0x5e8a4431, 0x4a801c84, 0x4a801c84},
5758 +- {0x0000a5d4, 0x648a4432, 0x648a4432, 0x4e801ce3, 0x4e801ce3},
5759 +- {0x0000a5d8, 0x688a4434, 0x688a4434, 0x52801ce5, 0x52801ce5},
5760 +- {0x0000a5dc, 0x6c8a6434, 0x6c8a6434, 0x56801ce9, 0x56801ce9},
5761 +- {0x0000a5e0, 0x6f8a6633, 0x6f8a6633, 0x5a801ceb, 0x5a801ceb},
5762 +- {0x0000a5e4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5763 +- {0x0000a5e8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5764 +- {0x0000a5ec, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5765 +- {0x0000a5f0, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5766 +- {0x0000a5f4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5767 +- {0x0000a5f8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5768 +- {0x0000a5fc, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec},
5769 ++ {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
5770 ++ {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
5771 ++ {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
5772 ++ {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
5773 ++ {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
5774 ++ {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
5775 ++ {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
5776 ++ {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
5777 ++ {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
5778 ++ {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
5779 ++ {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
5780 ++ {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
5781 ++ {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
5782 ++ {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861},
5783 ++ {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81},
5784 ++ {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83},
5785 ++ {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84},
5786 ++ {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3},
5787 ++ {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5},
5788 ++ {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9},
5789 ++ {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb},
5790 ++ {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5791 ++ {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5792 ++ {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5793 ++ {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5794 ++ {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5795 ++ {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5796 ++ {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
5797 + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5798 + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5799 +- {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
5800 +- {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
5801 +- {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000},
5802 +- {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000},
5803 +- {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501},
5804 +- {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501},
5805 +- {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03},
5806 +- {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04},
5807 +- {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04},
5808 +- {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
5809 +- {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
5810 +- {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
5811 +- {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
5812 +- {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005},
5813 +- {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
5814 +- {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
5815 +- {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
5816 ++ {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5817 ++ {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5818 ++ {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
5819 ++ {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000},
5820 ++ {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501},
5821 ++ {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501},
5822 ++ {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03},
5823 ++ {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04},
5824 ++ {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04},
5825 ++ {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
5826 ++ {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
5827 ++ {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
5828 ++ {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
5829 ++ {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
5830 ++ {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
5831 ++ {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
5832 ++ {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
5833 + {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
5834 +- {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352},
5835 +- {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584},
5836 +- {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800},
5837 ++ {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
5838 ++ {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
5839 ++ {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
5840 + {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
5841 + {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
5842 +- {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
5843 ++ {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
5844 + {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
5845 + {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
5846 +- {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
5847 ++ {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
5848 + {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
5849 + {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
5850 +- {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001},
5851 ++ {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
5852 + {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
5853 + };
5854 +
5855 +diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
5856 +index a140165..46d9d4e 100644
5857 +--- a/drivers/net/wireless/b43/main.c
5858 ++++ b/drivers/net/wireless/b43/main.c
5859 +@@ -5374,6 +5374,8 @@ static void b43_bcma_remove(struct bcma_device *core)
5860 + cancel_work_sync(&wldev->restart_work);
5861 +
5862 + B43_WARN_ON(!wl);
5863 ++ if (!wldev->fw.ucode.data)
5864 ++ return; /* NULL if firmware never loaded */
5865 + if (wl->current_dev == wldev && wl->hw_registred) {
5866 + b43_leds_stop(wldev);
5867 + ieee80211_unregister_hw(wl->hw);
5868 +@@ -5448,6 +5450,8 @@ static void b43_ssb_remove(struct ssb_device *sdev)
5869 + cancel_work_sync(&wldev->restart_work);
5870 +
5871 + B43_WARN_ON(!wl);
5872 ++ if (!wldev->fw.ucode.data)
5873 ++ return; /* NULL if firmware never loaded */
5874 + if (wl->current_dev == wldev && wl->hw_registred) {
5875 + b43_leds_stop(wldev);
5876 + ieee80211_unregister_hw(wl->hw);
5877 +diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
5878 +index 0df4591..6d1754a 100644
5879 +--- a/drivers/net/wireless/ipw2x00/ipw2200.c
5880 ++++ b/drivers/net/wireless/ipw2x00/ipw2200.c
5881 +@@ -10479,7 +10479,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
5882 + } else
5883 + len = src->len;
5884 +
5885 +- dst = alloc_skb(len + sizeof(*rt_hdr), GFP_ATOMIC);
5886 ++ dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC);
5887 + if (!dst)
5888 + continue;
5889 +
5890 +diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c
5891 +index 349c205..da58620 100644
5892 +--- a/drivers/net/wireless/iwlwifi/dvm/devices.c
5893 ++++ b/drivers/net/wireless/iwlwifi/dvm/devices.c
5894 +@@ -518,7 +518,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
5895 + * See iwlagn_mac_channel_switch.
5896 + */
5897 + struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
5898 +- struct iwl6000_channel_switch_cmd cmd;
5899 ++ struct iwl6000_channel_switch_cmd *cmd;
5900 + u32 switch_time_in_usec, ucode_switch_time;
5901 + u16 ch;
5902 + u32 tsf_low;
5903 +@@ -527,18 +527,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
5904 + struct ieee80211_vif *vif = ctx->vif;
5905 + struct iwl_host_cmd hcmd = {
5906 + .id = REPLY_CHANNEL_SWITCH,
5907 +- .len = { sizeof(cmd), },
5908 ++ .len = { sizeof(*cmd), },
5909 + .flags = CMD_SYNC,
5910 +- .data = { &cmd, },
5911 ++ .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
5912 + };
5913 ++ int err;
5914 +
5915 +- cmd.band = priv->band == IEEE80211_BAND_2GHZ;
5916 ++ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
5917 ++ if (!cmd)
5918 ++ return -ENOMEM;
5919 ++
5920 ++ hcmd.data[0] = cmd;
5921 ++
5922 ++ cmd->band = priv->band == IEEE80211_BAND_2GHZ;
5923 + ch = ch_switch->channel->hw_value;
5924 + IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
5925 + ctx->active.channel, ch);
5926 +- cmd.channel = cpu_to_le16(ch);
5927 +- cmd.rxon_flags = ctx->staging.flags;
5928 +- cmd.rxon_filter_flags = ctx->staging.filter_flags;
5929 ++ cmd->channel = cpu_to_le16(ch);
5930 ++ cmd->rxon_flags = ctx->staging.flags;
5931 ++ cmd->rxon_filter_flags = ctx->staging.filter_flags;
5932 + switch_count = ch_switch->count;
5933 + tsf_low = ch_switch->timestamp & 0x0ffffffff;
5934 + /*
5935 +@@ -554,23 +561,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
5936 + switch_count = 0;
5937 + }
5938 + if (switch_count <= 1)
5939 +- cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time);
5940 ++ cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time);
5941 + else {
5942 + switch_time_in_usec =
5943 + vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
5944 + ucode_switch_time = iwl_usecs_to_beacons(priv,
5945 + switch_time_in_usec,
5946 + beacon_interval);
5947 +- cmd.switch_time = iwl_add_beacon_time(priv,
5948 +- priv->ucode_beacon_time,
5949 +- ucode_switch_time,
5950 +- beacon_interval);
5951 ++ cmd->switch_time = iwl_add_beacon_time(priv,
5952 ++ priv->ucode_beacon_time,
5953 ++ ucode_switch_time,
5954 ++ beacon_interval);
5955 + }
5956 + IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
5957 +- cmd.switch_time);
5958 +- cmd.expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR;
5959 ++ cmd->switch_time);
5960 ++ cmd->expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR;
5961 +
5962 +- return iwl_dvm_send_cmd(priv, &hcmd);
5963 ++ err = iwl_dvm_send_cmd(priv, &hcmd);
5964 ++ kfree(cmd);
5965 ++ return err;
5966 + }
5967 +
5968 + struct iwl_lib_ops iwl6000_lib = {
5969 +diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c
5970 +index 891cd6c..4eed510 100644
5971 +--- a/drivers/rtc/rtc-imxdi.c
5972 ++++ b/drivers/rtc/rtc-imxdi.c
5973 +@@ -392,6 +392,8 @@ static int dryice_rtc_probe(struct platform_device *pdev)
5974 + if (imxdi->ioaddr == NULL)
5975 + return -ENOMEM;
5976 +
5977 ++ spin_lock_init(&imxdi->irq_lock);
5978 ++
5979 + imxdi->irq = platform_get_irq(pdev, 0);
5980 + if (imxdi->irq < 0)
5981 + return imxdi->irq;
5982 +diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
5983 +index 574e992..467d493 100644
5984 +--- a/drivers/staging/android/binder.c
5985 ++++ b/drivers/staging/android/binder.c
5986 +@@ -655,7 +655,7 @@ static int binder_update_page_range(struct binder_proc *proc, int allocate,
5987 + page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE];
5988 +
5989 + BUG_ON(*page);
5990 +- *page = alloc_page(GFP_KERNEL | __GFP_ZERO);
5991 ++ *page = alloc_page(GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO);
5992 + if (*page == NULL) {
5993 + pr_err("binder: %d: binder_alloc_buf failed "
5994 + "for page at %p\n", proc->pid, page_addr);
5995 +@@ -2507,14 +2507,38 @@ static void binder_release_work(struct list_head *list)
5996 + struct binder_transaction *t;
5997 +
5998 + t = container_of(w, struct binder_transaction, work);
5999 +- if (t->buffer->target_node && !(t->flags & TF_ONE_WAY))
6000 ++ if (t->buffer->target_node &&
6001 ++ !(t->flags & TF_ONE_WAY)) {
6002 + binder_send_failed_reply(t, BR_DEAD_REPLY);
6003 ++ } else {
6004 ++ binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
6005 ++ "binder: undelivered transaction %d\n",
6006 ++ t->debug_id);
6007 ++ t->buffer->transaction = NULL;
6008 ++ kfree(t);
6009 ++ binder_stats_deleted(BINDER_STAT_TRANSACTION);
6010 ++ }
6011 + } break;
6012 + case BINDER_WORK_TRANSACTION_COMPLETE: {
6013 ++ binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
6014 ++ "binder: undelivered TRANSACTION_COMPLETE\n");
6015 + kfree(w);
6016 + binder_stats_deleted(BINDER_STAT_TRANSACTION_COMPLETE);
6017 + } break;
6018 ++ case BINDER_WORK_DEAD_BINDER_AND_CLEAR:
6019 ++ case BINDER_WORK_CLEAR_DEATH_NOTIFICATION: {
6020 ++ struct binder_ref_death *death;
6021 ++
6022 ++ death = container_of(w, struct binder_ref_death, work);
6023 ++ binder_debug(BINDER_DEBUG_DEAD_TRANSACTION,
6024 ++ "binder: undelivered death notification, %p\n",
6025 ++ death->cookie);
6026 ++ kfree(death);
6027 ++ binder_stats_deleted(BINDER_STAT_DEATH);
6028 ++ } break;
6029 + default:
6030 ++ pr_err("binder: unexpected work type, %d, not freed\n",
6031 ++ w->type);
6032 + break;
6033 + }
6034 + }
6035 +@@ -2984,6 +3008,7 @@ static void binder_deferred_release(struct binder_proc *proc)
6036 + nodes++;
6037 + rb_erase(&node->rb_node, &proc->nodes);
6038 + list_del_init(&node->work.entry);
6039 ++ binder_release_work(&node->async_todo);
6040 + if (hlist_empty(&node->refs)) {
6041 + kfree(node);
6042 + binder_stats_deleted(BINDER_STAT_NODE);
6043 +@@ -3022,6 +3047,7 @@ static void binder_deferred_release(struct binder_proc *proc)
6044 + binder_delete_ref(ref);
6045 + }
6046 + binder_release_work(&proc->todo);
6047 ++ binder_release_work(&proc->delivered_death);
6048 + buffers = 0;
6049 +
6050 + while ((n = rb_first(&proc->allocated_buffers))) {
6051 +diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
6052 +index cc8931f..aee22fd 100644
6053 +--- a/drivers/staging/comedi/drivers/amplc_dio200.c
6054 ++++ b/drivers/staging/comedi/drivers/amplc_dio200.c
6055 +@@ -1429,6 +1429,8 @@ static void dio200_detach(struct comedi_device *dev)
6056 + const struct dio200_layout_struct *layout;
6057 + unsigned n;
6058 +
6059 ++ if (!thisboard)
6060 ++ return;
6061 + if (dev->irq)
6062 + free_irq(dev->irq, dev);
6063 + if (dev->subdevices) {
6064 +diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
6065 +index f502879..b46e663 100644
6066 +--- a/drivers/staging/comedi/drivers/amplc_pc236.c
6067 ++++ b/drivers/staging/comedi/drivers/amplc_pc236.c
6068 +@@ -577,10 +577,12 @@ static int __devinit pc236_attach_pci(struct comedi_device *dev,
6069 +
6070 + static void pc236_detach(struct comedi_device *dev)
6071 + {
6072 +- struct pc236_private *devpriv = dev->private;
6073 ++ const struct pc236_board *thisboard = comedi_board(dev);
6074 + struct pci_dev *pcidev = comedi_to_pci_dev(dev);
6075 +
6076 +- if (devpriv)
6077 ++ if (!thisboard)
6078 ++ return;
6079 ++ if (dev->iobase)
6080 + pc236_intr_disable(dev);
6081 + if (dev->irq)
6082 + free_irq(dev->irq, dev);
6083 +diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c
6084 +index 8191c4e..8c0fbd1 100644
6085 +--- a/drivers/staging/comedi/drivers/amplc_pc263.c
6086 ++++ b/drivers/staging/comedi/drivers/amplc_pc263.c
6087 +@@ -310,8 +310,11 @@ static int __devinit pc263_attach_pci(struct comedi_device *dev,
6088 +
6089 + static void pc263_detach(struct comedi_device *dev)
6090 + {
6091 ++ const struct pc263_board *thisboard = comedi_board(dev);
6092 + struct pci_dev *pcidev = comedi_to_pci_dev(dev);
6093 +
6094 ++ if (!thisboard)
6095 ++ return;
6096 + if (pcidev) {
6097 + if (dev->iobase)
6098 + comedi_pci_disable(pcidev);
6099 +diff --git a/drivers/staging/comedi/drivers/das08.c b/drivers/staging/comedi/drivers/das08.c
6100 +index 67a914a..d893e3b 100644
6101 +--- a/drivers/staging/comedi/drivers/das08.c
6102 ++++ b/drivers/staging/comedi/drivers/das08.c
6103 +@@ -1028,6 +1028,8 @@ static void __maybe_unused das08_detach(struct comedi_device *dev)
6104 + const struct das08_board_struct *thisboard = comedi_board(dev);
6105 + struct das08_private_struct *devpriv = dev->private;
6106 +
6107 ++ if (!thisboard)
6108 ++ return;
6109 + das08_common_detach(dev);
6110 + if (IS_ENABLED(CONFIG_COMEDI_DAS08_ISA) &&
6111 + (thisboard->bustype == isa || thisboard->bustype == pc104)) {
6112 +diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c
6113 +index 83016b4..bcf6a65 100644
6114 +--- a/drivers/staging/comedi/drivers/ni_daq_700.c
6115 ++++ b/drivers/staging/comedi/drivers/ni_daq_700.c
6116 +@@ -71,7 +71,7 @@ static int subdev_700_insn(struct comedi_device *dev,
6117 + }
6118 +
6119 + data[1] = s->state & 0xff;
6120 +- data[1] |= inb(dev->iobase + DIO_R);
6121 ++ data[1] |= inb(dev->iobase + DIO_R) << 8;
6122 +
6123 + return insn->n;
6124 + }
6125 +diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
6126 +index ab8b787..d3a1d65 100644
6127 +--- a/drivers/staging/comedi/drivers/ni_labpc.c
6128 ++++ b/drivers/staging/comedi/drivers/ni_labpc.c
6129 +@@ -809,6 +809,8 @@ static int labpc_find_device(struct comedi_device *dev, int bus, int slot)
6130 +
6131 + void labpc_common_detach(struct comedi_device *dev)
6132 + {
6133 ++ if (!thisboard)
6134 ++ return;
6135 + if (dev->subdevices)
6136 + subdev_8255_cleanup(dev, dev->subdevices + 2);
6137 + #ifdef CONFIG_ISA_DMA_API
6138 +diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
6139 +index 653b074..6edefde 100644
6140 +--- a/drivers/staging/zram/zram_drv.c
6141 ++++ b/drivers/staging/zram/zram_drv.c
6142 +@@ -223,8 +223,13 @@ static int zram_bvec_read(struct zram *zram, struct bio_vec *bvec,
6143 + cmem = zs_map_object(zram->mem_pool, zram->table[index].handle,
6144 + ZS_MM_RO);
6145 +
6146 +- ret = lzo1x_decompress_safe(cmem, zram->table[index].size,
6147 ++ if (zram->table[index].size == PAGE_SIZE) {
6148 ++ memcpy(uncmem, cmem, PAGE_SIZE);
6149 ++ ret = LZO_E_OK;
6150 ++ } else {
6151 ++ ret = lzo1x_decompress_safe(cmem, zram->table[index].size,
6152 + uncmem, &clen);
6153 ++ }
6154 +
6155 + if (is_partial_io(bvec)) {
6156 + memcpy(user_mem + bvec->bv_offset, uncmem + offset,
6157 +@@ -342,8 +347,11 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
6158 + goto out;
6159 + }
6160 +
6161 +- if (unlikely(clen > max_zpage_size))
6162 ++ if (unlikely(clen > max_zpage_size)) {
6163 + zram_stat_inc(&zram->stats.bad_compress);
6164 ++ src = uncmem;
6165 ++ clen = PAGE_SIZE;
6166 ++ }
6167 +
6168 + handle = zs_malloc(zram->mem_pool, clen);
6169 + if (!handle) {
6170 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
6171 +index bbff143..fe7faf0 100644
6172 +--- a/drivers/usb/core/hub.c
6173 ++++ b/drivers/usb/core/hub.c
6174 +@@ -730,13 +730,16 @@ static void hub_tt_work(struct work_struct *work)
6175 + int limit = 100;
6176 +
6177 + spin_lock_irqsave (&hub->tt.lock, flags);
6178 +- while (--limit && !list_empty (&hub->tt.clear_list)) {
6179 ++ while (!list_empty(&hub->tt.clear_list)) {
6180 + struct list_head *next;
6181 + struct usb_tt_clear *clear;
6182 + struct usb_device *hdev = hub->hdev;
6183 + const struct hc_driver *drv;
6184 + int status;
6185 +
6186 ++ if (!hub->quiescing && --limit < 0)
6187 ++ break;
6188 ++
6189 + next = hub->tt.clear_list.next;
6190 + clear = list_entry (next, struct usb_tt_clear, clear_list);
6191 + list_del (&clear->clear_list);
6192 +@@ -1201,7 +1204,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type)
6193 + if (hub->has_indicators)
6194 + cancel_delayed_work_sync(&hub->leds);
6195 + if (hub->tt.hub)
6196 +- cancel_work_sync(&hub->tt.clear_work);
6197 ++ flush_work_sync(&hub->tt.clear_work);
6198 + }
6199 +
6200 + /* caller has locked the hub device */
6201 +diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
6202 +index 966d148..39f9e4a 100644
6203 +--- a/drivers/usb/host/pci-quirks.c
6204 ++++ b/drivers/usb/host/pci-quirks.c
6205 +@@ -545,7 +545,14 @@ static const struct dmi_system_id __devinitconst ehci_dmi_nohandoff_table[] = {
6206 + /* Pegatron Lucid (Ordissimo AIRIS) */
6207 + .matches = {
6208 + DMI_MATCH(DMI_BOARD_NAME, "M11JB"),
6209 +- DMI_MATCH(DMI_BIOS_VERSION, "Lucid-GE-133"),
6210 ++ DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
6211 ++ },
6212 ++ },
6213 ++ {
6214 ++ /* Pegatron Lucid (Ordissimo) */
6215 ++ .matches = {
6216 ++ DMI_MATCH(DMI_BOARD_NAME, "Ordissimo"),
6217 ++ DMI_MATCH(DMI_BIOS_VERSION, "Lucid-"),
6218 + },
6219 + },
6220 + { }
6221 +diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
6222 +index a6e18b9..4f1e265 100644
6223 +--- a/drivers/usb/host/xhci-ring.c
6224 ++++ b/drivers/usb/host/xhci-ring.c
6225 +@@ -1228,6 +1228,17 @@ static void xhci_cmd_to_noop(struct xhci_hcd *xhci, struct xhci_cd *cur_cd)
6226 + cur_seg = find_trb_seg(xhci->cmd_ring->first_seg,
6227 + xhci->cmd_ring->dequeue, &cycle_state);
6228 +
6229 ++ if (!cur_seg) {
6230 ++ xhci_warn(xhci, "Command ring mismatch, dequeue = %p %llx (dma)\n",
6231 ++ xhci->cmd_ring->dequeue,
6232 ++ (unsigned long long)
6233 ++ xhci_trb_virt_to_dma(xhci->cmd_ring->deq_seg,
6234 ++ xhci->cmd_ring->dequeue));
6235 ++ xhci_debug_ring(xhci, xhci->cmd_ring);
6236 ++ xhci_dbg_ring_ptrs(xhci, xhci->cmd_ring);
6237 ++ return;
6238 ++ }
6239 ++
6240 + /* find the command trb matched by cd from command ring */
6241 + for (cmd_trb = xhci->cmd_ring->dequeue;
6242 + cmd_trb != xhci->cmd_ring->enqueue;
6243 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
6244 +index 0644f65..a6e910b 100644
6245 +--- a/drivers/usb/host/xhci.c
6246 ++++ b/drivers/usb/host/xhci.c
6247 +@@ -4020,7 +4020,7 @@ int xhci_update_device(struct usb_hcd *hcd, struct usb_device *udev)
6248 + static unsigned long long xhci_service_interval_to_ns(
6249 + struct usb_endpoint_descriptor *desc)
6250 + {
6251 +- return (1 << (desc->bInterval - 1)) * 125 * 1000;
6252 ++ return (1ULL << (desc->bInterval - 1)) * 125 * 1000;
6253 + }
6254 +
6255 + static u16 xhci_get_timeout_no_hub_lpm(struct usb_device *udev,
6256 +@@ -4141,7 +4141,7 @@ static u16 xhci_calculate_intel_u2_timeout(struct usb_device *udev,
6257 + (xhci_service_interval_to_ns(desc) > timeout_ns))
6258 + timeout_ns = xhci_service_interval_to_ns(desc);
6259 +
6260 +- u2_del_ns = udev->bos->ss_cap->bU2DevExitLat * 1000;
6261 ++ u2_del_ns = le16_to_cpu(udev->bos->ss_cap->bU2DevExitLat) * 1000ULL;
6262 + if (u2_del_ns > timeout_ns)
6263 + timeout_ns = u2_del_ns;
6264 +
6265 +diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
6266 +index cabd1b1..8391d30 100644
6267 +--- a/drivers/usb/serial/ch341.c
6268 ++++ b/drivers/usb/serial/ch341.c
6269 +@@ -241,13 +241,11 @@ out: kfree(buffer);
6270 + return r;
6271 + }
6272 +
6273 +-/* allocate private data */
6274 +-static int ch341_attach(struct usb_serial *serial)
6275 ++static int ch341_port_probe(struct usb_serial_port *port)
6276 + {
6277 + struct ch341_private *priv;
6278 + int r;
6279 +
6280 +- /* private data */
6281 + priv = kzalloc(sizeof(struct ch341_private), GFP_KERNEL);
6282 + if (!priv)
6283 + return -ENOMEM;
6284 +@@ -257,17 +255,27 @@ static int ch341_attach(struct usb_serial *serial)
6285 + priv->baud_rate = DEFAULT_BAUD_RATE;
6286 + priv->line_control = CH341_BIT_RTS | CH341_BIT_DTR;
6287 +
6288 +- r = ch341_configure(serial->dev, priv);
6289 ++ r = ch341_configure(port->serial->dev, priv);
6290 + if (r < 0)
6291 + goto error;
6292 +
6293 +- usb_set_serial_port_data(serial->port[0], priv);
6294 ++ usb_set_serial_port_data(port, priv);
6295 + return 0;
6296 +
6297 + error: kfree(priv);
6298 + return r;
6299 + }
6300 +
6301 ++static int ch341_port_remove(struct usb_serial_port *port)
6302 ++{
6303 ++ struct ch341_private *priv;
6304 ++
6305 ++ priv = usb_get_serial_port_data(port);
6306 ++ kfree(priv);
6307 ++
6308 ++ return 0;
6309 ++}
6310 ++
6311 + static int ch341_carrier_raised(struct usb_serial_port *port)
6312 + {
6313 + struct ch341_private *priv = usb_get_serial_port_data(port);
6314 +@@ -303,7 +311,7 @@ static void ch341_close(struct usb_serial_port *port)
6315 + static int ch341_open(struct tty_struct *tty, struct usb_serial_port *port)
6316 + {
6317 + struct usb_serial *serial = port->serial;
6318 +- struct ch341_private *priv = usb_get_serial_port_data(serial->port[0]);
6319 ++ struct ch341_private *priv = usb_get_serial_port_data(port);
6320 + int r;
6321 +
6322 + priv->baud_rate = DEFAULT_BAUD_RATE;
6323 +@@ -606,7 +614,8 @@ static struct usb_serial_driver ch341_device = {
6324 + .tiocmget = ch341_tiocmget,
6325 + .tiocmset = ch341_tiocmset,
6326 + .read_int_callback = ch341_read_int_callback,
6327 +- .attach = ch341_attach,
6328 ++ .port_probe = ch341_port_probe,
6329 ++ .port_remove = ch341_port_remove,
6330 + .reset_resume = ch341_reset_resume,
6331 + };
6332 +
6333 +diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
6334 +index b5cd838..06e8bf4 100644
6335 +--- a/drivers/usb/serial/digi_acceleport.c
6336 ++++ b/drivers/usb/serial/digi_acceleport.c
6337 +@@ -244,6 +244,8 @@ static int digi_startup_device(struct usb_serial *serial);
6338 + static int digi_startup(struct usb_serial *serial);
6339 + static void digi_disconnect(struct usb_serial *serial);
6340 + static void digi_release(struct usb_serial *serial);
6341 ++static int digi_port_probe(struct usb_serial_port *port);
6342 ++static int digi_port_remove(struct usb_serial_port *port);
6343 + static void digi_read_bulk_callback(struct urb *urb);
6344 + static int digi_read_inb_callback(struct urb *urb);
6345 + static int digi_read_oob_callback(struct urb *urb);
6346 +@@ -298,6 +300,8 @@ static struct usb_serial_driver digi_acceleport_2_device = {
6347 + .attach = digi_startup,
6348 + .disconnect = digi_disconnect,
6349 + .release = digi_release,
6350 ++ .port_probe = digi_port_probe,
6351 ++ .port_remove = digi_port_remove,
6352 + };
6353 +
6354 + static struct usb_serial_driver digi_acceleport_4_device = {
6355 +@@ -324,6 +328,8 @@ static struct usb_serial_driver digi_acceleport_4_device = {
6356 + .attach = digi_startup,
6357 + .disconnect = digi_disconnect,
6358 + .release = digi_release,
6359 ++ .port_probe = digi_port_probe,
6360 ++ .port_remove = digi_port_remove,
6361 + };
6362 +
6363 + static struct usb_serial_driver * const serial_drivers[] = {
6364 +@@ -1237,59 +1243,50 @@ static int digi_startup_device(struct usb_serial *serial)
6365 + return ret;
6366 + }
6367 +
6368 +-
6369 +-static int digi_startup(struct usb_serial *serial)
6370 ++static int digi_port_init(struct usb_serial_port *port, unsigned port_num)
6371 + {
6372 +-
6373 +- int i;
6374 + struct digi_port *priv;
6375 +- struct digi_serial *serial_priv;
6376 +
6377 +- /* allocate the private data structures for all ports */
6378 +- /* number of regular ports + 1 for the out-of-band port */
6379 +- for (i = 0; i < serial->type->num_ports + 1; i++) {
6380 +- /* allocate port private structure */
6381 +- priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL);
6382 +- if (priv == NULL) {
6383 +- while (--i >= 0)
6384 +- kfree(usb_get_serial_port_data(serial->port[i]));
6385 +- return 1; /* error */
6386 +- }
6387 ++ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
6388 ++ if (!priv)
6389 ++ return -ENOMEM;
6390 +
6391 +- /* initialize port private structure */
6392 +- spin_lock_init(&priv->dp_port_lock);
6393 +- priv->dp_port_num = i;
6394 +- priv->dp_out_buf_len = 0;
6395 +- priv->dp_write_urb_in_use = 0;
6396 +- priv->dp_modem_signals = 0;
6397 +- init_waitqueue_head(&priv->dp_modem_change_wait);
6398 +- priv->dp_transmit_idle = 0;
6399 +- init_waitqueue_head(&priv->dp_transmit_idle_wait);
6400 +- priv->dp_throttled = 0;
6401 +- priv->dp_throttle_restart = 0;
6402 +- init_waitqueue_head(&priv->dp_flush_wait);
6403 +- init_waitqueue_head(&priv->dp_close_wait);
6404 +- INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock);
6405 +- priv->dp_port = serial->port[i];
6406 +- /* initialize write wait queue for this port */
6407 +- init_waitqueue_head(&serial->port[i]->write_wait);
6408 +-
6409 +- usb_set_serial_port_data(serial->port[i], priv);
6410 +- }
6411 ++ spin_lock_init(&priv->dp_port_lock);
6412 ++ priv->dp_port_num = port_num;
6413 ++ init_waitqueue_head(&priv->dp_modem_change_wait);
6414 ++ init_waitqueue_head(&priv->dp_transmit_idle_wait);
6415 ++ init_waitqueue_head(&priv->dp_flush_wait);
6416 ++ init_waitqueue_head(&priv->dp_close_wait);
6417 ++ INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock);
6418 ++ priv->dp_port = port;
6419 +
6420 +- /* allocate serial private structure */
6421 +- serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL);
6422 +- if (serial_priv == NULL) {
6423 +- for (i = 0; i < serial->type->num_ports + 1; i++)
6424 +- kfree(usb_get_serial_port_data(serial->port[i]));
6425 +- return 1; /* error */
6426 +- }
6427 ++ init_waitqueue_head(&port->write_wait);
6428 ++
6429 ++ usb_set_serial_port_data(port, priv);
6430 ++
6431 ++ return 0;
6432 ++}
6433 ++
6434 ++static int digi_startup(struct usb_serial *serial)
6435 ++{
6436 ++ struct digi_serial *serial_priv;
6437 ++ int ret;
6438 ++
6439 ++ serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL);
6440 ++ if (!serial_priv)
6441 ++ return -ENOMEM;
6442 +
6443 +- /* initialize serial private structure */
6444 + spin_lock_init(&serial_priv->ds_serial_lock);
6445 + serial_priv->ds_oob_port_num = serial->type->num_ports;
6446 + serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num];
6447 +- serial_priv->ds_device_started = 0;
6448 ++
6449 ++ ret = digi_port_init(serial_priv->ds_oob_port,
6450 ++ serial_priv->ds_oob_port_num);
6451 ++ if (ret) {
6452 ++ kfree(serial_priv);
6453 ++ return ret;
6454 ++ }
6455 ++
6456 + usb_set_serial_data(serial, serial_priv);
6457 +
6458 + return 0;
6459 +@@ -1310,15 +1307,35 @@ static void digi_disconnect(struct usb_serial *serial)
6460 +
6461 + static void digi_release(struct usb_serial *serial)
6462 + {
6463 +- int i;
6464 ++ struct digi_serial *serial_priv;
6465 ++ struct digi_port *priv;
6466 ++
6467 ++ serial_priv = usb_get_serial_data(serial);
6468 ++
6469 ++ priv = usb_get_serial_port_data(serial_priv->ds_oob_port);
6470 ++ kfree(priv);
6471 +
6472 +- /* free the private data structures for all ports */
6473 +- /* number of regular ports + 1 for the out-of-band port */
6474 +- for (i = 0; i < serial->type->num_ports + 1; i++)
6475 +- kfree(usb_get_serial_port_data(serial->port[i]));
6476 +- kfree(usb_get_serial_data(serial));
6477 ++ kfree(serial_priv);
6478 + }
6479 +
6480 ++static int digi_port_probe(struct usb_serial_port *port)
6481 ++{
6482 ++ unsigned port_num;
6483 ++
6484 ++ port_num = port->number - port->serial->minor;
6485 ++
6486 ++ return digi_port_init(port, port_num);
6487 ++}
6488 ++
6489 ++static int digi_port_remove(struct usb_serial_port *port)
6490 ++{
6491 ++ struct digi_port *priv;
6492 ++
6493 ++ priv = usb_get_serial_port_data(port);
6494 ++ kfree(priv);
6495 ++
6496 ++ return 0;
6497 ++}
6498 +
6499 + static void digi_read_bulk_callback(struct urb *urb)
6500 + {
6501 +diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
6502 +index 2cb30c5..8df011f 100644
6503 +--- a/drivers/usb/serial/ipw.c
6504 ++++ b/drivers/usb/serial/ipw.c
6505 +@@ -209,8 +209,7 @@ static int ipw_open(struct tty_struct *tty, struct usb_serial_port *port)
6506 + return 0;
6507 + }
6508 +
6509 +-/* fake probe - only to allocate data structures */
6510 +-static int ipw_probe(struct usb_serial *serial, const struct usb_device_id *id)
6511 ++static int ipw_attach(struct usb_serial *serial)
6512 + {
6513 + struct usb_wwan_intf_private *data;
6514 +
6515 +@@ -310,9 +309,9 @@ static struct usb_serial_driver ipw_device = {
6516 + .num_ports = 1,
6517 + .open = ipw_open,
6518 + .close = ipw_close,
6519 +- .probe = ipw_probe,
6520 +- .attach = usb_wwan_startup,
6521 ++ .attach = ipw_attach,
6522 + .release = ipw_release,
6523 ++ .port_probe = usb_wwan_port_probe,
6524 + .port_remove = usb_wwan_port_remove,
6525 + .dtr_rts = ipw_dtr_rts,
6526 + .write = usb_wwan_write,
6527 +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
6528 +index af0b70e..f6788d7 100644
6529 +--- a/drivers/usb/serial/keyspan.c
6530 ++++ b/drivers/usb/serial/keyspan.c
6531 +@@ -1392,13 +1392,9 @@ static struct callbacks {
6532 + data in device_details */
6533 + static void keyspan_setup_urbs(struct usb_serial *serial)
6534 + {
6535 +- int i, j;
6536 + struct keyspan_serial_private *s_priv;
6537 + const struct keyspan_device_details *d_details;
6538 +- struct usb_serial_port *port;
6539 +- struct keyspan_port_private *p_priv;
6540 + struct callbacks *cback;
6541 +- int endp;
6542 +
6543 + s_priv = usb_get_serial_data(serial);
6544 + d_details = s_priv->device_details;
6545 +@@ -1422,45 +1418,6 @@ static void keyspan_setup_urbs(struct usb_serial *serial)
6546 + (serial, d_details->glocont_endpoint, USB_DIR_OUT,
6547 + serial, s_priv->glocont_buf, GLOCONT_BUFLEN,
6548 + cback->glocont_callback);
6549 +-
6550 +- /* Setup endpoints for each port specific thing */
6551 +- for (i = 0; i < d_details->num_ports; i++) {
6552 +- port = serial->port[i];
6553 +- p_priv = usb_get_serial_port_data(port);
6554 +-
6555 +- /* Do indat endpoints first, once for each flip */
6556 +- endp = d_details->indat_endpoints[i];
6557 +- for (j = 0; j <= d_details->indat_endp_flip; ++j, ++endp) {
6558 +- p_priv->in_urbs[j] = keyspan_setup_urb
6559 +- (serial, endp, USB_DIR_IN, port,
6560 +- p_priv->in_buffer[j], 64,
6561 +- cback->indat_callback);
6562 +- }
6563 +- for (; j < 2; ++j)
6564 +- p_priv->in_urbs[j] = NULL;
6565 +-
6566 +- /* outdat endpoints also have flip */
6567 +- endp = d_details->outdat_endpoints[i];
6568 +- for (j = 0; j <= d_details->outdat_endp_flip; ++j, ++endp) {
6569 +- p_priv->out_urbs[j] = keyspan_setup_urb
6570 +- (serial, endp, USB_DIR_OUT, port,
6571 +- p_priv->out_buffer[j], 64,
6572 +- cback->outdat_callback);
6573 +- }
6574 +- for (; j < 2; ++j)
6575 +- p_priv->out_urbs[j] = NULL;
6576 +-
6577 +- /* inack endpoint */
6578 +- p_priv->inack_urb = keyspan_setup_urb
6579 +- (serial, d_details->inack_endpoints[i], USB_DIR_IN,
6580 +- port, p_priv->inack_buffer, 1, cback->inack_callback);
6581 +-
6582 +- /* outcont endpoint */
6583 +- p_priv->outcont_urb = keyspan_setup_urb
6584 +- (serial, d_details->outcont_endpoints[i], USB_DIR_OUT,
6585 +- port, p_priv->outcont_buffer, 64,
6586 +- cback->outcont_callback);
6587 +- }
6588 + }
6589 +
6590 + /* usa19 function doesn't require prescaler */
6591 +@@ -2422,9 +2379,7 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
6592 + static int keyspan_startup(struct usb_serial *serial)
6593 + {
6594 + int i, err;
6595 +- struct usb_serial_port *port;
6596 + struct keyspan_serial_private *s_priv;
6597 +- struct keyspan_port_private *p_priv;
6598 + const struct keyspan_device_details *d_details;
6599 +
6600 + for (i = 0; (d_details = keyspan_devices[i]) != NULL; ++i)
6601 +@@ -2448,19 +2403,6 @@ static int keyspan_startup(struct usb_serial *serial)
6602 + s_priv->device_details = d_details;
6603 + usb_set_serial_data(serial, s_priv);
6604 +
6605 +- /* Now setup per port private data */
6606 +- for (i = 0; i < serial->num_ports; i++) {
6607 +- port = serial->port[i];
6608 +- p_priv = kzalloc(sizeof(struct keyspan_port_private),
6609 +- GFP_KERNEL);
6610 +- if (!p_priv) {
6611 +- dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __func__, i);
6612 +- return 1;
6613 +- }
6614 +- p_priv->device_details = d_details;
6615 +- usb_set_serial_port_data(port, p_priv);
6616 +- }
6617 +-
6618 + keyspan_setup_urbs(serial);
6619 +
6620 + if (s_priv->instat_urb != NULL) {
6621 +@@ -2481,61 +2423,112 @@ static int keyspan_startup(struct usb_serial *serial)
6622 +
6623 + static void keyspan_disconnect(struct usb_serial *serial)
6624 + {
6625 +- int i, j;
6626 +- struct usb_serial_port *port;
6627 +- struct keyspan_serial_private *s_priv;
6628 +- struct keyspan_port_private *p_priv;
6629 ++ struct keyspan_serial_private *s_priv;
6630 +
6631 + s_priv = usb_get_serial_data(serial);
6632 +
6633 +- /* Stop reading/writing urbs */
6634 + stop_urb(s_priv->instat_urb);
6635 + stop_urb(s_priv->glocont_urb);
6636 + stop_urb(s_priv->indat_urb);
6637 +- for (i = 0; i < serial->num_ports; ++i) {
6638 +- port = serial->port[i];
6639 +- p_priv = usb_get_serial_port_data(port);
6640 +- stop_urb(p_priv->inack_urb);
6641 +- stop_urb(p_priv->outcont_urb);
6642 +- for (j = 0; j < 2; j++) {
6643 +- stop_urb(p_priv->in_urbs[j]);
6644 +- stop_urb(p_priv->out_urbs[j]);
6645 +- }
6646 +- }
6647 ++}
6648 ++
6649 ++static void keyspan_release(struct usb_serial *serial)
6650 ++{
6651 ++ struct keyspan_serial_private *s_priv;
6652 ++
6653 ++ s_priv = usb_get_serial_data(serial);
6654 +
6655 +- /* Now free them */
6656 + usb_free_urb(s_priv->instat_urb);
6657 + usb_free_urb(s_priv->indat_urb);
6658 + usb_free_urb(s_priv->glocont_urb);
6659 +- for (i = 0; i < serial->num_ports; ++i) {
6660 +- port = serial->port[i];
6661 +- p_priv = usb_get_serial_port_data(port);
6662 +- usb_free_urb(p_priv->inack_urb);
6663 +- usb_free_urb(p_priv->outcont_urb);
6664 +- for (j = 0; j < 2; j++) {
6665 +- usb_free_urb(p_priv->in_urbs[j]);
6666 +- usb_free_urb(p_priv->out_urbs[j]);
6667 +- }
6668 +- }
6669 ++
6670 ++ kfree(s_priv);
6671 + }
6672 +
6673 +-static void keyspan_release(struct usb_serial *serial)
6674 ++static int keyspan_port_probe(struct usb_serial_port *port)
6675 + {
6676 +- int i;
6677 +- struct usb_serial_port *port;
6678 +- struct keyspan_serial_private *s_priv;
6679 ++ struct usb_serial *serial = port->serial;
6680 ++ struct keyspan_port_private *s_priv;
6681 ++ struct keyspan_port_private *p_priv;
6682 ++ const struct keyspan_device_details *d_details;
6683 ++ struct callbacks *cback;
6684 ++ int endp;
6685 ++ int port_num;
6686 ++ int i;
6687 +
6688 + s_priv = usb_get_serial_data(serial);
6689 ++ d_details = s_priv->device_details;
6690 +
6691 +- /* dbg("Freeing serial->private."); */
6692 +- kfree(s_priv);
6693 ++ p_priv = kzalloc(sizeof(*p_priv), GFP_KERNEL);
6694 ++ if (!p_priv)
6695 ++ return -ENOMEM;
6696 +
6697 +- /* dbg("Freeing port->private."); */
6698 +- /* Now free per port private data */
6699 +- for (i = 0; i < serial->num_ports; i++) {
6700 +- port = serial->port[i];
6701 +- kfree(usb_get_serial_port_data(port));
6702 ++ s_priv = usb_get_serial_data(port->serial);
6703 ++ p_priv->device_details = d_details;
6704 ++
6705 ++ /* Setup values for the various callback routines */
6706 ++ cback = &keyspan_callbacks[d_details->msg_format];
6707 ++
6708 ++ port_num = port->number - port->serial->minor;
6709 ++
6710 ++ /* Do indat endpoints first, once for each flip */
6711 ++ endp = d_details->indat_endpoints[port_num];
6712 ++ for (i = 0; i <= d_details->indat_endp_flip; ++i, ++endp) {
6713 ++ p_priv->in_urbs[i] = keyspan_setup_urb(serial, endp,
6714 ++ USB_DIR_IN, port,
6715 ++ p_priv->in_buffer[i], 64,
6716 ++ cback->indat_callback);
6717 ++ }
6718 ++ /* outdat endpoints also have flip */
6719 ++ endp = d_details->outdat_endpoints[port_num];
6720 ++ for (i = 0; i <= d_details->outdat_endp_flip; ++i, ++endp) {
6721 ++ p_priv->out_urbs[i] = keyspan_setup_urb(serial, endp,
6722 ++ USB_DIR_OUT, port,
6723 ++ p_priv->out_buffer[i], 64,
6724 ++ cback->outdat_callback);
6725 ++ }
6726 ++ /* inack endpoint */
6727 ++ p_priv->inack_urb = keyspan_setup_urb(serial,
6728 ++ d_details->inack_endpoints[port_num],
6729 ++ USB_DIR_IN, port,
6730 ++ p_priv->inack_buffer, 1,
6731 ++ cback->inack_callback);
6732 ++ /* outcont endpoint */
6733 ++ p_priv->outcont_urb = keyspan_setup_urb(serial,
6734 ++ d_details->outcont_endpoints[port_num],
6735 ++ USB_DIR_OUT, port,
6736 ++ p_priv->outcont_buffer, 64,
6737 ++ cback->outcont_callback);
6738 ++
6739 ++ usb_set_serial_port_data(port, p_priv);
6740 ++
6741 ++ return 0;
6742 ++}
6743 ++
6744 ++static int keyspan_port_remove(struct usb_serial_port *port)
6745 ++{
6746 ++ struct keyspan_port_private *p_priv;
6747 ++ int i;
6748 ++
6749 ++ p_priv = usb_get_serial_port_data(port);
6750 ++
6751 ++ stop_urb(p_priv->inack_urb);
6752 ++ stop_urb(p_priv->outcont_urb);
6753 ++ for (i = 0; i < 2; i++) {
6754 ++ stop_urb(p_priv->in_urbs[i]);
6755 ++ stop_urb(p_priv->out_urbs[i]);
6756 ++ }
6757 ++
6758 ++ usb_free_urb(p_priv->inack_urb);
6759 ++ usb_free_urb(p_priv->outcont_urb);
6760 ++ for (i = 0; i < 2; i++) {
6761 ++ usb_free_urb(p_priv->in_urbs[i]);
6762 ++ usb_free_urb(p_priv->out_urbs[i]);
6763 + }
6764 ++
6765 ++ kfree(p_priv);
6766 ++
6767 ++ return 0;
6768 + }
6769 +
6770 + MODULE_AUTHOR(DRIVER_AUTHOR);
6771 +diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
6772 +index fe1c5d9..90a7b36 100644
6773 +--- a/drivers/usb/serial/keyspan.h
6774 ++++ b/drivers/usb/serial/keyspan.h
6775 +@@ -42,6 +42,8 @@ static void keyspan_dtr_rts (struct usb_serial_port *port, int on);
6776 + static int keyspan_startup (struct usb_serial *serial);
6777 + static void keyspan_disconnect (struct usb_serial *serial);
6778 + static void keyspan_release (struct usb_serial *serial);
6779 ++static int keyspan_port_probe(struct usb_serial_port *port);
6780 ++static int keyspan_port_remove(struct usb_serial_port *port);
6781 + static int keyspan_write_room (struct tty_struct *tty);
6782 +
6783 + static int keyspan_write (struct tty_struct *tty,
6784 +@@ -562,6 +564,8 @@ static struct usb_serial_driver keyspan_1port_device = {
6785 + .attach = keyspan_startup,
6786 + .disconnect = keyspan_disconnect,
6787 + .release = keyspan_release,
6788 ++ .port_probe = keyspan_port_probe,
6789 ++ .port_remove = keyspan_port_remove,
6790 + };
6791 +
6792 + static struct usb_serial_driver keyspan_2port_device = {
6793 +@@ -584,6 +588,8 @@ static struct usb_serial_driver keyspan_2port_device = {
6794 + .attach = keyspan_startup,
6795 + .disconnect = keyspan_disconnect,
6796 + .release = keyspan_release,
6797 ++ .port_probe = keyspan_port_probe,
6798 ++ .port_remove = keyspan_port_remove,
6799 + };
6800 +
6801 + static struct usb_serial_driver keyspan_4port_device = {
6802 +@@ -606,6 +612,8 @@ static struct usb_serial_driver keyspan_4port_device = {
6803 + .attach = keyspan_startup,
6804 + .disconnect = keyspan_disconnect,
6805 + .release = keyspan_release,
6806 ++ .port_probe = keyspan_port_probe,
6807 ++ .port_remove = keyspan_port_remove,
6808 + };
6809 +
6810 + static struct usb_serial_driver * const serial_drivers[] = {
6811 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
6812 +index a71fa0a..c088250 100644
6813 +--- a/drivers/usb/serial/mct_u232.c
6814 ++++ b/drivers/usb/serial/mct_u232.c
6815 +@@ -51,7 +51,8 @@ static bool debug;
6816 + * Function prototypes
6817 + */
6818 + static int mct_u232_startup(struct usb_serial *serial);
6819 +-static void mct_u232_release(struct usb_serial *serial);
6820 ++static int mct_u232_port_probe(struct usb_serial_port *port);
6821 ++static int mct_u232_port_remove(struct usb_serial_port *remove);
6822 + static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port);
6823 + static void mct_u232_close(struct usb_serial_port *port);
6824 + static void mct_u232_dtr_rts(struct usb_serial_port *port, int on);
6825 +@@ -101,7 +102,8 @@ static struct usb_serial_driver mct_u232_device = {
6826 + .tiocmget = mct_u232_tiocmget,
6827 + .tiocmset = mct_u232_tiocmset,
6828 + .attach = mct_u232_startup,
6829 +- .release = mct_u232_release,
6830 ++ .port_probe = mct_u232_port_probe,
6831 ++ .port_remove = mct_u232_port_remove,
6832 + .ioctl = mct_u232_ioctl,
6833 + .get_icount = mct_u232_get_icount,
6834 + };
6835 +@@ -392,18 +394,8 @@ static void mct_u232_msr_to_state(unsigned int *control_state,
6836 +
6837 + static int mct_u232_startup(struct usb_serial *serial)
6838 + {
6839 +- struct mct_u232_private *priv;
6840 + struct usb_serial_port *port, *rport;
6841 +
6842 +- priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL);
6843 +- if (!priv)
6844 +- return -ENOMEM;
6845 +- spin_lock_init(&priv->lock);
6846 +- init_waitqueue_head(&priv->msr_wait);
6847 +- usb_set_serial_port_data(serial->port[0], priv);
6848 +-
6849 +- init_waitqueue_head(&serial->port[0]->write_wait);
6850 +-
6851 + /* Puh, that's dirty */
6852 + port = serial->port[0];
6853 + rport = serial->port[1];
6854 +@@ -416,18 +408,31 @@ static int mct_u232_startup(struct usb_serial *serial)
6855 + return 0;
6856 + } /* mct_u232_startup */
6857 +
6858 ++static int mct_u232_port_probe(struct usb_serial_port *port)
6859 ++{
6860 ++ struct mct_u232_private *priv;
6861 ++
6862 ++ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
6863 ++ if (!priv)
6864 ++ return -ENOMEM;
6865 ++
6866 ++ spin_lock_init(&priv->lock);
6867 ++ init_waitqueue_head(&priv->msr_wait);
6868 ++
6869 ++ usb_set_serial_port_data(port, priv);
6870 +
6871 +-static void mct_u232_release(struct usb_serial *serial)
6872 ++ return 0;
6873 ++}
6874 ++
6875 ++static int mct_u232_port_remove(struct usb_serial_port *port)
6876 + {
6877 + struct mct_u232_private *priv;
6878 +- int i;
6879 +
6880 +- for (i = 0; i < serial->num_ports; ++i) {
6881 +- /* My special items, the standard routines free my urbs */
6882 +- priv = usb_get_serial_port_data(serial->port[i]);
6883 +- kfree(priv);
6884 +- }
6885 +-} /* mct_u232_release */
6886 ++ priv = usb_get_serial_port_data(port);
6887 ++ kfree(priv);
6888 ++
6889 ++ return 0;
6890 ++}
6891 +
6892 + static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port)
6893 + {
6894 +@@ -519,12 +524,14 @@ static void mct_u232_dtr_rts(struct usb_serial_port *port, int on)
6895 +
6896 + static void mct_u232_close(struct usb_serial_port *port)
6897 + {
6898 +- if (port->serial->dev) {
6899 +- /* shutdown our urbs */
6900 +- usb_kill_urb(port->write_urb);
6901 +- usb_kill_urb(port->read_urb);
6902 +- usb_kill_urb(port->interrupt_in_urb);
6903 +- }
6904 ++ /*
6905 ++ * Must kill the read urb as it is actually an interrupt urb, which
6906 ++ * generic close thus fails to kill.
6907 ++ */
6908 ++ usb_kill_urb(port->read_urb);
6909 ++ usb_kill_urb(port->interrupt_in_urb);
6910 ++
6911 ++ usb_serial_generic_close(port);
6912 + } /* mct_u232_close */
6913 +
6914 +
6915 +diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c
6916 +index d47eb06..d284fb8 100644
6917 +--- a/drivers/usb/serial/metro-usb.c
6918 ++++ b/drivers/usb/serial/metro-usb.c
6919 +@@ -188,16 +188,13 @@ static void metrousb_cleanup(struct usb_serial_port *port)
6920 + {
6921 + dev_dbg(&port->dev, "%s\n", __func__);
6922 +
6923 +- if (port->serial->dev) {
6924 +- /* Shutdown any interrupt in urbs. */
6925 +- if (port->interrupt_in_urb) {
6926 +- usb_unlink_urb(port->interrupt_in_urb);
6927 +- usb_kill_urb(port->interrupt_in_urb);
6928 +- }
6929 +-
6930 +- /* Send deactivate cmd to device */
6931 ++ usb_unlink_urb(port->interrupt_in_urb);
6932 ++ usb_kill_urb(port->interrupt_in_urb);
6933 ++
6934 ++ mutex_lock(&port->serial->disc_mutex);
6935 ++ if (!port->serial->disconnected)
6936 + metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port);
6937 +- }
6938 ++ mutex_unlock(&port->serial->disc_mutex);
6939 + }
6940 +
6941 + static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
6942 +@@ -280,51 +277,27 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr
6943 + return retval;
6944 + }
6945 +
6946 +-static void metrousb_shutdown(struct usb_serial *serial)
6947 ++static int metrousb_port_probe(struct usb_serial_port *port)
6948 + {
6949 +- int i = 0;
6950 ++ struct metrousb_private *metro_priv;
6951 +
6952 +- dev_dbg(&serial->dev->dev, "%s\n", __func__);
6953 ++ metro_priv = kzalloc(sizeof(*metro_priv), GFP_KERNEL);
6954 ++ if (!metro_priv)
6955 ++ return -ENOMEM;
6956 +
6957 +- /* Stop reading and writing on all ports. */
6958 +- for (i = 0; i < serial->num_ports; ++i) {
6959 +- /* Close any open urbs. */
6960 +- metrousb_cleanup(serial->port[i]);
6961 ++ spin_lock_init(&metro_priv->lock);
6962 +
6963 +- /* Free memory. */
6964 +- kfree(usb_get_serial_port_data(serial->port[i]));
6965 +- usb_set_serial_port_data(serial->port[i], NULL);
6966 ++ usb_set_serial_port_data(port, metro_priv);
6967 +
6968 +- dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n",
6969 +- __func__, serial->port[i]->number);
6970 +- }
6971 ++ return 0;
6972 + }
6973 +
6974 +-static int metrousb_startup(struct usb_serial *serial)
6975 ++static int metrousb_port_remove(struct usb_serial_port *port)
6976 + {
6977 + struct metrousb_private *metro_priv;
6978 +- struct usb_serial_port *port;
6979 +- int i = 0;
6980 +
6981 +- dev_dbg(&serial->dev->dev, "%s\n", __func__);
6982 +-
6983 +- /* Loop through the serial ports setting up the private structures.
6984 +- * Currently we only use one port. */
6985 +- for (i = 0; i < serial->num_ports; ++i) {
6986 +- port = serial->port[i];
6987 +-
6988 +- /* Declare memory. */
6989 +- metro_priv = kzalloc(sizeof(struct metrousb_private), GFP_KERNEL);
6990 +- if (!metro_priv)
6991 +- return -ENOMEM;
6992 +-
6993 +- /* Initialize memory. */
6994 +- spin_lock_init(&metro_priv->lock);
6995 +- usb_set_serial_port_data(port, metro_priv);
6996 +-
6997 +- dev_dbg(&serial->dev->dev, "%s - port number=%d\n ",
6998 +- __func__, port->number);
6999 +- }
7000 ++ metro_priv = usb_get_serial_port_data(port);
7001 ++ kfree(metro_priv);
7002 +
7003 + return 0;
7004 + }
7005 +@@ -423,8 +396,8 @@ static struct usb_serial_driver metrousb_device = {
7006 + .close = metrousb_cleanup,
7007 + .read_int_callback = metrousb_read_int_callback,
7008 + .write_int_callback = metrousb_write_int_callback,
7009 +- .attach = metrousb_startup,
7010 +- .release = metrousb_shutdown,
7011 ++ .port_probe = metrousb_port_probe,
7012 ++ .port_remove = metrousb_port_remove,
7013 + .throttle = metrousb_throttle,
7014 + .unthrottle = metrousb_unthrottle,
7015 + .tiocmget = metrousb_tiocmget,
7016 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
7017 +index a07dd3c..eb84767 100644
7018 +--- a/drivers/usb/serial/mos7720.c
7019 ++++ b/drivers/usb/serial/mos7720.c
7020 +@@ -2023,9 +2023,7 @@ static int mos7720_ioctl(struct tty_struct *tty,
7021 +
7022 + static int mos7720_startup(struct usb_serial *serial)
7023 + {
7024 +- struct moschip_port *mos7720_port;
7025 + struct usb_device *dev;
7026 +- int i;
7027 + char data;
7028 + u16 product;
7029 + int ret_val;
7030 +@@ -2063,29 +2061,6 @@ static int mos7720_startup(struct usb_serial *serial)
7031 + serial->port[1]->interrupt_in_buffer = NULL;
7032 + }
7033 +
7034 +-
7035 +- /* set up serial port private structures */
7036 +- for (i = 0; i < serial->num_ports; ++i) {
7037 +- mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
7038 +- if (mos7720_port == NULL) {
7039 +- dev_err(&dev->dev, "%s - Out of memory\n", __func__);
7040 +- return -ENOMEM;
7041 +- }
7042 +-
7043 +- /* Initialize all port interrupt end point to port 0 int
7044 +- * endpoint. Our device has only one interrupt endpoint
7045 +- * common to all ports */
7046 +- serial->port[i]->interrupt_in_endpointAddress =
7047 +- serial->port[0]->interrupt_in_endpointAddress;
7048 +-
7049 +- mos7720_port->port = serial->port[i];
7050 +- usb_set_serial_port_data(serial->port[i], mos7720_port);
7051 +-
7052 +- dbg("port number is %d", serial->port[i]->number);
7053 +- dbg("serial number is %d", serial->minor);
7054 +- }
7055 +-
7056 +-
7057 + /* setting configuration feature to one */
7058 + usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
7059 + (__u8)0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5*HZ);
7060 +@@ -2113,8 +2088,6 @@ static int mos7720_startup(struct usb_serial *serial)
7061 +
7062 + static void mos7720_release(struct usb_serial *serial)
7063 + {
7064 +- int i;
7065 +-
7066 + #ifdef CONFIG_USB_SERIAL_MOS7715_PARPORT
7067 + /* close the parallel port */
7068 +
7069 +@@ -2153,9 +2126,36 @@ static void mos7720_release(struct usb_serial *serial)
7070 + kref_put(&mos_parport->ref_count, destroy_mos_parport);
7071 + }
7072 + #endif
7073 +- /* free private structure allocated for serial port */
7074 +- for (i = 0; i < serial->num_ports; ++i)
7075 +- kfree(usb_get_serial_port_data(serial->port[i]));
7076 ++}
7077 ++
7078 ++static int mos7720_port_probe(struct usb_serial_port *port)
7079 ++{
7080 ++ struct moschip_port *mos7720_port;
7081 ++
7082 ++ mos7720_port = kzalloc(sizeof(*mos7720_port), GFP_KERNEL);
7083 ++ if (!mos7720_port)
7084 ++ return -ENOMEM;
7085 ++
7086 ++ /* Initialize all port interrupt end point to port 0 int endpoint.
7087 ++ * Our device has only one interrupt endpoint common to all ports.
7088 ++ */
7089 ++ port->interrupt_in_endpointAddress =
7090 ++ port->serial->port[0]->interrupt_in_endpointAddress;
7091 ++ mos7720_port->port = port;
7092 ++
7093 ++ usb_set_serial_port_data(port, mos7720_port);
7094 ++
7095 ++ return 0;
7096 ++}
7097 ++
7098 ++static int mos7720_port_remove(struct usb_serial_port *port)
7099 ++{
7100 ++ struct moschip_port *mos7720_port;
7101 ++
7102 ++ mos7720_port = usb_get_serial_port_data(port);
7103 ++ kfree(mos7720_port);
7104 ++
7105 ++ return 0;
7106 + }
7107 +
7108 + static struct usb_serial_driver moschip7720_2port_driver = {
7109 +@@ -2173,6 +2173,8 @@ static struct usb_serial_driver moschip7720_2port_driver = {
7110 + .probe = mos77xx_probe,
7111 + .attach = mos7720_startup,
7112 + .release = mos7720_release,
7113 ++ .port_probe = mos7720_port_probe,
7114 ++ .port_remove = mos7720_port_remove,
7115 + .ioctl = mos7720_ioctl,
7116 + .tiocmget = mos7720_tiocmget,
7117 + .tiocmset = mos7720_tiocmset,
7118 +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
7119 +index 2f6da1e..52e5ca7 100644
7120 +--- a/drivers/usb/serial/mos7840.c
7121 ++++ b/drivers/usb/serial/mos7840.c
7122 +@@ -218,12 +218,10 @@ struct moschip_port {
7123 + int port_num; /*Actual port number in the device(1,2,etc) */
7124 + struct urb *write_urb; /* write URB for this port */
7125 + struct urb *read_urb; /* read URB for this port */
7126 +- struct urb *int_urb;
7127 + __u8 shadowLCR; /* last LCR value received */
7128 + __u8 shadowMCR; /* last MCR value received */
7129 + char open;
7130 + char open_ports;
7131 +- char zombie;
7132 + wait_queue_head_t wait_chase; /* for handling sleeping while waiting for chase to finish */
7133 + wait_queue_head_t delta_msr_wait; /* for handling sleeping while waiting for msr change to happen */
7134 + int delta_msr_cond;
7135 +@@ -493,7 +491,6 @@ static void mos7840_control_callback(struct urb *urb)
7136 + unsigned char *data;
7137 + struct moschip_port *mos7840_port;
7138 + __u8 regval = 0x0;
7139 +- int result = 0;
7140 + int status = urb->status;
7141 +
7142 + mos7840_port = urb->context;
7143 +@@ -512,7 +509,7 @@ static void mos7840_control_callback(struct urb *urb)
7144 + default:
7145 + dbg("%s - nonzero urb status received: %d", __func__,
7146 + status);
7147 +- goto exit;
7148 ++ return;
7149 + }
7150 +
7151 + dbg("%s urb buffer size is %d", __func__, urb->actual_length);
7152 +@@ -525,17 +522,6 @@ static void mos7840_control_callback(struct urb *urb)
7153 + mos7840_handle_new_msr(mos7840_port, regval);
7154 + else if (mos7840_port->MsrLsr == 1)
7155 + mos7840_handle_new_lsr(mos7840_port, regval);
7156 +-
7157 +-exit:
7158 +- spin_lock(&mos7840_port->pool_lock);
7159 +- if (!mos7840_port->zombie)
7160 +- result = usb_submit_urb(mos7840_port->int_urb, GFP_ATOMIC);
7161 +- spin_unlock(&mos7840_port->pool_lock);
7162 +- if (result) {
7163 +- dev_err(&urb->dev->dev,
7164 +- "%s - Error %d submitting interrupt urb\n",
7165 +- __func__, result);
7166 +- }
7167 + }
7168 +
7169 + static int mos7840_get_reg(struct moschip_port *mcs, __u16 Wval, __u16 reg,
7170 +@@ -704,14 +690,7 @@ static void mos7840_interrupt_callback(struct urb *urb)
7171 + wreg = MODEM_STATUS_REGISTER;
7172 + break;
7173 + }
7174 +- spin_lock(&mos7840_port->pool_lock);
7175 +- if (!mos7840_port->zombie) {
7176 +- rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data);
7177 +- } else {
7178 +- spin_unlock(&mos7840_port->pool_lock);
7179 +- return;
7180 +- }
7181 +- spin_unlock(&mos7840_port->pool_lock);
7182 ++ rv = mos7840_get_reg(mos7840_port, wval, wreg, &Data);
7183 + }
7184 + }
7185 + }
7186 +@@ -2684,7 +2663,6 @@ error:
7187 + kfree(mos7840_port->ctrl_buf);
7188 + usb_free_urb(mos7840_port->control_urb);
7189 + kfree(mos7840_port);
7190 +- serial->port[i] = NULL;
7191 + }
7192 + return status;
7193 + }
7194 +@@ -2714,9 +2692,6 @@ static void mos7840_disconnect(struct usb_serial *serial)
7195 + mos7840_port = mos7840_get_port_private(serial->port[i]);
7196 + dbg ("mos7840_port %d = %p", i, mos7840_port);
7197 + if (mos7840_port) {
7198 +- spin_lock_irqsave(&mos7840_port->pool_lock, flags);
7199 +- mos7840_port->zombie = 1;
7200 +- spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
7201 + usb_kill_urb(mos7840_port->control_urb);
7202 + }
7203 + }
7204 +@@ -2754,6 +2729,7 @@ static void mos7840_release(struct usb_serial *serial)
7205 + del_timer_sync(&mos7840_port->led_timer1);
7206 + del_timer_sync(&mos7840_port->led_timer2);
7207 + }
7208 ++ usb_free_urb(mos7840_port->control_urb);
7209 + kfree(mos7840_port->ctrl_buf);
7210 + kfree(mos7840_port->dr);
7211 + kfree(mos7840_port);
7212 +diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
7213 +index 6f3d705..27c9d06 100644
7214 +--- a/drivers/usb/serial/omninet.c
7215 ++++ b/drivers/usb/serial/omninet.c
7216 +@@ -46,8 +46,8 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
7217 + const unsigned char *buf, int count);
7218 + static int omninet_write_room(struct tty_struct *tty);
7219 + static void omninet_disconnect(struct usb_serial *serial);
7220 +-static void omninet_release(struct usb_serial *serial);
7221 +-static int omninet_attach(struct usb_serial *serial);
7222 ++static int omninet_port_probe(struct usb_serial_port *port);
7223 ++static int omninet_port_remove(struct usb_serial_port *port);
7224 +
7225 + static const struct usb_device_id id_table[] = {
7226 + { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) },
7227 +@@ -64,7 +64,8 @@ static struct usb_serial_driver zyxel_omninet_device = {
7228 + .description = "ZyXEL - omni.net lcd plus usb",
7229 + .id_table = id_table,
7230 + .num_ports = 1,
7231 +- .attach = omninet_attach,
7232 ++ .port_probe = omninet_port_probe,
7233 ++ .port_remove = omninet_port_remove,
7234 + .open = omninet_open,
7235 + .close = omninet_close,
7236 + .write = omninet_write,
7237 +@@ -72,7 +73,6 @@ static struct usb_serial_driver zyxel_omninet_device = {
7238 + .read_bulk_callback = omninet_read_bulk_callback,
7239 + .write_bulk_callback = omninet_write_bulk_callback,
7240 + .disconnect = omninet_disconnect,
7241 +- .release = omninet_release,
7242 + };
7243 +
7244 + static struct usb_serial_driver * const serial_drivers[] = {
7245 +@@ -114,18 +114,26 @@ struct omninet_data {
7246 + __u8 od_outseq; /* Sequence number for bulk_out URBs */
7247 + };
7248 +
7249 +-static int omninet_attach(struct usb_serial *serial)
7250 ++static int omninet_port_probe(struct usb_serial_port *port)
7251 + {
7252 + struct omninet_data *od;
7253 +- struct usb_serial_port *port = serial->port[0];
7254 +
7255 + od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL);
7256 +- if (!od) {
7257 +- dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n",
7258 +- __func__, sizeof(struct omninet_data));
7259 ++ if (!od)
7260 + return -ENOMEM;
7261 +- }
7262 ++
7263 + usb_set_serial_port_data(port, od);
7264 ++
7265 ++ return 0;
7266 ++}
7267 ++
7268 ++static int omninet_port_remove(struct usb_serial_port *port)
7269 ++{
7270 ++ struct omninet_data *od;
7271 ++
7272 ++ od = usb_get_serial_port_data(port);
7273 ++ kfree(od);
7274 ++
7275 + return 0;
7276 + }
7277 +
7278 +@@ -291,14 +299,6 @@ static void omninet_disconnect(struct usb_serial *serial)
7279 + usb_kill_urb(wport->write_urb);
7280 + }
7281 +
7282 +-
7283 +-static void omninet_release(struct usb_serial *serial)
7284 +-{
7285 +- struct usb_serial_port *port = serial->port[0];
7286 +-
7287 +- kfree(usb_get_serial_port_data(port));
7288 +-}
7289 +-
7290 + module_usb_serial_driver(serial_drivers, id_table);
7291 +
7292 + MODULE_AUTHOR(DRIVER_AUTHOR);
7293 +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
7294 +index 02cb1b7..623358a 100644
7295 +--- a/drivers/usb/serial/opticon.c
7296 ++++ b/drivers/usb/serial/opticon.c
7297 +@@ -158,7 +158,11 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
7298 + {
7299 + struct usb_serial *serial = port->serial;
7300 + int retval;
7301 +- u8 buffer[2];
7302 ++ u8 *buffer;
7303 ++
7304 ++ buffer = kzalloc(1, GFP_KERNEL);
7305 ++ if (!buffer)
7306 ++ return -ENOMEM;
7307 +
7308 + buffer[0] = val;
7309 + /* Send the message to the vendor control endpoint
7310 +@@ -167,6 +171,7 @@ static int send_control_msg(struct usb_serial_port *port, u8 requesttype,
7311 + requesttype,
7312 + USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE,
7313 + 0, 0, buffer, 1, 0);
7314 ++ kfree(buffer);
7315 +
7316 + return retval;
7317 + }
7318 +@@ -284,7 +289,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
7319 + if (!dr) {
7320 + dev_err(&port->dev, "out of memory\n");
7321 + count = -ENOMEM;
7322 +- goto error;
7323 ++ goto error_no_dr;
7324 + }
7325 +
7326 + dr->bRequestType = USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT;
7327 +@@ -314,6 +319,8 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port,
7328 +
7329 + return count;
7330 + error:
7331 ++ kfree(dr);
7332 ++error_no_dr:
7333 + usb_free_urb(urb);
7334 + error_no_urb:
7335 + kfree(buffer);
7336 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
7337 +index a0542ca..76a48e4 100644
7338 +--- a/drivers/usb/serial/option.c
7339 ++++ b/drivers/usb/serial/option.c
7340 +@@ -47,6 +47,7 @@
7341 + /* Function prototypes */
7342 + static int option_probe(struct usb_serial *serial,
7343 + const struct usb_device_id *id);
7344 ++static int option_attach(struct usb_serial *serial);
7345 + static void option_release(struct usb_serial *serial);
7346 + static int option_send_setup(struct usb_serial_port *port);
7347 + static void option_instat_callback(struct urb *urb);
7348 +@@ -1288,8 +1289,9 @@ static struct usb_serial_driver option_1port_device = {
7349 + .tiocmget = usb_wwan_tiocmget,
7350 + .tiocmset = usb_wwan_tiocmset,
7351 + .ioctl = usb_wwan_ioctl,
7352 +- .attach = usb_wwan_startup,
7353 ++ .attach = option_attach,
7354 + .release = option_release,
7355 ++ .port_probe = usb_wwan_port_probe,
7356 + .port_remove = usb_wwan_port_remove,
7357 + .read_int_callback = option_instat_callback,
7358 + #ifdef CONFIG_PM
7359 +@@ -1337,8 +1339,6 @@ static bool is_blacklisted(const u8 ifnum, enum option_blacklist_reason reason,
7360 + static int option_probe(struct usb_serial *serial,
7361 + const struct usb_device_id *id)
7362 + {
7363 +- struct usb_wwan_intf_private *data;
7364 +- struct option_private *priv;
7365 + struct usb_interface_descriptor *iface_desc =
7366 + &serial->interface->cur_altsetting->desc;
7367 + struct usb_device_descriptor *dev_desc = &serial->dev->descriptor;
7368 +@@ -1376,6 +1376,19 @@ static int option_probe(struct usb_serial *serial,
7369 + iface_desc->bInterfaceClass != USB_CLASS_CDC_DATA)
7370 + return -ENODEV;
7371 +
7372 ++ /* Store device id so we can use it during attach. */
7373 ++ usb_set_serial_data(serial, (void *)id);
7374 ++
7375 ++ return 0;
7376 ++}
7377 ++
7378 ++static int option_attach(struct usb_serial *serial)
7379 ++{
7380 ++ struct usb_interface_descriptor *iface_desc;
7381 ++ const struct usb_device_id *id;
7382 ++ struct usb_wwan_intf_private *data;
7383 ++ struct option_private *priv;
7384 ++
7385 + data = kzalloc(sizeof(struct usb_wwan_intf_private), GFP_KERNEL);
7386 + if (!data)
7387 + return -ENOMEM;
7388 +@@ -1386,6 +1399,10 @@ static int option_probe(struct usb_serial *serial,
7389 + return -ENOMEM;
7390 + }
7391 +
7392 ++ /* Retrieve device id stored at probe. */
7393 ++ id = usb_get_serial_data(serial);
7394 ++ iface_desc = &serial->interface->cur_altsetting->desc;
7395 ++
7396 + priv->bInterfaceNumber = iface_desc->bInterfaceNumber;
7397 + data->private = priv;
7398 +
7399 +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
7400 +index bfd5077..93232ca 100644
7401 +--- a/drivers/usb/serial/qcserial.c
7402 ++++ b/drivers/usb/serial/qcserial.c
7403 +@@ -140,7 +140,6 @@ MODULE_DEVICE_TABLE(usb, id_table);
7404 +
7405 + static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
7406 + {
7407 +- struct usb_wwan_intf_private *data;
7408 + struct usb_host_interface *intf = serial->interface->cur_altsetting;
7409 + struct device *dev = &serial->dev->dev;
7410 + int retval = -ENODEV;
7411 +@@ -156,13 +155,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
7412 + ifnum = intf->desc.bInterfaceNumber;
7413 + dev_dbg(dev, "This Interface = %d\n", ifnum);
7414 +
7415 +- data = kzalloc(sizeof(struct usb_wwan_intf_private),
7416 +- GFP_KERNEL);
7417 +- if (!data)
7418 +- return -ENOMEM;
7419 +-
7420 +- spin_lock_init(&data->susp_lock);
7421 +-
7422 + if (nintf == 1) {
7423 + /* QDL mode */
7424 + /* Gobi 2000 has a single altsetting, older ones have two */
7425 +@@ -255,20 +247,28 @@ done:
7426 + }
7427 + }
7428 +
7429 +- /* Set serial->private if not returning error */
7430 +- if (retval == 0)
7431 +- usb_set_serial_data(serial, data);
7432 +- else
7433 +- kfree(data);
7434 +-
7435 + return retval;
7436 + }
7437 +
7438 ++static int qc_attach(struct usb_serial *serial)
7439 ++{
7440 ++ struct usb_wwan_intf_private *data;
7441 ++
7442 ++ data = kzalloc(sizeof(*data), GFP_KERNEL);
7443 ++ if (!data)
7444 ++ return -ENOMEM;
7445 ++
7446 ++ spin_lock_init(&data->susp_lock);
7447 ++
7448 ++ usb_set_serial_data(serial, data);
7449 ++
7450 ++ return 0;
7451 ++}
7452 ++
7453 + static void qc_release(struct usb_serial *serial)
7454 + {
7455 + struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
7456 +
7457 +- /* Free the private data allocated in qcprobe */
7458 + usb_set_serial_data(serial, NULL);
7459 + kfree(priv);
7460 + }
7461 +@@ -287,8 +287,9 @@ static struct usb_serial_driver qcdevice = {
7462 + .write = usb_wwan_write,
7463 + .write_room = usb_wwan_write_room,
7464 + .chars_in_buffer = usb_wwan_chars_in_buffer,
7465 +- .attach = usb_wwan_startup,
7466 ++ .attach = qc_attach,
7467 + .release = qc_release,
7468 ++ .port_probe = usb_wwan_port_probe,
7469 + .port_remove = usb_wwan_port_remove,
7470 + #ifdef CONFIG_PM
7471 + .suspend = usb_wwan_suspend,
7472 +diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
7473 +index 151670b..ea69301 100644
7474 +--- a/drivers/usb/serial/quatech2.c
7475 ++++ b/drivers/usb/serial/quatech2.c
7476 +@@ -145,12 +145,12 @@ static void qt2_read_bulk_callback(struct urb *urb);
7477 +
7478 + static void qt2_release(struct usb_serial *serial)
7479 + {
7480 +- int i;
7481 ++ struct qt2_serial_private *serial_priv;
7482 +
7483 +- kfree(usb_get_serial_data(serial));
7484 ++ serial_priv = usb_get_serial_data(serial);
7485 +
7486 +- for (i = 0; i < serial->num_ports; i++)
7487 +- kfree(usb_get_serial_port_data(serial->port[i]));
7488 ++ usb_free_urb(serial_priv->read_urb);
7489 ++ kfree(serial_priv);
7490 + }
7491 +
7492 + static inline int calc_baud_divisor(int baudrate)
7493 +@@ -425,11 +425,16 @@ static void qt2_close(struct usb_serial_port *port)
7494 + port_priv->is_open = false;
7495 +
7496 + spin_lock_irqsave(&port_priv->urb_lock, flags);
7497 +- if (port_priv->write_urb->status == -EINPROGRESS)
7498 +- usb_kill_urb(port_priv->write_urb);
7499 ++ usb_kill_urb(port_priv->write_urb);
7500 + port_priv->urb_in_use = false;
7501 + spin_unlock_irqrestore(&port_priv->urb_lock, flags);
7502 +
7503 ++ mutex_lock(&port->serial->disc_mutex);
7504 ++ if (port->serial->disconnected) {
7505 ++ mutex_unlock(&port->serial->disc_mutex);
7506 ++ return;
7507 ++ }
7508 ++
7509 + /* flush the port transmit buffer */
7510 + i = usb_control_msg(serial->dev,
7511 + usb_rcvctrlpipe(serial->dev, 0),
7512 +@@ -461,26 +466,14 @@ static void qt2_close(struct usb_serial_port *port)
7513 + dev_err(&port->dev, "%s - close port failed %i\n",
7514 + __func__, i);
7515 +
7516 ++ mutex_unlock(&port->serial->disc_mutex);
7517 + }
7518 +
7519 + static void qt2_disconnect(struct usb_serial *serial)
7520 + {
7521 + struct qt2_serial_private *serial_priv = usb_get_serial_data(serial);
7522 +- struct qt2_port_private *port_priv;
7523 +- int i;
7524 +-
7525 +- if (serial_priv->read_urb->status == -EINPROGRESS)
7526 +- usb_kill_urb(serial_priv->read_urb);
7527 +-
7528 +- usb_free_urb(serial_priv->read_urb);
7529 +
7530 +- for (i = 0; i < serial->num_ports; i++) {
7531 +- port_priv = usb_get_serial_port_data(serial->port[i]);
7532 +-
7533 +- if (port_priv->write_urb->status == -EINPROGRESS)
7534 +- usb_kill_urb(port_priv->write_urb);
7535 +- usb_free_urb(port_priv->write_urb);
7536 +- }
7537 ++ usb_kill_urb(serial_priv->read_urb);
7538 + }
7539 +
7540 + static int get_serial_info(struct usb_serial_port *port,
7541 +@@ -775,11 +768,9 @@ static void qt2_read_bulk_callback(struct urb *urb)
7542 +
7543 + static int qt2_setup_urbs(struct usb_serial *serial)
7544 + {
7545 +- struct usb_serial_port *port;
7546 + struct usb_serial_port *port0;
7547 + struct qt2_serial_private *serial_priv;
7548 +- struct qt2_port_private *port_priv;
7549 +- int pcount, status;
7550 ++ int status;
7551 +
7552 + port0 = serial->port[0];
7553 +
7554 +@@ -797,46 +788,21 @@ static int qt2_setup_urbs(struct usb_serial *serial)
7555 + sizeof(serial_priv->read_buffer),
7556 + qt2_read_bulk_callback, serial);
7557 +
7558 +- /* setup write_urb for each port */
7559 +- for (pcount = 0; pcount < serial->num_ports; pcount++) {
7560 +-
7561 +- port = serial->port[pcount];
7562 +- port_priv = usb_get_serial_port_data(port);
7563 +-
7564 +- port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL);
7565 +- if (!port_priv->write_urb) {
7566 +- dev_err(&serial->dev->dev,
7567 +- "failed to alloc write_urb for port %i\n",
7568 +- pcount);
7569 +- return -ENOMEM;
7570 +- }
7571 +-
7572 +- usb_fill_bulk_urb(port_priv->write_urb,
7573 +- serial->dev,
7574 +- usb_sndbulkpipe(serial->dev,
7575 +- port0->
7576 +- bulk_out_endpointAddress),
7577 +- port_priv->write_buffer,
7578 +- sizeof(port_priv->write_buffer),
7579 +- qt2_write_bulk_callback, port);
7580 +- }
7581 +-
7582 + status = usb_submit_urb(serial_priv->read_urb, GFP_KERNEL);
7583 + if (status != 0) {
7584 + dev_err(&serial->dev->dev,
7585 + "%s - submit read urb failed %i\n", __func__, status);
7586 ++ usb_free_urb(serial_priv->read_urb);
7587 + return status;
7588 + }
7589 +
7590 + return 0;
7591 +-
7592 + }
7593 +
7594 + static int qt2_attach(struct usb_serial *serial)
7595 + {
7596 + struct qt2_serial_private *serial_priv;
7597 +- struct qt2_port_private *port_priv;
7598 +- int status, pcount;
7599 ++ int status;
7600 +
7601 + /* power on unit */
7602 + status = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
7603 +@@ -856,26 +822,6 @@ static int qt2_attach(struct usb_serial *serial)
7604 +
7605 + usb_set_serial_data(serial, serial_priv);
7606 +
7607 +- for (pcount = 0; pcount < serial->num_ports; pcount++) {
7608 +- port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
7609 +- if (!port_priv) {
7610 +- dev_err(&serial->dev->dev,
7611 +- "%s- kmalloc(%Zd) failed.\n", __func__,
7612 +- sizeof(*port_priv));
7613 +- pcount--;
7614 +- status = -ENOMEM;
7615 +- goto attach_failed;
7616 +- }
7617 +-
7618 +- spin_lock_init(&port_priv->lock);
7619 +- spin_lock_init(&port_priv->urb_lock);
7620 +- init_waitqueue_head(&port_priv->delta_msr_wait);
7621 +-
7622 +- port_priv->port = serial->port[pcount];
7623 +-
7624 +- usb_set_serial_port_data(serial->port[pcount], port_priv);
7625 +- }
7626 +-
7627 + status = qt2_setup_urbs(serial);
7628 + if (status != 0)
7629 + goto attach_failed;
7630 +@@ -883,14 +829,53 @@ static int qt2_attach(struct usb_serial *serial)
7631 + return 0;
7632 +
7633 + attach_failed:
7634 +- for (/* empty */; pcount >= 0; pcount--) {
7635 +- port_priv = usb_get_serial_port_data(serial->port[pcount]);
7636 +- kfree(port_priv);
7637 +- }
7638 + kfree(serial_priv);
7639 + return status;
7640 + }
7641 +
7642 ++static int qt2_port_probe(struct usb_serial_port *port)
7643 ++{
7644 ++ struct usb_serial *serial = port->serial;
7645 ++ struct qt2_port_private *port_priv;
7646 ++ u8 bEndpointAddress;
7647 ++
7648 ++ port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL);
7649 ++ if (!port_priv)
7650 ++ return -ENOMEM;
7651 ++
7652 ++ spin_lock_init(&port_priv->lock);
7653 ++ spin_lock_init(&port_priv->urb_lock);
7654 ++ init_waitqueue_head(&port_priv->delta_msr_wait);
7655 ++ port_priv->port = port;
7656 ++
7657 ++ port_priv->write_urb = usb_alloc_urb(0, GFP_KERNEL);
7658 ++ if (!port_priv->write_urb) {
7659 ++ kfree(port_priv);
7660 ++ return -ENOMEM;
7661 ++ }
7662 ++ bEndpointAddress = serial->port[0]->bulk_out_endpointAddress;
7663 ++ usb_fill_bulk_urb(port_priv->write_urb, serial->dev,
7664 ++ usb_sndbulkpipe(serial->dev, bEndpointAddress),
7665 ++ port_priv->write_buffer,
7666 ++ sizeof(port_priv->write_buffer),
7667 ++ qt2_write_bulk_callback, port);
7668 ++
7669 ++ usb_set_serial_port_data(port, port_priv);
7670 ++
7671 ++ return 0;
7672 ++}
7673 ++
7674 ++static int qt2_port_remove(struct usb_serial_port *port)
7675 ++{
7676 ++ struct qt2_port_private *port_priv;
7677 ++
7678 ++ port_priv = usb_get_serial_port_data(port);
7679 ++ usb_free_urb(port_priv->write_urb);
7680 ++ kfree(port_priv);
7681 ++
7682 ++ return 0;
7683 ++}
7684 ++
7685 + static int qt2_tiocmget(struct tty_struct *tty)
7686 + {
7687 + struct usb_serial_port *port = tty->driver_data;
7688 +@@ -1129,6 +1114,8 @@ static struct usb_serial_driver qt2_device = {
7689 + .attach = qt2_attach,
7690 + .release = qt2_release,
7691 + .disconnect = qt2_disconnect,
7692 ++ .port_probe = qt2_port_probe,
7693 ++ .port_remove = qt2_port_remove,
7694 + .dtr_rts = qt2_dtr_rts,
7695 + .break_ctl = qt2_break_ctl,
7696 + .tiocmget = qt2_tiocmget,
7697 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
7698 +index 0274710..cf6d149 100644
7699 +--- a/drivers/usb/serial/sierra.c
7700 ++++ b/drivers/usb/serial/sierra.c
7701 +@@ -162,7 +162,6 @@ static int sierra_probe(struct usb_serial *serial,
7702 + {
7703 + int result = 0;
7704 + struct usb_device *udev;
7705 +- struct sierra_intf_private *data;
7706 + u8 ifnum;
7707 +
7708 + udev = serial->dev;
7709 +@@ -189,11 +188,6 @@ static int sierra_probe(struct usb_serial *serial,
7710 + return -ENODEV;
7711 + }
7712 +
7713 +- data = serial->private = kzalloc(sizeof(struct sierra_intf_private), GFP_KERNEL);
7714 +- if (!data)
7715 +- return -ENOMEM;
7716 +- spin_lock_init(&data->susp_lock);
7717 +-
7718 + return result;
7719 + }
7720 +
7721 +@@ -886,11 +880,15 @@ static void sierra_dtr_rts(struct usb_serial_port *port, int on)
7722 +
7723 + static int sierra_startup(struct usb_serial *serial)
7724 + {
7725 +- struct usb_serial_port *port;
7726 +- struct sierra_port_private *portdata;
7727 +- struct sierra_iface_info *himemoryp = NULL;
7728 +- int i;
7729 +- u8 ifnum;
7730 ++ struct sierra_intf_private *intfdata;
7731 ++
7732 ++ intfdata = kzalloc(sizeof(*intfdata), GFP_KERNEL);
7733 ++ if (!intfdata)
7734 ++ return -ENOMEM;
7735 ++
7736 ++ spin_lock_init(&intfdata->susp_lock);
7737 ++
7738 ++ usb_set_serial_data(serial, intfdata);
7739 +
7740 + /* Set Device mode to D0 */
7741 + sierra_set_power_state(serial->dev, 0x0000);
7742 +@@ -899,68 +897,71 @@ static int sierra_startup(struct usb_serial *serial)
7743 + if (nmea)
7744 + sierra_vsc_set_nmea(serial->dev, 1);
7745 +
7746 +- /* Now setup per port private data */
7747 +- for (i = 0; i < serial->num_ports; i++) {
7748 +- port = serial->port[i];
7749 +- portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
7750 +- if (!portdata) {
7751 +- dev_dbg(&port->dev, "%s: kmalloc for "
7752 +- "sierra_port_private (%d) failed!\n",
7753 +- __func__, i);
7754 +- return -ENOMEM;
7755 +- }
7756 +- spin_lock_init(&portdata->lock);
7757 +- init_usb_anchor(&portdata->active);
7758 +- init_usb_anchor(&portdata->delayed);
7759 +- ifnum = i;
7760 +- /* Assume low memory requirements */
7761 +- portdata->num_out_urbs = N_OUT_URB;
7762 +- portdata->num_in_urbs = N_IN_URB;
7763 +-
7764 +- /* Determine actual memory requirements */
7765 +- if (serial->num_ports == 1) {
7766 +- /* Get interface number for composite device */
7767 +- ifnum = sierra_calc_interface(serial);
7768 +- himemoryp =
7769 +- (struct sierra_iface_info *)&typeB_interface_list;
7770 +- if (is_himemory(ifnum, himemoryp)) {
7771 +- portdata->num_out_urbs = N_OUT_URB_HM;
7772 +- portdata->num_in_urbs = N_IN_URB_HM;
7773 +- }
7774 +- }
7775 +- else {
7776 +- himemoryp =
7777 +- (struct sierra_iface_info *)&typeA_interface_list;
7778 +- if (is_himemory(i, himemoryp)) {
7779 +- portdata->num_out_urbs = N_OUT_URB_HM;
7780 +- portdata->num_in_urbs = N_IN_URB_HM;
7781 +- }
7782 +- }
7783 +- dev_dbg(&serial->dev->dev,
7784 +- "Memory usage (urbs) interface #%d, in=%d, out=%d\n",
7785 +- ifnum,portdata->num_in_urbs, portdata->num_out_urbs );
7786 +- /* Set the port private data pointer */
7787 +- usb_set_serial_port_data(port, portdata);
7788 +- }
7789 +-
7790 + return 0;
7791 + }
7792 +
7793 + static void sierra_release(struct usb_serial *serial)
7794 + {
7795 +- int i;
7796 +- struct usb_serial_port *port;
7797 ++ struct sierra_intf_private *intfdata;
7798 ++
7799 ++ intfdata = usb_get_serial_data(serial);
7800 ++ kfree(intfdata);
7801 ++}
7802 ++
7803 ++static int sierra_port_probe(struct usb_serial_port *port)
7804 ++{
7805 ++ struct usb_serial *serial = port->serial;
7806 + struct sierra_port_private *portdata;
7807 ++ const struct sierra_iface_info *himemoryp;
7808 ++ u8 ifnum;
7809 +
7810 +- for (i = 0; i < serial->num_ports; ++i) {
7811 +- port = serial->port[i];
7812 +- if (!port)
7813 +- continue;
7814 +- portdata = usb_get_serial_port_data(port);
7815 +- if (!portdata)
7816 +- continue;
7817 +- kfree(portdata);
7818 ++ portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
7819 ++ if (!portdata)
7820 ++ return -ENOMEM;
7821 ++
7822 ++ spin_lock_init(&portdata->lock);
7823 ++ init_usb_anchor(&portdata->active);
7824 ++ init_usb_anchor(&portdata->delayed);
7825 ++
7826 ++ /* Assume low memory requirements */
7827 ++ portdata->num_out_urbs = N_OUT_URB;
7828 ++ portdata->num_in_urbs = N_IN_URB;
7829 ++
7830 ++ /* Determine actual memory requirements */
7831 ++ if (serial->num_ports == 1) {
7832 ++ /* Get interface number for composite device */
7833 ++ ifnum = sierra_calc_interface(serial);
7834 ++ himemoryp = &typeB_interface_list;
7835 ++ } else {
7836 ++ /* This is really the usb-serial port number of the interface
7837 ++ * rather than the interface number.
7838 ++ */
7839 ++ ifnum = port->number - serial->minor;
7840 ++ himemoryp = &typeA_interface_list;
7841 + }
7842 ++
7843 ++ if (is_himemory(ifnum, himemoryp)) {
7844 ++ portdata->num_out_urbs = N_OUT_URB_HM;
7845 ++ portdata->num_in_urbs = N_IN_URB_HM;
7846 ++ }
7847 ++
7848 ++ dev_dbg(&port->dev,
7849 ++ "Memory usage (urbs) interface #%d, in=%d, out=%d\n",
7850 ++ ifnum, portdata->num_in_urbs, portdata->num_out_urbs);
7851 ++
7852 ++ usb_set_serial_port_data(port, portdata);
7853 ++
7854 ++ return 0;
7855 ++}
7856 ++
7857 ++static int sierra_port_remove(struct usb_serial_port *port)
7858 ++{
7859 ++ struct sierra_port_private *portdata;
7860 ++
7861 ++ portdata = usb_get_serial_port_data(port);
7862 ++ kfree(portdata);
7863 ++
7864 ++ return 0;
7865 + }
7866 +
7867 + #ifdef CONFIG_PM
7868 +@@ -1064,6 +1065,8 @@ static struct usb_serial_driver sierra_device = {
7869 + .tiocmset = sierra_tiocmset,
7870 + .attach = sierra_startup,
7871 + .release = sierra_release,
7872 ++ .port_probe = sierra_port_probe,
7873 ++ .port_remove = sierra_port_remove,
7874 + .suspend = sierra_suspend,
7875 + .resume = sierra_resume,
7876 + .read_int_callback = sierra_instat_callback,
7877 +diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
7878 +index 1f034d2..684739b 100644
7879 +--- a/drivers/usb/serial/usb-wwan.h
7880 ++++ b/drivers/usb/serial/usb-wwan.h
7881 +@@ -8,7 +8,7 @@
7882 + extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
7883 + extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
7884 + extern void usb_wwan_close(struct usb_serial_port *port);
7885 +-extern int usb_wwan_startup(struct usb_serial *serial);
7886 ++extern int usb_wwan_port_probe(struct usb_serial_port *port);
7887 + extern int usb_wwan_port_remove(struct usb_serial_port *port);
7888 + extern int usb_wwan_write_room(struct tty_struct *tty);
7889 + extern void usb_wwan_set_termios(struct tty_struct *tty,
7890 +diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
7891 +index 6855d5e..2f2d074 100644
7892 +--- a/drivers/usb/serial/usb_wwan.c
7893 ++++ b/drivers/usb/serial/usb_wwan.c
7894 +@@ -447,10 +447,12 @@ void usb_wwan_close(struct usb_serial_port *port)
7895 + EXPORT_SYMBOL(usb_wwan_close);
7896 +
7897 + /* Helper functions used by usb_wwan_setup_urbs */
7898 +-static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint,
7899 ++static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port,
7900 ++ int endpoint,
7901 + int dir, void *ctx, char *buf, int len,
7902 + void (*callback) (struct urb *))
7903 + {
7904 ++ struct usb_serial *serial = port->serial;
7905 + struct urb *urb;
7906 +
7907 + if (endpoint == -1)
7908 +@@ -470,100 +472,74 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint,
7909 + return urb;
7910 + }
7911 +
7912 +-/* Setup urbs */
7913 +-static void usb_wwan_setup_urbs(struct usb_serial *serial)
7914 ++int usb_wwan_port_probe(struct usb_serial_port *port)
7915 + {
7916 +- int i, j;
7917 +- struct usb_serial_port *port;
7918 + struct usb_wwan_port_private *portdata;
7919 ++ struct urb *urb;
7920 ++ u8 *buffer;
7921 ++ int err;
7922 ++ int i;
7923 +
7924 +- for (i = 0; i < serial->num_ports; i++) {
7925 +- port = serial->port[i];
7926 +- portdata = usb_get_serial_port_data(port);
7927 +-
7928 +- /* Do indat endpoints first */
7929 +- for (j = 0; j < N_IN_URB; ++j) {
7930 +- portdata->in_urbs[j] = usb_wwan_setup_urb(serial,
7931 +- port->
7932 +- bulk_in_endpointAddress,
7933 +- USB_DIR_IN,
7934 +- port,
7935 +- portdata->
7936 +- in_buffer[j],
7937 +- IN_BUFLEN,
7938 +- usb_wwan_indat_callback);
7939 +- }
7940 +-
7941 +- /* outdat endpoints */
7942 +- for (j = 0; j < N_OUT_URB; ++j) {
7943 +- portdata->out_urbs[j] = usb_wwan_setup_urb(serial,
7944 +- port->
7945 +- bulk_out_endpointAddress,
7946 +- USB_DIR_OUT,
7947 +- port,
7948 +- portdata->
7949 +- out_buffer
7950 +- [j],
7951 +- OUT_BUFLEN,
7952 +- usb_wwan_outdat_callback);
7953 +- }
7954 +- }
7955 +-}
7956 ++ portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
7957 ++ if (!portdata)
7958 ++ return -ENOMEM;
7959 +
7960 +-int usb_wwan_startup(struct usb_serial *serial)
7961 +-{
7962 +- int i, j, err;
7963 +- struct usb_serial_port *port;
7964 +- struct usb_wwan_port_private *portdata;
7965 +- u8 *buffer;
7966 ++ init_usb_anchor(&portdata->delayed);
7967 +
7968 +- /* Now setup per port private data */
7969 +- for (i = 0; i < serial->num_ports; i++) {
7970 +- port = serial->port[i];
7971 +- portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
7972 +- if (!portdata) {
7973 +- dbg("%s: kmalloc for usb_wwan_port_private (%d) failed!.",
7974 +- __func__, i);
7975 +- return 1;
7976 +- }
7977 +- init_usb_anchor(&portdata->delayed);
7978 ++ for (i = 0; i < N_IN_URB; i++) {
7979 ++ buffer = (u8 *)__get_free_page(GFP_KERNEL);
7980 ++ if (!buffer)
7981 ++ goto bail_out_error;
7982 ++ portdata->in_buffer[i] = buffer;
7983 ++
7984 ++ urb = usb_wwan_setup_urb(port, port->bulk_in_endpointAddress,
7985 ++ USB_DIR_IN, port,
7986 ++ buffer, IN_BUFLEN,
7987 ++ usb_wwan_indat_callback);
7988 ++ portdata->in_urbs[i] = urb;
7989 ++ }
7990 ++ for (i = 0; i < N_OUT_URB; i++) {
7991 ++ if (port->bulk_out_endpointAddress == -1)
7992 ++ continue;
7993 +
7994 +- for (j = 0; j < N_IN_URB; j++) {
7995 +- buffer = (u8 *) __get_free_page(GFP_KERNEL);
7996 +- if (!buffer)
7997 +- goto bail_out_error;
7998 +- portdata->in_buffer[j] = buffer;
7999 +- }
8000 ++ buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
8001 ++ if (!buffer)
8002 ++ goto bail_out_error2;
8003 ++ portdata->out_buffer[i] = buffer;
8004 +
8005 +- for (j = 0; j < N_OUT_URB; j++) {
8006 +- buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
8007 +- if (!buffer)
8008 +- goto bail_out_error2;
8009 +- portdata->out_buffer[j] = buffer;
8010 +- }
8011 ++ urb = usb_wwan_setup_urb(port, port->bulk_out_endpointAddress,
8012 ++ USB_DIR_OUT, port,
8013 ++ buffer, OUT_BUFLEN,
8014 ++ usb_wwan_outdat_callback);
8015 ++ portdata->out_urbs[i] = urb;
8016 ++ }
8017 +
8018 +- usb_set_serial_port_data(port, portdata);
8019 ++ usb_set_serial_port_data(port, portdata);
8020 +
8021 +- if (!port->interrupt_in_urb)
8022 +- continue;
8023 ++ if (port->interrupt_in_urb) {
8024 + err = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
8025 + if (err)
8026 +- dbg("%s: submit irq_in urb failed %d", __func__, err);
8027 ++ dev_dbg(&port->dev, "%s: submit irq_in urb failed %d\n",
8028 ++ __func__, err);
8029 + }
8030 +- usb_wwan_setup_urbs(serial);
8031 ++
8032 + return 0;
8033 +
8034 + bail_out_error2:
8035 +- for (j = 0; j < N_OUT_URB; j++)
8036 +- kfree(portdata->out_buffer[j]);
8037 ++ for (i = 0; i < N_OUT_URB; i++) {
8038 ++ usb_free_urb(portdata->out_urbs[i]);
8039 ++ kfree(portdata->out_buffer[i]);
8040 ++ }
8041 + bail_out_error:
8042 +- for (j = 0; j < N_IN_URB; j++)
8043 +- if (portdata->in_buffer[j])
8044 +- free_page((unsigned long)portdata->in_buffer[j]);
8045 ++ for (i = 0; i < N_IN_URB; i++) {
8046 ++ usb_free_urb(portdata->in_urbs[i]);
8047 ++ free_page((unsigned long)portdata->in_buffer[i]);
8048 ++ }
8049 + kfree(portdata);
8050 +- return 1;
8051 ++
8052 ++ return -ENOMEM;
8053 + }
8054 +-EXPORT_SYMBOL(usb_wwan_startup);
8055 ++EXPORT_SYMBOL_GPL(usb_wwan_port_probe);
8056 +
8057 + int usb_wwan_port_remove(struct usb_serial_port *port)
8058 + {
8059 +diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
8060 +index 473635e..bd36321 100644
8061 +--- a/drivers/usb/serial/whiteheat.c
8062 ++++ b/drivers/usb/serial/whiteheat.c
8063 +@@ -86,6 +86,8 @@ static int whiteheat_firmware_attach(struct usb_serial *serial);
8064 + /* function prototypes for the Connect Tech WhiteHEAT serial converter */
8065 + static int whiteheat_attach(struct usb_serial *serial);
8066 + static void whiteheat_release(struct usb_serial *serial);
8067 ++static int whiteheat_port_probe(struct usb_serial_port *port);
8068 ++static int whiteheat_port_remove(struct usb_serial_port *port);
8069 + static int whiteheat_open(struct tty_struct *tty,
8070 + struct usb_serial_port *port);
8071 + static void whiteheat_close(struct usb_serial_port *port);
8072 +@@ -120,6 +122,8 @@ static struct usb_serial_driver whiteheat_device = {
8073 + .num_ports = 4,
8074 + .attach = whiteheat_attach,
8075 + .release = whiteheat_release,
8076 ++ .port_probe = whiteheat_port_probe,
8077 ++ .port_remove = whiteheat_port_remove,
8078 + .open = whiteheat_open,
8079 + .close = whiteheat_close,
8080 + .ioctl = whiteheat_ioctl,
8081 +@@ -290,15 +294,12 @@ static int whiteheat_attach(struct usb_serial *serial)
8082 + {
8083 + struct usb_serial_port *command_port;
8084 + struct whiteheat_command_private *command_info;
8085 +- struct usb_serial_port *port;
8086 +- struct whiteheat_private *info;
8087 + struct whiteheat_hw_info *hw_info;
8088 + int pipe;
8089 + int ret;
8090 + int alen;
8091 + __u8 *command;
8092 + __u8 *result;
8093 +- int i;
8094 +
8095 + command_port = serial->port[COMMAND_PORT];
8096 +
8097 +@@ -357,22 +358,6 @@ static int whiteheat_attach(struct usb_serial *serial)
8098 + serial->type->description,
8099 + hw_info->sw_major_rev, hw_info->sw_minor_rev);
8100 +
8101 +- for (i = 0; i < serial->num_ports; i++) {
8102 +- port = serial->port[i];
8103 +-
8104 +- info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL);
8105 +- if (info == NULL) {
8106 +- dev_err(&port->dev,
8107 +- "%s: Out of memory for port structures\n",
8108 +- serial->type->description);
8109 +- goto no_private;
8110 +- }
8111 +-
8112 +- info->mcr = 0;
8113 +-
8114 +- usb_set_serial_port_data(port, info);
8115 +- }
8116 +-
8117 + command_info = kmalloc(sizeof(struct whiteheat_command_private),
8118 + GFP_KERNEL);
8119 + if (command_info == NULL) {
8120 +@@ -405,16 +390,10 @@ no_firmware:
8121 + "%s: please contact support@×××××××××××.com\n",
8122 + serial->type->description);
8123 + kfree(result);
8124 ++ kfree(command);
8125 + return -ENODEV;
8126 +
8127 + no_command_private:
8128 +- for (i = serial->num_ports - 1; i >= 0; i--) {
8129 +- port = serial->port[i];
8130 +- info = usb_get_serial_port_data(port);
8131 +- kfree(info);
8132 +-no_private:
8133 +- ;
8134 +- }
8135 + kfree(result);
8136 + no_result_buffer:
8137 + kfree(command);
8138 +@@ -422,21 +401,36 @@ no_command_buffer:
8139 + return -ENOMEM;
8140 + }
8141 +
8142 +-
8143 + static void whiteheat_release(struct usb_serial *serial)
8144 + {
8145 + struct usb_serial_port *command_port;
8146 +- struct whiteheat_private *info;
8147 +- int i;
8148 +
8149 + /* free up our private data for our command port */
8150 + command_port = serial->port[COMMAND_PORT];
8151 + kfree(usb_get_serial_port_data(command_port));
8152 ++}
8153 +
8154 +- for (i = 0; i < serial->num_ports; i++) {
8155 +- info = usb_get_serial_port_data(serial->port[i]);
8156 +- kfree(info);
8157 +- }
8158 ++static int whiteheat_port_probe(struct usb_serial_port *port)
8159 ++{
8160 ++ struct whiteheat_private *info;
8161 ++
8162 ++ info = kzalloc(sizeof(*info), GFP_KERNEL);
8163 ++ if (!info)
8164 ++ return -ENOMEM;
8165 ++
8166 ++ usb_set_serial_port_data(port, info);
8167 ++
8168 ++ return 0;
8169 ++}
8170 ++
8171 ++static int whiteheat_port_remove(struct usb_serial_port *port)
8172 ++{
8173 ++ struct whiteheat_private *info;
8174 ++
8175 ++ info = usb_get_serial_port_data(port);
8176 ++ kfree(info);
8177 ++
8178 ++ return 0;
8179 + }
8180 +
8181 + static int whiteheat_open(struct tty_struct *tty, struct usb_serial_port *port)
8182 +diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
8183 +index 62a31be..8f98c9a 100644
8184 +--- a/drivers/usb/storage/unusual_devs.h
8185 ++++ b/drivers/usb/storage/unusual_devs.h
8186 +@@ -1004,6 +1004,12 @@ UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9999,
8187 + USB_SC_8070, USB_PR_CB, NULL,
8188 + US_FL_NEED_OVERRIDE | US_FL_FIX_INQUIRY ),
8189 +
8190 ++/* Submitted by Oleksandr Chumachenko <ledest@×××××.com> */
8191 ++UNUSUAL_DEV( 0x07cf, 0x1167, 0x0100, 0x0100,
8192 ++ "Casio",
8193 ++ "EX-N1 DigitalCamera",
8194 ++ USB_SC_8070, USB_PR_DEVICE, NULL, 0),
8195 ++
8196 + /* Submitted by Hartmut Wahl <hwahl@×××××.de>*/
8197 + UNUSUAL_DEV( 0x0839, 0x000a, 0x0001, 0x0001,
8198 + "Samsung",
8199 +diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
8200 +index 072cbba..7f93f34 100644
8201 +--- a/drivers/vhost/net.c
8202 ++++ b/drivers/vhost/net.c
8203 +@@ -379,7 +379,8 @@ static void handle_rx(struct vhost_net *net)
8204 + .hdr.gso_type = VIRTIO_NET_HDR_GSO_NONE
8205 + };
8206 + size_t total_len = 0;
8207 +- int err, headcount, mergeable;
8208 ++ int err, mergeable;
8209 ++ s16 headcount;
8210 + size_t vhost_hlen, sock_hlen;
8211 + size_t vhost_len, sock_len;
8212 + /* TODO: check that we are running from vhost_worker? */
8213 +diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
8214 +index debdfe0..5d2069f 100644
8215 +--- a/fs/compat_ioctl.c
8216 ++++ b/fs/compat_ioctl.c
8217 +@@ -210,6 +210,8 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd,
8218 +
8219 + err = get_user(palp, &up->palette);
8220 + err |= get_user(length, &up->length);
8221 ++ if (err)
8222 ++ return -EFAULT;
8223 +
8224 + up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
8225 + err = put_user(compat_ptr(palp), &up_native->palette);
8226 +diff --git a/fs/exec.c b/fs/exec.c
8227 +index 574cf4d..fab2c6d 100644
8228 +--- a/fs/exec.c
8229 ++++ b/fs/exec.c
8230 +@@ -1110,7 +1110,8 @@ int flush_old_exec(struct linux_binprm * bprm)
8231 + bprm->mm = NULL; /* We're using it now */
8232 +
8233 + set_fs(USER_DS);
8234 +- current->flags &= ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD);
8235 ++ current->flags &=
8236 ++ ~(PF_RANDOMIZE | PF_FORKNOEXEC | PF_KTHREAD | PF_NOFREEZE);
8237 + flush_thread();
8238 + current->personality &= ~bprm->per_clear;
8239 +
8240 +diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
8241 +index e4fb3ba..3d7e09b 100644
8242 +--- a/fs/lockd/mon.c
8243 ++++ b/fs/lockd/mon.c
8244 +@@ -85,29 +85,38 @@ static struct rpc_clnt *nsm_create(struct net *net)
8245 + return rpc_create(&args);
8246 + }
8247 +
8248 ++static struct rpc_clnt *nsm_client_set(struct lockd_net *ln,
8249 ++ struct rpc_clnt *clnt)
8250 ++{
8251 ++ spin_lock(&ln->nsm_clnt_lock);
8252 ++ if (ln->nsm_users == 0) {
8253 ++ if (clnt == NULL)
8254 ++ goto out;
8255 ++ ln->nsm_clnt = clnt;
8256 ++ }
8257 ++ clnt = ln->nsm_clnt;
8258 ++ ln->nsm_users++;
8259 ++out:
8260 ++ spin_unlock(&ln->nsm_clnt_lock);
8261 ++ return clnt;
8262 ++}
8263 ++
8264 + static struct rpc_clnt *nsm_client_get(struct net *net)
8265 + {
8266 +- static DEFINE_MUTEX(nsm_create_mutex);
8267 +- struct rpc_clnt *clnt;
8268 ++ struct rpc_clnt *clnt, *new;
8269 + struct lockd_net *ln = net_generic(net, lockd_net_id);
8270 +
8271 +- spin_lock(&ln->nsm_clnt_lock);
8272 +- if (ln->nsm_users) {
8273 +- ln->nsm_users++;
8274 +- clnt = ln->nsm_clnt;
8275 +- spin_unlock(&ln->nsm_clnt_lock);
8276 ++ clnt = nsm_client_set(ln, NULL);
8277 ++ if (clnt != NULL)
8278 + goto out;
8279 +- }
8280 +- spin_unlock(&ln->nsm_clnt_lock);
8281 +
8282 +- mutex_lock(&nsm_create_mutex);
8283 +- clnt = nsm_create(net);
8284 +- if (!IS_ERR(clnt)) {
8285 +- ln->nsm_clnt = clnt;
8286 +- smp_wmb();
8287 +- ln->nsm_users = 1;
8288 +- }
8289 +- mutex_unlock(&nsm_create_mutex);
8290 ++ clnt = new = nsm_create(net);
8291 ++ if (IS_ERR(clnt))
8292 ++ goto out;
8293 ++
8294 ++ clnt = nsm_client_set(ln, new);
8295 ++ if (clnt != new)
8296 ++ rpc_shutdown_client(new);
8297 + out:
8298 + return clnt;
8299 + }
8300 +@@ -115,18 +124,16 @@ out:
8301 + static void nsm_client_put(struct net *net)
8302 + {
8303 + struct lockd_net *ln = net_generic(net, lockd_net_id);
8304 +- struct rpc_clnt *clnt = ln->nsm_clnt;
8305 +- int shutdown = 0;
8306 ++ struct rpc_clnt *clnt = NULL;
8307 +
8308 + spin_lock(&ln->nsm_clnt_lock);
8309 +- if (ln->nsm_users) {
8310 +- if (--ln->nsm_users)
8311 +- ln->nsm_clnt = NULL;
8312 +- shutdown = !ln->nsm_users;
8313 ++ ln->nsm_users--;
8314 ++ if (ln->nsm_users == 0) {
8315 ++ clnt = ln->nsm_clnt;
8316 ++ ln->nsm_clnt = NULL;
8317 + }
8318 + spin_unlock(&ln->nsm_clnt_lock);
8319 +-
8320 +- if (shutdown)
8321 ++ if (clnt != NULL)
8322 + rpc_shutdown_client(clnt);
8323 + }
8324 +
8325 +diff --git a/fs/namei.c b/fs/namei.c
8326 +index 81bd546..091c4b7 100644
8327 +--- a/fs/namei.c
8328 ++++ b/fs/namei.c
8329 +@@ -651,8 +651,8 @@ static inline void put_link(struct nameidata *nd, struct path *link, void *cooki
8330 + path_put(link);
8331 + }
8332 +
8333 +-int sysctl_protected_symlinks __read_mostly = 1;
8334 +-int sysctl_protected_hardlinks __read_mostly = 1;
8335 ++int sysctl_protected_symlinks __read_mostly = 0;
8336 ++int sysctl_protected_hardlinks __read_mostly = 0;
8337 +
8338 + /**
8339 + * may_follow_link - Check symlink following for unsafe situations
8340 +diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
8341 +index f3d16ad..1093968 100644
8342 +--- a/fs/nfs/blocklayout/blocklayout.c
8343 ++++ b/fs/nfs/blocklayout/blocklayout.c
8344 +@@ -242,14 +242,6 @@ bl_end_par_io_read(void *data, int unused)
8345 + schedule_work(&rdata->task.u.tk_work);
8346 + }
8347 +
8348 +-static bool
8349 +-bl_check_alignment(u64 offset, u32 len, unsigned long blkmask)
8350 +-{
8351 +- if ((offset & blkmask) || (len & blkmask))
8352 +- return false;
8353 +- return true;
8354 +-}
8355 +-
8356 + static enum pnfs_try_status
8357 + bl_read_pagelist(struct nfs_read_data *rdata)
8358 + {
8359 +@@ -260,15 +252,15 @@ bl_read_pagelist(struct nfs_read_data *rdata)
8360 + sector_t isect, extent_length = 0;
8361 + struct parallel_io *par;
8362 + loff_t f_offset = rdata->args.offset;
8363 ++ size_t bytes_left = rdata->args.count;
8364 ++ unsigned int pg_offset, pg_len;
8365 + struct page **pages = rdata->args.pages;
8366 + int pg_index = rdata->args.pgbase >> PAGE_CACHE_SHIFT;
8367 ++ const bool is_dio = (header->dreq != NULL);
8368 +
8369 + dprintk("%s enter nr_pages %u offset %lld count %u\n", __func__,
8370 + rdata->pages.npages, f_offset, (unsigned int)rdata->args.count);
8371 +
8372 +- if (!bl_check_alignment(f_offset, rdata->args.count, PAGE_CACHE_MASK))
8373 +- goto use_mds;
8374 +-
8375 + par = alloc_parallel(rdata);
8376 + if (!par)
8377 + goto use_mds;
8378 +@@ -298,36 +290,53 @@ bl_read_pagelist(struct nfs_read_data *rdata)
8379 + extent_length = min(extent_length, cow_length);
8380 + }
8381 + }
8382 ++
8383 ++ if (is_dio) {
8384 ++ pg_offset = f_offset & ~PAGE_CACHE_MASK;
8385 ++ if (pg_offset + bytes_left > PAGE_CACHE_SIZE)
8386 ++ pg_len = PAGE_CACHE_SIZE - pg_offset;
8387 ++ else
8388 ++ pg_len = bytes_left;
8389 ++
8390 ++ f_offset += pg_len;
8391 ++ bytes_left -= pg_len;
8392 ++ isect += (pg_offset >> SECTOR_SHIFT);
8393 ++ } else {
8394 ++ pg_offset = 0;
8395 ++ pg_len = PAGE_CACHE_SIZE;
8396 ++ }
8397 ++
8398 + hole = is_hole(be, isect);
8399 + if (hole && !cow_read) {
8400 + bio = bl_submit_bio(READ, bio);
8401 + /* Fill hole w/ zeroes w/o accessing device */
8402 + dprintk("%s Zeroing page for hole\n", __func__);
8403 +- zero_user_segment(pages[i], 0, PAGE_CACHE_SIZE);
8404 ++ zero_user_segment(pages[i], pg_offset, pg_len);
8405 + print_page(pages[i]);
8406 + SetPageUptodate(pages[i]);
8407 + } else {
8408 + struct pnfs_block_extent *be_read;
8409 +
8410 + be_read = (hole && cow_read) ? cow_read : be;
8411 +- bio = bl_add_page_to_bio(bio, rdata->pages.npages - i,
8412 ++ bio = do_add_page_to_bio(bio, rdata->pages.npages - i,
8413 + READ,
8414 + isect, pages[i], be_read,
8415 +- bl_end_io_read, par);
8416 ++ bl_end_io_read, par,
8417 ++ pg_offset, pg_len);
8418 + if (IS_ERR(bio)) {
8419 + header->pnfs_error = PTR_ERR(bio);
8420 + bio = NULL;
8421 + goto out;
8422 + }
8423 + }
8424 +- isect += PAGE_CACHE_SECTORS;
8425 ++ isect += (pg_len >> SECTOR_SHIFT);
8426 + extent_length -= PAGE_CACHE_SECTORS;
8427 + }
8428 + if ((isect << SECTOR_SHIFT) >= header->inode->i_size) {
8429 + rdata->res.eof = 1;
8430 +- rdata->res.count = header->inode->i_size - f_offset;
8431 ++ rdata->res.count = header->inode->i_size - rdata->args.offset;
8432 + } else {
8433 +- rdata->res.count = (isect << SECTOR_SHIFT) - f_offset;
8434 ++ rdata->res.count = (isect << SECTOR_SHIFT) - rdata->args.offset;
8435 + }
8436 + out:
8437 + bl_put_extent(be);
8438 +@@ -688,10 +697,13 @@ bl_write_pagelist(struct nfs_write_data *wdata, int sync)
8439 + NFS_SERVER(header->inode)->pnfs_blksize >> PAGE_CACHE_SHIFT;
8440 +
8441 + dprintk("%s enter, %Zu@%lld\n", __func__, count, offset);
8442 +- /* Check for alignment first */
8443 +- if (!bl_check_alignment(offset, count, PAGE_CACHE_MASK))
8444 +- goto out_mds;
8445 +
8446 ++ if (header->dreq != NULL &&
8447 ++ (!IS_ALIGNED(offset, NFS_SERVER(header->inode)->pnfs_blksize) ||
8448 ++ !IS_ALIGNED(count, NFS_SERVER(header->inode)->pnfs_blksize))) {
8449 ++ dprintk("pnfsblock nonblock aligned DIO writes. Resend MDS\n");
8450 ++ goto out_mds;
8451 ++ }
8452 + /* At this point, wdata->pages is a (sequential) list of nfs_pages.
8453 + * We want to write each, and if there is an error set pnfs_error
8454 + * to have it redone using nfs.
8455 +@@ -1164,33 +1176,64 @@ bl_clear_layoutdriver(struct nfs_server *server)
8456 + return 0;
8457 + }
8458 +
8459 ++static bool
8460 ++is_aligned_req(struct nfs_page *req, unsigned int alignment)
8461 ++{
8462 ++ return IS_ALIGNED(req->wb_offset, alignment) &&
8463 ++ IS_ALIGNED(req->wb_bytes, alignment);
8464 ++}
8465 ++
8466 + static void
8467 + bl_pg_init_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
8468 + {
8469 +- if (!bl_check_alignment(req->wb_offset, req->wb_bytes, PAGE_CACHE_MASK))
8470 ++ if (pgio->pg_dreq != NULL &&
8471 ++ !is_aligned_req(req, SECTOR_SIZE))
8472 + nfs_pageio_reset_read_mds(pgio);
8473 + else
8474 + pnfs_generic_pg_init_read(pgio, req);
8475 + }
8476 +
8477 +-static void
8478 ++static bool
8479 ++bl_pg_test_read(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
8480 ++ struct nfs_page *req)
8481 ++{
8482 ++ if (pgio->pg_dreq != NULL &&
8483 ++ !is_aligned_req(req, SECTOR_SIZE))
8484 ++ return false;
8485 ++
8486 ++ return pnfs_generic_pg_test(pgio, prev, req);
8487 ++}
8488 ++
8489 ++void
8490 + bl_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req)
8491 + {
8492 +- if (!bl_check_alignment(req->wb_offset, req->wb_bytes, PAGE_CACHE_MASK))
8493 ++ if (pgio->pg_dreq != NULL &&
8494 ++ !is_aligned_req(req, PAGE_CACHE_SIZE))
8495 + nfs_pageio_reset_write_mds(pgio);
8496 + else
8497 + pnfs_generic_pg_init_write(pgio, req);
8498 + }
8499 +
8500 ++static bool
8501 ++bl_pg_test_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *prev,
8502 ++ struct nfs_page *req)
8503 ++{
8504 ++ if (pgio->pg_dreq != NULL &&
8505 ++ !is_aligned_req(req, PAGE_CACHE_SIZE))
8506 ++ return false;
8507 ++
8508 ++ return pnfs_generic_pg_test(pgio, prev, req);
8509 ++}
8510 ++
8511 + static const struct nfs_pageio_ops bl_pg_read_ops = {
8512 + .pg_init = bl_pg_init_read,
8513 +- .pg_test = pnfs_generic_pg_test,
8514 ++ .pg_test = bl_pg_test_read,
8515 + .pg_doio = pnfs_generic_pg_readpages,
8516 + };
8517 +
8518 + static const struct nfs_pageio_ops bl_pg_write_ops = {
8519 + .pg_init = bl_pg_init_write,
8520 +- .pg_test = pnfs_generic_pg_test,
8521 ++ .pg_test = bl_pg_test_write,
8522 + .pg_doio = pnfs_generic_pg_writepages,
8523 + };
8524 +
8525 +diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
8526 +index 6b0bb00..2fbdff6 100644
8527 +--- a/fs/sysfs/dir.c
8528 ++++ b/fs/sysfs/dir.c
8529 +@@ -485,20 +485,18 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
8530 + /**
8531 + * sysfs_pathname - return full path to sysfs dirent
8532 + * @sd: sysfs_dirent whose path we want
8533 +- * @path: caller allocated buffer
8534 ++ * @path: caller allocated buffer of size PATH_MAX
8535 + *
8536 + * Gives the name "/" to the sysfs_root entry; any path returned
8537 + * is relative to wherever sysfs is mounted.
8538 +- *
8539 +- * XXX: does no error checking on @path size
8540 + */
8541 + static char *sysfs_pathname(struct sysfs_dirent *sd, char *path)
8542 + {
8543 + if (sd->s_parent) {
8544 + sysfs_pathname(sd->s_parent, path);
8545 +- strcat(path, "/");
8546 ++ strlcat(path, "/", PATH_MAX);
8547 + }
8548 +- strcat(path, sd->s_name);
8549 ++ strlcat(path, sd->s_name, PATH_MAX);
8550 + return path;
8551 + }
8552 +
8553 +@@ -531,9 +529,11 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
8554 + char *path = kzalloc(PATH_MAX, GFP_KERNEL);
8555 + WARN(1, KERN_WARNING
8556 + "sysfs: cannot create duplicate filename '%s'\n",
8557 +- (path == NULL) ? sd->s_name :
8558 +- strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"),
8559 +- sd->s_name));
8560 ++ (path == NULL) ? sd->s_name
8561 ++ : (sysfs_pathname(acxt->parent_sd, path),
8562 ++ strlcat(path, "/", PATH_MAX),
8563 ++ strlcat(path, sd->s_name, PATH_MAX),
8564 ++ path));
8565 + kfree(path);
8566 + }
8567 +
8568 +diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
8569 +index c78bb99..af1cbaf 100644
8570 +--- a/include/drm/drm_pciids.h
8571 ++++ b/include/drm/drm_pciids.h
8572 +@@ -205,6 +205,8 @@
8573 + {0x1002, 0x6788, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8574 + {0x1002, 0x678A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8575 + {0x1002, 0x6790, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8576 ++ {0x1002, 0x6791, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8577 ++ {0x1002, 0x6792, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8578 + {0x1002, 0x6798, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8579 + {0x1002, 0x6799, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8580 + {0x1002, 0x679A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI|RADEON_NEW_MEMMAP}, \
8581 +@@ -217,6 +219,7 @@
8582 + {0x1002, 0x6808, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8583 + {0x1002, 0x6809, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8584 + {0x1002, 0x6810, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8585 ++ {0x1002, 0x6811, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8586 + {0x1002, 0x6816, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8587 + {0x1002, 0x6817, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8588 + {0x1002, 0x6818, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_PITCAIRN|RADEON_NEW_MEMMAP}, \
8589 +diff --git a/include/linux/efi.h b/include/linux/efi.h
8590 +index ec45ccd..5782114 100644
8591 +--- a/include/linux/efi.h
8592 ++++ b/include/linux/efi.h
8593 +@@ -496,6 +496,11 @@ extern void efi_map_pal_code (void);
8594 + extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
8595 + extern void efi_gettimeofday (struct timespec *ts);
8596 + extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
8597 ++#ifdef CONFIG_X86
8598 ++extern void efi_free_boot_services(void);
8599 ++#else
8600 ++static inline void efi_free_boot_services(void) {}
8601 ++#endif
8602 + extern u64 efi_get_iobase (void);
8603 + extern u32 efi_mem_type (unsigned long phys_addr);
8604 + extern u64 efi_mem_attributes (unsigned long phys_addr);
8605 +diff --git a/include/linux/memblock.h b/include/linux/memblock.h
8606 +index 19dc455..c948c44 100644
8607 +--- a/include/linux/memblock.h
8608 ++++ b/include/linux/memblock.h
8609 +@@ -57,6 +57,7 @@ int memblock_add(phys_addr_t base, phys_addr_t size);
8610 + int memblock_remove(phys_addr_t base, phys_addr_t size);
8611 + int memblock_free(phys_addr_t base, phys_addr_t size);
8612 + int memblock_reserve(phys_addr_t base, phys_addr_t size);
8613 ++void memblock_trim_memory(phys_addr_t align);
8614 +
8615 + #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
8616 + void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
8617 +diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
8618 +index 3d254e1..f10553c 100644
8619 +--- a/include/net/cfg80211.h
8620 ++++ b/include/net/cfg80211.h
8621 +@@ -1217,6 +1217,7 @@ struct cfg80211_deauth_request {
8622 + const u8 *ie;
8623 + size_t ie_len;
8624 + u16 reason_code;
8625 ++ bool local_state_change;
8626 + };
8627 +
8628 + /**
8629 +diff --git a/init/main.c b/init/main.c
8630 +index b286730..d61ec54 100644
8631 +--- a/init/main.c
8632 ++++ b/init/main.c
8633 +@@ -631,6 +631,9 @@ asmlinkage void __init start_kernel(void)
8634 + acpi_early_init(); /* before LAPIC and SMP init */
8635 + sfi_init_late();
8636 +
8637 ++ if (efi_enabled)
8638 ++ efi_free_boot_services();
8639 ++
8640 + ftrace_init();
8641 +
8642 + /* Do the rest non-__init'ed, we're now alive */
8643 +diff --git a/lib/genalloc.c b/lib/genalloc.c
8644 +index 6bc04aa..7cb7a5d 100644
8645 +--- a/lib/genalloc.c
8646 ++++ b/lib/genalloc.c
8647 +@@ -176,7 +176,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy
8648 + struct gen_pool_chunk *chunk;
8649 + int nbits = size >> pool->min_alloc_order;
8650 + int nbytes = sizeof(struct gen_pool_chunk) +
8651 +- (nbits + BITS_PER_BYTE - 1) / BITS_PER_BYTE;
8652 ++ BITS_TO_LONGS(nbits) * sizeof(long);
8653 +
8654 + chunk = kmalloc_node(nbytes, GFP_KERNEL | __GFP_ZERO, nid);
8655 + if (unlikely(chunk == NULL))
8656 +diff --git a/mm/memblock.c b/mm/memblock.c
8657 +index 82aa349..0e490e8 100644
8658 +--- a/mm/memblock.c
8659 ++++ b/mm/memblock.c
8660 +@@ -929,6 +929,30 @@ int __init_memblock memblock_is_region_reserved(phys_addr_t base, phys_addr_t si
8661 + return memblock_overlaps_region(&memblock.reserved, base, size) >= 0;
8662 + }
8663 +
8664 ++void __init_memblock memblock_trim_memory(phys_addr_t align)
8665 ++{
8666 ++ int i;
8667 ++ phys_addr_t start, end, orig_start, orig_end;
8668 ++ struct memblock_type *mem = &memblock.memory;
8669 ++
8670 ++ for (i = 0; i < mem->cnt; i++) {
8671 ++ orig_start = mem->regions[i].base;
8672 ++ orig_end = mem->regions[i].base + mem->regions[i].size;
8673 ++ start = round_up(orig_start, align);
8674 ++ end = round_down(orig_end, align);
8675 ++
8676 ++ if (start == orig_start && end == orig_end)
8677 ++ continue;
8678 ++
8679 ++ if (start < end) {
8680 ++ mem->regions[i].base = start;
8681 ++ mem->regions[i].size = end - start;
8682 ++ } else {
8683 ++ memblock_remove_region(mem, i);
8684 ++ i--;
8685 ++ }
8686 ++ }
8687 ++}
8688 +
8689 + void __init_memblock memblock_set_current_limit(phys_addr_t limit)
8690 + {
8691 +diff --git a/mm/rmap.c b/mm/rmap.c
8692 +index 0f3b7cd..aa95e59 100644
8693 +--- a/mm/rmap.c
8694 ++++ b/mm/rmap.c
8695 +@@ -56,6 +56,7 @@
8696 + #include <linux/mmu_notifier.h>
8697 + #include <linux/migrate.h>
8698 + #include <linux/hugetlb.h>
8699 ++#include <linux/backing-dev.h>
8700 +
8701 + #include <asm/tlbflush.h>
8702 +
8703 +@@ -971,11 +972,8 @@ int page_mkclean(struct page *page)
8704 +
8705 + if (page_mapped(page)) {
8706 + struct address_space *mapping = page_mapping(page);
8707 +- if (mapping) {
8708 ++ if (mapping)
8709 + ret = page_mkclean_file(mapping, page);
8710 +- if (page_test_and_clear_dirty(page_to_pfn(page), 1))
8711 +- ret = 1;
8712 +- }
8713 + }
8714 +
8715 + return ret;
8716 +@@ -1161,6 +1159,7 @@ void page_add_file_rmap(struct page *page)
8717 + */
8718 + void page_remove_rmap(struct page *page)
8719 + {
8720 ++ struct address_space *mapping = page_mapping(page);
8721 + bool anon = PageAnon(page);
8722 + bool locked;
8723 + unsigned long flags;
8724 +@@ -1183,8 +1182,19 @@ void page_remove_rmap(struct page *page)
8725 + * this if the page is anon, so about to be freed; but perhaps
8726 + * not if it's in swapcache - there might be another pte slot
8727 + * containing the swap entry, but page not yet written to swap.
8728 ++ *
8729 ++ * And we can skip it on file pages, so long as the filesystem
8730 ++ * participates in dirty tracking; but need to catch shm and tmpfs
8731 ++ * and ramfs pages which have been modified since creation by read
8732 ++ * fault.
8733 ++ *
8734 ++ * Note that mapping must be decided above, before decrementing
8735 ++ * mapcount (which luckily provides a barrier): once page is unmapped,
8736 ++ * it could be truncated and page->mapping reset to NULL at any moment.
8737 ++ * Note also that we are relying on page_mapping(page) to set mapping
8738 ++ * to &swapper_space when PageSwapCache(page).
8739 + */
8740 +- if ((!anon || PageSwapCache(page)) &&
8741 ++ if (mapping && !mapping_cap_account_dirty(mapping) &&
8742 + page_test_and_clear_dirty(page_to_pfn(page), 1))
8743 + set_page_dirty(page);
8744 + /*
8745 +diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
8746 +index 8c225ef..2ac8d50 100644
8747 +--- a/net/bluetooth/smp.c
8748 ++++ b/net/bluetooth/smp.c
8749 +@@ -32,6 +32,8 @@
8750 +
8751 + #define SMP_TIMEOUT msecs_to_jiffies(30000)
8752 +
8753 ++#define AUTH_REQ_MASK 0x07
8754 ++
8755 + static inline void swap128(u8 src[16], u8 dst[16])
8756 + {
8757 + int i;
8758 +@@ -230,7 +232,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
8759 + req->max_key_size = SMP_MAX_ENC_KEY_SIZE;
8760 + req->init_key_dist = 0;
8761 + req->resp_key_dist = dist_keys;
8762 +- req->auth_req = authreq;
8763 ++ req->auth_req = (authreq & AUTH_REQ_MASK);
8764 + return;
8765 + }
8766 +
8767 +@@ -239,7 +241,7 @@ static void build_pairing_cmd(struct l2cap_conn *conn,
8768 + rsp->max_key_size = SMP_MAX_ENC_KEY_SIZE;
8769 + rsp->init_key_dist = 0;
8770 + rsp->resp_key_dist = req->resp_key_dist & dist_keys;
8771 +- rsp->auth_req = authreq;
8772 ++ rsp->auth_req = (authreq & AUTH_REQ_MASK);
8773 + }
8774 +
8775 + static u8 check_enc_key_size(struct l2cap_conn *conn, __u8 max_key_size)
8776 +diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
8777 +index bfb57dc..c93d395 100644
8778 +--- a/net/mac80211/iface.c
8779 ++++ b/net/mac80211/iface.c
8780 +@@ -822,7 +822,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata,
8781 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
8782 + if (info->control.vif == &sdata->vif) {
8783 + __skb_unlink(skb, &local->pending[i]);
8784 +- dev_kfree_skb_irq(skb);
8785 ++ ieee80211_free_txskb(&local->hw, skb);
8786 + }
8787 + }
8788 + }
8789 +diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
8790 +index f76b833..b71d466 100644
8791 +--- a/net/mac80211/mlme.c
8792 ++++ b/net/mac80211/mlme.c
8793 +@@ -3065,22 +3065,32 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
8794 + ht_cfreq, ht_oper->primary_chan,
8795 + cbss->channel->band);
8796 + ht_oper = NULL;
8797 ++ } else {
8798 ++ channel_type = NL80211_CHAN_HT20;
8799 + }
8800 + }
8801 +
8802 +- if (ht_oper) {
8803 +- channel_type = NL80211_CHAN_HT20;
8804 ++ if (ht_oper && sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
8805 ++ /*
8806 ++ * cfg80211 already verified that the channel itself can
8807 ++ * be used, but it didn't check that we can do the right
8808 ++ * HT type, so do that here as well. If HT40 isn't allowed
8809 ++ * on this channel, disable 40 MHz operation.
8810 ++ */
8811 +
8812 +- if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
8813 +- switch (ht_oper->ht_param &
8814 +- IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
8815 +- case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
8816 ++ switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
8817 ++ case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
8818 ++ if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS)
8819 ++ ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
8820 ++ else
8821 + channel_type = NL80211_CHAN_HT40PLUS;
8822 +- break;
8823 +- case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
8824 ++ break;
8825 ++ case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
8826 ++ if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40MINUS)
8827 ++ ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
8828 ++ else
8829 + channel_type = NL80211_CHAN_HT40MINUS;
8830 +- break;
8831 +- }
8832 ++ break;
8833 + }
8834 + }
8835 +
8836 +@@ -3457,6 +3467,7 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
8837 + {
8838 + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
8839 + u8 frame_buf[DEAUTH_DISASSOC_LEN];
8840 ++ bool tx = !req->local_state_change;
8841 +
8842 + mutex_lock(&ifmgd->mtx);
8843 +
8844 +@@ -3473,11 +3484,11 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
8845 + if (ifmgd->associated &&
8846 + ether_addr_equal(ifmgd->associated->bssid, req->bssid))
8847 + ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
8848 +- req->reason_code, true, frame_buf);
8849 ++ req->reason_code, tx, frame_buf);
8850 + else
8851 + ieee80211_send_deauth_disassoc(sdata, req->bssid,
8852 + IEEE80211_STYPE_DEAUTH,
8853 +- req->reason_code, true,
8854 ++ req->reason_code, tx,
8855 + frame_buf);
8856 + mutex_unlock(&ifmgd->mtx);
8857 +
8858 +diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
8859 +index 06fa75c..63882b9 100644
8860 +--- a/net/mac80211/sta_info.c
8861 ++++ b/net/mac80211/sta_info.c
8862 +@@ -585,7 +585,7 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local,
8863 + */
8864 + if (!skb)
8865 + break;
8866 +- dev_kfree_skb(skb);
8867 ++ ieee80211_free_txskb(&local->hw, skb);
8868 + }
8869 +
8870 + /*
8871 +@@ -614,7 +614,7 @@ static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local,
8872 + local->total_ps_buffered--;
8873 + ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n",
8874 + sta->sta.addr);
8875 +- dev_kfree_skb(skb);
8876 ++ ieee80211_free_txskb(&local->hw, skb);
8877 + }
8878 +
8879 + /*
8880 +diff --git a/net/mac80211/util.c b/net/mac80211/util.c
8881 +index 39b82fe..c9b52f7 100644
8882 +--- a/net/mac80211/util.c
8883 ++++ b/net/mac80211/util.c
8884 +@@ -400,7 +400,7 @@ void ieee80211_add_pending_skb(struct ieee80211_local *local,
8885 + int queue = info->hw_queue;
8886 +
8887 + if (WARN_ON(!info->control.vif)) {
8888 +- kfree_skb(skb);
8889 ++ ieee80211_free_txskb(&local->hw, skb);
8890 + return;
8891 + }
8892 +
8893 +@@ -425,7 +425,7 @@ void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local,
8894 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
8895 +
8896 + if (WARN_ON(!info->control.vif)) {
8897 +- kfree_skb(skb);
8898 ++ ieee80211_free_txskb(&local->hw, skb);
8899 + continue;
8900 + }
8901 +
8902 +diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
8903 +index bdb53ab..e72562a 100644
8904 +--- a/net/mac80211/wpa.c
8905 ++++ b/net/mac80211/wpa.c
8906 +@@ -106,7 +106,8 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
8907 + if (status->flag & RX_FLAG_MMIC_ERROR)
8908 + goto mic_fail;
8909 +
8910 +- if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key)
8911 ++ if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key &&
8912 ++ rx->key->conf.cipher == WLAN_CIPHER_SUITE_TKIP)
8913 + goto update_iv;
8914 +
8915 + return RX_CONTINUE;
8916 +diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
8917 +index 97f8918..6a70db4 100644
8918 +--- a/net/sunrpc/xprtsock.c
8919 ++++ b/net/sunrpc/xprtsock.c
8920 +@@ -254,7 +254,6 @@ struct sock_xprt {
8921 + void (*old_data_ready)(struct sock *, int);
8922 + void (*old_state_change)(struct sock *);
8923 + void (*old_write_space)(struct sock *);
8924 +- void (*old_error_report)(struct sock *);
8925 + };
8926 +
8927 + /*
8928 +@@ -737,10 +736,10 @@ static int xs_tcp_send_request(struct rpc_task *task)
8929 + dprintk("RPC: sendmsg returned unrecognized error %d\n",
8930 + -status);
8931 + case -ECONNRESET:
8932 +- case -EPIPE:
8933 + xs_tcp_shutdown(xprt);
8934 + case -ECONNREFUSED:
8935 + case -ENOTCONN:
8936 ++ case -EPIPE:
8937 + clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
8938 + }
8939 +
8940 +@@ -781,7 +780,6 @@ static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk)
8941 + transport->old_data_ready = sk->sk_data_ready;
8942 + transport->old_state_change = sk->sk_state_change;
8943 + transport->old_write_space = sk->sk_write_space;
8944 +- transport->old_error_report = sk->sk_error_report;
8945 + }
8946 +
8947 + static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk)
8948 +@@ -789,7 +787,6 @@ static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *s
8949 + sk->sk_data_ready = transport->old_data_ready;
8950 + sk->sk_state_change = transport->old_state_change;
8951 + sk->sk_write_space = transport->old_write_space;
8952 +- sk->sk_error_report = transport->old_error_report;
8953 + }
8954 +
8955 + static void xs_reset_transport(struct sock_xprt *transport)
8956 +@@ -1462,7 +1459,7 @@ static void xs_tcp_cancel_linger_timeout(struct rpc_xprt *xprt)
8957 + xprt_clear_connecting(xprt);
8958 + }
8959 +
8960 +-static void xs_sock_mark_closed(struct rpc_xprt *xprt)
8961 ++static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt)
8962 + {
8963 + smp_mb__before_clear_bit();
8964 + clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
8965 +@@ -1470,6 +1467,11 @@ static void xs_sock_mark_closed(struct rpc_xprt *xprt)
8966 + clear_bit(XPRT_CLOSE_WAIT, &xprt->state);
8967 + clear_bit(XPRT_CLOSING, &xprt->state);
8968 + smp_mb__after_clear_bit();
8969 ++}
8970 ++
8971 ++static void xs_sock_mark_closed(struct rpc_xprt *xprt)
8972 ++{
8973 ++ xs_sock_reset_connection_flags(xprt);
8974 + /* Mark transport as closed and wake up all pending tasks */
8975 + xprt_disconnect_done(xprt);
8976 + }
8977 +@@ -1525,6 +1527,7 @@ static void xs_tcp_state_change(struct sock *sk)
8978 + case TCP_CLOSE_WAIT:
8979 + /* The server initiated a shutdown of the socket */
8980 + xprt->connect_cookie++;
8981 ++ clear_bit(XPRT_CONNECTED, &xprt->state);
8982 + xs_tcp_force_close(xprt);
8983 + case TCP_CLOSING:
8984 + /*
8985 +@@ -1549,25 +1552,6 @@ static void xs_tcp_state_change(struct sock *sk)
8986 + read_unlock_bh(&sk->sk_callback_lock);
8987 + }
8988 +
8989 +-/**
8990 +- * xs_error_report - callback mainly for catching socket errors
8991 +- * @sk: socket
8992 +- */
8993 +-static void xs_error_report(struct sock *sk)
8994 +-{
8995 +- struct rpc_xprt *xprt;
8996 +-
8997 +- read_lock_bh(&sk->sk_callback_lock);
8998 +- if (!(xprt = xprt_from_sock(sk)))
8999 +- goto out;
9000 +- dprintk("RPC: %s client %p...\n"
9001 +- "RPC: error %d\n",
9002 +- __func__, xprt, sk->sk_err);
9003 +- xprt_wake_pending_tasks(xprt, -EAGAIN);
9004 +-out:
9005 +- read_unlock_bh(&sk->sk_callback_lock);
9006 +-}
9007 +-
9008 + static void xs_write_space(struct sock *sk)
9009 + {
9010 + struct socket *sock;
9011 +@@ -1867,7 +1851,6 @@ static int xs_local_finish_connecting(struct rpc_xprt *xprt,
9012 + sk->sk_user_data = xprt;
9013 + sk->sk_data_ready = xs_local_data_ready;
9014 + sk->sk_write_space = xs_udp_write_space;
9015 +- sk->sk_error_report = xs_error_report;
9016 + sk->sk_allocation = GFP_ATOMIC;
9017 +
9018 + xprt_clear_connected(xprt);
9019 +@@ -1995,7 +1978,6 @@ static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
9020 + sk->sk_user_data = xprt;
9021 + sk->sk_data_ready = xs_udp_data_ready;
9022 + sk->sk_write_space = xs_udp_write_space;
9023 +- sk->sk_error_report = xs_error_report;
9024 + sk->sk_no_check = UDP_CSUM_NORCV;
9025 + sk->sk_allocation = GFP_ATOMIC;
9026 +
9027 +@@ -2065,10 +2047,8 @@ static void xs_abort_connection(struct sock_xprt *transport)
9028 + any.sa_family = AF_UNSPEC;
9029 + result = kernel_connect(transport->sock, &any, sizeof(any), 0);
9030 + if (!result)
9031 +- xs_sock_mark_closed(&transport->xprt);
9032 +- else
9033 +- dprintk("RPC: AF_UNSPEC connect return code %d\n",
9034 +- result);
9035 ++ xs_sock_reset_connection_flags(&transport->xprt);
9036 ++ dprintk("RPC: AF_UNSPEC connect return code %d\n", result);
9037 + }
9038 +
9039 + static void xs_tcp_reuse_connection(struct sock_xprt *transport)
9040 +@@ -2113,7 +2093,6 @@ static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
9041 + sk->sk_data_ready = xs_tcp_data_ready;
9042 + sk->sk_state_change = xs_tcp_state_change;
9043 + sk->sk_write_space = xs_tcp_write_space;
9044 +- sk->sk_error_report = xs_error_report;
9045 + sk->sk_allocation = GFP_ATOMIC;
9046 +
9047 + /* socket options */
9048 +diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
9049 +index 1cdb1d5..9ea174f 100644
9050 +--- a/net/wireless/mlme.c
9051 ++++ b/net/wireless/mlme.c
9052 +@@ -457,20 +457,14 @@ int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
9053 + .reason_code = reason,
9054 + .ie = ie,
9055 + .ie_len = ie_len,
9056 ++ .local_state_change = local_state_change,
9057 + };
9058 +
9059 + ASSERT_WDEV_LOCK(wdev);
9060 +
9061 +- if (local_state_change) {
9062 +- if (wdev->current_bss &&
9063 +- ether_addr_equal(wdev->current_bss->pub.bssid, bssid)) {
9064 +- cfg80211_unhold_bss(wdev->current_bss);
9065 +- cfg80211_put_bss(&wdev->current_bss->pub);
9066 +- wdev->current_bss = NULL;
9067 +- }
9068 +-
9069 ++ if (local_state_change && (!wdev->current_bss ||
9070 ++ !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
9071 + return 0;
9072 +- }
9073 +
9074 + return rdev->ops->deauth(&rdev->wiphy, dev, &req);
9075 + }
9076 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
9077 +index 155cbd2..70ce60f 100644
9078 +--- a/sound/pci/hda/patch_realtek.c
9079 ++++ b/sound/pci/hda/patch_realtek.c
9080 +@@ -5704,6 +5704,7 @@ static const struct hda_verb alc268_beep_init_verbs[] = {
9081 +
9082 + enum {
9083 + ALC268_FIXUP_INV_DMIC,
9084 ++ ALC268_FIXUP_HP_EAPD,
9085 + };
9086 +
9087 + static const struct alc_fixup alc268_fixups[] = {
9088 +@@ -5711,10 +5712,26 @@ static const struct alc_fixup alc268_fixups[] = {
9089 + .type = ALC_FIXUP_FUNC,
9090 + .v.func = alc_fixup_inv_dmic_0x12,
9091 + },
9092 ++ [ALC268_FIXUP_HP_EAPD] = {
9093 ++ .type = ALC_FIXUP_VERBS,
9094 ++ .v.verbs = (const struct hda_verb[]) {
9095 ++ {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
9096 ++ {}
9097 ++ }
9098 ++ },
9099 + };
9100 +
9101 + static const struct alc_model_fixup alc268_fixup_models[] = {
9102 + {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
9103 ++ {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
9104 ++ {}
9105 ++};
9106 ++
9107 ++static const struct snd_pci_quirk alc268_fixup_tbl[] = {
9108 ++ /* below is codec SSID since multiple Toshiba laptops have the
9109 ++ * same PCI SSID 1179:ff00
9110 ++ */
9111 ++ SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
9112 + {}
9113 + };
9114 +
9115 +@@ -5749,7 +5766,7 @@ static int patch_alc268(struct hda_codec *codec)
9116 +
9117 + spec = codec->spec;
9118 +
9119 +- alc_pick_fixup(codec, alc268_fixup_models, NULL, alc268_fixups);
9120 ++ alc_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
9121 + alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
9122 +
9123 + /* automatic parse from the BIOS config */
9124 +@@ -6214,6 +6231,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
9125 + SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
9126 + SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
9127 + SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
9128 ++ SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
9129 + SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
9130 + SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
9131 + SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
9132 +diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
9133 +index af0f22f..aca6edc 100644
9134 +--- a/usr/gen_init_cpio.c
9135 ++++ b/usr/gen_init_cpio.c
9136 +@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location,
9137 + int retval;
9138 + int rc = -1;
9139 + int namesize;
9140 +- int i;
9141 ++ unsigned int i;
9142 +
9143 + mode |= S_IFREG;
9144 +
9145 +@@ -381,25 +381,28 @@ error:
9146 +
9147 + static char *cpio_replace_env(char *new_location)
9148 + {
9149 +- char expanded[PATH_MAX + 1];
9150 +- char env_var[PATH_MAX + 1];
9151 +- char *start;
9152 +- char *end;
9153 +-
9154 +- for (start = NULL; (start = strstr(new_location, "${")); ) {
9155 +- end = strchr(start, '}');
9156 +- if (start < end) {
9157 +- *env_var = *expanded = '\0';
9158 +- strncat(env_var, start + 2, end - start - 2);
9159 +- strncat(expanded, new_location, start - new_location);
9160 +- strncat(expanded, getenv(env_var), PATH_MAX);
9161 +- strncat(expanded, end + 1, PATH_MAX);
9162 +- strncpy(new_location, expanded, PATH_MAX);
9163 +- } else
9164 +- break;
9165 +- }
9166 +-
9167 +- return new_location;
9168 ++ char expanded[PATH_MAX + 1];
9169 ++ char env_var[PATH_MAX + 1];
9170 ++ char *start;
9171 ++ char *end;
9172 ++
9173 ++ for (start = NULL; (start = strstr(new_location, "${")); ) {
9174 ++ end = strchr(start, '}');
9175 ++ if (start < end) {
9176 ++ *env_var = *expanded = '\0';
9177 ++ strncat(env_var, start + 2, end - start - 2);
9178 ++ strncat(expanded, new_location, start - new_location);
9179 ++ strncat(expanded, getenv(env_var),
9180 ++ PATH_MAX - strlen(expanded));
9181 ++ strncat(expanded, end + 1,
9182 ++ PATH_MAX - strlen(expanded));
9183 ++ strncpy(new_location, expanded, PATH_MAX);
9184 ++ new_location[PATH_MAX] = 0;
9185 ++ } else
9186 ++ break;
9187 ++ }
9188 ++
9189 ++ return new_location;
9190 + }
9191 +
9192 +
9193
9194 diff --git a/3.6.4/4420_grsecurity-2.9.1-3.6.4-201210291446.patch b/3.6.5/4420_grsecurity-2.9.1-3.6.5-201210312121.patch
9195 similarity index 99%
9196 rename from 3.6.4/4420_grsecurity-2.9.1-3.6.4-201210291446.patch
9197 rename to 3.6.5/4420_grsecurity-2.9.1-3.6.5-201210312121.patch
9198 index 08c581d..c2276e8 100644
9199 --- a/3.6.4/4420_grsecurity-2.9.1-3.6.4-201210291446.patch
9200 +++ b/3.6.5/4420_grsecurity-2.9.1-3.6.5-201210312121.patch
9201 @@ -251,7 +251,7 @@ index ad7e2e5..199f49e 100644
9202
9203 pcd. [PARIDE]
9204 diff --git a/Makefile b/Makefile
9205 -index dcf132a..db194e3 100644
9206 +index 6e4a00d..4c7aa4f 100644
9207 --- a/Makefile
9208 +++ b/Makefile
9209 @@ -241,8 +241,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
9210 @@ -19013,7 +19013,7 @@ index 7a6f3b3..bed145d7 100644
9211
9212 1:
9213 diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
9214 -index 198e774..e880f29 100644
9215 +index 5cee802..bc22bc3 100644
9216 --- a/arch/x86/kernel/setup.c
9217 +++ b/arch/x86/kernel/setup.c
9218 @@ -440,7 +440,7 @@ static void __init parse_setup_data(void)
9219 @@ -24577,7 +24577,7 @@ index b91e485..d00e7c9 100644
9220 }
9221 if (mm->get_unmapped_area == arch_get_unmapped_area)
9222 diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
9223 -index ab1f6a9..23030ba 100644
9224 +index d7aea41..f753ad2 100644
9225 --- a/arch/x86/mm/init.c
9226 +++ b/arch/x86/mm/init.c
9227 @@ -16,6 +16,8 @@
9228 @@ -24589,16 +24589,16 @@ index ab1f6a9..23030ba 100644
9229
9230 unsigned long __initdata pgt_buf_start;
9231 unsigned long __meminitdata pgt_buf_end;
9232 -@@ -38,7 +40,7 @@ struct map_range {
9233 - static void __init find_early_table_space(struct map_range *mr, unsigned long end,
9234 - int use_pse, int use_gbpages)
9235 +@@ -44,7 +46,7 @@ static void __init find_early_table_space(struct map_range *mr, int nr_range)
9236 {
9237 -- unsigned long puds, pmds, ptes, tables, start = 0, good_end = end;
9238 -+ unsigned long puds, pmds, ptes, tables, start = 0x100000, good_end = end;
9239 + int i;
9240 + unsigned long puds = 0, pmds = 0, ptes = 0, tables;
9241 +- unsigned long start = 0, good_end;
9242 ++ unsigned long start = 0x100000, good_end;
9243 phys_addr_t base;
9244
9245 - puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
9246 -@@ -317,10 +319,37 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
9247 + for (i = 0; i < nr_range; i++) {
9248 +@@ -321,10 +323,37 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
9249 * Access has to be given to non-kernel-ram areas as well, these contain the PCI
9250 * mmio resources as well as potential bios/acpi data regions.
9251 */
9252 @@ -24637,7 +24637,7 @@ index ab1f6a9..23030ba 100644
9253 if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
9254 return 0;
9255 if (!page_is_ram(pagenr))
9256 -@@ -377,8 +406,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
9257 +@@ -381,8 +410,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
9258 #endif
9259 }
9260
9261 @@ -25034,7 +25034,7 @@ index 575d86f..4987469 100644
9262 printk(KERN_INFO "Write protecting the kernel text: %luk\n",
9263 size >> 10);
9264 diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
9265 -index 2b6b4a3..c17210d 100644
9266 +index 3baff25..8b37564 100644
9267 --- a/arch/x86/mm/init_64.c
9268 +++ b/arch/x86/mm/init_64.c
9269 @@ -74,7 +74,7 @@ early_param("gbpages", parse_direct_gbpages_on);
9270 @@ -25151,7 +25151,7 @@ index 2b6b4a3..c17210d 100644
9271 adr = (void *)(((unsigned long)adr) | left);
9272
9273 return adr;
9274 -@@ -548,7 +562,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
9275 +@@ -553,7 +567,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
9276 unmap_low_page(pmd);
9277
9278 spin_lock(&init_mm.page_table_lock);
9279 @@ -25160,7 +25160,7 @@ index 2b6b4a3..c17210d 100644
9280 spin_unlock(&init_mm.page_table_lock);
9281 }
9282 __flush_tlb_all();
9283 -@@ -594,7 +608,7 @@ kernel_physical_mapping_init(unsigned long start,
9284 +@@ -599,7 +613,7 @@ kernel_physical_mapping_init(unsigned long start,
9285 unmap_low_page(pud);
9286
9287 spin_lock(&init_mm.page_table_lock);
9288 @@ -25169,7 +25169,7 @@ index 2b6b4a3..c17210d 100644
9289 spin_unlock(&init_mm.page_table_lock);
9290 pgd_changed = true;
9291 }
9292 -@@ -686,6 +700,12 @@ void __init mem_init(void)
9293 +@@ -691,6 +705,12 @@ void __init mem_init(void)
9294
9295 pci_iommu_alloc();
9296
9297 @@ -25182,7 +25182,7 @@ index 2b6b4a3..c17210d 100644
9298 /* clear_bss() already clear the empty_zero_page */
9299
9300 reservedpages = 0;
9301 -@@ -846,8 +866,8 @@ int kern_addr_valid(unsigned long addr)
9302 +@@ -851,8 +871,8 @@ int kern_addr_valid(unsigned long addr)
9303 static struct vm_area_struct gate_vma = {
9304 .vm_start = VSYSCALL_START,
9305 .vm_end = VSYSCALL_START + (VSYSCALL_MAPPED_PAGES * PAGE_SIZE),
9306 @@ -25193,7 +25193,7 @@ index 2b6b4a3..c17210d 100644
9307 };
9308
9309 struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
9310 -@@ -881,7 +901,7 @@ int in_gate_area_no_mm(unsigned long addr)
9311 +@@ -886,7 +906,7 @@ int in_gate_area_no_mm(unsigned long addr)
9312
9313 const char *arch_vma_name(struct vm_area_struct *vma)
9314 {
9315 @@ -30813,7 +30813,7 @@ index 73fa3e1..ab2e9b9 100644
9316 iir = I915_READ(IIR);
9317
9318 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
9319 -index b634f6f..84bb8ba 100644
9320 +index b634f6f..43c62f5 100644
9321 --- a/drivers/gpu/drm/i915/intel_display.c
9322 +++ b/drivers/gpu/drm/i915/intel_display.c
9323 @@ -2182,7 +2182,7 @@ intel_finish_fb(struct drm_framebuffer *old_fb)
9324 @@ -30825,16 +30825,17 @@ index b634f6f..84bb8ba 100644
9325
9326 /* Big Hammer, we also need to ensure that any pending
9327 * MI_WAIT_FOR_EVENT inside a user batch buffer on the
9328 -@@ -6168,7 +6168,7 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
9329 +@@ -6168,8 +6168,7 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
9330
9331 obj = work->old_fb_obj;
9332
9333 - atomic_clear_mask(1 << intel_crtc->plane,
9334 -+ atomic_clear_mask_unchecked(1 << intel_crtc->plane,
9335 - &obj->pending_flip.counter);
9336 +- &obj->pending_flip.counter);
9337 ++ atomic_clear_mask_unchecked(1 << intel_crtc->plane, &obj->pending_flip);
9338
9339 wake_up(&dev_priv->pending_flip_queue);
9340 -@@ -6515,7 +6515,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9341 + schedule_work(&work->work);
9342 +@@ -6515,7 +6514,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9343 /* Block clients from rendering to the new back buffer until
9344 * the flip occurs and the object is no longer visible.
9345 */
9346 @@ -30843,7 +30844,7 @@ index b634f6f..84bb8ba 100644
9347
9348 ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);
9349 if (ret)
9350 -@@ -6530,7 +6530,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9351 +@@ -6530,7 +6529,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
9352 return 0;
9353
9354 cleanup_pending:
9355 @@ -31504,10 +31505,10 @@ index 14599e2..711c965 100644
9356
9357 for (i = 0; i < hid->maxcollection; i++)
9358 diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
9359 -index 4065374..10ed7dc 100644
9360 +index f4c3d28..82f45a9 100644
9361 --- a/drivers/hv/channel.c
9362 +++ b/drivers/hv/channel.c
9363 -@@ -400,8 +400,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
9364 +@@ -402,8 +402,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
9365 int ret = 0;
9366 int t;
9367
9368 @@ -44624,19 +44625,10 @@ index 112e45a..b59845b 100644
9369
9370 /*
9371 diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
9372 -index debdfe0..75d31d4 100644
9373 +index 5d2069f..75d31d4 100644
9374 --- a/fs/compat_ioctl.c
9375 +++ b/fs/compat_ioctl.c
9376 -@@ -210,6 +210,8 @@ static int do_video_set_spu_palette(unsigned int fd, unsigned int cmd,
9377 -
9378 - err = get_user(palp, &up->palette);
9379 - err |= get_user(length, &up->length);
9380 -+ if (err)
9381 -+ return -EFAULT;
9382 -
9383 - up_native = compat_alloc_user_space(sizeof(struct video_spu_palette));
9384 - err = put_user(compat_ptr(palp), &up_native->palette);
9385 -@@ -621,7 +623,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
9386 +@@ -623,7 +623,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
9387 return -EFAULT;
9388 if (__get_user(udata, &ss32->iomem_base))
9389 return -EFAULT;
9390 @@ -44645,7 +44637,7 @@ index debdfe0..75d31d4 100644
9391 if (__get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) ||
9392 __get_user(ss.port_high, &ss32->port_high))
9393 return -EFAULT;
9394 -@@ -796,7 +798,7 @@ static int compat_ioctl_preallocate(struct file *file,
9395 +@@ -798,7 +798,7 @@ static int compat_ioctl_preallocate(struct file *file,
9396 copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) ||
9397 copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) ||
9398 copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) ||
9399 @@ -44654,7 +44646,7 @@ index debdfe0..75d31d4 100644
9400 return -EFAULT;
9401
9402 return ioctl_preallocate(file, p);
9403 -@@ -1610,8 +1612,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
9404 +@@ -1612,8 +1612,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
9405 static int __init init_sys32_ioctl_cmp(const void *p, const void *q)
9406 {
9407 unsigned int a, b;
9408 @@ -44780,7 +44772,7 @@ index b2a34a1..162fa69 100644
9409 return rc;
9410 }
9411 diff --git a/fs/exec.c b/fs/exec.c
9412 -index 574cf4d..dfe774a 100644
9413 +index fab2c6d..4fa20c0 100644
9414 --- a/fs/exec.c
9415 +++ b/fs/exec.c
9416 @@ -55,6 +55,15 @@
9417 @@ -45050,7 +45042,7 @@ index 574cf4d..dfe774a 100644
9418 set_fs(old_fs);
9419 return result;
9420 }
9421 -@@ -1257,7 +1296,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
9422 +@@ -1258,7 +1297,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
9423 }
9424 rcu_read_unlock();
9425
9426 @@ -45059,7 +45051,7 @@ index 574cf4d..dfe774a 100644
9427 bprm->unsafe |= LSM_UNSAFE_SHARE;
9428 } else {
9429 res = -EAGAIN;
9430 -@@ -1460,6 +1499,28 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
9431 +@@ -1461,6 +1500,28 @@ int search_binary_handler(struct linux_binprm *bprm,struct pt_regs *regs)
9432
9433 EXPORT_SYMBOL(search_binary_handler);
9434
9435 @@ -45088,7 +45080,7 @@ index 574cf4d..dfe774a 100644
9436 /*
9437 * sys_execve() executes a new program.
9438 */
9439 -@@ -1468,6 +1529,11 @@ static int do_execve_common(const char *filename,
9440 +@@ -1469,6 +1530,11 @@ static int do_execve_common(const char *filename,
9441 struct user_arg_ptr envp,
9442 struct pt_regs *regs)
9443 {
9444 @@ -45100,7 +45092,7 @@ index 574cf4d..dfe774a 100644
9445 struct linux_binprm *bprm;
9446 struct file *file;
9447 struct files_struct *displaced;
9448 -@@ -1475,6 +1541,8 @@ static int do_execve_common(const char *filename,
9449 +@@ -1476,6 +1542,8 @@ static int do_execve_common(const char *filename,
9450 int retval;
9451 const struct cred *cred = current_cred();
9452
9453 @@ -45109,7 +45101,7 @@ index 574cf4d..dfe774a 100644
9454 /*
9455 * We move the actual failure in case of RLIMIT_NPROC excess from
9456 * set*uid() to execve() because too many poorly written programs
9457 -@@ -1515,12 +1583,27 @@ static int do_execve_common(const char *filename,
9458 +@@ -1516,12 +1584,27 @@ static int do_execve_common(const char *filename,
9459 if (IS_ERR(file))
9460 goto out_unmark;
9461
9462 @@ -45137,7 +45129,7 @@ index 574cf4d..dfe774a 100644
9463 retval = bprm_mm_init(bprm);
9464 if (retval)
9465 goto out_file;
9466 -@@ -1537,24 +1620,65 @@ static int do_execve_common(const char *filename,
9467 +@@ -1538,24 +1621,65 @@ static int do_execve_common(const char *filename,
9468 if (retval < 0)
9469 goto out;
9470
9471 @@ -45207,7 +45199,7 @@ index 574cf4d..dfe774a 100644
9472 current->fs->in_exec = 0;
9473 current->in_execve = 0;
9474 acct_update_integrals(current);
9475 -@@ -1563,6 +1687,14 @@ static int do_execve_common(const char *filename,
9476 +@@ -1564,6 +1688,14 @@ static int do_execve_common(const char *filename,
9477 put_files_struct(displaced);
9478 return retval;
9479
9480 @@ -45222,7 +45214,7 @@ index 574cf4d..dfe774a 100644
9481 out:
9482 if (bprm->mm) {
9483 acct_arg_size(bprm, 0);
9484 -@@ -1636,7 +1768,7 @@ static int expand_corename(struct core_name *cn)
9485 +@@ -1637,7 +1769,7 @@ static int expand_corename(struct core_name *cn)
9486 {
9487 char *old_corename = cn->corename;
9488
9489 @@ -45231,7 +45223,7 @@ index 574cf4d..dfe774a 100644
9490 cn->corename = krealloc(old_corename, cn->size, GFP_KERNEL);
9491
9492 if (!cn->corename) {
9493 -@@ -1733,7 +1865,7 @@ static int format_corename(struct core_name *cn, long signr)
9494 +@@ -1734,7 +1866,7 @@ static int format_corename(struct core_name *cn, long signr)
9495 int pid_in_pattern = 0;
9496 int err = 0;
9497
9498 @@ -45240,7 +45232,7 @@ index 574cf4d..dfe774a 100644
9499 cn->corename = kmalloc(cn->size, GFP_KERNEL);
9500 cn->used = 0;
9501
9502 -@@ -1830,6 +1962,250 @@ out:
9503 +@@ -1831,6 +1963,250 @@ out:
9504 return ispipe;
9505 }
9506
9507 @@ -45491,7 +45483,7 @@ index 574cf4d..dfe774a 100644
9508 static int zap_process(struct task_struct *start, int exit_code)
9509 {
9510 struct task_struct *t;
9511 -@@ -2040,17 +2416,17 @@ static void wait_for_dump_helpers(struct file *file)
9512 +@@ -2041,17 +2417,17 @@ static void wait_for_dump_helpers(struct file *file)
9513 pipe = file->f_path.dentry->d_inode->i_pipe;
9514
9515 pipe_lock(pipe);
9516 @@ -45514,7 +45506,7 @@ index 574cf4d..dfe774a 100644
9517 pipe_unlock(pipe);
9518
9519 }
9520 -@@ -2105,7 +2481,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9521 +@@ -2106,7 +2482,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9522 int flag = 0;
9523 int ispipe;
9524 bool need_nonrelative = false;
9525 @@ -45523,7 +45515,7 @@ index 574cf4d..dfe774a 100644
9526 struct coredump_params cprm = {
9527 .signr = signr,
9528 .regs = regs,
9529 -@@ -2120,6 +2496,9 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9530 +@@ -2121,6 +2497,9 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9531
9532 audit_core_dumps(signr);
9533
9534 @@ -45533,7 +45525,7 @@ index 574cf4d..dfe774a 100644
9535 binfmt = mm->binfmt;
9536 if (!binfmt || !binfmt->core_dump)
9537 goto fail;
9538 -@@ -2190,7 +2569,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9539 +@@ -2191,7 +2570,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9540 }
9541 cprm.limit = RLIM_INFINITY;
9542
9543 @@ -45542,7 +45534,7 @@ index 574cf4d..dfe774a 100644
9544 if (core_pipe_limit && (core_pipe_limit < dump_count)) {
9545 printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
9546 task_tgid_vnr(current), current->comm);
9547 -@@ -2217,6 +2596,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9548 +@@ -2218,6 +2597,8 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
9549 } else {
9550 struct inode *inode;
9551
9552 @@ -45551,7 +45543,7 @@ index 574cf4d..dfe774a 100644
9553 if (cprm.limit < binfmt->min_coredump)
9554 goto fail_unlock;
9555
9556 -@@ -2268,7 +2649,7 @@ close_fail:
9557 +@@ -2269,7 +2650,7 @@ close_fail:
9558 filp_close(cprm.file, NULL);
9559 fail_dropcount:
9560 if (ispipe)
9561 @@ -45560,7 +45552,7 @@ index 574cf4d..dfe774a 100644
9562 fail_unlock:
9563 kfree(cn.corename);
9564 fail_corename:
9565 -@@ -2287,7 +2668,7 @@ fail:
9566 +@@ -2288,7 +2669,7 @@ fail:
9567 */
9568 int dump_write(struct file *file, const void *addr, int nr)
9569 {
9570 @@ -47551,7 +47543,7 @@ index 7e81bfc..c3649aa 100644
9571
9572 lock_flocks();
9573 diff --git a/fs/namei.c b/fs/namei.c
9574 -index 81bd546..80149d9 100644
9575 +index 091c4b7..c6d7e26 100644
9576 --- a/fs/namei.c
9577 +++ b/fs/namei.c
9578 @@ -265,16 +265,32 @@ int generic_permission(struct inode *inode, int mask)
9579 @@ -50292,7 +50284,7 @@ index 41514dd..6564a93 100644
9580
9581 pipe_unlock(ipipe);
9582 diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
9583 -index 6b0bb00..75db2fe 100644
9584 +index 2fbdff6..5530a61 100644
9585 --- a/fs/sysfs/dir.c
9586 +++ b/fs/sysfs/dir.c
9587 @@ -685,6 +685,18 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
9588 @@ -61439,10 +61431,10 @@ index 9c02a45..89fdd73 100644
9589 unsigned int offset, size_t len);
9590
9591 diff --git a/include/linux/efi.h b/include/linux/efi.h
9592 -index ec45ccd..9923c32 100644
9593 +index 5782114..e9b1ba1 100644
9594 --- a/include/linux/efi.h
9595 +++ b/include/linux/efi.h
9596 -@@ -635,7 +635,7 @@ struct efivar_operations {
9597 +@@ -640,7 +640,7 @@ struct efivar_operations {
9598 efi_get_variable_t *get_variable;
9599 efi_get_next_variable_t *get_next_variable;
9600 efi_set_variable_t *set_variable;
9601 @@ -66039,7 +66031,7 @@ index 84c6bf1..8899338 100644
9602 next_state = Reset;
9603 return 0;
9604 diff --git a/init/main.c b/init/main.c
9605 -index b286730..9ff6135 100644
9606 +index d61ec54..bd3144f 100644
9607 --- a/init/main.c
9608 +++ b/init/main.c
9609 @@ -96,6 +96,8 @@ static inline void mark_rodata_ro(void) { }
9610 @@ -66113,7 +66105,7 @@ index b286730..9ff6135 100644
9611 static const char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, };
9612 const char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };
9613 static const char *panic_later, *panic_param;
9614 -@@ -675,6 +732,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
9615 +@@ -678,6 +735,7 @@ int __init_or_module do_one_initcall(initcall_t fn)
9616 {
9617 int count = preempt_count();
9618 int ret;
9619 @@ -66121,7 +66113,7 @@ index b286730..9ff6135 100644
9620
9621 if (initcall_debug)
9622 ret = do_one_initcall_debug(fn);
9623 -@@ -687,15 +745,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
9624 +@@ -690,15 +748,15 @@ int __init_or_module do_one_initcall(initcall_t fn)
9625 sprintf(msgbuf, "error code %d ", ret);
9626
9627 if (preempt_count() != count) {
9628 @@ -66141,7 +66133,7 @@ index b286730..9ff6135 100644
9629 }
9630
9631 return ret;
9632 -@@ -749,8 +807,14 @@ static void __init do_initcall_level(int level)
9633 +@@ -752,8 +810,14 @@ static void __init do_initcall_level(int level)
9634 level, level,
9635 &repair_env_string);
9636
9637 @@ -66157,7 +66149,7 @@ index b286730..9ff6135 100644
9638 }
9639
9640 static void __init do_initcalls(void)
9641 -@@ -784,8 +848,14 @@ static void __init do_pre_smp_initcalls(void)
9642 +@@ -787,8 +851,14 @@ static void __init do_pre_smp_initcalls(void)
9643 {
9644 initcall_t *fn;
9645
9646 @@ -66173,7 +66165,7 @@ index b286730..9ff6135 100644
9647 }
9648
9649 static void run_init_process(const char *init_filename)
9650 -@@ -867,7 +937,7 @@ static int __init kernel_init(void * unused)
9651 +@@ -870,7 +940,7 @@ static int __init kernel_init(void * unused)
9652 do_basic_setup();
9653
9654 /* Open the /dev/console on the rootfs, this should never fail */
9655 @@ -66182,7 +66174,7 @@ index b286730..9ff6135 100644
9656 printk(KERN_WARNING "Warning: unable to open an initial console.\n");
9657
9658 (void) sys_dup(0);
9659 -@@ -880,11 +950,13 @@ static int __init kernel_init(void * unused)
9660 +@@ -883,11 +953,13 @@ static int __init kernel_init(void * unused)
9661 if (!ramdisk_execute_command)
9662 ramdisk_execute_command = "/init";
9663
9664 @@ -72430,7 +72422,7 @@ index 5736170..8e04800 100644
9665 return 0;
9666 }
9667 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
9668 -index 3d64b36..dbab433 100644
9669 +index 3d64b36..c6ab69c 100644
9670 --- a/mm/mempolicy.c
9671 +++ b/mm/mempolicy.c
9672 @@ -655,6 +655,10 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
9673 @@ -72444,7 +72436,7 @@ index 3d64b36..dbab433 100644
9674 vma = find_vma(mm, start);
9675 if (!vma || vma->vm_start > start)
9676 return -EFAULT;
9677 -@@ -691,9 +695,18 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
9678 +@@ -691,9 +695,20 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
9679 if (err)
9680 goto out;
9681 }
9682 @@ -72455,15 +72447,17 @@ index 3d64b36..dbab433 100644
9683 +
9684 +#ifdef CONFIG_PAX_SEGMEXEC
9685 + vma_m = pax_find_mirror_vma(vma);
9686 -+ err = vma_replace_policy(vma_m, new_pol);
9687 -+ if (err)
9688 -+ goto out;
9689 ++ if (vma_m) {
9690 ++ err = vma_replace_policy(vma_m, new_pol);
9691 ++ if (err)
9692 ++ goto out;
9693 ++ }
9694 +#endif
9695 +
9696 }
9697
9698 out:
9699 -@@ -1147,6 +1160,17 @@ static long do_mbind(unsigned long start, unsigned long len,
9700 +@@ -1147,6 +1162,17 @@ static long do_mbind(unsigned long start, unsigned long len,
9701
9702 if (end < start)
9703 return -EINVAL;
9704 @@ -72481,7 +72475,7 @@ index 3d64b36..dbab433 100644
9705 if (end == start)
9706 return 0;
9707
9708 -@@ -1370,8 +1394,7 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
9709 +@@ -1370,8 +1396,7 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
9710 */
9711 tcred = __task_cred(task);
9712 if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) &&
9713 @@ -72491,7 +72485,7 @@ index 3d64b36..dbab433 100644
9714 rcu_read_unlock();
9715 err = -EPERM;
9716 goto out_put;
9717 -@@ -1402,6 +1425,15 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
9718 +@@ -1402,6 +1427,15 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
9719 goto out;
9720 }
9721
9722 @@ -74365,10 +74359,10 @@ index 926b466..b23df53 100644
9723 if (!mm || IS_ERR(mm)) {
9724 rc = IS_ERR(mm) ? PTR_ERR(mm) : -ESRCH;
9725 diff --git a/mm/rmap.c b/mm/rmap.c
9726 -index 0f3b7cd..c5652b6 100644
9727 +index aa95e59..b681a63 100644
9728 --- a/mm/rmap.c
9729 +++ b/mm/rmap.c
9730 -@@ -167,6 +167,10 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9731 +@@ -168,6 +168,10 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9732 struct anon_vma *anon_vma = vma->anon_vma;
9733 struct anon_vma_chain *avc;
9734
9735 @@ -74379,7 +74373,7 @@ index 0f3b7cd..c5652b6 100644
9736 might_sleep();
9737 if (unlikely(!anon_vma)) {
9738 struct mm_struct *mm = vma->vm_mm;
9739 -@@ -176,6 +180,12 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9740 +@@ -177,6 +181,12 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9741 if (!avc)
9742 goto out_enomem;
9743
9744 @@ -74392,7 +74386,7 @@ index 0f3b7cd..c5652b6 100644
9745 anon_vma = find_mergeable_anon_vma(vma);
9746 allocated = NULL;
9747 if (!anon_vma) {
9748 -@@ -189,6 +199,18 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9749 +@@ -190,6 +200,18 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9750 /* page_table_lock to protect against threads */
9751 spin_lock(&mm->page_table_lock);
9752 if (likely(!vma->anon_vma)) {
9753 @@ -74411,7 +74405,7 @@ index 0f3b7cd..c5652b6 100644
9754 vma->anon_vma = anon_vma;
9755 anon_vma_chain_link(vma, avc, anon_vma);
9756 allocated = NULL;
9757 -@@ -199,12 +221,24 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9758 +@@ -200,12 +222,24 @@ int anon_vma_prepare(struct vm_area_struct *vma)
9759
9760 if (unlikely(allocated))
9761 put_anon_vma(allocated);
9762 @@ -74436,7 +74430,7 @@ index 0f3b7cd..c5652b6 100644
9763 anon_vma_chain_free(avc);
9764 out_enomem:
9765 return -ENOMEM;
9766 -@@ -240,7 +274,7 @@ static inline void unlock_anon_vma_root(struct anon_vma *root)
9767 +@@ -241,7 +275,7 @@ static inline void unlock_anon_vma_root(struct anon_vma *root)
9768 * Attach the anon_vmas from src to dst.
9769 * Returns 0 on success, -ENOMEM on failure.
9770 */
9771 @@ -74445,7 +74439,7 @@ index 0f3b7cd..c5652b6 100644
9772 {
9773 struct anon_vma_chain *avc, *pavc;
9774 struct anon_vma *root = NULL;
9775 -@@ -318,7 +352,7 @@ void anon_vma_moveto_tail(struct vm_area_struct *dst)
9776 +@@ -319,7 +353,7 @@ void anon_vma_moveto_tail(struct vm_area_struct *dst)
9777 * the corresponding VMA in the parent process is attached to.
9778 * Returns 0 on success, non-zero on failure.
9779 */
9780 @@ -77901,7 +77895,7 @@ index bb61f77..3788d63 100644
9781 /* number of interfaces with corresponding FIF_ flags */
9782 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
9783 diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
9784 -index bfb57dc..77c4b81 100644
9785 +index c93d395..a305570 100644
9786 --- a/net/mac80211/iface.c
9787 +++ b/net/mac80211/iface.c
9788 @@ -454,7 +454,7 @@ static int ieee80211_do_open(struct net_device *dev, bool coming_up)
9789 @@ -78038,7 +78032,7 @@ index c97a065..ff61928 100644
9790
9791 return p;
9792 diff --git a/net/mac80211/util.c b/net/mac80211/util.c
9793 -index 39b82fe..5469ef4 100644
9794 +index c9b52f7..4da1014 100644
9795 --- a/net/mac80211/util.c
9796 +++ b/net/mac80211/util.c
9797 @@ -1251,7 +1251,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
9798 @@ -89442,32 +89436,6 @@ index 6789d78..4afd019e 100644
9799 + .endm
9800 +
9801 #endif
9802 -diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c
9803 -index af0f22f..9a7d479 100644
9804 ---- a/usr/gen_init_cpio.c
9805 -+++ b/usr/gen_init_cpio.c
9806 -@@ -303,7 +303,7 @@ static int cpio_mkfile(const char *name, const char *location,
9807 - int retval;
9808 - int rc = -1;
9809 - int namesize;
9810 -- int i;
9811 -+ unsigned int i;
9812 -
9813 - mode |= S_IFREG;
9814 -
9815 -@@ -392,9 +392,10 @@ static char *cpio_replace_env(char *new_location)
9816 - *env_var = *expanded = '\0';
9817 - strncat(env_var, start + 2, end - start - 2);
9818 - strncat(expanded, new_location, start - new_location);
9819 -- strncat(expanded, getenv(env_var), PATH_MAX);
9820 -- strncat(expanded, end + 1, PATH_MAX);
9821 -+ strncat(expanded, getenv(env_var), PATH_MAX - strlen(expanded));
9822 -+ strncat(expanded, end + 1, PATH_MAX - strlen(expanded));
9823 - strncpy(new_location, expanded, PATH_MAX);
9824 -+ new_location[PATH_MAX] = 0;
9825 - } else
9826 - break;
9827 - }
9828 diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
9829 index d617f69..6b445d2 100644
9830 --- a/virt/kvm/kvm_main.c
9831
9832 diff --git a/3.6.4/4430_grsec-remove-localversion-grsec.patch b/3.6.5/4430_grsec-remove-localversion-grsec.patch
9833 similarity index 100%
9834 rename from 3.6.4/4430_grsec-remove-localversion-grsec.patch
9835 rename to 3.6.5/4430_grsec-remove-localversion-grsec.patch
9836
9837 diff --git a/3.6.4/4435_grsec-mute-warnings.patch b/3.6.5/4435_grsec-mute-warnings.patch
9838 similarity index 100%
9839 rename from 3.6.4/4435_grsec-mute-warnings.patch
9840 rename to 3.6.5/4435_grsec-mute-warnings.patch
9841
9842 diff --git a/3.6.4/4440_grsec-remove-protected-paths.patch b/3.6.5/4440_grsec-remove-protected-paths.patch
9843 similarity index 100%
9844 rename from 3.6.4/4440_grsec-remove-protected-paths.patch
9845 rename to 3.6.5/4440_grsec-remove-protected-paths.patch
9846
9847 diff --git a/3.6.4/4450_grsec-kconfig-default-gids.patch b/3.6.5/4450_grsec-kconfig-default-gids.patch
9848 similarity index 100%
9849 rename from 3.6.4/4450_grsec-kconfig-default-gids.patch
9850 rename to 3.6.5/4450_grsec-kconfig-default-gids.patch
9851
9852 diff --git a/3.6.4/4465_selinux-avc_audit-log-curr_ip.patch b/3.6.5/4465_selinux-avc_audit-log-curr_ip.patch
9853 similarity index 100%
9854 rename from 3.6.4/4465_selinux-avc_audit-log-curr_ip.patch
9855 rename to 3.6.5/4465_selinux-avc_audit-log-curr_ip.patch
9856
9857 diff --git a/3.6.4/4470_disable-compat_vdso.patch b/3.6.5/4470_disable-compat_vdso.patch
9858 similarity index 100%
9859 rename from 3.6.4/4470_disable-compat_vdso.patch
9860 rename to 3.6.5/4470_disable-compat_vdso.patch