Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:3.14 commit in: /
Date: Tue, 08 Jul 2014 18:04:35
Message-Id: 1404842662.538f1ca65add21b1cfc539093d1702e52e170541.mpagano@gentoo
1 commit: 538f1ca65add21b1cfc539093d1702e52e170541
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 8 18:04:22 2014 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 8 18:04:22 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/linux-patches.git;a=commit;h=538f1ca6
7
8 Linux patch 3.14.11
9
10 ---
11 0000_README | 4 +
12 1010_linux-3.14.11.patch | 1804 ++++++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 1808 insertions(+)
14
15 diff --git a/0000_README b/0000_README
16 index b90f155..c719e74 100644
17 --- a/0000_README
18 +++ b/0000_README
19 @@ -82,6 +82,10 @@ Patch: 1009_linux-3.14.10.patch
20 From: http://www.kernel.org
21 Desc: Linux 3.14.10
22
23 +Patch: 1010_linux-3.14.11.patch
24 +From: http://www.kernel.org
25 +Desc: Linux 3.14.11
26 +
27 Patch: 1500_XATTR_USER_PREFIX.patch
28 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
29 Desc: Support for namespace user.pax.* on tmpfs.
30
31 diff --git a/1010_linux-3.14.11.patch b/1010_linux-3.14.11.patch
32 new file mode 100644
33 index 0000000..2f99b67
34 --- /dev/null
35 +++ b/1010_linux-3.14.11.patch
36 @@ -0,0 +1,1804 @@
37 +diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches
38 +index 26b1e31d5a13..1ec219a14904 100644
39 +--- a/Documentation/SubmittingPatches
40 ++++ b/Documentation/SubmittingPatches
41 +@@ -119,6 +119,20 @@ Example:
42 + platform_set_drvdata(), but left the variable "dev" unused,
43 + delete it.
44 +
45 ++If your patch fixes a bug in a specific commit, e.g. you found an issue using
46 ++git-bisect, please use the 'Fixes:' tag with the first 12 characters of the
47 ++SHA-1 ID, and the one line summary.
48 ++Example:
49 ++
50 ++ Fixes: e21d2170f366 ("video: remove unnecessary platform_set_drvdata()")
51 ++
52 ++The following git-config settings can be used to add a pretty format for
53 ++outputting the above style in the git log or git show commands
54 ++
55 ++ [core]
56 ++ abbrev = 12
57 ++ [pretty]
58 ++ fixes = Fixes: %h (\"%s\")
59 +
60 + 3) Separate your changes.
61 +
62 +@@ -430,7 +444,7 @@ person it names. This tag documents that potentially interested parties
63 + have been included in the discussion
64 +
65 +
66 +-14) Using Reported-by:, Tested-by:, Reviewed-by: and Suggested-by:
67 ++14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes:
68 +
69 + If this patch fixes a problem reported by somebody else, consider adding a
70 + Reported-by: tag to credit the reporter for their contribution. Please
71 +@@ -485,6 +499,12 @@ idea was not posted in a public forum. That said, if we diligently credit our
72 + idea reporters, they will, hopefully, be inspired to help us again in the
73 + future.
74 +
75 ++A Fixes: tag indicates that the patch fixes an issue in a previous commit. It
76 ++is used to make it easy to determine where a bug originated, which can help
77 ++review a bug fix. This tag also assists the stable kernel team in determining
78 ++which stable kernel versions should receive your fix. This is the preferred
79 ++method for indicating a bug fixed by the patch. See #2 above for more details.
80 ++
81 +
82 + 15) The canonical patch format
83 +
84 +diff --git a/Makefile b/Makefile
85 +index bd5d673ab57f..f1bbec5ece95 100644
86 +--- a/Makefile
87 ++++ b/Makefile
88 +@@ -1,6 +1,6 @@
89 + VERSION = 3
90 + PATCHLEVEL = 14
91 +-SUBLEVEL = 10
92 ++SUBLEVEL = 11
93 + EXTRAVERSION =
94 + NAME = Remembering Coco
95 +
96 +diff --git a/arch/arm/boot/dts/exynos5420.dtsi b/arch/arm/boot/dts/exynos5420.dtsi
97 +index 8db792b26f79..15eb8d4e4d3c 100644
98 +--- a/arch/arm/boot/dts/exynos5420.dtsi
99 ++++ b/arch/arm/boot/dts/exynos5420.dtsi
100 +@@ -323,6 +323,13 @@
101 + #dma-cells = <1>;
102 + #dma-channels = <8>;
103 + #dma-requests = <1>;
104 ++ /*
105 ++ * MDMA1 can support both secure and non-secure
106 ++ * AXI transactions. When this is enabled in the kernel
107 ++ * for boards that run in secure mode, we are getting
108 ++ * imprecise external aborts causing the kernel to oops.
109 ++ */
110 ++ status = "disabled";
111 + };
112 + };
113 +
114 +diff --git a/arch/mips/kernel/irq-msc01.c b/arch/mips/kernel/irq-msc01.c
115 +index fab40f7d2e03..ac9facc08694 100644
116 +--- a/arch/mips/kernel/irq-msc01.c
117 ++++ b/arch/mips/kernel/irq-msc01.c
118 +@@ -131,7 +131,7 @@ void __init init_msc_irqs(unsigned long icubase, unsigned int irqbase, msc_irqma
119 +
120 + board_bind_eic_interrupt = &msc_bind_eic_interrupt;
121 +
122 +- for (; nirq >= 0; nirq--, imp++) {
123 ++ for (; nirq > 0; nirq--, imp++) {
124 + int n = imp->im_irq;
125 +
126 + switch (imp->im_type) {
127 +diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
128 +index 5efce56f0df0..3e0ff8d0fbf9 100644
129 +--- a/arch/mips/kvm/kvm_mips.c
130 ++++ b/arch/mips/kvm/kvm_mips.c
131 +@@ -149,9 +149,7 @@ void kvm_mips_free_vcpus(struct kvm *kvm)
132 + if (kvm->arch.guest_pmap[i] != KVM_INVALID_PAGE)
133 + kvm_mips_release_pfn_clean(kvm->arch.guest_pmap[i]);
134 + }
135 +-
136 +- if (kvm->arch.guest_pmap)
137 +- kfree(kvm->arch.guest_pmap);
138 ++ kfree(kvm->arch.guest_pmap);
139 +
140 + kvm_for_each_vcpu(i, vcpu, kvm) {
141 + kvm_arch_vcpu_free(vcpu);
142 +@@ -389,12 +387,9 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
143 +
144 + kvm_mips_dump_stats(vcpu);
145 +
146 +- if (vcpu->arch.guest_ebase)
147 +- kfree(vcpu->arch.guest_ebase);
148 +-
149 +- if (vcpu->arch.kseg0_commpage)
150 +- kfree(vcpu->arch.kseg0_commpage);
151 +-
152 ++ kfree(vcpu->arch.guest_ebase);
153 ++ kfree(vcpu->arch.kseg0_commpage);
154 ++ kfree(vcpu);
155 + }
156 +
157 + void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
158 +diff --git a/arch/powerpc/include/asm/switch_to.h b/arch/powerpc/include/asm/switch_to.h
159 +index 0e83e7d8c73f..b5fad8afe837 100644
160 +--- a/arch/powerpc/include/asm/switch_to.h
161 ++++ b/arch/powerpc/include/asm/switch_to.h
162 +@@ -84,6 +84,8 @@ static inline void clear_task_ebb(struct task_struct *t)
163 + {
164 + #ifdef CONFIG_PPC_BOOK3S_64
165 + /* EBB perf events are not inherited, so clear all EBB state. */
166 ++ t->thread.ebbrr = 0;
167 ++ t->thread.ebbhr = 0;
168 + t->thread.bescr = 0;
169 + t->thread.mmcr2 = 0;
170 + t->thread.mmcr0 = 0;
171 +diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
172 +index 3ddf70276706..0616916b446a 100644
173 +--- a/arch/powerpc/include/asm/systbl.h
174 ++++ b/arch/powerpc/include/asm/systbl.h
175 +@@ -190,7 +190,7 @@ SYSCALL_SPU(getcwd)
176 + SYSCALL_SPU(capget)
177 + SYSCALL_SPU(capset)
178 + COMPAT_SYS(sigaltstack)
179 +-COMPAT_SYS_SPU(sendfile)
180 ++SYSX_SPU(sys_sendfile64,compat_sys_sendfile,sys_sendfile)
181 + SYSCALL(ni_syscall)
182 + SYSCALL(ni_syscall)
183 + PPC_SYS(vfork)
184 +diff --git a/arch/powerpc/include/uapi/asm/cputable.h b/arch/powerpc/include/uapi/asm/cputable.h
185 +index 5b7657959faa..de2c0e4ee1aa 100644
186 +--- a/arch/powerpc/include/uapi/asm/cputable.h
187 ++++ b/arch/powerpc/include/uapi/asm/cputable.h
188 +@@ -41,5 +41,6 @@
189 + #define PPC_FEATURE2_EBB 0x10000000
190 + #define PPC_FEATURE2_ISEL 0x08000000
191 + #define PPC_FEATURE2_TAR 0x04000000
192 ++#define PPC_FEATURE2_VEC_CRYPTO 0x02000000
193 +
194 + #endif /* _UAPI__ASM_POWERPC_CPUTABLE_H */
195 +diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
196 +index 6c8dd5da4de5..7ac1eab3ff8a 100644
197 +--- a/arch/powerpc/kernel/cputable.c
198 ++++ b/arch/powerpc/kernel/cputable.c
199 +@@ -109,7 +109,8 @@ extern void __restore_cpu_e6500(void);
200 + PPC_FEATURE_PSERIES_PERFMON_COMPAT)
201 + #define COMMON_USER2_POWER8 (PPC_FEATURE2_ARCH_2_07 | \
202 + PPC_FEATURE2_HTM_COMP | PPC_FEATURE2_DSCR | \
203 +- PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR)
204 ++ PPC_FEATURE2_ISEL | PPC_FEATURE2_TAR | \
205 ++ PPC_FEATURE2_VEC_CRYPTO)
206 + #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\
207 + PPC_FEATURE_TRUE_LE | \
208 + PPC_FEATURE_HAS_ALTIVEC_COMP)
209 +diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
210 +index 40bd7bd4e19a..8a8b722870a1 100644
211 +--- a/arch/powerpc/kernel/legacy_serial.c
212 ++++ b/arch/powerpc/kernel/legacy_serial.c
213 +@@ -48,6 +48,9 @@ static struct of_device_id legacy_serial_parents[] __initdata = {
214 + static unsigned int legacy_serial_count;
215 + static int legacy_serial_console = -1;
216 +
217 ++static const upf_t legacy_port_flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
218 ++ UPF_SHARE_IRQ | UPF_FIXED_PORT;
219 ++
220 + static unsigned int tsi_serial_in(struct uart_port *p, int offset)
221 + {
222 + unsigned int tmp;
223 +@@ -153,8 +156,6 @@ static int __init add_legacy_soc_port(struct device_node *np,
224 + {
225 + u64 addr;
226 + const __be32 *addrp;
227 +- upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ
228 +- | UPF_FIXED_PORT;
229 + struct device_node *tsi = of_get_parent(np);
230 +
231 + /* We only support ports that have a clock frequency properly
232 +@@ -185,9 +186,11 @@ static int __init add_legacy_soc_port(struct device_node *np,
233 + * IO port value. It will be fixed up later along with the irq
234 + */
235 + if (tsi && !strcmp(tsi->type, "tsi-bridge"))
236 +- return add_legacy_port(np, -1, UPIO_TSI, addr, addr, NO_IRQ, flags, 0);
237 ++ return add_legacy_port(np, -1, UPIO_TSI, addr, addr,
238 ++ NO_IRQ, legacy_port_flags, 0);
239 + else
240 +- return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags, 0);
241 ++ return add_legacy_port(np, -1, UPIO_MEM, addr, addr,
242 ++ NO_IRQ, legacy_port_flags, 0);
243 + }
244 +
245 + static int __init add_legacy_isa_port(struct device_node *np,
246 +@@ -233,7 +236,7 @@ static int __init add_legacy_isa_port(struct device_node *np,
247 +
248 + /* Add port, irq will be dealt with later */
249 + return add_legacy_port(np, index, UPIO_PORT, be32_to_cpu(reg[1]),
250 +- taddr, NO_IRQ, UPF_BOOT_AUTOCONF, 0);
251 ++ taddr, NO_IRQ, legacy_port_flags, 0);
252 +
253 + }
254 +
255 +@@ -306,7 +309,7 @@ static int __init add_legacy_pci_port(struct device_node *np,
256 + * IO port value. It will be fixed up later along with the irq
257 + */
258 + return add_legacy_port(np, index, iotype, base, addr, NO_IRQ,
259 +- UPF_BOOT_AUTOCONF, np != pci_dev);
260 ++ legacy_port_flags, np != pci_dev);
261 + }
262 + #endif
263 +
264 +diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
265 +index bc76cc6b419c..04aa4d3c7c05 100644
266 +--- a/arch/powerpc/kernel/setup-common.c
267 ++++ b/arch/powerpc/kernel/setup-common.c
268 +@@ -456,9 +456,17 @@ void __init smp_setup_cpu_maps(void)
269 + }
270 +
271 + for (j = 0; j < nthreads && cpu < nr_cpu_ids; j++) {
272 ++ bool avail;
273 ++
274 + DBG(" thread %d -> cpu %d (hard id %d)\n",
275 + j, cpu, be32_to_cpu(intserv[j]));
276 +- set_cpu_present(cpu, true);
277 ++
278 ++ avail = of_device_is_available(dn);
279 ++ if (!avail)
280 ++ avail = !of_property_match_string(dn,
281 ++ "enable-method", "spin-table");
282 ++
283 ++ set_cpu_present(cpu, avail);
284 + set_hard_smp_processor_id(cpu, be32_to_cpu(intserv[j]));
285 + set_cpu_possible(cpu, true);
286 + cpu++;
287 +diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
288 +index 57d4bada19bd..f8b994abb57f 100644
289 +--- a/arch/powerpc/kernel/time.c
290 ++++ b/arch/powerpc/kernel/time.c
291 +@@ -511,7 +511,7 @@ void timer_interrupt(struct pt_regs * regs)
292 + may_hard_irq_enable();
293 +
294 +
295 +-#if defined(CONFIG_PPC32) && defined(CONFIG_PMAC)
296 ++#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
297 + if (atomic_read(&ppc_n_lost_interrupts) != 0)
298 + do_IRQ(regs);
299 + #endif
300 +diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
301 +index c0511c27a733..412dd46dd0b7 100644
302 +--- a/arch/powerpc/lib/sstep.c
303 ++++ b/arch/powerpc/lib/sstep.c
304 +@@ -1470,7 +1470,7 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
305 + regs->gpr[rd] = byterev_4(val);
306 + goto ldst_done;
307 +
308 +-#ifdef CONFIG_PPC_CPU
309 ++#ifdef CONFIG_PPC_FPU
310 + case 535: /* lfsx */
311 + case 567: /* lfsux */
312 + if (!(regs->msr & MSR_FP))
313 +diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
314 +index d766d6ee33fe..6650699eb3b6 100644
315 +--- a/arch/powerpc/mm/hash_utils_64.c
316 ++++ b/arch/powerpc/mm/hash_utils_64.c
317 +@@ -960,6 +960,22 @@ void hash_failure_debug(unsigned long ea, unsigned long access,
318 + trap, vsid, ssize, psize, lpsize, pte);
319 + }
320 +
321 ++static void check_paca_psize(unsigned long ea, struct mm_struct *mm,
322 ++ int psize, bool user_region)
323 ++{
324 ++ if (user_region) {
325 ++ if (psize != get_paca_psize(ea)) {
326 ++ get_paca()->context = mm->context;
327 ++ slb_flush_and_rebolt();
328 ++ }
329 ++ } else if (get_paca()->vmalloc_sllp !=
330 ++ mmu_psize_defs[mmu_vmalloc_psize].sllp) {
331 ++ get_paca()->vmalloc_sllp =
332 ++ mmu_psize_defs[mmu_vmalloc_psize].sllp;
333 ++ slb_vmalloc_update();
334 ++ }
335 ++}
336 ++
337 + /* Result code is:
338 + * 0 - handled
339 + * 1 - normal page fault
340 +@@ -1081,6 +1097,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
341 + WARN_ON(1);
342 + }
343 + #endif
344 ++ check_paca_psize(ea, mm, psize, user_region);
345 ++
346 + goto bail;
347 + }
348 +
349 +@@ -1121,17 +1139,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
350 + #endif
351 + }
352 + }
353 +- if (user_region) {
354 +- if (psize != get_paca_psize(ea)) {
355 +- get_paca()->context = mm->context;
356 +- slb_flush_and_rebolt();
357 +- }
358 +- } else if (get_paca()->vmalloc_sllp !=
359 +- mmu_psize_defs[mmu_vmalloc_psize].sllp) {
360 +- get_paca()->vmalloc_sllp =
361 +- mmu_psize_defs[mmu_vmalloc_psize].sllp;
362 +- slb_vmalloc_update();
363 +- }
364 ++
365 ++ check_paca_psize(ea, mm, psize, user_region);
366 + #endif /* CONFIG_PPC_64K_PAGES */
367 +
368 + #ifdef CONFIG_PPC_HAS_HASH_64K
369 +diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
370 +index 8a8f0472d98f..83da53fde6b5 100644
371 +--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
372 ++++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
373 +@@ -464,6 +464,7 @@ static int pseries_eeh_get_state(struct eeh_pe *pe, int *state)
374 + } else {
375 + result = EEH_STATE_NOT_SUPPORT;
376 + }
377 ++ break;
378 + default:
379 + result = EEH_STATE_NOT_SUPPORT;
380 + }
381 +diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
382 +index 14fd6fd75a19..6205f0c434db 100644
383 +--- a/arch/x86/include/asm/ptrace.h
384 ++++ b/arch/x86/include/asm/ptrace.h
385 +@@ -231,6 +231,22 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
386 +
387 + #define ARCH_HAS_USER_SINGLE_STEP_INFO
388 +
389 ++/*
390 ++ * When hitting ptrace_stop(), we cannot return using SYSRET because
391 ++ * that does not restore the full CPU state, only a minimal set. The
392 ++ * ptracer can change arbitrary register values, which is usually okay
393 ++ * because the usual ptrace stops run off the signal delivery path which
394 ++ * forces IRET; however, ptrace_event() stops happen in arbitrary places
395 ++ * in the kernel and don't force IRET path.
396 ++ *
397 ++ * So force IRET path after a ptrace stop.
398 ++ */
399 ++#define arch_ptrace_stop_needed(code, info) \
400 ++({ \
401 ++ set_thread_flag(TIF_NOTIFY_RESUME); \
402 ++ false; \
403 ++})
404 ++
405 + struct user_desc;
406 + extern int do_get_thread_area(struct task_struct *p, int idx,
407 + struct user_desc __user *info);
408 +diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
409 +index a8939b98f9c3..4e763b0dbbfc 100644
410 +--- a/drivers/block/mtip32xx/mtip32xx.c
411 ++++ b/drivers/block/mtip32xx/mtip32xx.c
412 +@@ -1529,6 +1529,37 @@ static inline void ata_swap_string(u16 *buf, unsigned int len)
413 + be16_to_cpus(&buf[i]);
414 + }
415 +
416 ++static void mtip_set_timeout(struct driver_data *dd,
417 ++ struct host_to_dev_fis *fis,
418 ++ unsigned int *timeout, u8 erasemode)
419 ++{
420 ++ switch (fis->command) {
421 ++ case ATA_CMD_DOWNLOAD_MICRO:
422 ++ *timeout = 120000; /* 2 minutes */
423 ++ break;
424 ++ case ATA_CMD_SEC_ERASE_UNIT:
425 ++ case 0xFC:
426 ++ if (erasemode)
427 ++ *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
428 ++ else
429 ++ *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
430 ++ break;
431 ++ case ATA_CMD_STANDBYNOW1:
432 ++ *timeout = 120000; /* 2 minutes */
433 ++ break;
434 ++ case 0xF7:
435 ++ case 0xFA:
436 ++ *timeout = 60000; /* 60 seconds */
437 ++ break;
438 ++ case ATA_CMD_SMART:
439 ++ *timeout = 15000; /* 15 seconds */
440 ++ break;
441 ++ default:
442 ++ *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
443 ++ break;
444 ++ }
445 ++}
446 ++
447 + /*
448 + * Request the device identity information.
449 + *
450 +@@ -1644,6 +1675,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
451 + int rv;
452 + struct host_to_dev_fis fis;
453 + unsigned long start;
454 ++ unsigned int timeout;
455 +
456 + /* Build the FIS. */
457 + memset(&fis, 0, sizeof(struct host_to_dev_fis));
458 +@@ -1651,6 +1683,8 @@ static int mtip_standby_immediate(struct mtip_port *port)
459 + fis.opts = 1 << 7;
460 + fis.command = ATA_CMD_STANDBYNOW1;
461 +
462 ++ mtip_set_timeout(port->dd, &fis, &timeout, 0);
463 ++
464 + start = jiffies;
465 + rv = mtip_exec_internal_command(port,
466 + &fis,
467 +@@ -1659,7 +1693,7 @@ static int mtip_standby_immediate(struct mtip_port *port)
468 + 0,
469 + 0,
470 + GFP_ATOMIC,
471 +- 15000);
472 ++ timeout);
473 + dbg_printk(MTIP_DRV_NAME "Time taken to complete standby cmd: %d ms\n",
474 + jiffies_to_msecs(jiffies - start));
475 + if (rv)
476 +@@ -2202,36 +2236,6 @@ static unsigned int implicit_sector(unsigned char command,
477 + }
478 + return rv;
479 + }
480 +-static void mtip_set_timeout(struct driver_data *dd,
481 +- struct host_to_dev_fis *fis,
482 +- unsigned int *timeout, u8 erasemode)
483 +-{
484 +- switch (fis->command) {
485 +- case ATA_CMD_DOWNLOAD_MICRO:
486 +- *timeout = 120000; /* 2 minutes */
487 +- break;
488 +- case ATA_CMD_SEC_ERASE_UNIT:
489 +- case 0xFC:
490 +- if (erasemode)
491 +- *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
492 +- else
493 +- *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
494 +- break;
495 +- case ATA_CMD_STANDBYNOW1:
496 +- *timeout = 120000; /* 2 minutes */
497 +- break;
498 +- case 0xF7:
499 +- case 0xFA:
500 +- *timeout = 60000; /* 60 seconds */
501 +- break;
502 +- case ATA_CMD_SMART:
503 +- *timeout = 15000; /* 15 seconds */
504 +- break;
505 +- default:
506 +- *timeout = MTIP_IOCTL_COMMAND_TIMEOUT_MS;
507 +- break;
508 +- }
509 +-}
510 +
511 + /*
512 + * Executes a taskfile
513 +@@ -4479,6 +4483,57 @@ static DEFINE_HANDLER(5);
514 + static DEFINE_HANDLER(6);
515 + static DEFINE_HANDLER(7);
516 +
517 ++static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
518 ++{
519 ++ int pos;
520 ++ unsigned short pcie_dev_ctrl;
521 ++
522 ++ pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
523 ++ if (pos) {
524 ++ pci_read_config_word(pdev,
525 ++ pos + PCI_EXP_DEVCTL,
526 ++ &pcie_dev_ctrl);
527 ++ if (pcie_dev_ctrl & (1 << 11) ||
528 ++ pcie_dev_ctrl & (1 << 4)) {
529 ++ dev_info(&dd->pdev->dev,
530 ++ "Disabling ERO/No-Snoop on bridge device %04x:%04x\n",
531 ++ pdev->vendor, pdev->device);
532 ++ pcie_dev_ctrl &= ~(PCI_EXP_DEVCTL_NOSNOOP_EN |
533 ++ PCI_EXP_DEVCTL_RELAX_EN);
534 ++ pci_write_config_word(pdev,
535 ++ pos + PCI_EXP_DEVCTL,
536 ++ pcie_dev_ctrl);
537 ++ }
538 ++ }
539 ++}
540 ++
541 ++static void mtip_fix_ero_nosnoop(struct driver_data *dd, struct pci_dev *pdev)
542 ++{
543 ++ /*
544 ++ * This workaround is specific to AMD/ATI chipset with a PCI upstream
545 ++ * device with device id 0x5aXX
546 ++ */
547 ++ if (pdev->bus && pdev->bus->self) {
548 ++ if (pdev->bus->self->vendor == PCI_VENDOR_ID_ATI &&
549 ++ ((pdev->bus->self->device & 0xff00) == 0x5a00)) {
550 ++ mtip_disable_link_opts(dd, pdev->bus->self);
551 ++ } else {
552 ++ /* Check further up the topology */
553 ++ struct pci_dev *parent_dev = pdev->bus->self;
554 ++ if (parent_dev->bus &&
555 ++ parent_dev->bus->parent &&
556 ++ parent_dev->bus->parent->self &&
557 ++ parent_dev->bus->parent->self->vendor ==
558 ++ PCI_VENDOR_ID_ATI &&
559 ++ (parent_dev->bus->parent->self->device &
560 ++ 0xff00) == 0x5a00) {
561 ++ mtip_disable_link_opts(dd,
562 ++ parent_dev->bus->parent->self);
563 ++ }
564 ++ }
565 ++ }
566 ++}
567 ++
568 + /*
569 + * Called for each supported PCI device detected.
570 + *
571 +@@ -4630,6 +4685,8 @@ static int mtip_pci_probe(struct pci_dev *pdev,
572 + goto block_initialize_err;
573 + }
574 +
575 ++ mtip_fix_ero_nosnoop(dd, pdev);
576 ++
577 + /* Initialize the block layer. */
578 + rv = mtip_block_initialize(dd);
579 + if (rv < 0) {
580 +@@ -4933,13 +4990,13 @@ static int __init mtip_init(void)
581 + */
582 + static void __exit mtip_exit(void)
583 + {
584 +- debugfs_remove_recursive(dfs_parent);
585 +-
586 + /* Release the allocated major block device number. */
587 + unregister_blkdev(mtip_major, MTIP_DRV_NAME);
588 +
589 + /* Unregister the PCI driver. */
590 + pci_unregister_driver(&mtip_pci_driver);
591 ++
592 ++ debugfs_remove_recursive(dfs_parent);
593 + }
594 +
595 + MODULE_AUTHOR("Micron Technology, Inc");
596 +diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
597 +index f0d588f8859e..1acb99100556 100644
598 +--- a/drivers/infiniband/core/user_mad.c
599 ++++ b/drivers/infiniband/core/user_mad.c
600 +@@ -98,7 +98,7 @@ struct ib_umad_port {
601 +
602 + struct ib_umad_device {
603 + int start_port, end_port;
604 +- struct kref ref;
605 ++ struct kobject kobj;
606 + struct ib_umad_port port[0];
607 + };
608 +
609 +@@ -134,14 +134,18 @@ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
610 + static void ib_umad_add_one(struct ib_device *device);
611 + static void ib_umad_remove_one(struct ib_device *device);
612 +
613 +-static void ib_umad_release_dev(struct kref *ref)
614 ++static void ib_umad_release_dev(struct kobject *kobj)
615 + {
616 + struct ib_umad_device *dev =
617 +- container_of(ref, struct ib_umad_device, ref);
618 ++ container_of(kobj, struct ib_umad_device, kobj);
619 +
620 + kfree(dev);
621 + }
622 +
623 ++static struct kobj_type ib_umad_dev_ktype = {
624 ++ .release = ib_umad_release_dev,
625 ++};
626 ++
627 + static int hdr_size(struct ib_umad_file *file)
628 + {
629 + return file->use_pkey_index ? sizeof (struct ib_user_mad_hdr) :
630 +@@ -780,27 +784,19 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
631 + {
632 + struct ib_umad_port *port;
633 + struct ib_umad_file *file;
634 +- int ret;
635 ++ int ret = -ENXIO;
636 +
637 + port = container_of(inode->i_cdev, struct ib_umad_port, cdev);
638 +- if (port)
639 +- kref_get(&port->umad_dev->ref);
640 +- else
641 +- return -ENXIO;
642 +
643 + mutex_lock(&port->file_mutex);
644 +
645 +- if (!port->ib_dev) {
646 +- ret = -ENXIO;
647 ++ if (!port->ib_dev)
648 + goto out;
649 +- }
650 +
651 ++ ret = -ENOMEM;
652 + file = kzalloc(sizeof *file, GFP_KERNEL);
653 +- if (!file) {
654 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
655 +- ret = -ENOMEM;
656 ++ if (!file)
657 + goto out;
658 +- }
659 +
660 + mutex_init(&file->mutex);
661 + spin_lock_init(&file->send_lock);
662 +@@ -814,6 +810,13 @@ static int ib_umad_open(struct inode *inode, struct file *filp)
663 + list_add_tail(&file->port_list, &port->file_list);
664 +
665 + ret = nonseekable_open(inode, filp);
666 ++ if (ret) {
667 ++ list_del(&file->port_list);
668 ++ kfree(file);
669 ++ goto out;
670 ++ }
671 ++
672 ++ kobject_get(&port->umad_dev->kobj);
673 +
674 + out:
675 + mutex_unlock(&port->file_mutex);
676 +@@ -852,7 +855,7 @@ static int ib_umad_close(struct inode *inode, struct file *filp)
677 + mutex_unlock(&file->port->file_mutex);
678 +
679 + kfree(file);
680 +- kref_put(&dev->ref, ib_umad_release_dev);
681 ++ kobject_put(&dev->kobj);
682 +
683 + return 0;
684 + }
685 +@@ -880,10 +883,6 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
686 + int ret;
687 +
688 + port = container_of(inode->i_cdev, struct ib_umad_port, sm_cdev);
689 +- if (port)
690 +- kref_get(&port->umad_dev->ref);
691 +- else
692 +- return -ENXIO;
693 +
694 + if (filp->f_flags & O_NONBLOCK) {
695 + if (down_trylock(&port->sm_sem)) {
696 +@@ -898,17 +897,27 @@ static int ib_umad_sm_open(struct inode *inode, struct file *filp)
697 + }
698 +
699 + ret = ib_modify_port(port->ib_dev, port->port_num, 0, &props);
700 +- if (ret) {
701 +- up(&port->sm_sem);
702 +- goto fail;
703 +- }
704 ++ if (ret)
705 ++ goto err_up_sem;
706 +
707 + filp->private_data = port;
708 +
709 +- return nonseekable_open(inode, filp);
710 ++ ret = nonseekable_open(inode, filp);
711 ++ if (ret)
712 ++ goto err_clr_sm_cap;
713 ++
714 ++ kobject_get(&port->umad_dev->kobj);
715 ++
716 ++ return 0;
717 ++
718 ++err_clr_sm_cap:
719 ++ swap(props.set_port_cap_mask, props.clr_port_cap_mask);
720 ++ ib_modify_port(port->ib_dev, port->port_num, 0, &props);
721 ++
722 ++err_up_sem:
723 ++ up(&port->sm_sem);
724 +
725 + fail:
726 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
727 + return ret;
728 + }
729 +
730 +@@ -927,7 +936,7 @@ static int ib_umad_sm_close(struct inode *inode, struct file *filp)
731 +
732 + up(&port->sm_sem);
733 +
734 +- kref_put(&port->umad_dev->ref, ib_umad_release_dev);
735 ++ kobject_put(&port->umad_dev->kobj);
736 +
737 + return ret;
738 + }
739 +@@ -995,6 +1004,7 @@ static int find_overflow_devnum(void)
740 + }
741 +
742 + static int ib_umad_init_port(struct ib_device *device, int port_num,
743 ++ struct ib_umad_device *umad_dev,
744 + struct ib_umad_port *port)
745 + {
746 + int devnum;
747 +@@ -1027,6 +1037,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
748 +
749 + cdev_init(&port->cdev, &umad_fops);
750 + port->cdev.owner = THIS_MODULE;
751 ++ port->cdev.kobj.parent = &umad_dev->kobj;
752 + kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num);
753 + if (cdev_add(&port->cdev, base, 1))
754 + goto err_cdev;
755 +@@ -1045,6 +1056,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num,
756 + base += IB_UMAD_MAX_PORTS;
757 + cdev_init(&port->sm_cdev, &umad_sm_fops);
758 + port->sm_cdev.owner = THIS_MODULE;
759 ++ port->sm_cdev.kobj.parent = &umad_dev->kobj;
760 + kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num);
761 + if (cdev_add(&port->sm_cdev, base, 1))
762 + goto err_sm_cdev;
763 +@@ -1138,7 +1150,7 @@ static void ib_umad_add_one(struct ib_device *device)
764 + if (!umad_dev)
765 + return;
766 +
767 +- kref_init(&umad_dev->ref);
768 ++ kobject_init(&umad_dev->kobj, &ib_umad_dev_ktype);
769 +
770 + umad_dev->start_port = s;
771 + umad_dev->end_port = e;
772 +@@ -1146,7 +1158,8 @@ static void ib_umad_add_one(struct ib_device *device)
773 + for (i = s; i <= e; ++i) {
774 + umad_dev->port[i - s].umad_dev = umad_dev;
775 +
776 +- if (ib_umad_init_port(device, i, &umad_dev->port[i - s]))
777 ++ if (ib_umad_init_port(device, i, umad_dev,
778 ++ &umad_dev->port[i - s]))
779 + goto err;
780 + }
781 +
782 +@@ -1158,7 +1171,7 @@ err:
783 + while (--i >= s)
784 + ib_umad_kill_port(&umad_dev->port[i - s]);
785 +
786 +- kref_put(&umad_dev->ref, ib_umad_release_dev);
787 ++ kobject_put(&umad_dev->kobj);
788 + }
789 +
790 + static void ib_umad_remove_one(struct ib_device *device)
791 +@@ -1172,7 +1185,7 @@ static void ib_umad_remove_one(struct ib_device *device)
792 + for (i = 0; i <= umad_dev->end_port - umad_dev->start_port; ++i)
793 + ib_umad_kill_port(&umad_dev->port[i]);
794 +
795 +- kref_put(&umad_dev->ref, ib_umad_release_dev);
796 ++ kobject_put(&umad_dev->kobj);
797 + }
798 +
799 + static char *umad_devnode(struct device *dev, umode_t *mode)
800 +diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
801 +index e2f9a51f4a38..45802e97332e 100644
802 +--- a/drivers/infiniband/hw/ipath/ipath_diag.c
803 ++++ b/drivers/infiniband/hw/ipath/ipath_diag.c
804 +@@ -346,6 +346,10 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
805 + ret = -EFAULT;
806 + goto bail;
807 + }
808 ++ dp.len = odp.len;
809 ++ dp.unit = odp.unit;
810 ++ dp.data = odp.data;
811 ++ dp.pbc_wd = 0;
812 + } else {
813 + ret = -EINVAL;
814 + goto bail;
815 +diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
816 +index b1705ce6eb88..8c726f183980 100644
817 +--- a/drivers/infiniband/hw/mlx5/cq.c
818 ++++ b/drivers/infiniband/hw/mlx5/cq.c
819 +@@ -32,6 +32,7 @@
820 +
821 + #include <linux/kref.h>
822 + #include <rdma/ib_umem.h>
823 ++#include <rdma/ib_user_verbs.h>
824 + #include "mlx5_ib.h"
825 + #include "user.h"
826 +
827 +@@ -540,14 +541,24 @@ static int create_cq_user(struct mlx5_ib_dev *dev, struct ib_udata *udata,
828 + int *cqe_size, int *index, int *inlen)
829 + {
830 + struct mlx5_ib_create_cq ucmd;
831 ++ size_t ucmdlen;
832 + int page_shift;
833 + int npages;
834 + int ncont;
835 + int err;
836 +
837 +- if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd)))
838 ++ ucmdlen =
839 ++ (udata->inlen - sizeof(struct ib_uverbs_cmd_hdr) <
840 ++ sizeof(ucmd)) ? (sizeof(ucmd) -
841 ++ sizeof(ucmd.reserved)) : sizeof(ucmd);
842 ++
843 ++ if (ib_copy_from_udata(&ucmd, udata, ucmdlen))
844 + return -EFAULT;
845 +
846 ++ if (ucmdlen == sizeof(ucmd) &&
847 ++ ucmd.reserved != 0)
848 ++ return -EINVAL;
849 ++
850 + if (ucmd.cqe_size != 64 && ucmd.cqe_size != 128)
851 + return -EINVAL;
852 +
853 +diff --git a/drivers/infiniband/hw/mlx5/srq.c b/drivers/infiniband/hw/mlx5/srq.c
854 +index 210b3eaf188a..384af6dec5eb 100644
855 +--- a/drivers/infiniband/hw/mlx5/srq.c
856 ++++ b/drivers/infiniband/hw/mlx5/srq.c
857 +@@ -35,6 +35,7 @@
858 + #include <linux/mlx5/srq.h>
859 + #include <linux/slab.h>
860 + #include <rdma/ib_umem.h>
861 ++#include <rdma/ib_user_verbs.h>
862 +
863 + #include "mlx5_ib.h"
864 + #include "user.h"
865 +@@ -78,16 +79,27 @@ static int create_srq_user(struct ib_pd *pd, struct mlx5_ib_srq *srq,
866 + {
867 + struct mlx5_ib_dev *dev = to_mdev(pd->device);
868 + struct mlx5_ib_create_srq ucmd;
869 ++ size_t ucmdlen;
870 + int err;
871 + int npages;
872 + int page_shift;
873 + int ncont;
874 + u32 offset;
875 +
876 +- if (ib_copy_from_udata(&ucmd, udata, sizeof(ucmd))) {
877 ++ ucmdlen =
878 ++ (udata->inlen - sizeof(struct ib_uverbs_cmd_hdr) <
879 ++ sizeof(ucmd)) ? (sizeof(ucmd) -
880 ++ sizeof(ucmd.reserved)) : sizeof(ucmd);
881 ++
882 ++ if (ib_copy_from_udata(&ucmd, udata, ucmdlen)) {
883 + mlx5_ib_dbg(dev, "failed copy udata\n");
884 + return -EFAULT;
885 + }
886 ++
887 ++ if (ucmdlen == sizeof(ucmd) &&
888 ++ ucmd.reserved != 0)
889 ++ return -EINVAL;
890 ++
891 + srq->wq_sig = !!(ucmd.flags & MLX5_SRQ_FLAG_SIGNATURE);
892 +
893 + srq->umem = ib_umem_get(pd->uobject->context, ucmd.buf_addr, buf_size,
894 +diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h
895 +index 0f4f8e42a17f..d0ba264ac1ed 100644
896 +--- a/drivers/infiniband/hw/mlx5/user.h
897 ++++ b/drivers/infiniband/hw/mlx5/user.h
898 +@@ -91,6 +91,7 @@ struct mlx5_ib_create_cq {
899 + __u64 buf_addr;
900 + __u64 db_addr;
901 + __u32 cqe_size;
902 ++ __u32 reserved; /* explicit padding (optional on i386) */
903 + };
904 +
905 + struct mlx5_ib_create_cq_resp {
906 +@@ -109,6 +110,7 @@ struct mlx5_ib_create_srq {
907 + __u64 buf_addr;
908 + __u64 db_addr;
909 + __u32 flags;
910 ++ __u32 reserved; /* explicit padding (optional on i386) */
911 + };
912 +
913 + struct mlx5_ib_create_srq_resp {
914 +diff --git a/drivers/infiniband/hw/qib/qib_mad.c b/drivers/infiniband/hw/qib/qib_mad.c
915 +index ccb119143d20..1dd9fcbb7c9a 100644
916 +--- a/drivers/infiniband/hw/qib/qib_mad.c
917 ++++ b/drivers/infiniband/hw/qib/qib_mad.c
918 +@@ -1028,7 +1028,7 @@ static int set_pkeys(struct qib_devdata *dd, u8 port, u16 *pkeys)
919 +
920 + event.event = IB_EVENT_PKEY_CHANGE;
921 + event.device = &dd->verbs_dev.ibdev;
922 +- event.element.port_num = 1;
923 ++ event.element.port_num = port;
924 + ib_dispatch_event(&event);
925 + }
926 + return 0;
927 +diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
928 +index 529b6bcdca7a..e96c07ee6756 100644
929 +--- a/drivers/infiniband/ulp/srp/ib_srp.c
930 ++++ b/drivers/infiniband/ulp/srp/ib_srp.c
931 +@@ -1576,6 +1576,12 @@ err_unmap:
932 + err_iu:
933 + srp_put_tx_iu(target, iu, SRP_IU_CMD);
934 +
935 ++ /*
936 ++ * Avoid that the loops that iterate over the request ring can
937 ++ * encounter a dangling SCSI command pointer.
938 ++ */
939 ++ req->scmnd = NULL;
940 ++
941 + spin_lock_irqsave(&target->lock, flags);
942 + list_add(&req->list, &target->free_reqs);
943 +
944 +diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
945 +index 230cdcf8e6fe..233516aff595 100644
946 +--- a/drivers/input/mouse/elantech.c
947 ++++ b/drivers/input/mouse/elantech.c
948 +@@ -473,8 +473,15 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
949 + input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
950 + input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
951 + input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
952 +- input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
953 +- input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
954 ++
955 ++ /* For clickpads map both buttons to BTN_LEFT */
956 ++ if (etd->fw_version & 0x001000) {
957 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
958 ++ } else {
959 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
960 ++ input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
961 ++ }
962 ++
963 + input_report_abs(dev, ABS_PRESSURE, pres);
964 + input_report_abs(dev, ABS_TOOL_WIDTH, width);
965 +
966 +@@ -484,10 +491,17 @@ static void elantech_report_absolute_v3(struct psmouse *psmouse,
967 + static void elantech_input_sync_v4(struct psmouse *psmouse)
968 + {
969 + struct input_dev *dev = psmouse->dev;
970 ++ struct elantech_data *etd = psmouse->private;
971 + unsigned char *packet = psmouse->packet;
972 +
973 +- input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
974 +- input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
975 ++ /* For clickpads map both buttons to BTN_LEFT */
976 ++ if (etd->fw_version & 0x001000) {
977 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x03);
978 ++ } else {
979 ++ input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
980 ++ input_report_key(dev, BTN_RIGHT, packet[0] & 0x02);
981 ++ }
982 ++
983 + input_mt_report_pointer_emulation(dev, true);
984 + input_sync(dev);
985 + }
986 +@@ -835,7 +849,7 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
987 + if (etd->set_hw_resolution)
988 + etd->reg_10 = 0x0b;
989 + else
990 +- etd->reg_10 = 0x03;
991 ++ etd->reg_10 = 0x01;
992 +
993 + if (elantech_write_reg(psmouse, 0x10, etd->reg_10))
994 + rc = -1;
995 +@@ -1336,7 +1350,8 @@ static int elantech_reconnect(struct psmouse *psmouse)
996 + }
997 +
998 + /*
999 +- * Some hw_version 3 models go into error state when we try to set bit 3 of r10
1000 ++ * Some hw_version 3 models go into error state when we try to set
1001 ++ * bit 3 and/or bit 1 of r10.
1002 + */
1003 + static const struct dmi_system_id no_hw_res_dmi_table[] = {
1004 + #if defined(CONFIG_DMI) && defined(CONFIG_X86)
1005 +diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
1006 +index c5ec703c727e..ec772d962f06 100644
1007 +--- a/drivers/input/mouse/synaptics.c
1008 ++++ b/drivers/input/mouse/synaptics.c
1009 +@@ -347,15 +347,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
1010 + unsigned char resp[3];
1011 + int i;
1012 +
1013 +- for (i = 0; min_max_pnpid_table[i].pnp_ids; i++)
1014 +- if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
1015 +- priv->x_min = min_max_pnpid_table[i].x_min;
1016 +- priv->x_max = min_max_pnpid_table[i].x_max;
1017 +- priv->y_min = min_max_pnpid_table[i].y_min;
1018 +- priv->y_max = min_max_pnpid_table[i].y_max;
1019 +- return 0;
1020 +- }
1021 +-
1022 + if (SYN_ID_MAJOR(priv->identity) < 4)
1023 + return 0;
1024 +
1025 +@@ -366,6 +357,16 @@ static int synaptics_resolution(struct psmouse *psmouse)
1026 + }
1027 + }
1028 +
1029 ++ for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
1030 ++ if (matches_pnp_id(psmouse, min_max_pnpid_table[i].pnp_ids)) {
1031 ++ priv->x_min = min_max_pnpid_table[i].x_min;
1032 ++ priv->x_max = min_max_pnpid_table[i].x_max;
1033 ++ priv->y_min = min_max_pnpid_table[i].y_min;
1034 ++ priv->y_max = min_max_pnpid_table[i].y_max;
1035 ++ return 0;
1036 ++ }
1037 ++ }
1038 ++
1039 + if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
1040 + SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
1041 + if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
1042 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1043 +index 33bb970980d2..ed1b6db25b03 100644
1044 +--- a/drivers/pci/pci.c
1045 ++++ b/drivers/pci/pci.c
1046 +@@ -4102,7 +4102,7 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
1047 + u16 cmd;
1048 + int rc;
1049 +
1050 +- WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) & (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
1051 ++ WARN_ON((flags & PCI_VGA_STATE_CHANGE_DECODES) && (command_bits & ~(PCI_COMMAND_IO|PCI_COMMAND_MEMORY)));
1052 +
1053 + /* ARCH specific VGA enables */
1054 + rc = pci_set_vga_state_arch(dev, decode, command_bits, flags);
1055 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1056 +index 5cb726c193de..813f437f3ee8 100644
1057 +--- a/drivers/pci/quirks.c
1058 ++++ b/drivers/pci/quirks.c
1059 +@@ -2949,6 +2949,7 @@ static void disable_igfx_irq(struct pci_dev *dev)
1060 + }
1061 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
1062 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
1063 ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
1064 +
1065 + /*
1066 + * PCI devices which are on Intel chips can skip the 10ms delay
1067 +diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
1068 +index 22601c718b07..f329ad294fc0 100644
1069 +--- a/drivers/target/iscsi/iscsi_target.c
1070 ++++ b/drivers/target/iscsi/iscsi_target.c
1071 +@@ -1290,7 +1290,7 @@ iscsit_check_dataout_hdr(struct iscsi_conn *conn, unsigned char *buf,
1072 + if (cmd->data_direction != DMA_TO_DEVICE) {
1073 + pr_err("Command ITT: 0x%08x received DataOUT for a"
1074 + " NON-WRITE command.\n", cmd->init_task_tag);
1075 +- return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
1076 ++ return iscsit_dump_data_payload(conn, payload_length, 1);
1077 + }
1078 + se_cmd = &cmd->se_cmd;
1079 + iscsit_mod_dataout_timer(cmd);
1080 +diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
1081 +index cad6fdcc64da..d509aa74cfa1 100644
1082 +--- a/drivers/target/iscsi/iscsi_target_login.c
1083 ++++ b/drivers/target/iscsi/iscsi_target_login.c
1084 +@@ -1196,7 +1196,7 @@ old_sess_out:
1085 + static int __iscsi_target_login_thread(struct iscsi_np *np)
1086 + {
1087 + u8 *buffer, zero_tsih = 0;
1088 +- int ret = 0, rc, stop;
1089 ++ int ret = 0, rc;
1090 + struct iscsi_conn *conn = NULL;
1091 + struct iscsi_login *login;
1092 + struct iscsi_portal_group *tpg = NULL;
1093 +@@ -1210,6 +1210,9 @@ static int __iscsi_target_login_thread(struct iscsi_np *np)
1094 + if (np->np_thread_state == ISCSI_NP_THREAD_RESET) {
1095 + np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
1096 + complete(&np->np_restart_comp);
1097 ++ } else if (np->np_thread_state == ISCSI_NP_THREAD_SHUTDOWN) {
1098 ++ spin_unlock_bh(&np->np_thread_lock);
1099 ++ goto exit;
1100 + } else {
1101 + np->np_thread_state = ISCSI_NP_THREAD_ACTIVE;
1102 + }
1103 +@@ -1402,10 +1405,8 @@ old_sess_out:
1104 + }
1105 +
1106 + out:
1107 +- stop = kthread_should_stop();
1108 +- /* Wait for another socket.. */
1109 +- if (!stop)
1110 +- return 1;
1111 ++ return 1;
1112 ++
1113 + exit:
1114 + iscsi_stop_login_thread_timer(np);
1115 + spin_lock_bh(&np->np_thread_lock);
1116 +@@ -1422,7 +1423,7 @@ int iscsi_target_login_thread(void *arg)
1117 +
1118 + allow_signal(SIGINT);
1119 +
1120 +- while (!kthread_should_stop()) {
1121 ++ while (1) {
1122 + ret = __iscsi_target_login_thread(np);
1123 + /*
1124 + * We break and exit here unless another sock_accept() call
1125 +diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c
1126 +index e655b042ed18..ab77f80ead2b 100644
1127 +--- a/drivers/target/iscsi/iscsi_target_util.c
1128 ++++ b/drivers/target/iscsi/iscsi_target_util.c
1129 +@@ -1295,6 +1295,8 @@ int iscsit_tx_login_rsp(struct iscsi_conn *conn, u8 status_class, u8 status_deta
1130 + login->login_failed = 1;
1131 + iscsit_collect_login_stats(conn, status_class, status_detail);
1132 +
1133 ++ memset(&login->rsp[0], 0, ISCSI_HDR_LEN);
1134 ++
1135 + hdr = (struct iscsi_login_rsp *)&login->rsp[0];
1136 + hdr->opcode = ISCSI_OP_LOGIN_RSP;
1137 + hdr->status_class = status_class;
1138 +diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
1139 +index 26416c15d65c..6ea95d216eb8 100644
1140 +--- a/drivers/target/target_core_device.c
1141 ++++ b/drivers/target/target_core_device.c
1142 +@@ -616,6 +616,7 @@ void core_dev_unexport(
1143 + dev->export_count--;
1144 + spin_unlock(&hba->device_lock);
1145 +
1146 ++ lun->lun_sep = NULL;
1147 + lun->lun_se_dev = NULL;
1148 + }
1149 +
1150 +diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
1151 +index 9fa1f69dac13..61098cd5439e 100644
1152 +--- a/drivers/watchdog/ath79_wdt.c
1153 ++++ b/drivers/watchdog/ath79_wdt.c
1154 +@@ -20,6 +20,7 @@
1155 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1156 +
1157 + #include <linux/bitops.h>
1158 ++#include <linux/delay.h>
1159 + #include <linux/errno.h>
1160 + #include <linux/fs.h>
1161 + #include <linux/init.h>
1162 +@@ -91,6 +92,15 @@ static inline void ath79_wdt_keepalive(void)
1163 + static inline void ath79_wdt_enable(void)
1164 + {
1165 + ath79_wdt_keepalive();
1166 ++
1167 ++ /*
1168 ++ * Updating the TIMER register requires a few microseconds
1169 ++ * on the AR934x SoCs at least. Use a small delay to ensure
1170 ++ * that the TIMER register is updated within the hardware
1171 ++ * before enabling the watchdog.
1172 ++ */
1173 ++ udelay(2);
1174 ++
1175 + ath79_wdt_wr(WDOG_REG_CTRL, WDOG_CTRL_ACTION_FCR);
1176 + /* flush write */
1177 + ath79_wdt_rr(WDOG_REG_CTRL);
1178 +diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c
1179 +index 20dc73844737..d9c1a1601926 100644
1180 +--- a/drivers/watchdog/kempld_wdt.c
1181 ++++ b/drivers/watchdog/kempld_wdt.c
1182 +@@ -162,7 +162,7 @@ static int kempld_wdt_set_stage_timeout(struct kempld_wdt_data *wdt_data,
1183 + kempld_get_mutex(pld);
1184 + stage_cfg = kempld_read8(pld, KEMPLD_WDT_STAGE_CFG(stage->id));
1185 + stage_cfg &= ~STAGE_CFG_PRESCALER_MASK;
1186 +- stage_cfg |= STAGE_CFG_SET_PRESCALER(prescaler);
1187 ++ stage_cfg |= STAGE_CFG_SET_PRESCALER(PRESCALER_21);
1188 + kempld_write8(pld, KEMPLD_WDT_STAGE_CFG(stage->id), stage_cfg);
1189 + kempld_write32(pld, KEMPLD_WDT_STAGE_TIMEOUT(stage->id),
1190 + stage_timeout);
1191 +diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
1192 +index 3f786ce0a6f2..88bcdfb9f68f 100644
1193 +--- a/drivers/watchdog/sp805_wdt.c
1194 ++++ b/drivers/watchdog/sp805_wdt.c
1195 +@@ -60,7 +60,6 @@
1196 + * @adev: amba device structure of wdt
1197 + * @status: current status of wdt
1198 + * @load_val: load value to be set for current timeout
1199 +- * @timeout: current programmed timeout
1200 + */
1201 + struct sp805_wdt {
1202 + struct watchdog_device wdd;
1203 +@@ -69,7 +68,6 @@ struct sp805_wdt {
1204 + struct clk *clk;
1205 + struct amba_device *adev;
1206 + unsigned int load_val;
1207 +- unsigned int timeout;
1208 + };
1209 +
1210 + static bool nowayout = WATCHDOG_NOWAYOUT;
1211 +@@ -99,7 +97,7 @@ static int wdt_setload(struct watchdog_device *wdd, unsigned int timeout)
1212 + spin_lock(&wdt->lock);
1213 + wdt->load_val = load;
1214 + /* roundup timeout to closest positive integer value */
1215 +- wdt->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
1216 ++ wdd->timeout = div_u64((load + 1) * 2 + (rate / 2), rate);
1217 + spin_unlock(&wdt->lock);
1218 +
1219 + return 0;
1220 +diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
1221 +index 360114ae8b82..15f9d98627a4 100644
1222 +--- a/fs/nfs/inode.c
1223 ++++ b/fs/nfs/inode.c
1224 +@@ -1555,18 +1555,20 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1225 + inode->i_version = fattr->change_attr;
1226 + }
1227 + } else if (server->caps & NFS_CAP_CHANGE_ATTR)
1228 +- invalid |= save_cache_validity;
1229 ++ nfsi->cache_validity |= save_cache_validity;
1230 +
1231 + if (fattr->valid & NFS_ATTR_FATTR_MTIME) {
1232 + memcpy(&inode->i_mtime, &fattr->mtime, sizeof(inode->i_mtime));
1233 + } else if (server->caps & NFS_CAP_MTIME)
1234 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1235 ++ nfsi->cache_validity |= save_cache_validity &
1236 ++ (NFS_INO_INVALID_ATTR
1237 + | NFS_INO_REVAL_FORCED);
1238 +
1239 + if (fattr->valid & NFS_ATTR_FATTR_CTIME) {
1240 + memcpy(&inode->i_ctime, &fattr->ctime, sizeof(inode->i_ctime));
1241 + } else if (server->caps & NFS_CAP_CTIME)
1242 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1243 ++ nfsi->cache_validity |= save_cache_validity &
1244 ++ (NFS_INO_INVALID_ATTR
1245 + | NFS_INO_REVAL_FORCED);
1246 +
1247 + /* Check if our cached file size is stale */
1248 +@@ -1588,7 +1590,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1249 + (long long)new_isize);
1250 + }
1251 + } else
1252 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1253 ++ nfsi->cache_validity |= save_cache_validity &
1254 ++ (NFS_INO_INVALID_ATTR
1255 + | NFS_INO_REVAL_PAGECACHE
1256 + | NFS_INO_REVAL_FORCED);
1257 +
1258 +@@ -1596,7 +1599,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1259 + if (fattr->valid & NFS_ATTR_FATTR_ATIME)
1260 + memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
1261 + else if (server->caps & NFS_CAP_ATIME)
1262 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATIME
1263 ++ nfsi->cache_validity |= save_cache_validity &
1264 ++ (NFS_INO_INVALID_ATIME
1265 + | NFS_INO_REVAL_FORCED);
1266 +
1267 + if (fattr->valid & NFS_ATTR_FATTR_MODE) {
1268 +@@ -1607,7 +1611,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1269 + invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
1270 + }
1271 + } else if (server->caps & NFS_CAP_MODE)
1272 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1273 ++ nfsi->cache_validity |= save_cache_validity &
1274 ++ (NFS_INO_INVALID_ATTR
1275 + | NFS_INO_INVALID_ACCESS
1276 + | NFS_INO_INVALID_ACL
1277 + | NFS_INO_REVAL_FORCED);
1278 +@@ -1618,7 +1623,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1279 + inode->i_uid = fattr->uid;
1280 + }
1281 + } else if (server->caps & NFS_CAP_OWNER)
1282 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1283 ++ nfsi->cache_validity |= save_cache_validity &
1284 ++ (NFS_INO_INVALID_ATTR
1285 + | NFS_INO_INVALID_ACCESS
1286 + | NFS_INO_INVALID_ACL
1287 + | NFS_INO_REVAL_FORCED);
1288 +@@ -1629,7 +1635,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1289 + inode->i_gid = fattr->gid;
1290 + }
1291 + } else if (server->caps & NFS_CAP_OWNER_GROUP)
1292 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1293 ++ nfsi->cache_validity |= save_cache_validity &
1294 ++ (NFS_INO_INVALID_ATTR
1295 + | NFS_INO_INVALID_ACCESS
1296 + | NFS_INO_INVALID_ACL
1297 + | NFS_INO_REVAL_FORCED);
1298 +@@ -1642,7 +1649,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1299 + set_nlink(inode, fattr->nlink);
1300 + }
1301 + } else if (server->caps & NFS_CAP_NLINK)
1302 +- invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
1303 ++ nfsi->cache_validity |= save_cache_validity &
1304 ++ (NFS_INO_INVALID_ATTR
1305 + | NFS_INO_REVAL_FORCED);
1306 +
1307 + if (fattr->valid & NFS_ATTR_FATTR_SPACE_USED) {
1308 +diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
1309 +index b9a35c05b60f..5e992fc51e61 100644
1310 +--- a/fs/nfs/nfs4filelayout.c
1311 ++++ b/fs/nfs/nfs4filelayout.c
1312 +@@ -1330,7 +1330,7 @@ filelayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
1313 + struct nfs4_filelayout *flo;
1314 +
1315 + flo = kzalloc(sizeof(*flo), gfp_flags);
1316 +- return &flo->generic_hdr;
1317 ++ return flo != NULL ? &flo->generic_hdr : NULL;
1318 + }
1319 +
1320 + static void
1321 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
1322 +index 0deb32105ccf..27f5f858502b 100644
1323 +--- a/fs/nfs/nfs4state.c
1324 ++++ b/fs/nfs/nfs4state.c
1325 +@@ -1456,7 +1456,7 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
1326 + * server that doesn't support a grace period.
1327 + */
1328 + spin_lock(&sp->so_lock);
1329 +- write_seqcount_begin(&sp->so_reclaim_seqcount);
1330 ++ raw_write_seqcount_begin(&sp->so_reclaim_seqcount);
1331 + restart:
1332 + list_for_each_entry(state, &sp->so_states, open_states) {
1333 + if (!test_and_clear_bit(ops->state_flag_bit, &state->flags))
1334 +@@ -1519,13 +1519,13 @@ restart:
1335 + spin_lock(&sp->so_lock);
1336 + goto restart;
1337 + }
1338 +- write_seqcount_end(&sp->so_reclaim_seqcount);
1339 ++ raw_write_seqcount_end(&sp->so_reclaim_seqcount);
1340 + spin_unlock(&sp->so_lock);
1341 + return 0;
1342 + out_err:
1343 + nfs4_put_open_state(state);
1344 + spin_lock(&sp->so_lock);
1345 +- write_seqcount_end(&sp->so_reclaim_seqcount);
1346 ++ raw_write_seqcount_end(&sp->so_reclaim_seqcount);
1347 + spin_unlock(&sp->so_lock);
1348 + return status;
1349 + }
1350 +diff --git a/fs/nfs/super.c b/fs/nfs/super.c
1351 +index 910ed906eb82..05c3a6e6518d 100644
1352 +--- a/fs/nfs/super.c
1353 ++++ b/fs/nfs/super.c
1354 +@@ -2246,6 +2246,7 @@ nfs_remount(struct super_block *sb, int *flags, char *raw_data)
1355 + data->nfs_server.addrlen = nfss->nfs_client->cl_addrlen;
1356 + data->version = nfsvers;
1357 + data->minorversion = nfss->nfs_client->cl_minorversion;
1358 ++ data->net = current->nsproxy->net_ns;
1359 + memcpy(&data->nfs_server.address, &nfss->nfs_client->cl_addr,
1360 + data->nfs_server.addrlen);
1361 +
1362 +diff --git a/fs/nfs/write.c b/fs/nfs/write.c
1363 +index 9a3b6a4cd6b9..aaa16b31e21e 100644
1364 +--- a/fs/nfs/write.c
1365 ++++ b/fs/nfs/write.c
1366 +@@ -913,12 +913,14 @@ static bool nfs_write_pageuptodate(struct page *page, struct inode *inode)
1367 +
1368 + if (nfs_have_delegated_attributes(inode))
1369 + goto out;
1370 +- if (nfsi->cache_validity & (NFS_INO_INVALID_DATA|NFS_INO_REVAL_PAGECACHE))
1371 ++ if (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE)
1372 + return false;
1373 + smp_rmb();
1374 + if (test_bit(NFS_INO_INVALIDATING, &nfsi->flags))
1375 + return false;
1376 + out:
1377 ++ if (nfsi->cache_validity & NFS_INO_INVALID_DATA)
1378 ++ return false;
1379 + return PageUptodate(page) != 0;
1380 + }
1381 +
1382 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1383 +index 1693fd93fa58..34d2a1f2f400 100644
1384 +--- a/fs/nfsd/nfs4state.c
1385 ++++ b/fs/nfsd/nfs4state.c
1386 +@@ -3723,7 +3723,7 @@ nfsd4_free_lock_stateid(struct nfs4_ol_stateid *stp)
1387 + * correspondance, and we have to delete the lockowner when we
1388 + * delete the lock stateid:
1389 + */
1390 +- unhash_lockowner(lo);
1391 ++ release_lockowner(lo);
1392 + return nfs_ok;
1393 + }
1394 +
1395 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1396 +index 16e8fa71eb84..bc11bf68ec7f 100644
1397 +--- a/fs/nfsd/nfs4xdr.c
1398 ++++ b/fs/nfsd/nfs4xdr.c
1399 +@@ -2096,8 +2096,8 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
1400 + err = vfs_getattr(&path, &stat);
1401 + if (err)
1402 + goto out_nfserr;
1403 +- if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
1404 +- FATTR4_WORD0_MAXNAME)) ||
1405 ++ if ((bmval0 & (FATTR4_WORD0_FILES_AVAIL | FATTR4_WORD0_FILES_FREE |
1406 ++ FATTR4_WORD0_FILES_TOTAL | FATTR4_WORD0_MAXNAME)) ||
1407 + (bmval1 & (FATTR4_WORD1_SPACE_AVAIL | FATTR4_WORD1_SPACE_FREE |
1408 + FATTR4_WORD1_SPACE_TOTAL))) {
1409 + err = vfs_statfs(&path, &statfs);
1410 +diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
1411 +index ad62bdbb451e..1e4cf9d73130 100644
1412 +--- a/fs/reiserfs/inode.c
1413 ++++ b/fs/reiserfs/inode.c
1414 +@@ -3220,8 +3220,14 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
1415 + attr->ia_size != i_size_read(inode)) {
1416 + error = inode_newsize_ok(inode, attr->ia_size);
1417 + if (!error) {
1418 ++ /*
1419 ++ * Could race against reiserfs_file_release
1420 ++ * if called from NFS, so take tailpack mutex.
1421 ++ */
1422 ++ mutex_lock(&REISERFS_I(inode)->tailpack);
1423 + truncate_setsize(inode, attr->ia_size);
1424 +- reiserfs_vfs_truncate_file(inode);
1425 ++ reiserfs_truncate_file(inode, 1);
1426 ++ mutex_unlock(&REISERFS_I(inode)->tailpack);
1427 + }
1428 + }
1429 +
1430 +diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
1431 +index 123c79b7261e..b56eb6275744 100644
1432 +--- a/fs/ubifs/file.c
1433 ++++ b/fs/ubifs/file.c
1434 +@@ -1525,8 +1525,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma,
1435 + }
1436 +
1437 + wait_for_stable_page(page);
1438 +- unlock_page(page);
1439 +- return 0;
1440 ++ return VM_FAULT_LOCKED;
1441 +
1442 + out_unlock:
1443 + unlock_page(page);
1444 +diff --git a/fs/ubifs/shrinker.c b/fs/ubifs/shrinker.c
1445 +index f35135e28e96..9a9fb94a41c6 100644
1446 +--- a/fs/ubifs/shrinker.c
1447 ++++ b/fs/ubifs/shrinker.c
1448 +@@ -128,7 +128,6 @@ static int shrink_tnc(struct ubifs_info *c, int nr, int age, int *contention)
1449 + freed = ubifs_destroy_tnc_subtree(znode);
1450 + atomic_long_sub(freed, &ubifs_clean_zn_cnt);
1451 + atomic_long_sub(freed, &c->clean_zn_cnt);
1452 +- ubifs_assert(atomic_long_read(&c->clean_zn_cnt) >= 0);
1453 + total_freed += freed;
1454 + znode = zprev;
1455 + }
1456 +diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
1457 +index f96c05669a9e..c6ff3cf5a5bb 100644
1458 +--- a/fs/xfs/xfs_mount.c
1459 ++++ b/fs/xfs/xfs_mount.c
1460 +@@ -320,8 +320,19 @@ reread:
1461 + /*
1462 + * Initialize the mount structure from the superblock.
1463 + */
1464 +- xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
1465 +- xfs_sb_quota_from_disk(&mp->m_sb);
1466 ++ xfs_sb_from_disk(sbp, XFS_BUF_TO_SBP(bp));
1467 ++ xfs_sb_quota_from_disk(sbp);
1468 ++
1469 ++ /*
1470 ++ * If we haven't validated the superblock, do so now before we try
1471 ++ * to check the sector size and reread the superblock appropriately.
1472 ++ */
1473 ++ if (sbp->sb_magicnum != XFS_SB_MAGIC) {
1474 ++ if (loud)
1475 ++ xfs_warn(mp, "Invalid superblock magic number");
1476 ++ error = EINVAL;
1477 ++ goto release_buf;
1478 ++ }
1479 +
1480 + /*
1481 + * We must be able to do sector-sized and sector-aligned IO.
1482 +@@ -334,11 +345,11 @@ reread:
1483 + goto release_buf;
1484 + }
1485 +
1486 +- /*
1487 +- * Re-read the superblock so the buffer is correctly sized,
1488 +- * and properly verified.
1489 +- */
1490 + if (buf_ops == NULL) {
1491 ++ /*
1492 ++ * Re-read the superblock so the buffer is correctly sized,
1493 ++ * and properly verified.
1494 ++ */
1495 + xfs_buf_relse(bp);
1496 + sector_size = sbp->sb_sectsize;
1497 + buf_ops = loud ? &xfs_sb_buf_ops : &xfs_sb_quiet_buf_ops;
1498 +diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h
1499 +index 077904c8b70d..cc79eff4a1ad 100644
1500 +--- a/include/linux/ptrace.h
1501 ++++ b/include/linux/ptrace.h
1502 +@@ -334,6 +334,9 @@ static inline void user_single_step_siginfo(struct task_struct *tsk,
1503 + * calling arch_ptrace_stop() when it would be superfluous. For example,
1504 + * if the thread has not been back to user mode since the last stop, the
1505 + * thread state might indicate that nothing needs to be done.
1506 ++ *
1507 ++ * This is guaranteed to be invoked once before a task stops for ptrace and
1508 ++ * may include arch-specific operations necessary prior to a ptrace stop.
1509 + */
1510 + #define arch_ptrace_stop_needed(code, info) (0)
1511 + #endif
1512 +diff --git a/include/trace/syscall.h b/include/trace/syscall.h
1513 +index fed853f3d7aa..9674145e2f6a 100644
1514 +--- a/include/trace/syscall.h
1515 ++++ b/include/trace/syscall.h
1516 +@@ -4,6 +4,7 @@
1517 + #include <linux/tracepoint.h>
1518 + #include <linux/unistd.h>
1519 + #include <linux/ftrace_event.h>
1520 ++#include <linux/thread_info.h>
1521 +
1522 + #include <asm/ptrace.h>
1523 +
1524 +@@ -32,4 +33,18 @@ struct syscall_metadata {
1525 + struct ftrace_event_call *exit_event;
1526 + };
1527 +
1528 ++#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
1529 ++static inline void syscall_tracepoint_update(struct task_struct *p)
1530 ++{
1531 ++ if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
1532 ++ set_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
1533 ++ else
1534 ++ clear_tsk_thread_flag(p, TIF_SYSCALL_TRACEPOINT);
1535 ++}
1536 ++#else
1537 ++static inline void syscall_tracepoint_update(struct task_struct *p)
1538 ++{
1539 ++}
1540 ++#endif
1541 ++
1542 + #endif /* _TRACE_SYSCALL_H */
1543 +diff --git a/kernel/fork.c b/kernel/fork.c
1544 +index 45da005c9961..c44bff8097f5 100644
1545 +--- a/kernel/fork.c
1546 ++++ b/kernel/fork.c
1547 +@@ -1484,7 +1484,9 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1548 +
1549 + total_forks++;
1550 + spin_unlock(&current->sighand->siglock);
1551 ++ syscall_tracepoint_update(p);
1552 + write_unlock_irq(&tasklist_lock);
1553 ++
1554 + proc_fork_connector(p);
1555 + cgroup_post_fork(p);
1556 + if (clone_flags & CLONE_THREAD)
1557 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1558 +index 24c1f2382557..f0831c22760c 100644
1559 +--- a/kernel/trace/trace.c
1560 ++++ b/kernel/trace/trace.c
1561 +@@ -1449,12 +1449,12 @@ static void tracing_stop_tr(struct trace_array *tr)
1562 +
1563 + void trace_stop_cmdline_recording(void);
1564 +
1565 +-static void trace_save_cmdline(struct task_struct *tsk)
1566 ++static int trace_save_cmdline(struct task_struct *tsk)
1567 + {
1568 + unsigned pid, idx;
1569 +
1570 + if (!tsk->pid || unlikely(tsk->pid > PID_MAX_DEFAULT))
1571 +- return;
1572 ++ return 0;
1573 +
1574 + /*
1575 + * It's not the end of the world if we don't get
1576 +@@ -1463,7 +1463,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
1577 + * so if we miss here, then better luck next time.
1578 + */
1579 + if (!arch_spin_trylock(&trace_cmdline_lock))
1580 +- return;
1581 ++ return 0;
1582 +
1583 + idx = map_pid_to_cmdline[tsk->pid];
1584 + if (idx == NO_CMDLINE_MAP) {
1585 +@@ -1488,6 +1488,8 @@ static void trace_save_cmdline(struct task_struct *tsk)
1586 + memcpy(&saved_cmdlines[idx], tsk->comm, TASK_COMM_LEN);
1587 +
1588 + arch_spin_unlock(&trace_cmdline_lock);
1589 ++
1590 ++ return 1;
1591 + }
1592 +
1593 + void trace_find_cmdline(int pid, char comm[])
1594 +@@ -1529,9 +1531,8 @@ void tracing_record_cmdline(struct task_struct *tsk)
1595 + if (!__this_cpu_read(trace_cmdline_save))
1596 + return;
1597 +
1598 +- __this_cpu_write(trace_cmdline_save, false);
1599 +-
1600 +- trace_save_cmdline(tsk);
1601 ++ if (trace_save_cmdline(tsk))
1602 ++ __this_cpu_write(trace_cmdline_save, false);
1603 + }
1604 +
1605 + void
1606 +diff --git a/kernel/watchdog.c b/kernel/watchdog.c
1607 +index 4431610f049a..c9b6f01bf853 100644
1608 +--- a/kernel/watchdog.c
1609 ++++ b/kernel/watchdog.c
1610 +@@ -524,10 +524,8 @@ static void update_timers_all_cpus(void)
1611 + int cpu;
1612 +
1613 + get_online_cpus();
1614 +- preempt_disable();
1615 + for_each_online_cpu(cpu)
1616 + update_timers(cpu);
1617 +- preempt_enable();
1618 + put_online_cpus();
1619 + }
1620 +
1621 +diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
1622 +index b74da447e81e..7a85967060a5 100644
1623 +--- a/lib/lz4/lz4_decompress.c
1624 ++++ b/lib/lz4/lz4_decompress.c
1625 +@@ -192,6 +192,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
1626 + int s = 255;
1627 + while ((ip < iend) && (s == 255)) {
1628 + s = *ip++;
1629 ++ if (unlikely(length > (size_t)(length + s)))
1630 ++ goto _output_error;
1631 + length += s;
1632 + }
1633 + }
1634 +@@ -232,6 +234,8 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
1635 + if (length == ML_MASK) {
1636 + while (ip < iend) {
1637 + int s = *ip++;
1638 ++ if (unlikely(length > (size_t)(length + s)))
1639 ++ goto _output_error;
1640 + length += s;
1641 + if (s == 255)
1642 + continue;
1643 +@@ -284,7 +288,7 @@ static int lz4_uncompress_unknownoutputsize(const char *source, char *dest,
1644 +
1645 + /* write overflow error detected */
1646 + _output_error:
1647 +- return (int) (-(((char *) ip) - source));
1648 ++ return -1;
1649 + }
1650 +
1651 + int lz4_decompress(const unsigned char *src, size_t *src_len,
1652 +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
1653 +index 4f26ee46b51f..3d2d2c8108ca 100644
1654 +--- a/net/netfilter/ipvs/ip_vs_core.c
1655 ++++ b/net/netfilter/ipvs/ip_vs_core.c
1656 +@@ -1392,15 +1392,19 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1657 +
1658 + if (ipip) {
1659 + __be32 info = ic->un.gateway;
1660 ++ __u8 type = ic->type;
1661 ++ __u8 code = ic->code;
1662 +
1663 + /* Update the MTU */
1664 + if (ic->type == ICMP_DEST_UNREACH &&
1665 + ic->code == ICMP_FRAG_NEEDED) {
1666 + struct ip_vs_dest *dest = cp->dest;
1667 + u32 mtu = ntohs(ic->un.frag.mtu);
1668 ++ __be16 frag_off = cih->frag_off;
1669 +
1670 + /* Strip outer IP and ICMP, go to IPIP header */
1671 +- __skb_pull(skb, ihl + sizeof(_icmph));
1672 ++ if (pskb_pull(skb, ihl + sizeof(_icmph)) == NULL)
1673 ++ goto ignore_ipip;
1674 + offset2 -= ihl + sizeof(_icmph);
1675 + skb_reset_network_header(skb);
1676 + IP_VS_DBG(12, "ICMP for IPIP %pI4->%pI4: mtu=%u\n",
1677 +@@ -1408,7 +1412,7 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1678 + ipv4_update_pmtu(skb, dev_net(skb->dev),
1679 + mtu, 0, 0, 0, 0);
1680 + /* Client uses PMTUD? */
1681 +- if (!(cih->frag_off & htons(IP_DF)))
1682 ++ if (!(frag_off & htons(IP_DF)))
1683 + goto ignore_ipip;
1684 + /* Prefer the resulting PMTU */
1685 + if (dest) {
1686 +@@ -1427,12 +1431,13 @@ ip_vs_in_icmp(struct sk_buff *skb, int *related, unsigned int hooknum)
1687 + /* Strip outer IP, ICMP and IPIP, go to IP header of
1688 + * original request.
1689 + */
1690 +- __skb_pull(skb, offset2);
1691 ++ if (pskb_pull(skb, offset2) == NULL)
1692 ++ goto ignore_ipip;
1693 + skb_reset_network_header(skb);
1694 + IP_VS_DBG(12, "Sending ICMP for %pI4->%pI4: t=%u, c=%u, i=%u\n",
1695 + &ip_hdr(skb)->saddr, &ip_hdr(skb)->daddr,
1696 +- ic->type, ic->code, ntohl(info));
1697 +- icmp_send(skb, ic->type, ic->code, info);
1698 ++ type, code, ntohl(info));
1699 ++ icmp_send(skb, type, code, info);
1700 + /* ICMP can be shorter but anyways, account it */
1701 + ip_vs_out_stats(cp, skb);
1702 +
1703 +diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
1704 +index 06c6ff0cb911..a4acaf2bcf18 100644
1705 +--- a/net/sunrpc/svc_xprt.c
1706 ++++ b/net/sunrpc/svc_xprt.c
1707 +@@ -730,6 +730,8 @@ static int svc_handle_xprt(struct svc_rqst *rqstp, struct svc_xprt *xprt)
1708 + newxpt = xprt->xpt_ops->xpo_accept(xprt);
1709 + if (newxpt)
1710 + svc_add_new_temp_xprt(serv, newxpt);
1711 ++ else
1712 ++ module_put(xprt->xpt_class->xcl_owner);
1713 + } else if (xprt->xpt_ops->xpo_has_wspace(xprt)) {
1714 + /* XPT_DATA|XPT_DEFERRED case: */
1715 + dprintk("svc: server %p, pool %u, transport %p, inuse=%d\n",
1716 +diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
1717 +index 9d1421e63ff8..49b582a225b0 100644
1718 +--- a/scripts/recordmcount.h
1719 ++++ b/scripts/recordmcount.h
1720 +@@ -163,11 +163,11 @@ static int mcount_adjust = 0;
1721 +
1722 + static int MIPS_is_fake_mcount(Elf_Rel const *rp)
1723 + {
1724 +- static Elf_Addr old_r_offset;
1725 ++ static Elf_Addr old_r_offset = ~(Elf_Addr)0;
1726 + Elf_Addr current_r_offset = _w(rp->r_offset);
1727 + int is_fake;
1728 +
1729 +- is_fake = old_r_offset &&
1730 ++ is_fake = (old_r_offset != ~(Elf_Addr)0) &&
1731 + (current_r_offset - old_r_offset == MIPS_FAKEMCOUNT_OFFSET);
1732 + old_r_offset = current_r_offset;
1733 +
1734 +diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1735 +index ce5b339d9333..3abfe2a642ec 100644
1736 +--- a/sound/pci/hda/patch_hdmi.c
1737 ++++ b/sound/pci/hda/patch_hdmi.c
1738 +@@ -2165,7 +2165,7 @@ static int generic_hdmi_resume(struct hda_codec *codec)
1739 + struct hdmi_spec *spec = codec->spec;
1740 + int pin_idx;
1741 +
1742 +- generic_hdmi_init(codec);
1743 ++ codec->patch_ops.init(codec);
1744 + snd_hda_codec_resume_amp(codec);
1745 + snd_hda_codec_resume_cache(codec);
1746 +
1747 +diff --git a/sound/usb/card.c b/sound/usb/card.c
1748 +index d979050e6a6a..af1956042c9e 100644
1749 +--- a/sound/usb/card.c
1750 ++++ b/sound/usb/card.c
1751 +@@ -304,6 +304,11 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
1752 +
1753 + static int snd_usb_audio_free(struct snd_usb_audio *chip)
1754 + {
1755 ++ struct list_head *p, *n;
1756 ++
1757 ++ list_for_each_safe(p, n, &chip->ep_list)
1758 ++ snd_usb_endpoint_free(p);
1759 ++
1760 + mutex_destroy(&chip->mutex);
1761 + kfree(chip);
1762 + return 0;
1763 +@@ -580,7 +585,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
1764 + struct snd_usb_audio *chip)
1765 + {
1766 + struct snd_card *card;
1767 +- struct list_head *p, *n;
1768 ++ struct list_head *p;
1769 +
1770 + if (chip == (void *)-1L)
1771 + return;
1772 +@@ -593,14 +598,16 @@ static void snd_usb_audio_disconnect(struct usb_device *dev,
1773 + mutex_lock(&register_mutex);
1774 + chip->num_interfaces--;
1775 + if (chip->num_interfaces <= 0) {
1776 ++ struct snd_usb_endpoint *ep;
1777 ++
1778 + snd_card_disconnect(card);
1779 + /* release the pcm resources */
1780 + list_for_each(p, &chip->pcm_list) {
1781 + snd_usb_stream_disconnect(p);
1782 + }
1783 + /* release the endpoint resources */
1784 +- list_for_each_safe(p, n, &chip->ep_list) {
1785 +- snd_usb_endpoint_free(p);
1786 ++ list_for_each_entry(ep, &chip->ep_list, list) {
1787 ++ snd_usb_endpoint_release(ep);
1788 + }
1789 + /* release the midi resources */
1790 + list_for_each(p, &chip->midi_list) {
1791 +diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
1792 +index 814430fec6a2..105ece3c14e3 100644
1793 +--- a/sound/usb/endpoint.c
1794 ++++ b/sound/usb/endpoint.c
1795 +@@ -981,19 +981,30 @@ void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
1796 + }
1797 +
1798 + /**
1799 ++ * snd_usb_endpoint_release: Tear down an snd_usb_endpoint
1800 ++ *
1801 ++ * @ep: the endpoint to release
1802 ++ *
1803 ++ * This function does not care for the endpoint's use count but will tear
1804 ++ * down all the streaming URBs immediately.
1805 ++ */
1806 ++void snd_usb_endpoint_release(struct snd_usb_endpoint *ep)
1807 ++{
1808 ++ release_urbs(ep, 1);
1809 ++}
1810 ++
1811 ++/**
1812 + * snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint
1813 + *
1814 + * @ep: the list header of the endpoint to free
1815 + *
1816 +- * This function does not care for the endpoint's use count but will tear
1817 +- * down all the streaming URBs immediately and free all resources.
1818 ++ * This free all resources of the given ep.
1819 + */
1820 + void snd_usb_endpoint_free(struct list_head *head)
1821 + {
1822 + struct snd_usb_endpoint *ep;
1823 +
1824 + ep = list_entry(head, struct snd_usb_endpoint, list);
1825 +- release_urbs(ep, 1);
1826 + kfree(ep);
1827 + }
1828 +
1829 +diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
1830 +index 1c7e8ee48abc..e61ee5c356a3 100644
1831 +--- a/sound/usb/endpoint.h
1832 ++++ b/sound/usb/endpoint.h
1833 +@@ -23,6 +23,7 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
1834 + void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
1835 + int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
1836 + void snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
1837 ++void snd_usb_endpoint_release(struct snd_usb_endpoint *ep);
1838 + void snd_usb_endpoint_free(struct list_head *head);
1839 +
1840 + int snd_usb_endpoint_implicit_feedback_sink(struct snd_usb_endpoint *ep);