Magellan Linux

Contents of /trunk/kernel-alx/patches-3.14/0110-3.14.11-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


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