Gentoo Archives: gentoo-commits

From: Alice Ferrazzi <alicef@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Thu, 26 Jan 2017 08:24:26
Message-Id: 1485419041.2d2a8f260878820802a960b0b9e1584794431fd1.alicef@gentoo
1 commit: 2d2a8f260878820802a960b0b9e1584794431fd1
2 Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 26 08:24:01 2017 +0000
4 Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 26 08:24:01 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2d2a8f26
7
8 Linux patch 4.4.45
9
10 0000_README | 4 +
11 1044_linux-4.4.45.patch | 1157 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 1161 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 751eb4c..b4fb9ea 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -219,6 +219,10 @@ Patch: 1043_linux-4.4.44.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.4.44
21
22 +Patch: 1044_linux-4.4.45.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.4.45
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1044_linux-4.4.45.patch b/1044_linux-4.4.45.patch
31 new file mode 100644
32 index 0000000..7c4b34d
33 --- /dev/null
34 +++ b/1044_linux-4.4.45.patch
35 @@ -0,0 +1,1157 @@
36 +diff --git a/Documentation/devicetree/bindings/clock/imx31-clock.txt b/Documentation/devicetree/bindings/clock/imx31-clock.txt
37 +index 19df842c694f..8163d565f697 100644
38 +--- a/Documentation/devicetree/bindings/clock/imx31-clock.txt
39 ++++ b/Documentation/devicetree/bindings/clock/imx31-clock.txt
40 +@@ -77,7 +77,7 @@ Examples:
41 + clks: ccm@53f80000{
42 + compatible = "fsl,imx31-ccm";
43 + reg = <0x53f80000 0x4000>;
44 +- interrupts = <0 31 0x04 0 53 0x04>;
45 ++ interrupts = <31>, <53>;
46 + #clock-cells = <1>;
47 + };
48 +
49 +diff --git a/Makefile b/Makefile
50 +index d6a1de0e2bd7..a3dfc73da722 100644
51 +--- a/Makefile
52 ++++ b/Makefile
53 +@@ -1,6 +1,6 @@
54 + VERSION = 4
55 + PATCHLEVEL = 4
56 +-SUBLEVEL = 44
57 ++SUBLEVEL = 45
58 + EXTRAVERSION =
59 + NAME = Blurry Fish Butt
60 +
61 +diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
62 +index 4f935ad9f27b..6881757b03e8 100644
63 +--- a/arch/arm/boot/dts/da850-evm.dts
64 ++++ b/arch/arm/boot/dts/da850-evm.dts
65 +@@ -85,6 +85,7 @@
66 + #size-cells = <1>;
67 + compatible = "m25p64";
68 + spi-max-frequency = <30000000>;
69 ++ m25p,fast-read;
70 + reg = <0>;
71 + partition@0 {
72 + label = "U-Boot-SPL";
73 +diff --git a/arch/arm/boot/dts/imx31.dtsi b/arch/arm/boot/dts/imx31.dtsi
74 +index 5fdb222636a7..cbe5fd5ed179 100644
75 +--- a/arch/arm/boot/dts/imx31.dtsi
76 ++++ b/arch/arm/boot/dts/imx31.dtsi
77 +@@ -30,11 +30,11 @@
78 + };
79 + };
80 +
81 +- avic: avic-interrupt-controller@60000000 {
82 ++ avic: interrupt-controller@68000000 {
83 + compatible = "fsl,imx31-avic", "fsl,avic";
84 + interrupt-controller;
85 + #interrupt-cells = <1>;
86 +- reg = <0x60000000 0x100000>;
87 ++ reg = <0x68000000 0x100000>;
88 + };
89 +
90 + soc {
91 +@@ -110,13 +110,6 @@
92 + interrupts = <19>;
93 + clocks = <&clks 25>;
94 + };
95 +-
96 +- clks: ccm@53f80000{
97 +- compatible = "fsl,imx31-ccm";
98 +- reg = <0x53f80000 0x4000>;
99 +- interrupts = <0 31 0x04 0 53 0x04>;
100 +- #clock-cells = <1>;
101 +- };
102 + };
103 +
104 + aips@53f00000 { /* AIPS2 */
105 +@@ -126,6 +119,13 @@
106 + reg = <0x53f00000 0x100000>;
107 + ranges;
108 +
109 ++ clks: ccm@53f80000{
110 ++ compatible = "fsl,imx31-ccm";
111 ++ reg = <0x53f80000 0x4000>;
112 ++ interrupts = <31>, <53>;
113 ++ #clock-cells = <1>;
114 ++ };
115 ++
116 + gpt: timer@53f90000 {
117 + compatible = "fsl,imx31-gpt";
118 + reg = <0x53f90000 0x4000>;
119 +diff --git a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
120 +index a35d54fd9cd3..ddfdb75a6e90 100644
121 +--- a/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
122 ++++ b/arch/arm/boot/dts/imx6qdl-nitrogen6_max.dtsi
123 +@@ -319,8 +319,6 @@
124 + compatible = "fsl,imx6q-nitrogen6_max-sgtl5000",
125 + "fsl,imx-audio-sgtl5000";
126 + model = "imx6q-nitrogen6_max-sgtl5000";
127 +- pinctrl-names = "default";
128 +- pinctrl-0 = <&pinctrl_sgtl5000>;
129 + ssi-controller = <&ssi1>;
130 + audio-codec = <&codec>;
131 + audio-routing =
132 +@@ -401,6 +399,8 @@
133 +
134 + codec: sgtl5000@0a {
135 + compatible = "fsl,sgtl5000";
136 ++ pinctrl-names = "default";
137 ++ pinctrl-0 = <&pinctrl_sgtl5000>;
138 + reg = <0x0a>;
139 + clocks = <&clks 201>;
140 + VDDA-supply = <&reg_2p5v>;
141 +diff --git a/arch/arm/include/asm/cputype.h b/arch/arm/include/asm/cputype.h
142 +index 85e374f873ac..e9d04f475929 100644
143 +--- a/arch/arm/include/asm/cputype.h
144 ++++ b/arch/arm/include/asm/cputype.h
145 +@@ -81,6 +81,9 @@
146 + #define ARM_CPU_XSCALE_ARCH_V2 0x4000
147 + #define ARM_CPU_XSCALE_ARCH_V3 0x6000
148 +
149 ++/* Qualcomm implemented cores */
150 ++#define ARM_CPU_PART_SCORPION 0x510002d0
151 ++
152 + extern unsigned int processor_id;
153 +
154 + #ifdef CONFIG_CPU_CP15
155 +diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
156 +index 6284779d64ee..abcbea1ae30b 100644
157 +--- a/arch/arm/kernel/hw_breakpoint.c
158 ++++ b/arch/arm/kernel/hw_breakpoint.c
159 +@@ -1066,6 +1066,22 @@ static int __init arch_hw_breakpoint_init(void)
160 + return 0;
161 + }
162 +
163 ++ /*
164 ++ * Scorpion CPUs (at least those in APQ8060) seem to set DBGPRSR.SPD
165 ++ * whenever a WFI is issued, even if the core is not powered down, in
166 ++ * violation of the architecture. When DBGPRSR.SPD is set, accesses to
167 ++ * breakpoint and watchpoint registers are treated as undefined, so
168 ++ * this results in boot time and runtime failures when these are
169 ++ * accessed and we unexpectedly take a trap.
170 ++ *
171 ++ * It's not clear if/how this can be worked around, so we blacklist
172 ++ * Scorpion CPUs to avoid these issues.
173 ++ */
174 ++ if (read_cpuid_part() == ARM_CPU_PART_SCORPION) {
175 ++ pr_info("Scorpion CPU detected. Hardware breakpoints and watchpoints disabled\n");
176 ++ return 0;
177 ++ }
178 ++
179 + has_ossr = core_has_os_save_restore();
180 +
181 + /* Determine how many BRPs/WRPs are available. */
182 +diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
183 +index 2e72be4f623e..7cb079e74010 100644
184 +--- a/arch/arm/kernel/smp_tlb.c
185 ++++ b/arch/arm/kernel/smp_tlb.c
186 +@@ -9,6 +9,7 @@
187 + */
188 + #include <linux/preempt.h>
189 + #include <linux/smp.h>
190 ++#include <linux/uaccess.h>
191 +
192 + #include <asm/smp_plat.h>
193 + #include <asm/tlbflush.h>
194 +@@ -40,8 +41,11 @@ static inline void ipi_flush_tlb_mm(void *arg)
195 + static inline void ipi_flush_tlb_page(void *arg)
196 + {
197 + struct tlb_args *ta = (struct tlb_args *)arg;
198 ++ unsigned int __ua_flags = uaccess_save_and_enable();
199 +
200 + local_flush_tlb_page(ta->ta_vma, ta->ta_start);
201 ++
202 ++ uaccess_restore(__ua_flags);
203 + }
204 +
205 + static inline void ipi_flush_tlb_kernel_page(void *arg)
206 +@@ -54,8 +58,11 @@ static inline void ipi_flush_tlb_kernel_page(void *arg)
207 + static inline void ipi_flush_tlb_range(void *arg)
208 + {
209 + struct tlb_args *ta = (struct tlb_args *)arg;
210 ++ unsigned int __ua_flags = uaccess_save_and_enable();
211 +
212 + local_flush_tlb_range(ta->ta_vma, ta->ta_start, ta->ta_end);
213 ++
214 ++ uaccess_restore(__ua_flags);
215 + }
216 +
217 + static inline void ipi_flush_tlb_kernel_range(void *arg)
218 +diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
219 +index 8538910db202..a970e7fcba9e 100644
220 +--- a/arch/arm/mach-ux500/pm.c
221 ++++ b/arch/arm/mach-ux500/pm.c
222 +@@ -134,8 +134,8 @@ bool prcmu_pending_irq(void)
223 + */
224 + bool prcmu_is_cpu_in_wfi(int cpu)
225 + {
226 +- return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 :
227 +- PRCM_ARM_WFI_STANDBY_WFI0;
228 ++ return readl(PRCM_ARM_WFI_STANDBY) &
229 ++ (cpu ? PRCM_ARM_WFI_STANDBY_WFI1 : PRCM_ARM_WFI_STANDBY_WFI0);
230 + }
231 +
232 + /*
233 +diff --git a/arch/arm64/include/uapi/asm/ptrace.h b/arch/arm64/include/uapi/asm/ptrace.h
234 +index 208db3df135a..3378238b5d8b 100644
235 +--- a/arch/arm64/include/uapi/asm/ptrace.h
236 ++++ b/arch/arm64/include/uapi/asm/ptrace.h
237 +@@ -76,6 +76,7 @@ struct user_fpsimd_state {
238 + __uint128_t vregs[32];
239 + __u32 fpsr;
240 + __u32 fpcr;
241 ++ __u32 __reserved[2];
242 + };
243 +
244 + struct user_hwdebug_state {
245 +diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
246 +index 5a3753d09e20..bd14849beb73 100644
247 +--- a/arch/arm64/kernel/entry.S
248 ++++ b/arch/arm64/kernel/entry.S
249 +@@ -562,7 +562,7 @@ el0_inv:
250 + mov x0, sp
251 + mov x1, #BAD_SYNC
252 + mov x2, x25
253 +- bl bad_mode
254 ++ bl bad_el0_sync
255 + b ret_to_user
256 + ENDPROC(el0_sync)
257 +
258 +diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
259 +index fc779ec6f051..55909b2208cc 100644
260 +--- a/arch/arm64/kernel/ptrace.c
261 ++++ b/arch/arm64/kernel/ptrace.c
262 +@@ -450,6 +450,8 @@ static int hw_break_set(struct task_struct *target,
263 + /* (address, ctrl) registers */
264 + limit = regset->n * regset->size;
265 + while (count && offset < limit) {
266 ++ if (count < PTRACE_HBP_ADDR_SZ)
267 ++ return -EINVAL;
268 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &addr,
269 + offset, offset + PTRACE_HBP_ADDR_SZ);
270 + if (ret)
271 +@@ -459,6 +461,8 @@ static int hw_break_set(struct task_struct *target,
272 + return ret;
273 + offset += PTRACE_HBP_ADDR_SZ;
274 +
275 ++ if (!count)
276 ++ break;
277 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ctrl,
278 + offset, offset + PTRACE_HBP_CTRL_SZ);
279 + if (ret)
280 +@@ -495,7 +499,7 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset,
281 + const void *kbuf, const void __user *ubuf)
282 + {
283 + int ret;
284 +- struct user_pt_regs newregs;
285 ++ struct user_pt_regs newregs = task_pt_regs(target)->user_regs;
286 +
287 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newregs, 0, -1);
288 + if (ret)
289 +@@ -525,7 +529,8 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,
290 + const void *kbuf, const void __user *ubuf)
291 + {
292 + int ret;
293 +- struct user_fpsimd_state newstate;
294 ++ struct user_fpsimd_state newstate =
295 ++ target->thread.fpsimd_state.user_fpsimd;
296 +
297 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &newstate, 0, -1);
298 + if (ret)
299 +@@ -549,7 +554,7 @@ static int tls_set(struct task_struct *target, const struct user_regset *regset,
300 + const void *kbuf, const void __user *ubuf)
301 + {
302 + int ret;
303 +- unsigned long tls;
304 ++ unsigned long tls = target->thread.tp_value;
305 +
306 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
307 + if (ret)
308 +@@ -575,7 +580,8 @@ static int system_call_set(struct task_struct *target,
309 + unsigned int pos, unsigned int count,
310 + const void *kbuf, const void __user *ubuf)
311 + {
312 +- int syscallno, ret;
313 ++ int syscallno = task_pt_regs(target)->syscallno;
314 ++ int ret;
315 +
316 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &syscallno, 0, -1);
317 + if (ret)
318 +@@ -847,7 +853,7 @@ static int compat_tls_set(struct task_struct *target,
319 + const void __user *ubuf)
320 + {
321 + int ret;
322 +- compat_ulong_t tls;
323 ++ compat_ulong_t tls = target->thread.tp_value;
324 +
325 + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
326 + if (ret)
327 +diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
328 +index e9b9b5364393..ca7f0ac5f708 100644
329 +--- a/arch/arm64/kernel/traps.c
330 ++++ b/arch/arm64/kernel/traps.c
331 +@@ -434,16 +434,33 @@ const char *esr_get_class_string(u32 esr)
332 + }
333 +
334 + /*
335 +- * bad_mode handles the impossible case in the exception vector.
336 ++ * bad_mode handles the impossible case in the exception vector. This is always
337 ++ * fatal.
338 + */
339 + asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
340 + {
341 +- siginfo_t info;
342 +- void __user *pc = (void __user *)instruction_pointer(regs);
343 + console_verbose();
344 +
345 + pr_crit("Bad mode in %s handler detected, code 0x%08x -- %s\n",
346 + handler[reason], esr, esr_get_class_string(esr));
347 ++
348 ++ die("Oops - bad mode", regs, 0);
349 ++ local_irq_disable();
350 ++ panic("bad mode");
351 ++}
352 ++
353 ++/*
354 ++ * bad_el0_sync handles unexpected, but potentially recoverable synchronous
355 ++ * exceptions taken from EL0. Unlike bad_mode, this returns.
356 ++ */
357 ++asmlinkage void bad_el0_sync(struct pt_regs *regs, int reason, unsigned int esr)
358 ++{
359 ++ siginfo_t info;
360 ++ void __user *pc = (void __user *)instruction_pointer(regs);
361 ++ console_verbose();
362 ++
363 ++ pr_crit("Bad EL0 synchronous exception detected on CPU%d, code 0x%08x -- %s\n",
364 ++ smp_processor_id(), esr, esr_get_class_string(esr));
365 + __show_regs(regs);
366 +
367 + info.si_signo = SIGILL;
368 +@@ -451,7 +468,10 @@ asmlinkage void bad_mode(struct pt_regs *regs, int reason, unsigned int esr)
369 + info.si_code = ILL_ILLOPC;
370 + info.si_addr = pc;
371 +
372 +- arm64_notify_die("Oops - bad mode", regs, &info, 0);
373 ++ current->thread.fault_address = 0;
374 ++ current->thread.fault_code = 0;
375 ++
376 ++ force_sig_info(info.si_signo, &info, current);
377 + }
378 +
379 + void __pte_error(const char *file, int line, unsigned long val)
380 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
381 +index fdb0fbfb1197..aaacbd667212 100644
382 +--- a/arch/x86/kernel/apic/io_apic.c
383 ++++ b/arch/x86/kernel/apic/io_apic.c
384 +@@ -1875,6 +1875,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
385 + .irq_ack = irq_chip_ack_parent,
386 + .irq_eoi = ioapic_ack_level,
387 + .irq_set_affinity = ioapic_set_affinity,
388 ++ .irq_retrigger = irq_chip_retrigger_hierarchy,
389 + .flags = IRQCHIP_SKIP_SET_WAKE,
390 + };
391 +
392 +@@ -1886,6 +1887,7 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
393 + .irq_ack = irq_chip_ack_parent,
394 + .irq_eoi = ioapic_ir_ack_level,
395 + .irq_set_affinity = ioapic_set_affinity,
396 ++ .irq_retrigger = irq_chip_retrigger_hierarchy,
397 + .flags = IRQCHIP_SKIP_SET_WAKE,
398 + };
399 +
400 +diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
401 +index 87e1762e2bca..5d9afbcb6074 100644
402 +--- a/arch/x86/kernel/mcount_64.S
403 ++++ b/arch/x86/kernel/mcount_64.S
404 +@@ -180,7 +180,8 @@ GLOBAL(ftrace_graph_call)
405 + jmp ftrace_stub
406 + #endif
407 +
408 +-GLOBAL(ftrace_stub)
409 ++/* This is weak to keep gas from relaxing the jumps */
410 ++WEAK(ftrace_stub)
411 + retq
412 + END(ftrace_caller)
413 +
414 +diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
415 +index 3cd69832d7f4..3961103e9176 100644
416 +--- a/arch/x86/pci/acpi.c
417 ++++ b/arch/x86/pci/acpi.c
418 +@@ -114,6 +114,16 @@ static const struct dmi_system_id pci_crs_quirks[] __initconst = {
419 + DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"),
420 + },
421 + },
422 ++ /* https://bugzilla.kernel.org/show_bug.cgi?id=42606 */
423 ++ {
424 ++ .callback = set_nouse_crs,
425 ++ .ident = "Supermicro X8DTH",
426 ++ .matches = {
427 ++ DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
428 ++ DMI_MATCH(DMI_PRODUCT_NAME, "X8DTH-i/6/iF/6F"),
429 ++ DMI_MATCH(DMI_BIOS_VERSION, "2.0a"),
430 ++ },
431 ++ },
432 +
433 + /* https://bugzilla.kernel.org/show_bug.cgi?id=15362 */
434 + {
435 +diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
436 +index ff44082a0827..47f8aafe3344 100644
437 +--- a/drivers/clocksource/exynos_mct.c
438 ++++ b/drivers/clocksource/exynos_mct.c
439 +@@ -482,6 +482,7 @@ static void exynos4_local_timer_stop(struct mct_clock_event_device *mevt)
440 + if (mct_int_type == MCT_INT_SPI) {
441 + if (evt->irq != -1)
442 + disable_irq_nosync(evt->irq);
443 ++ exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
444 + } else {
445 + disable_percpu_irq(mct_irqs[MCT_L0_IRQ]);
446 + }
447 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
448 +index 17ee758b419f..8250950aab8b 100644
449 +--- a/drivers/dma/pl330.c
450 ++++ b/drivers/dma/pl330.c
451 +@@ -445,6 +445,9 @@ struct dma_pl330_chan {
452 +
453 + /* for cyclic capability */
454 + bool cyclic;
455 ++
456 ++ /* for runtime pm tracking */
457 ++ bool active;
458 + };
459 +
460 + struct pl330_dmac {
461 +@@ -1994,6 +1997,7 @@ static void pl330_tasklet(unsigned long data)
462 + _stop(pch->thread);
463 + spin_unlock(&pch->thread->dmac->lock);
464 + power_down = true;
465 ++ pch->active = false;
466 + } else {
467 + /* Make sure the PL330 Channel thread is active */
468 + spin_lock(&pch->thread->dmac->lock);
469 +@@ -2015,6 +2019,7 @@ static void pl330_tasklet(unsigned long data)
470 + desc->status = PREP;
471 + list_move_tail(&desc->node, &pch->work_list);
472 + if (power_down) {
473 ++ pch->active = true;
474 + spin_lock(&pch->thread->dmac->lock);
475 + _start(pch->thread);
476 + spin_unlock(&pch->thread->dmac->lock);
477 +@@ -2129,6 +2134,7 @@ static int pl330_terminate_all(struct dma_chan *chan)
478 + unsigned long flags;
479 + struct pl330_dmac *pl330 = pch->dmac;
480 + LIST_HEAD(list);
481 ++ bool power_down = false;
482 +
483 + pm_runtime_get_sync(pl330->ddma.dev);
484 + spin_lock_irqsave(&pch->lock, flags);
485 +@@ -2139,6 +2145,8 @@ static int pl330_terminate_all(struct dma_chan *chan)
486 + pch->thread->req[0].desc = NULL;
487 + pch->thread->req[1].desc = NULL;
488 + pch->thread->req_running = -1;
489 ++ power_down = pch->active;
490 ++ pch->active = false;
491 +
492 + /* Mark all desc done */
493 + list_for_each_entry(desc, &pch->submitted_list, node) {
494 +@@ -2156,6 +2164,8 @@ static int pl330_terminate_all(struct dma_chan *chan)
495 + list_splice_tail_init(&pch->completed_list, &pl330->desc_pool);
496 + spin_unlock_irqrestore(&pch->lock, flags);
497 + pm_runtime_mark_last_busy(pl330->ddma.dev);
498 ++ if (power_down)
499 ++ pm_runtime_put_autosuspend(pl330->ddma.dev);
500 + pm_runtime_put_autosuspend(pl330->ddma.dev);
501 +
502 + return 0;
503 +@@ -2302,6 +2312,7 @@ static void pl330_issue_pending(struct dma_chan *chan)
504 + * updated on work_list emptiness status.
505 + */
506 + WARN_ON(list_empty(&pch->submitted_list));
507 ++ pch->active = true;
508 + pm_runtime_get_sync(pch->dmac->ddma.dev);
509 + }
510 + list_splice_tail_init(&pch->submitted_list, &pch->work_list);
511 +diff --git a/drivers/hid/hid-corsair.c b/drivers/hid/hid-corsair.c
512 +index bcefb9ebb026..88be56321610 100644
513 +--- a/drivers/hid/hid-corsair.c
514 ++++ b/drivers/hid/hid-corsair.c
515 +@@ -148,26 +148,36 @@ static enum led_brightness k90_backlight_get(struct led_classdev *led_cdev)
516 + struct usb_interface *usbif = to_usb_interface(dev->parent);
517 + struct usb_device *usbdev = interface_to_usbdev(usbif);
518 + int brightness;
519 +- char data[8];
520 ++ char *data;
521 ++
522 ++ data = kmalloc(8, GFP_KERNEL);
523 ++ if (!data)
524 ++ return -ENOMEM;
525 +
526 + ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
527 + K90_REQUEST_STATUS,
528 + USB_DIR_IN | USB_TYPE_VENDOR |
529 + USB_RECIP_DEVICE, 0, 0, data, 8,
530 + USB_CTRL_SET_TIMEOUT);
531 +- if (ret < 0) {
532 ++ if (ret < 5) {
533 + dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
534 + ret);
535 +- return -EIO;
536 ++ ret = -EIO;
537 ++ goto out;
538 + }
539 + brightness = data[4];
540 + if (brightness < 0 || brightness > 3) {
541 + dev_warn(dev,
542 + "Read invalid backlight brightness: %02hhx.\n",
543 + data[4]);
544 +- return -EIO;
545 ++ ret = -EIO;
546 ++ goto out;
547 + }
548 +- return brightness;
549 ++ ret = brightness;
550 ++out:
551 ++ kfree(data);
552 ++
553 ++ return ret;
554 + }
555 +
556 + static enum led_brightness k90_record_led_get(struct led_classdev *led_cdev)
557 +@@ -253,17 +263,22 @@ static ssize_t k90_show_macro_mode(struct device *dev,
558 + struct usb_interface *usbif = to_usb_interface(dev->parent);
559 + struct usb_device *usbdev = interface_to_usbdev(usbif);
560 + const char *macro_mode;
561 +- char data[8];
562 ++ char *data;
563 ++
564 ++ data = kmalloc(2, GFP_KERNEL);
565 ++ if (!data)
566 ++ return -ENOMEM;
567 +
568 + ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
569 + K90_REQUEST_GET_MODE,
570 + USB_DIR_IN | USB_TYPE_VENDOR |
571 + USB_RECIP_DEVICE, 0, 0, data, 2,
572 + USB_CTRL_SET_TIMEOUT);
573 +- if (ret < 0) {
574 ++ if (ret < 1) {
575 + dev_warn(dev, "Failed to get K90 initial mode (error %d).\n",
576 + ret);
577 +- return -EIO;
578 ++ ret = -EIO;
579 ++ goto out;
580 + }
581 +
582 + switch (data[0]) {
583 +@@ -277,10 +292,15 @@ static ssize_t k90_show_macro_mode(struct device *dev,
584 + default:
585 + dev_warn(dev, "K90 in unknown mode: %02hhx.\n",
586 + data[0]);
587 +- return -EIO;
588 ++ ret = -EIO;
589 ++ goto out;
590 + }
591 +
592 +- return snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
593 ++ ret = snprintf(buf, PAGE_SIZE, "%s\n", macro_mode);
594 ++out:
595 ++ kfree(data);
596 ++
597 ++ return ret;
598 + }
599 +
600 + static ssize_t k90_store_macro_mode(struct device *dev,
601 +@@ -320,26 +340,36 @@ static ssize_t k90_show_current_profile(struct device *dev,
602 + struct usb_interface *usbif = to_usb_interface(dev->parent);
603 + struct usb_device *usbdev = interface_to_usbdev(usbif);
604 + int current_profile;
605 +- char data[8];
606 ++ char *data;
607 ++
608 ++ data = kmalloc(8, GFP_KERNEL);
609 ++ if (!data)
610 ++ return -ENOMEM;
611 +
612 + ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0),
613 + K90_REQUEST_STATUS,
614 + USB_DIR_IN | USB_TYPE_VENDOR |
615 + USB_RECIP_DEVICE, 0, 0, data, 8,
616 + USB_CTRL_SET_TIMEOUT);
617 +- if (ret < 0) {
618 ++ if (ret < 8) {
619 + dev_warn(dev, "Failed to get K90 initial state (error %d).\n",
620 + ret);
621 +- return -EIO;
622 ++ ret = -EIO;
623 ++ goto out;
624 + }
625 + current_profile = data[7];
626 + if (current_profile < 1 || current_profile > 3) {
627 + dev_warn(dev, "Read invalid current profile: %02hhx.\n",
628 + data[7]);
629 +- return -EIO;
630 ++ ret = -EIO;
631 ++ goto out;
632 + }
633 +
634 +- return snprintf(buf, PAGE_SIZE, "%d\n", current_profile);
635 ++ ret = snprintf(buf, PAGE_SIZE, "%d\n", current_profile);
636 ++out:
637 ++ kfree(data);
638 ++
639 ++ return ret;
640 + }
641 +
642 + static ssize_t k90_store_current_profile(struct device *dev,
643 +diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c
644 +index c007c766c61e..fc21bdbb8b32 100644
645 +--- a/drivers/infiniband/hw/mlx4/ah.c
646 ++++ b/drivers/infiniband/hw/mlx4/ah.c
647 +@@ -113,7 +113,9 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
648 + !(1 << ah->av.eth.stat_rate & dev->caps.stat_rate_support))
649 + --ah->av.eth.stat_rate;
650 + }
651 +-
652 ++ ah->av.eth.sl_tclass_flowlabel |=
653 ++ cpu_to_be32((ah_attr->grh.traffic_class << 20) |
654 ++ ah_attr->grh.flow_label);
655 + /*
656 + * HW requires multicast LID so we just choose one.
657 + */
658 +@@ -121,7 +123,7 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
659 + ah->av.ib.dlid = cpu_to_be16(0xc000);
660 +
661 + memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16);
662 +- ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29);
663 ++ ah->av.eth.sl_tclass_flowlabel |= cpu_to_be32(ah_attr->sl << 29);
664 +
665 + return &ah->ibah;
666 + }
667 +diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
668 +index 97d6878f9938..77ddf2fa8625 100644
669 +--- a/drivers/infiniband/hw/mlx4/main.c
670 ++++ b/drivers/infiniband/hw/mlx4/main.c
671 +@@ -630,9 +630,11 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
672 + if (err)
673 + goto out;
674 +
675 +- props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ?
676 +- IB_WIDTH_4X : IB_WIDTH_1X;
677 +- props->active_speed = IB_SPEED_QDR;
678 ++ props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ||
679 ++ (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
680 ++ IB_WIDTH_4X : IB_WIDTH_1X;
681 ++ props->active_speed = (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
682 ++ IB_SPEED_FDR : IB_SPEED_QDR;
683 + props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
684 + props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
685 + props->max_msg_sz = mdev->dev->caps.max_msg_sz;
686 +@@ -2401,14 +2403,19 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
687 + goto err_steer_qp_release;
688 + }
689 +
690 +- bitmap_zero(ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count);
691 +-
692 +- err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
693 +- dev, ibdev->steer_qpn_base,
694 +- ibdev->steer_qpn_base +
695 +- ibdev->steer_qpn_count - 1);
696 +- if (err)
697 +- goto err_steer_free_bitmap;
698 ++ if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB) {
699 ++ bitmap_zero(ibdev->ib_uc_qpns_bitmap,
700 ++ ibdev->steer_qpn_count);
701 ++ err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
702 ++ dev, ibdev->steer_qpn_base,
703 ++ ibdev->steer_qpn_base +
704 ++ ibdev->steer_qpn_count - 1);
705 ++ if (err)
706 ++ goto err_steer_free_bitmap;
707 ++ } else {
708 ++ bitmap_fill(ibdev->ib_uc_qpns_bitmap,
709 ++ ibdev->steer_qpn_count);
710 ++ }
711 + }
712 +
713 + for (j = 1; j <= ibdev->dev->caps.num_ports; j++)
714 +diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
715 +index f350f2d61c15..1c8b7c22c822 100644
716 +--- a/drivers/infiniband/hw/mlx4/qp.c
717 ++++ b/drivers/infiniband/hw/mlx4/qp.c
718 +@@ -1207,7 +1207,8 @@ int mlx4_ib_destroy_qp(struct ib_qp *qp)
719 + if (is_qp0(dev, mqp))
720 + mlx4_CLOSE_PORT(dev->dev, mqp->port);
721 +
722 +- if (dev->qp1_proxy[mqp->port - 1] == mqp) {
723 ++ if (mqp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI &&
724 ++ dev->qp1_proxy[mqp->port - 1] == mqp) {
725 + mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]);
726 + dev->qp1_proxy[mqp->port - 1] = NULL;
727 + mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]);
728 +diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
729 +index 6000f7aeede9..3399271c235b 100644
730 +--- a/drivers/infiniband/hw/mlx5/mr.c
731 ++++ b/drivers/infiniband/hw/mlx5/mr.c
732 +@@ -614,6 +614,33 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev)
733 + return 0;
734 + }
735 +
736 ++static void wait_for_async_commands(struct mlx5_ib_dev *dev)
737 ++{
738 ++ struct mlx5_mr_cache *cache = &dev->cache;
739 ++ struct mlx5_cache_ent *ent;
740 ++ int total = 0;
741 ++ int i;
742 ++ int j;
743 ++
744 ++ for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
745 ++ ent = &cache->ent[i];
746 ++ for (j = 0 ; j < 1000; j++) {
747 ++ if (!ent->pending)
748 ++ break;
749 ++ msleep(50);
750 ++ }
751 ++ }
752 ++ for (i = 0; i < MAX_MR_CACHE_ENTRIES; i++) {
753 ++ ent = &cache->ent[i];
754 ++ total += ent->pending;
755 ++ }
756 ++
757 ++ if (total)
758 ++ mlx5_ib_warn(dev, "aborted while there are %d pending mr requests\n", total);
759 ++ else
760 ++ mlx5_ib_warn(dev, "done with all pending requests\n");
761 ++}
762 ++
763 + int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev)
764 + {
765 + int i;
766 +@@ -627,6 +654,7 @@ int mlx5_mr_cache_cleanup(struct mlx5_ib_dev *dev)
767 + clean_keys(dev, i);
768 +
769 + destroy_workqueue(dev->cache.wq);
770 ++ wait_for_async_commands(dev);
771 + del_timer_sync(&dev->delay_timer);
772 +
773 + return 0;
774 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
775 +index 8ca75af0e6d1..de5e2b01ab05 100644
776 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
777 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
778 +@@ -1035,8 +1035,6 @@ static struct ib_qp *ipoib_cm_create_tx_qp(struct net_device *dev, struct ipoib_
779 +
780 + tx_qp = ib_create_qp(priv->pd, &attr);
781 + if (PTR_ERR(tx_qp) == -EINVAL) {
782 +- ipoib_warn(priv, "can't use GFP_NOIO for QPs on device %s, using GFP_KERNEL\n",
783 +- priv->ca->name);
784 + attr.create_flags &= ~IB_QP_CREATE_USE_GFP_NOIO;
785 + tx_qp = ib_create_qp(priv->pd, &attr);
786 + }
787 +diff --git a/drivers/media/platform/blackfin/ppi.c b/drivers/media/platform/blackfin/ppi.c
788 +index cff63e511e6d..b8f3d9fa66e9 100644
789 +--- a/drivers/media/platform/blackfin/ppi.c
790 ++++ b/drivers/media/platform/blackfin/ppi.c
791 +@@ -214,6 +214,8 @@ static int ppi_set_params(struct ppi_if *ppi, struct ppi_params *params)
792 + if (params->dlen > 24 || params->dlen <= 0)
793 + return -EINVAL;
794 + pctrl = devm_pinctrl_get(ppi->dev);
795 ++ if (IS_ERR(pctrl))
796 ++ return PTR_ERR(pctrl);
797 + pstate = pinctrl_lookup_state(pctrl,
798 + pin_state[(params->dlen + 7) / 8 - 1]);
799 + if (pinctrl_select_state(pctrl, pstate))
800 +diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
801 +index 0f301903aa6f..63165d324fff 100644
802 +--- a/drivers/media/rc/ite-cir.c
803 ++++ b/drivers/media/rc/ite-cir.c
804 +@@ -263,6 +263,8 @@ static void ite_set_carrier_params(struct ite_dev *dev)
805 +
806 + if (allowance > ITE_RXDCR_MAX)
807 + allowance = ITE_RXDCR_MAX;
808 ++
809 ++ use_demodulator = true;
810 + }
811 + }
812 +
813 +diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
814 +index 44ecebd1ea8c..c8b8ac66ff7e 100644
815 +--- a/drivers/mmc/host/mxs-mmc.c
816 ++++ b/drivers/mmc/host/mxs-mmc.c
817 +@@ -309,6 +309,9 @@ static void mxs_mmc_ac(struct mxs_mmc_host *host)
818 + cmd0 = BF_SSP(cmd->opcode, CMD0_CMD);
819 + cmd1 = cmd->arg;
820 +
821 ++ if (cmd->opcode == MMC_STOP_TRANSMISSION)
822 ++ cmd0 |= BM_SSP_CMD0_APPEND_8CYC;
823 ++
824 + if (host->sdio_irq_en) {
825 + ctrl0 |= BM_SSP_CTRL0_SDIO_IRQ_CHECK;
826 + cmd0 |= BM_SSP_CMD0_CONT_CLKING_EN | BM_SSP_CMD0_SLOW_CLKING_EN;
827 +@@ -417,8 +420,7 @@ static void mxs_mmc_adtc(struct mxs_mmc_host *host)
828 + ssp->base + HW_SSP_BLOCK_SIZE);
829 + }
830 +
831 +- if ((cmd->opcode == MMC_STOP_TRANSMISSION) ||
832 +- (cmd->opcode == SD_IO_RW_EXTENDED))
833 ++ if (cmd->opcode == SD_IO_RW_EXTENDED)
834 + cmd0 |= BM_SSP_CMD0_APPEND_8CYC;
835 +
836 + cmd1 = cmd->arg;
837 +diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
838 +index 289664089cf3..8f49f8aeff1a 100644
839 +--- a/drivers/mtd/nand/Kconfig
840 ++++ b/drivers/mtd/nand/Kconfig
841 +@@ -527,7 +527,7 @@ config MTD_NAND_FSMC
842 + Flexible Static Memory Controller (FSMC)
843 +
844 + config MTD_NAND_XWAY
845 +- tristate "Support for NAND on Lantiq XWAY SoC"
846 ++ bool "Support for NAND on Lantiq XWAY SoC"
847 + depends on LANTIQ && SOC_TYPE_XWAY
848 + select MTD_NAND_PLATFORM
849 + help
850 +diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
851 +index 199a94a9c8bc..3a429f1a8002 100644
852 +--- a/drivers/net/ieee802154/atusb.c
853 ++++ b/drivers/net/ieee802154/atusb.c
854 +@@ -110,13 +110,26 @@ static int atusb_read_reg(struct atusb *atusb, uint8_t reg)
855 + {
856 + struct usb_device *usb_dev = atusb->usb_dev;
857 + int ret;
858 ++ uint8_t *buffer;
859 + uint8_t value;
860 +
861 ++ buffer = kmalloc(1, GFP_KERNEL);
862 ++ if (!buffer)
863 ++ return -ENOMEM;
864 ++
865 + dev_dbg(&usb_dev->dev, "atusb: reg = 0x%x\n", reg);
866 + ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
867 + ATUSB_REG_READ, ATUSB_REQ_FROM_DEV,
868 +- 0, reg, &value, 1, 1000);
869 +- return ret >= 0 ? value : ret;
870 ++ 0, reg, buffer, 1, 1000);
871 ++
872 ++ if (ret >= 0) {
873 ++ value = buffer[0];
874 ++ kfree(buffer);
875 ++ return value;
876 ++ } else {
877 ++ kfree(buffer);
878 ++ return ret;
879 ++ }
880 + }
881 +
882 + static int atusb_write_subreg(struct atusb *atusb, uint8_t reg, uint8_t mask,
883 +@@ -517,9 +530,13 @@ static struct ieee802154_ops atusb_ops = {
884 + static int atusb_get_and_show_revision(struct atusb *atusb)
885 + {
886 + struct usb_device *usb_dev = atusb->usb_dev;
887 +- unsigned char buffer[3];
888 ++ unsigned char *buffer;
889 + int ret;
890 +
891 ++ buffer = kmalloc(3, GFP_KERNEL);
892 ++ if (!buffer)
893 ++ return -ENOMEM;
894 ++
895 + /* Get a couple of the ATMega Firmware values */
896 + ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
897 + ATUSB_ID, ATUSB_REQ_FROM_DEV, 0, 0,
898 +@@ -535,15 +552,20 @@ static int atusb_get_and_show_revision(struct atusb *atusb)
899 + dev_info(&usb_dev->dev, "Please update to version 0.2 or newer");
900 + }
901 +
902 ++ kfree(buffer);
903 + return ret;
904 + }
905 +
906 + static int atusb_get_and_show_build(struct atusb *atusb)
907 + {
908 + struct usb_device *usb_dev = atusb->usb_dev;
909 +- char build[ATUSB_BUILD_SIZE + 1];
910 ++ char *build;
911 + int ret;
912 +
913 ++ build = kmalloc(ATUSB_BUILD_SIZE + 1, GFP_KERNEL);
914 ++ if (!build)
915 ++ return -ENOMEM;
916 ++
917 + ret = atusb_control_msg(atusb, usb_rcvctrlpipe(usb_dev, 0),
918 + ATUSB_BUILD, ATUSB_REQ_FROM_DEV, 0, 0,
919 + build, ATUSB_BUILD_SIZE, 1000);
920 +@@ -552,6 +574,7 @@ static int atusb_get_and_show_build(struct atusb *atusb)
921 + dev_info(&usb_dev->dev, "Firmware: build %s\n", build);
922 + }
923 +
924 ++ kfree(build);
925 + return ret;
926 + }
927 +
928 +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
929 +index b5843c255263..71d9a6d1bd56 100644
930 +--- a/drivers/pci/probe.c
931 ++++ b/drivers/pci/probe.c
932 +@@ -1019,6 +1019,7 @@ void set_pcie_port_type(struct pci_dev *pdev)
933 + pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
934 + if (!pos)
935 + return;
936 ++
937 + pdev->pcie_cap = pos;
938 + pci_read_config_word(pdev, pos + PCI_EXP_FLAGS, &reg16);
939 + pdev->pcie_flags_reg = reg16;
940 +@@ -1026,13 +1027,14 @@ void set_pcie_port_type(struct pci_dev *pdev)
941 + pdev->pcie_mpss = reg16 & PCI_EXP_DEVCAP_PAYLOAD;
942 +
943 + /*
944 +- * A Root Port is always the upstream end of a Link. No PCIe
945 +- * component has two Links. Two Links are connected by a Switch
946 +- * that has a Port on each Link and internal logic to connect the
947 +- * two Ports.
948 ++ * A Root Port or a PCI-to-PCIe bridge is always the upstream end
949 ++ * of a Link. No PCIe component has two Links. Two Links are
950 ++ * connected by a Switch that has a Port on each Link and internal
951 ++ * logic to connect the two Ports.
952 + */
953 + type = pci_pcie_type(pdev);
954 +- if (type == PCI_EXP_TYPE_ROOT_PORT)
955 ++ if (type == PCI_EXP_TYPE_ROOT_PORT ||
956 ++ type == PCI_EXP_TYPE_PCIE_BRIDGE)
957 + pdev->has_secondary_link = 1;
958 + else if (type == PCI_EXP_TYPE_UPSTREAM ||
959 + type == PCI_EXP_TYPE_DOWNSTREAM) {
960 +diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
961 +index c44cbf46221c..3588a56aabb4 100644
962 +--- a/drivers/scsi/qla2xxx/qla_os.c
963 ++++ b/drivers/scsi/qla2xxx/qla_os.c
964 +@@ -3365,7 +3365,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
965 + sizeof(struct ct6_dsd), 0,
966 + SLAB_HWCACHE_ALIGN, NULL);
967 + if (!ctx_cachep)
968 +- goto fail_free_gid_list;
969 ++ goto fail_free_srb_mempool;
970 + }
971 + ha->ctx_mempool = mempool_create_slab_pool(SRB_MIN_REQ,
972 + ctx_cachep);
973 +@@ -3518,7 +3518,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
974 + ha->loop_id_map = kzalloc(BITS_TO_LONGS(LOOPID_MAP_SIZE) * sizeof(long),
975 + GFP_KERNEL);
976 + if (!ha->loop_id_map)
977 +- goto fail_async_pd;
978 ++ goto fail_loop_id_map;
979 + else {
980 + qla2x00_set_reserved_loop_ids(ha);
981 + ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123,
982 +@@ -3527,6 +3527,8 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
983 +
984 + return 0;
985 +
986 ++fail_loop_id_map:
987 ++ dma_pool_free(ha->s_dma_pool, ha->async_pd, ha->async_pd_dma);
988 + fail_async_pd:
989 + dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
990 + fail_ex_init_cb:
991 +@@ -3554,6 +3556,10 @@ fail_free_ms_iocb:
992 + dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
993 + ha->ms_iocb = NULL;
994 + ha->ms_iocb_dma = 0;
995 ++
996 ++ if (ha->sns_cmd)
997 ++ dma_free_coherent(&ha->pdev->dev, sizeof(struct sns_cmd_pkt),
998 ++ ha->sns_cmd, ha->sns_cmd_dma);
999 + fail_dma_pool:
1000 + if (IS_QLA82XX(ha) || ql2xenabledif) {
1001 + dma_pool_destroy(ha->fcp_cmnd_dma_pool);
1002 +@@ -3571,10 +3577,12 @@ fail_free_nvram:
1003 + kfree(ha->nvram);
1004 + ha->nvram = NULL;
1005 + fail_free_ctx_mempool:
1006 +- mempool_destroy(ha->ctx_mempool);
1007 ++ if (ha->ctx_mempool)
1008 ++ mempool_destroy(ha->ctx_mempool);
1009 + ha->ctx_mempool = NULL;
1010 + fail_free_srb_mempool:
1011 +- mempool_destroy(ha->srb_mempool);
1012 ++ if (ha->srb_mempool)
1013 ++ mempool_destroy(ha->srb_mempool);
1014 + ha->srb_mempool = NULL;
1015 + fail_free_gid_list:
1016 + dma_free_coherent(&ha->pdev->dev, qla2x00_gid_list_size(ha),
1017 +diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
1018 +index e7b130a637f9..239bc9cba28c 100644
1019 +--- a/fs/ceph/mds_client.c
1020 ++++ b/fs/ceph/mds_client.c
1021 +@@ -274,12 +274,13 @@ static int parse_reply_info_extra(void **p, void *end,
1022 + struct ceph_mds_reply_info_parsed *info,
1023 + u64 features)
1024 + {
1025 +- if (info->head->op == CEPH_MDS_OP_GETFILELOCK)
1026 ++ u32 op = le32_to_cpu(info->head->op);
1027 ++
1028 ++ if (op == CEPH_MDS_OP_GETFILELOCK)
1029 + return parse_reply_info_filelock(p, end, info, features);
1030 +- else if (info->head->op == CEPH_MDS_OP_READDIR ||
1031 +- info->head->op == CEPH_MDS_OP_LSSNAP)
1032 ++ else if (op == CEPH_MDS_OP_READDIR || op == CEPH_MDS_OP_LSSNAP)
1033 + return parse_reply_info_dir(p, end, info, features);
1034 +- else if (info->head->op == CEPH_MDS_OP_CREATE)
1035 ++ else if (op == CEPH_MDS_OP_CREATE)
1036 + return parse_reply_info_create(p, end, info, features);
1037 + else
1038 + return -EIO;
1039 +diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
1040 +index ebb5e37455a0..9096d44eb221 100644
1041 +--- a/fs/fuse/dev.c
1042 ++++ b/fs/fuse/dev.c
1043 +@@ -2083,7 +2083,6 @@ static void end_requests(struct fuse_conn *fc, struct list_head *head)
1044 + struct fuse_req *req;
1045 + req = list_entry(head->next, struct fuse_req, list);
1046 + req->out.h.error = -ECONNABORTED;
1047 +- clear_bit(FR_PENDING, &req->flags);
1048 + clear_bit(FR_SENT, &req->flags);
1049 + list_del_init(&req->list);
1050 + request_end(fc, req);
1051 +@@ -2161,6 +2160,8 @@ void fuse_abort_conn(struct fuse_conn *fc)
1052 + spin_lock(&fiq->waitq.lock);
1053 + fiq->connected = 0;
1054 + list_splice_init(&fiq->pending, &to_end2);
1055 ++ list_for_each_entry(req, &to_end2, list)
1056 ++ clear_bit(FR_PENDING, &req->flags);
1057 + while (forget_pending(fiq))
1058 + kfree(dequeue_forget(fiq, 1, NULL));
1059 + wake_up_all_locked(&fiq->waitq);
1060 +diff --git a/fs/posix_acl.c b/fs/posix_acl.c
1061 +index a60d3cc5b55d..993bb3b5f4d5 100644
1062 +--- a/fs/posix_acl.c
1063 ++++ b/fs/posix_acl.c
1064 +@@ -903,11 +903,10 @@ int simple_set_acl(struct inode *inode, struct posix_acl *acl, int type)
1065 + int error;
1066 +
1067 + if (type == ACL_TYPE_ACCESS) {
1068 +- error = posix_acl_equiv_mode(acl, &inode->i_mode);
1069 +- if (error < 0)
1070 +- return 0;
1071 +- if (error == 0)
1072 +- acl = NULL;
1073 ++ error = posix_acl_update_mode(inode,
1074 ++ &inode->i_mode, &acl);
1075 ++ if (error)
1076 ++ return error;
1077 + }
1078 +
1079 + inode->i_ctime = CURRENT_TIME;
1080 +diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
1081 +index fa9a20cc60d6..fe5e8d4970ae 100644
1082 +--- a/fs/ubifs/tnc.c
1083 ++++ b/fs/ubifs/tnc.c
1084 +@@ -34,6 +34,11 @@
1085 + #include <linux/slab.h>
1086 + #include "ubifs.h"
1087 +
1088 ++static int try_read_node(const struct ubifs_info *c, void *buf, int type,
1089 ++ int len, int lnum, int offs);
1090 ++static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
1091 ++ struct ubifs_zbranch *zbr, void *node);
1092 ++
1093 + /*
1094 + * Returned codes of 'matches_name()' and 'fallible_matches_name()' functions.
1095 + * @NAME_LESS: name corresponding to the first argument is less than second
1096 +@@ -402,7 +407,19 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
1097 + return 0;
1098 + }
1099 +
1100 +- err = ubifs_tnc_read_node(c, zbr, node);
1101 ++ if (c->replaying) {
1102 ++ err = fallible_read_node(c, &zbr->key, zbr, node);
1103 ++ /*
1104 ++ * When the node was not found, return -ENOENT, 0 otherwise.
1105 ++ * Negative return codes stay as-is.
1106 ++ */
1107 ++ if (err == 0)
1108 ++ err = -ENOENT;
1109 ++ else if (err == 1)
1110 ++ err = 0;
1111 ++ } else {
1112 ++ err = ubifs_tnc_read_node(c, zbr, node);
1113 ++ }
1114 + if (err)
1115 + return err;
1116 +
1117 +@@ -2766,7 +2783,11 @@ struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c,
1118 + if (nm->name) {
1119 + if (err) {
1120 + /* Handle collisions */
1121 +- err = resolve_collision(c, key, &znode, &n, nm);
1122 ++ if (c->replaying)
1123 ++ err = fallible_resolve_collision(c, key, &znode, &n,
1124 ++ nm, 0);
1125 ++ else
1126 ++ err = resolve_collision(c, key, &znode, &n, nm);
1127 + dbg_tnc("rc returned %d, znode %p, n %d",
1128 + err, znode, n);
1129 + if (unlikely(err < 0))
1130 +diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
1131 +index 4605dc73def6..033fec307528 100644
1132 +--- a/net/sunrpc/auth_gss/svcauth_gss.c
1133 ++++ b/net/sunrpc/auth_gss/svcauth_gss.c
1134 +@@ -1481,7 +1481,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp)
1135 + case RPC_GSS_PROC_DESTROY:
1136 + if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
1137 + goto auth_err;
1138 +- rsci->h.expiry_time = get_seconds();
1139 ++ rsci->h.expiry_time = seconds_since_boot();
1140 + set_bit(CACHE_NEGATIVE, &rsci->h.flags);
1141 + if (resv->iov_len + 4 > PAGE_SIZE)
1142 + goto drop;
1143 +diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
1144 +index ff4f01e527ec..d4e0d648bcea 100644
1145 +--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
1146 ++++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
1147 +@@ -346,8 +346,6 @@ int rdma_read_chunk_frmr(struct svcxprt_rdma *xprt,
1148 + atomic_inc(&rdma_stat_read);
1149 + return ret;
1150 + err:
1151 +- ib_dma_unmap_sg(xprt->sc_cm_id->device,
1152 +- frmr->sg, frmr->sg_nents, frmr->direction);
1153 + svc_rdma_put_context(ctxt, 0);
1154 + svc_rdma_put_frmr(xprt, frmr);
1155 + return ret;
1156 +diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
1157 +index 9df61059a85d..a2fd6e79d5a5 100644
1158 +--- a/tools/perf/util/trace-event-scripting.c
1159 ++++ b/tools/perf/util/trace-event-scripting.c
1160 +@@ -95,7 +95,8 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
1161 + if (err)
1162 + die("error registering py script extension");
1163 +
1164 +- scripting_context = malloc(sizeof(struct scripting_context));
1165 ++ if (scripting_context == NULL)
1166 ++ scripting_context = malloc(sizeof(*scripting_context));
1167 + }
1168 +
1169 + #ifdef NO_LIBPYTHON
1170 +@@ -159,7 +160,8 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
1171 + if (err)
1172 + die("error registering pl script extension");
1173 +
1174 +- scripting_context = malloc(sizeof(struct scripting_context));
1175 ++ if (scripting_context == NULL)
1176 ++ scripting_context = malloc(sizeof(*scripting_context));
1177 + }
1178 +
1179 + #ifdef NO_LIBPERL
1180 +diff --git a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
1181 +index c22860ab9733..30e1ac62e8cb 100644
1182 +--- a/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
1183 ++++ b/tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c
1184 +@@ -66,7 +66,7 @@ int pmc56_overflow(void)
1185 +
1186 + FAIL_IF(ebb_event_enable(&event));
1187 +
1188 +- mtspr(SPRN_PMC1, pmc_sample_period(sample_period));
1189 ++ mtspr(SPRN_PMC2, pmc_sample_period(sample_period));
1190 + mtspr(SPRN_PMC5, 0);
1191 + mtspr(SPRN_PMC6, 0);
1192 +