Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0255-4.9.156-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3308 - (hide annotations) (download)
Tue Mar 12 10:43:14 2019 UTC (5 years, 2 months ago) by niro
File size: 125133 byte(s)
-linux-4.9.156
1 niro 3308 diff --git a/Makefile b/Makefile
2     index 1933ac9c3406..956923115f7e 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 155
9     +SUBLEVEL = 156
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arm/boot/dts/mmp2.dtsi b/arch/arm/boot/dts/mmp2.dtsi
14     index 766bbb8495b6..47e5b63339d1 100644
15     --- a/arch/arm/boot/dts/mmp2.dtsi
16     +++ b/arch/arm/boot/dts/mmp2.dtsi
17     @@ -220,12 +220,15 @@
18     status = "disabled";
19     };
20    
21     - twsi2: i2c@d4025000 {
22     + twsi2: i2c@d4031000 {
23     compatible = "mrvl,mmp-twsi";
24     - reg = <0xd4025000 0x1000>;
25     - interrupts = <58>;
26     + reg = <0xd4031000 0x1000>;
27     + interrupt-parent = <&intcmux17>;
28     + interrupts = <0>;
29     clocks = <&soc_clocks MMP2_CLK_TWSI1>;
30     resets = <&soc_clocks MMP2_CLK_TWSI1>;
31     + #address-cells = <1>;
32     + #size-cells = <0>;
33     status = "disabled";
34     };
35    
36     diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
37     index d728ec963111..891ba75fd459 100644
38     --- a/arch/arm/boot/dts/omap4-sdp.dts
39     +++ b/arch/arm/boot/dts/omap4-sdp.dts
40     @@ -33,6 +33,7 @@
41     gpio = <&gpio2 16 GPIO_ACTIVE_HIGH>; /* gpio line 48 */
42     enable-active-high;
43     regulator-boot-on;
44     + startup-delay-us = <25000>;
45     };
46    
47     vbat: fixedregulator-vbat {
48     diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
49     index d2ce37da87d8..4b129aac7233 100644
50     --- a/arch/arm/kernel/smp.c
51     +++ b/arch/arm/kernel/smp.c
52     @@ -690,6 +690,21 @@ void smp_send_stop(void)
53     pr_warn("SMP: failed to stop secondary CPUs\n");
54     }
55    
56     +/* In case panic() and panic() called at the same time on CPU1 and CPU2,
57     + * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
58     + * CPU1 can't receive the ipi irqs from CPU2, CPU1 will be always online,
59     + * kdump fails. So split out the panic_smp_self_stop() and add
60     + * set_cpu_online(smp_processor_id(), false).
61     + */
62     +void panic_smp_self_stop(void)
63     +{
64     + pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n",
65     + smp_processor_id());
66     + set_cpu_online(smp_processor_id(), false);
67     + while (1)
68     + cpu_relax();
69     +}
70     +
71     /*
72     * not supported here
73     */
74     diff --git a/arch/arm/kvm/mmio.c b/arch/arm/kvm/mmio.c
75     index dac7ceb1a677..08443a15e6be 100644
76     --- a/arch/arm/kvm/mmio.c
77     +++ b/arch/arm/kvm/mmio.c
78     @@ -117,6 +117,12 @@ int kvm_handle_mmio_return(struct kvm_vcpu *vcpu, struct kvm_run *run)
79     vcpu_set_reg(vcpu, vcpu->arch.mmio_decode.rt, data);
80     }
81    
82     + /*
83     + * The MMIO instruction is emulated and should not be re-executed
84     + * in the guest.
85     + */
86     + kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
87     +
88     return 0;
89     }
90    
91     @@ -144,11 +150,6 @@ static int decode_hsr(struct kvm_vcpu *vcpu, bool *is_write, int *len)
92     vcpu->arch.mmio_decode.sign_extend = sign_extend;
93     vcpu->arch.mmio_decode.rt = rt;
94    
95     - /*
96     - * The MMIO instruction is emulated and should not be re-executed
97     - * in the guest.
98     - */
99     - kvm_skip_instr(vcpu, kvm_vcpu_trap_il_is32bit(vcpu));
100     return 0;
101     }
102    
103     diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
104     index b5c1714ebfdd..bfc74954540c 100644
105     --- a/arch/arm/mach-omap2/omap_hwmod.c
106     +++ b/arch/arm/mach-omap2/omap_hwmod.c
107     @@ -2551,7 +2551,7 @@ static int __init _init(struct omap_hwmod *oh, void *data)
108     * a stub; implementing this properly requires iclk autoidle usecounting in
109     * the clock code. No return value.
110     */
111     -static void __init _setup_iclk_autoidle(struct omap_hwmod *oh)
112     +static void _setup_iclk_autoidle(struct omap_hwmod *oh)
113     {
114     struct omap_hwmod_ocp_if *os;
115     struct list_head *p;
116     @@ -2586,7 +2586,7 @@ static void __init _setup_iclk_autoidle(struct omap_hwmod *oh)
117     * reset. Returns 0 upon success or a negative error code upon
118     * failure.
119     */
120     -static int __init _setup_reset(struct omap_hwmod *oh)
121     +static int _setup_reset(struct omap_hwmod *oh)
122     {
123     int r;
124    
125     @@ -2647,7 +2647,7 @@ static int __init _setup_reset(struct omap_hwmod *oh)
126     *
127     * No return value.
128     */
129     -static void __init _setup_postsetup(struct omap_hwmod *oh)
130     +static void _setup_postsetup(struct omap_hwmod *oh)
131     {
132     u8 postsetup_state;
133    
134     diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
135     index 868448d2cd82..38ab30869821 100644
136     --- a/arch/arm/mach-pxa/cm-x300.c
137     +++ b/arch/arm/mach-pxa/cm-x300.c
138     @@ -547,7 +547,7 @@ static struct pxa3xx_u2d_platform_data cm_x300_u2d_platform_data = {
139     .exit = cm_x300_u2d_exit,
140     };
141    
142     -static void cm_x300_init_u2d(void)
143     +static void __init cm_x300_init_u2d(void)
144     {
145     pxa3xx_set_u2d_info(&cm_x300_u2d_platform_data);
146     }
147     diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c
148     index 051c554776a6..ebdef6661f5f 100644
149     --- a/arch/arm/mach-pxa/littleton.c
150     +++ b/arch/arm/mach-pxa/littleton.c
151     @@ -183,7 +183,7 @@ static struct pxafb_mach_info littleton_lcd_info = {
152     .lcd_conn = LCD_COLOR_TFT_16BPP,
153     };
154    
155     -static void littleton_init_lcd(void)
156     +static void __init littleton_init_lcd(void)
157     {
158     pxa_set_fb_info(NULL, &littleton_lcd_info);
159     }
160     diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
161     index 3b94ecfb9426..3fcd5854bf5b 100644
162     --- a/arch/arm/mach-pxa/zeus.c
163     +++ b/arch/arm/mach-pxa/zeus.c
164     @@ -557,7 +557,7 @@ static struct pxaohci_platform_data zeus_ohci_platform_data = {
165     .flags = ENABLE_PORT_ALL | POWER_SENSE_LOW,
166     };
167    
168     -static void zeus_register_ohci(void)
169     +static void __init zeus_register_ohci(void)
170     {
171     /* Port 2 is shared between host and client interface. */
172     UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
173     diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
174     index aef02d2af3b5..7a87d32e98f4 100644
175     --- a/arch/arm64/kernel/entry-ftrace.S
176     +++ b/arch/arm64/kernel/entry-ftrace.S
177     @@ -78,7 +78,6 @@
178     .macro mcount_get_lr reg
179     ldr \reg, [x29]
180     ldr \reg, [\reg, #8]
181     - mcount_adjust_addr \reg, \reg
182     .endm
183    
184     .macro mcount_get_lr_addr reg
185     diff --git a/arch/mips/include/uapi/asm/inst.h b/arch/mips/include/uapi/asm/inst.h
186     index 711d9b8465b8..377d5179ea3b 100644
187     --- a/arch/mips/include/uapi/asm/inst.h
188     +++ b/arch/mips/include/uapi/asm/inst.h
189     @@ -361,8 +361,8 @@ enum mm_32a_minor_op {
190     mm_ext_op = 0x02c,
191     mm_pool32axf_op = 0x03c,
192     mm_srl32_op = 0x040,
193     + mm_srlv32_op = 0x050,
194     mm_sra_op = 0x080,
195     - mm_srlv32_op = 0x090,
196     mm_rotr_op = 0x0c0,
197     mm_lwxs_op = 0x118,
198     mm_addu32_op = 0x150,
199     diff --git a/arch/mips/ralink/Kconfig b/arch/mips/ralink/Kconfig
200     index 813826a456ca..55a5fee781e8 100644
201     --- a/arch/mips/ralink/Kconfig
202     +++ b/arch/mips/ralink/Kconfig
203     @@ -38,6 +38,7 @@ choice
204    
205     config SOC_MT7620
206     bool "MT7620/8"
207     + select CPU_MIPSR2_IRQ_VI
208     select HW_HAS_PCI
209    
210     config SOC_MT7621
211     diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
212     index c266227fdd5b..31913b3ac7ab 100644
213     --- a/arch/powerpc/include/asm/uaccess.h
214     +++ b/arch/powerpc/include/asm/uaccess.h
215     @@ -59,7 +59,7 @@
216     #endif
217    
218     #define access_ok(type, addr, size) \
219     - (__chk_user_ptr(addr), \
220     + (__chk_user_ptr(addr), (void)(type), \
221     __access_ok((__force unsigned long)(addr), (size), get_fs()))
222    
223     /*
224     diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
225     index 72ae2cdbcd6a..999b04819d69 100644
226     --- a/arch/powerpc/platforms/pseries/dlpar.c
227     +++ b/arch/powerpc/platforms/pseries/dlpar.c
228     @@ -288,6 +288,8 @@ int dlpar_detach_node(struct device_node *dn)
229     if (rc)
230     return rc;
231    
232     + of_node_put(dn);
233     +
234     return 0;
235     }
236    
237     diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
238     index 7485398d0737..9c04562310b3 100644
239     --- a/arch/um/include/asm/pgtable.h
240     +++ b/arch/um/include/asm/pgtable.h
241     @@ -197,12 +197,17 @@ static inline pte_t pte_mkold(pte_t pte)
242    
243     static inline pte_t pte_wrprotect(pte_t pte)
244     {
245     - pte_clear_bits(pte, _PAGE_RW);
246     + if (likely(pte_get_bits(pte, _PAGE_RW)))
247     + pte_clear_bits(pte, _PAGE_RW);
248     + else
249     + return pte;
250     return(pte_mknewprot(pte));
251     }
252    
253     static inline pte_t pte_mkread(pte_t pte)
254     {
255     + if (unlikely(pte_get_bits(pte, _PAGE_USER)))
256     + return pte;
257     pte_set_bits(pte, _PAGE_USER);
258     return(pte_mknewprot(pte));
259     }
260     @@ -221,6 +226,8 @@ static inline pte_t pte_mkyoung(pte_t pte)
261    
262     static inline pte_t pte_mkwrite(pte_t pte)
263     {
264     + if (unlikely(pte_get_bits(pte, _PAGE_RW)))
265     + return pte;
266     pte_set_bits(pte, _PAGE_RW);
267     return(pte_mknewprot(pte));
268     }
269     diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
270     index 4f8560774082..f600ab601e00 100644
271     --- a/arch/x86/events/intel/core.c
272     +++ b/arch/x86/events/intel/core.c
273     @@ -3234,6 +3234,11 @@ static void free_excl_cntrs(int cpu)
274     }
275    
276     static void intel_pmu_cpu_dying(int cpu)
277     +{
278     + fini_debug_store_on_cpu(cpu);
279     +}
280     +
281     +static void intel_pmu_cpu_dead(int cpu)
282     {
283     struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
284     struct intel_shared_regs *pc;
285     @@ -3246,8 +3251,6 @@ static void intel_pmu_cpu_dying(int cpu)
286     }
287    
288     free_excl_cntrs(cpu);
289     -
290     - fini_debug_store_on_cpu(cpu);
291     }
292    
293     static void intel_pmu_sched_task(struct perf_event_context *ctx,
294     @@ -3324,6 +3327,7 @@ static __initconst const struct x86_pmu core_pmu = {
295     .cpu_prepare = intel_pmu_cpu_prepare,
296     .cpu_starting = intel_pmu_cpu_starting,
297     .cpu_dying = intel_pmu_cpu_dying,
298     + .cpu_dead = intel_pmu_cpu_dead,
299     };
300    
301     static __initconst const struct x86_pmu intel_pmu = {
302     @@ -3359,6 +3363,8 @@ static __initconst const struct x86_pmu intel_pmu = {
303     .cpu_prepare = intel_pmu_cpu_prepare,
304     .cpu_starting = intel_pmu_cpu_starting,
305     .cpu_dying = intel_pmu_cpu_dying,
306     + .cpu_dead = intel_pmu_cpu_dead,
307     +
308     .guest_get_msrs = intel_guest_get_msrs,
309     .sched_task = intel_pmu_sched_task,
310     };
311     diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
312     index 8c2a9fa0caf3..686dd4339370 100644
313     --- a/arch/x86/events/intel/uncore_snbep.c
314     +++ b/arch/x86/events/intel/uncore_snbep.c
315     @@ -1221,6 +1221,8 @@ static struct pci_driver snbep_uncore_pci_driver = {
316     .id_table = snbep_uncore_pci_ids,
317     };
318    
319     +#define NODE_ID_MASK 0x7
320     +
321     /*
322     * build pci bus to socket mapping
323     */
324     @@ -1242,7 +1244,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool
325     err = pci_read_config_dword(ubox_dev, nodeid_loc, &config);
326     if (err)
327     break;
328     - nodeid = config;
329     + nodeid = config & NODE_ID_MASK;
330     /* get the Node ID mapping */
331     err = pci_read_config_dword(ubox_dev, idmap_loc, &config);
332     if (err)
333     diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h
334     index 499d6ed0e376..21d6fa27b4a9 100644
335     --- a/arch/x86/include/asm/fpu/internal.h
336     +++ b/arch/x86/include/asm/fpu/internal.h
337     @@ -97,6 +97,9 @@ extern void fpstate_sanitize_xstate(struct fpu *fpu);
338     #define user_insn(insn, output, input...) \
339     ({ \
340     int err; \
341     + \
342     + might_fault(); \
343     + \
344     asm volatile(ASM_STAC "\n" \
345     "1:" #insn "\n\t" \
346     "2: " ASM_CLAC "\n" \
347     diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
348     index 7e6163c9d434..25310d2b8609 100644
349     --- a/arch/x86/kernel/cpu/mcheck/mce.c
350     +++ b/arch/x86/kernel/cpu/mcheck/mce.c
351     @@ -751,6 +751,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp,
352     quirk_no_way_out(i, m, regs);
353    
354     if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) {
355     + m->bank = i;
356     mce_read_aux(m, i);
357     *msg = tmp;
358     return 1;
359     diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
360     index fa1b0e3c8a06..c8efacf2e65f 100644
361     --- a/arch/x86/kvm/svm.c
362     +++ b/arch/x86/kvm/svm.c
363     @@ -5223,6 +5223,13 @@ static bool svm_cpu_has_accelerated_tpr(void)
364    
365     static bool svm_has_emulated_msr(int index)
366     {
367     + switch (index) {
368     + case MSR_IA32_MCG_EXT_CTL:
369     + return false;
370     + default:
371     + break;
372     + }
373     +
374     return true;
375     }
376    
377     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
378     index 9446a3a2fc69..91db841101ca 100644
379     --- a/arch/x86/kvm/vmx.c
380     +++ b/arch/x86/kvm/vmx.c
381     @@ -7368,6 +7368,7 @@ static void free_nested(struct vcpu_vmx *vmx)
382     if (!vmx->nested.vmxon)
383     return;
384    
385     + hrtimer_cancel(&vmx->nested.preemption_timer);
386     vmx->nested.vmxon = false;
387     free_vpid(vmx->nested.vpid02);
388     nested_release_vmcs12(vmx);
389     diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
390     index 851e9d6c864f..5a35fee46620 100644
391     --- a/arch/x86/kvm/x86.c
392     +++ b/arch/x86/kvm/x86.c
393     @@ -4513,6 +4513,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu,
394     {
395     u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0;
396    
397     + /*
398     + * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED
399     + * is returned, but our callers are not ready for that and they blindly
400     + * call kvm_inject_page_fault. Ensure that they at least do not leak
401     + * uninitialized kernel stack memory into cr2 and error code.
402     + */
403     + memset(exception, 0, sizeof(*exception));
404     return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access,
405     exception);
406     }
407     diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c
408     index 526536c81ddc..ca1e8e6dccc8 100644
409     --- a/arch/x86/pci/broadcom_bus.c
410     +++ b/arch/x86/pci/broadcom_bus.c
411     @@ -50,8 +50,8 @@ static void __init cnb20le_res(u8 bus, u8 slot, u8 func)
412     word1 = read_pci_config_16(bus, slot, func, 0xc0);
413     word2 = read_pci_config_16(bus, slot, func, 0xc2);
414     if (word1 != word2) {
415     - res.start = (word1 << 16) | 0x0000;
416     - res.end = (word2 << 16) | 0xffff;
417     + res.start = ((resource_size_t) word1 << 16) | 0x0000;
418     + res.end = ((resource_size_t) word2 << 16) | 0xffff;
419     res.flags = IORESOURCE_MEM;
420     update_res(info, res.start, res.end, res.flags, 0);
421     }
422     diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c
423     index e83a3d3421b9..07e146b772ea 100644
424     --- a/drivers/ata/sata_rcar.c
425     +++ b/drivers/ata/sata_rcar.c
426     @@ -872,7 +872,9 @@ static int sata_rcar_probe(struct platform_device *pdev)
427     int ret = 0;
428    
429     irq = platform_get_irq(pdev, 0);
430     - if (irq <= 0)
431     + if (irq < 0)
432     + return irq;
433     + if (!irq)
434     return -EINVAL;
435    
436     priv = devm_kzalloc(&pdev->dev, sizeof(struct sata_rcar_priv),
437     diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
438     index f35db29cac76..abee91940a36 100644
439     --- a/drivers/block/drbd/drbd_nl.c
440     +++ b/drivers/block/drbd/drbd_nl.c
441     @@ -668,14 +668,15 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for
442     if (rv == SS_TWO_PRIMARIES) {
443     /* Maybe the peer is detected as dead very soon...
444     retry at most once more in this case. */
445     - int timeo;
446     - rcu_read_lock();
447     - nc = rcu_dereference(connection->net_conf);
448     - timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1;
449     - rcu_read_unlock();
450     - schedule_timeout_interruptible(timeo);
451     - if (try < max_tries)
452     + if (try < max_tries) {
453     + int timeo;
454     try = max_tries - 1;
455     + rcu_read_lock();
456     + nc = rcu_dereference(connection->net_conf);
457     + timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1;
458     + rcu_read_unlock();
459     + schedule_timeout_interruptible(timeo);
460     + }
461     continue;
462     }
463     if (rv < SS_SUCCESS) {
464     diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
465     index 942384f34e22..83957a1e15ed 100644
466     --- a/drivers/block/drbd/drbd_receiver.c
467     +++ b/drivers/block/drbd/drbd_receiver.c
468     @@ -3421,7 +3421,7 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device,
469     enum drbd_conns rv = C_MASK;
470     enum drbd_disk_state mydisk;
471     struct net_conf *nc;
472     - int hg, rule_nr, rr_conflict, tentative;
473     + int hg, rule_nr, rr_conflict, tentative, always_asbp;
474    
475     mydisk = device->state.disk;
476     if (mydisk == D_NEGOTIATING)
477     @@ -3472,8 +3472,12 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device,
478    
479     rcu_read_lock();
480     nc = rcu_dereference(peer_device->connection->net_conf);
481     + always_asbp = nc->always_asbp;
482     + rr_conflict = nc->rr_conflict;
483     + tentative = nc->tentative;
484     + rcu_read_unlock();
485    
486     - if (hg == 100 || (hg == -100 && nc->always_asbp)) {
487     + if (hg == 100 || (hg == -100 && always_asbp)) {
488     int pcount = (device->state.role == R_PRIMARY)
489     + (peer_role == R_PRIMARY);
490     int forced = (hg == -100);
491     @@ -3512,9 +3516,6 @@ static enum drbd_conns drbd_sync_handshake(struct drbd_peer_device *peer_device,
492     "Sync from %s node\n",
493     (hg < 0) ? "peer" : "this");
494     }
495     - rr_conflict = nc->rr_conflict;
496     - tentative = nc->tentative;
497     - rcu_read_unlock();
498    
499     if (hg == -100) {
500     /* FIXME this log message is not correct if we end up here
501     @@ -4198,7 +4199,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info
502     kfree(device->p_uuid);
503     device->p_uuid = p_uuid;
504    
505     - if (device->state.conn < C_CONNECTED &&
506     + if ((device->state.conn < C_CONNECTED || device->state.pdsk == D_DISKLESS) &&
507     device->state.disk < D_INCONSISTENT &&
508     device->state.role == R_PRIMARY &&
509     (device->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) {
510     diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
511     index cab157331c4e..c6d43a2a807d 100644
512     --- a/drivers/block/sunvdc.c
513     +++ b/drivers/block/sunvdc.c
514     @@ -40,6 +40,8 @@ MODULE_VERSION(DRV_MODULE_VERSION);
515     #define WAITING_FOR_GEN_CMD 0x04
516     #define WAITING_FOR_ANY -1
517    
518     +#define VDC_MAX_RETRIES 10
519     +
520     static struct workqueue_struct *sunvdc_wq;
521    
522     struct vdc_req_entry {
523     @@ -419,6 +421,7 @@ static int __vdc_tx_trigger(struct vdc_port *port)
524     .end_idx = dr->prod,
525     };
526     int err, delay;
527     + int retries = 0;
528    
529     hdr.seq = dr->snd_nxt;
530     delay = 1;
531     @@ -431,6 +434,8 @@ static int __vdc_tx_trigger(struct vdc_port *port)
532     udelay(delay);
533     if ((delay <<= 1) > 128)
534     delay = 128;
535     + if (retries++ > VDC_MAX_RETRIES)
536     + break;
537     } while (err == -EAGAIN);
538    
539     if (err == -ENOTCONN)
540     diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
541     index c264f2d284a7..2e0a9e2531cb 100644
542     --- a/drivers/block/swim3.c
543     +++ b/drivers/block/swim3.c
544     @@ -1027,7 +1027,11 @@ static void floppy_release(struct gendisk *disk, fmode_t mode)
545     struct swim3 __iomem *sw = fs->swim3;
546    
547     mutex_lock(&swim3_mutex);
548     - if (fs->ref_count > 0 && --fs->ref_count == 0) {
549     + if (fs->ref_count > 0)
550     + --fs->ref_count;
551     + else if (fs->ref_count == -1)
552     + fs->ref_count = 0;
553     + if (fs->ref_count == 0) {
554     swim3_action(fs, MOTOR_OFF);
555     out_8(&sw->control_bic, 0xff);
556     swim3_select(fs, RELAX);
557     diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
558     index e2808fefbb78..1852d19d0d7b 100644
559     --- a/drivers/cdrom/gdrom.c
560     +++ b/drivers/cdrom/gdrom.c
561     @@ -882,6 +882,7 @@ static void __exit exit_gdrom(void)
562     platform_device_unregister(pd);
563     platform_driver_unregister(&gdrom_driver);
564     kfree(gd.toc);
565     + kfree(gd.cd_info);
566     }
567    
568     module_init(init_gdrom);
569     diff --git a/drivers/clk/imx/clk-imx6sl.c b/drivers/clk/imx/clk-imx6sl.c
570     index 5fd4ddac1bf1..f3d9dc2d2405 100644
571     --- a/drivers/clk/imx/clk-imx6sl.c
572     +++ b/drivers/clk/imx/clk-imx6sl.c
573     @@ -17,6 +17,8 @@
574    
575     #include "clk.h"
576    
577     +#define CCDR 0x4
578     +#define BM_CCM_CCDR_MMDC_CH0_MASK (1 << 17)
579     #define CCSR 0xc
580     #define BM_CCSR_PLL1_SW_CLK_SEL (1 << 2)
581     #define CACRR 0x10
582     @@ -414,6 +416,10 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
583     clks[IMX6SL_CLK_USDHC3] = imx_clk_gate2("usdhc3", "usdhc3_podf", base + 0x80, 6);
584     clks[IMX6SL_CLK_USDHC4] = imx_clk_gate2("usdhc4", "usdhc4_podf", base + 0x80, 8);
585    
586     + /* Ensure the MMDC CH0 handshake is bypassed */
587     + writel_relaxed(readl_relaxed(base + CCDR) |
588     + BM_CCM_CCDR_MMDC_CH0_MASK, base + CCDR);
589     +
590     imx_check_clocks(clks, ARRAY_SIZE(clks));
591    
592     clk_data.clks = clks;
593     diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
594     index e1dc4e5b34e1..82add4670c53 100644
595     --- a/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
596     +++ b/drivers/clk/sunxi-ng/ccu-sun8i-a33.c
597     @@ -362,10 +362,10 @@ static SUNXI_CCU_MP_WITH_MUX_GATE(spi1_clk, "spi1", mod0_default_parents, 0x0a4,
598     static const char * const i2s_parents[] = { "pll-audio-8x", "pll-audio-4x",
599     "pll-audio-2x", "pll-audio" };
600     static SUNXI_CCU_MUX_WITH_GATE(i2s0_clk, "i2s0", i2s_parents,
601     - 0x0b0, 16, 2, BIT(31), 0);
602     + 0x0b0, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
603    
604     static SUNXI_CCU_MUX_WITH_GATE(i2s1_clk, "i2s1", i2s_parents,
605     - 0x0b4, 16, 2, BIT(31), 0);
606     + 0x0b4, 16, 2, BIT(31), CLK_SET_RATE_PARENT);
607    
608     /* TODO: the parent for most of the USB clocks is not known */
609     static SUNXI_CCU_GATE(usb_phy0_clk, "usb-phy0", "osc24M",
610     @@ -442,7 +442,7 @@ static SUNXI_CCU_M_WITH_GATE(ve_clk, "ve", "pll-ve",
611     static SUNXI_CCU_GATE(ac_dig_clk, "ac-dig", "pll-audio",
612     0x140, BIT(31), 0);
613     static SUNXI_CCU_GATE(ac_dig_4x_clk, "ac-dig-4x", "pll-audio-4x",
614     - 0x140, BIT(30), 0);
615     + 0x140, BIT(30), CLK_SET_RATE_PARENT);
616     static SUNXI_CCU_GATE(avs_clk, "avs", "osc24M",
617     0x144, BIT(31), 0);
618    
619     diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c
620     index db2ede565f1a..b44476a1b7ad 100644
621     --- a/drivers/cpuidle/cpuidle-big_little.c
622     +++ b/drivers/cpuidle/cpuidle-big_little.c
623     @@ -167,6 +167,7 @@ static int __init bl_idle_init(void)
624     {
625     int ret;
626     struct device_node *root = of_find_node_by_path("/");
627     + const struct of_device_id *match_id;
628    
629     if (!root)
630     return -ENODEV;
631     @@ -174,7 +175,11 @@ static int __init bl_idle_init(void)
632     /*
633     * Initialize the driver just for a compliant set of machines
634     */
635     - if (!of_match_node(compatible_machine_match, root))
636     + match_id = of_match_node(compatible_machine_match, root);
637     +
638     + of_node_put(root);
639     +
640     + if (!match_id)
641     return -ENODEV;
642    
643     if (!mcpm_is_available())
644     diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
645     index 790f7cadc1ed..efebc484e371 100644
646     --- a/drivers/crypto/ux500/cryp/cryp_core.c
647     +++ b/drivers/crypto/ux500/cryp/cryp_core.c
648     @@ -555,7 +555,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx,
649     desc = dmaengine_prep_slave_sg(channel,
650     ctx->device->dma.sg_src,
651     ctx->device->dma.sg_src_len,
652     - direction, DMA_CTRL_ACK);
653     + DMA_MEM_TO_DEV, DMA_CTRL_ACK);
654     break;
655    
656     case DMA_FROM_DEVICE:
657     @@ -579,7 +579,7 @@ static int cryp_set_dma_transfer(struct cryp_ctx *ctx,
658     desc = dmaengine_prep_slave_sg(channel,
659     ctx->device->dma.sg_dst,
660     ctx->device->dma.sg_dst_len,
661     - direction,
662     + DMA_DEV_TO_MEM,
663     DMA_CTRL_ACK |
664     DMA_PREP_INTERRUPT);
665    
666     diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
667     index 9acccad26928..17c8e2b28c42 100644
668     --- a/drivers/crypto/ux500/hash/hash_core.c
669     +++ b/drivers/crypto/ux500/hash/hash_core.c
670     @@ -165,7 +165,7 @@ static int hash_set_dma_transfer(struct hash_ctx *ctx, struct scatterlist *sg,
671     __func__);
672     desc = dmaengine_prep_slave_sg(channel,
673     ctx->device->dma.sg, ctx->device->dma.sg_len,
674     - direction, DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
675     + DMA_MEM_TO_DEV, DMA_CTRL_ACK | DMA_PREP_INTERRUPT);
676     if (!desc) {
677     dev_err(ctx->device->dev,
678     "%s: dmaengine_prep_slave_sg() failed!\n", __func__);
679     diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c
680     index 6204cc32d09c..6ba53bbd0e16 100644
681     --- a/drivers/dma/bcm2835-dma.c
682     +++ b/drivers/dma/bcm2835-dma.c
683     @@ -415,38 +415,32 @@ static void bcm2835_dma_fill_cb_chain_with_sg(
684     }
685     }
686    
687     -static int bcm2835_dma_abort(void __iomem *chan_base)
688     +static int bcm2835_dma_abort(struct bcm2835_chan *c)
689     {
690     - unsigned long cs;
691     + void __iomem *chan_base = c->chan_base;
692     long int timeout = 10000;
693    
694     - cs = readl(chan_base + BCM2835_DMA_CS);
695     - if (!(cs & BCM2835_DMA_ACTIVE))
696     + /*
697     + * A zero control block address means the channel is idle.
698     + * (The ACTIVE flag in the CS register is not a reliable indicator.)
699     + */
700     + if (!readl(chan_base + BCM2835_DMA_ADDR))
701     return 0;
702    
703     /* Write 0 to the active bit - Pause the DMA */
704     writel(0, chan_base + BCM2835_DMA_CS);
705    
706     /* Wait for any current AXI transfer to complete */
707     - while ((cs & BCM2835_DMA_ISPAUSED) && --timeout) {
708     + while ((readl(chan_base + BCM2835_DMA_CS) &
709     + BCM2835_DMA_WAITING_FOR_WRITES) && --timeout)
710     cpu_relax();
711     - cs = readl(chan_base + BCM2835_DMA_CS);
712     - }
713    
714     - /* We'll un-pause when we set of our next DMA */
715     + /* Peripheral might be stuck and fail to signal AXI write responses */
716     if (!timeout)
717     - return -ETIMEDOUT;
718     -
719     - if (!(cs & BCM2835_DMA_ACTIVE))
720     - return 0;
721     -
722     - /* Terminate the control block chain */
723     - writel(0, chan_base + BCM2835_DMA_NEXTCB);
724     -
725     - /* Abort the whole DMA */
726     - writel(BCM2835_DMA_ABORT | BCM2835_DMA_ACTIVE,
727     - chan_base + BCM2835_DMA_CS);
728     + dev_err(c->vc.chan.device->dev,
729     + "failed to complete outstanding writes\n");
730    
731     + writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS);
732     return 0;
733     }
734    
735     @@ -485,8 +479,15 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data)
736    
737     spin_lock_irqsave(&c->vc.lock, flags);
738    
739     - /* Acknowledge interrupt */
740     - writel(BCM2835_DMA_INT, c->chan_base + BCM2835_DMA_CS);
741     + /*
742     + * Clear the INT flag to receive further interrupts. Keep the channel
743     + * active in case the descriptor is cyclic or in case the client has
744     + * already terminated the descriptor and issued a new one. (May happen
745     + * if this IRQ handler is threaded.) If the channel is finished, it
746     + * will remain idle despite the ACTIVE flag being set.
747     + */
748     + writel(BCM2835_DMA_INT | BCM2835_DMA_ACTIVE,
749     + c->chan_base + BCM2835_DMA_CS);
750    
751     d = c->desc;
752    
753     @@ -494,11 +495,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data)
754     if (d->cyclic) {
755     /* call the cyclic callback */
756     vchan_cyclic_callback(&d->vd);
757     -
758     - /* Keep the DMA engine running */
759     - writel(BCM2835_DMA_ACTIVE,
760     - c->chan_base + BCM2835_DMA_CS);
761     - } else {
762     + } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) {
763     vchan_cookie_complete(&c->desc->vd);
764     bcm2835_dma_start_desc(c);
765     }
766     @@ -796,7 +793,6 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
767     struct bcm2835_chan *c = to_bcm2835_dma_chan(chan);
768     struct bcm2835_dmadev *d = to_bcm2835_dma_dev(c->vc.chan.device);
769     unsigned long flags;
770     - int timeout = 10000;
771     LIST_HEAD(head);
772    
773     spin_lock_irqsave(&c->vc.lock, flags);
774     @@ -806,27 +802,11 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan)
775     list_del_init(&c->node);
776     spin_unlock(&d->lock);
777    
778     - /*
779     - * Stop DMA activity: we assume the callback will not be called
780     - * after bcm_dma_abort() returns (even if it does, it will see
781     - * c->desc is NULL and exit.)
782     - */
783     + /* stop DMA activity */
784     if (c->desc) {
785     bcm2835_dma_desc_free(&c->desc->vd);
786     c->desc = NULL;
787     - bcm2835_dma_abort(c->chan_base);
788     -
789     - /* Wait for stopping */
790     - while (--timeout) {
791     - if (!(readl(c->chan_base + BCM2835_DMA_CS) &
792     - BCM2835_DMA_ACTIVE))
793     - break;
794     -
795     - cpu_relax();
796     - }
797     -
798     - if (!timeout)
799     - dev_err(d->ddev.dev, "DMA transfer could not be terminated\n");
800     + bcm2835_dma_abort(c);
801     }
802    
803     vchan_get_all_descriptors(&c->vc, &head);
804     diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
805     index ab0fb804fb1e..1cfa1d9bc971 100644
806     --- a/drivers/dma/imx-dma.c
807     +++ b/drivers/dma/imx-dma.c
808     @@ -623,7 +623,7 @@ static void imxdma_tasklet(unsigned long data)
809     {
810     struct imxdma_channel *imxdmac = (void *)data;
811     struct imxdma_engine *imxdma = imxdmac->imxdma;
812     - struct imxdma_desc *desc;
813     + struct imxdma_desc *desc, *next_desc;
814     unsigned long flags;
815    
816     spin_lock_irqsave(&imxdma->lock, flags);
817     @@ -653,10 +653,10 @@ static void imxdma_tasklet(unsigned long data)
818     list_move_tail(imxdmac->ld_active.next, &imxdmac->ld_free);
819    
820     if (!list_empty(&imxdmac->ld_queue)) {
821     - desc = list_first_entry(&imxdmac->ld_queue, struct imxdma_desc,
822     - node);
823     + next_desc = list_first_entry(&imxdmac->ld_queue,
824     + struct imxdma_desc, node);
825     list_move_tail(imxdmac->ld_queue.next, &imxdmac->ld_active);
826     - if (imxdma_xfer_desc(desc) < 0)
827     + if (imxdma_xfer_desc(next_desc) < 0)
828     dev_warn(imxdma->dev, "%s: channel: %d couldn't xfer desc\n",
829     __func__, imxdmac->channel);
830     }
831     diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
832     index 22658057fe27..9069fb854319 100644
833     --- a/drivers/dma/xilinx/zynqmp_dma.c
834     +++ b/drivers/dma/xilinx/zynqmp_dma.c
835     @@ -159,7 +159,7 @@ struct zynqmp_dma_desc_ll {
836     u32 ctrl;
837     u64 nxtdscraddr;
838     u64 rsvd;
839     -}; __aligned(64)
840     +};
841    
842     /**
843     * struct zynqmp_dma_desc_sw - Per Transaction structure
844     diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
845     index 9336ffdf6e2c..fceaafd67ec6 100644
846     --- a/drivers/firmware/efi/vars.c
847     +++ b/drivers/firmware/efi/vars.c
848     @@ -318,7 +318,12 @@ EXPORT_SYMBOL_GPL(efivar_variable_is_removable);
849     static efi_status_t
850     check_var_size(u32 attributes, unsigned long size)
851     {
852     - const struct efivar_operations *fops = __efivars->ops;
853     + const struct efivar_operations *fops;
854     +
855     + if (!__efivars)
856     + return EFI_UNSUPPORTED;
857     +
858     + fops = __efivars->ops;
859    
860     if (!fops->query_variable_store)
861     return EFI_UNSUPPORTED;
862     @@ -329,7 +334,12 @@ check_var_size(u32 attributes, unsigned long size)
863     static efi_status_t
864     check_var_size_nonblocking(u32 attributes, unsigned long size)
865     {
866     - const struct efivar_operations *fops = __efivars->ops;
867     + const struct efivar_operations *fops;
868     +
869     + if (!__efivars)
870     + return EFI_UNSUPPORTED;
871     +
872     + fops = __efivars->ops;
873    
874     if (!fops->query_variable_store)
875     return EFI_UNSUPPORTED;
876     @@ -429,13 +439,18 @@ static void dup_variable_bug(efi_char16_t *str16, efi_guid_t *vendor_guid,
877     int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *),
878     void *data, bool duplicates, struct list_head *head)
879     {
880     - const struct efivar_operations *ops = __efivars->ops;
881     + const struct efivar_operations *ops;
882     unsigned long variable_name_size = 1024;
883     efi_char16_t *variable_name;
884     efi_status_t status;
885     efi_guid_t vendor_guid;
886     int err = 0;
887    
888     + if (!__efivars)
889     + return -EFAULT;
890     +
891     + ops = __efivars->ops;
892     +
893     variable_name = kzalloc(variable_name_size, GFP_KERNEL);
894     if (!variable_name) {
895     printk(KERN_ERR "efivars: Memory allocation failed.\n");
896     @@ -583,12 +598,14 @@ static void efivar_entry_list_del_unlock(struct efivar_entry *entry)
897     */
898     int __efivar_entry_delete(struct efivar_entry *entry)
899     {
900     - const struct efivar_operations *ops = __efivars->ops;
901     efi_status_t status;
902    
903     - status = ops->set_variable(entry->var.VariableName,
904     - &entry->var.VendorGuid,
905     - 0, 0, NULL);
906     + if (!__efivars)
907     + return -EINVAL;
908     +
909     + status = __efivars->ops->set_variable(entry->var.VariableName,
910     + &entry->var.VendorGuid,
911     + 0, 0, NULL);
912    
913     return efi_status_to_err(status);
914     }
915     @@ -607,12 +624,17 @@ EXPORT_SYMBOL_GPL(__efivar_entry_delete);
916     */
917     int efivar_entry_delete(struct efivar_entry *entry)
918     {
919     - const struct efivar_operations *ops = __efivars->ops;
920     + const struct efivar_operations *ops;
921     efi_status_t status;
922    
923     if (down_interruptible(&efivars_lock))
924     return -EINTR;
925    
926     + if (!__efivars) {
927     + up(&efivars_lock);
928     + return -EINVAL;
929     + }
930     + ops = __efivars->ops;
931     status = ops->set_variable(entry->var.VariableName,
932     &entry->var.VendorGuid,
933     0, 0, NULL);
934     @@ -650,13 +672,19 @@ EXPORT_SYMBOL_GPL(efivar_entry_delete);
935     int efivar_entry_set(struct efivar_entry *entry, u32 attributes,
936     unsigned long size, void *data, struct list_head *head)
937     {
938     - const struct efivar_operations *ops = __efivars->ops;
939     + const struct efivar_operations *ops;
940     efi_status_t status;
941     efi_char16_t *name = entry->var.VariableName;
942     efi_guid_t vendor = entry->var.VendorGuid;
943    
944     if (down_interruptible(&efivars_lock))
945     return -EINTR;
946     +
947     + if (!__efivars) {
948     + up(&efivars_lock);
949     + return -EINVAL;
950     + }
951     + ops = __efivars->ops;
952     if (head && efivar_entry_find(name, vendor, head, false)) {
953     up(&efivars_lock);
954     return -EEXIST;
955     @@ -687,12 +715,17 @@ static int
956     efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor,
957     u32 attributes, unsigned long size, void *data)
958     {
959     - const struct efivar_operations *ops = __efivars->ops;
960     + const struct efivar_operations *ops;
961     efi_status_t status;
962    
963     if (down_trylock(&efivars_lock))
964     return -EBUSY;
965    
966     + if (!__efivars) {
967     + up(&efivars_lock);
968     + return -EINVAL;
969     + }
970     +
971     status = check_var_size_nonblocking(attributes,
972     size + ucs2_strsize(name, 1024));
973     if (status != EFI_SUCCESS) {
974     @@ -700,6 +733,7 @@ efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor,
975     return -ENOSPC;
976     }
977    
978     + ops = __efivars->ops;
979     status = ops->set_variable_nonblocking(name, &vendor, attributes,
980     size, data);
981    
982     @@ -727,9 +761,13 @@ efivar_entry_set_nonblocking(efi_char16_t *name, efi_guid_t vendor,
983     int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
984     bool block, unsigned long size, void *data)
985     {
986     - const struct efivar_operations *ops = __efivars->ops;
987     + const struct efivar_operations *ops;
988     efi_status_t status;
989    
990     + if (!__efivars)
991     + return -EINVAL;
992     +
993     + ops = __efivars->ops;
994     if (!ops->query_variable_store)
995     return -ENOSYS;
996    
997     @@ -829,13 +867,18 @@ EXPORT_SYMBOL_GPL(efivar_entry_find);
998     */
999     int efivar_entry_size(struct efivar_entry *entry, unsigned long *size)
1000     {
1001     - const struct efivar_operations *ops = __efivars->ops;
1002     + const struct efivar_operations *ops;
1003     efi_status_t status;
1004    
1005     *size = 0;
1006    
1007     if (down_interruptible(&efivars_lock))
1008     return -EINTR;
1009     + if (!__efivars) {
1010     + up(&efivars_lock);
1011     + return -EINVAL;
1012     + }
1013     + ops = __efivars->ops;
1014     status = ops->get_variable(entry->var.VariableName,
1015     &entry->var.VendorGuid, NULL, size, NULL);
1016     up(&efivars_lock);
1017     @@ -861,12 +904,14 @@ EXPORT_SYMBOL_GPL(efivar_entry_size);
1018     int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
1019     unsigned long *size, void *data)
1020     {
1021     - const struct efivar_operations *ops = __efivars->ops;
1022     efi_status_t status;
1023    
1024     - status = ops->get_variable(entry->var.VariableName,
1025     - &entry->var.VendorGuid,
1026     - attributes, size, data);
1027     + if (!__efivars)
1028     + return -EINVAL;
1029     +
1030     + status = __efivars->ops->get_variable(entry->var.VariableName,
1031     + &entry->var.VendorGuid,
1032     + attributes, size, data);
1033    
1034     return efi_status_to_err(status);
1035     }
1036     @@ -882,14 +927,19 @@ EXPORT_SYMBOL_GPL(__efivar_entry_get);
1037     int efivar_entry_get(struct efivar_entry *entry, u32 *attributes,
1038     unsigned long *size, void *data)
1039     {
1040     - const struct efivar_operations *ops = __efivars->ops;
1041     efi_status_t status;
1042    
1043     if (down_interruptible(&efivars_lock))
1044     return -EINTR;
1045     - status = ops->get_variable(entry->var.VariableName,
1046     - &entry->var.VendorGuid,
1047     - attributes, size, data);
1048     +
1049     + if (!__efivars) {
1050     + up(&efivars_lock);
1051     + return -EINVAL;
1052     + }
1053     +
1054     + status = __efivars->ops->get_variable(entry->var.VariableName,
1055     + &entry->var.VendorGuid,
1056     + attributes, size, data);
1057     up(&efivars_lock);
1058    
1059     return efi_status_to_err(status);
1060     @@ -921,7 +971,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_get);
1061     int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
1062     unsigned long *size, void *data, bool *set)
1063     {
1064     - const struct efivar_operations *ops = __efivars->ops;
1065     + const struct efivar_operations *ops;
1066     efi_char16_t *name = entry->var.VariableName;
1067     efi_guid_t *vendor = &entry->var.VendorGuid;
1068     efi_status_t status;
1069     @@ -940,6 +990,11 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
1070     if (down_interruptible(&efivars_lock))
1071     return -EINTR;
1072    
1073     + if (!__efivars) {
1074     + err = -EINVAL;
1075     + goto out;
1076     + }
1077     +
1078     /*
1079     * Ensure that the available space hasn't shrunk below the safe level
1080     */
1081     @@ -956,6 +1011,8 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
1082     }
1083     }
1084    
1085     + ops = __efivars->ops;
1086     +
1087     status = ops->set_variable(name, vendor, attributes, *size, data);
1088     if (status != EFI_SUCCESS) {
1089     err = efi_status_to_err(status);
1090     diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
1091     index adb1dd7fde5f..9ccd7d702cd3 100644
1092     --- a/drivers/gpu/drm/drm_bufs.c
1093     +++ b/drivers/gpu/drm/drm_bufs.c
1094     @@ -36,6 +36,8 @@
1095     #include <drm/drmP.h>
1096     #include "drm_legacy.h"
1097    
1098     +#include <linux/nospec.h>
1099     +
1100     static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
1101     struct drm_local_map *map)
1102     {
1103     @@ -1413,6 +1415,7 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
1104     idx, dma->buf_count - 1);
1105     return -EINVAL;
1106     }
1107     + idx = array_index_nospec(idx, dma->buf_count);
1108     buf = dma->buflist[idx];
1109     if (buf->file_priv != file_priv) {
1110     DRM_ERROR("Process %d freeing buffer not owned\n",
1111     diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c
1112     index 70051bf0ee5c..0376c0c2fc66 100644
1113     --- a/drivers/gpu/drm/vc4/vc4_plane.c
1114     +++ b/drivers/gpu/drm/vc4/vc4_plane.c
1115     @@ -345,12 +345,14 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state)
1116     vc4_get_scaling_mode(vc4_state->src_h[1],
1117     vc4_state->crtc_h);
1118    
1119     - /* YUV conversion requires that horizontal scaling be enabled,
1120     - * even on a plane that's otherwise 1:1. Looks like only PPF
1121     - * works in that case, so let's pick that one.
1122     + /* YUV conversion requires that horizontal scaling be enabled
1123     + * on the UV plane even if vc4_get_scaling_mode() returned
1124     + * VC4_SCALING_NONE (which can happen when the down-scaling
1125     + * ratio is 0.5). Let's force it to VC4_SCALING_PPF in this
1126     + * case.
1127     */
1128     - if (vc4_state->is_unity)
1129     - vc4_state->x_scaling[0] = VC4_SCALING_PPF;
1130     + if (vc4_state->x_scaling[1] == VC4_SCALING_NONE)
1131     + vc4_state->x_scaling[1] = VC4_SCALING_PPF;
1132     } else {
1133     vc4_state->is_yuv = false;
1134     vc4_state->x_scaling[1] = VC4_SCALING_NONE;
1135     diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
1136     index 805b6fa7b5f4..50b73f3876fb 100644
1137     --- a/drivers/gpu/ipu-v3/ipu-image-convert.c
1138     +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
1139     @@ -1513,7 +1513,7 @@ unlock:
1140     EXPORT_SYMBOL_GPL(ipu_image_convert_queue);
1141    
1142     /* Abort any active or pending conversions for this context */
1143     -void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
1144     +static void __ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
1145     {
1146     struct ipu_image_convert_chan *chan = ctx->chan;
1147     struct ipu_image_convert_priv *priv = chan->priv;
1148     @@ -1540,7 +1540,7 @@ void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
1149    
1150     need_abort = (run_count || active_run);
1151    
1152     - ctx->aborting = need_abort;
1153     + ctx->aborting = true;
1154    
1155     spin_unlock_irqrestore(&chan->irqlock, flags);
1156    
1157     @@ -1561,7 +1561,11 @@ void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
1158     dev_warn(priv->ipu->dev, "%s: timeout\n", __func__);
1159     force_abort(ctx);
1160     }
1161     +}
1162    
1163     +void ipu_image_convert_abort(struct ipu_image_convert_ctx *ctx)
1164     +{
1165     + __ipu_image_convert_abort(ctx);
1166     ctx->aborting = false;
1167     }
1168     EXPORT_SYMBOL_GPL(ipu_image_convert_abort);
1169     @@ -1575,7 +1579,7 @@ void ipu_image_convert_unprepare(struct ipu_image_convert_ctx *ctx)
1170     bool put_res;
1171    
1172     /* make sure no runs are hanging around */
1173     - ipu_image_convert_abort(ctx);
1174     + __ipu_image_convert_abort(ctx);
1175    
1176     dev_dbg(priv->ipu->dev, "%s: task %u: removing ctx %p\n", __func__,
1177     chan->ic_task, ctx);
1178     diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c
1179     index 1ac4ff4d57a6..d409cc8759fc 100644
1180     --- a/drivers/hid/hid-lenovo.c
1181     +++ b/drivers/hid/hid-lenovo.c
1182     @@ -713,7 +713,9 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
1183     data_pointer->led_mute.brightness_get = lenovo_led_brightness_get_tpkbd;
1184     data_pointer->led_mute.brightness_set = lenovo_led_brightness_set_tpkbd;
1185     data_pointer->led_mute.dev = dev;
1186     - led_classdev_register(dev, &data_pointer->led_mute);
1187     + ret = led_classdev_register(dev, &data_pointer->led_mute);
1188     + if (ret < 0)
1189     + goto err;
1190    
1191     data_pointer->led_micmute.name = name_micmute;
1192     data_pointer->led_micmute.brightness_get =
1193     @@ -721,7 +723,11 @@ static int lenovo_probe_tpkbd(struct hid_device *hdev)
1194     data_pointer->led_micmute.brightness_set =
1195     lenovo_led_brightness_set_tpkbd;
1196     data_pointer->led_micmute.dev = dev;
1197     - led_classdev_register(dev, &data_pointer->led_micmute);
1198     + ret = led_classdev_register(dev, &data_pointer->led_micmute);
1199     + if (ret < 0) {
1200     + led_classdev_unregister(&data_pointer->led_mute);
1201     + goto err;
1202     + }
1203    
1204     lenovo_features_set_tpkbd(hdev);
1205    
1206     diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
1207     index 4bcd9b882948..cb6606a0470d 100644
1208     --- a/drivers/hwmon/lm80.c
1209     +++ b/drivers/hwmon/lm80.c
1210     @@ -360,9 +360,11 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
1211     struct i2c_client *client = data->client;
1212     unsigned long min, val;
1213     u8 reg;
1214     - int err = kstrtoul(buf, 10, &val);
1215     - if (err < 0)
1216     - return err;
1217     + int rv;
1218     +
1219     + rv = kstrtoul(buf, 10, &val);
1220     + if (rv < 0)
1221     + return rv;
1222    
1223     /* Save fan_min */
1224     mutex_lock(&data->update_lock);
1225     @@ -390,8 +392,11 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr,
1226     return -EINVAL;
1227     }
1228    
1229     - reg = (lm80_read_value(client, LM80_REG_FANDIV) &
1230     - ~(3 << (2 * (nr + 1)))) | (data->fan_div[nr] << (2 * (nr + 1)));
1231     + rv = lm80_read_value(client, LM80_REG_FANDIV);
1232     + if (rv < 0)
1233     + return rv;
1234     + reg = (rv & ~(3 << (2 * (nr + 1))))
1235     + | (data->fan_div[nr] << (2 * (nr + 1)));
1236     lm80_write_value(client, LM80_REG_FANDIV, reg);
1237    
1238     /* Restore fan_min */
1239     @@ -623,6 +628,7 @@ static int lm80_probe(struct i2c_client *client,
1240     struct device *dev = &client->dev;
1241     struct device *hwmon_dev;
1242     struct lm80_data *data;
1243     + int rv;
1244    
1245     data = devm_kzalloc(dev, sizeof(struct lm80_data), GFP_KERNEL);
1246     if (!data)
1247     @@ -635,8 +641,14 @@ static int lm80_probe(struct i2c_client *client,
1248     lm80_init_client(client);
1249    
1250     /* A few vars need to be filled upon startup */
1251     - data->fan[f_min][0] = lm80_read_value(client, LM80_REG_FAN_MIN(1));
1252     - data->fan[f_min][1] = lm80_read_value(client, LM80_REG_FAN_MIN(2));
1253     + rv = lm80_read_value(client, LM80_REG_FAN_MIN(1));
1254     + if (rv < 0)
1255     + return rv;
1256     + data->fan[f_min][0] = rv;
1257     + rv = lm80_read_value(client, LM80_REG_FAN_MIN(2));
1258     + if (rv < 0)
1259     + return rv;
1260     + data->fan[f_min][1] = rv;
1261    
1262     hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
1263     data, lm80_groups);
1264     diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c
1265     index 96a6d5df9b26..b0962897bc45 100644
1266     --- a/drivers/i2c/busses/i2c-axxia.c
1267     +++ b/drivers/i2c/busses/i2c-axxia.c
1268     @@ -296,22 +296,7 @@ static irqreturn_t axxia_i2c_isr(int irq, void *_dev)
1269     i2c_int_disable(idev, MST_STATUS_TFL);
1270     }
1271    
1272     - if (status & MST_STATUS_SCC) {
1273     - /* Stop completed */
1274     - i2c_int_disable(idev, ~MST_STATUS_TSS);
1275     - complete(&idev->msg_complete);
1276     - } else if (status & MST_STATUS_SNS) {
1277     - /* Transfer done */
1278     - i2c_int_disable(idev, ~MST_STATUS_TSS);
1279     - if (i2c_m_rd(idev->msg) && idev->msg_xfrd < idev->msg->len)
1280     - axxia_i2c_empty_rx_fifo(idev);
1281     - complete(&idev->msg_complete);
1282     - } else if (status & MST_STATUS_TSS) {
1283     - /* Transfer timeout */
1284     - idev->msg_err = -ETIMEDOUT;
1285     - i2c_int_disable(idev, ~MST_STATUS_TSS);
1286     - complete(&idev->msg_complete);
1287     - } else if (unlikely(status & MST_STATUS_ERR)) {
1288     + if (unlikely(status & MST_STATUS_ERR)) {
1289     /* Transfer error */
1290     i2c_int_disable(idev, ~0);
1291     if (status & MST_STATUS_AL)
1292     @@ -328,6 +313,21 @@ static irqreturn_t axxia_i2c_isr(int irq, void *_dev)
1293     readl(idev->base + MST_TX_BYTES_XFRD),
1294     readl(idev->base + MST_TX_XFER));
1295     complete(&idev->msg_complete);
1296     + } else if (status & MST_STATUS_SCC) {
1297     + /* Stop completed */
1298     + i2c_int_disable(idev, ~MST_STATUS_TSS);
1299     + complete(&idev->msg_complete);
1300     + } else if (status & MST_STATUS_SNS) {
1301     + /* Transfer done */
1302     + i2c_int_disable(idev, ~MST_STATUS_TSS);
1303     + if (i2c_m_rd(idev->msg) && idev->msg_xfrd < idev->msg->len)
1304     + axxia_i2c_empty_rx_fifo(idev);
1305     + complete(&idev->msg_complete);
1306     + } else if (status & MST_STATUS_TSS) {
1307     + /* Transfer timeout */
1308     + idev->msg_err = -ETIMEDOUT;
1309     + i2c_int_disable(idev, ~MST_STATUS_TSS);
1310     + complete(&idev->msg_complete);
1311     }
1312    
1313     out:
1314     diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
1315     index 3f968c46e667..784636800361 100644
1316     --- a/drivers/iio/accel/kxcjk-1013.c
1317     +++ b/drivers/iio/accel/kxcjk-1013.c
1318     @@ -1393,6 +1393,7 @@ static const struct acpi_device_id kx_acpi_match[] = {
1319     {"KXCJ1008", KXCJ91008},
1320     {"KXCJ9000", KXCJ91008},
1321     {"KIOX000A", KXCJ91008},
1322     + {"KIOX010A", KXCJ91008}, /* KXCJ91008 inside the display of a 2-in-1 */
1323     {"KXTJ1009", KXTJ21009},
1324     {"SMO8500", KXCJ91008},
1325     { },
1326     diff --git a/drivers/infiniband/hw/hfi1/ruc.c b/drivers/infiniband/hw/hfi1/ruc.c
1327     index 9f768b48321f..d1514294bd68 100644
1328     --- a/drivers/infiniband/hw/hfi1/ruc.c
1329     +++ b/drivers/infiniband/hw/hfi1/ruc.c
1330     @@ -471,6 +471,8 @@ send:
1331     goto op_err;
1332     if (!ret)
1333     goto rnr_nak;
1334     + if (wqe->length > qp->r_len)
1335     + goto inv_err;
1336     break;
1337    
1338     case IB_WR_RDMA_WRITE_WITH_IMM:
1339     @@ -638,7 +640,10 @@ op_err:
1340     goto err;
1341    
1342     inv_err:
1343     - send_status = IB_WC_REM_INV_REQ_ERR;
1344     + send_status =
1345     + sqp->ibqp.qp_type == IB_QPT_RC ?
1346     + IB_WC_REM_INV_REQ_ERR :
1347     + IB_WC_SUCCESS;
1348     wc.status = IB_WC_LOC_QP_OP_ERR;
1349     goto err;
1350    
1351     diff --git a/drivers/infiniband/hw/qib/qib_ruc.c b/drivers/infiniband/hw/qib/qib_ruc.c
1352     index de1bde5950f5..10afde6d02fa 100644
1353     --- a/drivers/infiniband/hw/qib/qib_ruc.c
1354     +++ b/drivers/infiniband/hw/qib/qib_ruc.c
1355     @@ -449,6 +449,8 @@ again:
1356     goto op_err;
1357     if (!ret)
1358     goto rnr_nak;
1359     + if (wqe->length > qp->r_len)
1360     + goto inv_err;
1361     break;
1362    
1363     case IB_WR_RDMA_WRITE_WITH_IMM:
1364     @@ -612,7 +614,10 @@ op_err:
1365     goto err;
1366    
1367     inv_err:
1368     - send_status = IB_WC_REM_INV_REQ_ERR;
1369     + send_status =
1370     + sqp->ibqp.qp_type == IB_QPT_RC ?
1371     + IB_WC_REM_INV_REQ_ERR :
1372     + IB_WC_SUCCESS;
1373     wc.status = IB_WC_LOC_QP_OP_ERR;
1374     goto err;
1375    
1376     diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
1377     index bba1b9f2f782..e984418ffa2a 100644
1378     --- a/drivers/iommu/amd_iommu.c
1379     +++ b/drivers/iommu/amd_iommu.c
1380     @@ -464,7 +464,14 @@ static int iommu_init_device(struct device *dev)
1381    
1382     dev_data->alias = get_alias(dev);
1383    
1384     - if (dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) {
1385     + /*
1386     + * By default we use passthrough mode for IOMMUv2 capable device.
1387     + * But if amd_iommu=force_isolation is set (e.g. to debug DMA to
1388     + * invalid address), we ignore the capability for the device so
1389     + * it'll be forced to go into translation mode.
1390     + */
1391     + if ((iommu_pass_through || !amd_iommu_force_isolation) &&
1392     + dev_is_pci(dev) && pci_iommuv2_capable(to_pci_dev(dev))) {
1393     struct amd_iommu *iommu;
1394    
1395     iommu = amd_iommu_rlookup_table[dev_data->devid];
1396     diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
1397     index ff4be1174ff0..7bd98585d78d 100644
1398     --- a/drivers/iommu/arm-smmu-v3.c
1399     +++ b/drivers/iommu/arm-smmu-v3.c
1400     @@ -697,7 +697,13 @@ static void queue_inc_cons(struct arm_smmu_queue *q)
1401     u32 cons = (Q_WRP(q, q->cons) | Q_IDX(q, q->cons)) + 1;
1402    
1403     q->cons = Q_OVF(q, q->cons) | Q_WRP(q, cons) | Q_IDX(q, cons);
1404     - writel(q->cons, q->cons_reg);
1405     +
1406     + /*
1407     + * Ensure that all CPU accesses (reads and writes) to the queue
1408     + * are complete before we update the cons pointer.
1409     + */
1410     + mb();
1411     + writel_relaxed(q->cons, q->cons_reg);
1412     }
1413    
1414     static int queue_sync_prod(struct arm_smmu_queue *q)
1415     diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
1416     index 5a9a4416f467..f7ecb30a0bac 100644
1417     --- a/drivers/iommu/arm-smmu.c
1418     +++ b/drivers/iommu/arm-smmu.c
1419     @@ -297,6 +297,7 @@ enum arm_smmu_implementation {
1420     GENERIC_SMMU,
1421     ARM_MMU500,
1422     CAVIUM_SMMUV2,
1423     + QCOM_SMMUV2,
1424     };
1425    
1426     struct arm_smmu_s2cr {
1427     @@ -1894,6 +1895,7 @@ ARM_SMMU_MATCH_DATA(smmu_generic_v2, ARM_SMMU_V2, GENERIC_SMMU);
1428     ARM_SMMU_MATCH_DATA(arm_mmu401, ARM_SMMU_V1_64K, GENERIC_SMMU);
1429     ARM_SMMU_MATCH_DATA(arm_mmu500, ARM_SMMU_V2, ARM_MMU500);
1430     ARM_SMMU_MATCH_DATA(cavium_smmuv2, ARM_SMMU_V2, CAVIUM_SMMUV2);
1431     +ARM_SMMU_MATCH_DATA(qcom_smmuv2, ARM_SMMU_V2, QCOM_SMMUV2);
1432    
1433     static const struct of_device_id arm_smmu_of_match[] = {
1434     { .compatible = "arm,smmu-v1", .data = &smmu_generic_v1 },
1435     @@ -1902,6 +1904,7 @@ static const struct of_device_id arm_smmu_of_match[] = {
1436     { .compatible = "arm,mmu-401", .data = &arm_mmu401 },
1437     { .compatible = "arm,mmu-500", .data = &arm_mmu500 },
1438     { .compatible = "cavium,smmu-v2", .data = &cavium_smmuv2 },
1439     + { .compatible = "qcom,smmu-v2", .data = &qcom_smmuv2 },
1440     { },
1441     };
1442     MODULE_DEVICE_TABLE(of, arm_smmu_of_match);
1443     diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
1444     index 90449e1e91e5..1b1453d62fed 100644
1445     --- a/drivers/isdn/hisax/hfc_pci.c
1446     +++ b/drivers/isdn/hisax/hfc_pci.c
1447     @@ -1169,11 +1169,13 @@ HFCPCI_l1hw(struct PStack *st, int pr, void *arg)
1448     if (cs->debug & L1_DEB_LAPD)
1449     debugl1(cs, "-> PH_REQUEST_PULL");
1450     #endif
1451     + spin_lock_irqsave(&cs->lock, flags);
1452     if (!cs->tx_skb) {
1453     test_and_clear_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1454     st->l1.l1l2(st, PH_PULL | CONFIRM, NULL);
1455     } else
1456     test_and_set_bit(FLG_L1_PULL_REQ, &st->l1.Flags);
1457     + spin_unlock_irqrestore(&cs->lock, flags);
1458     break;
1459     case (HW_RESET | REQUEST):
1460     spin_lock_irqsave(&cs->lock, flags);
1461     diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
1462     index 50f354144ee7..2abbbc6392c0 100644
1463     --- a/drivers/media/i2c/ad9389b.c
1464     +++ b/drivers/media/i2c/ad9389b.c
1465     @@ -590,7 +590,7 @@ static const struct v4l2_dv_timings_cap ad9389b_timings_cap = {
1466     .type = V4L2_DV_BT_656_1120,
1467     /* keep this initialization for compatibility with GCC < 4.4.6 */
1468     .reserved = { 0 },
1469     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000,
1470     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000,
1471     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1472     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1473     V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
1474     diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
1475     index 5ba0f21bcfe4..5f1c8ee8a50e 100644
1476     --- a/drivers/media/i2c/adv7511.c
1477     +++ b/drivers/media/i2c/adv7511.c
1478     @@ -142,7 +142,7 @@ static const struct v4l2_dv_timings_cap adv7511_timings_cap = {
1479     .type = V4L2_DV_BT_656_1120,
1480     /* keep this initialization for compatibility with GCC < 4.4.6 */
1481     .reserved = { 0 },
1482     - V4L2_INIT_BT_TIMINGS(0, ADV7511_MAX_WIDTH, 0, ADV7511_MAX_HEIGHT,
1483     + V4L2_INIT_BT_TIMINGS(640, ADV7511_MAX_WIDTH, 350, ADV7511_MAX_HEIGHT,
1484     ADV7511_MIN_PIXELCLOCK, ADV7511_MAX_PIXELCLOCK,
1485     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1486     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1487     diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
1488     index 7b1935ab03c8..ce6f93074ae0 100644
1489     --- a/drivers/media/i2c/adv7604.c
1490     +++ b/drivers/media/i2c/adv7604.c
1491     @@ -777,7 +777,7 @@ static const struct v4l2_dv_timings_cap adv7604_timings_cap_analog = {
1492     .type = V4L2_DV_BT_656_1120,
1493     /* keep this initialization for compatibility with GCC < 4.4.6 */
1494     .reserved = { 0 },
1495     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000,
1496     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000,
1497     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1498     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1499     V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
1500     @@ -788,7 +788,7 @@ static const struct v4l2_dv_timings_cap adv76xx_timings_cap_digital = {
1501     .type = V4L2_DV_BT_656_1120,
1502     /* keep this initialization for compatibility with GCC < 4.4.6 */
1503     .reserved = { 0 },
1504     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000,
1505     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 225000000,
1506     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1507     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1508     V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
1509     diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
1510     index 8c2a52e280af..cf3b42c9417e 100644
1511     --- a/drivers/media/i2c/adv7842.c
1512     +++ b/drivers/media/i2c/adv7842.c
1513     @@ -676,7 +676,7 @@ static const struct v4l2_dv_timings_cap adv7842_timings_cap_analog = {
1514     .type = V4L2_DV_BT_656_1120,
1515     /* keep this initialization for compatibility with GCC < 4.4.6 */
1516     .reserved = { 0 },
1517     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 170000000,
1518     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 170000000,
1519     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1520     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1521     V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
1522     @@ -687,7 +687,7 @@ static const struct v4l2_dv_timings_cap adv7842_timings_cap_digital = {
1523     .type = V4L2_DV_BT_656_1120,
1524     /* keep this initialization for compatibility with GCC < 4.4.6 */
1525     .reserved = { 0 },
1526     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1200, 25000000, 225000000,
1527     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 25000000, 225000000,
1528     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1529     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1530     V4L2_DV_BT_CAP_PROGRESSIVE | V4L2_DV_BT_CAP_REDUCED_BLANKING |
1531     diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
1532     index 0f572bff64f5..7ebcb9473956 100644
1533     --- a/drivers/media/i2c/tc358743.c
1534     +++ b/drivers/media/i2c/tc358743.c
1535     @@ -66,7 +66,7 @@ static const struct v4l2_dv_timings_cap tc358743_timings_cap = {
1536     /* keep this initialization for compatibility with GCC < 4.4.6 */
1537     .reserved = { 0 },
1538     /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */
1539     - V4L2_INIT_BT_TIMINGS(1, 10000, 1, 10000, 0, 165000000,
1540     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1200, 13000000, 165000000,
1541     V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT |
1542     V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT,
1543     V4L2_DV_BT_CAP_PROGRESSIVE |
1544     diff --git a/drivers/media/i2c/ths8200.c b/drivers/media/i2c/ths8200.c
1545     index 42340e364cea..e06e2de87f90 100644
1546     --- a/drivers/media/i2c/ths8200.c
1547     +++ b/drivers/media/i2c/ths8200.c
1548     @@ -49,7 +49,7 @@ static const struct v4l2_dv_timings_cap ths8200_timings_cap = {
1549     .type = V4L2_DV_BT_656_1120,
1550     /* keep this initialization for compatibility with GCC < 4.4.6 */
1551     .reserved = { 0 },
1552     - V4L2_INIT_BT_TIMINGS(0, 1920, 0, 1080, 25000000, 148500000,
1553     + V4L2_INIT_BT_TIMINGS(640, 1920, 350, 1080, 25000000, 148500000,
1554     V4L2_DV_BT_STD_CEA861, V4L2_DV_BT_CAP_PROGRESSIVE)
1555     };
1556    
1557     diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
1558     index 9a6c2cc38acb..abce9c4a1a8e 100644
1559     --- a/drivers/media/platform/davinci/vpbe.c
1560     +++ b/drivers/media/platform/davinci/vpbe.c
1561     @@ -753,7 +753,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
1562     if (ret) {
1563     v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default output %s",
1564     def_output);
1565     - return ret;
1566     + goto fail_kfree_amp;
1567     }
1568    
1569     printk(KERN_NOTICE "Setting default mode to %s\n", def_mode);
1570     @@ -761,12 +761,15 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
1571     if (ret) {
1572     v4l2_err(&vpbe_dev->v4l2_dev, "Failed to set default mode %s",
1573     def_mode);
1574     - return ret;
1575     + goto fail_kfree_amp;
1576     }
1577     vpbe_dev->initialized = 1;
1578     /* TBD handling of bootargs for default output and mode */
1579     return 0;
1580    
1581     +fail_kfree_amp:
1582     + mutex_lock(&vpbe_dev->lock);
1583     + kfree(vpbe_dev->amp);
1584     fail_kfree_encoders:
1585     kfree(vpbe_dev->encoders);
1586     fail_dev_unregister:
1587     diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
1588     index 3e73e9db781f..7c025045ea90 100644
1589     --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
1590     +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
1591     @@ -41,25 +41,27 @@ int mtk_vcodec_init_enc_pm(struct mtk_vcodec_dev *mtkdev)
1592     node = of_parse_phandle(dev->of_node, "mediatek,larb", 0);
1593     if (!node) {
1594     mtk_v4l2_err("no mediatek,larb found");
1595     - return -1;
1596     + return -ENODEV;
1597     }
1598     pdev = of_find_device_by_node(node);
1599     + of_node_put(node);
1600     if (!pdev) {
1601     mtk_v4l2_err("no mediatek,larb device found");
1602     - return -1;
1603     + return -ENODEV;
1604     }
1605     pm->larbvenc = &pdev->dev;
1606    
1607     node = of_parse_phandle(dev->of_node, "mediatek,larb", 1);
1608     if (!node) {
1609     mtk_v4l2_err("no mediatek,larb found");
1610     - return -1;
1611     + return -ENODEV;
1612     }
1613    
1614     pdev = of_find_device_by_node(node);
1615     + of_node_put(node);
1616     if (!pdev) {
1617     mtk_v4l2_err("no mediatek,larb device found");
1618     - return -1;
1619     + return -ENODEV;
1620     }
1621    
1622     pm->larbvenclt = &pdev->dev;
1623     diff --git a/drivers/memstick/core/memstick.c b/drivers/memstick/core/memstick.c
1624     index a0547dbf9806..4d673a626db4 100644
1625     --- a/drivers/memstick/core/memstick.c
1626     +++ b/drivers/memstick/core/memstick.c
1627     @@ -18,6 +18,7 @@
1628     #include <linux/delay.h>
1629     #include <linux/slab.h>
1630     #include <linux/module.h>
1631     +#include <linux/pm_runtime.h>
1632    
1633     #define DRIVER_NAME "memstick"
1634    
1635     @@ -436,6 +437,7 @@ static void memstick_check(struct work_struct *work)
1636     struct memstick_dev *card;
1637    
1638     dev_dbg(&host->dev, "memstick_check started\n");
1639     + pm_runtime_get_noresume(host->dev.parent);
1640     mutex_lock(&host->lock);
1641     if (!host->card) {
1642     if (memstick_power_on(host))
1643     @@ -479,6 +481,7 @@ out_power_off:
1644     host->set_param(host, MEMSTICK_POWER, MEMSTICK_POWER_OFF);
1645    
1646     mutex_unlock(&host->lock);
1647     + pm_runtime_put(host->dev.parent);
1648     dev_dbg(&host->dev, "memstick_check finished\n");
1649     }
1650    
1651     diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
1652     index 16dc9ac7ecb6..53a506b0d790 100644
1653     --- a/drivers/net/ethernet/broadcom/bcmsysport.c
1654     +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
1655     @@ -378,7 +378,6 @@ static void bcm_sysport_get_wol(struct net_device *dev,
1656     struct ethtool_wolinfo *wol)
1657     {
1658     struct bcm_sysport_priv *priv = netdev_priv(dev);
1659     - u32 reg;
1660    
1661     wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE;
1662     wol->wolopts = priv->wolopts;
1663     @@ -386,11 +385,7 @@ static void bcm_sysport_get_wol(struct net_device *dev,
1664     if (!(priv->wolopts & WAKE_MAGICSECURE))
1665     return;
1666    
1667     - /* Return the programmed SecureOn password */
1668     - reg = umac_readl(priv, UMAC_PSW_MS);
1669     - put_unaligned_be16(reg, &wol->sopass[0]);
1670     - reg = umac_readl(priv, UMAC_PSW_LS);
1671     - put_unaligned_be32(reg, &wol->sopass[2]);
1672     + memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass));
1673     }
1674    
1675     static int bcm_sysport_set_wol(struct net_device *dev,
1676     @@ -406,13 +401,8 @@ static int bcm_sysport_set_wol(struct net_device *dev,
1677     if (wol->wolopts & ~supported)
1678     return -EINVAL;
1679    
1680     - /* Program the SecureOn password */
1681     - if (wol->wolopts & WAKE_MAGICSECURE) {
1682     - umac_writel(priv, get_unaligned_be16(&wol->sopass[0]),
1683     - UMAC_PSW_MS);
1684     - umac_writel(priv, get_unaligned_be32(&wol->sopass[2]),
1685     - UMAC_PSW_LS);
1686     - }
1687     + if (wol->wolopts & WAKE_MAGICSECURE)
1688     + memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass));
1689    
1690     /* Flag the device and relevant IRQ as wakeup capable */
1691     if (wol->wolopts) {
1692     @@ -1875,12 +1865,17 @@ static int bcm_sysport_suspend_to_wol(struct bcm_sysport_priv *priv)
1693     unsigned int timeout = 1000;
1694     u32 reg;
1695    
1696     - /* Password has already been programmed */
1697     reg = umac_readl(priv, UMAC_MPD_CTRL);
1698     reg |= MPD_EN;
1699     reg &= ~PSW_EN;
1700     - if (priv->wolopts & WAKE_MAGICSECURE)
1701     + if (priv->wolopts & WAKE_MAGICSECURE) {
1702     + /* Program the SecureOn password */
1703     + umac_writel(priv, get_unaligned_be16(&priv->sopass[0]),
1704     + UMAC_PSW_MS);
1705     + umac_writel(priv, get_unaligned_be32(&priv->sopass[2]),
1706     + UMAC_PSW_LS);
1707     reg |= PSW_EN;
1708     + }
1709     umac_writel(priv, reg, UMAC_MPD_CTRL);
1710    
1711     /* Make sure RBUF entered WoL mode as result */
1712     diff --git a/drivers/net/ethernet/broadcom/bcmsysport.h b/drivers/net/ethernet/broadcom/bcmsysport.h
1713     index 07b0aaa98de0..0d3444f1d78a 100644
1714     --- a/drivers/net/ethernet/broadcom/bcmsysport.h
1715     +++ b/drivers/net/ethernet/broadcom/bcmsysport.h
1716     @@ -11,6 +11,7 @@
1717     #ifndef __BCM_SYSPORT_H
1718     #define __BCM_SYSPORT_H
1719    
1720     +#include <linux/ethtool.h>
1721     #include <linux/if_vlan.h>
1722    
1723     /* Receive/transmit descriptor format */
1724     @@ -681,6 +682,7 @@ struct bcm_sysport_priv {
1725     unsigned int crc_fwd:1;
1726     u16 rev;
1727     u32 wolopts;
1728     + u8 sopass[SOPASS_MAX];
1729     unsigned int wol_irq_disabled:1;
1730    
1731     /* MIB related fields */
1732     diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
1733     index 07282eb76867..89acf7bc4cf9 100644
1734     --- a/drivers/net/ethernet/cisco/enic/enic_main.c
1735     +++ b/drivers/net/ethernet/cisco/enic/enic_main.c
1736     @@ -1180,7 +1180,7 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
1737     * CHECSUM_UNNECESSARY.
1738     */
1739     if ((netdev->features & NETIF_F_RXCSUM) && tcp_udp_csum_ok &&
1740     - ipv4_csum_ok)
1741     + (ipv4_csum_ok || ipv6))
1742     skb->ip_summed = CHECKSUM_UNNECESSARY;
1743    
1744     if (vlan_stripped)
1745     diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
1746     index 71a5ded9d1de..21dd5579130e 100644
1747     --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
1748     +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
1749     @@ -923,7 +923,7 @@ int memac_add_hash_mac_address(struct fman_mac *memac, enet_addr_t *eth_addr)
1750     hash = get_mac_addr_hash_code(addr) & HASH_CTRL_ADDR_MASK;
1751    
1752     /* Create element to be added to the driver hash table */
1753     - hash_entry = kmalloc(sizeof(*hash_entry), GFP_KERNEL);
1754     + hash_entry = kmalloc(sizeof(*hash_entry), GFP_ATOMIC);
1755     if (!hash_entry)
1756     return -ENOMEM;
1757     hash_entry->addr = addr;
1758     diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c
1759     index 4b0f3a50b293..e575259d20f4 100644
1760     --- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
1761     +++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
1762     @@ -551,7 +551,7 @@ int tgec_add_hash_mac_address(struct fman_mac *tgec, enet_addr_t *eth_addr)
1763     hash = (crc >> TGEC_HASH_MCAST_SHIFT) & TGEC_HASH_ADR_MSK;
1764    
1765     /* Create element to be added to the driver hash table */
1766     - hash_entry = kmalloc(sizeof(*hash_entry), GFP_KERNEL);
1767     + hash_entry = kmalloc(sizeof(*hash_entry), GFP_ATOMIC);
1768     if (!hash_entry)
1769     return -ENOMEM;
1770     hash_entry->addr = addr;
1771     diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
1772     index 57c7456a5751..7836072d3f63 100644
1773     --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
1774     +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
1775     @@ -9194,6 +9194,9 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
1776     ether_addr_copy(netdev->dev_addr, mac_addr);
1777     ether_addr_copy(netdev->perm_addr, mac_addr);
1778    
1779     + /* i40iw_net_event() reads 16 bytes from neigh->primary_key */
1780     + netdev->neigh_priv_len = sizeof(u32) * 4;
1781     +
1782     netdev->priv_flags |= IFF_UNICAST_FLT;
1783     netdev->priv_flags |= IFF_SUPP_NOFCS;
1784     /* Setup netdev TC information */
1785     diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1786     index 3a61491421b1..82e48e355fb9 100644
1787     --- a/drivers/net/ethernet/intel/igb/igb_main.c
1788     +++ b/drivers/net/ethernet/intel/igb/igb_main.c
1789     @@ -7564,9 +7564,11 @@ static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake,
1790     rtnl_unlock();
1791    
1792     #ifdef CONFIG_PM
1793     - retval = pci_save_state(pdev);
1794     - if (retval)
1795     - return retval;
1796     + if (!runtime) {
1797     + retval = pci_save_state(pdev);
1798     + if (retval)
1799     + return retval;
1800     + }
1801     #endif
1802    
1803     status = rd32(E1000_STATUS);
1804     diff --git a/drivers/net/ethernet/marvell/skge.c b/drivers/net/ethernet/marvell/skge.c
1805     index 7173836fe361..c9f4b5412844 100644
1806     --- a/drivers/net/ethernet/marvell/skge.c
1807     +++ b/drivers/net/ethernet/marvell/skge.c
1808     @@ -152,8 +152,10 @@ static void skge_get_regs(struct net_device *dev, struct ethtool_regs *regs,
1809     memset(p, 0, regs->len);
1810     memcpy_fromio(p, io, B3_RAM_ADDR);
1811    
1812     - memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1,
1813     - regs->len - B3_RI_WTO_R1);
1814     + if (regs->len > B3_RI_WTO_R1) {
1815     + memcpy_fromio(p + B3_RI_WTO_R1, io + B3_RI_WTO_R1,
1816     + regs->len - B3_RI_WTO_R1);
1817     + }
1818     }
1819    
1820     /* Wake on Lan only supported on Yukon chips with rev 1 or above */
1821     diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1822     index 7309ae3b8c7b..2b6a7eb2be7e 100644
1823     --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1824     +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1825     @@ -553,6 +553,8 @@ static inline bool is_first_ethertype_ip(struct sk_buff *skb)
1826     return (ethertype == htons(ETH_P_IP) || ethertype == htons(ETH_P_IPV6));
1827     }
1828    
1829     +#define short_frame(size) ((size) <= ETH_ZLEN + ETH_FCS_LEN)
1830     +
1831     static inline void mlx5e_handle_csum(struct net_device *netdev,
1832     struct mlx5_cqe64 *cqe,
1833     struct mlx5e_rq *rq,
1834     @@ -567,6 +569,17 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
1835     return;
1836     }
1837    
1838     + /* CQE csum doesn't cover padding octets in short ethernet
1839     + * frames. And the pad field is appended prior to calculating
1840     + * and appending the FCS field.
1841     + *
1842     + * Detecting these padded frames requires to verify and parse
1843     + * IP headers, so we simply force all those small frames to be
1844     + * CHECKSUM_UNNECESSARY even if they are not padded.
1845     + */
1846     + if (short_frame(skb->len))
1847     + goto csum_unnecessary;
1848     +
1849     if (is_first_ethertype_ip(skb)) {
1850     skb->ip_summed = CHECKSUM_COMPLETE;
1851     skb->csum = csum_unfold((__force __sum16)cqe->check_sum);
1852     @@ -574,6 +587,7 @@ static inline void mlx5e_handle_csum(struct net_device *netdev,
1853     return;
1854     }
1855    
1856     +csum_unnecessary:
1857     if (likely((cqe->hds_ip_ext & CQE_L3_OK) &&
1858     (cqe->hds_ip_ext & CQE_L4_OK))) {
1859     skb->ip_summed = CHECKSUM_UNNECESSARY;
1860     diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
1861     index e45e2f14fb94..fe5b0ac8c631 100644
1862     --- a/drivers/net/ethernet/sun/niu.c
1863     +++ b/drivers/net/ethernet/sun/niu.c
1864     @@ -8121,6 +8121,8 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
1865     start += 3;
1866    
1867     prop_len = niu_pci_eeprom_read(np, start + 4);
1868     + if (prop_len < 0)
1869     + return prop_len;
1870     err = niu_pci_vpd_get_propname(np, start + 5, namebuf, 64);
1871     if (err < 0)
1872     return err;
1873     @@ -8165,8 +8167,12 @@ static int niu_pci_vpd_scan_props(struct niu *np, u32 start, u32 end)
1874     netif_printk(np, probe, KERN_DEBUG, np->dev,
1875     "VPD_SCAN: Reading in property [%s] len[%d]\n",
1876     namebuf, prop_len);
1877     - for (i = 0; i < prop_len; i++)
1878     - *prop_buf++ = niu_pci_eeprom_read(np, off + i);
1879     + for (i = 0; i < prop_len; i++) {
1880     + err = niu_pci_eeprom_read(np, off + i);
1881     + if (err >= 0)
1882     + *prop_buf = err;
1883     + ++prop_buf;
1884     + }
1885     }
1886    
1887     start += len;
1888     diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
1889     index 482ea404a2d4..557f6510bad7 100644
1890     --- a/drivers/net/phy/dp83640.c
1891     +++ b/drivers/net/phy/dp83640.c
1892     @@ -891,14 +891,14 @@ static void decode_txts(struct dp83640_private *dp83640,
1893     struct phy_txts *phy_txts)
1894     {
1895     struct skb_shared_hwtstamps shhwtstamps;
1896     + struct dp83640_skb_info *skb_info;
1897     struct sk_buff *skb;
1898     - u64 ns;
1899     u8 overflow;
1900     + u64 ns;
1901    
1902     /* We must already have the skb that triggered this. */
1903     -
1904     +again:
1905     skb = skb_dequeue(&dp83640->tx_queue);
1906     -
1907     if (!skb) {
1908     pr_debug("have timestamp but tx_queue empty\n");
1909     return;
1910     @@ -913,6 +913,11 @@ static void decode_txts(struct dp83640_private *dp83640,
1911     }
1912     return;
1913     }
1914     + skb_info = (struct dp83640_skb_info *)skb->cb;
1915     + if (time_after(jiffies, skb_info->tmo)) {
1916     + kfree_skb(skb);
1917     + goto again;
1918     + }
1919    
1920     ns = phy2txts(phy_txts);
1921     memset(&shhwtstamps, 0, sizeof(shhwtstamps));
1922     @@ -1463,6 +1468,7 @@ static bool dp83640_rxtstamp(struct phy_device *phydev,
1923     static void dp83640_txtstamp(struct phy_device *phydev,
1924     struct sk_buff *skb, int type)
1925     {
1926     + struct dp83640_skb_info *skb_info = (struct dp83640_skb_info *)skb->cb;
1927     struct dp83640_private *dp83640 = phydev->priv;
1928    
1929     switch (dp83640->hwts_tx_en) {
1930     @@ -1475,6 +1481,7 @@ static void dp83640_txtstamp(struct phy_device *phydev,
1931     /* fall through */
1932     case HWTSTAMP_TX_ON:
1933     skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
1934     + skb_info->tmo = jiffies + SKB_TIMESTAMP_TIMEOUT;
1935     skb_queue_tail(&dp83640->tx_queue, skb);
1936     break;
1937    
1938     diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
1939     index a7316710a902..7bda18c61eb6 100644
1940     --- a/drivers/net/wireless/ath/ath9k/ath9k.h
1941     +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
1942     @@ -267,7 +267,7 @@ struct ath_node {
1943     #endif
1944     u8 key_idx[4];
1945    
1946     - u32 ackto;
1947     + int ackto;
1948     struct list_head list;
1949     };
1950    
1951     diff --git a/drivers/net/wireless/ath/ath9k/dynack.c b/drivers/net/wireless/ath/ath9k/dynack.c
1952     index 7334c9b09e82..6e236a485431 100644
1953     --- a/drivers/net/wireless/ath/ath9k/dynack.c
1954     +++ b/drivers/net/wireless/ath/ath9k/dynack.c
1955     @@ -29,9 +29,13 @@
1956     * ath_dynack_ewma - EWMA (Exponentially Weighted Moving Average) calculation
1957     *
1958     */
1959     -static inline u32 ath_dynack_ewma(u32 old, u32 new)
1960     +static inline int ath_dynack_ewma(int old, int new)
1961     {
1962     - return (new * (EWMA_DIV - EWMA_LEVEL) + old * EWMA_LEVEL) / EWMA_DIV;
1963     + if (old > 0)
1964     + return (new * (EWMA_DIV - EWMA_LEVEL) +
1965     + old * EWMA_LEVEL) / EWMA_DIV;
1966     + else
1967     + return new;
1968     }
1969    
1970     /**
1971     @@ -82,10 +86,10 @@ static inline bool ath_dynack_bssidmask(struct ath_hw *ah, const u8 *mac)
1972     */
1973     static void ath_dynack_compute_ackto(struct ath_hw *ah)
1974     {
1975     - struct ath_node *an;
1976     - u32 to = 0;
1977     - struct ath_dynack *da = &ah->dynack;
1978     struct ath_common *common = ath9k_hw_common(ah);
1979     + struct ath_dynack *da = &ah->dynack;
1980     + struct ath_node *an;
1981     + int to = 0;
1982    
1983     list_for_each_entry(an, &da->nodes, list)
1984     if (an->ackto > to)
1985     @@ -144,7 +148,8 @@ static void ath_dynack_compute_to(struct ath_hw *ah)
1986     an->ackto = ath_dynack_ewma(an->ackto,
1987     ackto);
1988     ath_dbg(ath9k_hw_common(ah), DYNACK,
1989     - "%pM to %u\n", dst, an->ackto);
1990     + "%pM to %d [%u]\n", dst,
1991     + an->ackto, ackto);
1992     if (time_is_before_jiffies(da->lto)) {
1993     ath_dynack_compute_ackto(ah);
1994     da->lto = jiffies + COMPUTE_TO;
1995     @@ -166,10 +171,12 @@ static void ath_dynack_compute_to(struct ath_hw *ah)
1996     * @ah: ath hw
1997     * @skb: socket buffer
1998     * @ts: tx status info
1999     + * @sta: station pointer
2000     *
2001     */
2002     void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
2003     - struct ath_tx_status *ts)
2004     + struct ath_tx_status *ts,
2005     + struct ieee80211_sta *sta)
2006     {
2007     u8 ridx;
2008     struct ieee80211_hdr *hdr;
2009     @@ -177,7 +184,7 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
2010     struct ath_common *common = ath9k_hw_common(ah);
2011     struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2012    
2013     - if ((info->flags & IEEE80211_TX_CTL_NO_ACK) || !da->enabled)
2014     + if (!da->enabled || (info->flags & IEEE80211_TX_CTL_NO_ACK))
2015     return;
2016    
2017     spin_lock_bh(&da->qlock);
2018     @@ -187,11 +194,19 @@ void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
2019     /* late ACK */
2020     if (ts->ts_status & ATH9K_TXERR_XRETRY) {
2021     if (ieee80211_is_assoc_req(hdr->frame_control) ||
2022     - ieee80211_is_assoc_resp(hdr->frame_control)) {
2023     + ieee80211_is_assoc_resp(hdr->frame_control) ||
2024     + ieee80211_is_auth(hdr->frame_control)) {
2025     ath_dbg(common, DYNACK, "late ack\n");
2026     +
2027     ath9k_hw_setslottime(ah, (LATEACK_TO - 3) / 2);
2028     ath9k_hw_set_ack_timeout(ah, LATEACK_TO);
2029     ath9k_hw_set_cts_timeout(ah, LATEACK_TO);
2030     + if (sta) {
2031     + struct ath_node *an;
2032     +
2033     + an = (struct ath_node *)sta->drv_priv;
2034     + an->ackto = -1;
2035     + }
2036     da->lto = jiffies + LATEACK_DELAY;
2037     }
2038    
2039     @@ -251,7 +266,7 @@ void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb,
2040     struct ath_common *common = ath9k_hw_common(ah);
2041     struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2042    
2043     - if (!ath_dynack_bssidmask(ah, hdr->addr1) || !da->enabled)
2044     + if (!da->enabled || !ath_dynack_bssidmask(ah, hdr->addr1))
2045     return;
2046    
2047     spin_lock_bh(&da->qlock);
2048     diff --git a/drivers/net/wireless/ath/ath9k/dynack.h b/drivers/net/wireless/ath/ath9k/dynack.h
2049     index 6d7bef976742..cf60224d40df 100644
2050     --- a/drivers/net/wireless/ath/ath9k/dynack.h
2051     +++ b/drivers/net/wireless/ath/ath9k/dynack.h
2052     @@ -86,7 +86,8 @@ void ath_dynack_node_deinit(struct ath_hw *ah, struct ath_node *an);
2053     void ath_dynack_init(struct ath_hw *ah);
2054     void ath_dynack_sample_ack_ts(struct ath_hw *ah, struct sk_buff *skb, u32 ts);
2055     void ath_dynack_sample_tx_ts(struct ath_hw *ah, struct sk_buff *skb,
2056     - struct ath_tx_status *ts);
2057     + struct ath_tx_status *ts,
2058     + struct ieee80211_sta *sta);
2059     #else
2060     static inline void ath_dynack_init(struct ath_hw *ah) {}
2061     static inline void ath_dynack_node_init(struct ath_hw *ah,
2062     @@ -97,7 +98,8 @@ static inline void ath_dynack_sample_ack_ts(struct ath_hw *ah,
2063     struct sk_buff *skb, u32 ts) {}
2064     static inline void ath_dynack_sample_tx_ts(struct ath_hw *ah,
2065     struct sk_buff *skb,
2066     - struct ath_tx_status *ts) {}
2067     + struct ath_tx_status *ts,
2068     + struct ieee80211_sta *sta) {}
2069     #endif
2070    
2071     #endif /* DYNACK_H */
2072     diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
2073     index 8a504afe667e..0ef27d99bef3 100644
2074     --- a/drivers/net/wireless/ath/ath9k/xmit.c
2075     +++ b/drivers/net/wireless/ath/ath9k/xmit.c
2076     @@ -593,7 +593,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
2077     if (bf == bf->bf_lastbf)
2078     ath_dynack_sample_tx_ts(sc->sc_ah,
2079     bf->bf_mpdu,
2080     - ts);
2081     + ts, sta);
2082     }
2083    
2084     ath_tx_complete_buf(sc, bf, txq, &bf_head, sta, ts,
2085     @@ -709,7 +709,8 @@ static void ath_tx_process_buffer(struct ath_softc *sc, struct ath_txq *txq,
2086     memcpy(info->control.rates, bf->rates,
2087     sizeof(info->control.rates));
2088     ath_tx_rc_status(sc, bf, ts, 1, txok ? 0 : 1, txok);
2089     - ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts);
2090     + ath_dynack_sample_tx_ts(sc->sc_ah, bf->bf_mpdu, ts,
2091     + sta);
2092     }
2093     ath_tx_complete_buf(sc, bf, txq, bf_head, sta, ts, txok);
2094     } else
2095     diff --git a/drivers/net/wireless/st/cw1200/scan.c b/drivers/net/wireless/st/cw1200/scan.c
2096     index 0a0ff7e31f5b..c5492d792f43 100644
2097     --- a/drivers/net/wireless/st/cw1200/scan.c
2098     +++ b/drivers/net/wireless/st/cw1200/scan.c
2099     @@ -78,6 +78,10 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,
2100     if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS)
2101     return -EINVAL;
2102    
2103     + /* will be unlocked in cw1200_scan_work() */
2104     + down(&priv->scan.lock);
2105     + mutex_lock(&priv->conf_mutex);
2106     +
2107     frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0,
2108     req->ie_len);
2109     if (!frame.skb)
2110     @@ -86,19 +90,15 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,
2111     if (req->ie_len)
2112     memcpy(skb_put(frame.skb, req->ie_len), req->ie, req->ie_len);
2113    
2114     - /* will be unlocked in cw1200_scan_work() */
2115     - down(&priv->scan.lock);
2116     - mutex_lock(&priv->conf_mutex);
2117     -
2118     ret = wsm_set_template_frame(priv, &frame);
2119     if (!ret) {
2120     /* Host want to be the probe responder. */
2121     ret = wsm_set_probe_responder(priv, true);
2122     }
2123     if (ret) {
2124     + dev_kfree_skb(frame.skb);
2125     mutex_unlock(&priv->conf_mutex);
2126     up(&priv->scan.lock);
2127     - dev_kfree_skb(frame.skb);
2128     return ret;
2129     }
2130    
2131     @@ -120,10 +120,9 @@ int cw1200_hw_scan(struct ieee80211_hw *hw,
2132     ++priv->scan.n_ssids;
2133     }
2134    
2135     - mutex_unlock(&priv->conf_mutex);
2136     -
2137     if (frame.skb)
2138     dev_kfree_skb(frame.skb);
2139     + mutex_unlock(&priv->conf_mutex);
2140     queue_work(priv->workqueue, &priv->scan.work);
2141     return 0;
2142     }
2143     diff --git a/drivers/pci/host/vmd.c b/drivers/pci/host/vmd.c
2144     index 0e7f8f319fe3..9a60098f7b7d 100644
2145     --- a/drivers/pci/host/vmd.c
2146     +++ b/drivers/pci/host/vmd.c
2147     @@ -731,6 +731,11 @@ static void vmd_remove(struct pci_dev *dev)
2148     static int vmd_suspend(struct device *dev)
2149     {
2150     struct pci_dev *pdev = to_pci_dev(dev);
2151     + struct vmd_dev *vmd = pci_get_drvdata(pdev);
2152     + int i;
2153     +
2154     + for (i = 0; i < vmd->msix_count; i++)
2155     + devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
2156    
2157     pci_save_state(pdev);
2158     return 0;
2159     @@ -739,6 +744,16 @@ static int vmd_suspend(struct device *dev)
2160     static int vmd_resume(struct device *dev)
2161     {
2162     struct pci_dev *pdev = to_pci_dev(dev);
2163     + struct vmd_dev *vmd = pci_get_drvdata(pdev);
2164     + int err, i;
2165     +
2166     + for (i = 0; i < vmd->msix_count; i++) {
2167     + err = devm_request_irq(dev, pci_irq_vector(pdev, i),
2168     + vmd_irq, IRQF_NO_THREAD,
2169     + "vmd", &vmd->irqs[i]);
2170     + if (err)
2171     + return err;
2172     + }
2173    
2174     pci_restore_state(pdev);
2175     return 0;
2176     diff --git a/drivers/pinctrl/meson/pinctrl-meson8.c b/drivers/pinctrl/meson/pinctrl-meson8.c
2177     index 07f1cb21c1b8..0de7fa414beb 100644
2178     --- a/drivers/pinctrl/meson/pinctrl-meson8.c
2179     +++ b/drivers/pinctrl/meson/pinctrl-meson8.c
2180     @@ -736,7 +736,9 @@ static const char * const gpio_groups[] = {
2181     "BOOT_5", "BOOT_6", "BOOT_7", "BOOT_8", "BOOT_9",
2182     "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
2183     "BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18",
2184     +};
2185    
2186     +static const char * const gpio_aobus_groups[] = {
2187     "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3",
2188     "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7",
2189     "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11",
2190     @@ -908,6 +910,7 @@ static struct meson_pmx_func meson8_cbus_functions[] = {
2191     };
2192    
2193     static struct meson_pmx_func meson8_aobus_functions[] = {
2194     + FUNCTION(gpio_aobus),
2195     FUNCTION(uart_ao),
2196     FUNCTION(remote),
2197     FUNCTION(i2c_slave_ao),
2198     diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c
2199     index f87ef5a0ee6c..cbe5f5cbddb8 100644
2200     --- a/drivers/pinctrl/meson/pinctrl-meson8b.c
2201     +++ b/drivers/pinctrl/meson/pinctrl-meson8b.c
2202     @@ -643,16 +643,18 @@ static const char * const gpio_groups[] = {
2203     "BOOT_10", "BOOT_11", "BOOT_12", "BOOT_13", "BOOT_14",
2204     "BOOT_15", "BOOT_16", "BOOT_17", "BOOT_18",
2205    
2206     - "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3",
2207     - "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7",
2208     - "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11",
2209     - "GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N",
2210     -
2211     "DIF_0_P", "DIF_0_N", "DIF_1_P", "DIF_1_N",
2212     "DIF_2_P", "DIF_2_N", "DIF_3_P", "DIF_3_N",
2213     "DIF_4_P", "DIF_4_N"
2214     };
2215    
2216     +static const char * const gpio_aobus_groups[] = {
2217     + "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3",
2218     + "GPIOAO_4", "GPIOAO_5", "GPIOAO_6", "GPIOAO_7",
2219     + "GPIOAO_8", "GPIOAO_9", "GPIOAO_10", "GPIOAO_11",
2220     + "GPIOAO_12", "GPIOAO_13", "GPIO_BSD_EN", "GPIO_TEST_N"
2221     +};
2222     +
2223     static const char * const sd_a_groups[] = {
2224     "sd_d0_a", "sd_d1_a", "sd_d2_a", "sd_d3_a", "sd_clk_a",
2225     "sd_cmd_a"
2226     @@ -868,6 +870,7 @@ static struct meson_pmx_func meson8b_cbus_functions[] = {
2227     };
2228    
2229     static struct meson_pmx_func meson8b_aobus_functions[] = {
2230     + FUNCTION(gpio_aobus),
2231     FUNCTION(uart_ao),
2232     FUNCTION(uart_ao_b),
2233     FUNCTION(i2c_slave_ao),
2234     diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
2235     index a421d6c551b6..ecb41eacd74b 100644
2236     --- a/drivers/ptp/ptp_chardev.c
2237     +++ b/drivers/ptp/ptp_chardev.c
2238     @@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
2239     pct->sec = ts.tv_sec;
2240     pct->nsec = ts.tv_nsec;
2241     pct++;
2242     - ptp->info->gettime64(ptp->info, &ts);
2243     + err = ptp->info->gettime64(ptp->info, &ts);
2244     + if (err)
2245     + goto out;
2246     pct->sec = ts.tv_sec;
2247     pct->nsec = ts.tv_nsec;
2248     pct++;
2249     @@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
2250     break;
2251     }
2252    
2253     +out:
2254     kfree(sysoff);
2255     return err;
2256     }
2257     diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
2258     index 913ebb6d0d29..85442edf3c49 100644
2259     --- a/drivers/scsi/aic94xx/aic94xx_init.c
2260     +++ b/drivers/scsi/aic94xx/aic94xx_init.c
2261     @@ -281,7 +281,7 @@ static ssize_t asd_show_dev_rev(struct device *dev,
2262     return snprintf(buf, PAGE_SIZE, "%s\n",
2263     asd_dev_rev[asd_ha->revision_id]);
2264     }
2265     -static DEVICE_ATTR(revision, S_IRUGO, asd_show_dev_rev, NULL);
2266     +static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
2267    
2268     static ssize_t asd_show_dev_bios_build(struct device *dev,
2269     struct device_attribute *attr,char *buf)
2270     @@ -478,7 +478,7 @@ static int asd_create_dev_attrs(struct asd_ha_struct *asd_ha)
2271     {
2272     int err;
2273    
2274     - err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_revision);
2275     + err = device_create_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
2276     if (err)
2277     return err;
2278    
2279     @@ -500,13 +500,13 @@ err_update_bios:
2280     err_biosb:
2281     device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
2282     err_rev:
2283     - device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
2284     + device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
2285     return err;
2286     }
2287    
2288     static void asd_remove_dev_attrs(struct asd_ha_struct *asd_ha)
2289     {
2290     - device_remove_file(&asd_ha->pcidev->dev, &dev_attr_revision);
2291     + device_remove_file(&asd_ha->pcidev->dev, &dev_attr_aic_revision);
2292     device_remove_file(&asd_ha->pcidev->dev, &dev_attr_bios_build);
2293     device_remove_file(&asd_ha->pcidev->dev, &dev_attr_pcba_sn);
2294     device_remove_file(&asd_ha->pcidev->dev, &dev_attr_update_bios);
2295     diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
2296     index fc7addaf24da..4905455bbfc7 100644
2297     --- a/drivers/scsi/lpfc/lpfc_els.c
2298     +++ b/drivers/scsi/lpfc/lpfc_els.c
2299     @@ -5396,6 +5396,9 @@ error:
2300     stat = (struct ls_rjt *)(pcmd + sizeof(uint32_t));
2301     stat->un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
2302    
2303     + if (shdr_add_status == ADD_STATUS_OPERATION_ALREADY_ACTIVE)
2304     + stat->un.b.lsRjtRsnCodeExp = LSEXP_CMD_IN_PROGRESS;
2305     +
2306     elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
2307     phba->fc_stat.elsXmitLSRJT++;
2308     rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0);
2309     diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
2310     index b2b969990a5d..06a062455404 100644
2311     --- a/drivers/scsi/smartpqi/smartpqi_init.c
2312     +++ b/drivers/scsi/smartpqi/smartpqi_init.c
2313     @@ -473,6 +473,7 @@ struct bmic_host_wellness_driver_version {
2314     u8 driver_version_tag[2];
2315     __le16 driver_version_length;
2316     char driver_version[32];
2317     + u8 dont_write_tag[2];
2318     u8 end_tag[2];
2319     };
2320    
2321     @@ -502,6 +503,8 @@ static int pqi_write_driver_version_to_host_wellness(
2322     strncpy(buffer->driver_version, DRIVER_VERSION,
2323     sizeof(buffer->driver_version) - 1);
2324     buffer->driver_version[sizeof(buffer->driver_version) - 1] = '\0';
2325     + buffer->dont_write_tag[0] = 'D';
2326     + buffer->dont_write_tag[1] = 'W';
2327     buffer->end_tag[0] = 'Z';
2328     buffer->end_tag[1] = 'Z';
2329    
2330     @@ -980,6 +983,9 @@ static void pqi_get_volume_status(struct pqi_ctrl_info *ctrl_info,
2331     if (rc)
2332     goto out;
2333    
2334     + if (vpd->page_code != CISS_VPD_LV_STATUS)
2335     + goto out;
2336     +
2337     page_length = offsetof(struct ciss_vpd_logical_volume_status,
2338     volume_status) + vpd->page_length;
2339     if (page_length < sizeof(*vpd))
2340     diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcmstb/common.c
2341     index 94e7335553f4..3f6063b639ac 100644
2342     --- a/drivers/soc/bcm/brcmstb/common.c
2343     +++ b/drivers/soc/bcm/brcmstb/common.c
2344     @@ -31,13 +31,17 @@ static const struct of_device_id brcmstb_machine_match[] = {
2345    
2346     bool soc_is_brcmstb(void)
2347     {
2348     + const struct of_device_id *match;
2349     struct device_node *root;
2350    
2351     root = of_find_node_by_path("/");
2352     if (!root)
2353     return false;
2354    
2355     - return of_match_node(brcmstb_machine_match, root) != NULL;
2356     + match = of_match_node(brcmstb_machine_match, root);
2357     + of_node_put(root);
2358     +
2359     + return match != NULL;
2360     }
2361    
2362     static const struct of_device_id sun_top_ctrl_match[] = {
2363     diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
2364     index cd8f41351add..7bfb154d6fa5 100644
2365     --- a/drivers/soc/tegra/common.c
2366     +++ b/drivers/soc/tegra/common.c
2367     @@ -22,11 +22,15 @@ static const struct of_device_id tegra_machine_match[] = {
2368    
2369     bool soc_is_tegra(void)
2370     {
2371     + const struct of_device_id *match;
2372     struct device_node *root;
2373    
2374     root = of_find_node_by_path("/");
2375     if (!root)
2376     return false;
2377    
2378     - return of_match_node(tegra_machine_match, root) != NULL;
2379     + match = of_match_node(tegra_machine_match, root);
2380     + of_node_put(root);
2381     +
2382     + return match != NULL;
2383     }
2384     diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
2385     index b460dda7eb65..dec25fadba8c 100644
2386     --- a/drivers/staging/iio/adc/ad7280a.c
2387     +++ b/drivers/staging/iio/adc/ad7280a.c
2388     @@ -250,7 +250,9 @@ static int ad7280_read(struct ad7280_state *st, unsigned int devaddr,
2389     if (ret)
2390     return ret;
2391    
2392     - __ad7280_read32(st, &tmp);
2393     + ret = __ad7280_read32(st, &tmp);
2394     + if (ret)
2395     + return ret;
2396    
2397     if (ad7280_check_crc(st, tmp))
2398     return -EIO;
2399     @@ -288,7 +290,9 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned int devaddr,
2400    
2401     ad7280_delay(st);
2402    
2403     - __ad7280_read32(st, &tmp);
2404     + ret = __ad7280_read32(st, &tmp);
2405     + if (ret)
2406     + return ret;
2407    
2408     if (ad7280_check_crc(st, tmp))
2409     return -EIO;
2410     @@ -321,7 +325,9 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt,
2411     ad7280_delay(st);
2412    
2413     for (i = 0; i < cnt; i++) {
2414     - __ad7280_read32(st, &tmp);
2415     + ret = __ad7280_read32(st, &tmp);
2416     + if (ret)
2417     + return ret;
2418    
2419     if (ad7280_check_crc(st, tmp))
2420     return -EIO;
2421     @@ -364,7 +370,10 @@ static int ad7280_chain_setup(struct ad7280_state *st)
2422     return ret;
2423    
2424     for (n = 0; n <= AD7280A_MAX_CHAIN; n++) {
2425     - __ad7280_read32(st, &val);
2426     + ret = __ad7280_read32(st, &val);
2427     + if (ret)
2428     + return ret;
2429     +
2430     if (val == 0)
2431     return n - 1;
2432    
2433     diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
2434     index c9a0c2aa602f..5d163386ab6e 100644
2435     --- a/drivers/staging/iio/adc/ad7780.c
2436     +++ b/drivers/staging/iio/adc/ad7780.c
2437     @@ -87,12 +87,16 @@ static int ad7780_read_raw(struct iio_dev *indio_dev,
2438     long m)
2439     {
2440     struct ad7780_state *st = iio_priv(indio_dev);
2441     + int voltage_uv;
2442    
2443     switch (m) {
2444     case IIO_CHAN_INFO_RAW:
2445     return ad_sigma_delta_single_conversion(indio_dev, chan, val);
2446     case IIO_CHAN_INFO_SCALE:
2447     - *val = st->int_vref_mv * st->gain;
2448     + voltage_uv = regulator_get_voltage(st->reg);
2449     + if (voltage_uv < 0)
2450     + return voltage_uv;
2451     + *val = (voltage_uv / 1000) * st->gain;
2452     *val2 = chan->scan_type.realbits - 1;
2453     return IIO_VAL_FRACTIONAL_LOG2;
2454     case IIO_CHAN_INFO_OFFSET:
2455     diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c
2456     index 5b1c0db33e7f..b44253eb62ec 100644
2457     --- a/drivers/staging/iio/resolver/ad2s90.c
2458     +++ b/drivers/staging/iio/resolver/ad2s90.c
2459     @@ -86,7 +86,12 @@ static int ad2s90_probe(struct spi_device *spi)
2460     /* need 600ns between CS and the first falling edge of SCLK */
2461     spi->max_speed_hz = 830000;
2462     spi->mode = SPI_MODE_3;
2463     - spi_setup(spi);
2464     + ret = spi_setup(spi);
2465     +
2466     + if (ret < 0) {
2467     + dev_err(&spi->dev, "spi_setup failed!\n");
2468     + return ret;
2469     + }
2470    
2471     return 0;
2472     }
2473     diff --git a/drivers/thermal/thermal-generic-adc.c b/drivers/thermal/thermal-generic-adc.c
2474     index 73f55d6a1721..ad601e5b4175 100644
2475     --- a/drivers/thermal/thermal-generic-adc.c
2476     +++ b/drivers/thermal/thermal-generic-adc.c
2477     @@ -26,7 +26,7 @@ struct gadc_thermal_info {
2478    
2479     static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
2480     {
2481     - int temp, adc_hi, adc_lo;
2482     + int temp, temp_hi, temp_lo, adc_hi, adc_lo;
2483     int i;
2484    
2485     for (i = 0; i < gti->nlookup_table; i++) {
2486     @@ -36,13 +36,17 @@ static int gadc_thermal_adc_to_temp(struct gadc_thermal_info *gti, int val)
2487    
2488     if (i == 0) {
2489     temp = gti->lookup_table[0];
2490     - } else if (i >= (gti->nlookup_table - 1)) {
2491     + } else if (i >= gti->nlookup_table) {
2492     temp = gti->lookup_table[2 * (gti->nlookup_table - 1)];
2493     } else {
2494     adc_hi = gti->lookup_table[2 * i - 1];
2495     adc_lo = gti->lookup_table[2 * i + 1];
2496     - temp = gti->lookup_table[2 * i];
2497     - temp -= ((val - adc_lo) * 1000) / (adc_hi - adc_lo);
2498     +
2499     + temp_hi = gti->lookup_table[2 * i - 2];
2500     + temp_lo = gti->lookup_table[2 * i];
2501     +
2502     + temp = temp_hi + mult_frac(temp_lo - temp_hi, val - adc_hi,
2503     + adc_lo - adc_hi);
2504     }
2505    
2506     return temp;
2507     diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
2508     index 226b0b4aced6..cd82ae34ddfa 100644
2509     --- a/drivers/thermal/thermal_core.c
2510     +++ b/drivers/thermal/thermal_core.c
2511     @@ -597,16 +597,20 @@ static void update_temperature(struct thermal_zone_device *tz)
2512     tz->last_temperature, tz->temperature);
2513     }
2514    
2515     -static void thermal_zone_device_reset(struct thermal_zone_device *tz)
2516     +static void thermal_zone_device_init(struct thermal_zone_device *tz)
2517     {
2518     struct thermal_instance *pos;
2519     -
2520     tz->temperature = THERMAL_TEMP_INVALID;
2521     - tz->passive = 0;
2522     list_for_each_entry(pos, &tz->thermal_instances, tz_node)
2523     pos->initialized = false;
2524     }
2525    
2526     +static void thermal_zone_device_reset(struct thermal_zone_device *tz)
2527     +{
2528     + tz->passive = 0;
2529     + thermal_zone_device_init(tz);
2530     +}
2531     +
2532     void thermal_zone_device_update(struct thermal_zone_device *tz,
2533     enum thermal_notify_event event)
2534     {
2535     @@ -2297,7 +2301,7 @@ static int thermal_pm_notify(struct notifier_block *nb,
2536     case PM_POST_SUSPEND:
2537     atomic_set(&in_suspend, 0);
2538     list_for_each_entry(tz, &thermal_tz_list, node) {
2539     - thermal_zone_device_reset(tz);
2540     + thermal_zone_device_init(tz);
2541     thermal_zone_device_update(tz,
2542     THERMAL_EVENT_UNSPECIFIED);
2543     }
2544     diff --git a/drivers/thermal/thermal_hwmon.h b/drivers/thermal/thermal_hwmon.h
2545     index c798fdb2ae43..f97f76691bd0 100644
2546     --- a/drivers/thermal/thermal_hwmon.h
2547     +++ b/drivers/thermal/thermal_hwmon.h
2548     @@ -34,13 +34,13 @@
2549     int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz);
2550     void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz);
2551     #else
2552     -static int
2553     +static inline int
2554     thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
2555     {
2556     return 0;
2557     }
2558    
2559     -static void
2560     +static inline void
2561     thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
2562     {
2563     }
2564     diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
2565     index e2ec04904f54..5c471c3481bd 100644
2566     --- a/drivers/tty/serial/fsl_lpuart.c
2567     +++ b/drivers/tty/serial/fsl_lpuart.c
2568     @@ -1344,6 +1344,8 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios,
2569     else
2570     cr1 &= ~UARTCR1_PT;
2571     }
2572     + } else {
2573     + cr1 &= ~UARTCR1_PE;
2574     }
2575    
2576     /* ask the core to calculate the divisor */
2577     @@ -1487,6 +1489,8 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
2578     else
2579     ctrl &= ~UARTCTRL_PT;
2580     }
2581     + } else {
2582     + ctrl &= ~UARTCTRL_PE;
2583     }
2584    
2585     /* ask the core to calculate the divisor */
2586     diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
2587     index 5609305b3676..01ff8ec78023 100644
2588     --- a/drivers/tty/serial/samsung.c
2589     +++ b/drivers/tty/serial/samsung.c
2590     @@ -1335,11 +1335,14 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
2591     wr_regl(port, S3C2410_ULCON, ulcon);
2592     wr_regl(port, S3C2410_UBRDIV, quot);
2593    
2594     + port->status &= ~UPSTAT_AUTOCTS;
2595     +
2596     umcon = rd_regl(port, S3C2410_UMCON);
2597     if (termios->c_cflag & CRTSCTS) {
2598     umcon |= S3C2410_UMCOM_AFC;
2599     /* Disable RTS when RX FIFO contains 63 bytes */
2600     umcon &= ~S3C2412_UMCON_AFC_8;
2601     + port->status = UPSTAT_AUTOCTS;
2602     } else {
2603     umcon &= ~S3C2410_UMCOM_AFC;
2604     }
2605     diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
2606     index 95fc7e893fd2..55ed4c66f77f 100644
2607     --- a/drivers/tty/serial/serial_core.c
2608     +++ b/drivers/tty/serial/serial_core.c
2609     @@ -141,6 +141,9 @@ static void uart_start(struct tty_struct *tty)
2610     struct uart_port *port;
2611     unsigned long flags;
2612    
2613     + if (!state)
2614     + return;
2615     +
2616     port = uart_port_lock(state, flags);
2617     __uart_start(tty);
2618     uart_port_unlock(port, flags);
2619     @@ -717,6 +720,9 @@ static void uart_unthrottle(struct tty_struct *tty)
2620     struct uart_port *port;
2621     upstat_t mask = 0;
2622    
2623     + if (!state)
2624     + return;
2625     +
2626     port = uart_port_ref(state);
2627     if (!port)
2628     return;
2629     diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
2630     index 67679f619c3b..7b6919086539 100644
2631     --- a/drivers/usb/core/hub.c
2632     +++ b/drivers/usb/core/hub.c
2633     @@ -1108,6 +1108,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
2634     USB_PORT_FEAT_ENABLE);
2635     }
2636    
2637     + /*
2638     + * Add debounce if USB3 link is in polling/link training state.
2639     + * Link will automatically transition to Enabled state after
2640     + * link training completes.
2641     + */
2642     + if (hub_is_superspeed(hdev) &&
2643     + ((portstatus & USB_PORT_STAT_LINK_STATE) ==
2644     + USB_SS_PORT_LS_POLLING))
2645     + need_debounce_delay = true;
2646     +
2647     /* Clear status-change flags; we'll debounce later */
2648     if (portchange & USB_PORT_STAT_C_CONNECTION) {
2649     need_debounce_delay = true;
2650     diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
2651     index 7c6113432093..40396a265a3f 100644
2652     --- a/drivers/usb/gadget/udc/net2272.c
2653     +++ b/drivers/usb/gadget/udc/net2272.c
2654     @@ -2096,7 +2096,7 @@ static irqreturn_t net2272_irq(int irq, void *_dev)
2655     #if defined(PLX_PCI_RDK2)
2656     /* see if PCI int for us by checking irqstat */
2657     intcsr = readl(dev->rdk2.fpga_base_addr + RDK2_IRQSTAT);
2658     - if (!intcsr & (1 << NET2272_PCI_IRQ)) {
2659     + if (!(intcsr & (1 << NET2272_PCI_IRQ))) {
2660     spin_unlock(&dev->lock);
2661     return IRQ_NONE;
2662     }
2663     diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
2664     index f1219f6d58a9..60540a8ac431 100644
2665     --- a/drivers/usb/musb/musb_gadget.c
2666     +++ b/drivers/usb/musb/musb_gadget.c
2667     @@ -477,13 +477,10 @@ void musb_g_tx(struct musb *musb, u8 epnum)
2668     }
2669    
2670     if (request) {
2671     - u8 is_dma = 0;
2672     - bool short_packet = false;
2673    
2674     trace_musb_req_tx(req);
2675    
2676     if (dma && (csr & MUSB_TXCSR_DMAENAB)) {
2677     - is_dma = 1;
2678     csr |= MUSB_TXCSR_P_WZC_BITS;
2679     csr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_P_UNDERRUN |
2680     MUSB_TXCSR_TXPKTRDY | MUSB_TXCSR_AUTOSET);
2681     @@ -501,16 +498,8 @@ void musb_g_tx(struct musb *musb, u8 epnum)
2682     */
2683     if ((request->zero && request->length)
2684     && (request->length % musb_ep->packet_sz == 0)
2685     - && (request->actual == request->length))
2686     - short_packet = true;
2687     + && (request->actual == request->length)) {
2688    
2689     - if ((musb_dma_inventra(musb) || musb_dma_ux500(musb)) &&
2690     - (is_dma && (!dma->desired_mode ||
2691     - (request->actual &
2692     - (musb_ep->packet_sz - 1)))))
2693     - short_packet = true;
2694     -
2695     - if (short_packet) {
2696     /*
2697     * On DMA completion, FIFO may not be
2698     * available yet...
2699     diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c
2700     index 3620073da58c..512108e22d2b 100644
2701     --- a/drivers/usb/musb/musbhsdma.c
2702     +++ b/drivers/usb/musb/musbhsdma.c
2703     @@ -320,12 +320,10 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
2704     channel->status = MUSB_DMA_STATUS_FREE;
2705    
2706     /* completed */
2707     - if ((devctl & MUSB_DEVCTL_HM)
2708     - && (musb_channel->transmit)
2709     - && ((channel->desired_mode == 0)
2710     - || (channel->actual_len &
2711     - (musb_channel->max_packet_sz - 1)))
2712     - ) {
2713     + if (musb_channel->transmit &&
2714     + (!channel->desired_mode ||
2715     + (channel->actual_len %
2716     + musb_channel->max_packet_sz))) {
2717     u8 epnum = musb_channel->epnum;
2718     int offset = musb->io.ep_offset(epnum,
2719     MUSB_TXCSR);
2720     @@ -337,11 +335,14 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data)
2721     */
2722     musb_ep_select(mbase, epnum);
2723     txcsr = musb_readw(mbase, offset);
2724     - txcsr &= ~(MUSB_TXCSR_DMAENAB
2725     + if (channel->desired_mode == 1) {
2726     + txcsr &= ~(MUSB_TXCSR_DMAENAB
2727     | MUSB_TXCSR_AUTOSET);
2728     - musb_writew(mbase, offset, txcsr);
2729     - /* Send out the packet */
2730     - txcsr &= ~MUSB_TXCSR_DMAMODE;
2731     + musb_writew(mbase, offset, txcsr);
2732     + /* Send out the packet */
2733     + txcsr &= ~MUSB_TXCSR_DMAMODE;
2734     + txcsr |= MUSB_TXCSR_DMAENAB;
2735     + }
2736     txcsr |= MUSB_TXCSR_TXPKTRDY;
2737     musb_writew(mbase, offset, txcsr);
2738     }
2739     diff --git a/drivers/usb/phy/phy-am335x.c b/drivers/usb/phy/phy-am335x.c
2740     index 7e5aece769da..cb1382a52765 100644
2741     --- a/drivers/usb/phy/phy-am335x.c
2742     +++ b/drivers/usb/phy/phy-am335x.c
2743     @@ -60,9 +60,6 @@ static int am335x_phy_probe(struct platform_device *pdev)
2744     if (ret)
2745     return ret;
2746    
2747     - ret = usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
2748     - if (ret)
2749     - return ret;
2750     am_phy->usb_phy_gen.phy.init = am335x_init;
2751     am_phy->usb_phy_gen.phy.shutdown = am335x_shutdown;
2752    
2753     @@ -81,7 +78,7 @@ static int am335x_phy_probe(struct platform_device *pdev)
2754     device_set_wakeup_enable(dev, false);
2755     phy_ctrl_power(am_phy->phy_ctrl, am_phy->id, am_phy->dr_mode, false);
2756    
2757     - return 0;
2758     + return usb_add_phy_dev(&am_phy->usb_phy_gen.phy);
2759     }
2760    
2761     static int am335x_phy_remove(struct platform_device *pdev)
2762     diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
2763     index 4db10d7990c9..178b507a6fe0 100644
2764     --- a/drivers/video/console/fbcon.c
2765     +++ b/drivers/video/console/fbcon.c
2766     @@ -3030,7 +3030,7 @@ static int fbcon_fb_unbind(int idx)
2767     for (i = first_fb_vc; i <= last_fb_vc; i++) {
2768     if (con2fb_map[i] != idx &&
2769     con2fb_map[i] != -1) {
2770     - new_idx = i;
2771     + new_idx = con2fb_map[i];
2772     break;
2773     }
2774     }
2775     diff --git a/drivers/video/fbdev/clps711x-fb.c b/drivers/video/fbdev/clps711x-fb.c
2776     index ff561073ee4e..42f909618f04 100644
2777     --- a/drivers/video/fbdev/clps711x-fb.c
2778     +++ b/drivers/video/fbdev/clps711x-fb.c
2779     @@ -287,14 +287,17 @@ static int clps711x_fb_probe(struct platform_device *pdev)
2780     }
2781    
2782     ret = of_get_fb_videomode(disp, &cfb->mode, OF_USE_NATIVE_MODE);
2783     - if (ret)
2784     + if (ret) {
2785     + of_node_put(disp);
2786     goto out_fb_release;
2787     + }
2788    
2789     of_property_read_u32(disp, "ac-prescale", &cfb->ac_prescale);
2790     cfb->cmap_invert = of_property_read_bool(disp, "cmap-invert");
2791    
2792     ret = of_property_read_u32(disp, "bits-per-pixel",
2793     &info->var.bits_per_pixel);
2794     + of_node_put(disp);
2795     if (ret)
2796     goto out_fb_release;
2797    
2798     diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
2799     index 74273bc7ca9a..a1d93151c059 100644
2800     --- a/drivers/video/fbdev/core/fbmem.c
2801     +++ b/drivers/video/fbdev/core/fbmem.c
2802     @@ -433,7 +433,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
2803     image->dx += image->width + 8;
2804     }
2805     } else if (rotate == FB_ROTATE_UD) {
2806     - for (x = 0; x < num; x++) {
2807     + u32 dx = image->dx;
2808     +
2809     + for (x = 0; x < num && image->dx <= dx; x++) {
2810     info->fbops->fb_imageblit(info, image);
2811     image->dx -= image->width + 8;
2812     }
2813     @@ -445,7 +447,9 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
2814     image->dy += image->height + 8;
2815     }
2816     } else if (rotate == FB_ROTATE_CCW) {
2817     - for (x = 0; x < num; x++) {
2818     + u32 dy = image->dy;
2819     +
2820     + for (x = 0; x < num && image->dy <= dy; x++) {
2821     info->fbops->fb_imageblit(info, image);
2822     image->dy -= image->height + 8;
2823     }
2824     diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
2825     index afdf4e3cafc2..634bdbb23851 100644
2826     --- a/fs/binfmt_script.c
2827     +++ b/fs/binfmt_script.c
2828     @@ -43,10 +43,14 @@ static int load_script(struct linux_binprm *bprm)
2829     fput(bprm->file);
2830     bprm->file = NULL;
2831    
2832     - bprm->buf[BINPRM_BUF_SIZE - 1] = '\0';
2833     - if ((cp = strchr(bprm->buf, '\n')) == NULL)
2834     - cp = bprm->buf+BINPRM_BUF_SIZE-1;
2835     + for (cp = bprm->buf+2;; cp++) {
2836     + if (cp >= bprm->buf + BINPRM_BUF_SIZE)
2837     + return -ENOEXEC;
2838     + if (!*cp || (*cp == '\n'))
2839     + break;
2840     + }
2841     *cp = '\0';
2842     +
2843     while (cp > bprm->buf) {
2844     cp--;
2845     if ((*cp == ' ') || (*cp == '\t'))
2846     diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
2847     index ef24b4527459..68183872bf8b 100644
2848     --- a/fs/cifs/readdir.c
2849     +++ b/fs/cifs/readdir.c
2850     @@ -655,7 +655,14 @@ find_cifs_entry(const unsigned int xid, struct cifs_tcon *tcon, loff_t pos,
2851     /* scan and find it */
2852     int i;
2853     char *cur_ent;
2854     - char *end_of_smb = cfile->srch_inf.ntwrk_buf_start +
2855     + char *end_of_smb;
2856     +
2857     + if (cfile->srch_inf.ntwrk_buf_start == NULL) {
2858     + cifs_dbg(VFS, "ntwrk_buf_start is NULL during readdir\n");
2859     + return -EIO;
2860     + }
2861     +
2862     + end_of_smb = cfile->srch_inf.ntwrk_buf_start +
2863     server->ops->calc_smb_size(
2864     cfile->srch_inf.ntwrk_buf_start);
2865    
2866     diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c
2867     index dcea1e37a1b7..f18619bc2e09 100644
2868     --- a/fs/dlm/ast.c
2869     +++ b/fs/dlm/ast.c
2870     @@ -290,6 +290,8 @@ void dlm_callback_suspend(struct dlm_ls *ls)
2871     flush_workqueue(ls->ls_callback_wq);
2872     }
2873    
2874     +#define MAX_CB_QUEUE 25
2875     +
2876     void dlm_callback_resume(struct dlm_ls *ls)
2877     {
2878     struct dlm_lkb *lkb, *safe;
2879     @@ -300,15 +302,23 @@ void dlm_callback_resume(struct dlm_ls *ls)
2880     if (!ls->ls_callback_wq)
2881     return;
2882    
2883     +more:
2884     mutex_lock(&ls->ls_cb_mutex);
2885     list_for_each_entry_safe(lkb, safe, &ls->ls_cb_delay, lkb_cb_list) {
2886     list_del_init(&lkb->lkb_cb_list);
2887     queue_work(ls->ls_callback_wq, &lkb->lkb_cb_work);
2888     count++;
2889     + if (count == MAX_CB_QUEUE)
2890     + break;
2891     }
2892     mutex_unlock(&ls->ls_cb_mutex);
2893    
2894     if (count)
2895     log_rinfo(ls, "dlm_callback_resume %d", count);
2896     + if (count == MAX_CB_QUEUE) {
2897     + count = 0;
2898     + cond_resched();
2899     + goto more;
2900     + }
2901     }
2902    
2903     diff --git a/fs/eventpoll.c b/fs/eventpoll.c
2904     index 3cbc30413add..a9c0bf8782f5 100644
2905     --- a/fs/eventpoll.c
2906     +++ b/fs/eventpoll.c
2907     @@ -1040,7 +1040,7 @@ static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync, void *k
2908     * semantics). All the events that happen during that period of time are
2909     * chained in ep->ovflist and requeued later on.
2910     */
2911     - if (unlikely(ep->ovflist != EP_UNACTIVE_PTR)) {
2912     + if (ep->ovflist != EP_UNACTIVE_PTR) {
2913     if (epi->next == EP_UNACTIVE_PTR) {
2914     epi->next = ep->ovflist;
2915     ep->ovflist = epi;
2916     diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c
2917     index 55aa29c0c78d..a9894089d9dc 100644
2918     --- a/fs/f2fs/acl.c
2919     +++ b/fs/f2fs/acl.c
2920     @@ -348,12 +348,14 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
2921     return PTR_ERR(p);
2922    
2923     clone = f2fs_acl_clone(p, GFP_NOFS);
2924     - if (!clone)
2925     - goto no_mem;
2926     + if (!clone) {
2927     + ret = -ENOMEM;
2928     + goto release_acl;
2929     + }
2930    
2931     ret = f2fs_acl_create_masq(clone, mode);
2932     if (ret < 0)
2933     - goto no_mem_clone;
2934     + goto release_clone;
2935    
2936     if (ret == 0)
2937     posix_acl_release(clone);
2938     @@ -367,11 +369,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
2939    
2940     return 0;
2941    
2942     -no_mem_clone:
2943     +release_clone:
2944     posix_acl_release(clone);
2945     -no_mem:
2946     +release_acl:
2947     posix_acl_release(p);
2948     - return -ENOMEM;
2949     + return ret;
2950     }
2951    
2952     int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
2953     diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
2954     index 9c380885b0fc..b16ab4187234 100644
2955     --- a/fs/f2fs/f2fs.h
2956     +++ b/fs/f2fs/f2fs.h
2957     @@ -1885,10 +1885,19 @@ static inline bool is_dot_dotdot(const struct qstr *str)
2958    
2959     static inline bool f2fs_may_extent_tree(struct inode *inode)
2960     {
2961     - if (!test_opt(F2FS_I_SB(inode), EXTENT_CACHE) ||
2962     + struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
2963     +
2964     + if (!test_opt(sbi, EXTENT_CACHE) ||
2965     is_inode_flag_set(inode, FI_NO_EXTENT))
2966     return false;
2967    
2968     + /*
2969     + * for recovered files during mount do not create extents
2970     + * if shrinker is not registered.
2971     + */
2972     + if (list_empty(&sbi->s_list))
2973     + return false;
2974     +
2975     return S_ISREG(inode->i_mode);
2976     }
2977    
2978     diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
2979     index b768f495603e..f46ac1651bd5 100644
2980     --- a/fs/f2fs/file.c
2981     +++ b/fs/f2fs/file.c
2982     @@ -198,6 +198,9 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,
2983    
2984     trace_f2fs_sync_file_enter(inode);
2985    
2986     + if (S_ISDIR(inode->i_mode))
2987     + goto go_write;
2988     +
2989     /* if fdatasync is triggered, let's do in-place-update */
2990     if (datasync || get_dirty_pages(inode) <= SM_I(sbi)->min_fsync_blocks)
2991     set_inode_flag(inode, FI_NEED_IPU);
2992     diff --git a/fs/f2fs/shrinker.c b/fs/f2fs/shrinker.c
2993     index 46c915425923..a40bfa7fafec 100644
2994     --- a/fs/f2fs/shrinker.c
2995     +++ b/fs/f2fs/shrinker.c
2996     @@ -136,6 +136,6 @@ void f2fs_leave_shrinker(struct f2fs_sb_info *sbi)
2997     f2fs_shrink_extent_tree(sbi, __count_extent_cache(sbi));
2998    
2999     spin_lock(&f2fs_list_lock);
3000     - list_del(&sbi->s_list);
3001     + list_del_init(&sbi->s_list);
3002     spin_unlock(&f2fs_list_lock);
3003     }
3004     diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
3005     index b4253181b5d4..411f16101d1a 100644
3006     --- a/fs/fuse/dev.c
3007     +++ b/fs/fuse/dev.c
3008     @@ -1685,7 +1685,6 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
3009     req->in.h.nodeid = outarg->nodeid;
3010     req->in.numargs = 2;
3011     req->in.argpages = 1;
3012     - req->page_descs[0].offset = offset;
3013     req->end = fuse_retrieve_end;
3014    
3015     index = outarg->offset >> PAGE_SHIFT;
3016     @@ -1700,6 +1699,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
3017    
3018     this_num = min_t(unsigned, num, PAGE_SIZE - offset);
3019     req->pages[req->num_pages] = page;
3020     + req->page_descs[req->num_pages].offset = offset;
3021     req->page_descs[req->num_pages].length = this_num;
3022     req->num_pages++;
3023    
3024     @@ -2018,8 +2018,10 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
3025    
3026     ret = fuse_dev_do_write(fud, &cs, len);
3027    
3028     + pipe_lock(pipe);
3029     for (idx = 0; idx < nbuf; idx++)
3030     pipe_buf_release(pipe, &bufs[idx]);
3031     + pipe_unlock(pipe);
3032    
3033     out:
3034     kfree(bufs);
3035     diff --git a/fs/fuse/file.c b/fs/fuse/file.c
3036     index 1cd46e667e3d..30a607473621 100644
3037     --- a/fs/fuse/file.c
3038     +++ b/fs/fuse/file.c
3039     @@ -1772,7 +1772,7 @@ static bool fuse_writepage_in_flight(struct fuse_req *new_req,
3040     spin_unlock(&fc->lock);
3041    
3042     dec_wb_stat(&bdi->wb, WB_WRITEBACK);
3043     - dec_node_page_state(page, NR_WRITEBACK_TEMP);
3044     + dec_node_page_state(new_req->pages[0], NR_WRITEBACK_TEMP);
3045     wb_writeout_inc(&bdi->wb);
3046     fuse_writepage_free(fc, new_req);
3047     fuse_request_free(new_req);
3048     diff --git a/fs/nfs/super.c b/fs/nfs/super.c
3049     index 2fdb8f5a7b69..35aef192a13f 100644
3050     --- a/fs/nfs/super.c
3051     +++ b/fs/nfs/super.c
3052     @@ -2403,8 +2403,7 @@ static int nfs_compare_mount_options(const struct super_block *s, const struct n
3053     goto Ebusy;
3054     if (a->acdirmax != b->acdirmax)
3055     goto Ebusy;
3056     - if (b->auth_info.flavor_len > 0 &&
3057     - clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
3058     + if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
3059     goto Ebusy;
3060     return 1;
3061     Ebusy:
3062     diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
3063     index 36b2af931e06..797a155c9a67 100644
3064     --- a/fs/nfsd/nfsctl.c
3065     +++ b/fs/nfsd/nfsctl.c
3066     @@ -1103,6 +1103,8 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size)
3067     case 'Y':
3068     case 'y':
3069     case '1':
3070     + if (nn->nfsd_serv)
3071     + return -EBUSY;
3072     nfsd4_end_grace(nn);
3073     break;
3074     default:
3075     diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
3076     index 25c8b328c43d..935bac253991 100644
3077     --- a/fs/ocfs2/buffer_head_io.c
3078     +++ b/fs/ocfs2/buffer_head_io.c
3079     @@ -151,7 +151,6 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
3080     #endif
3081     }
3082    
3083     - clear_buffer_uptodate(bh);
3084     get_bh(bh); /* for end_buffer_read_sync() */
3085     bh->b_end_io = end_buffer_read_sync;
3086     submit_bh(REQ_OP_READ, 0, bh);
3087     @@ -305,7 +304,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
3088     continue;
3089     }
3090    
3091     - clear_buffer_uptodate(bh);
3092     get_bh(bh); /* for end_buffer_read_sync() */
3093     if (validate)
3094     set_buffer_needs_validate(bh);
3095     diff --git a/fs/udf/inode.c b/fs/udf/inode.c
3096     index 035943501b9f..fd817022cb9b 100644
3097     --- a/fs/udf/inode.c
3098     +++ b/fs/udf/inode.c
3099     @@ -1372,6 +1372,12 @@ reread:
3100    
3101     iinfo->i_alloc_type = le16_to_cpu(fe->icbTag.flags) &
3102     ICBTAG_FLAG_AD_MASK;
3103     + if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_SHORT &&
3104     + iinfo->i_alloc_type != ICBTAG_FLAG_AD_LONG &&
3105     + iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB) {
3106     + ret = -EIO;
3107     + goto out;
3108     + }
3109     iinfo->i_unique = 0;
3110     iinfo->i_lenEAttr = 0;
3111     iinfo->i_lenExtents = 0;
3112     diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h
3113     index 6270a56e5edc..d0d6fdc22698 100644
3114     --- a/include/linux/genl_magic_struct.h
3115     +++ b/include/linux/genl_magic_struct.h
3116     @@ -190,6 +190,7 @@ static inline void ct_assert_unique_operations(void)
3117     {
3118     switch (0) {
3119     #include GENL_MAGIC_INCLUDE_FILE
3120     + case 0:
3121     ;
3122     }
3123     }
3124     @@ -208,6 +209,7 @@ static inline void ct_assert_unique_top_level_attributes(void)
3125     {
3126     switch (0) {
3127     #include GENL_MAGIC_INCLUDE_FILE
3128     + case 0:
3129     ;
3130     }
3131     }
3132     @@ -217,7 +219,8 @@ static inline void ct_assert_unique_top_level_attributes(void)
3133     static inline void ct_assert_unique_ ## s_name ## _attributes(void) \
3134     { \
3135     switch (0) { \
3136     - s_fields \
3137     + s_fields \
3138     + case 0: \
3139     ; \
3140     } \
3141     }
3142     diff --git a/include/linux/sched.h b/include/linux/sched.h
3143     index f4a551a5482c..ebd0afb35d16 100644
3144     --- a/include/linux/sched.h
3145     +++ b/include/linux/sched.h
3146     @@ -527,6 +527,7 @@ static inline int get_dumpable(struct mm_struct *mm)
3147     #define MMF_OOM_SKIP 21 /* mm is of no interest for the OOM killer */
3148     #define MMF_UNSTABLE 22 /* mm is unstable for copy_from_user */
3149     #define MMF_HUGE_ZERO_PAGE 23 /* mm has ever used the global huge zero page */
3150     +#define MMF_OOM_REAP_QUEUED 26 /* mm was queued for oom_reaper */
3151    
3152     #define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK)
3153    
3154     diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h
3155     index cee8c00f3d3e..96bc5acdade3 100644
3156     --- a/include/sound/compress_driver.h
3157     +++ b/include/sound/compress_driver.h
3158     @@ -185,7 +185,11 @@ static inline void snd_compr_drain_notify(struct snd_compr_stream *stream)
3159     if (snd_BUG_ON(!stream))
3160     return;
3161    
3162     - stream->runtime->state = SNDRV_PCM_STATE_SETUP;
3163     + if (stream->direction == SND_COMPRESS_PLAYBACK)
3164     + stream->runtime->state = SNDRV_PCM_STATE_SETUP;
3165     + else
3166     + stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
3167     +
3168     wake_up(&stream->runtime->sleep);
3169     }
3170    
3171     diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c
3172     index 017f7933a37d..f4b5811ebe23 100644
3173     --- a/kernel/events/ring_buffer.c
3174     +++ b/kernel/events/ring_buffer.c
3175     @@ -700,6 +700,9 @@ struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
3176     size = sizeof(struct ring_buffer);
3177     size += nr_pages * sizeof(void *);
3178    
3179     + if (order_base_2(size) >= MAX_ORDER)
3180     + goto fail;
3181     +
3182     rb = kzalloc(size, GFP_KERNEL);
3183     if (!rb)
3184     goto fail;
3185     diff --git a/kernel/hung_task.c b/kernel/hung_task.c
3186     index 2b59c82cc3e1..fd781a468f32 100644
3187     --- a/kernel/hung_task.c
3188     +++ b/kernel/hung_task.c
3189     @@ -30,7 +30,7 @@ int __read_mostly sysctl_hung_task_check_count = PID_MAX_LIMIT;
3190     * is disabled during the critical section. It also controls the size of
3191     * the RCU grace period. So it needs to be upper-bound.
3192     */
3193     -#define HUNG_TASK_BATCHING 1024
3194     +#define HUNG_TASK_LOCK_BREAK (HZ / 10)
3195    
3196     /*
3197     * Zero means infinite timeout - no checking done:
3198     @@ -158,7 +158,7 @@ static bool rcu_lock_break(struct task_struct *g, struct task_struct *t)
3199     static void check_hung_uninterruptible_tasks(unsigned long timeout)
3200     {
3201     int max_count = sysctl_hung_task_check_count;
3202     - int batch_count = HUNG_TASK_BATCHING;
3203     + unsigned long last_break = jiffies;
3204     struct task_struct *g, *t;
3205    
3206     /*
3207     @@ -172,10 +172,10 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
3208     for_each_process_thread(g, t) {
3209     if (!max_count--)
3210     goto unlock;
3211     - if (!--batch_count) {
3212     - batch_count = HUNG_TASK_BATCHING;
3213     + if (time_after(jiffies, last_break + HUNG_TASK_LOCK_BREAK)) {
3214     if (!rcu_lock_break(g, t))
3215     goto unlock;
3216     + last_break = jiffies;
3217     }
3218     /* use "==" to skip the TASK_KILLABLE tasks waiting on NFS */
3219     if (t->state == TASK_UNINTERRUPTIBLE)
3220     diff --git a/kernel/sysctl.c b/kernel/sysctl.c
3221     index 23f658d311c0..93c7b02279b9 100644
3222     --- a/kernel/sysctl.c
3223     +++ b/kernel/sysctl.c
3224     @@ -2503,6 +2503,8 @@ static int __do_proc_doulongvec_minmax(void *data, struct ctl_table *table, int
3225     bool neg;
3226    
3227     left -= proc_skip_spaces(&p);
3228     + if (!left)
3229     + break;
3230    
3231     err = proc_get_long(&p, &left, &val, &neg,
3232     proc_wspace_sep,
3233     diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
3234     index d831827d7ab0..e24e1f0c5690 100644
3235     --- a/kernel/time/timekeeping.c
3236     +++ b/kernel/time/timekeeping.c
3237     @@ -39,7 +39,9 @@
3238     static struct {
3239     seqcount_t seq;
3240     struct timekeeper timekeeper;
3241     -} tk_core ____cacheline_aligned;
3242     +} tk_core ____cacheline_aligned = {
3243     + .seq = SEQCNT_ZERO(tk_core.seq),
3244     +};
3245    
3246     static DEFINE_RAW_SPINLOCK(timekeeper_lock);
3247     static struct timekeeper shadow_timekeeper;
3248     diff --git a/lib/seq_buf.c b/lib/seq_buf.c
3249     index cb18469e1f49..5954f9fb6675 100644
3250     --- a/lib/seq_buf.c
3251     +++ b/lib/seq_buf.c
3252     @@ -143,9 +143,13 @@ int seq_buf_puts(struct seq_buf *s, const char *str)
3253    
3254     WARN_ON(s->size == 0);
3255    
3256     + /* Add 1 to len for the trailing null byte which must be there */
3257     + len += 1;
3258     +
3259     if (seq_buf_can_fit(s, len)) {
3260     memcpy(s->buffer + s->len, str, len);
3261     - s->len += len;
3262     + /* Don't count the trailing null byte against the capacity */
3263     + s->len += len - 1;
3264     return 0;
3265     }
3266     seq_buf_set_overflow(s);
3267     diff --git a/mm/oom_kill.c b/mm/oom_kill.c
3268     index 1de3695cb419..d514eebad905 100644
3269     --- a/mm/oom_kill.c
3270     +++ b/mm/oom_kill.c
3271     @@ -626,8 +626,8 @@ static void wake_oom_reaper(struct task_struct *tsk)
3272     if (!oom_reaper_th)
3273     return;
3274    
3275     - /* tsk is already queued? */
3276     - if (tsk == oom_reaper_list || tsk->oom_reaper_list)
3277     + /* mm is already queued? */
3278     + if (test_and_set_bit(MMF_OOM_REAP_QUEUED, &tsk->signal->oom_mm->flags))
3279     return;
3280    
3281     get_task_struct(tsk);
3282     diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
3283     index d2f9eb169ba8..6f78489fdb13 100644
3284     --- a/net/bluetooth/hci_event.c
3285     +++ b/net/bluetooth/hci_event.c
3286     @@ -5212,6 +5212,12 @@ static bool hci_get_cmd_complete(struct hci_dev *hdev, u16 opcode,
3287     return true;
3288     }
3289    
3290     + /* Check if request ended in Command Status - no way to retreive
3291     + * any extra parameters in this case.
3292     + */
3293     + if (hdr->evt == HCI_EV_CMD_STATUS)
3294     + return false;
3295     +
3296     if (hdr->evt != HCI_EV_CMD_COMPLETE) {
3297     BT_DBG("Last event is not cmd complete (0x%2.2x)", hdr->evt);
3298     return false;
3299     diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
3300     index 6eb837a47b5c..baaaeb2b2c42 100644
3301     --- a/net/dccp/ccid.h
3302     +++ b/net/dccp/ccid.h
3303     @@ -202,7 +202,7 @@ static inline void ccid_hc_tx_packet_recv(struct ccid *ccid, struct sock *sk,
3304     static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
3305     u8 pkt, u8 opt, u8 *val, u8 len)
3306     {
3307     - if (ccid->ccid_ops->ccid_hc_tx_parse_options == NULL)
3308     + if (!ccid || !ccid->ccid_ops->ccid_hc_tx_parse_options)
3309     return 0;
3310     return ccid->ccid_ops->ccid_hc_tx_parse_options(sk, pkt, opt, val, len);
3311     }
3312     @@ -214,7 +214,7 @@ static inline int ccid_hc_tx_parse_options(struct ccid *ccid, struct sock *sk,
3313     static inline int ccid_hc_rx_parse_options(struct ccid *ccid, struct sock *sk,
3314     u8 pkt, u8 opt, u8 *val, u8 len)
3315     {
3316     - if (ccid->ccid_ops->ccid_hc_rx_parse_options == NULL)
3317     + if (!ccid || !ccid->ccid_ops->ccid_hc_rx_parse_options)
3318     return 0;
3319     return ccid->ccid_ops->ccid_hc_rx_parse_options(sk, pkt, opt, val, len);
3320     }
3321     diff --git a/net/dsa/slave.c b/net/dsa/slave.c
3322     index 339d9c678d3e..d7883e55fe15 100644
3323     --- a/net/dsa/slave.c
3324     +++ b/net/dsa/slave.c
3325     @@ -180,10 +180,14 @@ static void dsa_slave_change_rx_flags(struct net_device *dev, int change)
3326     struct dsa_slave_priv *p = netdev_priv(dev);
3327     struct net_device *master = p->parent->dst->master_netdev;
3328    
3329     - if (change & IFF_ALLMULTI)
3330     - dev_set_allmulti(master, dev->flags & IFF_ALLMULTI ? 1 : -1);
3331     - if (change & IFF_PROMISC)
3332     - dev_set_promiscuity(master, dev->flags & IFF_PROMISC ? 1 : -1);
3333     + if (dev->flags & IFF_UP) {
3334     + if (change & IFF_ALLMULTI)
3335     + dev_set_allmulti(master,
3336     + dev->flags & IFF_ALLMULTI ? 1 : -1);
3337     + if (change & IFF_PROMISC)
3338     + dev_set_promiscuity(master,
3339     + dev->flags & IFF_PROMISC ? 1 : -1);
3340     + }
3341     }
3342    
3343     static void dsa_slave_set_rx_mode(struct net_device *dev)
3344     diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
3345     index e1c0bbe7996c..3a2701d42f47 100644
3346     --- a/net/ipv6/xfrm6_tunnel.c
3347     +++ b/net/ipv6/xfrm6_tunnel.c
3348     @@ -144,6 +144,9 @@ static u32 __xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr)
3349     index = __xfrm6_tunnel_spi_check(net, spi);
3350     if (index >= 0)
3351     goto alloc_spi;
3352     +
3353     + if (spi == XFRM6_TUNNEL_SPI_MAX)
3354     + break;
3355     }
3356     for (spi = XFRM6_TUNNEL_SPI_MIN; spi < xfrm6_tn->spi; spi++) {
3357     index = __xfrm6_tunnel_spi_check(net, spi);
3358     diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
3359     index 93c332737e86..af02d2136a06 100644
3360     --- a/net/mac80211/rx.c
3361     +++ b/net/mac80211/rx.c
3362     @@ -152,6 +152,9 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
3363     /* allocate extra bitmaps */
3364     if (status->chains)
3365     len += 4 * hweight8(status->chains);
3366     + /* vendor presence bitmap */
3367     + if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA)
3368     + len += 4;
3369    
3370     if (ieee80211_have_rx_timestamp(status)) {
3371     len = ALIGN(len, 8);
3372     @@ -193,8 +196,6 @@ ieee80211_rx_radiotap_hdrlen(struct ieee80211_local *local,
3373     if (status->flag & RX_FLAG_RADIOTAP_VENDOR_DATA) {
3374     struct ieee80211_vendor_radiotap *rtap = (void *)skb->data;
3375    
3376     - /* vendor presence bitmap */
3377     - len += 4;
3378     /* alignment for fixed 6-byte vendor data header */
3379     len = ALIGN(len, 2);
3380     /* vendor data header */
3381     diff --git a/net/rds/bind.c b/net/rds/bind.c
3382     index cc7e3a138598..438452fb5fbc 100644
3383     --- a/net/rds/bind.c
3384     +++ b/net/rds/bind.c
3385     @@ -62,10 +62,10 @@ struct rds_sock *rds_find_bound(__be32 addr, __be16 port)
3386    
3387     rcu_read_lock();
3388     rs = rhashtable_lookup(&bind_hash_table, &key, ht_parms);
3389     - if (rs && !sock_flag(rds_rs_to_sk(rs), SOCK_DEAD))
3390     - rds_sock_addref(rs);
3391     - else
3392     + if (rs && (sock_flag(rds_rs_to_sk(rs), SOCK_DEAD) ||
3393     + !atomic_inc_not_zero(&rds_rs_to_sk(rs)->sk_refcnt)))
3394     rs = NULL;
3395     +
3396     rcu_read_unlock();
3397    
3398     rdsdebug("returning rs %p for %pI4:%u\n", rs, &addr,
3399     diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
3400     index 3e52b7fdc35d..72de69175476 100644
3401     --- a/net/rxrpc/recvmsg.c
3402     +++ b/net/rxrpc/recvmsg.c
3403     @@ -552,6 +552,7 @@ error:
3404     rxrpc_put_call(call, rxrpc_call_put);
3405     error_no_call:
3406     release_sock(&rx->sk);
3407     +error_trace:
3408     trace_rxrpc_recvmsg(call, rxrpc_recvmsg_return, 0, 0, 0, ret);
3409     return ret;
3410    
3411     @@ -560,7 +561,7 @@ wait_interrupted:
3412     wait_error:
3413     finish_wait(sk_sleep(&rx->sk), &wait);
3414     call = NULL;
3415     - goto error_no_call;
3416     + goto error_trace;
3417     }
3418    
3419     /**
3420     diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
3421     index c332684e1b5a..edde8250195c 100755
3422     --- a/scripts/decode_stacktrace.sh
3423     +++ b/scripts/decode_stacktrace.sh
3424     @@ -77,7 +77,7 @@ parse_symbol() {
3425     fi
3426    
3427     # Strip out the base of the path
3428     - code=${code//$basepath/""}
3429     + code=${code//^$basepath/""}
3430    
3431     # In the case of inlines, move everything to same line
3432     code=${code//$'\n'/' '}
3433     diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
3434     index 88b3dc19bbae..fdf5bbfd00cd 100644
3435     --- a/scripts/mod/modpost.c
3436     +++ b/scripts/mod/modpost.c
3437     @@ -1198,6 +1198,30 @@ static int secref_whitelist(const struct sectioncheck *mismatch,
3438     return 1;
3439     }
3440    
3441     +static inline int is_arm_mapping_symbol(const char *str)
3442     +{
3443     + return str[0] == '$' && strchr("axtd", str[1])
3444     + && (str[2] == '\0' || str[2] == '.');
3445     +}
3446     +
3447     +/*
3448     + * If there's no name there, ignore it; likewise, ignore it if it's
3449     + * one of the magic symbols emitted used by current ARM tools.
3450     + *
3451     + * Otherwise if find_symbols_between() returns those symbols, they'll
3452     + * fail the whitelist tests and cause lots of false alarms ... fixable
3453     + * only by merging __exit and __init sections into __text, bloating
3454     + * the kernel (which is especially evil on embedded platforms).
3455     + */
3456     +static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
3457     +{
3458     + const char *name = elf->strtab + sym->st_name;
3459     +
3460     + if (!name || !strlen(name))
3461     + return 0;
3462     + return !is_arm_mapping_symbol(name);
3463     +}
3464     +
3465     /**
3466     * Find symbol based on relocation record info.
3467     * In some cases the symbol supplied is a valid symbol so
3468     @@ -1223,6 +1247,8 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
3469     continue;
3470     if (ELF_ST_TYPE(sym->st_info) == STT_SECTION)
3471     continue;
3472     + if (!is_valid_name(elf, sym))
3473     + continue;
3474     if (sym->st_value == addr)
3475     return sym;
3476     /* Find a symbol nearby - addr are maybe negative */
3477     @@ -1241,30 +1267,6 @@ static Elf_Sym *find_elf_symbol(struct elf_info *elf, Elf64_Sword addr,
3478     return NULL;
3479     }
3480    
3481     -static inline int is_arm_mapping_symbol(const char *str)
3482     -{
3483     - return str[0] == '$' && strchr("axtd", str[1])
3484     - && (str[2] == '\0' || str[2] == '.');
3485     -}
3486     -
3487     -/*
3488     - * If there's no name there, ignore it; likewise, ignore it if it's
3489     - * one of the magic symbols emitted used by current ARM tools.
3490     - *
3491     - * Otherwise if find_symbols_between() returns those symbols, they'll
3492     - * fail the whitelist tests and cause lots of false alarms ... fixable
3493     - * only by merging __exit and __init sections into __text, bloating
3494     - * the kernel (which is especially evil on embedded platforms).
3495     - */
3496     -static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym)
3497     -{
3498     - const char *name = elf->strtab + sym->st_name;
3499     -
3500     - if (!name || !strlen(name))
3501     - return 0;
3502     - return !is_arm_mapping_symbol(name);
3503     -}
3504     -
3505     /*
3506     * Find symbols before or equal addr and after addr - in the section sec.
3507     * If we find two symbols with equal offset prefer one with a valid name.
3508     diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
3509     index fb7c534fb57d..aeb3ba70f907 100644
3510     --- a/security/smack/smack_lsm.c
3511     +++ b/security/smack/smack_lsm.c
3512     @@ -4362,6 +4362,12 @@ static int smack_key_permission(key_ref_t key_ref,
3513     int request = 0;
3514     int rc;
3515    
3516     + /*
3517     + * Validate requested permissions
3518     + */
3519     + if (perm & ~KEY_NEED_ALL)
3520     + return -EINVAL;
3521     +
3522     keyp = key_ref_to_ptr(key_ref);
3523     if (keyp == NULL)
3524     return -EINVAL;
3525     @@ -4381,10 +4387,10 @@ static int smack_key_permission(key_ref_t key_ref,
3526     ad.a.u.key_struct.key = keyp->serial;
3527     ad.a.u.key_struct.key_desc = keyp->description;
3528     #endif
3529     - if (perm & KEY_NEED_READ)
3530     - request = MAY_READ;
3531     + if (perm & (KEY_NEED_READ | KEY_NEED_SEARCH | KEY_NEED_VIEW))
3532     + request |= MAY_READ;
3533     if (perm & (KEY_NEED_WRITE | KEY_NEED_LINK | KEY_NEED_SETATTR))
3534     - request = MAY_WRITE;
3535     + request |= MAY_WRITE;
3536     rc = smk_access(tkp, keyp->security, request, &ad);
3537     rc = smk_bu_note("key access", tkp, keyp->security, request, rc);
3538     return rc;
3539     diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
3540     index 6efadbfb3fe3..7ea201c05e5d 100644
3541     --- a/sound/pci/hda/hda_bind.c
3542     +++ b/sound/pci/hda/hda_bind.c
3543     @@ -109,7 +109,8 @@ static int hda_codec_driver_probe(struct device *dev)
3544     err = snd_hda_codec_build_controls(codec);
3545     if (err < 0)
3546     goto error_module;
3547     - if (codec->card->registered) {
3548     + /* only register after the bus probe finished; otherwise it's racy */
3549     + if (!codec->bus->bus_probing && codec->card->registered) {
3550     err = snd_card_register(codec->card);
3551     if (err < 0)
3552     goto error_module;
3553     diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
3554     index 776dffa88aee..171e11be938d 100644
3555     --- a/sound/pci/hda/hda_codec.h
3556     +++ b/sound/pci/hda/hda_codec.h
3557     @@ -68,6 +68,7 @@ struct hda_bus {
3558     unsigned int response_reset:1; /* controller was reset */
3559     unsigned int in_reset:1; /* during reset operation */
3560     unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
3561     + unsigned int bus_probing :1; /* during probing process */
3562    
3563     int primary_dig_out_type; /* primary digital out PCM type */
3564     unsigned int mixer_assigned; /* codec addr for mixer name */
3565     diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3566     index fcd583efe011..789eca17fc60 100644
3567     --- a/sound/pci/hda/hda_intel.c
3568     +++ b/sound/pci/hda/hda_intel.c
3569     @@ -2089,6 +2089,7 @@ static int azx_probe_continue(struct azx *chip)
3570     int val;
3571     int err;
3572    
3573     + to_hda_bus(bus)->bus_probing = 1;
3574     hda->probe_continued = 1;
3575    
3576     /* Request display power well for the HDA controller or codec. For
3577     @@ -2189,6 +2190,7 @@ i915_power_fail:
3578     if (err < 0)
3579     hda->init_failed = 1;
3580     complete_all(&hda->probe_wait);
3581     + to_hda_bus(bus)->bus_probing = 0;
3582     return err;
3583     }
3584    
3585     diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
3586     index 19bdcac71775..a732b3a065c9 100644
3587     --- a/sound/soc/fsl/Kconfig
3588     +++ b/sound/soc/fsl/Kconfig
3589     @@ -220,7 +220,7 @@ config SND_SOC_PHYCORE_AC97
3590    
3591     config SND_SOC_EUKREA_TLV320
3592     tristate "Eukrea TLV320"
3593     - depends on ARCH_MXC && I2C
3594     + depends on ARCH_MXC && !ARM64 && I2C
3595     select SND_SOC_TLV320AIC23_I2C
3596     select SND_SOC_IMX_AUDMUX
3597     select SND_SOC_IMX_SSI
3598     diff --git a/sound/soc/intel/atom/sst/sst_loader.c b/sound/soc/intel/atom/sst/sst_loader.c
3599     index 33917146d9c4..054b1d514e8a 100644
3600     --- a/sound/soc/intel/atom/sst/sst_loader.c
3601     +++ b/sound/soc/intel/atom/sst/sst_loader.c
3602     @@ -354,14 +354,14 @@ static int sst_request_fw(struct intel_sst_drv *sst)
3603     const struct firmware *fw;
3604    
3605     retval = request_firmware(&fw, sst->firmware_name, sst->dev);
3606     - if (fw == NULL) {
3607     - dev_err(sst->dev, "fw is returning as null\n");
3608     - return -EINVAL;
3609     - }
3610     if (retval) {
3611     dev_err(sst->dev, "request fw failed %d\n", retval);
3612     return retval;
3613     }
3614     + if (fw == NULL) {
3615     + dev_err(sst->dev, "fw is returning as null\n");
3616     + return -EINVAL;
3617     + }
3618     mutex_lock(&sst->sst_lock);
3619     retval = sst_cache_and_parse_fw(sst, fw);
3620     mutex_unlock(&sst->sst_lock);
3621     diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c
3622     index b63d4be655a2..2020e12a856f 100644
3623     --- a/tools/perf/arch/x86/util/kvm-stat.c
3624     +++ b/tools/perf/arch/x86/util/kvm-stat.c
3625     @@ -154,7 +154,7 @@ int cpu_isa_init(struct perf_kvm_stat *kvm, const char *cpuid)
3626     if (strstr(cpuid, "Intel")) {
3627     kvm->exit_reasons = vmx_exit_reasons;
3628     kvm->exit_reasons_isa = "VMX";
3629     - } else if (strstr(cpuid, "AMD")) {
3630     + } else if (strstr(cpuid, "AMD") || strstr(cpuid, "Hygon")) {
3631     kvm->exit_reasons = svm_exit_reasons;
3632     kvm->exit_reasons_isa = "SVM";
3633     } else
3634     diff --git a/tools/perf/tests/evsel-tp-sched.c b/tools/perf/tests/evsel-tp-sched.c
3635     index 1984b3bbfe15..66b53f10eb18 100644
3636     --- a/tools/perf/tests/evsel-tp-sched.c
3637     +++ b/tools/perf/tests/evsel-tp-sched.c
3638     @@ -16,7 +16,7 @@ static int perf_evsel__test_field(struct perf_evsel *evsel, const char *name,
3639     return -1;
3640     }
3641    
3642     - is_signed = !!(field->flags | FIELD_IS_SIGNED);
3643     + is_signed = !!(field->flags & FIELD_IS_SIGNED);
3644     if (should_be_signed && !is_signed) {
3645     pr_debug("%s: \"%s\" signedness(%d) is wrong, should be %d\n",
3646     evsel->name, name, is_signed, should_be_signed);
3647     diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
3648     index ab36aa5585b4..a11f6760cce8 100644
3649     --- a/tools/perf/util/header.c
3650     +++ b/tools/perf/util/header.c
3651     @@ -2988,7 +2988,7 @@ perf_event__synthesize_event_update_unit(struct perf_tool *tool,
3652     if (ev == NULL)
3653     return -ENOMEM;
3654    
3655     - strncpy(ev->data, evsel->unit, size);
3656     + strlcpy(ev->data, evsel->unit, size + 1);
3657     err = process(tool, (union perf_event *)ev, NULL, NULL);
3658     free(ev);
3659     return err;
3660     diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
3661     index 436b64731f65..b9507a8d0e30 100644
3662     --- a/tools/perf/util/probe-file.c
3663     +++ b/tools/perf/util/probe-file.c
3664     @@ -414,7 +414,7 @@ static int probe_cache__open(struct probe_cache *pcache, const char *target)
3665    
3666     if (target && build_id_cache__cached(target)) {
3667     /* This is a cached buildid */
3668     - strncpy(sbuildid, target, SBUILD_ID_SIZE);
3669     + strlcpy(sbuildid, target, SBUILD_ID_SIZE);
3670     dir_name = build_id_cache__linkname(sbuildid, NULL, 0);
3671     goto found;
3672     }
3673     diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
3674     index 4f2a2df85b1f..60de4c337f0a 100644
3675     --- a/virt/kvm/kvm_main.c
3676     +++ b/virt/kvm/kvm_main.c
3677     @@ -2900,8 +2900,10 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
3678     if (ops->init)
3679     ops->init(dev);
3680    
3681     + kvm_get_kvm(kvm);
3682     ret = anon_inode_getfd(ops->name, &kvm_device_fops, dev, O_RDWR | O_CLOEXEC);
3683     if (ret < 0) {
3684     + kvm_put_kvm(kvm);
3685     mutex_lock(&kvm->lock);
3686     list_del(&dev->vm_node);
3687     mutex_unlock(&kvm->lock);
3688     @@ -2909,7 +2911,6 @@ static int kvm_ioctl_create_device(struct kvm *kvm,
3689     return ret;
3690     }
3691    
3692     - kvm_get_kvm(kvm);
3693     cd->fd = ret;
3694     return 0;
3695     }