Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0264-4.9.165-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3341 - (hide annotations) (download)
Tue Jun 18 09:41:55 2019 UTC (5 years ago) by niro
File size: 127195 byte(s)
-linux-4.9.165
1 niro 3341 diff --git a/Makefile b/Makefile
2     index e1bcc76388dc..9b61da532c42 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 164
9     +SUBLEVEL = 165
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h
14     index 0684fd2f42e8..f82393f89215 100644
15     --- a/arch/arc/include/asm/uaccess.h
16     +++ b/arch/arc/include/asm/uaccess.h
17     @@ -209,7 +209,7 @@ __arc_copy_from_user(void *to, const void __user *from, unsigned long n)
18     */
19     "=&r" (tmp), "+r" (to), "+r" (from)
20     :
21     - : "lp_count", "lp_start", "lp_end", "memory");
22     + : "lp_count", "memory");
23    
24     return n;
25     }
26     @@ -438,7 +438,7 @@ __arc_copy_to_user(void __user *to, const void *from, unsigned long n)
27     */
28     "=&r" (tmp), "+r" (to), "+r" (from)
29     :
30     - : "lp_count", "lp_start", "lp_end", "memory");
31     + : "lp_count", "memory");
32    
33     return n;
34     }
35     @@ -658,7 +658,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n)
36     " .previous \n"
37     : "+r"(d_char), "+r"(res)
38     : "i"(0)
39     - : "lp_count", "lp_start", "lp_end", "memory");
40     + : "lp_count", "memory");
41    
42     return res;
43     }
44     @@ -691,7 +691,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count)
45     " .previous \n"
46     : "+r"(res), "+r"(dst), "+r"(src), "=r"(val)
47     : "g"(-EFAULT), "r"(count)
48     - : "lp_count", "lp_start", "lp_end", "memory");
49     + : "lp_count", "memory");
50    
51     return res;
52     }
53     diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S
54     index d61044dd8b58..ea14b0bf3116 100644
55     --- a/arch/arc/lib/memcpy-archs.S
56     +++ b/arch/arc/lib/memcpy-archs.S
57     @@ -25,15 +25,11 @@
58     #endif
59    
60     #ifdef CONFIG_ARC_HAS_LL64
61     -# define PREFETCH_READ(RX) prefetch [RX, 56]
62     -# define PREFETCH_WRITE(RX) prefetchw [RX, 64]
63     # define LOADX(DST,RX) ldd.ab DST, [RX, 8]
64     # define STOREX(SRC,RX) std.ab SRC, [RX, 8]
65     # define ZOLSHFT 5
66     # define ZOLAND 0x1F
67     #else
68     -# define PREFETCH_READ(RX) prefetch [RX, 28]
69     -# define PREFETCH_WRITE(RX) prefetchw [RX, 32]
70     # define LOADX(DST,RX) ld.ab DST, [RX, 4]
71     # define STOREX(SRC,RX) st.ab SRC, [RX, 4]
72     # define ZOLSHFT 4
73     @@ -41,8 +37,6 @@
74     #endif
75    
76     ENTRY_CFI(memcpy)
77     - prefetch [r1] ; Prefetch the read location
78     - prefetchw [r0] ; Prefetch the write location
79     mov.f 0, r2
80     ;;; if size is zero
81     jz.d [blink]
82     @@ -72,8 +66,6 @@ ENTRY_CFI(memcpy)
83     lpnz @.Lcopy32_64bytes
84     ;; LOOP START
85     LOADX (r6, r1)
86     - PREFETCH_READ (r1)
87     - PREFETCH_WRITE (r3)
88     LOADX (r8, r1)
89     LOADX (r10, r1)
90     LOADX (r4, r1)
91     @@ -117,9 +109,7 @@ ENTRY_CFI(memcpy)
92     lpnz @.Lcopy8bytes_1
93     ;; LOOP START
94     ld.ab r6, [r1, 4]
95     - prefetch [r1, 28] ;Prefetch the next read location
96     ld.ab r8, [r1,4]
97     - prefetchw [r3, 32] ;Prefetch the next write location
98    
99     SHIFT_1 (r7, r6, 24)
100     or r7, r7, r5
101     @@ -162,9 +152,7 @@ ENTRY_CFI(memcpy)
102     lpnz @.Lcopy8bytes_2
103     ;; LOOP START
104     ld.ab r6, [r1, 4]
105     - prefetch [r1, 28] ;Prefetch the next read location
106     ld.ab r8, [r1,4]
107     - prefetchw [r3, 32] ;Prefetch the next write location
108    
109     SHIFT_1 (r7, r6, 16)
110     or r7, r7, r5
111     @@ -204,9 +192,7 @@ ENTRY_CFI(memcpy)
112     lpnz @.Lcopy8bytes_3
113     ;; LOOP START
114     ld.ab r6, [r1, 4]
115     - prefetch [r1, 28] ;Prefetch the next read location
116     ld.ab r8, [r1,4]
117     - prefetchw [r3, 32] ;Prefetch the next write location
118    
119     SHIFT_1 (r7, r6, 8)
120     or r7, r7, r5
121     diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
122     index b5d529fdffab..74a70f91b01a 100644
123     --- a/arch/arm/Kconfig
124     +++ b/arch/arm/Kconfig
125     @@ -1457,6 +1457,7 @@ config NR_CPUS
126     config HOTPLUG_CPU
127     bool "Support for hot-pluggable CPUs"
128     depends on SMP
129     + select GENERIC_IRQ_MIGRATION
130     help
131     Say Y here to experiment with turning CPUs off and on. CPUs
132     can be controlled through /sys/devices/system/cpu.
133     diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
134     index e53638c8ed8a..61e1d089ce1a 100644
135     --- a/arch/arm/include/asm/irq.h
136     +++ b/arch/arm/include/asm/irq.h
137     @@ -24,7 +24,6 @@
138     #ifndef __ASSEMBLY__
139     struct irqaction;
140     struct pt_regs;
141     -extern void migrate_irqs(void);
142    
143     extern void asm_do_IRQ(unsigned int, struct pt_regs *);
144     void handle_IRQ(unsigned int, struct pt_regs *);
145     diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
146     index ece04a457486..5b07c7a31c31 100644
147     --- a/arch/arm/kernel/irq.c
148     +++ b/arch/arm/kernel/irq.c
149     @@ -31,7 +31,6 @@
150     #include <linux/smp.h>
151     #include <linux/init.h>
152     #include <linux/seq_file.h>
153     -#include <linux/ratelimit.h>
154     #include <linux/errno.h>
155     #include <linux/list.h>
156     #include <linux/kallsyms.h>
157     @@ -119,64 +118,3 @@ int __init arch_probe_nr_irqs(void)
158     return nr_irqs;
159     }
160     #endif
161     -
162     -#ifdef CONFIG_HOTPLUG_CPU
163     -static bool migrate_one_irq(struct irq_desc *desc)
164     -{
165     - struct irq_data *d = irq_desc_get_irq_data(desc);
166     - const struct cpumask *affinity = irq_data_get_affinity_mask(d);
167     - struct irq_chip *c;
168     - bool ret = false;
169     -
170     - /*
171     - * If this is a per-CPU interrupt, or the affinity does not
172     - * include this CPU, then we have nothing to do.
173     - */
174     - if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity))
175     - return false;
176     -
177     - if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) {
178     - affinity = cpu_online_mask;
179     - ret = true;
180     - }
181     -
182     - c = irq_data_get_irq_chip(d);
183     - if (!c->irq_set_affinity)
184     - pr_debug("IRQ%u: unable to set affinity\n", d->irq);
185     - else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret)
186     - cpumask_copy(irq_data_get_affinity_mask(d), affinity);
187     -
188     - return ret;
189     -}
190     -
191     -/*
192     - * The current CPU has been marked offline. Migrate IRQs off this CPU.
193     - * If the affinity settings do not allow other CPUs, force them onto any
194     - * available CPU.
195     - *
196     - * Note: we must iterate over all IRQs, whether they have an attached
197     - * action structure or not, as we need to get chained interrupts too.
198     - */
199     -void migrate_irqs(void)
200     -{
201     - unsigned int i;
202     - struct irq_desc *desc;
203     - unsigned long flags;
204     -
205     - local_irq_save(flags);
206     -
207     - for_each_irq_desc(i, desc) {
208     - bool affinity_broken;
209     -
210     - raw_spin_lock(&desc->lock);
211     - affinity_broken = migrate_one_irq(desc);
212     - raw_spin_unlock(&desc->lock);
213     -
214     - if (affinity_broken)
215     - pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n",
216     - i, smp_processor_id());
217     - }
218     -
219     - local_irq_restore(flags);
220     -}
221     -#endif /* CONFIG_HOTPLUG_CPU */
222     diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
223     index 8faf869e9fb2..bc83ec7ed53f 100644
224     --- a/arch/arm/kernel/smp.c
225     +++ b/arch/arm/kernel/smp.c
226     @@ -253,7 +253,7 @@ int __cpu_disable(void)
227     /*
228     * OK - migrate IRQs away from this CPU
229     */
230     - migrate_irqs();
231     + irq_migrate_all_off_this_cpu();
232    
233     /*
234     * Flush user cache and TLB mappings, and then remove this CPU
235     diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
236     index 70b3eaf085e4..5ca7e29ad851 100644
237     --- a/arch/arm/mach-omap2/display.c
238     +++ b/arch/arm/mach-omap2/display.c
239     @@ -115,6 +115,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
240     u32 enable_mask, enable_shift;
241     u32 pipd_mask, pipd_shift;
242     u32 reg;
243     + int ret;
244    
245     if (dsi_id == 0) {
246     enable_mask = OMAP4_DSI1_LANEENABLE_MASK;
247     @@ -130,7 +131,11 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes)
248     return -ENODEV;
249     }
250    
251     - regmap_read(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, &reg);
252     + ret = regmap_read(omap4_dsi_mux_syscon,
253     + OMAP4_DSIPHY_SYSCON_OFFSET,
254     + &reg);
255     + if (ret)
256     + return ret;
257    
258     reg &= ~enable_mask;
259     reg &= ~pipd_mask;
260     diff --git a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
261     index 262ab0744748..f4fdfca9439b 100644
262     --- a/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
263     +++ b/arch/arm/mach-s3c24xx/mach-osiris-dvs.c
264     @@ -70,16 +70,16 @@ static int osiris_dvs_notify(struct notifier_block *nb,
265    
266     switch (val) {
267     case CPUFREQ_PRECHANGE:
268     - if (old_dvs & !new_dvs ||
269     - cur_dvs & !new_dvs) {
270     + if ((old_dvs && !new_dvs) ||
271     + (cur_dvs && !new_dvs)) {
272     pr_debug("%s: exiting dvs\n", __func__);
273     cur_dvs = false;
274     gpio_set_value(OSIRIS_GPIO_DVS, 1);
275     }
276     break;
277     case CPUFREQ_POSTCHANGE:
278     - if (!old_dvs & new_dvs ||
279     - !cur_dvs & new_dvs) {
280     + if ((!old_dvs && new_dvs) ||
281     + (!cur_dvs && new_dvs)) {
282     pr_debug("entering dvs\n");
283     cur_dvs = true;
284     gpio_set_value(OSIRIS_GPIO_DVS, 0);
285     diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S
286     index 3363560c79b7..7bc459d9235c 100644
287     --- a/arch/arm64/crypto/aes-ce-ccm-core.S
288     +++ b/arch/arm64/crypto/aes-ce-ccm-core.S
289     @@ -74,12 +74,13 @@ ENTRY(ce_aes_ccm_auth_data)
290     beq 10f
291     ext v0.16b, v0.16b, v0.16b, #1 /* rotate out the mac bytes */
292     b 7b
293     -8: mov w7, w8
294     +8: cbz w8, 91f
295     + mov w7, w8
296     add w8, w8, #16
297     9: ext v1.16b, v1.16b, v1.16b, #1
298     adds w7, w7, #1
299     bne 9b
300     - eor v0.16b, v0.16b, v1.16b
301     +91: eor v0.16b, v0.16b, v1.16b
302     st1 {v0.16b}, [x0]
303     10: str w8, [x3]
304     ret
305     diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
306     index 3289d1458791..db6ff1944c41 100644
307     --- a/arch/arm64/kernel/head.S
308     +++ b/arch/arm64/kernel/head.S
309     @@ -534,8 +534,7 @@ set_hcr:
310     /* GICv3 system register access */
311     mrs x0, id_aa64pfr0_el1
312     ubfx x0, x0, #24, #4
313     - cmp x0, #1
314     - b.ne 3f
315     + cbz x0, 3f
316    
317     mrs_s x0, ICC_SRE_EL2
318     orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1
319     diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
320     index f0dd9fc84002..a229d28e14cc 100644
321     --- a/arch/m68k/Makefile
322     +++ b/arch/m68k/Makefile
323     @@ -58,7 +58,10 @@ cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
324     cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
325    
326     KBUILD_AFLAGS += $(cpuflags-y)
327     -KBUILD_CFLAGS += $(cpuflags-y) -pipe
328     +KBUILD_CFLAGS += $(cpuflags-y)
329     +
330     +KBUILD_CFLAGS += -pipe -ffreestanding
331     +
332     ifdef CONFIG_MMU
333     # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
334     KBUILD_CFLAGS += -fno-strength-reduce -ffixed-a2
335     diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
336     index 3841d749a430..370645687cc7 100644
337     --- a/arch/powerpc/kernel/entry_32.S
338     +++ b/arch/powerpc/kernel/entry_32.S
339     @@ -698,6 +698,9 @@ fast_exception_return:
340     mtcr r10
341     lwz r10,_LINK(r11)
342     mtlr r10
343     + /* Clear the exception_marker on the stack to avoid confusing stacktrace */
344     + li r10, 0
345     + stw r10, 8(r11)
346     REST_GPR(10, r11)
347     mtspr SPRN_SRR1,r9
348     mtspr SPRN_SRR0,r12
349     @@ -932,6 +935,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
350     mtcrf 0xFF,r10
351     mtlr r11
352    
353     + /* Clear the exception_marker on the stack to avoid confusing stacktrace */
354     + li r10, 0
355     + stw r10, 8(r1)
356     /*
357     * Once we put values in SRR0 and SRR1, we are in a state
358     * where exceptions are not recoverable, since taking an
359     @@ -969,6 +975,9 @@ exc_exit_restart_end:
360     mtlr r11
361     lwz r10,_CCR(r1)
362     mtcrf 0xff,r10
363     + /* Clear the exception_marker on the stack to avoid confusing stacktrace */
364     + li r10, 0
365     + stw r10, 8(r1)
366     REST_2GPRS(9, r1)
367     .globl exc_exit_restart
368     exc_exit_restart:
369     diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
370     index 1c141d50fbc6..609f0e87ced7 100644
371     --- a/arch/powerpc/kernel/process.c
372     +++ b/arch/powerpc/kernel/process.c
373     @@ -153,7 +153,7 @@ void __giveup_fpu(struct task_struct *tsk)
374    
375     save_fpu(tsk);
376     msr = tsk->thread.regs->msr;
377     - msr &= ~MSR_FP;
378     + msr &= ~(MSR_FP|MSR_FE0|MSR_FE1);
379     #ifdef CONFIG_VSX
380     if (cpu_has_feature(CPU_FTR_VSX))
381     msr &= ~MSR_VSX;
382     diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
383     index adfa63e7df8c..4f2829634d79 100644
384     --- a/arch/powerpc/kernel/ptrace.c
385     +++ b/arch/powerpc/kernel/ptrace.c
386     @@ -547,6 +547,7 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,
387     /*
388     * Copy out only the low-order word of vrsave.
389     */
390     + int start, end;
391     union {
392     elf_vrreg_t reg;
393     u32 word;
394     @@ -555,8 +556,10 @@ static int vr_get(struct task_struct *target, const struct user_regset *regset,
395    
396     vrsave.word = target->thread.vrsave;
397    
398     + start = 33 * sizeof(vector128);
399     + end = start + sizeof(vrsave);
400     ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave,
401     - 33 * sizeof(vector128), -1);
402     + start, end);
403     }
404    
405     return ret;
406     @@ -594,6 +597,7 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,
407     /*
408     * We use only the first word of vrsave.
409     */
410     + int start, end;
411     union {
412     elf_vrreg_t reg;
413     u32 word;
414     @@ -602,8 +606,10 @@ static int vr_set(struct task_struct *target, const struct user_regset *regset,
415    
416     vrsave.word = target->thread.vrsave;
417    
418     + start = 33 * sizeof(vector128);
419     + end = start + sizeof(vrsave);
420     ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &vrsave,
421     - 33 * sizeof(vector128), -1);
422     + start, end);
423     if (!ret)
424     target->thread.vrsave = vrsave.word;
425     }
426     diff --git a/arch/powerpc/platforms/83xx/suspend-asm.S b/arch/powerpc/platforms/83xx/suspend-asm.S
427     index 3d1ecd211776..8137f77abad5 100644
428     --- a/arch/powerpc/platforms/83xx/suspend-asm.S
429     +++ b/arch/powerpc/platforms/83xx/suspend-asm.S
430     @@ -26,13 +26,13 @@
431     #define SS_MSR 0x74
432     #define SS_SDR1 0x78
433     #define SS_LR 0x7c
434     -#define SS_SPRG 0x80 /* 4 SPRGs */
435     -#define SS_DBAT 0x90 /* 8 DBATs */
436     -#define SS_IBAT 0xd0 /* 8 IBATs */
437     -#define SS_TB 0x110
438     -#define SS_CR 0x118
439     -#define SS_GPREG 0x11c /* r12-r31 */
440     -#define STATE_SAVE_SIZE 0x16c
441     +#define SS_SPRG 0x80 /* 8 SPRGs */
442     +#define SS_DBAT 0xa0 /* 8 DBATs */
443     +#define SS_IBAT 0xe0 /* 8 IBATs */
444     +#define SS_TB 0x120
445     +#define SS_CR 0x128
446     +#define SS_GPREG 0x12c /* r12-r31 */
447     +#define STATE_SAVE_SIZE 0x17c
448    
449     .section .data
450     .align 5
451     @@ -103,6 +103,16 @@ _GLOBAL(mpc83xx_enter_deep_sleep)
452     stw r7, SS_SPRG+12(r3)
453     stw r8, SS_SDR1(r3)
454    
455     + mfspr r4, SPRN_SPRG4
456     + mfspr r5, SPRN_SPRG5
457     + mfspr r6, SPRN_SPRG6
458     + mfspr r7, SPRN_SPRG7
459     +
460     + stw r4, SS_SPRG+16(r3)
461     + stw r5, SS_SPRG+20(r3)
462     + stw r6, SS_SPRG+24(r3)
463     + stw r7, SS_SPRG+28(r3)
464     +
465     mfspr r4, SPRN_DBAT0U
466     mfspr r5, SPRN_DBAT0L
467     mfspr r6, SPRN_DBAT1U
468     @@ -493,6 +503,16 @@ mpc83xx_deep_resume:
469     mtspr SPRN_IBAT7U, r6
470     mtspr SPRN_IBAT7L, r7
471    
472     + lwz r4, SS_SPRG+16(r3)
473     + lwz r5, SS_SPRG+20(r3)
474     + lwz r6, SS_SPRG+24(r3)
475     + lwz r7, SS_SPRG+28(r3)
476     +
477     + mtspr SPRN_SPRG4, r4
478     + mtspr SPRN_SPRG5, r5
479     + mtspr SPRN_SPRG6, r6
480     + mtspr SPRN_SPRG7, r7
481     +
482     lwz r4, SS_SPRG+0(r3)
483     lwz r5, SS_SPRG+4(r3)
484     lwz r6, SS_SPRG+8(r3)
485     diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
486     index 3fd683e40bc9..2914529c0695 100644
487     --- a/arch/powerpc/platforms/embedded6xx/wii.c
488     +++ b/arch/powerpc/platforms/embedded6xx/wii.c
489     @@ -104,6 +104,10 @@ unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
490     /* MEM2 64MB@0x10000000 */
491     delta = wii_hole_start + wii_hole_size;
492     size = top - delta;
493     +
494     + if (__map_without_bats)
495     + return delta;
496     +
497     for (bl = 128<<10; bl < max_size; bl <<= 1) {
498     if (bl * 2 > size)
499     break;
500     diff --git a/arch/powerpc/platforms/powernv/opal-msglog.c b/arch/powerpc/platforms/powernv/opal-msglog.c
501     index 39d6ff9e5630..d10bad14097b 100644
502     --- a/arch/powerpc/platforms/powernv/opal-msglog.c
503     +++ b/arch/powerpc/platforms/powernv/opal-msglog.c
504     @@ -98,7 +98,7 @@ static ssize_t opal_msglog_read(struct file *file, struct kobject *kobj,
505     }
506    
507     static struct bin_attribute opal_msglog_attr = {
508     - .attr = {.name = "msglog", .mode = 0444},
509     + .attr = {.name = "msglog", .mode = 0400},
510     .read = opal_msglog_read
511     };
512    
513     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
514     index 1870fa7387b7..a34fb7284024 100644
515     --- a/arch/x86/kvm/vmx.c
516     +++ b/arch/x86/kvm/vmx.c
517     @@ -5965,6 +5965,7 @@ static int handle_external_interrupt(struct kvm_vcpu *vcpu)
518     static int handle_triple_fault(struct kvm_vcpu *vcpu)
519     {
520     vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
521     + vcpu->mmio_needed = 0;
522     return 0;
523     }
524    
525     @@ -7046,6 +7047,10 @@ static int get_vmx_mem_address(struct kvm_vcpu *vcpu,
526     /* Addr = segment_base + offset */
527     /* offset = base + [index * scale] + displacement */
528     off = exit_qualification; /* holds the displacement */
529     + if (addr_size == 1)
530     + off = (gva_t)sign_extend64(off, 31);
531     + else if (addr_size == 0)
532     + off = (gva_t)sign_extend64(off, 15);
533     if (base_is_valid)
534     off += kvm_register_read(vcpu, base_reg);
535     if (index_is_valid)
536     @@ -7088,10 +7093,16 @@ static int get_vmx_mem_address(struct kvm_vcpu *vcpu,
537     /* Protected mode: #GP(0)/#SS(0) if the segment is unusable.
538     */
539     exn = (s.unusable != 0);
540     - /* Protected mode: #GP(0)/#SS(0) if the memory
541     - * operand is outside the segment limit.
542     +
543     + /*
544     + * Protected mode: #GP(0)/#SS(0) if the memory operand is
545     + * outside the segment limit. All CPUs that support VMX ignore
546     + * limit checks for flat segments, i.e. segments with base==0,
547     + * limit==0xffffffff and of type expand-up data or code.
548     */
549     - exn = exn || (off + sizeof(u64) > s.limit);
550     + if (!(s.base == 0 && s.limit == 0xffffffff &&
551     + ((s.type & 8) || !(s.type & 4))))
552     + exn = exn || (off + sizeof(u64) > s.limit);
553     }
554     if (exn) {
555     kvm_queue_exception_e(vcpu,
556     diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
557     index 5a35fee46620..a29df9ccbfde 100644
558     --- a/arch/x86/kvm/x86.c
559     +++ b/arch/x86/kvm/x86.c
560     @@ -6769,6 +6769,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
561     }
562     if (kvm_check_request(KVM_REQ_TRIPLE_FAULT, vcpu)) {
563     vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
564     + vcpu->mmio_needed = 0;
565     r = 0;
566     goto out;
567     }
568     diff --git a/crypto/ahash.c b/crypto/ahash.c
569     index 90d73a22f129..9a4e87755a0b 100644
570     --- a/crypto/ahash.c
571     +++ b/crypto/ahash.c
572     @@ -85,17 +85,17 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
573     int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
574     {
575     unsigned int alignmask = walk->alignmask;
576     - unsigned int nbytes = walk->entrylen;
577    
578     walk->data -= walk->offset;
579    
580     - if (nbytes && walk->offset & alignmask && !err) {
581     - walk->offset = ALIGN(walk->offset, alignmask + 1);
582     - nbytes = min(nbytes,
583     - ((unsigned int)(PAGE_SIZE)) - walk->offset);
584     - walk->entrylen -= nbytes;
585     + if (walk->entrylen && (walk->offset & alignmask) && !err) {
586     + unsigned int nbytes;
587    
588     + walk->offset = ALIGN(walk->offset, alignmask + 1);
589     + nbytes = min(walk->entrylen,
590     + (unsigned int)(PAGE_SIZE - walk->offset));
591     if (nbytes) {
592     + walk->entrylen -= nbytes;
593     walk->data += walk->offset;
594     return nbytes;
595     }
596     @@ -115,7 +115,7 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
597     if (err)
598     return err;
599    
600     - if (nbytes) {
601     + if (walk->entrylen) {
602     walk->offset = 0;
603     walk->pg++;
604     return hash_walk_next(walk);
605     @@ -189,6 +189,21 @@ static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key,
606     return ret;
607     }
608    
609     +static int ahash_nosetkey(struct crypto_ahash *tfm, const u8 *key,
610     + unsigned int keylen)
611     +{
612     + return -ENOSYS;
613     +}
614     +
615     +static void ahash_set_needkey(struct crypto_ahash *tfm)
616     +{
617     + const struct hash_alg_common *alg = crypto_hash_alg_common(tfm);
618     +
619     + if (tfm->setkey != ahash_nosetkey &&
620     + !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
621     + crypto_ahash_set_flags(tfm, CRYPTO_TFM_NEED_KEY);
622     +}
623     +
624     int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
625     unsigned int keylen)
626     {
627     @@ -200,20 +215,16 @@ int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key,
628     else
629     err = tfm->setkey(tfm, key, keylen);
630    
631     - if (err)
632     + if (unlikely(err)) {
633     + ahash_set_needkey(tfm);
634     return err;
635     + }
636    
637     crypto_ahash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
638     return 0;
639     }
640     EXPORT_SYMBOL_GPL(crypto_ahash_setkey);
641    
642     -static int ahash_nosetkey(struct crypto_ahash *tfm, const u8 *key,
643     - unsigned int keylen)
644     -{
645     - return -ENOSYS;
646     -}
647     -
648     static inline unsigned int ahash_align_buffer_size(unsigned len,
649     unsigned long mask)
650     {
651     @@ -482,8 +493,7 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm)
652    
653     if (alg->setkey) {
654     hash->setkey = alg->setkey;
655     - if (!(alg->halg.base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
656     - crypto_ahash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
657     + ahash_set_needkey(hash);
658     }
659     if (alg->export)
660     hash->export = alg->export;
661     diff --git a/crypto/pcbc.c b/crypto/pcbc.c
662     index f654965f0933..de81f716cf26 100644
663     --- a/crypto/pcbc.c
664     +++ b/crypto/pcbc.c
665     @@ -52,7 +52,7 @@ static int crypto_pcbc_encrypt_segment(struct blkcipher_desc *desc,
666     unsigned int nbytes = walk->nbytes;
667     u8 *src = walk->src.virt.addr;
668     u8 *dst = walk->dst.virt.addr;
669     - u8 *iv = walk->iv;
670     + u8 * const iv = walk->iv;
671    
672     do {
673     crypto_xor(iv, src, bsize);
674     @@ -76,7 +76,7 @@ static int crypto_pcbc_encrypt_inplace(struct blkcipher_desc *desc,
675     int bsize = crypto_cipher_blocksize(tfm);
676     unsigned int nbytes = walk->nbytes;
677     u8 *src = walk->src.virt.addr;
678     - u8 *iv = walk->iv;
679     + u8 * const iv = walk->iv;
680     u8 tmpbuf[bsize];
681    
682     do {
683     @@ -89,8 +89,6 @@ static int crypto_pcbc_encrypt_inplace(struct blkcipher_desc *desc,
684     src += bsize;
685     } while ((nbytes -= bsize) >= bsize);
686    
687     - memcpy(walk->iv, iv, bsize);
688     -
689     return nbytes;
690     }
691    
692     @@ -130,7 +128,7 @@ static int crypto_pcbc_decrypt_segment(struct blkcipher_desc *desc,
693     unsigned int nbytes = walk->nbytes;
694     u8 *src = walk->src.virt.addr;
695     u8 *dst = walk->dst.virt.addr;
696     - u8 *iv = walk->iv;
697     + u8 * const iv = walk->iv;
698    
699     do {
700     fn(crypto_cipher_tfm(tfm), dst, src);
701     @@ -142,8 +140,6 @@ static int crypto_pcbc_decrypt_segment(struct blkcipher_desc *desc,
702     dst += bsize;
703     } while ((nbytes -= bsize) >= bsize);
704    
705     - memcpy(walk->iv, iv, bsize);
706     -
707     return nbytes;
708     }
709    
710     @@ -156,7 +152,7 @@ static int crypto_pcbc_decrypt_inplace(struct blkcipher_desc *desc,
711     int bsize = crypto_cipher_blocksize(tfm);
712     unsigned int nbytes = walk->nbytes;
713     u8 *src = walk->src.virt.addr;
714     - u8 *iv = walk->iv;
715     + u8 * const iv = walk->iv;
716     u8 tmpbuf[bsize];
717    
718     do {
719     @@ -169,8 +165,6 @@ static int crypto_pcbc_decrypt_inplace(struct blkcipher_desc *desc,
720     src += bsize;
721     } while ((nbytes -= bsize) >= bsize);
722    
723     - memcpy(walk->iv, iv, bsize);
724     -
725     return nbytes;
726     }
727    
728     diff --git a/crypto/shash.c b/crypto/shash.c
729     index 4f047c7eeca7..a1c7609578ea 100644
730     --- a/crypto/shash.c
731     +++ b/crypto/shash.c
732     @@ -52,6 +52,13 @@ static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
733     return err;
734     }
735    
736     +static void shash_set_needkey(struct crypto_shash *tfm, struct shash_alg *alg)
737     +{
738     + if (crypto_shash_alg_has_setkey(alg) &&
739     + !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
740     + crypto_shash_set_flags(tfm, CRYPTO_TFM_NEED_KEY);
741     +}
742     +
743     int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
744     unsigned int keylen)
745     {
746     @@ -64,8 +71,10 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
747     else
748     err = shash->setkey(tfm, key, keylen);
749    
750     - if (err)
751     + if (unlikely(err)) {
752     + shash_set_needkey(tfm, shash);
753     return err;
754     + }
755    
756     crypto_shash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
757     return 0;
758     @@ -367,7 +376,8 @@ int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
759     crt->final = shash_async_final;
760     crt->finup = shash_async_finup;
761     crt->digest = shash_async_digest;
762     - crt->setkey = shash_async_setkey;
763     + if (crypto_shash_alg_has_setkey(alg))
764     + crt->setkey = shash_async_setkey;
765    
766     crypto_ahash_set_flags(crt, crypto_shash_get_flags(shash) &
767     CRYPTO_TFM_NEED_KEY);
768     @@ -389,9 +399,7 @@ static int crypto_shash_init_tfm(struct crypto_tfm *tfm)
769    
770     hash->descsize = alg->descsize;
771    
772     - if (crypto_shash_alg_has_setkey(alg) &&
773     - !(alg->base.cra_flags & CRYPTO_ALG_OPTIONAL_KEY))
774     - crypto_shash_set_flags(hash, CRYPTO_TFM_NEED_KEY);
775     + shash_set_needkey(hash, alg);
776    
777     return 0;
778     }
779     diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
780     index 201c7ceb7052..98b513d049f6 100644
781     --- a/drivers/acpi/device_sysfs.c
782     +++ b/drivers/acpi/device_sysfs.c
783     @@ -202,11 +202,15 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
784     {
785     struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER };
786     const union acpi_object *of_compatible, *obj;
787     + acpi_status status;
788     int len, count;
789     int i, nval;
790     char *c;
791    
792     - acpi_get_name(acpi_dev->handle, ACPI_SINGLE_NAME, &buf);
793     + status = acpi_get_name(acpi_dev->handle, ACPI_SINGLE_NAME, &buf);
794     + if (ACPI_FAILURE(status))
795     + return -ENODEV;
796     +
797     /* DT strings are all in lower case */
798     for (c = buf.pointer; *c != '\0'; c++)
799     *c = tolower(*c);
800     diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
801     index 06cf7427d0c4..31a07609f7a2 100644
802     --- a/drivers/acpi/nfit/core.c
803     +++ b/drivers/acpi/nfit/core.c
804     @@ -307,6 +307,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
805     return -EINVAL;
806     }
807    
808     + if (out_obj->type != ACPI_TYPE_BUFFER) {
809     + dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n",
810     + dimm_name, cmd_name, out_obj->type);
811     + rc = -EINVAL;
812     + goto out;
813     + }
814     +
815     if (call_pkg) {
816     call_pkg->nd_fw_size = out_obj->buffer.length;
817     memcpy(call_pkg->nd_payload + call_pkg->nd_size_in,
818     @@ -325,13 +332,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm,
819     return 0;
820     }
821    
822     - if (out_obj->package.type != ACPI_TYPE_BUFFER) {
823     - dev_dbg(dev, "%s:%s unexpected output object type cmd: %s type: %d\n",
824     - __func__, dimm_name, cmd_name, out_obj->type);
825     - rc = -EINVAL;
826     - goto out;
827     - }
828     -
829     if (IS_ENABLED(CONFIG_ACPI_NFIT_DEBUG)) {
830     dev_dbg(dev, "%s:%s cmd: %s output length: %d\n", __func__,
831     dimm_name, cmd_name, out_obj->buffer.length);
832     diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
833     index f98121f11f7c..9f51a167bf4e 100644
834     --- a/drivers/base/power/wakeup.c
835     +++ b/drivers/base/power/wakeup.c
836     @@ -113,7 +113,6 @@ void wakeup_source_drop(struct wakeup_source *ws)
837     if (!ws)
838     return;
839    
840     - del_timer_sync(&ws->timer);
841     __pm_relax(ws);
842     }
843     EXPORT_SYMBOL_GPL(wakeup_source_drop);
844     @@ -201,6 +200,13 @@ void wakeup_source_remove(struct wakeup_source *ws)
845     list_del_rcu(&ws->entry);
846     spin_unlock_irqrestore(&events_lock, flags);
847     synchronize_srcu(&wakeup_srcu);
848     +
849     + del_timer_sync(&ws->timer);
850     + /*
851     + * Clear timer.function to make wakeup_source_not_registered() treat
852     + * this wakeup source as not registered.
853     + */
854     + ws->timer.function = NULL;
855     }
856     EXPORT_SYMBOL_GPL(wakeup_source_remove);
857    
858     diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
859     index 326b9ba4518e..6914c6e1e1a8 100644
860     --- a/drivers/block/floppy.c
861     +++ b/drivers/block/floppy.c
862     @@ -3752,7 +3752,7 @@ static unsigned int floppy_check_events(struct gendisk *disk,
863    
864     if (time_after(jiffies, UDRS->last_checked + UDP->checkfreq)) {
865     if (lock_fdc(drive))
866     - return -EINTR;
867     + return 0;
868     poll_drive(false, 0);
869     process_fd_request();
870     }
871     diff --git a/drivers/clk/clk-twl6040.c b/drivers/clk/clk-twl6040.c
872     index 7b222a5db931..82d615fe2947 100644
873     --- a/drivers/clk/clk-twl6040.c
874     +++ b/drivers/clk/clk-twl6040.c
875     @@ -41,6 +41,43 @@ static int twl6040_pdmclk_is_prepared(struct clk_hw *hw)
876     return pdmclk->enabled;
877     }
878    
879     +static int twl6040_pdmclk_reset_one_clock(struct twl6040_pdmclk *pdmclk,
880     + unsigned int reg)
881     +{
882     + const u8 reset_mask = TWL6040_HPLLRST; /* Same for HPPLL and LPPLL */
883     + int ret;
884     +
885     + ret = twl6040_set_bits(pdmclk->twl6040, reg, reset_mask);
886     + if (ret < 0)
887     + return ret;
888     +
889     + ret = twl6040_clear_bits(pdmclk->twl6040, reg, reset_mask);
890     + if (ret < 0)
891     + return ret;
892     +
893     + return 0;
894     +}
895     +
896     +/*
897     + * TWL6040A2 Phoenix Audio IC erratum #6: "PDM Clock Generation Issue At
898     + * Cold Temperature". This affects cold boot and deeper idle states it
899     + * seems. The workaround consists of resetting HPPLL and LPPLL.
900     + */
901     +static int twl6040_pdmclk_quirk_reset_clocks(struct twl6040_pdmclk *pdmclk)
902     +{
903     + int ret;
904     +
905     + ret = twl6040_pdmclk_reset_one_clock(pdmclk, TWL6040_REG_HPPLLCTL);
906     + if (ret)
907     + return ret;
908     +
909     + ret = twl6040_pdmclk_reset_one_clock(pdmclk, TWL6040_REG_LPPLLCTL);
910     + if (ret)
911     + return ret;
912     +
913     + return 0;
914     +}
915     +
916     static int twl6040_pdmclk_prepare(struct clk_hw *hw)
917     {
918     struct twl6040_pdmclk *pdmclk = container_of(hw, struct twl6040_pdmclk,
919     @@ -48,8 +85,20 @@ static int twl6040_pdmclk_prepare(struct clk_hw *hw)
920     int ret;
921    
922     ret = twl6040_power(pdmclk->twl6040, 1);
923     - if (!ret)
924     - pdmclk->enabled = 1;
925     + if (ret)
926     + return ret;
927     +
928     + ret = twl6040_pdmclk_quirk_reset_clocks(pdmclk);
929     + if (ret)
930     + goto out_err;
931     +
932     + pdmclk->enabled = 1;
933     +
934     + return 0;
935     +
936     +out_err:
937     + dev_err(pdmclk->dev, "%s: error %i\n", __func__, ret);
938     + twl6040_power(pdmclk->twl6040, 0);
939    
940     return ret;
941     }
942     diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
943     index e8248f9185f7..4dec9e9ccffe 100644
944     --- a/drivers/clk/ingenic/cgu.c
945     +++ b/drivers/clk/ingenic/cgu.c
946     @@ -364,16 +364,16 @@ ingenic_clk_round_rate(struct clk_hw *hw, unsigned long req_rate,
947     struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw);
948     struct ingenic_cgu *cgu = ingenic_clk->cgu;
949     const struct ingenic_cgu_clk_info *clk_info;
950     - long rate = *parent_rate;
951     + unsigned int div = 1;
952    
953     clk_info = &cgu->clock_info[ingenic_clk->idx];
954    
955     if (clk_info->type & CGU_CLK_DIV)
956     - rate /= ingenic_clk_calc_div(clk_info, *parent_rate, req_rate);
957     + div = ingenic_clk_calc_div(clk_info, *parent_rate, req_rate);
958     else if (clk_info->type & CGU_CLK_FIXDIV)
959     - rate /= clk_info->fixdiv.div;
960     + div = clk_info->fixdiv.div;
961    
962     - return rate;
963     + return DIV_ROUND_UP(*parent_rate, div);
964     }
965    
966     static int
967     @@ -393,7 +393,7 @@ ingenic_clk_set_rate(struct clk_hw *hw, unsigned long req_rate,
968    
969     if (clk_info->type & CGU_CLK_DIV) {
970     div = ingenic_clk_calc_div(clk_info, parent_rate, req_rate);
971     - rate = parent_rate / div;
972     + rate = DIV_ROUND_UP(parent_rate, div);
973    
974     if (rate != req_rate)
975     return -EINVAL;
976     diff --git a/drivers/clk/ingenic/cgu.h b/drivers/clk/ingenic/cgu.h
977     index 09700b2c555d..a22f654b2900 100644
978     --- a/drivers/clk/ingenic/cgu.h
979     +++ b/drivers/clk/ingenic/cgu.h
980     @@ -78,7 +78,7 @@ struct ingenic_cgu_mux_info {
981     * @reg: offset of the divider control register within the CGU
982     * @shift: number of bits to left shift the divide value by (ie. the index of
983     * the lowest bit of the divide value within its control register)
984     - * @div: number of bits to divide the divider value by (i.e. if the
985     + * @div: number to divide the divider value by (i.e. if the
986     * effective divider value is the value written to the register
987     * multiplied by some constant)
988     * @bits: the size of the divide value in bits
989     diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
990     index 6ea5401e6881..7f1281298651 100644
991     --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
992     +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
993     @@ -252,9 +252,9 @@ static SUNXI_CCU_GATE(ahb1_mmc1_clk, "ahb1-mmc1", "ahb1",
994     static SUNXI_CCU_GATE(ahb1_mmc2_clk, "ahb1-mmc2", "ahb1",
995     0x060, BIT(10), 0);
996     static SUNXI_CCU_GATE(ahb1_mmc3_clk, "ahb1-mmc3", "ahb1",
997     - 0x060, BIT(12), 0);
998     + 0x060, BIT(11), 0);
999     static SUNXI_CCU_GATE(ahb1_nand1_clk, "ahb1-nand1", "ahb1",
1000     - 0x060, BIT(13), 0);
1001     + 0x060, BIT(12), 0);
1002     static SUNXI_CCU_GATE(ahb1_nand0_clk, "ahb1-nand0", "ahb1",
1003     0x060, BIT(13), 0);
1004     static SUNXI_CCU_GATE(ahb1_sdram_clk, "ahb1-sdram", "ahb1",
1005     diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
1006     index 7f6fed9f0703..fb0cf8b74516 100644
1007     --- a/drivers/clocksource/exynos_mct.c
1008     +++ b/drivers/clocksource/exynos_mct.c
1009     @@ -388,6 +388,13 @@ static void exynos4_mct_tick_start(unsigned long cycles,
1010     exynos4_mct_write(tmp, mevt->base + MCT_L_TCON_OFFSET);
1011     }
1012    
1013     +static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt)
1014     +{
1015     + /* Clear the MCT tick interrupt */
1016     + if (readl_relaxed(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1)
1017     + exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
1018     +}
1019     +
1020     static int exynos4_tick_set_next_event(unsigned long cycles,
1021     struct clock_event_device *evt)
1022     {
1023     @@ -404,6 +411,7 @@ static int set_state_shutdown(struct clock_event_device *evt)
1024    
1025     mevt = container_of(evt, struct mct_clock_event_device, evt);
1026     exynos4_mct_tick_stop(mevt);
1027     + exynos4_mct_tick_clear(mevt);
1028     return 0;
1029     }
1030    
1031     @@ -420,8 +428,11 @@ static int set_state_periodic(struct clock_event_device *evt)
1032     return 0;
1033     }
1034    
1035     -static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt)
1036     +static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
1037     {
1038     + struct mct_clock_event_device *mevt = dev_id;
1039     + struct clock_event_device *evt = &mevt->evt;
1040     +
1041     /*
1042     * This is for supporting oneshot mode.
1043     * Mct would generate interrupt periodically
1044     @@ -430,16 +441,6 @@ static void exynos4_mct_tick_clear(struct mct_clock_event_device *mevt)
1045     if (!clockevent_state_periodic(&mevt->evt))
1046     exynos4_mct_tick_stop(mevt);
1047    
1048     - /* Clear the MCT tick interrupt */
1049     - if (readl_relaxed(reg_base + mevt->base + MCT_L_INT_CSTAT_OFFSET) & 1)
1050     - exynos4_mct_write(0x1, mevt->base + MCT_L_INT_CSTAT_OFFSET);
1051     -}
1052     -
1053     -static irqreturn_t exynos4_mct_tick_isr(int irq, void *dev_id)
1054     -{
1055     - struct mct_clock_event_device *mevt = dev_id;
1056     - struct clock_event_device *evt = &mevt->evt;
1057     -
1058     exynos4_mct_tick_clear(mevt);
1059    
1060     evt->event_handler(evt);
1061     diff --git a/drivers/cpufreq/pxa2xx-cpufreq.c b/drivers/cpufreq/pxa2xx-cpufreq.c
1062     index ce345bf34d5d..a24e9f037865 100644
1063     --- a/drivers/cpufreq/pxa2xx-cpufreq.c
1064     +++ b/drivers/cpufreq/pxa2xx-cpufreq.c
1065     @@ -192,7 +192,7 @@ static int pxa_cpufreq_change_voltage(const struct pxa_freqs *pxa_freq)
1066     return ret;
1067     }
1068    
1069     -static void __init pxa_cpufreq_init_voltages(void)
1070     +static void pxa_cpufreq_init_voltages(void)
1071     {
1072     vcc_core = regulator_get(NULL, "vcc_core");
1073     if (IS_ERR(vcc_core)) {
1074     @@ -208,7 +208,7 @@ static int pxa_cpufreq_change_voltage(const struct pxa_freqs *pxa_freq)
1075     return 0;
1076     }
1077    
1078     -static void __init pxa_cpufreq_init_voltages(void) { }
1079     +static void pxa_cpufreq_init_voltages(void) { }
1080     #endif
1081    
1082     static void find_freq_tables(struct cpufreq_frequency_table **freq_table,
1083     diff --git a/drivers/cpufreq/tegra124-cpufreq.c b/drivers/cpufreq/tegra124-cpufreq.c
1084     index 43530254201a..4bb154f6c54c 100644
1085     --- a/drivers/cpufreq/tegra124-cpufreq.c
1086     +++ b/drivers/cpufreq/tegra124-cpufreq.c
1087     @@ -134,6 +134,8 @@ static int tegra124_cpufreq_probe(struct platform_device *pdev)
1088    
1089     platform_set_drvdata(pdev, priv);
1090    
1091     + of_node_put(np);
1092     +
1093     return 0;
1094    
1095     out_switch_to_pllx:
1096     diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
1097     index 0d743c634f25..88caca3370f2 100644
1098     --- a/drivers/crypto/caam/caamalg.c
1099     +++ b/drivers/crypto/caam/caamalg.c
1100     @@ -2131,6 +2131,7 @@ static void init_aead_job(struct aead_request *req,
1101     if (unlikely(req->src != req->dst)) {
1102     if (!edesc->dst_nents) {
1103     dst_dma = sg_dma_address(req->dst);
1104     + out_options = 0;
1105     } else {
1106     dst_dma = edesc->sec4_sg_dma +
1107     sec4_sg_index *
1108     diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
1109     index 6509031098d5..26c4befcd234 100644
1110     --- a/drivers/gpu/drm/i915/i915_gem.c
1111     +++ b/drivers/gpu/drm/i915/i915_gem.c
1112     @@ -1600,7 +1600,8 @@ __vma_matches(struct vm_area_struct *vma, struct file *filp,
1113     if (vma->vm_file != filp)
1114     return false;
1115    
1116     - return vma->vm_start == addr && (vma->vm_end - vma->vm_start) == size;
1117     + return vma->vm_start == addr &&
1118     + (vma->vm_end - vma->vm_start) == PAGE_ALIGN(size);
1119     }
1120    
1121     /**
1122     diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
1123     index d960d3915408..f09388e00523 100644
1124     --- a/drivers/gpu/drm/radeon/evergreen_cs.c
1125     +++ b/drivers/gpu/drm/radeon/evergreen_cs.c
1126     @@ -1299,6 +1299,7 @@ static int evergreen_cs_handle_reg(struct radeon_cs_parser *p, u32 reg, u32 idx)
1127     return -EINVAL;
1128     }
1129     ib[idx] += (u32)((reloc->gpu_offset >> 8) & 0xffffffff);
1130     + break;
1131     case CB_TARGET_MASK:
1132     track->cb_target_mask = radeon_get_ib_value(p, idx);
1133     track->cb_dirty = true;
1134     diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
1135     index 99c813a4ec1f..57d22bc963b5 100644
1136     --- a/drivers/gpu/ipu-v3/ipu-common.c
1137     +++ b/drivers/gpu/ipu-v3/ipu-common.c
1138     @@ -884,8 +884,8 @@ static struct ipu_devtype ipu_type_imx51 = {
1139     .cpmem_ofs = 0x1f000000,
1140     .srm_ofs = 0x1f040000,
1141     .tpm_ofs = 0x1f060000,
1142     - .csi0_ofs = 0x1f030000,
1143     - .csi1_ofs = 0x1f038000,
1144     + .csi0_ofs = 0x1e030000,
1145     + .csi1_ofs = 0x1e038000,
1146     .ic_ofs = 0x1e020000,
1147     .disp0_ofs = 0x1e040000,
1148     .disp1_ofs = 0x1e048000,
1149     @@ -900,8 +900,8 @@ static struct ipu_devtype ipu_type_imx53 = {
1150     .cpmem_ofs = 0x07000000,
1151     .srm_ofs = 0x07040000,
1152     .tpm_ofs = 0x07060000,
1153     - .csi0_ofs = 0x07030000,
1154     - .csi1_ofs = 0x07038000,
1155     + .csi0_ofs = 0x06030000,
1156     + .csi1_ofs = 0x06038000,
1157     .ic_ofs = 0x06020000,
1158     .disp0_ofs = 0x06040000,
1159     .disp1_ofs = 0x06048000,
1160     diff --git a/drivers/hwtracing/intel_th/gth.c b/drivers/hwtracing/intel_th/gth.c
1161     index 33e09369a491..b0502e2782c1 100644
1162     --- a/drivers/hwtracing/intel_th/gth.c
1163     +++ b/drivers/hwtracing/intel_th/gth.c
1164     @@ -599,11 +599,15 @@ static void intel_th_gth_unassign(struct intel_th_device *thdev,
1165     {
1166     struct gth_device *gth = dev_get_drvdata(&thdev->dev);
1167     int port = othdev->output.port;
1168     + int master;
1169    
1170     spin_lock(&gth->gth_lock);
1171     othdev->output.port = -1;
1172     othdev->output.active = false;
1173     gth->output[port].output = NULL;
1174     + for (master = 0; master < TH_CONFIGURABLE_MASTERS; master++)
1175     + if (gth->master[master] == port)
1176     + gth->master[master] = -1;
1177     spin_unlock(&gth->gth_lock);
1178     }
1179    
1180     diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
1181     index c38645106783..3c45c1c15f7e 100644
1182     --- a/drivers/hwtracing/stm/core.c
1183     +++ b/drivers/hwtracing/stm/core.c
1184     @@ -252,6 +252,9 @@ static int find_free_channels(unsigned long *bitmap, unsigned int start,
1185     ;
1186     if (i == width)
1187     return pos;
1188     +
1189     + /* step over [pos..pos+i) to continue search */
1190     + pos += i;
1191     }
1192    
1193     return -1;
1194     @@ -558,7 +561,7 @@ static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg)
1195     {
1196     struct stm_device *stm = stmf->stm;
1197     struct stp_policy_id *id;
1198     - int ret = -EINVAL;
1199     + int ret = -EINVAL, wlimit = 1;
1200     u32 size;
1201    
1202     if (stmf->output.nr_chans)
1203     @@ -586,8 +589,10 @@ static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg)
1204     if (id->__reserved_0 || id->__reserved_1)
1205     goto err_free;
1206    
1207     - if (id->width < 1 ||
1208     - id->width > PAGE_SIZE / stm->data->sw_mmiosz)
1209     + if (stm->data->sw_mmiosz)
1210     + wlimit = PAGE_SIZE / stm->data->sw_mmiosz;
1211     +
1212     + if (id->width < 1 || id->width > wlimit)
1213     goto err_free;
1214    
1215     ret = stm_file_assign(stmf, id->id, id->width);
1216     diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
1217     index 45d6771fac8c..59c08d5b75d6 100644
1218     --- a/drivers/i2c/busses/i2c-cadence.c
1219     +++ b/drivers/i2c/busses/i2c-cadence.c
1220     @@ -382,8 +382,10 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
1221     * Check for the message size against FIFO depth and set the
1222     * 'hold bus' bit if it is greater than FIFO depth.
1223     */
1224     - if (id->recv_count > CDNS_I2C_FIFO_DEPTH)
1225     + if ((id->recv_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
1226     ctrl_reg |= CDNS_I2C_CR_HOLD;
1227     + else
1228     + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
1229    
1230     cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
1231    
1232     @@ -440,8 +442,11 @@ static void cdns_i2c_msend(struct cdns_i2c *id)
1233     * Check for the message size against FIFO depth and set the
1234     * 'hold bus' bit if it is greater than FIFO depth.
1235     */
1236     - if (id->send_count > CDNS_I2C_FIFO_DEPTH)
1237     + if ((id->send_count > CDNS_I2C_FIFO_DEPTH) || id->bus_hold_flag)
1238     ctrl_reg |= CDNS_I2C_CR_HOLD;
1239     + else
1240     + ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
1241     +
1242     cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
1243    
1244     /* Clear the interrupts in interrupt status register. */
1245     diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
1246     index 586e557e113a..36100f453f31 100644
1247     --- a/drivers/i2c/busses/i2c-tegra.c
1248     +++ b/drivers/i2c/busses/i2c-tegra.c
1249     @@ -794,7 +794,7 @@ static const struct i2c_algorithm tegra_i2c_algo = {
1250     /* payload size is only 12 bit */
1251     static struct i2c_adapter_quirks tegra_i2c_quirks = {
1252     .max_read_len = 4096,
1253     - .max_write_len = 4096,
1254     + .max_write_len = 4096 - 12,
1255     };
1256    
1257     static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
1258     diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
1259     index c15756d7bf7f..eb8b735ca12b 100644
1260     --- a/drivers/iio/adc/exynos_adc.c
1261     +++ b/drivers/iio/adc/exynos_adc.c
1262     @@ -916,7 +916,7 @@ static int exynos_adc_remove(struct platform_device *pdev)
1263     struct iio_dev *indio_dev = platform_get_drvdata(pdev);
1264     struct exynos_adc *info = iio_priv(indio_dev);
1265    
1266     - if (IS_REACHABLE(CONFIG_INPUT)) {
1267     + if (IS_REACHABLE(CONFIG_INPUT) && info->input) {
1268     free_irq(info->tsirq, info);
1269     input_unregister_device(info->input);
1270     }
1271     diff --git a/drivers/input/keyboard/cap11xx.c b/drivers/input/keyboard/cap11xx.c
1272     index 4401be225d64..3c53aa5d5c0c 100644
1273     --- a/drivers/input/keyboard/cap11xx.c
1274     +++ b/drivers/input/keyboard/cap11xx.c
1275     @@ -75,9 +75,7 @@
1276     struct cap11xx_led {
1277     struct cap11xx_priv *priv;
1278     struct led_classdev cdev;
1279     - struct work_struct work;
1280     u32 reg;
1281     - enum led_brightness new_brightness;
1282     };
1283     #endif
1284    
1285     @@ -233,30 +231,21 @@ static void cap11xx_input_close(struct input_dev *idev)
1286     }
1287    
1288     #ifdef CONFIG_LEDS_CLASS
1289     -static void cap11xx_led_work(struct work_struct *work)
1290     +static int cap11xx_led_set(struct led_classdev *cdev,
1291     + enum led_brightness value)
1292     {
1293     - struct cap11xx_led *led = container_of(work, struct cap11xx_led, work);
1294     + struct cap11xx_led *led = container_of(cdev, struct cap11xx_led, cdev);
1295     struct cap11xx_priv *priv = led->priv;
1296     - int value = led->new_brightness;
1297    
1298     /*
1299     - * All LEDs share the same duty cycle as this is a HW limitation.
1300     - * Brightness levels per LED are either 0 (OFF) and 1 (ON).
1301     + * All LEDs share the same duty cycle as this is a HW
1302     + * limitation. Brightness levels per LED are either
1303     + * 0 (OFF) and 1 (ON).
1304     */
1305     - regmap_update_bits(priv->regmap, CAP11XX_REG_LED_OUTPUT_CONTROL,
1306     - BIT(led->reg), value ? BIT(led->reg) : 0);
1307     -}
1308     -
1309     -static void cap11xx_led_set(struct led_classdev *cdev,
1310     - enum led_brightness value)
1311     -{
1312     - struct cap11xx_led *led = container_of(cdev, struct cap11xx_led, cdev);
1313     -
1314     - if (led->new_brightness == value)
1315     - return;
1316     -
1317     - led->new_brightness = value;
1318     - schedule_work(&led->work);
1319     + return regmap_update_bits(priv->regmap,
1320     + CAP11XX_REG_LED_OUTPUT_CONTROL,
1321     + BIT(led->reg),
1322     + value ? BIT(led->reg) : 0);
1323     }
1324    
1325     static int cap11xx_init_leds(struct device *dev,
1326     @@ -299,7 +288,7 @@ static int cap11xx_init_leds(struct device *dev,
1327     led->cdev.default_trigger =
1328     of_get_property(child, "linux,default-trigger", NULL);
1329     led->cdev.flags = 0;
1330     - led->cdev.brightness_set = cap11xx_led_set;
1331     + led->cdev.brightness_set_blocking = cap11xx_led_set;
1332     led->cdev.max_brightness = 1;
1333     led->cdev.brightness = LED_OFF;
1334    
1335     @@ -312,8 +301,6 @@ static int cap11xx_init_leds(struct device *dev,
1336     led->reg = reg;
1337     led->priv = priv;
1338    
1339     - INIT_WORK(&led->work, cap11xx_led_work);
1340     -
1341     error = devm_led_classdev_register(dev, &led->cdev);
1342     if (error) {
1343     of_node_put(child);
1344     diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
1345     index c64d87442a62..2e12e31f45c5 100644
1346     --- a/drivers/input/keyboard/matrix_keypad.c
1347     +++ b/drivers/input/keyboard/matrix_keypad.c
1348     @@ -220,7 +220,7 @@ static void matrix_keypad_stop(struct input_dev *dev)
1349     keypad->stopped = true;
1350     spin_unlock_irq(&keypad->lock);
1351    
1352     - flush_work(&keypad->work.work);
1353     + flush_delayed_work(&keypad->work);
1354     /*
1355     * matrix_keypad_scan() will leave IRQs enabled;
1356     * we should disable them now.
1357     diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
1358     index de7be4f03d91..ebf9f643d910 100644
1359     --- a/drivers/input/keyboard/st-keyscan.c
1360     +++ b/drivers/input/keyboard/st-keyscan.c
1361     @@ -153,6 +153,8 @@ static int keyscan_probe(struct platform_device *pdev)
1362    
1363     input_dev->id.bustype = BUS_HOST;
1364    
1365     + keypad_data->input_dev = input_dev;
1366     +
1367     error = keypad_matrix_key_parse_dt(keypad_data);
1368     if (error)
1369     return error;
1370     @@ -168,8 +170,6 @@ static int keyscan_probe(struct platform_device *pdev)
1371    
1372     input_set_drvdata(input_dev, keypad_data);
1373    
1374     - keypad_data->input_dev = input_dev;
1375     -
1376     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1377     keypad_data->base = devm_ioremap_resource(&pdev->dev, res);
1378     if (IS_ERR(keypad_data->base))
1379     diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h
1380     index cdf8d253209e..6fb6dd600970 100644
1381     --- a/drivers/md/bcache/writeback.h
1382     +++ b/drivers/md/bcache/writeback.h
1383     @@ -68,6 +68,9 @@ static inline bool should_writeback(struct cached_dev *dc, struct bio *bio,
1384     in_use > CUTOFF_WRITEBACK_SYNC)
1385     return false;
1386    
1387     + if (bio_op(bio) == REQ_OP_DISCARD)
1388     + return false;
1389     +
1390     if (dc->partial_stripes_expensive &&
1391     bcache_dev_stripe_dirty(dc, bio->bi_iter.bi_sector,
1392     bio_sectors(bio)))
1393     diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
1394     index 67414616eb35..717787d09e0f 100644
1395     --- a/drivers/md/raid10.c
1396     +++ b/drivers/md/raid10.c
1397     @@ -3798,6 +3798,8 @@ static int raid10_run(struct mddev *mddev)
1398     set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
1399     mddev->sync_thread = md_register_thread(md_do_sync, mddev,
1400     "reshape");
1401     + if (!mddev->sync_thread)
1402     + goto out_free_conf;
1403     }
1404    
1405     return 0;
1406     diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1407     index 4afc419da60f..9ec74dfe94f4 100644
1408     --- a/drivers/md/raid5.c
1409     +++ b/drivers/md/raid5.c
1410     @@ -6977,6 +6977,8 @@ static int raid5_run(struct mddev *mddev)
1411     set_bit(MD_RECOVERY_RUNNING, &mddev->recovery);
1412     mddev->sync_thread = md_register_thread(md_do_sync, mddev,
1413     "reshape");
1414     + if (!mddev->sync_thread)
1415     + goto abort;
1416     }
1417    
1418     /* Ok, everything is just fine now */
1419     diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
1420     index 48503f30b3a2..dcca723f7155 100644
1421     --- a/drivers/media/usb/uvc/uvc_video.c
1422     +++ b/drivers/media/usb/uvc/uvc_video.c
1423     @@ -638,6 +638,14 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
1424     if (!uvc_hw_timestamps_param)
1425     return;
1426    
1427     + /*
1428     + * We will get called from __vb2_queue_cancel() if there are buffers
1429     + * done but not dequeued by the user, but the sample array has already
1430     + * been released at that time. Just bail out in that case.
1431     + */
1432     + if (!clock->samples)
1433     + return;
1434     +
1435     spin_lock_irqsave(&clock->lock, flags);
1436    
1437     if (clock->count < clock->size)
1438     diff --git a/drivers/media/v4l2-core/videobuf2-v4l2.c b/drivers/media/v4l2-core/videobuf2-v4l2.c
1439     index 52ef8833f6b6..7e45da4d52e1 100644
1440     --- a/drivers/media/v4l2-core/videobuf2-v4l2.c
1441     +++ b/drivers/media/v4l2-core/videobuf2-v4l2.c
1442     @@ -146,7 +146,6 @@ static void vb2_warn_zero_bytesused(struct vb2_buffer *vb)
1443     return;
1444    
1445     check_once = true;
1446     - WARN_ON(1);
1447    
1448     pr_warn("use of bytesused == 0 is deprecated and will be removed in the future,\n");
1449     if (vb->vb2_queue->allow_zero_bytesused)
1450     diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
1451     index 2ff465848b65..097a0bf592ab 100644
1452     --- a/drivers/net/ethernet/atheros/atlx/atl2.c
1453     +++ b/drivers/net/ethernet/atheros/atlx/atl2.c
1454     @@ -1338,13 +1338,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1455     {
1456     struct net_device *netdev;
1457     struct atl2_adapter *adapter;
1458     - static int cards_found;
1459     + static int cards_found = 0;
1460     unsigned long mmio_start;
1461     int mmio_len;
1462     int err;
1463    
1464     - cards_found = 0;
1465     -
1466     err = pci_enable_device(pdev);
1467     if (err)
1468     return err;
1469     diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
1470     index 53a506b0d790..95874c10c23b 100644
1471     --- a/drivers/net/ethernet/broadcom/bcmsysport.c
1472     +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
1473     @@ -104,6 +104,10 @@ static int bcm_sysport_set_rx_csum(struct net_device *dev,
1474    
1475     priv->rx_chk_en = !!(wanted & NETIF_F_RXCSUM);
1476     reg = rxchk_readl(priv, RXCHK_CONTROL);
1477     + /* Clear L2 header checks, which would prevent BPDUs
1478     + * from being received.
1479     + */
1480     + reg &= ~RXCHK_L2_HDR_DIS;
1481     if (priv->rx_chk_en)
1482     reg |= RXCHK_EN;
1483     else
1484     diff --git a/drivers/net/ethernet/cavium/thunder/nic_main.c b/drivers/net/ethernet/cavium/thunder/nic_main.c
1485     index da142f6bd0c3..18ddd243dfa1 100644
1486     --- a/drivers/net/ethernet/cavium/thunder/nic_main.c
1487     +++ b/drivers/net/ethernet/cavium/thunder/nic_main.c
1488     @@ -999,7 +999,7 @@ static void nic_handle_mbx_intr(struct nicpf *nic, int vf)
1489     case NIC_MBOX_MSG_CFG_DONE:
1490     /* Last message of VF config msg sequence */
1491     nic_enable_vf(nic, vf, true);
1492     - goto unlock;
1493     + break;
1494     case NIC_MBOX_MSG_SHUTDOWN:
1495     /* First msg in VF teardown sequence */
1496     if (vf >= nic->num_vf_en)
1497     diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
1498     index c75d4ea9342b..71f228cece03 100644
1499     --- a/drivers/net/ethernet/cavium/thunder/nicvf_main.c
1500     +++ b/drivers/net/ethernet/cavium/thunder/nicvf_main.c
1501     @@ -162,6 +162,17 @@ static int nicvf_check_pf_ready(struct nicvf *nic)
1502     return 1;
1503     }
1504    
1505     +static void nicvf_send_cfg_done(struct nicvf *nic)
1506     +{
1507     + union nic_mbx mbx = {};
1508     +
1509     + mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
1510     + if (nicvf_send_msg_to_pf(nic, &mbx)) {
1511     + netdev_err(nic->netdev,
1512     + "PF didn't respond to CFG DONE msg\n");
1513     + }
1514     +}
1515     +
1516     static void nicvf_read_bgx_stats(struct nicvf *nic, struct bgx_stats_msg *bgx)
1517     {
1518     if (bgx->rx)
1519     @@ -1178,7 +1189,6 @@ int nicvf_open(struct net_device *netdev)
1520     struct nicvf *nic = netdev_priv(netdev);
1521     struct queue_set *qs = nic->qs;
1522     struct nicvf_cq_poll *cq_poll = NULL;
1523     - union nic_mbx mbx = {};
1524    
1525     netif_carrier_off(netdev);
1526    
1527     @@ -1267,8 +1277,7 @@ int nicvf_open(struct net_device *netdev)
1528     nicvf_enable_intr(nic, NICVF_INTR_RBDR, qidx);
1529    
1530     /* Send VF config done msg to PF */
1531     - mbx.msg.msg = NIC_MBOX_MSG_CFG_DONE;
1532     - nicvf_write_to_mbx(nic, &mbx);
1533     + nicvf_send_cfg_done(nic);
1534    
1535     return 0;
1536     cleanup:
1537     diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
1538     index 5bb019d49409..551b2a9ebf0f 100644
1539     --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
1540     +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c
1541     @@ -2820,6 +2820,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
1542     dsaf_dev = dev_get_drvdata(&pdev->dev);
1543     if (!dsaf_dev) {
1544     dev_err(&pdev->dev, "dsaf_dev is NULL\n");
1545     + put_device(&pdev->dev);
1546     return -ENODEV;
1547     }
1548    
1549     @@ -2827,6 +2828,7 @@ int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset)
1550     if (AE_IS_VER1(dsaf_dev->dsaf_ver)) {
1551     dev_err(dsaf_dev->dev, "%s v1 chip doesn't support RoCE!\n",
1552     dsaf_dev->ae_dev.name);
1553     + put_device(&pdev->dev);
1554     return -ENODEV;
1555     }
1556    
1557     diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
1558     index 5b12022adf1f..526d07e02bbc 100644
1559     --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
1560     +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
1561     @@ -2886,7 +2886,7 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
1562    
1563     ret = mv643xx_eth_shared_of_probe(pdev);
1564     if (ret)
1565     - return ret;
1566     + goto err_put_clk;
1567     pd = dev_get_platdata(&pdev->dev);
1568    
1569     msp->tx_csum_limit = (pd != NULL && pd->tx_csum_limit) ?
1570     @@ -2894,6 +2894,11 @@ static int mv643xx_eth_shared_probe(struct platform_device *pdev)
1571     infer_hw_params(msp);
1572    
1573     return 0;
1574     +
1575     +err_put_clk:
1576     + if (!IS_ERR(msp->clk))
1577     + clk_disable_unprepare(msp->clk);
1578     + return ret;
1579     }
1580    
1581     static int mv643xx_eth_shared_remove(struct platform_device *pdev)
1582     diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
1583     index c92ffdf91065..d98b874a7238 100644
1584     --- a/drivers/net/ethernet/marvell/mvneta.c
1585     +++ b/drivers/net/ethernet/marvell/mvneta.c
1586     @@ -2050,7 +2050,7 @@ err_drop_frame:
1587     if (unlikely(!skb))
1588     goto err_drop_frame_ret_pool;
1589    
1590     - dma_sync_single_range_for_cpu(dev->dev.parent,
1591     + dma_sync_single_range_for_cpu(&pp->bm_priv->pdev->dev,
1592     rx_desc->buf_phys_addr,
1593     MVNETA_MH_SIZE + NET_SKB_PAD,
1594     rx_bytes,
1595     diff --git a/drivers/net/ethernet/netronome/nfp/nfp_bpf_jit.c b/drivers/net/ethernet/netronome/nfp/nfp_bpf_jit.c
1596     index f8df5300f49c..73087770d72f 100644
1597     --- a/drivers/net/ethernet/netronome/nfp/nfp_bpf_jit.c
1598     +++ b/drivers/net/ethernet/netronome/nfp/nfp_bpf_jit.c
1599     @@ -756,15 +756,10 @@ wrp_alu64_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,
1600    
1601     static int
1602     wrp_alu32_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta,
1603     - enum alu_op alu_op, bool skip)
1604     + enum alu_op alu_op)
1605     {
1606     const struct bpf_insn *insn = &meta->insn;
1607    
1608     - if (skip) {
1609     - meta->skip = true;
1610     - return 0;
1611     - }
1612     -
1613     wrp_alu_imm(nfp_prog, insn->dst_reg * 2, alu_op, insn->imm);
1614     wrp_immed(nfp_prog, reg_both(insn->dst_reg * 2 + 1), 0);
1615    
1616     @@ -1017,7 +1012,7 @@ static int xor_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1617    
1618     static int xor_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1619     {
1620     - return wrp_alu32_imm(nfp_prog, meta, ALU_OP_XOR, !~meta->insn.imm);
1621     + return wrp_alu32_imm(nfp_prog, meta, ALU_OP_XOR);
1622     }
1623    
1624     static int and_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1625     @@ -1027,7 +1022,7 @@ static int and_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1626    
1627     static int and_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1628     {
1629     - return wrp_alu32_imm(nfp_prog, meta, ALU_OP_AND, !~meta->insn.imm);
1630     + return wrp_alu32_imm(nfp_prog, meta, ALU_OP_AND);
1631     }
1632    
1633     static int or_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1634     @@ -1037,7 +1032,7 @@ static int or_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1635    
1636     static int or_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1637     {
1638     - return wrp_alu32_imm(nfp_prog, meta, ALU_OP_OR, !meta->insn.imm);
1639     + return wrp_alu32_imm(nfp_prog, meta, ALU_OP_OR);
1640     }
1641    
1642     static int add_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1643     @@ -1047,7 +1042,7 @@ static int add_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1644    
1645     static int add_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1646     {
1647     - return wrp_alu32_imm(nfp_prog, meta, ALU_OP_ADD, !meta->insn.imm);
1648     + return wrp_alu32_imm(nfp_prog, meta, ALU_OP_ADD);
1649     }
1650    
1651     static int sub_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1652     @@ -1057,7 +1052,7 @@ static int sub_reg(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1653    
1654     static int sub_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1655     {
1656     - return wrp_alu32_imm(nfp_prog, meta, ALU_OP_SUB, !meta->insn.imm);
1657     + return wrp_alu32_imm(nfp_prog, meta, ALU_OP_SUB);
1658     }
1659    
1660     static int shl_imm(struct nfp_prog *nfp_prog, struct nfp_insn_meta *meta)
1661     diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1662     index 134eb184fa22..16e5c8cd104d 100644
1663     --- a/drivers/net/usb/qmi_wwan.c
1664     +++ b/drivers/net/usb/qmi_wwan.c
1665     @@ -895,8 +895,8 @@ static const struct usb_device_id products[] = {
1666     {QMI_FIXED_INTF(0x114f, 0x68a2, 8)}, /* Sierra Wireless MC7750 */
1667     {QMI_FIXED_INTF(0x1199, 0x68a2, 8)}, /* Sierra Wireless MC7710 in QMI mode */
1668     {QMI_FIXED_INTF(0x1199, 0x68a2, 19)}, /* Sierra Wireless MC7710 in QMI mode */
1669     - {QMI_FIXED_INTF(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354 */
1670     - {QMI_FIXED_INTF(0x1199, 0x68c0, 10)}, /* Sierra Wireless MC7304/MC7354 */
1671     + {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 8)}, /* Sierra Wireless MC7304/MC7354, WP76xx */
1672     + {QMI_QUIRK_SET_DTR(0x1199, 0x68c0, 10)},/* Sierra Wireless MC7304/MC7354 */
1673     {QMI_FIXED_INTF(0x1199, 0x901c, 8)}, /* Sierra Wireless EM7700 */
1674     {QMI_FIXED_INTF(0x1199, 0x901f, 8)}, /* Sierra Wireless EM7355 */
1675     {QMI_FIXED_INTF(0x1199, 0x9041, 8)}, /* Sierra Wireless MC7305/MC7355 */
1676     diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
1677     index 780acf23fd19..e9ec1da9935d 100644
1678     --- a/drivers/net/wireless/mac80211_hwsim.c
1679     +++ b/drivers/net/wireless/mac80211_hwsim.c
1680     @@ -3167,7 +3167,7 @@ static int hwsim_get_radio_nl(struct sk_buff *msg, struct genl_info *info)
1681     goto out_err;
1682     }
1683    
1684     - genlmsg_reply(skb, info);
1685     + res = genlmsg_reply(skb, info);
1686     break;
1687     }
1688    
1689     diff --git a/drivers/net/wireless/marvell/libertas_tf/if_usb.c b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
1690     index e0ade40d9497..4b539209999b 100644
1691     --- a/drivers/net/wireless/marvell/libertas_tf/if_usb.c
1692     +++ b/drivers/net/wireless/marvell/libertas_tf/if_usb.c
1693     @@ -433,8 +433,6 @@ static int __if_usb_submit_rx_urb(struct if_usb_card *cardp,
1694     skb_tail_pointer(skb),
1695     MRVDRV_ETH_RX_PACKET_BUFFER_SIZE, callbackfn, cardp);
1696    
1697     - cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
1698     -
1699     lbtf_deb_usb2(&cardp->udev->dev, "Pointer for rx_urb %p\n",
1700     cardp->rx_urb);
1701     ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC);
1702     diff --git a/drivers/nvdimm/label.c b/drivers/nvdimm/label.c
1703     index d8d189d14834..66a089d561cf 100644
1704     --- a/drivers/nvdimm/label.c
1705     +++ b/drivers/nvdimm/label.c
1706     @@ -492,7 +492,7 @@ static unsigned long nd_label_offset(struct nvdimm_drvdata *ndd,
1707    
1708     static int __pmem_label_update(struct nd_region *nd_region,
1709     struct nd_mapping *nd_mapping, struct nd_namespace_pmem *nspm,
1710     - int pos)
1711     + int pos, unsigned long flags)
1712     {
1713     u64 cookie = nd_region_interleave_set_cookie(nd_region);
1714     struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
1715     @@ -530,7 +530,7 @@ static int __pmem_label_update(struct nd_region *nd_region,
1716     memcpy(nd_label->uuid, nspm->uuid, NSLABEL_UUID_LEN);
1717     if (nspm->alt_name)
1718     memcpy(nd_label->name, nspm->alt_name, NSLABEL_NAME_LEN);
1719     - nd_label->flags = __cpu_to_le32(NSLABEL_FLAG_UPDATING);
1720     + nd_label->flags = __cpu_to_le32(flags);
1721     nd_label->nlabel = __cpu_to_le16(nd_region->ndr_mappings);
1722     nd_label->position = __cpu_to_le16(pos);
1723     nd_label->isetcookie = __cpu_to_le64(cookie);
1724     @@ -922,13 +922,13 @@ static int del_labels(struct nd_mapping *nd_mapping, u8 *uuid)
1725     int nd_pmem_namespace_label_update(struct nd_region *nd_region,
1726     struct nd_namespace_pmem *nspm, resource_size_t size)
1727     {
1728     - int i;
1729     + int i, rc;
1730    
1731     for (i = 0; i < nd_region->ndr_mappings; i++) {
1732     struct nd_mapping *nd_mapping = &nd_region->mapping[i];
1733     struct nvdimm_drvdata *ndd = to_ndd(nd_mapping);
1734     struct resource *res;
1735     - int rc, count = 0;
1736     + int count = 0;
1737    
1738     if (size == 0) {
1739     rc = del_labels(nd_mapping, nspm->uuid);
1740     @@ -946,7 +946,20 @@ int nd_pmem_namespace_label_update(struct nd_region *nd_region,
1741     if (rc < 0)
1742     return rc;
1743    
1744     - rc = __pmem_label_update(nd_region, nd_mapping, nspm, i);
1745     + rc = __pmem_label_update(nd_region, nd_mapping, nspm, i,
1746     + NSLABEL_FLAG_UPDATING);
1747     + if (rc)
1748     + return rc;
1749     + }
1750     +
1751     + if (size == 0)
1752     + return 0;
1753     +
1754     + /* Clear the UPDATING flag per UEFI 2.7 expectations */
1755     + for (i = 0; i < nd_region->ndr_mappings; i++) {
1756     + struct nd_mapping *nd_mapping = &nd_region->mapping[i];
1757     +
1758     + rc = __pmem_label_update(nd_region, nd_mapping, nspm, i, 0);
1759     if (rc)
1760     return rc;
1761     }
1762     diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
1763     index 74257ac92490..9bc5f555ee68 100644
1764     --- a/drivers/nvdimm/namespace_devs.c
1765     +++ b/drivers/nvdimm/namespace_devs.c
1766     @@ -138,6 +138,7 @@ bool nd_is_uuid_unique(struct device *dev, u8 *uuid)
1767     bool pmem_should_map_pages(struct device *dev)
1768     {
1769     struct nd_region *nd_region = to_nd_region(dev->parent);
1770     + struct nd_namespace_common *ndns = to_ndns(dev);
1771     struct nd_namespace_io *nsio;
1772    
1773     if (!IS_ENABLED(CONFIG_ZONE_DEVICE))
1774     @@ -149,6 +150,9 @@ bool pmem_should_map_pages(struct device *dev)
1775     if (is_nd_pfn(dev) || is_nd_btt(dev))
1776     return false;
1777    
1778     + if (ndns->force_raw)
1779     + return false;
1780     +
1781     nsio = to_nd_namespace_io(dev);
1782     if (region_intersects(nsio->res.start, resource_size(&nsio->res),
1783     IORESOURCE_SYSTEM_RAM,
1784     diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c
1785     index d6aa59ca68b9..ba9aa8475e6d 100644
1786     --- a/drivers/nvdimm/pfn_devs.c
1787     +++ b/drivers/nvdimm/pfn_devs.c
1788     @@ -515,7 +515,7 @@ static unsigned long init_altmap_base(resource_size_t base)
1789    
1790     static unsigned long init_altmap_reserve(resource_size_t base)
1791     {
1792     - unsigned long reserve = PHYS_PFN(SZ_8K);
1793     + unsigned long reserve = PFN_UP(SZ_8K);
1794     unsigned long base_pfn = PHYS_PFN(base);
1795    
1796     reserve += base_pfn - PFN_SECTION_ALIGN_DOWN(base_pfn);
1797     diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
1798     index bdce0679674c..02e6485c1ed5 100644
1799     --- a/drivers/parport/parport_pc.c
1800     +++ b/drivers/parport/parport_pc.c
1801     @@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport *p)
1802     {
1803     int i;
1804     for (i = 0; i < NR_SUPERIOS; i++)
1805     - if (superios[i].io != p->base)
1806     + if (superios[i].io == p->base)
1807     return &superios[i];
1808     return NULL;
1809     }
1810     diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c
1811     index cbe5f5cbddb8..e1b689f840ab 100644
1812     --- a/drivers/pinctrl/meson/pinctrl-meson8b.c
1813     +++ b/drivers/pinctrl/meson/pinctrl-meson8b.c
1814     @@ -662,7 +662,7 @@ static const char * const sd_a_groups[] = {
1815    
1816     static const char * const sdxc_a_groups[] = {
1817     "sdxc_d0_0_a", "sdxc_d13_0_a", "sdxc_d47_a", "sdxc_clk_a",
1818     - "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d0_13_1_a"
1819     + "sdxc_cmd_a", "sdxc_d0_1_a", "sdxc_d13_1_a"
1820     };
1821    
1822     static const char * const pcm_a_groups[] = {
1823     diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c
1824     index 92f88753bfed..2daf751c26c7 100644
1825     --- a/drivers/regulator/s2mpa01.c
1826     +++ b/drivers/regulator/s2mpa01.c
1827     @@ -303,13 +303,13 @@ static const struct regulator_desc regulators[] = {
1828     regulator_desc_ldo(2, STEP_50_MV),
1829     regulator_desc_ldo(3, STEP_50_MV),
1830     regulator_desc_ldo(4, STEP_50_MV),
1831     - regulator_desc_ldo(5, STEP_50_MV),
1832     + regulator_desc_ldo(5, STEP_25_MV),
1833     regulator_desc_ldo(6, STEP_25_MV),
1834     regulator_desc_ldo(7, STEP_50_MV),
1835     regulator_desc_ldo(8, STEP_50_MV),
1836     regulator_desc_ldo(9, STEP_50_MV),
1837     regulator_desc_ldo(10, STEP_50_MV),
1838     - regulator_desc_ldo(11, STEP_25_MV),
1839     + regulator_desc_ldo(11, STEP_50_MV),
1840     regulator_desc_ldo(12, STEP_50_MV),
1841     regulator_desc_ldo(13, STEP_50_MV),
1842     regulator_desc_ldo(14, STEP_50_MV),
1843     @@ -320,11 +320,11 @@ static const struct regulator_desc regulators[] = {
1844     regulator_desc_ldo(19, STEP_50_MV),
1845     regulator_desc_ldo(20, STEP_50_MV),
1846     regulator_desc_ldo(21, STEP_50_MV),
1847     - regulator_desc_ldo(22, STEP_25_MV),
1848     - regulator_desc_ldo(23, STEP_25_MV),
1849     + regulator_desc_ldo(22, STEP_50_MV),
1850     + regulator_desc_ldo(23, STEP_50_MV),
1851     regulator_desc_ldo(24, STEP_50_MV),
1852     regulator_desc_ldo(25, STEP_50_MV),
1853     - regulator_desc_ldo(26, STEP_50_MV),
1854     + regulator_desc_ldo(26, STEP_25_MV),
1855     regulator_desc_buck1_4(1),
1856     regulator_desc_buck1_4(2),
1857     regulator_desc_buck1_4(3),
1858     diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
1859     index d838e77dd947..1fe1c18cc27b 100644
1860     --- a/drivers/regulator/s2mps11.c
1861     +++ b/drivers/regulator/s2mps11.c
1862     @@ -376,7 +376,7 @@ static const struct regulator_desc s2mps11_regulators[] = {
1863     regulator_desc_s2mps11_ldo(32, STEP_50_MV),
1864     regulator_desc_s2mps11_ldo(33, STEP_50_MV),
1865     regulator_desc_s2mps11_ldo(34, STEP_50_MV),
1866     - regulator_desc_s2mps11_ldo(35, STEP_50_MV),
1867     + regulator_desc_s2mps11_ldo(35, STEP_25_MV),
1868     regulator_desc_s2mps11_ldo(36, STEP_50_MV),
1869     regulator_desc_s2mps11_ldo(37, STEP_50_MV),
1870     regulator_desc_s2mps11_ldo(38, STEP_50_MV),
1871     @@ -386,8 +386,8 @@ static const struct regulator_desc s2mps11_regulators[] = {
1872     regulator_desc_s2mps11_buck1_4(4),
1873     regulator_desc_s2mps11_buck5,
1874     regulator_desc_s2mps11_buck67810(6, MIN_600_MV, STEP_6_25_MV),
1875     - regulator_desc_s2mps11_buck67810(7, MIN_600_MV, STEP_6_25_MV),
1876     - regulator_desc_s2mps11_buck67810(8, MIN_600_MV, STEP_6_25_MV),
1877     + regulator_desc_s2mps11_buck67810(7, MIN_600_MV, STEP_12_5_MV),
1878     + regulator_desc_s2mps11_buck67810(8, MIN_600_MV, STEP_12_5_MV),
1879     regulator_desc_s2mps11_buck9,
1880     regulator_desc_s2mps11_buck67810(10, MIN_750_MV, STEP_12_5_MV),
1881     };
1882     diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
1883     index be17de9807b6..11c6335b1951 100644
1884     --- a/drivers/s390/block/dasd_eckd.c
1885     +++ b/drivers/s390/block/dasd_eckd.c
1886     @@ -4508,6 +4508,14 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp)
1887     usrparm.psf_data &= 0x7fffffffULL;
1888     usrparm.rssd_result &= 0x7fffffffULL;
1889     }
1890     + /* at least 2 bytes are accessed and should be allocated */
1891     + if (usrparm.psf_data_len < 2) {
1892     + DBF_DEV_EVENT(DBF_WARNING, device,
1893     + "Symmetrix ioctl invalid data length %d",
1894     + usrparm.psf_data_len);
1895     + rc = -EINVAL;
1896     + goto out;
1897     + }
1898     /* alloc I/O data area */
1899     psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL | GFP_DMA);
1900     rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL | GFP_DMA);
1901     diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
1902     index 3493d449911c..d5e510ff5437 100644
1903     --- a/drivers/s390/virtio/virtio_ccw.c
1904     +++ b/drivers/s390/virtio/virtio_ccw.c
1905     @@ -283,6 +283,8 @@ static void virtio_ccw_drop_indicators(struct virtio_ccw_device *vcdev)
1906     {
1907     struct virtio_ccw_vq_info *info;
1908    
1909     + if (!vcdev->airq_info)
1910     + return;
1911     list_for_each_entry(info, &vcdev->virtqueues, node)
1912     drop_airq_indicator(info->vq, vcdev->airq_info);
1913     }
1914     @@ -424,7 +426,7 @@ static int virtio_ccw_read_vq_conf(struct virtio_ccw_device *vcdev,
1915     ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_VQ_CONF);
1916     if (ret)
1917     return ret;
1918     - return vcdev->config_block->num;
1919     + return vcdev->config_block->num ?: -ENOENT;
1920     }
1921    
1922     static void virtio_ccw_del_vq(struct virtqueue *vq, struct ccw1 *ccw)
1923     diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
1924     index c79743de48f9..2ffe10453e30 100644
1925     --- a/drivers/scsi/libiscsi.c
1926     +++ b/drivers/scsi/libiscsi.c
1927     @@ -1448,7 +1448,13 @@ static int iscsi_xmit_task(struct iscsi_conn *conn)
1928     if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx))
1929     return -ENODATA;
1930    
1931     + spin_lock_bh(&conn->session->back_lock);
1932     + if (conn->task == NULL) {
1933     + spin_unlock_bh(&conn->session->back_lock);
1934     + return -ENODATA;
1935     + }
1936     __iscsi_get_task(task);
1937     + spin_unlock_bh(&conn->session->back_lock);
1938     spin_unlock_bh(&conn->session->frwd_lock);
1939     rc = conn->session->tt->xmit_task(task);
1940     spin_lock_bh(&conn->session->frwd_lock);
1941     diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
1942     index 867ae76f93f2..3e9cbba41464 100644
1943     --- a/drivers/scsi/sd.c
1944     +++ b/drivers/scsi/sd.c
1945     @@ -2834,6 +2834,55 @@ static void sd_read_write_same(struct scsi_disk *sdkp, unsigned char *buffer)
1946     sdkp->ws10 = 1;
1947     }
1948    
1949     +/*
1950     + * Determine the device's preferred I/O size for reads and writes
1951     + * unless the reported value is unreasonably small, large, not a
1952     + * multiple of the physical block size, or simply garbage.
1953     + */
1954     +static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp,
1955     + unsigned int dev_max)
1956     +{
1957     + struct scsi_device *sdp = sdkp->device;
1958     + unsigned int opt_xfer_bytes =
1959     + logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
1960     +
1961     + if (sdkp->opt_xfer_blocks > dev_max) {
1962     + sd_first_printk(KERN_WARNING, sdkp,
1963     + "Optimal transfer size %u logical blocks " \
1964     + "> dev_max (%u logical blocks)\n",
1965     + sdkp->opt_xfer_blocks, dev_max);
1966     + return false;
1967     + }
1968     +
1969     + if (sdkp->opt_xfer_blocks > SD_DEF_XFER_BLOCKS) {
1970     + sd_first_printk(KERN_WARNING, sdkp,
1971     + "Optimal transfer size %u logical blocks " \
1972     + "> sd driver limit (%u logical blocks)\n",
1973     + sdkp->opt_xfer_blocks, SD_DEF_XFER_BLOCKS);
1974     + return false;
1975     + }
1976     +
1977     + if (opt_xfer_bytes < PAGE_SIZE) {
1978     + sd_first_printk(KERN_WARNING, sdkp,
1979     + "Optimal transfer size %u bytes < " \
1980     + "PAGE_SIZE (%u bytes)\n",
1981     + opt_xfer_bytes, (unsigned int)PAGE_SIZE);
1982     + return false;
1983     + }
1984     +
1985     + if (opt_xfer_bytes & (sdkp->physical_block_size - 1)) {
1986     + sd_first_printk(KERN_WARNING, sdkp,
1987     + "Optimal transfer size %u bytes not a " \
1988     + "multiple of physical block size (%u bytes)\n",
1989     + opt_xfer_bytes, sdkp->physical_block_size);
1990     + return false;
1991     + }
1992     +
1993     + sd_first_printk(KERN_INFO, sdkp, "Optimal transfer size %u bytes\n",
1994     + opt_xfer_bytes);
1995     + return true;
1996     +}
1997     +
1998     /**
1999     * sd_revalidate_disk - called the first time a new disk is seen,
2000     * performs disk spin up, read_capacity, etc.
2001     @@ -2898,15 +2947,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
2002     dev_max = min_not_zero(dev_max, sdkp->max_xfer_blocks);
2003     q->limits.max_dev_sectors = logical_to_sectors(sdp, dev_max);
2004    
2005     - /*
2006     - * Determine the device's preferred I/O size for reads and writes
2007     - * unless the reported value is unreasonably small, large, or
2008     - * garbage.
2009     - */
2010     - if (sdkp->opt_xfer_blocks &&
2011     - sdkp->opt_xfer_blocks <= dev_max &&
2012     - sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
2013     - logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) {
2014     + if (sd_validate_opt_xfer_size(sdkp, dev_max)) {
2015     q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
2016     rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
2017     } else
2018     diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
2019     index cbc8e9388268..7ba0031d3a73 100644
2020     --- a/drivers/scsi/virtio_scsi.c
2021     +++ b/drivers/scsi/virtio_scsi.c
2022     @@ -693,7 +693,6 @@ static int virtscsi_device_reset(struct scsi_cmnd *sc)
2023     return FAILED;
2024    
2025     memset(cmd, 0, sizeof(*cmd));
2026     - cmd->sc = sc;
2027     cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){
2028     .type = VIRTIO_SCSI_T_TMF,
2029     .subtype = cpu_to_virtio32(vscsi->vdev,
2030     @@ -752,7 +751,6 @@ static int virtscsi_abort(struct scsi_cmnd *sc)
2031     return FAILED;
2032    
2033     memset(cmd, 0, sizeof(*cmd));
2034     - cmd->sc = sc;
2035     cmd->req.tmf = (struct virtio_scsi_ctrl_tmf_req){
2036     .type = VIRTIO_SCSI_T_TMF,
2037     .subtype = VIRTIO_SCSI_T_TMF_ABORT_TASK,
2038     diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
2039     index 3f3751e2b521..f2209ec4cb68 100644
2040     --- a/drivers/spi/spi-pxa2xx.c
2041     +++ b/drivers/spi/spi-pxa2xx.c
2042     @@ -1668,6 +1668,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
2043     platform_info->enable_dma = false;
2044     } else {
2045     master->can_dma = pxa2xx_spi_can_dma;
2046     + master->max_dma_len = MAX_DMA_LEN;
2047     }
2048     }
2049    
2050     diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
2051     index caeac66a3977..4cb72a8e4646 100644
2052     --- a/drivers/spi/spi-ti-qspi.c
2053     +++ b/drivers/spi/spi-ti-qspi.c
2054     @@ -457,8 +457,8 @@ static void ti_qspi_enable_memory_map(struct spi_device *spi)
2055     ti_qspi_write(qspi, MM_SWITCH, QSPI_SPI_SWITCH_REG);
2056     if (qspi->ctrl_base) {
2057     regmap_update_bits(qspi->ctrl_base, qspi->ctrl_reg,
2058     - MEM_CS_EN(spi->chip_select),
2059     - MEM_CS_MASK);
2060     + MEM_CS_MASK,
2061     + MEM_CS_EN(spi->chip_select));
2062     }
2063     qspi->mmap_enabled = true;
2064     }
2065     @@ -470,7 +470,7 @@ static void ti_qspi_disable_memory_map(struct spi_device *spi)
2066     ti_qspi_write(qspi, 0, QSPI_SPI_SWITCH_REG);
2067     if (qspi->ctrl_base)
2068     regmap_update_bits(qspi->ctrl_base, qspi->ctrl_reg,
2069     - 0, MEM_CS_MASK);
2070     + MEM_CS_MASK, 0);
2071     qspi->mmap_enabled = false;
2072     }
2073    
2074     diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
2075     index 80205f3362d4..b6c4f55f79e7 100644
2076     --- a/drivers/target/iscsi/iscsi_target.c
2077     +++ b/drivers/target/iscsi/iscsi_target.c
2078     @@ -4084,9 +4084,9 @@ static void iscsit_release_commands_from_conn(struct iscsi_conn *conn)
2079     struct se_cmd *se_cmd = &cmd->se_cmd;
2080    
2081     if (se_cmd->se_tfo != NULL) {
2082     - spin_lock(&se_cmd->t_state_lock);
2083     + spin_lock_irq(&se_cmd->t_state_lock);
2084     se_cmd->transport_state |= CMD_T_FABRIC_STOP;
2085     - spin_unlock(&se_cmd->t_state_lock);
2086     + spin_unlock_irq(&se_cmd->t_state_lock);
2087     }
2088     }
2089     spin_unlock_bh(&conn->cmd_lock);
2090     diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c
2091     index 7a8b5fc81a19..f89dfde934a3 100644
2092     --- a/drivers/tty/serial/8250/8250_of.c
2093     +++ b/drivers/tty/serial/8250/8250_of.c
2094     @@ -97,6 +97,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
2095     if (of_property_read_u32(np, "reg-offset", &prop) == 0)
2096     port->mapbase += prop;
2097    
2098     + /* Compatibility with the deprecated pxa driver and 8250_pxa drivers. */
2099     + if (of_device_is_compatible(np, "mrvl,mmp-uart"))
2100     + port->regshift = 2;
2101     +
2102     /* Check for registers offset within the devices address range */
2103     if (of_property_read_u32(np, "reg-shift", &prop) == 0)
2104     port->regshift = prop;
2105     diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
2106     index e82b3473b6b8..2c38b3a1d518 100644
2107     --- a/drivers/tty/serial/8250/8250_pci.c
2108     +++ b/drivers/tty/serial/8250/8250_pci.c
2109     @@ -1330,6 +1330,30 @@ static int pci_default_setup(struct serial_private *priv,
2110     return setup_port(priv, port, bar, offset, board->reg_shift);
2111     }
2112    
2113     +static int pci_pericom_setup(struct serial_private *priv,
2114     + const struct pciserial_board *board,
2115     + struct uart_8250_port *port, int idx)
2116     +{
2117     + unsigned int bar, offset = board->first_offset, maxnr;
2118     +
2119     + bar = FL_GET_BASE(board->flags);
2120     + if (board->flags & FL_BASE_BARS)
2121     + bar += idx;
2122     + else
2123     + offset += idx * board->uart_offset;
2124     +
2125     + if (idx==3)
2126     + offset = 0x38;
2127     +
2128     + maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >>
2129     + (board->reg_shift + 3);
2130     +
2131     + if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
2132     + return 1;
2133     +
2134     + return setup_port(priv, port, bar, offset, board->reg_shift);
2135     +}
2136     +
2137     static int
2138     ce4100_serial_setup(struct serial_private *priv,
2139     const struct pciserial_board *board,
2140     @@ -2096,6 +2120,16 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
2141     .setup = pci_default_setup,
2142     .exit = pci_plx9050_exit,
2143     },
2144     + /*
2145     + * Pericom (Only 7954 - It have a offset jump for port 4)
2146     + */
2147     + {
2148     + .vendor = PCI_VENDOR_ID_PERICOM,
2149     + .device = PCI_DEVICE_ID_PERICOM_PI7C9X7954,
2150     + .subvendor = PCI_ANY_ID,
2151     + .subdevice = PCI_ANY_ID,
2152     + .setup = pci_pericom_setup,
2153     + },
2154     /*
2155     * PLX
2156     */
2157     @@ -2126,6 +2160,111 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
2158     .setup = pci_default_setup,
2159     .exit = pci_plx9050_exit,
2160     },
2161     + {
2162     + .vendor = PCI_VENDOR_ID_ACCESIO,
2163     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB,
2164     + .subvendor = PCI_ANY_ID,
2165     + .subdevice = PCI_ANY_ID,
2166     + .setup = pci_pericom_setup,
2167     + },
2168     + {
2169     + .vendor = PCI_VENDOR_ID_ACCESIO,
2170     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4S,
2171     + .subvendor = PCI_ANY_ID,
2172     + .subdevice = PCI_ANY_ID,
2173     + .setup = pci_pericom_setup,
2174     + },
2175     + {
2176     + .vendor = PCI_VENDOR_ID_ACCESIO,
2177     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB,
2178     + .subvendor = PCI_ANY_ID,
2179     + .subdevice = PCI_ANY_ID,
2180     + .setup = pci_pericom_setup,
2181     + },
2182     + {
2183     + .vendor = PCI_VENDOR_ID_ACCESIO,
2184     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_4,
2185     + .subvendor = PCI_ANY_ID,
2186     + .subdevice = PCI_ANY_ID,
2187     + .setup = pci_pericom_setup,
2188     + },
2189     + {
2190     + .vendor = PCI_VENDOR_ID_ACCESIO,
2191     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB,
2192     + .subvendor = PCI_ANY_ID,
2193     + .subdevice = PCI_ANY_ID,
2194     + .setup = pci_pericom_setup,
2195     + },
2196     + {
2197     + .vendor = PCI_VENDOR_ID_ACCESIO,
2198     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_COM_4SM,
2199     + .subvendor = PCI_ANY_ID,
2200     + .subdevice = PCI_ANY_ID,
2201     + .setup = pci_pericom_setup,
2202     + },
2203     + {
2204     + .vendor = PCI_VENDOR_ID_ACCESIO,
2205     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4,
2206     + .subvendor = PCI_ANY_ID,
2207     + .subdevice = PCI_ANY_ID,
2208     + .setup = pci_pericom_setup,
2209     + },
2210     + {
2211     + .vendor = PCI_VENDOR_ID_ACCESIO,
2212     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_4,
2213     + .subvendor = PCI_ANY_ID,
2214     + .subdevice = PCI_ANY_ID,
2215     + .setup = pci_pericom_setup,
2216     + },
2217     + {
2218     + .vendor = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,
2219     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4,
2220     + .subvendor = PCI_ANY_ID,
2221     + .subdevice = PCI_ANY_ID,
2222     + .setup = pci_pericom_setup,
2223     + },
2224     + {
2225     + .vendor = PCI_VENDOR_ID_ACCESIO,
2226     + .device = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4,
2227     + .subvendor = PCI_ANY_ID,
2228     + .subdevice = PCI_ANY_ID,
2229     + .setup = pci_pericom_setup,
2230     + },
2231     + {
2232     + .vendor = PCI_VENDOR_ID_ACCESIO,
2233     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4,
2234     + .subvendor = PCI_ANY_ID,
2235     + .subdevice = PCI_ANY_ID,
2236     + .setup = pci_pericom_setup,
2237     + },
2238     + {
2239     + .vendor = PCI_VENDOR_ID_ACCESIO,
2240     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4,
2241     + .subvendor = PCI_ANY_ID,
2242     + .subdevice = PCI_ANY_ID,
2243     + .setup = pci_pericom_setup,
2244     + },
2245     + {
2246     + .vendor = PCI_VENDOR_ID_ACCESIO,
2247     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4,
2248     + .subvendor = PCI_ANY_ID,
2249     + .subdevice = PCI_ANY_ID,
2250     + .setup = pci_pericom_setup,
2251     + },
2252     + {
2253     + .vendor = PCI_VENDOR_ID_ACCESIO,
2254     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM,
2255     + .subvendor = PCI_ANY_ID,
2256     + .subdevice = PCI_ANY_ID,
2257     + .setup = pci_pericom_setup,
2258     + },
2259     + {
2260     + .vendor = PCI_VENDOR_ID_ACCESIO,
2261     + .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM,
2262     + .subvendor = PCI_ANY_ID,
2263     + .subdevice = PCI_ANY_ID,
2264     + .setup = pci_pericom_setup,
2265     + },
2266     /*
2267     * SBS Technologies, Inc., PMC-OCTALPRO 232
2268     */
2269     @@ -4976,10 +5115,10 @@ static struct pci_device_id serial_pci_tbl[] = {
2270     */
2271     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SDB,
2272     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2273     - pbn_pericom_PI7C9X7954 },
2274     + pbn_pericom_PI7C9X7952 },
2275     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2S,
2276     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2277     - pbn_pericom_PI7C9X7954 },
2278     + pbn_pericom_PI7C9X7952 },
2279     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SDB,
2280     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2281     pbn_pericom_PI7C9X7954 },
2282     @@ -4988,10 +5127,10 @@ static struct pci_device_id serial_pci_tbl[] = {
2283     pbn_pericom_PI7C9X7954 },
2284     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_2DB,
2285     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2286     - pbn_pericom_PI7C9X7954 },
2287     + pbn_pericom_PI7C9X7952 },
2288     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM232_2,
2289     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2290     - pbn_pericom_PI7C9X7954 },
2291     + pbn_pericom_PI7C9X7952 },
2292     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4DB,
2293     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2294     pbn_pericom_PI7C9X7954 },
2295     @@ -5000,10 +5139,10 @@ static struct pci_device_id serial_pci_tbl[] = {
2296     pbn_pericom_PI7C9X7954 },
2297     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_2SMDB,
2298     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2299     - pbn_pericom_PI7C9X7954 },
2300     + pbn_pericom_PI7C9X7952 },
2301     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_COM_2SM,
2302     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2303     - pbn_pericom_PI7C9X7954 },
2304     + pbn_pericom_PI7C9X7952 },
2305     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SMDB,
2306     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2307     pbn_pericom_PI7C9X7954 },
2308     @@ -5012,13 +5151,13 @@ static struct pci_device_id serial_pci_tbl[] = {
2309     pbn_pericom_PI7C9X7954 },
2310     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_1,
2311     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2312     - pbn_pericom_PI7C9X7954 },
2313     + pbn_pericom_PI7C9X7951 },
2314     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_2,
2315     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2316     - pbn_pericom_PI7C9X7954 },
2317     + pbn_pericom_PI7C9X7952 },
2318     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM485_2,
2319     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2320     - pbn_pericom_PI7C9X7954 },
2321     + pbn_pericom_PI7C9X7952 },
2322     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM422_4,
2323     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2324     pbn_pericom_PI7C9X7954 },
2325     @@ -5027,16 +5166,16 @@ static struct pci_device_id serial_pci_tbl[] = {
2326     pbn_pericom_PI7C9X7954 },
2327     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2S,
2328     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2329     - pbn_pericom_PI7C9X7954 },
2330     + pbn_pericom_PI7C9X7952 },
2331     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,
2332     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2333     pbn_pericom_PI7C9X7954 },
2334     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_2,
2335     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2336     - pbn_pericom_PI7C9X7954 },
2337     + pbn_pericom_PI7C9X7952 },
2338     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_2,
2339     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2340     - pbn_pericom_PI7C9X7954 },
2341     + pbn_pericom_PI7C9X7952 },
2342     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4,
2343     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2344     pbn_pericom_PI7C9X7954 },
2345     @@ -5045,13 +5184,13 @@ static struct pci_device_id serial_pci_tbl[] = {
2346     pbn_pericom_PI7C9X7954 },
2347     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_2SM,
2348     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2349     - pbn_pericom_PI7C9X7954 },
2350     + pbn_pericom_PI7C9X7952 },
2351     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_4,
2352     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2353     - pbn_pericom_PI7C9X7958 },
2354     + pbn_pericom_PI7C9X7954 },
2355     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM485_4,
2356     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2357     - pbn_pericom_PI7C9X7958 },
2358     + pbn_pericom_PI7C9X7954 },
2359     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM422_8,
2360     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2361     pbn_pericom_PI7C9X7958 },
2362     @@ -5060,19 +5199,19 @@ static struct pci_device_id serial_pci_tbl[] = {
2363     pbn_pericom_PI7C9X7958 },
2364     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_4,
2365     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2366     - pbn_pericom_PI7C9X7958 },
2367     + pbn_pericom_PI7C9X7954 },
2368     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM232_8,
2369     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2370     pbn_pericom_PI7C9X7958 },
2371     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_4SM,
2372     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2373     - pbn_pericom_PI7C9X7958 },
2374     + pbn_pericom_PI7C9X7954 },
2375     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_COM_8SM,
2376     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2377     pbn_pericom_PI7C9X7958 },
2378     { PCI_VENDOR_ID_ACCESIO, PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4SM,
2379     PCI_ANY_ID, PCI_ANY_ID, 0, 0,
2380     - pbn_pericom_PI7C9X7958 },
2381     + pbn_pericom_PI7C9X7954 },
2382     /*
2383     * Topic TP560 Data/Fax/Voice 56k modem (reported by Evan Clarke)
2384     */
2385     diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
2386     index 7333d64f68f2..ffb474c49f0f 100644
2387     --- a/drivers/tty/serial/xilinx_uartps.c
2388     +++ b/drivers/tty/serial/xilinx_uartps.c
2389     @@ -362,7 +362,13 @@ static irqreturn_t cdns_uart_isr(int irq, void *dev_id)
2390     cdns_uart_handle_tx(dev_id);
2391     isrstatus &= ~CDNS_UART_IXR_TXEMPTY;
2392     }
2393     - if (isrstatus & CDNS_UART_IXR_RXMASK)
2394     +
2395     + /*
2396     + * Skip RX processing if RX is disabled as RXEMPTY will never be set
2397     + * as read bytes will not be removed from the FIFO.
2398     + */
2399     + if (isrstatus & CDNS_UART_IXR_RXMASK &&
2400     + !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS))
2401     cdns_uart_handle_rx(dev_id, isrstatus);
2402    
2403     spin_unlock(&port->lock);
2404     diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
2405     index 5a0db6dec8d1..aaee1e6584e6 100644
2406     --- a/fs/9p/v9fs_vfs.h
2407     +++ b/fs/9p/v9fs_vfs.h
2408     @@ -40,6 +40,9 @@
2409     */
2410     #define P9_LOCK_TIMEOUT (30*HZ)
2411    
2412     +/* flags for v9fs_stat2inode() & v9fs_stat2inode_dotl() */
2413     +#define V9FS_STAT2INODE_KEEP_ISIZE 1
2414     +
2415     extern struct file_system_type v9fs_fs_type;
2416     extern const struct address_space_operations v9fs_addr_operations;
2417     extern const struct file_operations v9fs_file_operations;
2418     @@ -61,8 +64,10 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
2419     struct inode *inode, umode_t mode, dev_t);
2420     void v9fs_evict_inode(struct inode *inode);
2421     ino_t v9fs_qid2ino(struct p9_qid *qid);
2422     -void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *);
2423     -void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *);
2424     +void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
2425     + struct super_block *sb, unsigned int flags);
2426     +void v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
2427     + unsigned int flags);
2428     int v9fs_dir_release(struct inode *inode, struct file *filp);
2429     int v9fs_file_open(struct inode *inode, struct file *file);
2430     void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat);
2431     @@ -83,4 +88,18 @@ static inline void v9fs_invalidate_inode_attr(struct inode *inode)
2432     }
2433    
2434     int v9fs_open_to_dotl_flags(int flags);
2435     +
2436     +static inline void v9fs_i_size_write(struct inode *inode, loff_t i_size)
2437     +{
2438     + /*
2439     + * 32-bit need the lock, concurrent updates could break the
2440     + * sequences and make i_size_read() loop forever.
2441     + * 64-bit updates are atomic and can skip the locking.
2442     + */
2443     + if (sizeof(i_size) > sizeof(long))
2444     + spin_lock(&inode->i_lock);
2445     + i_size_write(inode, i_size);
2446     + if (sizeof(i_size) > sizeof(long))
2447     + spin_unlock(&inode->i_lock);
2448     +}
2449     #endif
2450     diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
2451     index 398a3eddb2df..2f035b15180e 100644
2452     --- a/fs/9p/vfs_file.c
2453     +++ b/fs/9p/vfs_file.c
2454     @@ -442,7 +442,11 @@ v9fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
2455     i_size = i_size_read(inode);
2456     if (iocb->ki_pos > i_size) {
2457     inode_add_bytes(inode, iocb->ki_pos - i_size);
2458     - i_size_write(inode, iocb->ki_pos);
2459     + /*
2460     + * Need to serialize against i_size_write() in
2461     + * v9fs_stat2inode()
2462     + */
2463     + v9fs_i_size_write(inode, iocb->ki_pos);
2464     }
2465     return retval;
2466     }
2467     diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
2468     index f8ab4a66acaf..ddd1eb6aedee 100644
2469     --- a/fs/9p/vfs_inode.c
2470     +++ b/fs/9p/vfs_inode.c
2471     @@ -538,7 +538,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
2472     if (retval)
2473     goto error;
2474    
2475     - v9fs_stat2inode(st, inode, sb);
2476     + v9fs_stat2inode(st, inode, sb, 0);
2477     v9fs_cache_inode_get_cookie(inode);
2478     unlock_new_inode(inode);
2479     return inode;
2480     @@ -1078,7 +1078,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
2481     if (IS_ERR(st))
2482     return PTR_ERR(st);
2483    
2484     - v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb);
2485     + v9fs_stat2inode(st, d_inode(dentry), dentry->d_sb, 0);
2486     generic_fillattr(d_inode(dentry), stat);
2487    
2488     p9stat_free(st);
2489     @@ -1156,12 +1156,13 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
2490     * @stat: Plan 9 metadata (mistat) structure
2491     * @inode: inode to populate
2492     * @sb: superblock of filesystem
2493     + * @flags: control flags (e.g. V9FS_STAT2INODE_KEEP_ISIZE)
2494     *
2495     */
2496    
2497     void
2498     v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
2499     - struct super_block *sb)
2500     + struct super_block *sb, unsigned int flags)
2501     {
2502     umode_t mode;
2503     char ext[32];
2504     @@ -1202,10 +1203,11 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
2505     mode = p9mode2perm(v9ses, stat);
2506     mode |= inode->i_mode & ~S_IALLUGO;
2507     inode->i_mode = mode;
2508     - i_size_write(inode, stat->length);
2509    
2510     + if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
2511     + v9fs_i_size_write(inode, stat->length);
2512     /* not real number of blocks, but 512 byte ones ... */
2513     - inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9;
2514     + inode->i_blocks = (stat->length + 512 - 1) >> 9;
2515     v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
2516     }
2517    
2518     @@ -1402,9 +1404,9 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
2519     {
2520     int umode;
2521     dev_t rdev;
2522     - loff_t i_size;
2523     struct p9_wstat *st;
2524     struct v9fs_session_info *v9ses;
2525     + unsigned int flags;
2526    
2527     v9ses = v9fs_inode2v9ses(inode);
2528     st = p9_client_stat(fid);
2529     @@ -1417,16 +1419,13 @@ int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
2530     if ((inode->i_mode & S_IFMT) != (umode & S_IFMT))
2531     goto out;
2532    
2533     - spin_lock(&inode->i_lock);
2534     /*
2535     * We don't want to refresh inode->i_size,
2536     * because we may have cached data
2537     */
2538     - i_size = inode->i_size;
2539     - v9fs_stat2inode(st, inode, inode->i_sb);
2540     - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
2541     - inode->i_size = i_size;
2542     - spin_unlock(&inode->i_lock);
2543     + flags = (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) ?
2544     + V9FS_STAT2INODE_KEEP_ISIZE : 0;
2545     + v9fs_stat2inode(st, inode, inode->i_sb, flags);
2546     out:
2547     p9stat_free(st);
2548     kfree(st);
2549     diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
2550     index c3dd0d42bb3a..425bc1a2b8c1 100644
2551     --- a/fs/9p/vfs_inode_dotl.c
2552     +++ b/fs/9p/vfs_inode_dotl.c
2553     @@ -143,7 +143,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_block *sb,
2554     if (retval)
2555     goto error;
2556    
2557     - v9fs_stat2inode_dotl(st, inode);
2558     + v9fs_stat2inode_dotl(st, inode, 0);
2559     v9fs_cache_inode_get_cookie(inode);
2560     retval = v9fs_get_acl(inode, fid);
2561     if (retval)
2562     @@ -496,7 +496,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
2563     if (IS_ERR(st))
2564     return PTR_ERR(st);
2565    
2566     - v9fs_stat2inode_dotl(st, d_inode(dentry));
2567     + v9fs_stat2inode_dotl(st, d_inode(dentry), 0);
2568     generic_fillattr(d_inode(dentry), stat);
2569     /* Change block size to what the server returned */
2570     stat->blksize = st->st_blksize;
2571     @@ -607,11 +607,13 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
2572     * v9fs_stat2inode_dotl - populate an inode structure with stat info
2573     * @stat: stat structure
2574     * @inode: inode to populate
2575     + * @flags: ctrl flags (e.g. V9FS_STAT2INODE_KEEP_ISIZE)
2576     *
2577     */
2578    
2579     void
2580     -v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
2581     +v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode,
2582     + unsigned int flags)
2583     {
2584     umode_t mode;
2585     struct v9fs_inode *v9inode = V9FS_I(inode);
2586     @@ -631,7 +633,8 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
2587     mode |= inode->i_mode & ~S_IALLUGO;
2588     inode->i_mode = mode;
2589    
2590     - i_size_write(inode, stat->st_size);
2591     + if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE))
2592     + v9fs_i_size_write(inode, stat->st_size);
2593     inode->i_blocks = stat->st_blocks;
2594     } else {
2595     if (stat->st_result_mask & P9_STATS_ATIME) {
2596     @@ -661,8 +664,9 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
2597     }
2598     if (stat->st_result_mask & P9_STATS_RDEV)
2599     inode->i_rdev = new_decode_dev(stat->st_rdev);
2600     - if (stat->st_result_mask & P9_STATS_SIZE)
2601     - i_size_write(inode, stat->st_size);
2602     + if (!(flags & V9FS_STAT2INODE_KEEP_ISIZE) &&
2603     + stat->st_result_mask & P9_STATS_SIZE)
2604     + v9fs_i_size_write(inode, stat->st_size);
2605     if (stat->st_result_mask & P9_STATS_BLOCKS)
2606     inode->i_blocks = stat->st_blocks;
2607     }
2608     @@ -928,9 +932,9 @@ v9fs_vfs_get_link_dotl(struct dentry *dentry,
2609    
2610     int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
2611     {
2612     - loff_t i_size;
2613     struct p9_stat_dotl *st;
2614     struct v9fs_session_info *v9ses;
2615     + unsigned int flags;
2616    
2617     v9ses = v9fs_inode2v9ses(inode);
2618     st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
2619     @@ -942,16 +946,13 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
2620     if ((inode->i_mode & S_IFMT) != (st->st_mode & S_IFMT))
2621     goto out;
2622    
2623     - spin_lock(&inode->i_lock);
2624     /*
2625     * We don't want to refresh inode->i_size,
2626     * because we may have cached data
2627     */
2628     - i_size = inode->i_size;
2629     - v9fs_stat2inode_dotl(st, inode);
2630     - if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE)
2631     - inode->i_size = i_size;
2632     - spin_unlock(&inode->i_lock);
2633     + flags = (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) ?
2634     + V9FS_STAT2INODE_KEEP_ISIZE : 0;
2635     + v9fs_stat2inode_dotl(st, inode, flags);
2636     out:
2637     kfree(st);
2638     return 0;
2639     diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
2640     index de3ed8629196..06ff1a9089e8 100644
2641     --- a/fs/9p/vfs_super.c
2642     +++ b/fs/9p/vfs_super.c
2643     @@ -165,7 +165,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
2644     goto release_sb;
2645     }
2646     d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
2647     - v9fs_stat2inode_dotl(st, d_inode(root));
2648     + v9fs_stat2inode_dotl(st, d_inode(root), 0);
2649     kfree(st);
2650     } else {
2651     struct p9_wstat *st = NULL;
2652     @@ -176,7 +176,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
2653     }
2654    
2655     d_inode(root)->i_ino = v9fs_qid2ino(&st->qid);
2656     - v9fs_stat2inode(st, d_inode(root), sb);
2657     + v9fs_stat2inode(st, d_inode(root), sb, 0);
2658    
2659     p9stat_free(st);
2660     kfree(st);
2661     diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
2662     index 5c5c389d8fed..4d901200be13 100644
2663     --- a/fs/btrfs/extent_io.c
2664     +++ b/fs/btrfs/extent_io.c
2665     @@ -3018,11 +3018,11 @@ static int __do_readpage(struct extent_io_tree *tree,
2666     */
2667     if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) &&
2668     prev_em_start && *prev_em_start != (u64)-1 &&
2669     - *prev_em_start != em->orig_start)
2670     + *prev_em_start != em->start)
2671     force_bio_submit = true;
2672    
2673     if (prev_em_start)
2674     - *prev_em_start = em->orig_start;
2675     + *prev_em_start = em->start;
2676    
2677     free_extent_map(em);
2678     em = NULL;
2679     diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
2680     index 5aa2749eaf42..c063ac57c30e 100644
2681     --- a/fs/btrfs/volumes.c
2682     +++ b/fs/btrfs/volumes.c
2683     @@ -6439,10 +6439,10 @@ static int btrfs_check_chunk_valid(struct btrfs_root *root,
2684     }
2685    
2686     if ((type & BTRFS_BLOCK_GROUP_RAID10 && sub_stripes != 2) ||
2687     - (type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 1) ||
2688     + (type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes != 2) ||
2689     (type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 2) ||
2690     (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) ||
2691     - (type & BTRFS_BLOCK_GROUP_DUP && num_stripes > 2) ||
2692     + (type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 2) ||
2693     ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 &&
2694     num_stripes != 1)) {
2695     btrfs_err(root->fs_info,
2696     diff --git a/fs/cifs/file.c b/fs/cifs/file.c
2697     index 8ec296308729..1c5099fffaec 100644
2698     --- a/fs/cifs/file.c
2699     +++ b/fs/cifs/file.c
2700     @@ -2797,14 +2797,16 @@ cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from)
2701     * these pages but not on the region from pos to ppos+len-1.
2702     */
2703     written = cifs_user_writev(iocb, from);
2704     - if (written > 0 && CIFS_CACHE_READ(cinode)) {
2705     + if (CIFS_CACHE_READ(cinode)) {
2706     /*
2707     - * Windows 7 server can delay breaking level2 oplock if a write
2708     - * request comes - break it on the client to prevent reading
2709     - * an old data.
2710     + * We have read level caching and we have just sent a write
2711     + * request to the server thus making data in the cache stale.
2712     + * Zap the cache and set oplock/lease level to NONE to avoid
2713     + * reading stale data from the cache. All subsequent read
2714     + * operations will read new data from the server.
2715     */
2716     cifs_zap_mapping(inode);
2717     - cifs_dbg(FYI, "Set no oplock for inode=%p after a write operation\n",
2718     + cifs_dbg(FYI, "Set Oplock/Lease to NONE for inode=%p after write\n",
2719     inode);
2720     cinode->oplock = 0;
2721     }
2722     diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
2723     index e96a74da756f..244d27bb8fba 100644
2724     --- a/fs/cifs/smb2misc.c
2725     +++ b/fs/cifs/smb2misc.c
2726     @@ -474,7 +474,6 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
2727     __u8 lease_state;
2728     struct list_head *tmp;
2729     struct cifsFileInfo *cfile;
2730     - struct TCP_Server_Info *server = tcon->ses->server;
2731     struct cifs_pending_open *open;
2732     struct cifsInodeInfo *cinode;
2733     int ack_req = le32_to_cpu(rsp->Flags &
2734     @@ -494,13 +493,25 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp,
2735     cifs_dbg(FYI, "lease key match, lease break 0x%x\n",
2736     le32_to_cpu(rsp->NewLeaseState));
2737    
2738     - server->ops->set_oplock_level(cinode, lease_state, 0, NULL);
2739     -
2740     if (ack_req)
2741     cfile->oplock_break_cancelled = false;
2742     else
2743     cfile->oplock_break_cancelled = true;
2744    
2745     + set_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags);
2746     +
2747     + /*
2748     + * Set or clear flags depending on the lease state being READ.
2749     + * HANDLE caching flag should be added when the client starts
2750     + * to defer closing remote file handles with HANDLE leases.
2751     + */
2752     + if (lease_state & SMB2_LEASE_READ_CACHING_HE)
2753     + set_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2754     + &cinode->flags);
2755     + else
2756     + clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2,
2757     + &cinode->flags);
2758     +
2759     queue_work(cifsoplockd_wq, &cfile->oplock_break);
2760     kfree(lw);
2761     return true;
2762     diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
2763     index 2db7968febfe..97d8e2a3df9b 100644
2764     --- a/fs/cifs/smb2ops.c
2765     +++ b/fs/cifs/smb2ops.c
2766     @@ -1376,6 +1376,15 @@ smb2_downgrade_oplock(struct TCP_Server_Info *server,
2767     server->ops->set_oplock_level(cinode, 0, 0, NULL);
2768     }
2769    
2770     +static void
2771     +smb21_downgrade_oplock(struct TCP_Server_Info *server,
2772     + struct cifsInodeInfo *cinode, bool set_level2)
2773     +{
2774     + server->ops->set_oplock_level(cinode,
2775     + set_level2 ? SMB2_LEASE_READ_CACHING_HE :
2776     + 0, 0, NULL);
2777     +}
2778     +
2779     static void
2780     smb2_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock,
2781     unsigned int epoch, bool *purge_cache)
2782     @@ -1681,7 +1690,7 @@ struct smb_version_operations smb21_operations = {
2783     .print_stats = smb2_print_stats,
2784     .is_oplock_break = smb2_is_valid_oplock_break,
2785     .handle_cancelled_mid = smb2_handle_cancelled_mid,
2786     - .downgrade_oplock = smb2_downgrade_oplock,
2787     + .downgrade_oplock = smb21_downgrade_oplock,
2788     .need_neg = smb2_need_neg,
2789     .negotiate = smb2_negotiate,
2790     .negotiate_wsize = smb2_negotiate_wsize,
2791     @@ -1765,7 +1774,7 @@ struct smb_version_operations smb30_operations = {
2792     .dump_share_caps = smb2_dump_share_caps,
2793     .is_oplock_break = smb2_is_valid_oplock_break,
2794     .handle_cancelled_mid = smb2_handle_cancelled_mid,
2795     - .downgrade_oplock = smb2_downgrade_oplock,
2796     + .downgrade_oplock = smb21_downgrade_oplock,
2797     .need_neg = smb2_need_neg,
2798     .negotiate = smb2_negotiate,
2799     .negotiate_wsize = smb2_negotiate_wsize,
2800     @@ -1855,7 +1864,7 @@ struct smb_version_operations smb311_operations = {
2801     .dump_share_caps = smb2_dump_share_caps,
2802     .is_oplock_break = smb2_is_valid_oplock_break,
2803     .handle_cancelled_mid = smb2_handle_cancelled_mid,
2804     - .downgrade_oplock = smb2_downgrade_oplock,
2805     + .downgrade_oplock = smb21_downgrade_oplock,
2806     .need_neg = smb2_need_neg,
2807     .negotiate = smb2_negotiate,
2808     .negotiate_wsize = smb2_negotiate_wsize,
2809     diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
2810     index 108df2e3602c..81be3ba17cbf 100644
2811     --- a/fs/devpts/inode.c
2812     +++ b/fs/devpts/inode.c
2813     @@ -396,6 +396,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
2814     s->s_blocksize_bits = 10;
2815     s->s_magic = DEVPTS_SUPER_MAGIC;
2816     s->s_op = &devpts_sops;
2817     + s->s_d_op = &simple_dentry_operations;
2818     s->s_time_gran = 1;
2819    
2820     error = -ENOMEM;
2821     diff --git a/fs/ext2/super.c b/fs/ext2/super.c
2822     index 6cb042b53b5b..6fcb29b393d3 100644
2823     --- a/fs/ext2/super.c
2824     +++ b/fs/ext2/super.c
2825     @@ -724,7 +724,8 @@ static loff_t ext2_max_size(int bits)
2826     {
2827     loff_t res = EXT2_NDIR_BLOCKS;
2828     int meta_blocks;
2829     - loff_t upper_limit;
2830     + unsigned int upper_limit;
2831     + unsigned int ppb = 1 << (bits-2);
2832    
2833     /* This is calculated to be the largest file size for a
2834     * dense, file such that the total number of
2835     @@ -738,24 +739,34 @@ static loff_t ext2_max_size(int bits)
2836     /* total blocks in file system block size */
2837     upper_limit >>= (bits - 9);
2838    
2839     + /* Compute how many blocks we can address by block tree */
2840     + res += 1LL << (bits-2);
2841     + res += 1LL << (2*(bits-2));
2842     + res += 1LL << (3*(bits-2));
2843     + /* Does block tree limit file size? */
2844     + if (res < upper_limit)
2845     + goto check_lfs;
2846    
2847     + res = upper_limit;
2848     + /* How many metadata blocks are needed for addressing upper_limit? */
2849     + upper_limit -= EXT2_NDIR_BLOCKS;
2850     /* indirect blocks */
2851     meta_blocks = 1;
2852     + upper_limit -= ppb;
2853     /* double indirect blocks */
2854     - meta_blocks += 1 + (1LL << (bits-2));
2855     - /* tripple indirect blocks */
2856     - meta_blocks += 1 + (1LL << (bits-2)) + (1LL << (2*(bits-2)));
2857     -
2858     - upper_limit -= meta_blocks;
2859     - upper_limit <<= bits;
2860     -
2861     - res += 1LL << (bits-2);
2862     - res += 1LL << (2*(bits-2));
2863     - res += 1LL << (3*(bits-2));
2864     + if (upper_limit < ppb * ppb) {
2865     + meta_blocks += 1 + DIV_ROUND_UP(upper_limit, ppb);
2866     + res -= meta_blocks;
2867     + goto check_lfs;
2868     + }
2869     + meta_blocks += 1 + ppb;
2870     + upper_limit -= ppb * ppb;
2871     + /* tripple indirect blocks for the rest */
2872     + meta_blocks += 1 + DIV_ROUND_UP(upper_limit, ppb) +
2873     + DIV_ROUND_UP(upper_limit, ppb*ppb);
2874     + res -= meta_blocks;
2875     +check_lfs:
2876     res <<= bits;
2877     - if (res > upper_limit)
2878     - res = upper_limit;
2879     -
2880     if (res > MAX_LFS_FILESIZE)
2881     res = MAX_LFS_FILESIZE;
2882    
2883     diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
2884     index 58e6b8a03e90..67b359629a66 100644
2885     --- a/fs/ext4/resize.c
2886     +++ b/fs/ext4/resize.c
2887     @@ -1928,7 +1928,8 @@ retry:
2888     le16_to_cpu(es->s_reserved_gdt_blocks);
2889     n_group = n_desc_blocks * EXT4_DESC_PER_BLOCK(sb);
2890     n_blocks_count = (ext4_fsblk_t)n_group *
2891     - EXT4_BLOCKS_PER_GROUP(sb);
2892     + EXT4_BLOCKS_PER_GROUP(sb) +
2893     + le32_to_cpu(es->s_first_data_block);
2894     n_group--; /* set to last group number */
2895     }
2896    
2897     diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
2898     index b320c1ba7fdc..799f96c67211 100644
2899     --- a/fs/jbd2/transaction.c
2900     +++ b/fs/jbd2/transaction.c
2901     @@ -1211,11 +1211,12 @@ int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
2902     struct journal_head *jh;
2903     char *committed_data = NULL;
2904    
2905     - JBUFFER_TRACE(jh, "entry");
2906     if (jbd2_write_access_granted(handle, bh, true))
2907     return 0;
2908    
2909     jh = jbd2_journal_add_journal_head(bh);
2910     + JBUFFER_TRACE(jh, "entry");
2911     +
2912     /*
2913     * Do this first --- it can drop the journal lock, so we want to
2914     * make sure that obtaining the committed_data is done
2915     @@ -1326,15 +1327,17 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
2916    
2917     if (is_handle_aborted(handle))
2918     return -EROFS;
2919     - if (!buffer_jbd(bh)) {
2920     - ret = -EUCLEAN;
2921     - goto out;
2922     - }
2923     + if (!buffer_jbd(bh))
2924     + return -EUCLEAN;
2925     +
2926     /*
2927     * We don't grab jh reference here since the buffer must be part
2928     * of the running transaction.
2929     */
2930     jh = bh2jh(bh);
2931     + jbd_debug(5, "journal_head %p\n", jh);
2932     + JBUFFER_TRACE(jh, "entry");
2933     +
2934     /*
2935     * This and the following assertions are unreliable since we may see jh
2936     * in inconsistent state unless we grab bh_state lock. But this is
2937     @@ -1368,9 +1371,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)
2938     }
2939    
2940     journal = transaction->t_journal;
2941     - jbd_debug(5, "journal_head %p\n", jh);
2942     - JBUFFER_TRACE(jh, "entry");
2943     -
2944     jbd_lock_bh_state(bh);
2945    
2946     if (jh->b_modified == 0) {
2947     @@ -1568,14 +1568,21 @@ int jbd2_journal_forget (handle_t *handle, struct buffer_head *bh)
2948     /* However, if the buffer is still owned by a prior
2949     * (committing) transaction, we can't drop it yet... */
2950     JBUFFER_TRACE(jh, "belongs to older transaction");
2951     - /* ... but we CAN drop it from the new transaction if we
2952     - * have also modified it since the original commit. */
2953     + /* ... but we CAN drop it from the new transaction through
2954     + * marking the buffer as freed and set j_next_transaction to
2955     + * the new transaction, so that not only the commit code
2956     + * knows it should clear dirty bits when it is done with the
2957     + * buffer, but also the buffer can be checkpointed only
2958     + * after the new transaction commits. */
2959    
2960     - if (jh->b_next_transaction) {
2961     - J_ASSERT(jh->b_next_transaction == transaction);
2962     + set_buffer_freed(bh);
2963     +
2964     + if (!jh->b_next_transaction) {
2965     spin_lock(&journal->j_list_lock);
2966     - jh->b_next_transaction = NULL;
2967     + jh->b_next_transaction = transaction;
2968     spin_unlock(&journal->j_list_lock);
2969     + } else {
2970     + J_ASSERT(jh->b_next_transaction == transaction);
2971    
2972     /*
2973     * only drop a reference if this transaction modified
2974     diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
2975     index 892c88542ebd..fad4d5188aaf 100644
2976     --- a/fs/nfs/pagelist.c
2977     +++ b/fs/nfs/pagelist.c
2978     @@ -975,6 +975,17 @@ static void nfs_pageio_doio(struct nfs_pageio_descriptor *desc)
2979     }
2980     }
2981    
2982     +static void
2983     +nfs_pageio_cleanup_request(struct nfs_pageio_descriptor *desc,
2984     + struct nfs_page *req)
2985     +{
2986     + LIST_HEAD(head);
2987     +
2988     + nfs_list_remove_request(req);
2989     + nfs_list_add_request(req, &head);
2990     + desc->pg_completion_ops->error_cleanup(&head);
2991     +}
2992     +
2993     /**
2994     * nfs_pageio_add_request - Attempt to coalesce a request into a page list.
2995     * @desc: destination io descriptor
2996     @@ -1012,10 +1023,8 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
2997     nfs_page_group_unlock(req);
2998     desc->pg_moreio = 1;
2999     nfs_pageio_doio(desc);
3000     - if (desc->pg_error < 0)
3001     - return 0;
3002     - if (mirror->pg_recoalesce)
3003     - return 0;
3004     + if (desc->pg_error < 0 || mirror->pg_recoalesce)
3005     + goto out_cleanup_subreq;
3006     /* retry add_request for this subreq */
3007     nfs_page_group_lock(req, false);
3008     continue;
3009     @@ -1048,6 +1057,10 @@ err_ptr:
3010     desc->pg_error = PTR_ERR(subreq);
3011     nfs_page_group_unlock(req);
3012     return 0;
3013     +out_cleanup_subreq:
3014     + if (req != subreq)
3015     + nfs_pageio_cleanup_request(desc, subreq);
3016     + return 0;
3017     }
3018    
3019     static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc)
3020     @@ -1066,7 +1079,6 @@ static int nfs_do_recoalesce(struct nfs_pageio_descriptor *desc)
3021     struct nfs_page *req;
3022    
3023     req = list_first_entry(&head, struct nfs_page, wb_list);
3024     - nfs_list_remove_request(req);
3025     if (__nfs_pageio_add_request(desc, req))
3026     continue;
3027     if (desc->pg_error < 0) {
3028     @@ -1141,11 +1153,14 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
3029     if (nfs_pgio_has_mirroring(desc))
3030     desc->pg_mirror_idx = midx;
3031     if (!nfs_pageio_add_request_mirror(desc, dupreq))
3032     - goto out_failed;
3033     + goto out_cleanup_subreq;
3034     }
3035    
3036     return 1;
3037    
3038     +out_cleanup_subreq:
3039     + if (req != dupreq)
3040     + nfs_pageio_cleanup_request(desc, dupreq);
3041     out_failed:
3042     /*
3043     * We might have failed before sending any reqs over wire.
3044     @@ -1185,7 +1200,7 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc,
3045     desc->pg_mirror_idx = mirror_idx;
3046     for (;;) {
3047     nfs_pageio_doio(desc);
3048     - if (!mirror->pg_recoalesce)
3049     + if (desc->pg_error < 0 || !mirror->pg_recoalesce)
3050     break;
3051     if (!nfs_do_recoalesce(desc))
3052     break;
3053     diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
3054     index d818e4ffd79f..00b472fe77c1 100644
3055     --- a/fs/nfsd/nfs3proc.c
3056     +++ b/fs/nfsd/nfs3proc.c
3057     @@ -431,8 +431,19 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
3058     &resp->common, nfs3svc_encode_entry);
3059     memcpy(resp->verf, argp->verf, 8);
3060     resp->count = resp->buffer - argp->buffer;
3061     - if (resp->offset)
3062     - xdr_encode_hyper(resp->offset, argp->cookie);
3063     + if (resp->offset) {
3064     + loff_t offset = argp->cookie;
3065     +
3066     + if (unlikely(resp->offset1)) {
3067     + /* we ended up with offset on a page boundary */
3068     + *resp->offset = htonl(offset >> 32);
3069     + *resp->offset1 = htonl(offset & 0xffffffff);
3070     + resp->offset1 = NULL;
3071     + } else {
3072     + xdr_encode_hyper(resp->offset, offset);
3073     + }
3074     + resp->offset = NULL;
3075     + }
3076    
3077     RETURN_STATUS(nfserr);
3078     }
3079     @@ -500,6 +511,7 @@ nfsd3_proc_readdirplus(struct svc_rqst *rqstp, struct nfsd3_readdirargs *argp,
3080     } else {
3081     xdr_encode_hyper(resp->offset, offset);
3082     }
3083     + resp->offset = NULL;
3084     }
3085    
3086     RETURN_STATUS(nfserr);
3087     diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
3088     index 452334694a5d..7e50248ca432 100644
3089     --- a/fs/nfsd/nfs3xdr.c
3090     +++ b/fs/nfsd/nfs3xdr.c
3091     @@ -899,6 +899,7 @@ encode_entry(struct readdir_cd *ccd, const char *name, int namlen,
3092     } else {
3093     xdr_encode_hyper(cd->offset, offset64);
3094     }
3095     + cd->offset = NULL;
3096     }
3097    
3098     /*
3099     diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
3100     index 797a155c9a67..f704f90db36c 100644
3101     --- a/fs/nfsd/nfsctl.c
3102     +++ b/fs/nfsd/nfsctl.c
3103     @@ -1103,7 +1103,7 @@ static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size)
3104     case 'Y':
3105     case 'y':
3106     case '1':
3107     - if (nn->nfsd_serv)
3108     + if (!nn->nfsd_serv)
3109     return -EBUSY;
3110     nfsd4_end_grace(nn);
3111     break;
3112     diff --git a/fs/pipe.c b/fs/pipe.c
3113     index 34345535f63d..388e09a689de 100644
3114     --- a/fs/pipe.c
3115     +++ b/fs/pipe.c
3116     @@ -238,6 +238,14 @@ static const struct pipe_buf_operations anon_pipe_buf_ops = {
3117     .get = generic_pipe_buf_get,
3118     };
3119    
3120     +static const struct pipe_buf_operations anon_pipe_buf_nomerge_ops = {
3121     + .can_merge = 0,
3122     + .confirm = generic_pipe_buf_confirm,
3123     + .release = anon_pipe_buf_release,
3124     + .steal = anon_pipe_buf_steal,
3125     + .get = generic_pipe_buf_get,
3126     +};
3127     +
3128     static const struct pipe_buf_operations packet_pipe_buf_ops = {
3129     .can_merge = 0,
3130     .confirm = generic_pipe_buf_confirm,
3131     @@ -246,6 +254,12 @@ static const struct pipe_buf_operations packet_pipe_buf_ops = {
3132     .get = generic_pipe_buf_get,
3133     };
3134    
3135     +void pipe_buf_mark_unmergeable(struct pipe_buffer *buf)
3136     +{
3137     + if (buf->ops == &anon_pipe_buf_ops)
3138     + buf->ops = &anon_pipe_buf_nomerge_ops;
3139     +}
3140     +
3141     static ssize_t
3142     pipe_read(struct kiocb *iocb, struct iov_iter *to)
3143     {
3144     diff --git a/fs/splice.c b/fs/splice.c
3145     index 8dd79ecfd383..01983bea760c 100644
3146     --- a/fs/splice.c
3147     +++ b/fs/splice.c
3148     @@ -1594,6 +1594,8 @@ retry:
3149     */
3150     obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
3151    
3152     + pipe_buf_mark_unmergeable(obuf);
3153     +
3154     obuf->len = len;
3155     opipe->nrbufs++;
3156     ibuf->offset += obuf->len;
3157     @@ -1668,6 +1670,8 @@ static int link_pipe(struct pipe_inode_info *ipipe,
3158     */
3159     obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
3160    
3161     + pipe_buf_mark_unmergeable(obuf);
3162     +
3163     if (obuf->len > len)
3164     obuf->len = len;
3165    
3166     diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
3167     index ef7962e84444..9661bb2fbe22 100644
3168     --- a/include/linux/device-mapper.h
3169     +++ b/include/linux/device-mapper.h
3170     @@ -627,7 +627,7 @@ extern struct ratelimit_state dm_ratelimit_state;
3171     */
3172     #define dm_target_offset(ti, sector) ((sector) - (ti)->begin)
3173    
3174     -static inline sector_t to_sector(unsigned long n)
3175     +static inline sector_t to_sector(unsigned long long n)
3176     {
3177     return (n >> SECTOR_SHIFT);
3178     }
3179     diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
3180     index e7497c9dde7f..4f7129389855 100644
3181     --- a/include/linux/pipe_fs_i.h
3182     +++ b/include/linux/pipe_fs_i.h
3183     @@ -182,6 +182,7 @@ void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
3184     int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
3185     int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
3186     void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *);
3187     +void pipe_buf_mark_unmergeable(struct pipe_buffer *buf);
3188    
3189     extern const struct pipe_buf_operations nosteal_pipe_buf_ops;
3190    
3191     diff --git a/include/linux/property.h b/include/linux/property.h
3192     index 459337fb44d0..d5c7ebda4113 100644
3193     --- a/include/linux/property.h
3194     +++ b/include/linux/property.h
3195     @@ -233,7 +233,7 @@ struct property_entry {
3196     #define PROPERTY_ENTRY_STRING(_name_, _val_) \
3197     (struct property_entry) { \
3198     .name = _name_, \
3199     - .length = sizeof(_val_), \
3200     + .length = sizeof(const char *), \
3201     .is_string = true, \
3202     { .value = { .str = _val_ } }, \
3203     }
3204     diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h
3205     index b669fe6dbc3b..98f31c7ea23d 100644
3206     --- a/include/net/phonet/pep.h
3207     +++ b/include/net/phonet/pep.h
3208     @@ -63,10 +63,11 @@ struct pnpipehdr {
3209     u8 state_after_reset; /* reset request */
3210     u8 error_code; /* any response */
3211     u8 pep_type; /* status indication */
3212     - u8 data[1];
3213     + u8 data0; /* anything else */
3214     };
3215     + u8 data[];
3216     };
3217     -#define other_pep_type data[1]
3218     +#define other_pep_type data[0]
3219    
3220     static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb)
3221     {
3222     diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
3223     index d1a02877a42c..d0b113de3316 100644
3224     --- a/kernel/rcu/tree.c
3225     +++ b/kernel/rcu/tree.c
3226     @@ -1718,15 +1718,23 @@ static int rcu_future_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp)
3227     }
3228    
3229     /*
3230     - * Awaken the grace-period kthread for the specified flavor of RCU.
3231     - * Don't do a self-awaken, and don't bother awakening when there is
3232     - * nothing for the grace-period kthread to do (as in several CPUs
3233     - * raced to awaken, and we lost), and finally don't try to awaken
3234     - * a kthread that has not yet been created.
3235     + * Awaken the grace-period kthread. Don't do a self-awaken (unless in
3236     + * an interrupt or softirq handler), and don't bother awakening when there
3237     + * is nothing for the grace-period kthread to do (as in several CPUs raced
3238     + * to awaken, and we lost), and finally don't try to awaken a kthread that
3239     + * has not yet been created. If all those checks are passed, track some
3240     + * debug information and awaken.
3241     + *
3242     + * So why do the self-wakeup when in an interrupt or softirq handler
3243     + * in the grace-period kthread's context? Because the kthread might have
3244     + * been interrupted just as it was going to sleep, and just after the final
3245     + * pre-sleep check of the awaken condition. In this case, a wakeup really
3246     + * is required, and is therefore supplied.
3247     */
3248     static void rcu_gp_kthread_wake(struct rcu_state *rsp)
3249     {
3250     - if (current == rsp->gp_kthread ||
3251     + if ((current == rsp->gp_kthread &&
3252     + !in_interrupt() && !in_serving_softirq()) ||
3253     !READ_ONCE(rsp->gp_flags) ||
3254     !rsp->gp_kthread)
3255     return;
3256     diff --git a/kernel/sysctl.c b/kernel/sysctl.c
3257     index 93c7b02279b9..efd340a510a9 100644
3258     --- a/kernel/sysctl.c
3259     +++ b/kernel/sysctl.c
3260     @@ -2377,7 +2377,16 @@ static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp,
3261     {
3262     struct do_proc_dointvec_minmax_conv_param *param = data;
3263     if (write) {
3264     - int val = *negp ? -*lvalp : *lvalp;
3265     + int val;
3266     + if (*negp) {
3267     + if (*lvalp > (unsigned long) INT_MAX + 1)
3268     + return -EINVAL;
3269     + val = -*lvalp;
3270     + } else {
3271     + if (*lvalp > (unsigned long) INT_MAX)
3272     + return -EINVAL;
3273     + val = *lvalp;
3274     + }
3275     if ((param->min && *param->min > val) ||
3276     (param->max && *param->max < val))
3277     return -EINVAL;
3278     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
3279     index 6786c507f1f9..f18dedf9195e 100644
3280     --- a/kernel/trace/trace.c
3281     +++ b/kernel/trace/trace.c
3282     @@ -5057,7 +5057,6 @@ out:
3283     return ret;
3284    
3285     fail:
3286     - kfree(iter->trace);
3287     kfree(iter);
3288     __trace_array_put(tr);
3289     mutex_unlock(&trace_types_lock);
3290     diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
3291     index 0664044ade06..766e5ccad60a 100644
3292     --- a/kernel/trace/trace_events_hist.c
3293     +++ b/kernel/trace/trace_events_hist.c
3294     @@ -871,9 +871,10 @@ static inline void add_to_key(char *compound_key, void *key,
3295     /* ensure NULL-termination */
3296     if (size > key_field->size - 1)
3297     size = key_field->size - 1;
3298     - }
3299    
3300     - memcpy(compound_key + key_field->offset, key, size);
3301     + strncpy(compound_key + key_field->offset, (char *)key, size);
3302     + } else
3303     + memcpy(compound_key + key_field->offset, key, size);
3304     }
3305    
3306     static void event_hist_trigger(struct event_trigger_data *data, void *rec)
3307     diff --git a/lib/assoc_array.c b/lib/assoc_array.c
3308     index 5cd093589c5a..3b46c5433b7a 100644
3309     --- a/lib/assoc_array.c
3310     +++ b/lib/assoc_array.c
3311     @@ -781,9 +781,11 @@ all_leaves_cluster_together:
3312     new_s0->index_key[i] =
3313     ops->get_key_chunk(index_key, i * ASSOC_ARRAY_KEY_CHUNK_SIZE);
3314    
3315     - blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
3316     - pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
3317     - new_s0->index_key[keylen - 1] &= ~blank;
3318     + if (level & ASSOC_ARRAY_KEY_CHUNK_MASK) {
3319     + blank = ULONG_MAX << (level & ASSOC_ARRAY_KEY_CHUNK_MASK);
3320     + pr_devel("blank off [%zu] %d: %lx\n", keylen - 1, level, blank);
3321     + new_s0->index_key[keylen - 1] &= ~blank;
3322     + }
3323    
3324     /* This now reduces to a node splitting exercise for which we'll need
3325     * to regenerate the disparity table.
3326     diff --git a/mm/gup.c b/mm/gup.c
3327     index d71da7216c6e..99c2f10188c0 100644
3328     --- a/mm/gup.c
3329     +++ b/mm/gup.c
3330     @@ -1423,7 +1423,8 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
3331     if (pmd_none(pmd))
3332     return 0;
3333    
3334     - if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd))) {
3335     + if (unlikely(pmd_trans_huge(pmd) || pmd_huge(pmd) ||
3336     + pmd_devmap(pmd))) {
3337     /*
3338     * NUMA hinting faults need to be handled in the GUP
3339     * slowpath for accounting purposes and so that they
3340     diff --git a/mm/memory-failure.c b/mm/memory-failure.c
3341     index 4f1f5fd12042..d6524dce43b2 100644
3342     --- a/mm/memory-failure.c
3343     +++ b/mm/memory-failure.c
3344     @@ -1705,19 +1705,17 @@ static int soft_offline_in_use_page(struct page *page, int flags)
3345     struct page *hpage = compound_head(page);
3346    
3347     if (!PageHuge(page) && PageTransHuge(hpage)) {
3348     - lock_page(hpage);
3349     - if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
3350     - unlock_page(hpage);
3351     - if (!PageAnon(hpage))
3352     + lock_page(page);
3353     + if (!PageAnon(page) || unlikely(split_huge_page(page))) {
3354     + unlock_page(page);
3355     + if (!PageAnon(page))
3356     pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page));
3357     else
3358     pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page));
3359     - put_hwpoison_page(hpage);
3360     + put_hwpoison_page(page);
3361     return -EBUSY;
3362     }
3363     - unlock_page(hpage);
3364     - get_hwpoison_page(page);
3365     - put_hwpoison_page(hpage);
3366     + unlock_page(page);
3367     }
3368    
3369     if (PageHuge(page))
3370     diff --git a/mm/page_alloc.c b/mm/page_alloc.c
3371     index 3af727d95c17..05f141e39ac1 100644
3372     --- a/mm/page_alloc.c
3373     +++ b/mm/page_alloc.c
3374     @@ -3955,11 +3955,11 @@ refill:
3375     /* Even if we own the page, we do not use atomic_set().
3376     * This would break get_page_unless_zero() users.
3377     */
3378     - page_ref_add(page, size - 1);
3379     + page_ref_add(page, size);
3380    
3381     /* reset page count bias and offset to start of new frag */
3382     nc->pfmemalloc = page_is_pfmemalloc(page);
3383     - nc->pagecnt_bias = size;
3384     + nc->pagecnt_bias = size + 1;
3385     nc->offset = size;
3386     }
3387    
3388     @@ -3975,10 +3975,10 @@ refill:
3389     size = nc->size;
3390     #endif
3391     /* OK, page count is 0, we can safely set it */
3392     - set_page_count(page, size);
3393     + set_page_count(page, size + 1);
3394    
3395     /* reset page count bias and offset to start of new frag */
3396     - nc->pagecnt_bias = size;
3397     + nc->pagecnt_bias = size + 1;
3398     offset = size - fragsz;
3399     }
3400    
3401     diff --git a/mm/shmem.c b/mm/shmem.c
3402     index 9b17bd4cbc5e..944242491059 100644
3403     --- a/mm/shmem.c
3404     +++ b/mm/shmem.c
3405     @@ -2896,16 +2896,20 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode,
3406     static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
3407     {
3408     struct inode *inode = d_inode(old_dentry);
3409     - int ret;
3410     + int ret = 0;
3411    
3412     /*
3413     * No ordinary (disk based) filesystem counts links as inodes;
3414     * but each new link needs a new dentry, pinning lowmem, and
3415     * tmpfs dentries cannot be pruned until they are unlinked.
3416     + * But if an O_TMPFILE file is linked into the tmpfs, the
3417     + * first link must skip that, to get the accounting right.
3418     */
3419     - ret = shmem_reserve_inode(inode->i_sb);
3420     - if (ret)
3421     - goto out;
3422     + if (inode->i_nlink) {
3423     + ret = shmem_reserve_inode(inode->i_sb);
3424     + if (ret)
3425     + goto out;
3426     + }
3427    
3428     dir->i_size += BOGO_DIRENT_SIZE;
3429     inode->i_ctime = dir->i_ctime = dir->i_mtime = current_time(inode);
3430     diff --git a/mm/vmalloc.c b/mm/vmalloc.c
3431     index fa598162dbf0..e6aa073f01df 100644
3432     --- a/mm/vmalloc.c
3433     +++ b/mm/vmalloc.c
3434     @@ -2191,7 +2191,7 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
3435     if (!(area->flags & VM_USERMAP))
3436     return -EINVAL;
3437    
3438     - if (kaddr + size > area->addr + area->size)
3439     + if (kaddr + size > area->addr + get_vm_area_size(area))
3440     return -EINVAL;
3441    
3442     do {
3443     diff --git a/net/9p/client.c b/net/9p/client.c
3444     index 142afe70edb9..f1517ca8aba3 100644
3445     --- a/net/9p/client.c
3446     +++ b/net/9p/client.c
3447     @@ -1058,7 +1058,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
3448     p9_debug(P9_DEBUG_ERROR,
3449     "Please specify a msize of at least 4k\n");
3450     err = -EINVAL;
3451     - goto free_client;
3452     + goto close_trans;
3453     }
3454    
3455     err = p9_client_version(clnt);
3456     diff --git a/net/phonet/pep.c b/net/phonet/pep.c
3457     index 850a86cde0b3..f6aa532bcbf6 100644
3458     --- a/net/phonet/pep.c
3459     +++ b/net/phonet/pep.c
3460     @@ -131,7 +131,7 @@ static int pep_indicate(struct sock *sk, u8 id, u8 code,
3461     ph->utid = 0;
3462     ph->message_id = id;
3463     ph->pipe_handle = pn->pipe_handle;
3464     - ph->data[0] = code;
3465     + ph->error_code = code;
3466     return pn_skb_send(sk, skb, NULL);
3467     }
3468    
3469     @@ -152,7 +152,7 @@ static int pipe_handler_request(struct sock *sk, u8 id, u8 code,
3470     ph->utid = id; /* whatever */
3471     ph->message_id = id;
3472     ph->pipe_handle = pn->pipe_handle;
3473     - ph->data[0] = code;
3474     + ph->error_code = code;
3475     return pn_skb_send(sk, skb, NULL);
3476     }
3477    
3478     @@ -207,7 +207,7 @@ static int pep_ctrlreq_error(struct sock *sk, struct sk_buff *oskb, u8 code,
3479     struct pnpipehdr *ph;
3480     struct sockaddr_pn dst;
3481     u8 data[4] = {
3482     - oph->data[0], /* PEP type */
3483     + oph->pep_type, /* PEP type */
3484     code, /* error code, at an unusual offset */
3485     PAD, PAD,
3486     };
3487     @@ -220,7 +220,7 @@ static int pep_ctrlreq_error(struct sock *sk, struct sk_buff *oskb, u8 code,
3488     ph->utid = oph->utid;
3489     ph->message_id = PNS_PEP_CTRL_RESP;
3490     ph->pipe_handle = oph->pipe_handle;
3491     - ph->data[0] = oph->data[1]; /* CTRL id */
3492     + ph->data0 = oph->data[0]; /* CTRL id */
3493    
3494     pn_skb_get_src_sockaddr(oskb, &dst);
3495     return pn_skb_send(sk, skb, &dst);
3496     @@ -271,17 +271,17 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
3497     return -EINVAL;
3498    
3499     hdr = pnp_hdr(skb);
3500     - if (hdr->data[0] != PN_PEP_TYPE_COMMON) {
3501     + if (hdr->pep_type != PN_PEP_TYPE_COMMON) {
3502     net_dbg_ratelimited("Phonet unknown PEP type: %u\n",
3503     - (unsigned int)hdr->data[0]);
3504     + (unsigned int)hdr->pep_type);
3505     return -EOPNOTSUPP;
3506     }
3507    
3508     - switch (hdr->data[1]) {
3509     + switch (hdr->data[0]) {
3510     case PN_PEP_IND_FLOW_CONTROL:
3511     switch (pn->tx_fc) {
3512     case PN_LEGACY_FLOW_CONTROL:
3513     - switch (hdr->data[4]) {
3514     + switch (hdr->data[3]) {
3515     case PEP_IND_BUSY:
3516     atomic_set(&pn->tx_credits, 0);
3517     break;
3518     @@ -291,7 +291,7 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
3519     }
3520     break;
3521     case PN_ONE_CREDIT_FLOW_CONTROL:
3522     - if (hdr->data[4] == PEP_IND_READY)
3523     + if (hdr->data[3] == PEP_IND_READY)
3524     atomic_set(&pn->tx_credits, wake = 1);
3525     break;
3526     }
3527     @@ -300,12 +300,12 @@ static int pipe_rcv_status(struct sock *sk, struct sk_buff *skb)
3528     case PN_PEP_IND_ID_MCFC_GRANT_CREDITS:
3529     if (pn->tx_fc != PN_MULTI_CREDIT_FLOW_CONTROL)
3530     break;
3531     - atomic_add(wake = hdr->data[4], &pn->tx_credits);
3532     + atomic_add(wake = hdr->data[3], &pn->tx_credits);
3533     break;
3534    
3535     default:
3536     net_dbg_ratelimited("Phonet unknown PEP indication: %u\n",
3537     - (unsigned int)hdr->data[1]);
3538     + (unsigned int)hdr->data[0]);
3539     return -EOPNOTSUPP;
3540     }
3541     if (wake)
3542     @@ -317,7 +317,7 @@ static int pipe_rcv_created(struct sock *sk, struct sk_buff *skb)
3543     {
3544     struct pep_sock *pn = pep_sk(sk);
3545     struct pnpipehdr *hdr = pnp_hdr(skb);
3546     - u8 n_sb = hdr->data[0];
3547     + u8 n_sb = hdr->data0;
3548    
3549     pn->rx_fc = pn->tx_fc = PN_LEGACY_FLOW_CONTROL;
3550     __skb_pull(skb, sizeof(*hdr));
3551     @@ -505,7 +505,7 @@ static int pep_connresp_rcv(struct sock *sk, struct sk_buff *skb)
3552     return -ECONNREFUSED;
3553    
3554     /* Parse sub-blocks */
3555     - n_sb = hdr->data[4];
3556     + n_sb = hdr->data[3];
3557     while (n_sb > 0) {
3558     u8 type, buf[6], len = sizeof(buf);
3559     const u8 *data = pep_get_sb(skb, &type, &len, buf);
3560     @@ -738,7 +738,7 @@ static int pipe_do_remove(struct sock *sk)
3561     ph->utid = 0;
3562     ph->message_id = PNS_PIPE_REMOVE_REQ;
3563     ph->pipe_handle = pn->pipe_handle;
3564     - ph->data[0] = PAD;
3565     + ph->data0 = PAD;
3566     return pn_skb_send(sk, skb, NULL);
3567     }
3568    
3569     @@ -815,7 +815,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp)
3570     peer_type = hdr->other_pep_type << 8;
3571    
3572     /* Parse sub-blocks (options) */
3573     - n_sb = hdr->data[4];
3574     + n_sb = hdr->data[3];
3575     while (n_sb > 0) {
3576     u8 type, buf[1], len = sizeof(buf);
3577     const u8 *data = pep_get_sb(skb, &type, &len, buf);
3578     @@ -1106,7 +1106,7 @@ static int pipe_skb_send(struct sock *sk, struct sk_buff *skb)
3579     ph->utid = 0;
3580     if (pn->aligned) {
3581     ph->message_id = PNS_PIPE_ALIGNED_DATA;
3582     - ph->data[0] = 0; /* padding */
3583     + ph->data0 = 0; /* padding */
3584     } else
3585     ph->message_id = PNS_PIPE_DATA;
3586     ph->pipe_handle = pn->pipe_handle;
3587     diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
3588     index 3ef174531344..23ab0d169c11 100644
3589     --- a/sound/soc/fsl/fsl_esai.c
3590     +++ b/sound/soc/fsl/fsl_esai.c
3591     @@ -396,7 +396,8 @@ static int fsl_esai_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
3592     break;
3593     case SND_SOC_DAIFMT_RIGHT_J:
3594     /* Data on rising edge of bclk, frame high, right aligned */
3595     - xccr |= ESAI_xCCR_xCKP | ESAI_xCCR_xHCKP | ESAI_xCR_xWA;
3596     + xccr |= ESAI_xCCR_xCKP | ESAI_xCCR_xHCKP;
3597     + xcr |= ESAI_xCR_xWA;
3598     break;
3599     case SND_SOC_DAIFMT_DSP_A:
3600     /* Data on rising edge of bclk, frame high, 1clk before data */
3601     @@ -453,12 +454,12 @@ static int fsl_esai_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
3602     return -EINVAL;
3603     }
3604    
3605     - mask = ESAI_xCR_xFSL | ESAI_xCR_xFSR;
3606     + mask = ESAI_xCR_xFSL | ESAI_xCR_xFSR | ESAI_xCR_xWA;
3607     regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, mask, xcr);
3608     regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, mask, xcr);
3609    
3610     mask = ESAI_xCCR_xCKP | ESAI_xCCR_xHCKP | ESAI_xCCR_xFSP |
3611     - ESAI_xCCR_xFSD | ESAI_xCCR_xCKD | ESAI_xCR_xWA;
3612     + ESAI_xCCR_xFSD | ESAI_xCCR_xCKD;
3613     regmap_update_bits(esai_priv->regmap, REG_ESAI_TCCR, mask, xccr);
3614     regmap_update_bits(esai_priv->regmap, REG_ESAI_RCCR, mask, xccr);
3615    
3616     diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
3617     index d6b48c796bfc..086fe4d27f60 100644
3618     --- a/sound/soc/soc-topology.c
3619     +++ b/sound/soc/soc-topology.c
3620     @@ -1989,6 +1989,7 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
3621     struct snd_soc_tplg_ops *ops, const struct firmware *fw, u32 id)
3622     {
3623     struct soc_tplg tplg;
3624     + int ret;
3625    
3626     /* setup parsing context */
3627     memset(&tplg, 0, sizeof(tplg));
3628     @@ -2002,7 +2003,12 @@ int snd_soc_tplg_component_load(struct snd_soc_component *comp,
3629     tplg.bytes_ext_ops = ops->bytes_ext_ops;
3630     tplg.bytes_ext_ops_count = ops->bytes_ext_ops_count;
3631    
3632     - return soc_tplg_load(&tplg);
3633     + ret = soc_tplg_load(&tplg);
3634     + /* free the created components if fail to load topology */
3635     + if (ret)
3636     + snd_soc_tplg_component_remove(comp, SND_SOC_TPLG_INDEX_ALL);
3637     +
3638     + return ret;
3639     }
3640     EXPORT_SYMBOL_GPL(snd_soc_tplg_component_load);
3641    
3642     diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c
3643     index 29d015e2d900..b87221efdf7e 100644
3644     --- a/tools/perf/util/auxtrace.c
3645     +++ b/tools/perf/util/auxtrace.c
3646     @@ -1244,9 +1244,9 @@ static int __auxtrace_mmap__read(struct auxtrace_mmap *mm,
3647     }
3648    
3649     /* padding must be written by fn() e.g. record__process_auxtrace() */
3650     - padding = size & 7;
3651     + padding = size & (PERF_AUXTRACE_RECORD_ALIGNMENT - 1);
3652     if (padding)
3653     - padding = 8 - padding;
3654     + padding = PERF_AUXTRACE_RECORD_ALIGNMENT - padding;
3655    
3656     memset(&ev, 0, sizeof(ev));
3657     ev.auxtrace.header.type = PERF_RECORD_AUXTRACE;
3658     diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
3659     index 26fb1ee5746a..1b6963e09934 100644
3660     --- a/tools/perf/util/auxtrace.h
3661     +++ b/tools/perf/util/auxtrace.h
3662     @@ -37,6 +37,9 @@ struct record_opts;
3663     struct auxtrace_info_event;
3664     struct events_stats;
3665    
3666     +/* Auxtrace records must have the same alignment as perf event records */
3667     +#define PERF_AUXTRACE_RECORD_ALIGNMENT 8
3668     +
3669     enum auxtrace_type {
3670     PERF_AUXTRACE_UNKNOWN,
3671     PERF_AUXTRACE_INTEL_PT,
3672     diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3673     index d27715ff9a5f..94764efb0a6a 100644
3674     --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3675     +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3676     @@ -26,6 +26,7 @@
3677    
3678     #include "../cache.h"
3679     #include "../util.h"
3680     +#include "../auxtrace.h"
3681    
3682     #include "intel-pt-insn-decoder.h"
3683     #include "intel-pt-pkt-decoder.h"
3684     @@ -1311,7 +1312,6 @@ static int intel_pt_overflow(struct intel_pt_decoder *decoder)
3685     {
3686     intel_pt_log("ERROR: Buffer overflow\n");
3687     intel_pt_clear_tx_flags(decoder);
3688     - decoder->cbr = 0;
3689     decoder->timestamp_insn_cnt = 0;
3690     decoder->pkt_state = INTEL_PT_STATE_ERR_RESYNC;
3691     decoder->overflow = true;
3692     @@ -2351,6 +2351,34 @@ static int intel_pt_tsc_cmp(uint64_t tsc1, uint64_t tsc2)
3693     }
3694     }
3695    
3696     +#define MAX_PADDING (PERF_AUXTRACE_RECORD_ALIGNMENT - 1)
3697     +
3698     +/**
3699     + * adj_for_padding - adjust overlap to account for padding.
3700     + * @buf_b: second buffer
3701     + * @buf_a: first buffer
3702     + * @len_a: size of first buffer
3703     + *
3704     + * @buf_a might have up to 7 bytes of padding appended. Adjust the overlap
3705     + * accordingly.
3706     + *
3707     + * Return: A pointer into @buf_b from where non-overlapped data starts
3708     + */
3709     +static unsigned char *adj_for_padding(unsigned char *buf_b,
3710     + unsigned char *buf_a, size_t len_a)
3711     +{
3712     + unsigned char *p = buf_b - MAX_PADDING;
3713     + unsigned char *q = buf_a + len_a - MAX_PADDING;
3714     + int i;
3715     +
3716     + for (i = MAX_PADDING; i; i--, p++, q++) {
3717     + if (*p != *q)
3718     + break;
3719     + }
3720     +
3721     + return p;
3722     +}
3723     +
3724     /**
3725     * intel_pt_find_overlap_tsc - determine start of non-overlapped trace data
3726     * using TSC.
3727     @@ -2401,8 +2429,11 @@ static unsigned char *intel_pt_find_overlap_tsc(unsigned char *buf_a,
3728    
3729     /* Same TSC, so buffers are consecutive */
3730     if (!cmp && rem_b >= rem_a) {
3731     + unsigned char *start;
3732     +
3733     *consecutive = true;
3734     - return buf_b + len_b - (rem_b - rem_a);
3735     + start = buf_b + len_b - (rem_b - rem_a);
3736     + return adj_for_padding(start, buf_a, len_a);
3737     }
3738     if (cmp < 0)
3739     return buf_b; /* tsc_a < tsc_b => no overlap */
3740     @@ -2465,7 +2496,7 @@ unsigned char *intel_pt_find_overlap(unsigned char *buf_a, size_t len_a,
3741     found = memmem(buf_a, len_a, buf_b, len_a);
3742     if (found) {
3743     *consecutive = true;
3744     - return buf_b + len_a;
3745     + return adj_for_padding(buf_b + len_a, buf_a, len_a);
3746     }
3747    
3748     /* Try again at next PSB in buffer 'a' */
3749     diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
3750     index d40ab4cf8932..24c6621e2d95 100644
3751     --- a/tools/perf/util/intel-pt.c
3752     +++ b/tools/perf/util/intel-pt.c
3753     @@ -2259,6 +2259,8 @@ int intel_pt_process_auxtrace_info(union perf_event *event,
3754     }
3755    
3756     pt->timeless_decoding = intel_pt_timeless_decoding(pt);
3757     + if (pt->timeless_decoding && !pt->tc.time_mult)
3758     + pt->tc.time_mult = 1;
3759     pt->have_tsc = intel_pt_have_tsc(pt);
3760     pt->sampling_mode = false;
3761     pt->est_tsc = !pt->timeless_decoding;