Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0127-4.9.28-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (show annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 8 months ago) by niro
File size: 131781 byte(s)
-added kerenl-alx-legacy pkg
1 diff --git a/Makefile b/Makefile
2 index 35d6b4e76264..9460a63087b8 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 27
9 +SUBLEVEL = 28
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/boot/dts/bcm958522er.dts b/arch/arm/boot/dts/bcm958522er.dts
14 index a21b0fd21f4e..417f65738402 100644
15 --- a/arch/arm/boot/dts/bcm958522er.dts
16 +++ b/arch/arm/boot/dts/bcm958522er.dts
17 @@ -55,6 +55,7 @@
18 gpio-restart {
19 compatible = "gpio-restart";
20 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
21 + open-source;
22 priority = <200>;
23 };
24 };
25 diff --git a/arch/arm/boot/dts/bcm958525er.dts b/arch/arm/boot/dts/bcm958525er.dts
26 index be7f2f8ecf39..5279b769fdfc 100644
27 --- a/arch/arm/boot/dts/bcm958525er.dts
28 +++ b/arch/arm/boot/dts/bcm958525er.dts
29 @@ -55,6 +55,7 @@
30 gpio-restart {
31 compatible = "gpio-restart";
32 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
33 + open-source;
34 priority = <200>;
35 };
36 };
37 diff --git a/arch/arm/boot/dts/bcm958525xmc.dts b/arch/arm/boot/dts/bcm958525xmc.dts
38 index 959cde911c3c..872882bd01bc 100644
39 --- a/arch/arm/boot/dts/bcm958525xmc.dts
40 +++ b/arch/arm/boot/dts/bcm958525xmc.dts
41 @@ -55,6 +55,7 @@
42 gpio-restart {
43 compatible = "gpio-restart";
44 gpios = <&gpioa 31 GPIO_ACTIVE_LOW>;
45 + open-source;
46 priority = <200>;
47 };
48 };
49 diff --git a/arch/arm/boot/dts/bcm958622hr.dts b/arch/arm/boot/dts/bcm958622hr.dts
50 index ad2aa87dd15a..a340e1d93a58 100644
51 --- a/arch/arm/boot/dts/bcm958622hr.dts
52 +++ b/arch/arm/boot/dts/bcm958622hr.dts
53 @@ -55,6 +55,7 @@
54 gpio-restart {
55 compatible = "gpio-restart";
56 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
57 + open-source;
58 priority = <200>;
59 };
60 };
61 diff --git a/arch/arm/boot/dts/bcm958623hr.dts b/arch/arm/boot/dts/bcm958623hr.dts
62 index 4ceb8fef8041..226b652ccdc8 100644
63 --- a/arch/arm/boot/dts/bcm958623hr.dts
64 +++ b/arch/arm/boot/dts/bcm958623hr.dts
65 @@ -55,6 +55,7 @@
66 gpio-restart {
67 compatible = "gpio-restart";
68 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
69 + open-source;
70 priority = <200>;
71 };
72 };
73 diff --git a/arch/arm/boot/dts/bcm958625hr.dts b/arch/arm/boot/dts/bcm958625hr.dts
74 index 442002597063..a1658d0721b8 100644
75 --- a/arch/arm/boot/dts/bcm958625hr.dts
76 +++ b/arch/arm/boot/dts/bcm958625hr.dts
77 @@ -55,6 +55,7 @@
78 gpio-restart {
79 compatible = "gpio-restart";
80 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
81 + open-source;
82 priority = <200>;
83 };
84 };
85 diff --git a/arch/arm/boot/dts/bcm988312hr.dts b/arch/arm/boot/dts/bcm988312hr.dts
86 index 104afe98a43b..ed05e33d56de 100644
87 --- a/arch/arm/boot/dts/bcm988312hr.dts
88 +++ b/arch/arm/boot/dts/bcm988312hr.dts
89 @@ -55,6 +55,7 @@
90 gpio-restart {
91 compatible = "gpio-restart";
92 gpios = <&gpioa 15 GPIO_ACTIVE_LOW>;
93 + open-source;
94 priority = <200>;
95 };
96 };
97 diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
98 index 2e375576ffd0..76f4e8921d58 100644
99 --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
100 +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
101 @@ -65,13 +65,13 @@
102 cxo_board {
103 compatible = "fixed-clock";
104 #clock-cells = <0>;
105 - clock-frequency = <19200000>;
106 + clock-frequency = <25000000>;
107 };
108
109 pxo_board {
110 compatible = "fixed-clock";
111 #clock-cells = <0>;
112 - clock-frequency = <27000000>;
113 + clock-frequency = <25000000>;
114 };
115
116 sleep_clk: sleep_clk {
117 diff --git a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
118 index 73c05dab0a69..e00539ae1b8a 100644
119 --- a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
120 +++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
121 @@ -167,7 +167,7 @@
122 reg = <8>;
123 label = "cpu";
124 ethernet = <&gmac>;
125 - phy-mode = "rgmii";
126 + phy-mode = "rgmii-txid";
127 fixed-link {
128 speed = <1000>;
129 full-duplex;
130 diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
131 index fe36ce2734d4..4c6f14cf92a8 100644
132 --- a/arch/arm/mach-omap2/omap-headsmp.S
133 +++ b/arch/arm/mach-omap2/omap-headsmp.S
134 @@ -17,6 +17,7 @@
135
136 #include <linux/linkage.h>
137 #include <linux/init.h>
138 +#include <asm/assembler.h>
139
140 #include "omap44xx.h"
141
142 @@ -66,7 +67,7 @@ wait_2: ldr r2, =AUX_CORE_BOOT0_PA @ read from AuxCoreBoot0
143 cmp r0, r4
144 bne wait_2
145 ldr r12, =API_HYP_ENTRY
146 - adr r0, hyp_boot
147 + badr r0, hyp_boot
148 smc #0
149 hyp_boot:
150 b omap_secondary_startup
151 diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
152 index 8c15040f2540..9536f2013bf4 100644
153 --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
154 +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
155 @@ -553,6 +553,7 @@
156 phy-mode = "rgmii-id";
157 #address-cells = <1>;
158 #size-cells = <0>;
159 + status = "disabled";
160 };
161
162 can0: can@e6c30000 {
163 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
164 index ffbb9a520563..61e214015b38 100644
165 --- a/arch/arm64/include/asm/pgtable.h
166 +++ b/arch/arm64/include/asm/pgtable.h
167 @@ -71,9 +71,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
168 #define pte_young(pte) (!!(pte_val(pte) & PTE_AF))
169 #define pte_special(pte) (!!(pte_val(pte) & PTE_SPECIAL))
170 #define pte_write(pte) (!!(pte_val(pte) & PTE_WRITE))
171 -#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
172 +#define pte_user_exec(pte) (!(pte_val(pte) & PTE_UXN))
173 #define pte_cont(pte) (!!(pte_val(pte) & PTE_CONT))
174 -#define pte_ng(pte) (!!(pte_val(pte) & PTE_NG))
175
176 #ifdef CONFIG_ARM64_HW_AFDBM
177 #define pte_hw_dirty(pte) (pte_write(pte) && !(pte_val(pte) & PTE_RDONLY))
178 @@ -84,8 +83,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
179 #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte))
180
181 #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID))
182 -#define pte_valid_global(pte) \
183 - ((pte_val(pte) & (PTE_VALID | PTE_NG)) == PTE_VALID)
184 +/*
185 + * Execute-only user mappings do not have the PTE_USER bit set. All valid
186 + * kernel mappings have the PTE_UXN bit set.
187 + */
188 +#define pte_valid_not_user(pte) \
189 + ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN))
190 #define pte_valid_young(pte) \
191 ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF))
192
193 @@ -178,7 +181,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
194 * Only if the new pte is valid and kernel, otherwise TLB maintenance
195 * or update_mmu_cache() have the necessary barriers.
196 */
197 - if (pte_valid_global(pte)) {
198 + if (pte_valid_not_user(pte)) {
199 dsb(ishst);
200 isb();
201 }
202 @@ -212,7 +215,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
203 pte_val(pte) &= ~PTE_RDONLY;
204 else
205 pte_val(pte) |= PTE_RDONLY;
206 - if (pte_ng(pte) && pte_exec(pte) && !pte_special(pte))
207 + if (pte_user_exec(pte) && !pte_special(pte))
208 __sync_icache_dcache(pte, addr);
209 }
210
211 diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
212 index b2fc97a2c56c..9c4b57a7b265 100644
213 --- a/arch/arm64/net/bpf_jit_comp.c
214 +++ b/arch/arm64/net/bpf_jit_comp.c
215 @@ -779,14 +779,14 @@ static int build_body(struct jit_ctx *ctx)
216 int ret;
217
218 ret = build_insn(insn, ctx);
219 -
220 - if (ctx->image == NULL)
221 - ctx->offset[i] = ctx->idx;
222 -
223 if (ret > 0) {
224 i++;
225 + if (ctx->image == NULL)
226 + ctx->offset[i] = ctx->idx;
227 continue;
228 }
229 + if (ctx->image == NULL)
230 + ctx->offset[i] = ctx->idx;
231 if (ret)
232 return ret;
233 }
234 diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-r2-to-r6-emul.c
235 index bd09853aecdf..d8227f289d7f 100644
236 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
237 +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
238 @@ -433,8 +433,8 @@ static int multu_func(struct pt_regs *regs, u32 ir)
239 rs = regs->regs[MIPSInst_RS(ir)];
240 res = (u64)rt * (u64)rs;
241 rt = res;
242 - regs->lo = (s64)rt;
243 - regs->hi = (s64)(res >> 32);
244 + regs->lo = (s64)(s32)rt;
245 + regs->hi = (s64)(s32)(res >> 32);
246
247 MIPS_R2_STATS(muls);
248
249 @@ -670,9 +670,9 @@ static int maddu_func(struct pt_regs *regs, u32 ir)
250 res += ((((s64)rt) << 32) | (u32)rs);
251
252 rt = res;
253 - regs->lo = (s64)rt;
254 + regs->lo = (s64)(s32)rt;
255 rs = res >> 32;
256 - regs->hi = (s64)rs;
257 + regs->hi = (s64)(s32)rs;
258
259 MIPS_R2_STATS(dsps);
260
261 @@ -728,9 +728,9 @@ static int msubu_func(struct pt_regs *regs, u32 ir)
262 res = ((((s64)rt) << 32) | (u32)rs) - res;
263
264 rt = res;
265 - regs->lo = (s64)rt;
266 + regs->lo = (s64)(s32)rt;
267 rs = res >> 32;
268 - regs->hi = (s64)rs;
269 + regs->hi = (s64)(s32)rs;
270
271 MIPS_R2_STATS(dsps);
272
273 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
274 index 65fba4c34cd7..8f01f21e78f1 100644
275 --- a/arch/powerpc/Kconfig
276 +++ b/arch/powerpc/Kconfig
277 @@ -388,8 +388,8 @@ config DISABLE_MPROFILE_KERNEL
278 be disabled also.
279
280 If you have a toolchain which supports mprofile-kernel, then you can
281 - enable this. Otherwise leave it disabled. If you're not sure, say
282 - "N".
283 + disable this. Otherwise leave it enabled. If you're not sure, say
284 + "Y".
285
286 config MPROFILE_KERNEL
287 depends on PPC64 && CPU_LITTLE_ENDIAN
288 diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
289 index 13f5fad21066..e7d9eca53af3 100644
290 --- a/arch/powerpc/include/asm/reg.h
291 +++ b/arch/powerpc/include/asm/reg.h
292 @@ -337,7 +337,7 @@
293 #define LPCR_DPFD_SH 52
294 #define LPCR_DPFD (ASM_CONST(7) << LPCR_DPFD_SH)
295 #define LPCR_VRMASD_SH 47
296 -#define LPCR_VRMASD (ASM_CONST(1) << LPCR_VRMASD_SH)
297 +#define LPCR_VRMASD (ASM_CONST(0x1f) << LPCR_VRMASD_SH)
298 #define LPCR_VRMA_L ASM_CONST(0x0008000000000000)
299 #define LPCR_VRMA_LP0 ASM_CONST(0x0001000000000000)
300 #define LPCR_VRMA_LP1 ASM_CONST(0x0000800000000000)
301 diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
302 index 1925341dbb9c..adb52d101133 100644
303 --- a/arch/powerpc/kernel/Makefile
304 +++ b/arch/powerpc/kernel/Makefile
305 @@ -15,7 +15,7 @@ CFLAGS_btext.o += -fPIC
306 endif
307
308 CFLAGS_cputable.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
309 -CFLAGS_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
310 +CFLAGS_prom_init.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
311 CFLAGS_btext.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
312 CFLAGS_prom.o += $(DISABLE_LATENT_ENTROPY_PLUGIN)
313
314 diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S
315 index 44d2d842cee7..483d8c05d11a 100644
316 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S
317 +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S
318 @@ -146,7 +146,7 @@ opal_tracepoint_entry:
319 opal_tracepoint_return:
320 std r3,STK_REG(R31)(r1)
321 mr r4,r3
322 - ld r0,STK_REG(R23)(r1)
323 + ld r3,STK_REG(R23)(r1)
324 bl __trace_opal_exit
325 ld r3,STK_REG(R31)(r1)
326 addi r1,r1,STACKFRAMESIZE
327 diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
328 index 6aa3da152c20..9835152a0682 100644
329 --- a/arch/sparc/kernel/head_64.S
330 +++ b/arch/sparc/kernel/head_64.S
331 @@ -935,3 +935,9 @@ ENTRY(__retl_o1)
332 retl
333 mov %o1, %o0
334 ENDPROC(__retl_o1)
335 +
336 +ENTRY(__retl_o1_asi)
337 + wr %o5, 0x0, %asi
338 + retl
339 + mov %o1, %o0
340 +ENDPROC(__retl_o1_asi)
341 diff --git a/arch/sparc/lib/GENbzero.S b/arch/sparc/lib/GENbzero.S
342 index 8e7a843ddd88..2fbf6297d57c 100644
343 --- a/arch/sparc/lib/GENbzero.S
344 +++ b/arch/sparc/lib/GENbzero.S
345 @@ -8,7 +8,7 @@
346 98: x,y; \
347 .section __ex_table,"a";\
348 .align 4; \
349 - .word 98b, __retl_o1; \
350 + .word 98b, __retl_o1_asi;\
351 .text; \
352 .align 4;
353
354 diff --git a/arch/sparc/lib/NGbzero.S b/arch/sparc/lib/NGbzero.S
355 index beab29bf419b..33053bdf3766 100644
356 --- a/arch/sparc/lib/NGbzero.S
357 +++ b/arch/sparc/lib/NGbzero.S
358 @@ -8,7 +8,7 @@
359 98: x,y; \
360 .section __ex_table,"a";\
361 .align 4; \
362 - .word 98b, __retl_o1; \
363 + .word 98b, __retl_o1_asi;\
364 .text; \
365 .align 4;
366
367 diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c
368 index c5047b8f777b..df60b58691e7 100644
369 --- a/arch/x86/events/intel/pt.c
370 +++ b/arch/x86/events/intel/pt.c
371 @@ -106,18 +106,24 @@ static struct attribute_group pt_cap_group = {
372 };
373
374 PMU_FORMAT_ATTR(cyc, "config:1" );
375 +PMU_FORMAT_ATTR(pwr_evt, "config:4" );
376 +PMU_FORMAT_ATTR(fup_on_ptw, "config:5" );
377 PMU_FORMAT_ATTR(mtc, "config:9" );
378 PMU_FORMAT_ATTR(tsc, "config:10" );
379 PMU_FORMAT_ATTR(noretcomp, "config:11" );
380 +PMU_FORMAT_ATTR(ptw, "config:12" );
381 PMU_FORMAT_ATTR(mtc_period, "config:14-17" );
382 PMU_FORMAT_ATTR(cyc_thresh, "config:19-22" );
383 PMU_FORMAT_ATTR(psb_period, "config:24-27" );
384
385 static struct attribute *pt_formats_attr[] = {
386 &format_attr_cyc.attr,
387 + &format_attr_pwr_evt.attr,
388 + &format_attr_fup_on_ptw.attr,
389 &format_attr_mtc.attr,
390 &format_attr_tsc.attr,
391 &format_attr_noretcomp.attr,
392 + &format_attr_ptw.attr,
393 &format_attr_mtc_period.attr,
394 &format_attr_cyc_thresh.attr,
395 &format_attr_psb_period.attr,
396 diff --git a/arch/x86/include/asm/xen/events.h b/arch/x86/include/asm/xen/events.h
397 index 608a79d5a466..e6911caf5bbf 100644
398 --- a/arch/x86/include/asm/xen/events.h
399 +++ b/arch/x86/include/asm/xen/events.h
400 @@ -20,4 +20,15 @@ static inline int xen_irqs_disabled(struct pt_regs *regs)
401 /* No need for a barrier -- XCHG is a barrier on x86. */
402 #define xchg_xen_ulong(ptr, val) xchg((ptr), (val))
403
404 +extern int xen_have_vector_callback;
405 +
406 +/*
407 + * Events delivered via platform PCI interrupts are always
408 + * routed to vcpu 0 and hence cannot be rebound.
409 + */
410 +static inline bool xen_support_evtchn_rebind(void)
411 +{
412 + return (!xen_hvm_domain() || xen_have_vector_callback);
413 +}
414 +
415 #endif /* _ASM_X86_XEN_EVENTS_H */
416 diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
417 index d1e25564b3c1..7249f1500bcb 100644
418 --- a/arch/x86/kernel/apic/io_apic.c
419 +++ b/arch/x86/kernel/apic/io_apic.c
420 @@ -1876,6 +1876,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
421 .irq_ack = irq_chip_ack_parent,
422 .irq_eoi = ioapic_ack_level,
423 .irq_set_affinity = ioapic_set_affinity,
424 + .irq_retrigger = irq_chip_retrigger_hierarchy,
425 .flags = IRQCHIP_SKIP_SET_WAKE,
426 };
427
428 @@ -1887,6 +1888,7 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
429 .irq_ack = irq_chip_ack_parent,
430 .irq_eoi = ioapic_ir_ack_level,
431 .irq_set_affinity = ioapic_set_affinity,
432 + .irq_retrigger = irq_chip_retrigger_hierarchy,
433 .flags = IRQCHIP_SKIP_SET_WAKE,
434 };
435
436 diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
437 index c6ee63f927ab..d688826e5736 100644
438 --- a/arch/x86/kernel/kprobes/common.h
439 +++ b/arch/x86/kernel/kprobes/common.h
440 @@ -67,7 +67,7 @@
441 #endif
442
443 /* Ensure if the instruction can be boostable */
444 -extern int can_boost(kprobe_opcode_t *instruction);
445 +extern int can_boost(kprobe_opcode_t *instruction, void *addr);
446 /* Recover instruction if given address is probed */
447 extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf,
448 unsigned long addr);
449 diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
450 index d9d8d16b69db..b55d07b9d530 100644
451 --- a/arch/x86/kernel/kprobes/core.c
452 +++ b/arch/x86/kernel/kprobes/core.c
453 @@ -166,12 +166,12 @@ NOKPROBE_SYMBOL(skip_prefixes);
454 * Returns non-zero if opcode is boostable.
455 * RIP relative instructions are adjusted at copying time in 64 bits mode
456 */
457 -int can_boost(kprobe_opcode_t *opcodes)
458 +int can_boost(kprobe_opcode_t *opcodes, void *addr)
459 {
460 kprobe_opcode_t opcode;
461 kprobe_opcode_t *orig_opcodes = opcodes;
462
463 - if (search_exception_tables((unsigned long)opcodes))
464 + if (search_exception_tables((unsigned long)addr))
465 return 0; /* Page fault may occur on this address. */
466
467 retry:
468 @@ -416,7 +416,7 @@ static int arch_copy_kprobe(struct kprobe *p)
469 * __copy_instruction can modify the displacement of the instruction,
470 * but it doesn't affect boostable check.
471 */
472 - if (can_boost(p->ainsn.insn))
473 + if (can_boost(p->ainsn.insn, p->addr))
474 p->ainsn.boostable = 0;
475 else
476 p->ainsn.boostable = -1;
477 diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
478 index 3bb4c5f021f6..4d74f7386a61 100644
479 --- a/arch/x86/kernel/kprobes/opt.c
480 +++ b/arch/x86/kernel/kprobes/opt.c
481 @@ -178,7 +178,7 @@ static int copy_optimized_instructions(u8 *dest, u8 *src)
482
483 while (len < RELATIVEJUMP_SIZE) {
484 ret = __copy_instruction(dest + len, src + len);
485 - if (!ret || !can_boost(dest + len))
486 + if (!ret || !can_boost(dest + len, src + len))
487 return -EINVAL;
488 len += ret;
489 }
490 diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
491 index 5d400ba1349d..d47517941bbc 100644
492 --- a/arch/x86/kernel/pci-calgary_64.c
493 +++ b/arch/x86/kernel/pci-calgary_64.c
494 @@ -296,7 +296,7 @@ static void iommu_free(struct iommu_table *tbl, dma_addr_t dma_addr,
495
496 /* were we called with bad_dma_address? */
497 badend = DMA_ERROR_CODE + (EMERGENCY_PAGES * PAGE_SIZE);
498 - if (unlikely((dma_addr >= DMA_ERROR_CODE) && (dma_addr < badend))) {
499 + if (unlikely(dma_addr < badend)) {
500 WARN(1, KERN_ERR "Calgary: driver tried unmapping bad DMA "
501 "address 0x%Lx\n", dma_addr);
502 return;
503 diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
504 index afa7bbb596cd..967e459ff1e6 100644
505 --- a/arch/x86/kvm/cpuid.c
506 +++ b/arch/x86/kvm/cpuid.c
507 @@ -846,12 +846,6 @@ void kvm_cpuid(struct kvm_vcpu *vcpu, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
508 if (!best)
509 best = check_cpuid_limit(vcpu, function, index);
510
511 - /*
512 - * Perfmon not yet supported for L2 guest.
513 - */
514 - if (is_guest_mode(vcpu) && function == 0xa)
515 - best = NULL;
516 -
517 if (best) {
518 *eax = best->eax;
519 *ebx = best->ebx;
520 diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
521 index 43b55ef82bac..89b98e07211f 100644
522 --- a/arch/x86/kvm/vmx.c
523 +++ b/arch/x86/kvm/vmx.c
524 @@ -8051,8 +8051,6 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
525 case EXIT_REASON_TASK_SWITCH:
526 return true;
527 case EXIT_REASON_CPUID:
528 - if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa)
529 - return false;
530 return true;
531 case EXIT_REASON_HLT:
532 return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING);
533 @@ -8137,6 +8135,9 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu)
534 return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES);
535 case EXIT_REASON_PREEMPTION_TIMER:
536 return false;
537 + case EXIT_REASON_PML_FULL:
538 + /* We don't expose PML support to L1. */
539 + return false;
540 default:
541 return true;
542 }
543 @@ -10073,6 +10074,18 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
544
545 }
546
547 + if (enable_pml) {
548 + /*
549 + * Conceptually we want to copy the PML address and index from
550 + * vmcs01 here, and then back to vmcs01 on nested vmexit. But,
551 + * since we always flush the log on each vmexit, this happens
552 + * to be equivalent to simply resetting the fields in vmcs02.
553 + */
554 + ASSERT(vmx->pml_pg);
555 + vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg));
556 + vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1);
557 + }
558 +
559 if (nested_cpu_has_ept(vmcs12)) {
560 kvm_mmu_unload(vcpu);
561 nested_ept_init_mmu_context(vcpu);
562 diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
563 index a00a6c07bb6f..4ea9f290c19f 100644
564 --- a/arch/x86/pci/xen.c
565 +++ b/arch/x86/pci/xen.c
566 @@ -447,7 +447,7 @@ void __init xen_msi_init(void)
567
568 int __init pci_xen_hvm_init(void)
569 {
570 - if (!xen_feature(XENFEAT_hvm_pirqs))
571 + if (!xen_have_vector_callback || !xen_feature(XENFEAT_hvm_pirqs))
572 return 0;
573
574 #ifdef CONFIG_ACPI
575 diff --git a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
576 index 3f1f1c77d090..10bad1e55fcc 100644
577 --- a/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
578 +++ b/arch/x86/platform/intel-mid/device_libs/platform_mrfld_wdt.c
579 @@ -19,7 +19,7 @@
580 #include <asm/intel_scu_ipc.h>
581 #include <asm/io_apic.h>
582
583 -#define TANGIER_EXT_TIMER0_MSI 15
584 +#define TANGIER_EXT_TIMER0_MSI 12
585
586 static struct platform_device wdt_dev = {
587 .name = "intel_mid_wdt",
588 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
589 index bdd855685403..8f1f7efa848c 100644
590 --- a/arch/x86/xen/enlighten.c
591 +++ b/arch/x86/xen/enlighten.c
592 @@ -137,6 +137,8 @@ struct shared_info xen_dummy_shared_info;
593 void *xen_initial_gdt;
594
595 RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
596 +__read_mostly int xen_have_vector_callback;
597 +EXPORT_SYMBOL_GPL(xen_have_vector_callback);
598
599 static int xen_cpu_up_prepare(unsigned int cpu);
600 static int xen_cpu_up_online(unsigned int cpu);
601 @@ -1521,7 +1523,10 @@ static void __init xen_pvh_early_guest_init(void)
602 if (!xen_feature(XENFEAT_auto_translated_physmap))
603 return;
604
605 - BUG_ON(!xen_feature(XENFEAT_hvm_callback_vector));
606 + if (!xen_feature(XENFEAT_hvm_callback_vector))
607 + return;
608 +
609 + xen_have_vector_callback = 1;
610
611 xen_pvh_early_cpu_init(0, false);
612 xen_pvh_set_cr_flags(0);
613 @@ -1860,7 +1865,9 @@ static int xen_cpu_up_prepare(unsigned int cpu)
614 xen_vcpu_setup(cpu);
615 }
616
617 - if (xen_pv_domain() || xen_feature(XENFEAT_hvm_safe_pvclock))
618 + if (xen_pv_domain() ||
619 + (xen_have_vector_callback &&
620 + xen_feature(XENFEAT_hvm_safe_pvclock)))
621 xen_setup_timer(cpu);
622
623 rc = xen_smp_intr_init(cpu);
624 @@ -1876,7 +1883,9 @@ static int xen_cpu_dead(unsigned int cpu)
625 {
626 xen_smp_intr_free(cpu);
627
628 - if (xen_pv_domain() || xen_feature(XENFEAT_hvm_safe_pvclock))
629 + if (xen_pv_domain() ||
630 + (xen_have_vector_callback &&
631 + xen_feature(XENFEAT_hvm_safe_pvclock)))
632 xen_teardown_timer(cpu);
633
634 return 0;
635 @@ -1915,8 +1924,8 @@ static void __init xen_hvm_guest_init(void)
636
637 xen_panic_handler_init();
638
639 - BUG_ON(!xen_feature(XENFEAT_hvm_callback_vector));
640 -
641 + if (xen_feature(XENFEAT_hvm_callback_vector))
642 + xen_have_vector_callback = 1;
643 xen_hvm_smp_init();
644 WARN_ON(xen_cpuhp_setup());
645 xen_unplug_emulated_devices();
646 @@ -1954,7 +1963,7 @@ bool xen_hvm_need_lapic(void)
647 return false;
648 if (!xen_hvm_domain())
649 return false;
650 - if (xen_feature(XENFEAT_hvm_pirqs))
651 + if (xen_feature(XENFEAT_hvm_pirqs) && xen_have_vector_callback)
652 return false;
653 return true;
654 }
655 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
656 index 311acad7dad2..137afbbd0590 100644
657 --- a/arch/x86/xen/smp.c
658 +++ b/arch/x86/xen/smp.c
659 @@ -765,6 +765,8 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
660
661 void __init xen_hvm_smp_init(void)
662 {
663 + if (!xen_have_vector_callback)
664 + return;
665 smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus;
666 smp_ops.smp_send_reschedule = xen_smp_send_reschedule;
667 smp_ops.cpu_die = xen_cpu_die;
668 diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
669 index 33d8f6a7829d..67356d29d74d 100644
670 --- a/arch/x86/xen/time.c
671 +++ b/arch/x86/xen/time.c
672 @@ -432,6 +432,11 @@ static void xen_hvm_setup_cpu_clockevents(void)
673
674 void __init xen_hvm_init_time_ops(void)
675 {
676 + /* vector callback is needed otherwise we cannot receive interrupts
677 + * on cpu > 0 and at this point we don't know how many cpus are
678 + * available */
679 + if (!xen_have_vector_callback)
680 + return;
681 if (!xen_feature(XENFEAT_hvm_safe_pvclock)) {
682 printk(KERN_INFO "Xen doesn't support pvclock on HVM,"
683 "disable pv timer\n");
684 diff --git a/block/blk-integrity.c b/block/blk-integrity.c
685 index d69c5c79f98e..319f2e4f4a8b 100644
686 --- a/block/blk-integrity.c
687 +++ b/block/blk-integrity.c
688 @@ -417,7 +417,7 @@ void blk_integrity_register(struct gendisk *disk, struct blk_integrity *template
689 bi->tuple_size = template->tuple_size;
690 bi->tag_size = template->tag_size;
691
692 - blk_integrity_revalidate(disk);
693 + disk->queue->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;
694 }
695 EXPORT_SYMBOL(blk_integrity_register);
696
697 @@ -430,26 +430,11 @@ EXPORT_SYMBOL(blk_integrity_register);
698 */
699 void blk_integrity_unregister(struct gendisk *disk)
700 {
701 - blk_integrity_revalidate(disk);
702 + disk->queue->backing_dev_info.capabilities &= ~BDI_CAP_STABLE_WRITES;
703 memset(&disk->queue->integrity, 0, sizeof(struct blk_integrity));
704 }
705 EXPORT_SYMBOL(blk_integrity_unregister);
706
707 -void blk_integrity_revalidate(struct gendisk *disk)
708 -{
709 - struct blk_integrity *bi = &disk->queue->integrity;
710 -
711 - if (!(disk->flags & GENHD_FL_UP))
712 - return;
713 -
714 - if (bi->profile)
715 - disk->queue->backing_dev_info.capabilities |=
716 - BDI_CAP_STABLE_WRITES;
717 - else
718 - disk->queue->backing_dev_info.capabilities &=
719 - ~BDI_CAP_STABLE_WRITES;
720 -}
721 -
722 void blk_integrity_add(struct gendisk *disk)
723 {
724 if (kobject_init_and_add(&disk->integrity_kobj, &integrity_ktype,
725 diff --git a/block/partition-generic.c b/block/partition-generic.c
726 index 71d9ed9df8da..a2437c006640 100644
727 --- a/block/partition-generic.c
728 +++ b/block/partition-generic.c
729 @@ -447,7 +447,6 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
730
731 if (disk->fops->revalidate_disk)
732 disk->fops->revalidate_disk(disk);
733 - blk_integrity_revalidate(disk);
734 check_disk_size_change(disk, bdev);
735 bdev->bd_invalidated = 0;
736 if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
737 diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
738 index e5950131bd90..a017ccd8cc3b 100644
739 --- a/drivers/char/tpm/tpm-chip.c
740 +++ b/drivers/char/tpm/tpm-chip.c
741 @@ -140,7 +140,7 @@ static void tpm_dev_release(struct device *dev)
742 * Allocates a new struct tpm_chip instance and assigns a free
743 * device number for it. Must be paired with put_device(&chip->dev).
744 */
745 -struct tpm_chip *tpm_chip_alloc(struct device *dev,
746 +struct tpm_chip *tpm_chip_alloc(struct device *pdev,
747 const struct tpm_class_ops *ops)
748 {
749 struct tpm_chip *chip;
750 @@ -159,7 +159,7 @@ struct tpm_chip *tpm_chip_alloc(struct device *dev,
751 rc = idr_alloc(&dev_nums_idr, NULL, 0, TPM_NUM_DEVICES, GFP_KERNEL);
752 mutex_unlock(&idr_lock);
753 if (rc < 0) {
754 - dev_err(dev, "No available tpm device numbers\n");
755 + dev_err(pdev, "No available tpm device numbers\n");
756 kfree(chip);
757 return ERR_PTR(rc);
758 }
759 @@ -169,7 +169,7 @@ struct tpm_chip *tpm_chip_alloc(struct device *dev,
760
761 chip->dev.class = tpm_class;
762 chip->dev.release = tpm_dev_release;
763 - chip->dev.parent = dev;
764 + chip->dev.parent = pdev;
765 chip->dev.groups = chip->groups;
766
767 if (chip->dev_num == 0)
768 @@ -181,7 +181,7 @@ struct tpm_chip *tpm_chip_alloc(struct device *dev,
769 if (rc)
770 goto out;
771
772 - if (!dev)
773 + if (!pdev)
774 chip->flags |= TPM_CHIP_FLAG_VIRTUAL;
775
776 cdev_init(&chip->cdev, &tpm_fops);
777 diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
778 index 4d183c97f6a6..aa4299cf7e5a 100644
779 --- a/drivers/char/tpm/tpm.h
780 +++ b/drivers/char/tpm/tpm.h
781 @@ -518,6 +518,11 @@ static inline void tpm_add_ppi(struct tpm_chip *chip)
782 }
783 #endif
784
785 +static inline inline u32 tpm2_rc_value(u32 rc)
786 +{
787 + return (rc & BIT(7)) ? rc & 0xff : rc;
788 +}
789 +
790 int tpm2_pcr_read(struct tpm_chip *chip, int pcr_idx, u8 *res_buf);
791 int tpm2_pcr_extend(struct tpm_chip *chip, int pcr_idx, const u8 *hash);
792 int tpm2_get_random(struct tpm_chip *chip, u8 *out, size_t max);
793 diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
794 index 7df55d58c939..17896d654033 100644
795 --- a/drivers/char/tpm/tpm2-cmd.c
796 +++ b/drivers/char/tpm/tpm2-cmd.c
797 @@ -529,7 +529,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip,
798 tpm_buf_destroy(&buf);
799
800 if (rc > 0) {
801 - if ((rc & TPM2_RC_HASH) == TPM2_RC_HASH)
802 + if (tpm2_rc_value(rc) == TPM2_RC_HASH)
803 rc = -EINVAL;
804 else
805 rc = -EPERM;
806 diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
807 index 925081ec14c0..42042c0a936c 100644
808 --- a/drivers/clk/Makefile
809 +++ b/drivers/clk/Makefile
810 @@ -87,6 +87,8 @@ obj-y += ti/
811 obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
812 obj-$(CONFIG_ARCH_U8500) += ux500/
813 obj-$(CONFIG_COMMON_CLK_VERSATILE) += versatile/
814 +ifeq ($(CONFIG_COMMON_CLK), y)
815 obj-$(CONFIG_X86) += x86/
816 +endif
817 obj-$(CONFIG_ARCH_ZX) += zte/
818 obj-$(CONFIG_ARCH_ZYNQ) += zynq/
819 diff --git a/drivers/clk/rockchip/clk-rk3036.c b/drivers/clk/rockchip/clk-rk3036.c
820 index 924f560dcf80..dcde70f4c105 100644
821 --- a/drivers/clk/rockchip/clk-rk3036.c
822 +++ b/drivers/clk/rockchip/clk-rk3036.c
823 @@ -127,7 +127,7 @@ PNAME(mux_ddrphy_p) = { "dpll_ddr", "gpll_ddr" };
824 PNAME(mux_pll_src_3plls_p) = { "apll", "dpll", "gpll" };
825 PNAME(mux_timer_p) = { "xin24m", "pclk_peri_src" };
826
827 -PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll" "usb480m" };
828 +PNAME(mux_pll_src_apll_dpll_gpll_usb480m_p) = { "apll", "dpll", "gpll", "usb480m" };
829
830 PNAME(mux_mmc_src_p) = { "apll", "dpll", "gpll", "xin24m" };
831 PNAME(mux_i2s_pre_p) = { "i2s_src", "i2s_frac", "ext_i2s", "xin12m" };
832 diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
833 index 660dc206969f..2474f1494955 100644
834 --- a/drivers/crypto/caam/caamhash.c
835 +++ b/drivers/crypto/caam/caamhash.c
836 @@ -154,6 +154,7 @@ static inline int map_seq_out_ptr_ctx(u32 *desc, struct device *jrdev,
837 ctx_len, DMA_FROM_DEVICE);
838 if (dma_mapping_error(jrdev, state->ctx_dma)) {
839 dev_err(jrdev, "unable to map ctx\n");
840 + state->ctx_dma = 0;
841 return -ENOMEM;
842 }
843
844 @@ -214,6 +215,7 @@ static inline int ctx_map_to_sec4_sg(u32 *desc, struct device *jrdev,
845 state->ctx_dma = dma_map_single(jrdev, state->caam_ctx, ctx_len, flag);
846 if (dma_mapping_error(jrdev, state->ctx_dma)) {
847 dev_err(jrdev, "unable to map ctx\n");
848 + state->ctx_dma = 0;
849 return -ENOMEM;
850 }
851
852 @@ -620,8 +622,10 @@ static inline void ahash_unmap_ctx(struct device *dev,
853 struct caam_hash_ctx *ctx = crypto_ahash_ctx(ahash);
854 struct caam_hash_state *state = ahash_request_ctx(req);
855
856 - if (state->ctx_dma)
857 + if (state->ctx_dma) {
858 dma_unmap_single(dev, state->ctx_dma, ctx->ctx_len, flag);
859 + state->ctx_dma = 0;
860 + }
861 ahash_unmap(dev, edesc, req, dst_len);
862 }
863
864 @@ -1605,6 +1609,7 @@ static int ahash_init(struct ahash_request *req)
865 state->finup = ahash_finup_first;
866 state->final = ahash_final_no_ctx;
867
868 + state->ctx_dma = 0;
869 state->current_buf = 0;
870 state->buf_dma = 0;
871 state->buflen_0 = 0;
872 diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
873 index 81df3097b545..7fd496f99385 100644
874 --- a/drivers/gpu/drm/sti/sti_gdp.c
875 +++ b/drivers/gpu/drm/sti/sti_gdp.c
876 @@ -66,7 +66,9 @@ static struct gdp_format_to_str {
877 #define GAM_GDP_ALPHARANGE_255 BIT(5)
878 #define GAM_GDP_AGC_FULL_RANGE 0x00808080
879 #define GAM_GDP_PPT_IGNORE (BIT(1) | BIT(0))
880 -#define GAM_GDP_SIZE_MAX 0x7FF
881 +
882 +#define GAM_GDP_SIZE_MAX_WIDTH 3840
883 +#define GAM_GDP_SIZE_MAX_HEIGHT 2160
884
885 #define GDP_NODE_NB_BANK 2
886 #define GDP_NODE_PER_FIELD 2
887 @@ -633,8 +635,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
888 /* src_x are in 16.16 format */
889 src_x = state->src_x >> 16;
890 src_y = state->src_y >> 16;
891 - src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX);
892 - src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX);
893 + src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX_WIDTH);
894 + src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX_HEIGHT);
895
896 format = sti_gdp_fourcc2format(fb->pixel_format);
897 if (format == -1) {
898 @@ -732,8 +734,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
899 /* src_x are in 16.16 format */
900 src_x = state->src_x >> 16;
901 src_y = state->src_y >> 16;
902 - src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX);
903 - src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX);
904 + src_w = clamp_val(state->src_w >> 16, 0, GAM_GDP_SIZE_MAX_WIDTH);
905 + src_h = clamp_val(state->src_h >> 16, 0, GAM_GDP_SIZE_MAX_HEIGHT);
906
907 list = sti_gdp_get_free_nodes(gdp);
908 top_field = list->top_field;
909 diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
910 index a6ed9d5e5167..750733a8cce2 100644
911 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
912 +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
913 @@ -66,8 +66,11 @@ static int ttm_bo_vm_fault_idle(struct ttm_buffer_object *bo,
914 if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT)
915 goto out_unlock;
916
917 + ttm_bo_reference(bo);
918 up_read(&vma->vm_mm->mmap_sem);
919 (void) fence_wait(bo->moving, true);
920 + ttm_bo_unreserve(bo);
921 + ttm_bo_unref(&bo);
922 goto out_unlock;
923 }
924
925 @@ -120,8 +123,10 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
926
927 if (vmf->flags & FAULT_FLAG_ALLOW_RETRY) {
928 if (!(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
929 + ttm_bo_reference(bo);
930 up_read(&vma->vm_mm->mmap_sem);
931 (void) ttm_bo_wait_unreserved(bo);
932 + ttm_bo_unref(&bo);
933 }
934
935 return VM_FAULT_RETRY;
936 @@ -166,6 +171,13 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
937 ret = ttm_bo_vm_fault_idle(bo, vma, vmf);
938 if (unlikely(ret != 0)) {
939 retval = ret;
940 +
941 + if (retval == VM_FAULT_RETRY &&
942 + !(vmf->flags & FAULT_FLAG_RETRY_NOWAIT)) {
943 + /* The BO has already been unreserved. */
944 + return retval;
945 + }
946 +
947 goto out_unlock;
948 }
949
950 diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c
951 index b99c1df48156..81853ee85f6a 100644
952 --- a/drivers/hwmon/it87.c
953 +++ b/drivers/hwmon/it87.c
954 @@ -2600,7 +2600,7 @@ static int __init it87_find(int sioaddr, unsigned short *address,
955
956 /* Check for pwm4 */
957 reg = superio_inb(sioaddr, IT87_SIO_GPIO4_REG);
958 - if (!(reg & BIT(2)))
959 + if (reg & BIT(2))
960 sio_data->skip_pwm |= BIT(3);
961
962 /* Check for pwm2, fan2 */
963 diff --git a/drivers/leds/leds-ktd2692.c b/drivers/leds/leds-ktd2692.c
964 index bf23ba191ad0..45296aaca9da 100644
965 --- a/drivers/leds/leds-ktd2692.c
966 +++ b/drivers/leds/leds-ktd2692.c
967 @@ -270,15 +270,15 @@ static int ktd2692_parse_dt(struct ktd2692_context *led, struct device *dev,
968 return -ENXIO;
969
970 led->ctrl_gpio = devm_gpiod_get(dev, "ctrl", GPIOD_ASIS);
971 - if (IS_ERR(led->ctrl_gpio)) {
972 - ret = PTR_ERR(led->ctrl_gpio);
973 + ret = PTR_ERR_OR_ZERO(led->ctrl_gpio);
974 + if (ret) {
975 dev_err(dev, "cannot get ctrl-gpios %d\n", ret);
976 return ret;
977 }
978
979 led->aux_gpio = devm_gpiod_get(dev, "aux", GPIOD_ASIS);
980 - if (IS_ERR(led->aux_gpio)) {
981 - ret = PTR_ERR(led->aux_gpio);
982 + ret = PTR_ERR_OR_ZERO(led->aux_gpio);
983 + if (ret) {
984 dev_err(dev, "cannot get aux-gpios %d\n", ret);
985 return ret;
986 }
987 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
988 index f08a20b921e7..48ee4110ef6e 100644
989 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
990 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
991 @@ -2867,7 +2867,8 @@ static int bnxt_alloc_ntp_fltrs(struct bnxt *bp)
992 INIT_HLIST_HEAD(&bp->ntp_fltr_hash_tbl[i]);
993
994 bp->ntp_fltr_count = 0;
995 - bp->ntp_fltr_bmap = kzalloc(BITS_TO_LONGS(BNXT_NTP_FLTR_MAX_FLTR),
996 + bp->ntp_fltr_bmap = kcalloc(BITS_TO_LONGS(BNXT_NTP_FLTR_MAX_FLTR),
997 + sizeof(long),
998 GFP_KERNEL);
999
1000 if (!bp->ntp_fltr_bmap)
1001 diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
1002 index f7c6a40aae81..a5d66e205bb2 100644
1003 --- a/drivers/net/macsec.c
1004 +++ b/drivers/net/macsec.c
1005 @@ -617,7 +617,8 @@ static void macsec_encrypt_done(struct crypto_async_request *base, int err)
1006
1007 static struct aead_request *macsec_alloc_req(struct crypto_aead *tfm,
1008 unsigned char **iv,
1009 - struct scatterlist **sg)
1010 + struct scatterlist **sg,
1011 + int num_frags)
1012 {
1013 size_t size, iv_offset, sg_offset;
1014 struct aead_request *req;
1015 @@ -629,7 +630,7 @@ static struct aead_request *macsec_alloc_req(struct crypto_aead *tfm,
1016
1017 size = ALIGN(size, __alignof__(struct scatterlist));
1018 sg_offset = size;
1019 - size += sizeof(struct scatterlist) * (MAX_SKB_FRAGS + 1);
1020 + size += sizeof(struct scatterlist) * num_frags;
1021
1022 tmp = kmalloc(size, GFP_ATOMIC);
1023 if (!tmp)
1024 @@ -649,6 +650,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
1025 {
1026 int ret;
1027 struct scatterlist *sg;
1028 + struct sk_buff *trailer;
1029 unsigned char *iv;
1030 struct ethhdr *eth;
1031 struct macsec_eth_header *hh;
1032 @@ -723,7 +725,14 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
1033 return ERR_PTR(-EINVAL);
1034 }
1035
1036 - req = macsec_alloc_req(tx_sa->key.tfm, &iv, &sg);
1037 + ret = skb_cow_data(skb, 0, &trailer);
1038 + if (unlikely(ret < 0)) {
1039 + macsec_txsa_put(tx_sa);
1040 + kfree_skb(skb);
1041 + return ERR_PTR(ret);
1042 + }
1043 +
1044 + req = macsec_alloc_req(tx_sa->key.tfm, &iv, &sg, ret);
1045 if (!req) {
1046 macsec_txsa_put(tx_sa);
1047 kfree_skb(skb);
1048 @@ -732,7 +741,7 @@ static struct sk_buff *macsec_encrypt(struct sk_buff *skb,
1049
1050 macsec_fill_iv(iv, secy->sci, pn);
1051
1052 - sg_init_table(sg, MAX_SKB_FRAGS + 1);
1053 + sg_init_table(sg, ret);
1054 skb_to_sgvec(skb, sg, 0, skb->len);
1055
1056 if (tx_sc->encrypt) {
1057 @@ -914,6 +923,7 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb,
1058 {
1059 int ret;
1060 struct scatterlist *sg;
1061 + struct sk_buff *trailer;
1062 unsigned char *iv;
1063 struct aead_request *req;
1064 struct macsec_eth_header *hdr;
1065 @@ -924,7 +934,12 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb,
1066 if (!skb)
1067 return ERR_PTR(-ENOMEM);
1068
1069 - req = macsec_alloc_req(rx_sa->key.tfm, &iv, &sg);
1070 + ret = skb_cow_data(skb, 0, &trailer);
1071 + if (unlikely(ret < 0)) {
1072 + kfree_skb(skb);
1073 + return ERR_PTR(ret);
1074 + }
1075 + req = macsec_alloc_req(rx_sa->key.tfm, &iv, &sg, ret);
1076 if (!req) {
1077 kfree_skb(skb);
1078 return ERR_PTR(-ENOMEM);
1079 @@ -933,7 +948,7 @@ static struct sk_buff *macsec_decrypt(struct sk_buff *skb,
1080 hdr = (struct macsec_eth_header *)skb->data;
1081 macsec_fill_iv(iv, sci, ntohl(hdr->packet_number));
1082
1083 - sg_init_table(sg, MAX_SKB_FRAGS + 1);
1084 + sg_init_table(sg, ret);
1085 skb_to_sgvec(skb, sg, 0, skb->len);
1086
1087 if (hdr->tci_an & MACSEC_TCI_E) {
1088 @@ -2709,7 +2724,7 @@ static netdev_tx_t macsec_start_xmit(struct sk_buff *skb,
1089 }
1090
1091 #define MACSEC_FEATURES \
1092 - (NETIF_F_SG | NETIF_F_HIGHDMA)
1093 + (NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST)
1094 static struct lock_class_key macsec_netdev_addr_lock_key;
1095
1096 static int macsec_dev_init(struct net_device *dev)
1097 diff --git a/drivers/net/phy/mdio-mux-bcm-iproc.c b/drivers/net/phy/mdio-mux-bcm-iproc.c
1098 index 0a0412524cec..0a5f62e0efcc 100644
1099 --- a/drivers/net/phy/mdio-mux-bcm-iproc.c
1100 +++ b/drivers/net/phy/mdio-mux-bcm-iproc.c
1101 @@ -203,11 +203,14 @@ static int mdio_mux_iproc_probe(struct platform_device *pdev)
1102 &md->mux_handle, md, md->mii_bus);
1103 if (rc) {
1104 dev_info(md->dev, "mdiomux initialization failed\n");
1105 - goto out;
1106 + goto out_register;
1107 }
1108
1109 dev_info(md->dev, "iProc mdiomux registered\n");
1110 return 0;
1111 +
1112 +out_register:
1113 + mdiobus_unregister(bus);
1114 out:
1115 mdiobus_free(bus);
1116 return rc;
1117 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1118 index 0d519a9582ca..34d997ca1b27 100644
1119 --- a/drivers/net/usb/qmi_wwan.c
1120 +++ b/drivers/net/usb/qmi_wwan.c
1121 @@ -902,6 +902,7 @@ static const struct usb_device_id products[] = {
1122 {QMI_FIXED_INTF(0x2357, 0x0201, 4)}, /* TP-LINK HSUPA Modem MA180 */
1123 {QMI_FIXED_INTF(0x2357, 0x9000, 4)}, /* TP-LINK MA260 */
1124 {QMI_QUIRK_SET_DTR(0x1bc7, 0x1040, 2)}, /* Telit LE922A */
1125 + {QMI_FIXED_INTF(0x1bc7, 0x1100, 3)}, /* Telit ME910 */
1126 {QMI_FIXED_INTF(0x1bc7, 0x1200, 5)}, /* Telit LE920 */
1127 {QMI_FIXED_INTF(0x1bc7, 0x1201, 2)}, /* Telit LE920 */
1128 {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)}, /* XS Stick W100-2 from 4G Systems */
1129 diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
1130 index 5eaac13e2317..f877301c9454 100644
1131 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
1132 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
1133 @@ -198,7 +198,7 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
1134 int ret;
1135 struct brcmf_if *ifp = netdev_priv(ndev);
1136 struct brcmf_pub *drvr = ifp->drvr;
1137 - struct ethhdr *eh = (struct ethhdr *)(skb->data);
1138 + struct ethhdr *eh;
1139
1140 brcmf_dbg(DATA, "Enter, bsscfgidx=%d\n", ifp->bsscfgidx);
1141
1142 @@ -211,22 +211,13 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
1143 goto done;
1144 }
1145
1146 - /* Make sure there's enough room for any header */
1147 - if (skb_headroom(skb) < drvr->hdrlen) {
1148 - struct sk_buff *skb2;
1149 -
1150 - brcmf_dbg(INFO, "%s: insufficient headroom\n",
1151 + /* Make sure there's enough writable headroom*/
1152 + ret = skb_cow_head(skb, drvr->hdrlen);
1153 + if (ret < 0) {
1154 + brcmf_err("%s: skb_cow_head failed\n",
1155 brcmf_ifname(ifp));
1156 - drvr->bus_if->tx_realloc++;
1157 - skb2 = skb_realloc_headroom(skb, drvr->hdrlen);
1158 dev_kfree_skb(skb);
1159 - skb = skb2;
1160 - if (skb == NULL) {
1161 - brcmf_err("%s: skb_realloc_headroom failed\n",
1162 - brcmf_ifname(ifp));
1163 - ret = -ENOMEM;
1164 - goto done;
1165 - }
1166 + goto done;
1167 }
1168
1169 /* validate length for ether packet */
1170 @@ -236,6 +227,8 @@ static netdev_tx_t brcmf_netdev_start_xmit(struct sk_buff *skb,
1171 goto done;
1172 }
1173
1174 + eh = (struct ethhdr *)(skb->data);
1175 +
1176 if (eh->h_proto == htons(ETH_P_PAE))
1177 atomic_inc(&ifp->pend_8021x_cnt);
1178
1179 diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-6000.c b/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
1180 index 0b9f6a7bc834..39335b7b0c16 100644
1181 --- a/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
1182 +++ b/drivers/net/wireless/intel/iwlwifi/iwl-6000.c
1183 @@ -371,4 +371,4 @@ const struct iwl_cfg iwl6000_3agn_cfg = {
1184 MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
1185 MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
1186 MODULE_FIRMWARE(IWL6005_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
1187 -MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2B_UCODE_API_MAX));
1188 +MODULE_FIRMWARE(IWL6030_MODULE_FIRMWARE(IWL6000G2_UCODE_API_MAX));
1189 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1190 index b88e2048ae0b..207d8ae1e116 100644
1191 --- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1192 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
1193 @@ -1262,12 +1262,15 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
1194 iwl_trans_d3_suspend(mvm->trans, test, !unified_image);
1195 out:
1196 if (ret < 0) {
1197 - iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
1198 - if (mvm->restart_fw > 0) {
1199 - mvm->restart_fw--;
1200 - ieee80211_restart_hw(mvm->hw);
1201 - }
1202 iwl_mvm_free_nd(mvm);
1203 +
1204 + if (!unified_image) {
1205 + iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN);
1206 + if (mvm->restart_fw > 0) {
1207 + mvm->restart_fw--;
1208 + ieee80211_restart_hw(mvm->hw);
1209 + }
1210 + }
1211 }
1212 out_noreset:
1213 mutex_unlock(&mvm->mutex);
1214 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
1215 index 7b7d2a146e30..0bda91ffc608 100644
1216 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
1217 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
1218 @@ -1056,6 +1056,8 @@ static ssize_t iwl_dbgfs_fw_dbg_collect_write(struct iwl_mvm *mvm,
1219
1220 if (ret)
1221 return ret;
1222 + if (count == 0)
1223 + return 0;
1224
1225 iwl_mvm_fw_dbg_collect(mvm, FW_DBG_TRIGGER_USER, buf,
1226 (count - 1), NULL);
1227 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
1228 index d89d0a1fd34e..700d244df34b 100644
1229 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
1230 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw-dbg.c
1231 @@ -784,12 +784,16 @@ void iwl_mvm_fw_error_dump(struct iwl_mvm *mvm)
1232 struct iwl_fw_error_dump_paging *paging;
1233 struct page *pages =
1234 mvm->fw_paging_db[i].fw_paging_block;
1235 + dma_addr_t addr = mvm->fw_paging_db[i].fw_paging_phys;
1236
1237 dump_data->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PAGING);
1238 dump_data->len = cpu_to_le32(sizeof(*paging) +
1239 PAGING_BLOCK_SIZE);
1240 paging = (void *)dump_data->data;
1241 paging->index = cpu_to_le32(i);
1242 + dma_sync_single_for_cpu(mvm->trans->dev, addr,
1243 + PAGING_BLOCK_SIZE,
1244 + DMA_BIDIRECTIONAL);
1245 memcpy(paging->data, page_address(pages),
1246 PAGING_BLOCK_SIZE);
1247 dump_data = iwl_fw_error_next_data(dump_data);
1248 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
1249 index 872066317fa5..2ec3a91a0f6b 100644
1250 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
1251 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c
1252 @@ -214,6 +214,10 @@ static int iwl_fill_paging_mem(struct iwl_mvm *mvm, const struct fw_img *image)
1253 memcpy(page_address(mvm->fw_paging_db[0].fw_paging_block),
1254 image->sec[sec_idx].data,
1255 mvm->fw_paging_db[0].fw_paging_size);
1256 + dma_sync_single_for_device(mvm->trans->dev,
1257 + mvm->fw_paging_db[0].fw_paging_phys,
1258 + mvm->fw_paging_db[0].fw_paging_size,
1259 + DMA_BIDIRECTIONAL);
1260
1261 IWL_DEBUG_FW(mvm,
1262 "Paging: copied %d CSS bytes to first block\n",
1263 @@ -228,9 +232,16 @@ static int iwl_fill_paging_mem(struct iwl_mvm *mvm, const struct fw_img *image)
1264 * loop stop at num_of_paging_blk since that last block is not full.
1265 */
1266 for (idx = 1; idx < mvm->num_of_paging_blk; idx++) {
1267 - memcpy(page_address(mvm->fw_paging_db[idx].fw_paging_block),
1268 + struct iwl_fw_paging *block = &mvm->fw_paging_db[idx];
1269 +
1270 + memcpy(page_address(block->fw_paging_block),
1271 image->sec[sec_idx].data + offset,
1272 - mvm->fw_paging_db[idx].fw_paging_size);
1273 + block->fw_paging_size);
1274 + dma_sync_single_for_device(mvm->trans->dev,
1275 + block->fw_paging_phys,
1276 + block->fw_paging_size,
1277 + DMA_BIDIRECTIONAL);
1278 +
1279
1280 IWL_DEBUG_FW(mvm,
1281 "Paging: copied %d paging bytes to block %d\n",
1282 @@ -242,9 +253,15 @@ static int iwl_fill_paging_mem(struct iwl_mvm *mvm, const struct fw_img *image)
1283
1284 /* copy the last paging block */
1285 if (mvm->num_of_pages_in_last_blk > 0) {
1286 - memcpy(page_address(mvm->fw_paging_db[idx].fw_paging_block),
1287 + struct iwl_fw_paging *block = &mvm->fw_paging_db[idx];
1288 +
1289 + memcpy(page_address(block->fw_paging_block),
1290 image->sec[sec_idx].data + offset,
1291 FW_PAGING_SIZE * mvm->num_of_pages_in_last_blk);
1292 + dma_sync_single_for_device(mvm->trans->dev,
1293 + block->fw_paging_phys,
1294 + block->fw_paging_size,
1295 + DMA_BIDIRECTIONAL);
1296
1297 IWL_DEBUG_FW(mvm,
1298 "Paging: copied %d pages in the last block %d\n",
1299 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1300 index 6c802cee900c..a481eb41f693 100644
1301 --- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1302 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
1303 @@ -409,7 +409,7 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm,
1304
1305 /* ignore nssn smaller than head sn - this can happen due to timeout */
1306 if (iwl_mvm_is_sn_less(nssn, ssn, reorder_buf->buf_size))
1307 - return;
1308 + goto set_timer;
1309
1310 while (iwl_mvm_is_sn_less(ssn, nssn, reorder_buf->buf_size)) {
1311 int index = ssn % reorder_buf->buf_size;
1312 @@ -432,6 +432,7 @@ static void iwl_mvm_release_frames(struct iwl_mvm *mvm,
1313 }
1314 reorder_buf->head_sn = nssn;
1315
1316 +set_timer:
1317 if (reorder_buf->num_stored && !reorder_buf->removed) {
1318 u16 index = reorder_buf->head_sn % reorder_buf->buf_size;
1319
1320 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
1321 index 52de3c6d760c..e64aeb4a2204 100644
1322 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
1323 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
1324 @@ -1466,6 +1466,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1325 {
1326 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1327 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
1328 + u8 sta_id = mvm_sta->sta_id;
1329 int ret;
1330
1331 lockdep_assert_held(&mvm->mutex);
1332 @@ -1474,7 +1475,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1333 kfree(mvm_sta->dup_data);
1334
1335 if ((vif->type == NL80211_IFTYPE_STATION &&
1336 - mvmvif->ap_sta_id == mvm_sta->sta_id) ||
1337 + mvmvif->ap_sta_id == sta_id) ||
1338 iwl_mvm_is_dqa_supported(mvm)){
1339 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
1340 if (ret)
1341 @@ -1497,6 +1498,15 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1342 iwl_mvm_disable_sta_queues(mvm, vif, mvm_sta);
1343
1344 /*
1345 + * If pending_frames is set at this point - it must be
1346 + * driver internal logic error, since queues are empty
1347 + * and removed successuly.
1348 + * warn on it but set it to 0 anyway to avoid station
1349 + * not being removed later in the function
1350 + */
1351 + WARN_ON(atomic_xchg(&mvm->pending_frames[sta_id], 0));
1352 +
1353 + /*
1354 * If no traffic has gone through the reserved TXQ - it
1355 * is still marked as IWL_MVM_QUEUE_RESERVED, and
1356 * should be manually marked as free again
1357 @@ -1506,7 +1516,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1358 if (WARN((*status != IWL_MVM_QUEUE_RESERVED) &&
1359 (*status != IWL_MVM_QUEUE_FREE),
1360 "sta_id %d reserved txq %d status %d",
1361 - mvm_sta->sta_id, reserved_txq, *status)) {
1362 + sta_id, reserved_txq, *status)) {
1363 spin_unlock_bh(&mvm->queue_info_lock);
1364 return -EINVAL;
1365 }
1366 @@ -1516,7 +1526,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1367 }
1368
1369 if (vif->type == NL80211_IFTYPE_STATION &&
1370 - mvmvif->ap_sta_id == mvm_sta->sta_id) {
1371 + mvmvif->ap_sta_id == sta_id) {
1372 /* if associated - we can't remove the AP STA now */
1373 if (vif->bss_conf.assoc)
1374 return ret;
1375 @@ -1525,7 +1535,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1376 mvmvif->ap_sta_id = IWL_MVM_STATION_COUNT;
1377
1378 /* clear d0i3_ap_sta_id if no longer relevant */
1379 - if (mvm->d0i3_ap_sta_id == mvm_sta->sta_id)
1380 + if (mvm->d0i3_ap_sta_id == sta_id)
1381 mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT;
1382 }
1383 }
1384 @@ -1534,7 +1544,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1385 * This shouldn't happen - the TDLS channel switch should be canceled
1386 * before the STA is removed.
1387 */
1388 - if (WARN_ON_ONCE(mvm->tdls_cs.peer.sta_id == mvm_sta->sta_id)) {
1389 + if (WARN_ON_ONCE(mvm->tdls_cs.peer.sta_id == sta_id)) {
1390 mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT;
1391 cancel_delayed_work(&mvm->tdls_cs.dwork);
1392 }
1393 @@ -1544,21 +1554,20 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
1394 * calls the drain worker.
1395 */
1396 spin_lock_bh(&mvm_sta->lock);
1397 +
1398 /*
1399 * There are frames pending on the AC queues for this station.
1400 * We need to wait until all the frames are drained...
1401 */
1402 - if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) {
1403 - rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id],
1404 + if (atomic_read(&mvm->pending_frames[sta_id])) {
1405 + rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id],
1406 ERR_PTR(-EBUSY));
1407 spin_unlock_bh(&mvm_sta->lock);
1408
1409 /* disable TDLS sta queues on drain complete */
1410 if (sta->tdls) {
1411 - mvm->tfd_drained[mvm_sta->sta_id] =
1412 - mvm_sta->tfd_queue_msk;
1413 - IWL_DEBUG_TDLS(mvm, "Draining TDLS sta %d\n",
1414 - mvm_sta->sta_id);
1415 + mvm->tfd_drained[sta_id] = mvm_sta->tfd_queue_msk;
1416 + IWL_DEBUG_TDLS(mvm, "Draining TDLS sta %d\n", sta_id);
1417 }
1418
1419 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true);
1420 diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
1421 index 66957ac12ca4..0556d139b719 100644
1422 --- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
1423 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
1424 @@ -202,7 +202,6 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
1425 struct iwl_tx_cmd *tx_cmd,
1426 struct ieee80211_tx_info *info, u8 sta_id)
1427 {
1428 - struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
1429 struct ieee80211_hdr *hdr = (void *)skb->data;
1430 __le16 fc = hdr->frame_control;
1431 u32 tx_flags = le32_to_cpu(tx_cmd->tx_flags);
1432 @@ -284,9 +283,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
1433 tx_flags |= TX_CMD_FLG_WRITE_TX_POWER;
1434
1435 tx_cmd->tx_flags = cpu_to_le32(tx_flags);
1436 - /* Total # bytes to be transmitted */
1437 - tx_cmd->len = cpu_to_le16((u16)skb->len +
1438 - (uintptr_t)skb_info->driver_data[0]);
1439 + /* Total # bytes to be transmitted - PCIe code will adjust for A-MSDU */
1440 + tx_cmd->len = cpu_to_le16((u16)skb->len);
1441 tx_cmd->life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE);
1442 tx_cmd->sta_id = sta_id;
1443
1444 @@ -459,7 +457,6 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
1445 struct ieee80211_sta *sta, u8 sta_id)
1446 {
1447 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
1448 - struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
1449 struct iwl_device_cmd *dev_cmd;
1450 struct iwl_tx_cmd *tx_cmd;
1451
1452 @@ -479,12 +476,18 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
1453
1454 iwl_mvm_set_tx_cmd_rate(mvm, tx_cmd, info, sta, hdr->frame_control);
1455
1456 + return dev_cmd;
1457 +}
1458 +
1459 +static void iwl_mvm_skb_prepare_status(struct sk_buff *skb,
1460 + struct iwl_device_cmd *cmd)
1461 +{
1462 + struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
1463 +
1464 memset(&skb_info->status, 0, sizeof(skb_info->status));
1465 memset(skb_info->driver_data, 0, sizeof(skb_info->driver_data));
1466
1467 - skb_info->driver_data[1] = dev_cmd;
1468 -
1469 - return dev_cmd;
1470 + skb_info->driver_data[1] = cmd;
1471 }
1472
1473 static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm,
1474 @@ -550,9 +553,6 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
1475 info.hw_queue != info.control.vif->cab_queue)))
1476 return -1;
1477
1478 - /* This holds the amsdu headers length */
1479 - skb_info->driver_data[0] = (void *)(uintptr_t)0;
1480 -
1481 queue = info.hw_queue;
1482
1483 /*
1484 @@ -563,9 +563,10 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
1485 * (this is not possible for unicast packets as a TLDS discovery
1486 * response are sent without a station entry); otherwise use the
1487 * AUX station.
1488 - * In DQA mode, if vif is of type STATION and frames are not multicast,
1489 - * they should be sent from the BSS queue. For example, TDLS setup
1490 - * frames should be sent on this queue, as they go through the AP.
1491 + * In DQA mode, if vif is of type STATION and frames are not multicast
1492 + * or offchannel, they should be sent from the BSS queue.
1493 + * For example, TDLS setup frames should be sent on this queue,
1494 + * as they go through the AP.
1495 */
1496 sta_id = mvm->aux_sta.sta_id;
1497 if (info.control.vif) {
1498 @@ -587,7 +588,8 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
1499 if (ap_sta_id != IWL_MVM_STATION_COUNT)
1500 sta_id = ap_sta_id;
1501 } else if (iwl_mvm_is_dqa_supported(mvm) &&
1502 - info.control.vif->type == NL80211_IFTYPE_STATION) {
1503 + info.control.vif->type == NL80211_IFTYPE_STATION &&
1504 + queue != mvm->aux_queue) {
1505 queue = IWL_MVM_DQA_BSS_CLIENT_QUEUE;
1506 }
1507 }
1508 @@ -598,6 +600,9 @@ int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb)
1509 if (!dev_cmd)
1510 return -1;
1511
1512 + /* From now on, we cannot access info->control */
1513 + iwl_mvm_skb_prepare_status(skb, dev_cmd);
1514 +
1515 tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload;
1516
1517 /* Copy MAC header from skb into command buffer */
1518 @@ -634,7 +639,7 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
1519 unsigned int num_subframes, tcp_payload_len, subf_len, max_amsdu_len;
1520 bool ipv4 = (skb->protocol == htons(ETH_P_IP));
1521 u16 ip_base_id = ipv4 ? ntohs(ip_hdr(skb)->id) : 0;
1522 - u16 amsdu_add, snap_ip_tcp, pad, i = 0;
1523 + u16 snap_ip_tcp, pad, i = 0;
1524 unsigned int dbg_max_amsdu_len;
1525 netdev_features_t netdev_features = NETIF_F_CSUM_MASK | NETIF_F_SG;
1526 u8 *qc, tid, txf;
1527 @@ -736,21 +741,6 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
1528
1529 /* This skb fits in one single A-MSDU */
1530 if (num_subframes * mss >= tcp_payload_len) {
1531 - struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
1532 -
1533 - /*
1534 - * Compute the length of all the data added for the A-MSDU.
1535 - * This will be used to compute the length to write in the TX
1536 - * command. We have: SNAP + IP + TCP for n -1 subframes and
1537 - * ETH header for n subframes. Note that the original skb
1538 - * already had one set of SNAP / IP / TCP headers.
1539 - */
1540 - num_subframes = DIV_ROUND_UP(tcp_payload_len, mss);
1541 - amsdu_add = num_subframes * sizeof(struct ethhdr) +
1542 - (num_subframes - 1) * (snap_ip_tcp + pad);
1543 - /* This holds the amsdu headers length */
1544 - skb_info->driver_data[0] = (void *)(uintptr_t)amsdu_add;
1545 -
1546 __skb_queue_tail(mpdus_skb, skb);
1547 return 0;
1548 }
1549 @@ -789,14 +779,6 @@ static int iwl_mvm_tx_tso(struct iwl_mvm *mvm, struct sk_buff *skb,
1550 ip_hdr(tmp)->id = htons(ip_base_id + i * num_subframes);
1551
1552 if (tcp_payload_len > mss) {
1553 - struct ieee80211_tx_info *skb_info =
1554 - IEEE80211_SKB_CB(tmp);
1555 -
1556 - num_subframes = DIV_ROUND_UP(tcp_payload_len, mss);
1557 - amsdu_add = num_subframes * sizeof(struct ethhdr) +
1558 - (num_subframes - 1) * (snap_ip_tcp + pad);
1559 - skb_info->driver_data[0] =
1560 - (void *)(uintptr_t)amsdu_add;
1561 skb_shinfo(tmp)->gso_size = mss;
1562 } else {
1563 qc = ieee80211_get_qos_ctl((void *)tmp->data);
1564 @@ -908,7 +890,6 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1565 goto drop;
1566
1567 tx_cmd = (struct iwl_tx_cmd *)dev_cmd->payload;
1568 - /* From now on, we cannot access info->control */
1569
1570 /*
1571 * we handle that entirely ourselves -- for uAPSD the firmware
1572 @@ -1015,6 +996,9 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1573 IWL_DEBUG_TX(mvm, "TX to [%d|%d] Q:%d - seq: 0x%x\n", mvmsta->sta_id,
1574 tid, txq_id, IEEE80211_SEQ_TO_SN(seq_number));
1575
1576 + /* From now on, we cannot access info->control */
1577 + iwl_mvm_skb_prepare_status(skb, dev_cmd);
1578 +
1579 if (iwl_trans_tx(mvm->trans, skb, dev_cmd, txq_id))
1580 goto drop_unlock_sta;
1581
1582 @@ -1024,7 +1008,10 @@ static int iwl_mvm_tx_mpdu(struct iwl_mvm *mvm, struct sk_buff *skb,
1583 spin_unlock(&mvmsta->lock);
1584
1585 /* Increase pending frames count if this isn't AMPDU */
1586 - if (!is_ampdu)
1587 + if ((iwl_mvm_is_dqa_supported(mvm) &&
1588 + mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_ON &&
1589 + mvmsta->tid_data[tx_cmd->tid_tspec].state != IWL_AGG_STARTING) ||
1590 + (!iwl_mvm_is_dqa_supported(mvm) && !is_ampdu))
1591 atomic_inc(&mvm->pending_frames[mvmsta->sta_id]);
1592
1593 return 0;
1594 @@ -1040,7 +1027,6 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
1595 struct ieee80211_sta *sta)
1596 {
1597 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1598 - struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb);
1599 struct ieee80211_tx_info info;
1600 struct sk_buff_head mpdus_skbs;
1601 unsigned int payload_len;
1602 @@ -1054,9 +1040,6 @@ int iwl_mvm_tx_skb(struct iwl_mvm *mvm, struct sk_buff *skb,
1603
1604 memcpy(&info, skb->cb, sizeof(info));
1605
1606 - /* This holds the amsdu headers length */
1607 - skb_info->driver_data[0] = (void *)(uintptr_t)0;
1608 -
1609 if (!skb_is_gso(skb))
1610 return iwl_mvm_tx_mpdu(mvm, skb, &info, sta);
1611
1612 @@ -1295,8 +1278,6 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
1613
1614 memset(&info->status, 0, sizeof(info->status));
1615
1616 - info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1617 -
1618 /* inform mac80211 about what happened with the frame */
1619 switch (status & TX_STATUS_MSK) {
1620 case TX_STATUS_SUCCESS:
1621 @@ -1319,10 +1300,11 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
1622 (void *)(uintptr_t)le32_to_cpu(tx_resp->initial_rate);
1623
1624 /* Single frame failure in an AMPDU queue => send BAR */
1625 - if (txq_id >= mvm->first_agg_queue &&
1626 + if (info->flags & IEEE80211_TX_CTL_AMPDU &&
1627 !(info->flags & IEEE80211_TX_STAT_ACK) &&
1628 !(info->flags & IEEE80211_TX_STAT_TX_FILTERED))
1629 info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
1630 + info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1631
1632 /* W/A FW bug: seq_ctl is wrong when the status isn't success */
1633 if (status != TX_STATUS_SUCCESS) {
1634 @@ -1357,7 +1339,7 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
1635 ieee80211_tx_status(mvm->hw, skb);
1636 }
1637
1638 - if (txq_id >= mvm->first_agg_queue) {
1639 + if (iwl_mvm_is_dqa_supported(mvm) || txq_id >= mvm->first_agg_queue) {
1640 /* If this is an aggregation queue, we use the ssn since:
1641 * ssn = wifi seq_num % 256.
1642 * The seq_ctl is the sequence control of the packet to which
1643 diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
1644 index cac6d99012b3..e3cede979751 100644
1645 --- a/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
1646 +++ b/drivers/net/wireless/intel/iwlwifi/pcie/internal.h
1647 @@ -279,7 +279,7 @@ struct iwl_txq {
1648 bool frozen;
1649 u8 active;
1650 bool ampdu;
1651 - bool block;
1652 + int block;
1653 unsigned long wd_timeout;
1654 struct sk_buff_head overflow_q;
1655
1656 diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1657 index ae95533e587d..10ef44e8ecd5 100644
1658 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1659 +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
1660 @@ -868,17 +868,13 @@ static int iwl_pcie_load_cpu_sections(struct iwl_trans *trans,
1661 int cpu,
1662 int *first_ucode_section)
1663 {
1664 - int shift_param;
1665 int i, ret = 0;
1666 u32 last_read_idx = 0;
1667
1668 - if (cpu == 1) {
1669 - shift_param = 0;
1670 + if (cpu == 1)
1671 *first_ucode_section = 0;
1672 - } else {
1673 - shift_param = 16;
1674 + else
1675 (*first_ucode_section)++;
1676 - }
1677
1678 for (i = *first_ucode_section; i < IWL_UCODE_SECTION_MAX; i++) {
1679 last_read_idx = i;
1680 @@ -2933,16 +2929,12 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
1681 PCIE_LINK_STATE_CLKPM);
1682 }
1683
1684 - if (cfg->mq_rx_supported)
1685 - addr_size = 64;
1686 - else
1687 - addr_size = 36;
1688 -
1689 if (cfg->use_tfh) {
1690 + addr_size = 64;
1691 trans_pcie->max_tbs = IWL_TFH_NUM_TBS;
1692 trans_pcie->tfd_size = sizeof(struct iwl_tfh_tfd);
1693 -
1694 } else {
1695 + addr_size = 36;
1696 trans_pcie->max_tbs = IWL_NUM_OF_TBS;
1697 trans_pcie->tfd_size = sizeof(struct iwl_tfd);
1698 }
1699 diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
1700 index 5f840f16f40b..e1bfc9522cbe 100644
1701 --- a/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
1702 +++ b/drivers/net/wireless/intel/iwlwifi/pcie/tx.c
1703 @@ -2096,6 +2096,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
1704 struct iwl_cmd_meta *out_meta,
1705 struct iwl_device_cmd *dev_cmd, u16 tb1_len)
1706 {
1707 + struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload;
1708 struct iwl_trans_pcie *trans_pcie = txq->trans_pcie;
1709 struct ieee80211_hdr *hdr = (void *)skb->data;
1710 unsigned int snap_ip_tcp_hdrlen, ip_hdrlen, total_len, hdr_room;
1711 @@ -2145,6 +2146,13 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
1712 */
1713 skb_pull(skb, hdr_len + iv_len);
1714
1715 + /*
1716 + * Remove the length of all the headers that we don't actually
1717 + * have in the MPDU by themselves, but that we duplicate into
1718 + * all the different MSDUs inside the A-MSDU.
1719 + */
1720 + le16_add_cpu(&tx_cmd->len, -snap_ip_tcp_hdrlen);
1721 +
1722 tso_start(skb, &tso);
1723
1724 while (total_len) {
1725 @@ -2155,7 +2163,7 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
1726 unsigned int hdr_tb_len;
1727 dma_addr_t hdr_tb_phys;
1728 struct tcphdr *tcph;
1729 - u8 *iph;
1730 + u8 *iph, *subf_hdrs_start = hdr_page->pos;
1731
1732 total_len -= data_left;
1733
1734 @@ -2216,6 +2224,8 @@ static int iwl_fill_data_tbs_amsdu(struct iwl_trans *trans, struct sk_buff *skb,
1735 hdr_tb_len, false);
1736 trace_iwlwifi_dev_tx_tso_chunk(trans->dev, start_hdr,
1737 hdr_tb_len);
1738 + /* add this subframe's headers' length to the tx_cmd */
1739 + le16_add_cpu(&tx_cmd->len, hdr_page->pos - subf_hdrs_start);
1740
1741 /* prepare the start_hdr for the next subframe */
1742 start_hdr = hdr_page->pos;
1743 @@ -2408,9 +2418,10 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
1744 tb1_len = len;
1745 }
1746
1747 - /* The first TB points to bi-directional DMA data */
1748 - memcpy(&txq->first_tb_bufs[txq->write_ptr], &dev_cmd->hdr,
1749 - IWL_FIRST_TB_SIZE);
1750 + /*
1751 + * The first TB points to bi-directional DMA data, we'll
1752 + * memcpy the data into it later.
1753 + */
1754 iwl_pcie_txq_build_tfd(trans, txq, tb0_phys,
1755 IWL_FIRST_TB_SIZE, true);
1756
1757 @@ -2434,6 +2445,10 @@ int iwl_trans_pcie_tx(struct iwl_trans *trans, struct sk_buff *skb,
1758 goto out_err;
1759 }
1760
1761 + /* building the A-MSDU might have changed this data, so memcpy it now */
1762 + memcpy(&txq->first_tb_bufs[txq->write_ptr], &dev_cmd->hdr,
1763 + IWL_FIRST_TB_SIZE);
1764 +
1765 tfd = iwl_pcie_get_tfd(trans_pcie, txq, txq->write_ptr);
1766 /* Set up entry for this TFD in Tx byte-count array */
1767 iwl_pcie_txq_update_byte_cnt_tbl(trans, txq, le16_to_cpu(tx_cmd->len),
1768 diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
1769 index c47d6366875d..a75013ac84d7 100644
1770 --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
1771 +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
1772 @@ -101,13 +101,6 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv,
1773 {
1774 struct txpd *local_tx_pd;
1775 struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb);
1776 - unsigned int pad;
1777 - int headroom = (priv->adapter->iface_type ==
1778 - MWIFIEX_USB) ? 0 : INTF_HEADER_LEN;
1779 -
1780 - pad = ((void *)skb->data - sizeof(*local_tx_pd) -
1781 - headroom - NULL) & (MWIFIEX_DMA_ALIGN_SZ - 1);
1782 - skb_push(skb, pad);
1783
1784 skb_push(skb, sizeof(*local_tx_pd));
1785
1786 @@ -121,12 +114,10 @@ mwifiex_11n_form_amsdu_txpd(struct mwifiex_private *priv,
1787 local_tx_pd->bss_num = priv->bss_num;
1788 local_tx_pd->bss_type = priv->bss_type;
1789 /* Always zero as the data is followed by struct txpd */
1790 - local_tx_pd->tx_pkt_offset = cpu_to_le16(sizeof(struct txpd) +
1791 - pad);
1792 + local_tx_pd->tx_pkt_offset = cpu_to_le16(sizeof(struct txpd));
1793 local_tx_pd->tx_pkt_type = cpu_to_le16(PKT_TYPE_AMSDU);
1794 local_tx_pd->tx_pkt_length = cpu_to_le16(skb->len -
1795 - sizeof(*local_tx_pd) -
1796 - pad);
1797 + sizeof(*local_tx_pd));
1798
1799 if (tx_info->flags & MWIFIEX_BUF_FLAG_TDLS_PKT)
1800 local_tx_pd->flags |= MWIFIEX_TXPD_FLAGS_TDLS_PACKET;
1801 @@ -190,7 +181,11 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
1802 ra_list_flags);
1803 return -1;
1804 }
1805 - skb_reserve(skb_aggr, MWIFIEX_MIN_DATA_HEADER_LEN);
1806 +
1807 + /* skb_aggr->data already 64 byte align, just reserve bus interface
1808 + * header and txpd.
1809 + */
1810 + skb_reserve(skb_aggr, headroom + sizeof(struct txpd));
1811 tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr);
1812
1813 memset(tx_info_aggr, 0, sizeof(*tx_info_aggr));
1814 diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
1815 index b9284b533294..ae2b69db5994 100644
1816 --- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
1817 +++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
1818 @@ -114,7 +114,8 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
1819 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) {
1820 p += sprintf(p, "multicast_count=\"%d\"\n",
1821 netdev_mc_count(netdev));
1822 - p += sprintf(p, "essid=\"%s\"\n", info.ssid.ssid);
1823 + p += sprintf(p, "essid=\"%.*s\"\n", info.ssid.ssid_len,
1824 + info.ssid.ssid);
1825 p += sprintf(p, "bssid=\"%pM\"\n", info.bssid);
1826 p += sprintf(p, "channel=\"%d\"\n", (int) info.bss_chan);
1827 p += sprintf(p, "country_code = \"%s\"\n", info.country_code);
1828 diff --git a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
1829 index 644f3a248741..1532ac9cee0b 100644
1830 --- a/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
1831 +++ b/drivers/net/wireless/marvell/mwifiex/sta_ioctl.c
1832 @@ -1159,8 +1159,6 @@ int mwifiex_set_encode(struct mwifiex_private *priv, struct key_params *kp,
1833 encrypt_key.is_rx_seq_valid = true;
1834 }
1835 } else {
1836 - if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP)
1837 - return 0;
1838 encrypt_key.key_disable = true;
1839 if (mac_addr)
1840 memcpy(encrypt_key.mac_addr, mac_addr, ETH_ALEN);
1841 diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c
1842 index b36ce185c9f2..86fa0fc69084 100644
1843 --- a/drivers/net/wireless/ti/wl18xx/event.c
1844 +++ b/drivers/net/wireless/ti/wl18xx/event.c
1845 @@ -218,5 +218,33 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
1846 if (vector & FW_LOGGER_INDICATION)
1847 wlcore_event_fw_logger(wl);
1848
1849 + if (vector & RX_BA_WIN_SIZE_CHANGE_EVENT_ID) {
1850 + struct wl12xx_vif *wlvif;
1851 + struct ieee80211_vif *vif;
1852 + struct ieee80211_sta *sta;
1853 + u8 link_id = mbox->rx_ba_link_id;
1854 + u8 win_size = mbox->rx_ba_win_size;
1855 + const u8 *addr;
1856 +
1857 + wlvif = wl->links[link_id].wlvif;
1858 + vif = wl12xx_wlvif_to_vif(wlvif);
1859 +
1860 + /* Update RX aggregation window size and call
1861 + * MAC routine to stop active RX aggregations for this link
1862 + */
1863 + if (wlvif->bss_type != BSS_TYPE_AP_BSS)
1864 + addr = vif->bss_conf.bssid;
1865 + else
1866 + addr = wl->links[link_id].addr;
1867 +
1868 + sta = ieee80211_find_sta(vif, addr);
1869 + if (sta) {
1870 + sta->max_rx_aggregation_subframes = win_size;
1871 + ieee80211_stop_rx_ba_session(vif,
1872 + wl->links[link_id].ba_bitmap,
1873 + addr);
1874 + }
1875 + }
1876 +
1877 return 0;
1878 }
1879 diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h
1880 index ce8ea9c04052..4af297fbb529 100644
1881 --- a/drivers/net/wireless/ti/wl18xx/event.h
1882 +++ b/drivers/net/wireless/ti/wl18xx/event.h
1883 @@ -38,6 +38,7 @@ enum {
1884 REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18),
1885 DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19),
1886 PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20),
1887 + RX_BA_WIN_SIZE_CHANGE_EVENT_ID = BIT(21),
1888 SMART_CONFIG_SYNC_EVENT_ID = BIT(22),
1889 SMART_CONFIG_DECODE_EVENT_ID = BIT(23),
1890 TIME_SYNC_EVENT_ID = BIT(24),
1891 diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
1892 index 06d6943b257c..5bdf7a03e3dd 100644
1893 --- a/drivers/net/wireless/ti/wl18xx/main.c
1894 +++ b/drivers/net/wireless/ti/wl18xx/main.c
1895 @@ -1041,7 +1041,8 @@ static int wl18xx_boot(struct wl1271 *wl)
1896 SMART_CONFIG_SYNC_EVENT_ID |
1897 SMART_CONFIG_DECODE_EVENT_ID |
1898 TIME_SYNC_EVENT_ID |
1899 - FW_LOGGER_INDICATION;
1900 + FW_LOGGER_INDICATION |
1901 + RX_BA_WIN_SIZE_CHANGE_EVENT_ID;
1902
1903 wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;
1904
1905 diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
1906 index 26cc23f32241..a4859993db3c 100644
1907 --- a/drivers/net/wireless/ti/wlcore/acx.c
1908 +++ b/drivers/net/wireless/ti/wlcore/acx.c
1909 @@ -1419,7 +1419,8 @@ int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
1910
1911 /* setup BA session receiver setting in the FW. */
1912 int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
1913 - u16 ssn, bool enable, u8 peer_hlid)
1914 + u16 ssn, bool enable, u8 peer_hlid,
1915 + u8 win_size)
1916 {
1917 struct wl1271_acx_ba_receiver_setup *acx;
1918 int ret;
1919 @@ -1435,7 +1436,7 @@ int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
1920 acx->hlid = peer_hlid;
1921 acx->tid = tid_index;
1922 acx->enable = enable;
1923 - acx->win_size = wl->conf.ht.rx_ba_win_size;
1924 + acx->win_size = win_size;
1925 acx->ssn = ssn;
1926
1927 ret = wlcore_cmd_configure_failsafe(wl, ACX_BA_SESSION_RX_SETUP, acx,
1928 diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h
1929 index 6321ed472891..f46d7fdf9a00 100644
1930 --- a/drivers/net/wireless/ti/wlcore/acx.h
1931 +++ b/drivers/net/wireless/ti/wlcore/acx.h
1932 @@ -1113,7 +1113,8 @@ int wl1271_acx_set_ht_information(struct wl1271 *wl,
1933 int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
1934 struct wl12xx_vif *wlvif);
1935 int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
1936 - u16 ssn, bool enable, u8 peer_hlid);
1937 + u16 ssn, bool enable, u8 peer_hlid,
1938 + u8 win_size);
1939 int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1940 u64 *mactime);
1941 int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1942 diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
1943 index 471521a0db7b..5438975c7ff2 100644
1944 --- a/drivers/net/wireless/ti/wlcore/main.c
1945 +++ b/drivers/net/wireless/ti/wlcore/main.c
1946 @@ -5285,7 +5285,9 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw,
1947 }
1948
1949 ret = wl12xx_acx_set_ba_receiver_session(wl, tid, *ssn, true,
1950 - hlid);
1951 + hlid,
1952 + params->buf_size);
1953 +
1954 if (!ret) {
1955 *ba_bitmap |= BIT(tid);
1956 wl->ba_rx_session_count++;
1957 @@ -5306,7 +5308,7 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw,
1958 }
1959
1960 ret = wl12xx_acx_set_ba_receiver_session(wl, tid, 0, false,
1961 - hlid);
1962 + hlid, 0);
1963 if (!ret) {
1964 *ba_bitmap &= ~BIT(tid);
1965 wl->ba_rx_session_count--;
1966 diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
1967 index fe00f9134d51..7dc726d7fbde 100644
1968 --- a/drivers/phy/Kconfig
1969 +++ b/drivers/phy/Kconfig
1970 @@ -456,6 +456,7 @@ config PHY_QCOM_UFS
1971 config PHY_TUSB1210
1972 tristate "TI TUSB1210 ULPI PHY module"
1973 depends on USB_ULPI_BUS
1974 + depends on EXTCON || !EXTCON # if EXTCON=m, this cannot be built-in
1975 select GENERIC_PHY
1976 help
1977 Support for TI TUSB1210 USB ULPI PHY.
1978 diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
1979 index e9584330aeed..50171fd3cc6d 100644
1980 --- a/drivers/power/supply/bq24190_charger.c
1981 +++ b/drivers/power/supply/bq24190_charger.c
1982 @@ -144,10 +144,7 @@
1983 * so the first read after a fault returns the latched value and subsequent
1984 * reads return the current value. In order to return the fault status
1985 * to the user, have the interrupt handler save the reg's value and retrieve
1986 - * it in the appropriate health/status routine. Each routine has its own
1987 - * flag indicating whether it should use the value stored by the last run
1988 - * of the interrupt handler or do an actual reg read. That way each routine
1989 - * can report back whatever fault may have occured.
1990 + * it in the appropriate health/status routine.
1991 */
1992 struct bq24190_dev_info {
1993 struct i2c_client *client;
1994 @@ -159,10 +156,6 @@ struct bq24190_dev_info {
1995 unsigned int gpio_int;
1996 unsigned int irq;
1997 struct mutex f_reg_lock;
1998 - bool first_time;
1999 - bool charger_health_valid;
2000 - bool battery_health_valid;
2001 - bool battery_status_valid;
2002 u8 f_reg;
2003 u8 ss_reg;
2004 u8 watchdog;
2005 @@ -636,21 +629,11 @@ static int bq24190_charger_get_health(struct bq24190_dev_info *bdi,
2006 union power_supply_propval *val)
2007 {
2008 u8 v;
2009 - int health, ret;
2010 + int health;
2011
2012 mutex_lock(&bdi->f_reg_lock);
2013 -
2014 - if (bdi->charger_health_valid) {
2015 - v = bdi->f_reg;
2016 - bdi->charger_health_valid = false;
2017 - mutex_unlock(&bdi->f_reg_lock);
2018 - } else {
2019 - mutex_unlock(&bdi->f_reg_lock);
2020 -
2021 - ret = bq24190_read(bdi, BQ24190_REG_F, &v);
2022 - if (ret < 0)
2023 - return ret;
2024 - }
2025 + v = bdi->f_reg;
2026 + mutex_unlock(&bdi->f_reg_lock);
2027
2028 if (v & BQ24190_REG_F_BOOST_FAULT_MASK) {
2029 /*
2030 @@ -937,18 +920,8 @@ static int bq24190_battery_get_status(struct bq24190_dev_info *bdi,
2031 int status, ret;
2032
2033 mutex_lock(&bdi->f_reg_lock);
2034 -
2035 - if (bdi->battery_status_valid) {
2036 - chrg_fault = bdi->f_reg;
2037 - bdi->battery_status_valid = false;
2038 - mutex_unlock(&bdi->f_reg_lock);
2039 - } else {
2040 - mutex_unlock(&bdi->f_reg_lock);
2041 -
2042 - ret = bq24190_read(bdi, BQ24190_REG_F, &chrg_fault);
2043 - if (ret < 0)
2044 - return ret;
2045 - }
2046 + chrg_fault = bdi->f_reg;
2047 + mutex_unlock(&bdi->f_reg_lock);
2048
2049 chrg_fault &= BQ24190_REG_F_CHRG_FAULT_MASK;
2050 chrg_fault >>= BQ24190_REG_F_CHRG_FAULT_SHIFT;
2051 @@ -996,21 +969,11 @@ static int bq24190_battery_get_health(struct bq24190_dev_info *bdi,
2052 union power_supply_propval *val)
2053 {
2054 u8 v;
2055 - int health, ret;
2056 + int health;
2057
2058 mutex_lock(&bdi->f_reg_lock);
2059 -
2060 - if (bdi->battery_health_valid) {
2061 - v = bdi->f_reg;
2062 - bdi->battery_health_valid = false;
2063 - mutex_unlock(&bdi->f_reg_lock);
2064 - } else {
2065 - mutex_unlock(&bdi->f_reg_lock);
2066 -
2067 - ret = bq24190_read(bdi, BQ24190_REG_F, &v);
2068 - if (ret < 0)
2069 - return ret;
2070 - }
2071 + v = bdi->f_reg;
2072 + mutex_unlock(&bdi->f_reg_lock);
2073
2074 if (v & BQ24190_REG_F_BAT_FAULT_MASK) {
2075 health = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
2076 @@ -1197,9 +1160,12 @@ static const struct power_supply_desc bq24190_battery_desc = {
2077 static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
2078 {
2079 struct bq24190_dev_info *bdi = data;
2080 - bool alert_userspace = false;
2081 + const u8 battery_mask_ss = BQ24190_REG_SS_CHRG_STAT_MASK;
2082 + const u8 battery_mask_f = BQ24190_REG_F_BAT_FAULT_MASK
2083 + | BQ24190_REG_F_NTC_FAULT_MASK;
2084 + bool alert_charger = false, alert_battery = false;
2085 u8 ss_reg = 0, f_reg = 0;
2086 - int ret;
2087 + int i, ret;
2088
2089 pm_runtime_get_sync(bdi->dev);
2090
2091 @@ -1209,6 +1175,32 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
2092 goto out;
2093 }
2094
2095 + i = 0;
2096 + do {
2097 + ret = bq24190_read(bdi, BQ24190_REG_F, &f_reg);
2098 + if (ret < 0) {
2099 + dev_err(bdi->dev, "Can't read F reg: %d\n", ret);
2100 + goto out;
2101 + }
2102 + } while (f_reg && ++i < 2);
2103 +
2104 + if (f_reg != bdi->f_reg) {
2105 + dev_info(bdi->dev,
2106 + "Fault: boost %d, charge %d, battery %d, ntc %d\n",
2107 + !!(f_reg & BQ24190_REG_F_BOOST_FAULT_MASK),
2108 + !!(f_reg & BQ24190_REG_F_CHRG_FAULT_MASK),
2109 + !!(f_reg & BQ24190_REG_F_BAT_FAULT_MASK),
2110 + !!(f_reg & BQ24190_REG_F_NTC_FAULT_MASK));
2111 +
2112 + mutex_lock(&bdi->f_reg_lock);
2113 + if ((bdi->f_reg & battery_mask_f) != (f_reg & battery_mask_f))
2114 + alert_battery = true;
2115 + if ((bdi->f_reg & ~battery_mask_f) != (f_reg & ~battery_mask_f))
2116 + alert_charger = true;
2117 + bdi->f_reg = f_reg;
2118 + mutex_unlock(&bdi->f_reg_lock);
2119 + }
2120 +
2121 if (ss_reg != bdi->ss_reg) {
2122 /*
2123 * The device is in host mode so when PG_STAT goes from 1->0
2124 @@ -1225,47 +1217,17 @@ static irqreturn_t bq24190_irq_handler_thread(int irq, void *data)
2125 ret);
2126 }
2127
2128 + if ((bdi->ss_reg & battery_mask_ss) != (ss_reg & battery_mask_ss))
2129 + alert_battery = true;
2130 + if ((bdi->ss_reg & ~battery_mask_ss) != (ss_reg & ~battery_mask_ss))
2131 + alert_charger = true;
2132 bdi->ss_reg = ss_reg;
2133 - alert_userspace = true;
2134 - }
2135 -
2136 - mutex_lock(&bdi->f_reg_lock);
2137 -
2138 - ret = bq24190_read(bdi, BQ24190_REG_F, &f_reg);
2139 - if (ret < 0) {
2140 - mutex_unlock(&bdi->f_reg_lock);
2141 - dev_err(bdi->dev, "Can't read F reg: %d\n", ret);
2142 - goto out;
2143 }
2144
2145 - if (f_reg != bdi->f_reg) {
2146 - bdi->f_reg = f_reg;
2147 - bdi->charger_health_valid = true;
2148 - bdi->battery_health_valid = true;
2149 - bdi->battery_status_valid = true;
2150 -
2151 - alert_userspace = true;
2152 - }
2153 -
2154 - mutex_unlock(&bdi->f_reg_lock);
2155 -
2156 - /*
2157 - * Sometimes bq24190 gives a steady trickle of interrupts even
2158 - * though the watchdog timer is turned off and neither the STATUS
2159 - * nor FAULT registers have changed. Weed out these sprurious
2160 - * interrupts so userspace isn't alerted for no reason.
2161 - * In addition, the chip always generates an interrupt after
2162 - * register reset so we should ignore that one (the very first
2163 - * interrupt received).
2164 - */
2165 - if (alert_userspace) {
2166 - if (!bdi->first_time) {
2167 - power_supply_changed(bdi->charger);
2168 - power_supply_changed(bdi->battery);
2169 - } else {
2170 - bdi->first_time = false;
2171 - }
2172 - }
2173 + if (alert_charger)
2174 + power_supply_changed(bdi->charger);
2175 + if (alert_battery)
2176 + power_supply_changed(bdi->battery);
2177
2178 out:
2179 pm_runtime_put_sync(bdi->dev);
2180 @@ -1300,6 +1262,10 @@ static int bq24190_hw_init(struct bq24190_dev_info *bdi)
2181 goto out;
2182
2183 ret = bq24190_set_mode_host(bdi);
2184 + if (ret < 0)
2185 + goto out;
2186 +
2187 + ret = bq24190_read(bdi, BQ24190_REG_SS, &bdi->ss_reg);
2188 out:
2189 pm_runtime_put_sync(bdi->dev);
2190 return ret;
2191 @@ -1375,10 +1341,8 @@ static int bq24190_probe(struct i2c_client *client,
2192 bdi->model = id->driver_data;
2193 strncpy(bdi->model_name, id->name, I2C_NAME_SIZE);
2194 mutex_init(&bdi->f_reg_lock);
2195 - bdi->first_time = true;
2196 - bdi->charger_health_valid = false;
2197 - bdi->battery_health_valid = false;
2198 - bdi->battery_status_valid = false;
2199 + bdi->f_reg = 0;
2200 + bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state */
2201
2202 i2c_set_clientdata(client, bdi);
2203
2204 @@ -1392,22 +1356,13 @@ static int bq24190_probe(struct i2c_client *client,
2205 return -EINVAL;
2206 }
2207
2208 - ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
2209 - bq24190_irq_handler_thread,
2210 - IRQF_TRIGGER_RISING | IRQF_ONESHOT,
2211 - "bq24190-charger", bdi);
2212 - if (ret < 0) {
2213 - dev_err(dev, "Can't set up irq handler\n");
2214 - goto out1;
2215 - }
2216 -
2217 pm_runtime_enable(dev);
2218 pm_runtime_resume(dev);
2219
2220 ret = bq24190_hw_init(bdi);
2221 if (ret < 0) {
2222 dev_err(dev, "Hardware init failed\n");
2223 - goto out2;
2224 + goto out1;
2225 }
2226
2227 charger_cfg.drv_data = bdi;
2228 @@ -1418,7 +1373,7 @@ static int bq24190_probe(struct i2c_client *client,
2229 if (IS_ERR(bdi->charger)) {
2230 dev_err(dev, "Can't register charger\n");
2231 ret = PTR_ERR(bdi->charger);
2232 - goto out2;
2233 + goto out1;
2234 }
2235
2236 battery_cfg.drv_data = bdi;
2237 @@ -1427,24 +1382,34 @@ static int bq24190_probe(struct i2c_client *client,
2238 if (IS_ERR(bdi->battery)) {
2239 dev_err(dev, "Can't register battery\n");
2240 ret = PTR_ERR(bdi->battery);
2241 - goto out3;
2242 + goto out2;
2243 }
2244
2245 ret = bq24190_sysfs_create_group(bdi);
2246 if (ret) {
2247 dev_err(dev, "Can't create sysfs entries\n");
2248 + goto out3;
2249 + }
2250 +
2251 + ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
2252 + bq24190_irq_handler_thread,
2253 + IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
2254 + "bq24190-charger", bdi);
2255 + if (ret < 0) {
2256 + dev_err(dev, "Can't set up irq handler\n");
2257 goto out4;
2258 }
2259
2260 return 0;
2261
2262 out4:
2263 - power_supply_unregister(bdi->battery);
2264 + bq24190_sysfs_remove_group(bdi);
2265 out3:
2266 - power_supply_unregister(bdi->charger);
2267 + power_supply_unregister(bdi->battery);
2268 out2:
2269 - pm_runtime_disable(dev);
2270 + power_supply_unregister(bdi->charger);
2271 out1:
2272 + pm_runtime_disable(dev);
2273 if (bdi->gpio_int)
2274 gpio_free(bdi->gpio_int);
2275
2276 @@ -1488,12 +1453,13 @@ static int bq24190_pm_resume(struct device *dev)
2277 struct i2c_client *client = to_i2c_client(dev);
2278 struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
2279
2280 - bdi->charger_health_valid = false;
2281 - bdi->battery_health_valid = false;
2282 - bdi->battery_status_valid = false;
2283 + bdi->f_reg = 0;
2284 + bdi->ss_reg = BQ24190_REG_SS_VBUS_STAT_MASK; /* impossible state */
2285
2286 pm_runtime_get_sync(bdi->dev);
2287 bq24190_register_reset(bdi);
2288 + bq24190_set_mode_host(bdi);
2289 + bq24190_read(bdi, BQ24190_REG_SS, &bdi->ss_reg);
2290 pm_runtime_put_sync(bdi->dev);
2291
2292 /* Things may have changed while suspended so alert upper layer */
2293 diff --git a/drivers/power/supply/lp8788-charger.c b/drivers/power/supply/lp8788-charger.c
2294 index 7321b727d484..cd614fe69d14 100644
2295 --- a/drivers/power/supply/lp8788-charger.c
2296 +++ b/drivers/power/supply/lp8788-charger.c
2297 @@ -654,7 +654,7 @@ static ssize_t lp8788_show_eoc_time(struct device *dev,
2298 {
2299 struct lp8788_charger *pchg = dev_get_drvdata(dev);
2300 char *stime[] = { "400ms", "5min", "10min", "15min",
2301 - "20min", "25min", "30min" "No timeout" };
2302 + "20min", "25min", "30min", "No timeout" };
2303 u8 val;
2304
2305 lp8788_read_byte(pchg->lp, LP8788_CHG_EOC, &val);
2306 diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
2307 index 3e2bdb90813c..17b1574920fd 100644
2308 --- a/drivers/scsi/Kconfig
2309 +++ b/drivers/scsi/Kconfig
2310 @@ -1497,7 +1497,7 @@ config ATARI_SCSI
2311
2312 config MAC_SCSI
2313 tristate "Macintosh NCR5380 SCSI"
2314 - depends on MAC && SCSI=y
2315 + depends on MAC && SCSI
2316 select SCSI_SPI_ATTRS
2317 help
2318 This is the NCR 5380 SCSI controller included on most of the 68030
2319 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
2320 index 734e592a247e..f9b52a4b8c55 100644
2321 --- a/drivers/scsi/qla2xxx/qla_os.c
2322 +++ b/drivers/scsi/qla2xxx/qla_os.c
2323 @@ -1464,7 +1464,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
2324 /* Don't abort commands in adapter during EEH
2325 * recovery as it's not accessible/responding.
2326 */
2327 - if (GET_CMD_SP(sp) && !ha->flags.eeh_busy) {
2328 + if (GET_CMD_SP(sp) && !ha->flags.eeh_busy &&
2329 + (sp->type == SRB_SCSI_CMD)) {
2330 /* Get a reference to the sp and drop the lock.
2331 * The reference ensures this sp->done() call
2332 * - and not the call in qla2xxx_eh_abort() -
2333 diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
2334 index a535b2661f38..96a343ec8313 100644
2335 --- a/drivers/scsi/smartpqi/smartpqi_init.c
2336 +++ b/drivers/scsi/smartpqi/smartpqi_init.c
2337 @@ -533,8 +533,7 @@ static int pqi_write_current_time_to_host_wellness(
2338 size_t buffer_length;
2339 time64_t local_time;
2340 unsigned int year;
2341 - struct timeval time;
2342 - struct rtc_time tm;
2343 + struct tm tm;
2344
2345 buffer_length = sizeof(*buffer);
2346
2347 @@ -551,9 +550,8 @@ static int pqi_write_current_time_to_host_wellness(
2348 put_unaligned_le16(sizeof(buffer->time),
2349 &buffer->time_length);
2350
2351 - do_gettimeofday(&time);
2352 - local_time = time.tv_sec - (sys_tz.tz_minuteswest * 60);
2353 - rtc_time64_to_tm(local_time, &tm);
2354 + local_time = ktime_get_real_seconds();
2355 + time64_to_tm(local_time, -sys_tz.tz_minuteswest * 60, &tm);
2356 year = tm.tm_year + 1900;
2357
2358 buffer->time[0] = bin2bcd(tm.tm_hour);
2359 diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
2360 index c3e298843b43..1055649f034c 100644
2361 --- a/drivers/staging/emxx_udc/emxx_udc.c
2362 +++ b/drivers/staging/emxx_udc/emxx_udc.c
2363 @@ -3160,7 +3160,7 @@ static const struct {
2364 };
2365
2366 /*-------------------------------------------------------------------------*/
2367 -static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
2368 +static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
2369 {
2370 int i;
2371
2372 @@ -3191,7 +3191,7 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
2373
2374 /*-------------------------------------------------------------------------*/
2375 /* platform_driver */
2376 -static int __init nbu2ss_drv_contest_init(
2377 +static int nbu2ss_drv_contest_init(
2378 struct platform_device *pdev,
2379 struct nbu2ss_udc *udc)
2380 {
2381 diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c
2382 index 23fda9d98bff..13ec24d44b04 100644
2383 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
2384 +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
2385 @@ -924,27 +924,29 @@ static ssize_t ll_unstable_stats_seq_write(struct file *file,
2386 }
2387 LPROC_SEQ_FOPS(ll_unstable_stats);
2388
2389 -static ssize_t root_squash_show(struct kobject *kobj, struct attribute *attr,
2390 - char *buf)
2391 +static int ll_root_squash_seq_show(struct seq_file *m, void *v)
2392 {
2393 - struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
2394 - ll_kobj);
2395 + struct super_block *sb = m->private;
2396 + struct ll_sb_info *sbi = ll_s2sbi(sb);
2397 struct root_squash_info *squash = &sbi->ll_squash;
2398
2399 - return sprintf(buf, "%u:%u\n", squash->rsi_uid, squash->rsi_gid);
2400 + seq_printf(m, "%u:%u\n", squash->rsi_uid, squash->rsi_gid);
2401 + return 0;
2402 }
2403
2404 -static ssize_t root_squash_store(struct kobject *kobj, struct attribute *attr,
2405 - const char *buffer, size_t count)
2406 +static ssize_t ll_root_squash_seq_write(struct file *file,
2407 + const char __user *buffer,
2408 + size_t count, loff_t *off)
2409 {
2410 - struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
2411 - ll_kobj);
2412 + struct seq_file *m = file->private_data;
2413 + struct super_block *sb = m->private;
2414 + struct ll_sb_info *sbi = ll_s2sbi(sb);
2415 struct root_squash_info *squash = &sbi->ll_squash;
2416
2417 return lprocfs_wr_root_squash(buffer, count, squash,
2418 - ll_get_fsname(sbi->ll_sb, NULL, 0));
2419 + ll_get_fsname(sb, NULL, 0));
2420 }
2421 -LUSTRE_RW_ATTR(root_squash);
2422 +LPROC_SEQ_FOPS(ll_root_squash);
2423
2424 static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
2425 {
2426 @@ -997,6 +999,8 @@ static struct lprocfs_vars lprocfs_llite_obd_vars[] = {
2427 { "statahead_stats", &ll_statahead_stats_fops, NULL, 0 },
2428 { "unstable_stats", &ll_unstable_stats_fops, NULL },
2429 { "sbi_flags", &ll_sbi_flags_fops, NULL, 0 },
2430 + { .name = "root_squash",
2431 + .fops = &ll_root_squash_fops },
2432 { .name = "nosquash_nids",
2433 .fops = &ll_nosquash_nids_fops },
2434 { NULL }
2435 @@ -1027,7 +1031,6 @@ static struct attribute *llite_attrs[] = {
2436 &lustre_attr_max_easize.attr,
2437 &lustre_attr_default_easize.attr,
2438 &lustre_attr_xattr_cache.attr,
2439 - &lustre_attr_root_squash.attr,
2440 NULL,
2441 };
2442
2443 diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
2444 index 825a63a7c0e3..2e075a60f876 100644
2445 --- a/drivers/staging/wlan-ng/p80211netdev.c
2446 +++ b/drivers/staging/wlan-ng/p80211netdev.c
2447 @@ -232,7 +232,7 @@ static int p80211_convert_to_ether(struct wlandevice *wlandev, struct sk_buff *s
2448 struct p80211_hdr_a3 *hdr;
2449
2450 hdr = (struct p80211_hdr_a3 *)skb->data;
2451 - if (p80211_rx_typedrop(wlandev, hdr->fc))
2452 + if (p80211_rx_typedrop(wlandev, le16_to_cpu(hdr->fc)))
2453 return CONV_TO_ETHER_SKIPPED;
2454
2455 /* perform mcast filtering: allow my local address through but reject
2456 diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
2457 index f4eb807a2616..da31159a03ec 100644
2458 --- a/drivers/tty/serial/8250/8250_omap.c
2459 +++ b/drivers/tty/serial/8250/8250_omap.c
2460 @@ -1237,7 +1237,8 @@ static int omap8250_probe(struct platform_device *pdev)
2461 pm_runtime_put_autosuspend(&pdev->dev);
2462 return 0;
2463 err:
2464 - pm_runtime_put(&pdev->dev);
2465 + pm_runtime_dont_use_autosuspend(&pdev->dev);
2466 + pm_runtime_put_sync(&pdev->dev);
2467 pm_runtime_disable(&pdev->dev);
2468 return ret;
2469 }
2470 @@ -1246,6 +1247,7 @@ static int omap8250_remove(struct platform_device *pdev)
2471 {
2472 struct omap8250_priv *priv = platform_get_drvdata(pdev);
2473
2474 + pm_runtime_dont_use_autosuspend(&pdev->dev);
2475 pm_runtime_put_sync(&pdev->dev);
2476 pm_runtime_disable(&pdev->dev);
2477 serial8250_unregister_port(priv->line);
2478 @@ -1345,6 +1347,10 @@ static int omap8250_runtime_suspend(struct device *dev)
2479 struct omap8250_priv *priv = dev_get_drvdata(dev);
2480 struct uart_8250_port *up;
2481
2482 + /* In case runtime-pm tries this before we are setup */
2483 + if (!priv)
2484 + return 0;
2485 +
2486 up = serial8250_get_port(priv->line);
2487 /*
2488 * When using 'no_console_suspend', the console UART must not be
2489 diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
2490 index cd414559040f..05bc4d631cb9 100644
2491 --- a/drivers/usb/chipidea/ci.h
2492 +++ b/drivers/usb/chipidea/ci.h
2493 @@ -428,9 +428,6 @@ int hw_port_test_set(struct ci_hdrc *ci, u8 mode);
2494
2495 u8 hw_port_test_get(struct ci_hdrc *ci);
2496
2497 -int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
2498 - u32 value, unsigned int timeout_ms);
2499 -
2500 void ci_platform_configure(struct ci_hdrc *ci);
2501
2502 int dbg_create_files(struct ci_hdrc *ci);
2503 diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
2504 index 3dbb4a21ab44..6e0d614a8075 100644
2505 --- a/drivers/usb/chipidea/core.c
2506 +++ b/drivers/usb/chipidea/core.c
2507 @@ -516,38 +516,6 @@ int hw_device_reset(struct ci_hdrc *ci)
2508 return 0;
2509 }
2510
2511 -/**
2512 - * hw_wait_reg: wait the register value
2513 - *
2514 - * Sometimes, it needs to wait register value before going on.
2515 - * Eg, when switch to device mode, the vbus value should be lower
2516 - * than OTGSC_BSV before connects to host.
2517 - *
2518 - * @ci: the controller
2519 - * @reg: register index
2520 - * @mask: mast bit
2521 - * @value: the bit value to wait
2522 - * @timeout_ms: timeout in millisecond
2523 - *
2524 - * This function returns an error code if timeout
2525 - */
2526 -int hw_wait_reg(struct ci_hdrc *ci, enum ci_hw_regs reg, u32 mask,
2527 - u32 value, unsigned int timeout_ms)
2528 -{
2529 - unsigned long elapse = jiffies + msecs_to_jiffies(timeout_ms);
2530 -
2531 - while (hw_read(ci, reg, mask) != value) {
2532 - if (time_after(jiffies, elapse)) {
2533 - dev_err(ci->dev, "timeout waiting for %08x in %d\n",
2534 - mask, reg);
2535 - return -ETIMEDOUT;
2536 - }
2537 - msleep(20);
2538 - }
2539 -
2540 - return 0;
2541 -}
2542 -
2543 static irqreturn_t ci_irq(int irq, void *data)
2544 {
2545 struct ci_hdrc *ci = data;
2546 diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c
2547 index 03b6743461d1..0cf149edddd8 100644
2548 --- a/drivers/usb/chipidea/otg.c
2549 +++ b/drivers/usb/chipidea/otg.c
2550 @@ -44,12 +44,15 @@ u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask)
2551 else
2552 val &= ~OTGSC_BSVIS;
2553
2554 - cable->changed = false;
2555 -
2556 if (cable->state)
2557 val |= OTGSC_BSV;
2558 else
2559 val &= ~OTGSC_BSV;
2560 +
2561 + if (cable->enabled)
2562 + val |= OTGSC_BSVIE;
2563 + else
2564 + val &= ~OTGSC_BSVIE;
2565 }
2566
2567 cable = &ci->platdata->id_extcon;
2568 @@ -59,15 +62,18 @@ u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask)
2569 else
2570 val &= ~OTGSC_IDIS;
2571
2572 - cable->changed = false;
2573 -
2574 if (cable->state)
2575 val |= OTGSC_ID;
2576 else
2577 val &= ~OTGSC_ID;
2578 +
2579 + if (cable->enabled)
2580 + val |= OTGSC_IDIE;
2581 + else
2582 + val &= ~OTGSC_IDIE;
2583 }
2584
2585 - return val;
2586 + return val & mask;
2587 }
2588
2589 /**
2590 @@ -77,6 +83,36 @@ u32 hw_read_otgsc(struct ci_hdrc *ci, u32 mask)
2591 */
2592 void hw_write_otgsc(struct ci_hdrc *ci, u32 mask, u32 data)
2593 {
2594 + struct ci_hdrc_cable *cable;
2595 +
2596 + cable = &ci->platdata->vbus_extcon;
2597 + if (!IS_ERR(cable->edev)) {
2598 + if (data & mask & OTGSC_BSVIS)
2599 + cable->changed = false;
2600 +
2601 + /* Don't enable vbus interrupt if using external notifier */
2602 + if (data & mask & OTGSC_BSVIE) {
2603 + cable->enabled = true;
2604 + data &= ~OTGSC_BSVIE;
2605 + } else if (mask & OTGSC_BSVIE) {
2606 + cable->enabled = false;
2607 + }
2608 + }
2609 +
2610 + cable = &ci->platdata->id_extcon;
2611 + if (!IS_ERR(cable->edev)) {
2612 + if (data & mask & OTGSC_IDIS)
2613 + cable->changed = false;
2614 +
2615 + /* Don't enable id interrupt if using external notifier */
2616 + if (data & mask & OTGSC_IDIE) {
2617 + cable->enabled = true;
2618 + data &= ~OTGSC_IDIE;
2619 + } else if (mask & OTGSC_IDIE) {
2620 + cable->enabled = false;
2621 + }
2622 + }
2623 +
2624 hw_write(ci, OP_OTGSC, mask | OTGSC_INT_STATUS_BITS, data);
2625 }
2626
2627 @@ -104,7 +140,31 @@ void ci_handle_vbus_change(struct ci_hdrc *ci)
2628 usb_gadget_vbus_disconnect(&ci->gadget);
2629 }
2630
2631 -#define CI_VBUS_STABLE_TIMEOUT_MS 5000
2632 +/**
2633 + * When we switch to device mode, the vbus value should be lower
2634 + * than OTGSC_BSV before connecting to host.
2635 + *
2636 + * @ci: the controller
2637 + *
2638 + * This function returns an error code if timeout
2639 + */
2640 +static int hw_wait_vbus_lower_bsv(struct ci_hdrc *ci)
2641 +{
2642 + unsigned long elapse = jiffies + msecs_to_jiffies(5000);
2643 + u32 mask = OTGSC_BSV;
2644 +
2645 + while (hw_read_otgsc(ci, mask)) {
2646 + if (time_after(jiffies, elapse)) {
2647 + dev_err(ci->dev, "timeout waiting for %08x in OTGSC\n",
2648 + mask);
2649 + return -ETIMEDOUT;
2650 + }
2651 + msleep(20);
2652 + }
2653 +
2654 + return 0;
2655 +}
2656 +
2657 static void ci_handle_id_switch(struct ci_hdrc *ci)
2658 {
2659 enum ci_role role = ci_otg_role(ci);
2660 @@ -116,9 +176,11 @@ static void ci_handle_id_switch(struct ci_hdrc *ci)
2661 ci_role_stop(ci);
2662
2663 if (role == CI_ROLE_GADGET)
2664 - /* wait vbus lower than OTGSC_BSV */
2665 - hw_wait_reg(ci, OP_OTGSC, OTGSC_BSV, 0,
2666 - CI_VBUS_STABLE_TIMEOUT_MS);
2667 + /*
2668 + * wait vbus lower than OTGSC_BSV before connecting
2669 + * to host
2670 + */
2671 + hw_wait_vbus_lower_bsv(ci);
2672
2673 ci_role_start(ci, role);
2674 }
2675 diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
2676 index 4c0fa0b17353..f6759c61ad07 100644
2677 --- a/drivers/usb/dwc2/core.c
2678 +++ b/drivers/usb/dwc2/core.c
2679 @@ -455,7 +455,7 @@ static void dwc2_clear_force_mode(struct dwc2_hsotg *hsotg)
2680 dwc2_writel(gusbcfg, hsotg->regs + GUSBCFG);
2681
2682 if (dwc2_iddig_filter_enabled(hsotg))
2683 - usleep_range(100000, 110000);
2684 + msleep(100);
2685 }
2686
2687 /*
2688 diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
2689 index 42e5b66353ef..7a603f66a9bc 100644
2690 --- a/drivers/usb/host/ehci-exynos.c
2691 +++ b/drivers/usb/host/ehci-exynos.c
2692 @@ -77,10 +77,12 @@ static int exynos_ehci_get_phy(struct device *dev,
2693 if (IS_ERR(phy)) {
2694 ret = PTR_ERR(phy);
2695 if (ret == -EPROBE_DEFER) {
2696 + of_node_put(child);
2697 return ret;
2698 } else if (ret != -ENOSYS && ret != -ENODEV) {
2699 dev_err(dev,
2700 "Error retrieving usb2 phy: %d\n", ret);
2701 + of_node_put(child);
2702 return ret;
2703 }
2704 }
2705 diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
2706 index 2cd105be7319..6865b919403f 100644
2707 --- a/drivers/usb/host/ohci-exynos.c
2708 +++ b/drivers/usb/host/ohci-exynos.c
2709 @@ -66,10 +66,12 @@ static int exynos_ohci_get_phy(struct device *dev,
2710 if (IS_ERR(phy)) {
2711 ret = PTR_ERR(phy);
2712 if (ret == -EPROBE_DEFER) {
2713 + of_node_put(child);
2714 return ret;
2715 } else if (ret != -ENOSYS && ret != -ENODEV) {
2716 dev_err(dev,
2717 "Error retrieving usb2 phy: %d\n", ret);
2718 + of_node_put(child);
2719 return ret;
2720 }
2721 }
2722 diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
2723 index 7812052dc700..754fc3e41005 100644
2724 --- a/drivers/usb/serial/ark3116.c
2725 +++ b/drivers/usb/serial/ark3116.c
2726 @@ -373,23 +373,29 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
2727 dev_dbg(&port->dev,
2728 "%s - usb_serial_generic_open failed: %d\n",
2729 __func__, result);
2730 - goto err_out;
2731 + goto err_free;
2732 }
2733
2734 /* remove any data still left: also clears error state */
2735 ark3116_read_reg(serial, UART_RX, buf);
2736
2737 /* read modem status */
2738 - priv->msr = ark3116_read_reg(serial, UART_MSR, buf);
2739 + result = ark3116_read_reg(serial, UART_MSR, buf);
2740 + if (result < 0)
2741 + goto err_close;
2742 + priv->msr = *buf;
2743 +
2744 /* read line status */
2745 - priv->lsr = ark3116_read_reg(serial, UART_LSR, buf);
2746 + result = ark3116_read_reg(serial, UART_LSR, buf);
2747 + if (result < 0)
2748 + goto err_close;
2749 + priv->lsr = *buf;
2750
2751 result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
2752 if (result) {
2753 dev_err(&port->dev, "submit irq_in urb failed %d\n",
2754 result);
2755 - ark3116_close(port);
2756 - goto err_out;
2757 + goto err_close;
2758 }
2759
2760 /* activate interrupts */
2761 @@ -402,8 +408,15 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port)
2762 if (tty)
2763 ark3116_set_termios(tty, port, NULL);
2764
2765 -err_out:
2766 kfree(buf);
2767 +
2768 + return 0;
2769 +
2770 +err_close:
2771 + usb_serial_generic_close(port);
2772 +err_free:
2773 + kfree(buf);
2774 +
2775 return result;
2776 }
2777
2778 diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
2779 index 30bf0f5db82d..7ab3235febfc 100644
2780 --- a/drivers/usb/serial/digi_acceleport.c
2781 +++ b/drivers/usb/serial/digi_acceleport.c
2782 @@ -1398,25 +1398,30 @@ static int digi_read_inb_callback(struct urb *urb)
2783 {
2784 struct usb_serial_port *port = urb->context;
2785 struct digi_port *priv = usb_get_serial_port_data(port);
2786 - int opcode = ((unsigned char *)urb->transfer_buffer)[0];
2787 - int len = ((unsigned char *)urb->transfer_buffer)[1];
2788 - int port_status = ((unsigned char *)urb->transfer_buffer)[2];
2789 - unsigned char *data = ((unsigned char *)urb->transfer_buffer) + 3;
2790 + unsigned char *buf = urb->transfer_buffer;
2791 + int opcode;
2792 + int len;
2793 + int port_status;
2794 + unsigned char *data;
2795 int flag, throttled;
2796 - int status = urb->status;
2797 -
2798 - /* do not process callbacks on closed ports */
2799 - /* but do continue the read chain */
2800 - if (urb->status == -ENOENT)
2801 - return 0;
2802
2803 /* short/multiple packet check */
2804 + if (urb->actual_length < 2) {
2805 + dev_warn(&port->dev, "short packet received\n");
2806 + return -1;
2807 + }
2808 +
2809 + opcode = buf[0];
2810 + len = buf[1];
2811 +
2812 if (urb->actual_length != len + 2) {
2813 - dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, "
2814 - "status=%d, port=%d, opcode=%d, len=%d, "
2815 - "actual_length=%d, status=%d\n", __func__, status,
2816 - priv->dp_port_num, opcode, len, urb->actual_length,
2817 - port_status);
2818 + dev_err(&port->dev, "malformed packet received: port=%d, opcode=%d, len=%d, actual_length=%u\n",
2819 + priv->dp_port_num, opcode, len, urb->actual_length);
2820 + return -1;
2821 + }
2822 +
2823 + if (opcode == DIGI_CMD_RECEIVE_DATA && len < 1) {
2824 + dev_err(&port->dev, "malformed data packet received\n");
2825 return -1;
2826 }
2827
2828 @@ -1430,6 +1435,9 @@ static int digi_read_inb_callback(struct urb *urb)
2829
2830 /* receive data */
2831 if (opcode == DIGI_CMD_RECEIVE_DATA) {
2832 + port_status = buf[2];
2833 + data = &buf[3];
2834 +
2835 /* get flag from port_status */
2836 flag = 0;
2837
2838 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2839 index 99a0a5f1b400..d8d13eede6d9 100644
2840 --- a/drivers/usb/serial/ftdi_sio.c
2841 +++ b/drivers/usb/serial/ftdi_sio.c
2842 @@ -1439,10 +1439,13 @@ static int read_latency_timer(struct usb_serial_port *port)
2843 FTDI_SIO_GET_LATENCY_TIMER_REQUEST_TYPE,
2844 0, priv->interface,
2845 buf, 1, WDR_TIMEOUT);
2846 - if (rv < 0)
2847 + if (rv < 1) {
2848 dev_err(&port->dev, "Unable to read latency timer: %i\n", rv);
2849 - else
2850 + if (rv >= 0)
2851 + rv = -EIO;
2852 + } else {
2853 priv->latency = buf[0];
2854 + }
2855
2856 kfree(buf);
2857
2858 diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
2859 index 36dfe9972b17..464db17b5328 100644
2860 --- a/drivers/usb/serial/io_edgeport.c
2861 +++ b/drivers/usb/serial/io_edgeport.c
2862 @@ -492,20 +492,24 @@ static int get_epic_descriptor(struct edgeport_serial *ep)
2863 int result;
2864 struct usb_serial *serial = ep->serial;
2865 struct edgeport_product_info *product_info = &ep->product_info;
2866 - struct edge_compatibility_descriptor *epic = &ep->epic_descriptor;
2867 + struct edge_compatibility_descriptor *epic;
2868 struct edge_compatibility_bits *bits;
2869 struct device *dev = &serial->dev->dev;
2870
2871 ep->is_epic = 0;
2872 +
2873 + epic = kmalloc(sizeof(*epic), GFP_KERNEL);
2874 + if (!epic)
2875 + return -ENOMEM;
2876 +
2877 result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
2878 USB_REQUEST_ION_GET_EPIC_DESC,
2879 0xC0, 0x00, 0x00,
2880 - &ep->epic_descriptor,
2881 - sizeof(struct edge_compatibility_descriptor),
2882 + epic, sizeof(*epic),
2883 300);
2884 -
2885 - if (result > 0) {
2886 + if (result == sizeof(*epic)) {
2887 ep->is_epic = 1;
2888 + memcpy(&ep->epic_descriptor, epic, sizeof(*epic));
2889 memset(product_info, 0, sizeof(struct edgeport_product_info));
2890
2891 product_info->NumPorts = epic->NumPorts;
2892 @@ -534,8 +538,16 @@ static int get_epic_descriptor(struct edgeport_serial *ep)
2893 dev_dbg(dev, " IOSPWriteLCR : %s\n", bits->IOSPWriteLCR ? "TRUE": "FALSE");
2894 dev_dbg(dev, " IOSPSetBaudRate : %s\n", bits->IOSPSetBaudRate ? "TRUE": "FALSE");
2895 dev_dbg(dev, " TrueEdgeport : %s\n", bits->TrueEdgeport ? "TRUE": "FALSE");
2896 +
2897 + result = 0;
2898 + } else if (result >= 0) {
2899 + dev_warn(&serial->interface->dev, "short epic descriptor received: %d\n",
2900 + result);
2901 + result = -EIO;
2902 }
2903
2904 + kfree(epic);
2905 +
2906 return result;
2907 }
2908
2909 @@ -2093,8 +2105,7 @@ static int rom_write(struct usb_serial *serial, __u16 extAddr, __u16 addr,
2910 * rom_read
2911 * reads a number of bytes from the Edgeport device starting at the given
2912 * address.
2913 - * If successful returns the number of bytes read, otherwise it returns
2914 - * a negative error number of the problem.
2915 + * Returns zero on success or a negative error number.
2916 ****************************************************************************/
2917 static int rom_read(struct usb_serial *serial, __u16 extAddr,
2918 __u16 addr, __u16 length, __u8 *data)
2919 @@ -2119,12 +2130,17 @@ static int rom_read(struct usb_serial *serial, __u16 extAddr,
2920 USB_REQUEST_ION_READ_ROM,
2921 0xC0, addr, extAddr, transfer_buffer,
2922 current_length, 300);
2923 - if (result < 0)
2924 + if (result < current_length) {
2925 + if (result >= 0)
2926 + result = -EIO;
2927 break;
2928 + }
2929 memcpy(data, transfer_buffer, current_length);
2930 length -= current_length;
2931 addr += current_length;
2932 data += current_length;
2933 +
2934 + result = 0;
2935 }
2936
2937 kfree(transfer_buffer);
2938 @@ -2578,9 +2594,10 @@ static void get_manufacturing_desc(struct edgeport_serial *edge_serial)
2939 EDGE_MANUF_DESC_LEN,
2940 (__u8 *)(&edge_serial->manuf_descriptor));
2941
2942 - if (response < 1)
2943 - dev_err(dev, "error in getting manufacturer descriptor\n");
2944 - else {
2945 + if (response < 0) {
2946 + dev_err(dev, "error in getting manufacturer descriptor: %d\n",
2947 + response);
2948 + } else {
2949 char string[30];
2950 dev_dbg(dev, "**Manufacturer Descriptor\n");
2951 dev_dbg(dev, " RomSize: %dK\n",
2952 @@ -2637,9 +2654,10 @@ static void get_boot_desc(struct edgeport_serial *edge_serial)
2953 EDGE_BOOT_DESC_LEN,
2954 (__u8 *)(&edge_serial->boot_descriptor));
2955
2956 - if (response < 1)
2957 - dev_err(dev, "error in getting boot descriptor\n");
2958 - else {
2959 + if (response < 0) {
2960 + dev_err(dev, "error in getting boot descriptor: %d\n",
2961 + response);
2962 + } else {
2963 dev_dbg(dev, "**Boot Descriptor:\n");
2964 dev_dbg(dev, " BootCodeLength: %d\n",
2965 le16_to_cpu(edge_serial->boot_descriptor.BootCodeLength));
2966 @@ -2782,7 +2800,7 @@ static int edge_startup(struct usb_serial *serial)
2967 dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name);
2968
2969 /* Read the epic descriptor */
2970 - if (get_epic_descriptor(edge_serial) <= 0) {
2971 + if (get_epic_descriptor(edge_serial) < 0) {
2972 /* memcpy descriptor to Supports structures */
2973 memcpy(&edge_serial->epic_descriptor.Supports, descriptor,
2974 sizeof(struct edge_compatibility_bits));
2975 diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
2976 index 83523fcf6fb9..d2dab2a341b8 100644
2977 --- a/drivers/usb/serial/keyspan_pda.c
2978 +++ b/drivers/usb/serial/keyspan_pda.c
2979 @@ -139,6 +139,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
2980 {
2981 struct usb_serial_port *port = urb->context;
2982 unsigned char *data = urb->transfer_buffer;
2983 + unsigned int len = urb->actual_length;
2984 int retval;
2985 int status = urb->status;
2986 struct keyspan_pda_private *priv;
2987 @@ -159,18 +160,26 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
2988 goto exit;
2989 }
2990
2991 + if (len < 1) {
2992 + dev_warn(&port->dev, "short message received\n");
2993 + goto exit;
2994 + }
2995 +
2996 /* see if the message is data or a status interrupt */
2997 switch (data[0]) {
2998 case 0:
2999 /* rest of message is rx data */
3000 - if (urb->actual_length) {
3001 - tty_insert_flip_string(&port->port, data + 1,
3002 - urb->actual_length - 1);
3003 - tty_flip_buffer_push(&port->port);
3004 - }
3005 + if (len < 2)
3006 + break;
3007 + tty_insert_flip_string(&port->port, data + 1, len - 1);
3008 + tty_flip_buffer_push(&port->port);
3009 break;
3010 case 1:
3011 /* status interrupt */
3012 + if (len < 3) {
3013 + dev_warn(&port->dev, "short interrupt message received\n");
3014 + break;
3015 + }
3016 dev_dbg(&port->dev, "rx int, d1=%d, d2=%d\n", data[1], data[2]);
3017 switch (data[1]) {
3018 case 1: /* modemline change */
3019 diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
3020 index 885655315de1..edbc81f205c2 100644
3021 --- a/drivers/usb/serial/mct_u232.c
3022 +++ b/drivers/usb/serial/mct_u232.c
3023 @@ -322,8 +322,12 @@ static int mct_u232_get_modem_stat(struct usb_serial_port *port,
3024 MCT_U232_GET_REQUEST_TYPE,
3025 0, 0, buf, MCT_U232_GET_MODEM_STAT_SIZE,
3026 WDR_TIMEOUT);
3027 - if (rc < 0) {
3028 + if (rc < MCT_U232_GET_MODEM_STAT_SIZE) {
3029 dev_err(&port->dev, "Get MODEM STATus failed (error = %d)\n", rc);
3030 +
3031 + if (rc >= 0)
3032 + rc = -EIO;
3033 +
3034 *msr = 0;
3035 } else {
3036 *msr = buf[0];
3037 diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
3038 index bd1a1307e0f0..1d17779b2203 100644
3039 --- a/drivers/usb/serial/quatech2.c
3040 +++ b/drivers/usb/serial/quatech2.c
3041 @@ -188,22 +188,22 @@ static inline int qt2_setdevice(struct usb_device *dev, u8 *data)
3042 }
3043
3044
3045 -static inline int qt2_getdevice(struct usb_device *dev, u8 *data)
3046 -{
3047 - return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3048 - QT_SET_GET_DEVICE, 0xc0, 0, 0,
3049 - data, 3, QT2_USB_TIMEOUT);
3050 -}
3051 -
3052 static inline int qt2_getregister(struct usb_device *dev,
3053 u8 uart,
3054 u8 reg,
3055 u8 *data)
3056 {
3057 - return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3058 - QT_SET_GET_REGISTER, 0xc0, reg,
3059 - uart, data, sizeof(*data), QT2_USB_TIMEOUT);
3060 + int ret;
3061 +
3062 + ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3063 + QT_SET_GET_REGISTER, 0xc0, reg,
3064 + uart, data, sizeof(*data), QT2_USB_TIMEOUT);
3065 + if (ret < sizeof(*data)) {
3066 + if (ret >= 0)
3067 + ret = -EIO;
3068 + }
3069
3070 + return ret;
3071 }
3072
3073 static inline int qt2_setregister(struct usb_device *dev,
3074 @@ -372,9 +372,11 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port)
3075 0xc0, 0,
3076 device_port, data, 2, QT2_USB_TIMEOUT);
3077
3078 - if (status < 0) {
3079 + if (status < 2) {
3080 dev_err(&port->dev, "%s - open port failed %i\n", __func__,
3081 status);
3082 + if (status >= 0)
3083 + status = -EIO;
3084 kfree(data);
3085 return status;
3086 }
3087 diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c
3088 index 70a098de429f..886e1294b120 100644
3089 --- a/drivers/usb/serial/ssu100.c
3090 +++ b/drivers/usb/serial/ssu100.c
3091 @@ -80,9 +80,17 @@ static inline int ssu100_setdevice(struct usb_device *dev, u8 *data)
3092
3093 static inline int ssu100_getdevice(struct usb_device *dev, u8 *data)
3094 {
3095 - return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3096 - QT_SET_GET_DEVICE, 0xc0, 0, 0,
3097 - data, 3, 300);
3098 + int ret;
3099 +
3100 + ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3101 + QT_SET_GET_DEVICE, 0xc0, 0, 0,
3102 + data, 3, 300);
3103 + if (ret < 3) {
3104 + if (ret >= 0)
3105 + ret = -EIO;
3106 + }
3107 +
3108 + return ret;
3109 }
3110
3111 static inline int ssu100_getregister(struct usb_device *dev,
3112 @@ -90,10 +98,17 @@ static inline int ssu100_getregister(struct usb_device *dev,
3113 unsigned short reg,
3114 u8 *data)
3115 {
3116 - return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3117 - QT_SET_GET_REGISTER, 0xc0, reg,
3118 - uart, data, sizeof(*data), 300);
3119 + int ret;
3120 +
3121 + ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
3122 + QT_SET_GET_REGISTER, 0xc0, reg,
3123 + uart, data, sizeof(*data), 300);
3124 + if (ret < sizeof(*data)) {
3125 + if (ret >= 0)
3126 + ret = -EIO;
3127 + }
3128
3129 + return ret;
3130 }
3131
3132
3133 @@ -289,8 +304,10 @@ static int ssu100_open(struct tty_struct *tty, struct usb_serial_port *port)
3134 QT_OPEN_CLOSE_CHANNEL,
3135 QT_TRANSFER_IN, 0x01,
3136 0, data, 2, 300);
3137 - if (result < 0) {
3138 + if (result < 2) {
3139 dev_dbg(&port->dev, "%s - open failed %i\n", __func__, result);
3140 + if (result >= 0)
3141 + result = -EIO;
3142 kfree(data);
3143 return result;
3144 }
3145 diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
3146 index bdbddbc8bd4d..6bcb874b4832 100644
3147 --- a/drivers/usb/serial/ti_usb_3410_5052.c
3148 +++ b/drivers/usb/serial/ti_usb_3410_5052.c
3149 @@ -1556,13 +1556,10 @@ static int ti_command_out_sync(struct ti_device *tdev, __u8 command,
3150 (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT),
3151 value, moduleid, data, size, 1000);
3152
3153 - if (status == size)
3154 - status = 0;
3155 -
3156 - if (status > 0)
3157 - status = -ECOMM;
3158 + if (status < 0)
3159 + return status;
3160
3161 - return status;
3162 + return 0;
3163 }
3164
3165
3166 @@ -1578,8 +1575,7 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command,
3167
3168 if (status == size)
3169 status = 0;
3170 -
3171 - if (status > 0)
3172 + else if (status >= 0)
3173 status = -ECOMM;
3174
3175 return status;
3176 diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
3177 index 9ecfcdcdd6d6..d5dbdb9d24d8 100644
3178 --- a/drivers/xen/events/events_base.c
3179 +++ b/drivers/xen/events/events_base.c
3180 @@ -1314,6 +1314,9 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu)
3181 if (!VALID_EVTCHN(evtchn))
3182 return -1;
3183
3184 + if (!xen_support_evtchn_rebind())
3185 + return -1;
3186 +
3187 /* Send future instances of this interrupt to other vcpu. */
3188 bind_vcpu.port = evtchn;
3189 bind_vcpu.vcpu = xen_vcpu_nr(tcpu);
3190 @@ -1647,15 +1650,20 @@ void xen_callback_vector(void)
3191 {
3192 int rc;
3193 uint64_t callback_via;
3194 -
3195 - callback_via = HVM_CALLBACK_VECTOR(HYPERVISOR_CALLBACK_VECTOR);
3196 - rc = xen_set_callback_via(callback_via);
3197 - BUG_ON(rc);
3198 - pr_info("Xen HVM callback vector for event delivery is enabled\n");
3199 - /* in the restore case the vector has already been allocated */
3200 - if (!test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors))
3201 - alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
3202 - xen_hvm_callback_vector);
3203 + if (xen_have_vector_callback) {
3204 + callback_via = HVM_CALLBACK_VECTOR(HYPERVISOR_CALLBACK_VECTOR);
3205 + rc = xen_set_callback_via(callback_via);
3206 + if (rc) {
3207 + pr_err("Request for Xen HVM callback vector failed\n");
3208 + xen_have_vector_callback = 0;
3209 + return;
3210 + }
3211 + pr_info("Xen HVM callback vector for event delivery is enabled\n");
3212 + /* in the restore case the vector has already been allocated */
3213 + if (!test_bit(HYPERVISOR_CALLBACK_VECTOR, used_vectors))
3214 + alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR,
3215 + xen_hvm_callback_vector);
3216 + }
3217 }
3218 #else
3219 void xen_callback_vector(void) {}
3220 diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c
3221 index b59c9455aae1..cf9666680c8c 100644
3222 --- a/drivers/xen/platform-pci.c
3223 +++ b/drivers/xen/platform-pci.c
3224 @@ -42,6 +42,7 @@
3225 static unsigned long platform_mmio;
3226 static unsigned long platform_mmio_alloc;
3227 static unsigned long platform_mmiolen;
3228 +static uint64_t callback_via;
3229
3230 static unsigned long alloc_xen_mmio(unsigned long len)
3231 {
3232 @@ -54,6 +55,51 @@ static unsigned long alloc_xen_mmio(unsigned long len)
3233 return addr;
3234 }
3235
3236 +static uint64_t get_callback_via(struct pci_dev *pdev)
3237 +{
3238 + u8 pin;
3239 + int irq;
3240 +
3241 + irq = pdev->irq;
3242 + if (irq < 16)
3243 + return irq; /* ISA IRQ */
3244 +
3245 + pin = pdev->pin;
3246 +
3247 + /* We don't know the GSI. Specify the PCI INTx line instead. */
3248 + return ((uint64_t)0x01 << 56) | /* PCI INTx identifier */
3249 + ((uint64_t)pci_domain_nr(pdev->bus) << 32) |
3250 + ((uint64_t)pdev->bus->number << 16) |
3251 + ((uint64_t)(pdev->devfn & 0xff) << 8) |
3252 + ((uint64_t)(pin - 1) & 3);
3253 +}
3254 +
3255 +static irqreturn_t do_hvm_evtchn_intr(int irq, void *dev_id)
3256 +{
3257 + xen_hvm_evtchn_do_upcall();
3258 + return IRQ_HANDLED;
3259 +}
3260 +
3261 +static int xen_allocate_irq(struct pci_dev *pdev)
3262 +{
3263 + return request_irq(pdev->irq, do_hvm_evtchn_intr,
3264 + IRQF_NOBALANCING | IRQF_TRIGGER_RISING,
3265 + "xen-platform-pci", pdev);
3266 +}
3267 +
3268 +static int platform_pci_resume(struct pci_dev *pdev)
3269 +{
3270 + int err;
3271 + if (xen_have_vector_callback)
3272 + return 0;
3273 + err = xen_set_callback_via(callback_via);
3274 + if (err) {
3275 + dev_err(&pdev->dev, "platform_pci_resume failure!\n");
3276 + return err;
3277 + }
3278 + return 0;
3279 +}
3280 +
3281 static int platform_pci_probe(struct pci_dev *pdev,
3282 const struct pci_device_id *ent)
3283 {
3284 @@ -92,6 +138,21 @@ static int platform_pci_probe(struct pci_dev *pdev,
3285 platform_mmio = mmio_addr;
3286 platform_mmiolen = mmio_len;
3287
3288 + if (!xen_have_vector_callback) {
3289 + ret = xen_allocate_irq(pdev);
3290 + if (ret) {
3291 + dev_warn(&pdev->dev, "request_irq failed err=%d\n", ret);
3292 + goto out;
3293 + }
3294 + callback_via = get_callback_via(pdev);
3295 + ret = xen_set_callback_via(callback_via);
3296 + if (ret) {
3297 + dev_warn(&pdev->dev, "Unable to set the evtchn callback "
3298 + "err=%d\n", ret);
3299 + goto out;
3300 + }
3301 + }
3302 +
3303 max_nr_gframes = gnttab_max_grant_frames();
3304 grant_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes);
3305 ret = gnttab_setup_auto_xlat_frames(grant_frames);
3306 @@ -123,6 +184,9 @@ static struct pci_driver platform_driver = {
3307 .name = DRV_NAME,
3308 .probe = platform_pci_probe,
3309 .id_table = platform_pci_tbl,
3310 +#ifdef CONFIG_PM
3311 + .resume_early = platform_pci_resume,
3312 +#endif
3313 };
3314
3315 static int __init platform_pci_init(void)
3316 diff --git a/fs/9p/acl.c b/fs/9p/acl.c
3317 index b3c2cc79c20d..082d227fa56b 100644
3318 --- a/fs/9p/acl.c
3319 +++ b/fs/9p/acl.c
3320 @@ -277,6 +277,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
3321 case ACL_TYPE_ACCESS:
3322 if (acl) {
3323 struct iattr iattr;
3324 + struct posix_acl *old_acl = acl;
3325
3326 retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
3327 if (retval)
3328 @@ -287,6 +288,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
3329 * by the mode bits. So don't
3330 * update ACL.
3331 */
3332 + posix_acl_release(old_acl);
3333 value = NULL;
3334 size = 0;
3335 }
3336 diff --git a/fs/block_dev.c b/fs/block_dev.c
3337 index 092a2eed1628..9ad527ff9974 100644
3338 --- a/fs/block_dev.c
3339 +++ b/fs/block_dev.c
3340 @@ -1165,7 +1165,6 @@ int revalidate_disk(struct gendisk *disk)
3341
3342 if (disk->fops->revalidate_disk)
3343 ret = disk->fops->revalidate_disk(disk);
3344 - blk_integrity_revalidate(disk);
3345 bdev = bdget_disk(disk, 0);
3346 if (!bdev)
3347 return ret;
3348 diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
3349 index 013c6a541d6b..7e0c002c12e9 100644
3350 --- a/fs/f2fs/super.c
3351 +++ b/fs/f2fs/super.c
3352 @@ -1405,6 +1405,13 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi,
3353 return 1;
3354 }
3355
3356 + if (le32_to_cpu(raw_super->segment_count) > F2FS_MAX_SEGMENT) {
3357 + f2fs_msg(sb, KERN_INFO,
3358 + "Invalid segment count (%u)",
3359 + le32_to_cpu(raw_super->segment_count));
3360 + return 1;
3361 + }
3362 +
3363 /* check CP/SIT/NAT/SSA/MAIN_AREA area boundary */
3364 if (sanity_check_area_boundary(sbi, bh))
3365 return 1;
3366 diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
3367 index 422630b8e588..e46e7d10312b 100644
3368 --- a/include/linux/f2fs_fs.h
3369 +++ b/include/linux/f2fs_fs.h
3370 @@ -286,6 +286,12 @@ struct f2fs_nat_block {
3371 #define SIT_ENTRY_PER_BLOCK (PAGE_SIZE / sizeof(struct f2fs_sit_entry))
3372
3373 /*
3374 + * F2FS uses 4 bytes to represent block address. As a result, supported size of
3375 + * disk is 16 TB and it equals to 16 * 1024 * 1024 / 2 segments.
3376 + */
3377 +#define F2FS_MAX_SEGMENT ((16 * 1024 * 1024) / 2)
3378 +
3379 +/*
3380 * Note that f2fs_sit_entry->vblocks has the following bit-field information.
3381 * [15:10] : allocation type such as CURSEG_XXXX_TYPE
3382 * [9:0] : valid block count
3383 diff --git a/include/linux/genhd.h b/include/linux/genhd.h
3384 index e0341af6950e..3c99fb6727ca 100644
3385 --- a/include/linux/genhd.h
3386 +++ b/include/linux/genhd.h
3387 @@ -731,11 +731,9 @@ static inline void part_nr_sects_write(struct hd_struct *part, sector_t size)
3388 #if defined(CONFIG_BLK_DEV_INTEGRITY)
3389 extern void blk_integrity_add(struct gendisk *);
3390 extern void blk_integrity_del(struct gendisk *);
3391 -extern void blk_integrity_revalidate(struct gendisk *);
3392 #else /* CONFIG_BLK_DEV_INTEGRITY */
3393 static inline void blk_integrity_add(struct gendisk *disk) { }
3394 static inline void blk_integrity_del(struct gendisk *disk) { }
3395 -static inline void blk_integrity_revalidate(struct gendisk *disk) { }
3396 #endif /* CONFIG_BLK_DEV_INTEGRITY */
3397
3398 #else /* CONFIG_BLOCK */
3399 diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
3400 index 5dd75fa47dd8..f9be467d6695 100644
3401 --- a/include/linux/usb/chipidea.h
3402 +++ b/include/linux/usb/chipidea.h
3403 @@ -14,6 +14,7 @@ struct ci_hdrc;
3404 * struct ci_hdrc_cable - structure for external connector cable state tracking
3405 * @state: current state of the line
3406 * @changed: set to true when extcon event happen
3407 + * @enabled: set to true if we've enabled the vbus or id interrupt
3408 * @edev: device which generate events
3409 * @ci: driver state of the chipidea device
3410 * @nb: hold event notification callback
3411 @@ -22,6 +23,7 @@ struct ci_hdrc;
3412 struct ci_hdrc_cable {
3413 bool state;
3414 bool changed;
3415 + bool enabled;
3416 struct extcon_dev *edev;
3417 struct ci_hdrc *ci;
3418 struct notifier_block nb;
3419 diff --git a/include/net/addrconf.h b/include/net/addrconf.h
3420 index 8f998afc1384..b8ee8a113e32 100644
3421 --- a/include/net/addrconf.h
3422 +++ b/include/net/addrconf.h
3423 @@ -20,6 +20,8 @@
3424 #define ADDRCONF_TIMER_FUZZ (HZ / 4)
3425 #define ADDRCONF_TIMER_FUZZ_MAX (HZ)
3426
3427 +#define ADDRCONF_NOTIFY_PRIORITY 0
3428 +
3429 #include <linux/in.h>
3430 #include <linux/in6.h>
3431
3432 diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
3433 index f83e78d071a3..2e347d4545cf 100644
3434 --- a/include/net/ip6_route.h
3435 +++ b/include/net/ip6_route.h
3436 @@ -84,6 +84,7 @@ struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
3437 struct rt6_info *ip6_pol_route(struct net *net, struct fib6_table *table,
3438 int ifindex, struct flowi6 *fl6, int flags);
3439
3440 +void ip6_route_init_special_entries(void);
3441 int ip6_route_init(void);
3442 void ip6_route_cleanup(void);
3443
3444 diff --git a/include/xen/xen.h b/include/xen/xen.h
3445 index f0f0252cff9a..0c0e3ef4c45d 100644
3446 --- a/include/xen/xen.h
3447 +++ b/include/xen/xen.h
3448 @@ -38,7 +38,8 @@ extern enum xen_domain_type xen_domain_type;
3449 */
3450 #include <xen/features.h>
3451 #define xen_pvh_domain() (xen_pv_domain() && \
3452 - xen_feature(XENFEAT_auto_translated_physmap))
3453 + xen_feature(XENFEAT_auto_translated_physmap) && \
3454 + xen_have_vector_callback)
3455 #else
3456 #define xen_pvh_domain() (0)
3457 #endif
3458 diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
3459 index 7c9f94c53441..44c17f47d94c 100644
3460 --- a/kernel/bpf/verifier.c
3461 +++ b/kernel/bpf/verifier.c
3462 @@ -279,7 +279,8 @@ static const char *const bpf_jmp_string[16] = {
3463 [BPF_EXIT >> 4] = "exit",
3464 };
3465
3466 -static void print_bpf_insn(struct bpf_insn *insn)
3467 +static void print_bpf_insn(const struct bpf_verifier_env *env,
3468 + const struct bpf_insn *insn)
3469 {
3470 u8 class = BPF_CLASS(insn->code);
3471
3472 @@ -343,9 +344,19 @@ static void print_bpf_insn(struct bpf_insn *insn)
3473 insn->code,
3474 bpf_ldst_string[BPF_SIZE(insn->code) >> 3],
3475 insn->src_reg, insn->imm);
3476 - } else if (BPF_MODE(insn->code) == BPF_IMM) {
3477 - verbose("(%02x) r%d = 0x%x\n",
3478 - insn->code, insn->dst_reg, insn->imm);
3479 + } else if (BPF_MODE(insn->code) == BPF_IMM &&
3480 + BPF_SIZE(insn->code) == BPF_DW) {
3481 + /* At this point, we already made sure that the second
3482 + * part of the ldimm64 insn is accessible.
3483 + */
3484 + u64 imm = ((u64)(insn + 1)->imm << 32) | (u32)insn->imm;
3485 + bool map_ptr = insn->src_reg == BPF_PSEUDO_MAP_FD;
3486 +
3487 + if (map_ptr && !env->allow_ptr_leaks)
3488 + imm = 0;
3489 +
3490 + verbose("(%02x) r%d = 0x%llx\n", insn->code,
3491 + insn->dst_reg, (unsigned long long)imm);
3492 } else {
3493 verbose("BUG_ld_%02x\n", insn->code);
3494 return;
3495 @@ -1749,6 +1760,17 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
3496 return 0;
3497 } else if (opcode == BPF_ADD &&
3498 BPF_CLASS(insn->code) == BPF_ALU64 &&
3499 + dst_reg->type == PTR_TO_STACK &&
3500 + ((BPF_SRC(insn->code) == BPF_X &&
3501 + regs[insn->src_reg].type == CONST_IMM) ||
3502 + BPF_SRC(insn->code) == BPF_K)) {
3503 + if (BPF_SRC(insn->code) == BPF_X)
3504 + dst_reg->imm += regs[insn->src_reg].imm;
3505 + else
3506 + dst_reg->imm += insn->imm;
3507 + return 0;
3508 + } else if (opcode == BPF_ADD &&
3509 + BPF_CLASS(insn->code) == BPF_ALU64 &&
3510 (dst_reg->type == PTR_TO_PACKET ||
3511 (BPF_SRC(insn->code) == BPF_X &&
3512 regs[insn->src_reg].type == PTR_TO_PACKET))) {
3513 @@ -2663,7 +2685,7 @@ static int do_check(struct bpf_verifier_env *env)
3514
3515 if (log_level) {
3516 verbose("%d: ", insn_idx);
3517 - print_bpf_insn(insn);
3518 + print_bpf_insn(env, insn);
3519 }
3520
3521 err = ext_analyzer_insn_hook(env, insn_idx, prev_insn_idx);
3522 diff --git a/lib/test_bpf.c b/lib/test_bpf.c
3523 index 0362da0b66c3..2e385026915c 100644
3524 --- a/lib/test_bpf.c
3525 +++ b/lib/test_bpf.c
3526 @@ -4656,6 +4656,51 @@ static struct bpf_test tests[] = {
3527 { },
3528 { { 0, 1 } },
3529 },
3530 + {
3531 + /* Mainly testing JIT + imm64 here. */
3532 + "JMP_JGE_X: ldimm64 test 1",
3533 + .u.insns_int = {
3534 + BPF_ALU32_IMM(BPF_MOV, R0, 0),
3535 + BPF_LD_IMM64(R1, 3),
3536 + BPF_LD_IMM64(R2, 2),
3537 + BPF_JMP_REG(BPF_JGE, R1, R2, 2),
3538 + BPF_LD_IMM64(R0, 0xffffffffffffffffUL),
3539 + BPF_LD_IMM64(R0, 0xeeeeeeeeeeeeeeeeUL),
3540 + BPF_EXIT_INSN(),
3541 + },
3542 + INTERNAL,
3543 + { },
3544 + { { 0, 0xeeeeeeeeU } },
3545 + },
3546 + {
3547 + "JMP_JGE_X: ldimm64 test 2",
3548 + .u.insns_int = {
3549 + BPF_ALU32_IMM(BPF_MOV, R0, 0),
3550 + BPF_LD_IMM64(R1, 3),
3551 + BPF_LD_IMM64(R2, 2),
3552 + BPF_JMP_REG(BPF_JGE, R1, R2, 0),
3553 + BPF_LD_IMM64(R0, 0xffffffffffffffffUL),
3554 + BPF_EXIT_INSN(),
3555 + },
3556 + INTERNAL,
3557 + { },
3558 + { { 0, 0xffffffffU } },
3559 + },
3560 + {
3561 + "JMP_JGE_X: ldimm64 test 3",
3562 + .u.insns_int = {
3563 + BPF_ALU32_IMM(BPF_MOV, R0, 1),
3564 + BPF_LD_IMM64(R1, 3),
3565 + BPF_LD_IMM64(R2, 2),
3566 + BPF_JMP_REG(BPF_JGE, R1, R2, 4),
3567 + BPF_LD_IMM64(R0, 0xffffffffffffffffUL),
3568 + BPF_LD_IMM64(R0, 0xeeeeeeeeeeeeeeeeUL),
3569 + BPF_EXIT_INSN(),
3570 + },
3571 + INTERNAL,
3572 + { },
3573 + { { 0, 1 } },
3574 + },
3575 /* BPF_JMP | BPF_JNE | BPF_X */
3576 {
3577 "JMP_JNE_X: if (3 != 2) return 1",
3578 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
3579 index b7f9ae7b1c5f..b490af67c6fa 100644
3580 --- a/net/core/rtnetlink.c
3581 +++ b/net/core/rtnetlink.c
3582 @@ -1059,7 +1059,7 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
3583 return err;
3584 }
3585
3586 - if (nla_put(skb, IFLA_PHYS_PORT_NAME, strlen(name), name))
3587 + if (nla_put_string(skb, IFLA_PHYS_PORT_NAME, name))
3588 return -EMSGSIZE;
3589
3590 return 0;
3591 diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
3592 index ecbe5a7c2d6d..9879b73d5565 100644
3593 --- a/net/ipv4/raw.c
3594 +++ b/net/ipv4/raw.c
3595 @@ -356,6 +356,9 @@ static int raw_send_hdrinc(struct sock *sk, struct flowi4 *fl4,
3596 rt->dst.dev->mtu);
3597 return -EMSGSIZE;
3598 }
3599 + if (length < sizeof(struct iphdr))
3600 + return -EINVAL;
3601 +
3602 if (flags&MSG_PROBE)
3603 goto out;
3604
3605 diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
3606 index c67ece1390c2..7d86fc505397 100644
3607 --- a/net/ipv4/tcp_lp.c
3608 +++ b/net/ipv4/tcp_lp.c
3609 @@ -264,13 +264,15 @@ static void tcp_lp_pkts_acked(struct sock *sk, const struct ack_sample *sample)
3610 {
3611 struct tcp_sock *tp = tcp_sk(sk);
3612 struct lp *lp = inet_csk_ca(sk);
3613 + u32 delta;
3614
3615 if (sample->rtt_us > 0)
3616 tcp_lp_rtt_sample(sk, sample->rtt_us);
3617
3618 /* calc inference */
3619 - if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
3620 - lp->inference = 3 * (tcp_time_stamp - tp->rx_opt.rcv_tsecr);
3621 + delta = tcp_time_stamp - tp->rx_opt.rcv_tsecr;
3622 + if ((s32)delta > 0)
3623 + lp->inference = 3 * delta;
3624
3625 /* test if within inference */
3626 if (lp->last_drop && (tcp_time_stamp - lp->last_drop < lp->inference))
3627 diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
3628 index 8615a6b8550f..64e1ba49c3e2 100644
3629 --- a/net/ipv4/tcp_minisocks.c
3630 +++ b/net/ipv4/tcp_minisocks.c
3631 @@ -543,6 +543,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
3632 newicsk->icsk_ack.last_seg_size = skb->len - newtp->tcp_header_len;
3633 newtp->rx_opt.mss_clamp = req->mss;
3634 tcp_ecn_openreq_child(newtp, req);
3635 + newtp->fastopen_req = NULL;
3636 newtp->fastopen_rsk = NULL;
3637 newtp->syn_data_acked = 0;
3638 newtp->rack.mstamp.v64 = 0;
3639 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
3640 index 65d6189140bc..dc4258fd15dc 100644
3641 --- a/net/ipv4/tcp_output.c
3642 +++ b/net/ipv4/tcp_output.c
3643 @@ -1246,7 +1246,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len,
3644 * eventually). The difference is that pulled data not copied, but
3645 * immediately discarded.
3646 */
3647 -static void __pskb_trim_head(struct sk_buff *skb, int len)
3648 +static int __pskb_trim_head(struct sk_buff *skb, int len)
3649 {
3650 struct skb_shared_info *shinfo;
3651 int i, k, eat;
3652 @@ -1256,7 +1256,7 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
3653 __skb_pull(skb, eat);
3654 len -= eat;
3655 if (!len)
3656 - return;
3657 + return 0;
3658 }
3659 eat = len;
3660 k = 0;
3661 @@ -1282,23 +1282,28 @@ static void __pskb_trim_head(struct sk_buff *skb, int len)
3662 skb_reset_tail_pointer(skb);
3663 skb->data_len -= len;
3664 skb->len = skb->data_len;
3665 + return len;
3666 }
3667
3668 /* Remove acked data from a packet in the transmit queue. */
3669 int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
3670 {
3671 + u32 delta_truesize;
3672 +
3673 if (skb_unclone(skb, GFP_ATOMIC))
3674 return -ENOMEM;
3675
3676 - __pskb_trim_head(skb, len);
3677 + delta_truesize = __pskb_trim_head(skb, len);
3678
3679 TCP_SKB_CB(skb)->seq += len;
3680 skb->ip_summed = CHECKSUM_PARTIAL;
3681
3682 - skb->truesize -= len;
3683 - sk->sk_wmem_queued -= len;
3684 - sk_mem_uncharge(sk, len);
3685 - sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
3686 + if (delta_truesize) {
3687 + skb->truesize -= delta_truesize;
3688 + sk->sk_wmem_queued -= delta_truesize;
3689 + sk_mem_uncharge(sk, delta_truesize);
3690 + sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
3691 + }
3692
3693 /* Any change of skb->len requires recalculation of tso factor. */
3694 if (tcp_skb_pcount(skb) > 1)
3695 diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
3696 index cffdbdbff3a2..f088a1d9a618 100644
3697 --- a/net/ipv6/addrconf.c
3698 +++ b/net/ipv6/addrconf.c
3699 @@ -3278,7 +3278,8 @@ static int fixup_permanent_addr(struct inet6_dev *idev,
3700 idev->dev, 0, 0);
3701 }
3702
3703 - addrconf_dad_start(ifp);
3704 + if (ifp->state == INET6_IFADDR_STATE_PREDAD)
3705 + addrconf_dad_start(ifp);
3706
3707 return 0;
3708 }
3709 @@ -3491,6 +3492,7 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
3710 */
3711 static struct notifier_block ipv6_dev_notf = {
3712 .notifier_call = addrconf_notify,
3713 + .priority = ADDRCONF_NOTIFY_PRIORITY,
3714 };
3715
3716 static void addrconf_type_change(struct net_device *dev, unsigned long event)
3717 @@ -3627,7 +3629,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
3718 if (keep) {
3719 /* set state to skip the notifier below */
3720 state = INET6_IFADDR_STATE_DEAD;
3721 - ifa->state = 0;
3722 + ifa->state = INET6_IFADDR_STATE_PREDAD;
3723 if (!(ifa->flags & IFA_F_NODAD))
3724 ifa->flags |= IFA_F_TENTATIVE;
3725
3726 @@ -6263,6 +6265,8 @@ int __init addrconf_init(void)
3727 goto errlo;
3728 }
3729
3730 + ip6_route_init_special_entries();
3731 +
3732 for (i = 0; i < IN6_ADDR_HSIZE; i++)
3733 INIT_HLIST_HEAD(&inet6_addr_lst[i]);
3734
3735 diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
3736 index ced3817539c2..1a2fe5c3a366 100644
3737 --- a/net/ipv6/raw.c
3738 +++ b/net/ipv6/raw.c
3739 @@ -630,6 +630,8 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
3740 ipv6_local_error(sk, EMSGSIZE, fl6, rt->dst.dev->mtu);
3741 return -EMSGSIZE;
3742 }
3743 + if (length < sizeof(struct ipv6hdr))
3744 + return -EINVAL;
3745 if (flags&MSG_PROBE)
3746 goto out;
3747
3748 diff --git a/net/ipv6/route.c b/net/ipv6/route.c
3749 index 9f1bc756799a..b8b475389ae4 100644
3750 --- a/net/ipv6/route.c
3751 +++ b/net/ipv6/route.c
3752 @@ -3480,7 +3480,10 @@ static int ip6_route_dev_notify(struct notifier_block *this,
3753 struct net_device *dev = netdev_notifier_info_to_dev(ptr);
3754 struct net *net = dev_net(dev);
3755
3756 - if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) {
3757 + if (!(dev->flags & IFF_LOOPBACK))
3758 + return NOTIFY_OK;
3759 +
3760 + if (event == NETDEV_REGISTER) {
3761 net->ipv6.ip6_null_entry->dst.dev = dev;
3762 net->ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(dev);
3763 #ifdef CONFIG_IPV6_MULTIPLE_TABLES
3764 @@ -3489,6 +3492,12 @@ static int ip6_route_dev_notify(struct notifier_block *this,
3765 net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
3766 net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
3767 #endif
3768 + } else if (event == NETDEV_UNREGISTER) {
3769 + in6_dev_put(net->ipv6.ip6_null_entry->rt6i_idev);
3770 +#ifdef CONFIG_IPV6_MULTIPLE_TABLES
3771 + in6_dev_put(net->ipv6.ip6_prohibit_entry->rt6i_idev);
3772 + in6_dev_put(net->ipv6.ip6_blk_hole_entry->rt6i_idev);
3773 +#endif
3774 }
3775
3776 return NOTIFY_OK;
3777 @@ -3795,9 +3804,24 @@ static struct pernet_operations ip6_route_net_late_ops = {
3778
3779 static struct notifier_block ip6_route_dev_notifier = {
3780 .notifier_call = ip6_route_dev_notify,
3781 - .priority = 0,
3782 + .priority = ADDRCONF_NOTIFY_PRIORITY - 10,
3783 };
3784
3785 +void __init ip6_route_init_special_entries(void)
3786 +{
3787 + /* Registering of the loopback is done before this portion of code,
3788 + * the loopback reference in rt6_info will not be taken, do it
3789 + * manually for init_net */
3790 + init_net.ipv6.ip6_null_entry->dst.dev = init_net.loopback_dev;
3791 + init_net.ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3792 + #ifdef CONFIG_IPV6_MULTIPLE_TABLES
3793 + init_net.ipv6.ip6_prohibit_entry->dst.dev = init_net.loopback_dev;
3794 + init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3795 + init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
3796 + init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3797 + #endif
3798 +}
3799 +
3800 int __init ip6_route_init(void)
3801 {
3802 int ret;
3803 @@ -3824,17 +3848,6 @@ int __init ip6_route_init(void)
3804
3805 ip6_dst_blackhole_ops.kmem_cachep = ip6_dst_ops_template.kmem_cachep;
3806
3807 - /* Registering of the loopback is done before this portion of code,
3808 - * the loopback reference in rt6_info will not be taken, do it
3809 - * manually for init_net */
3810 - init_net.ipv6.ip6_null_entry->dst.dev = init_net.loopback_dev;
3811 - init_net.ipv6.ip6_null_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3812 - #ifdef CONFIG_IPV6_MULTIPLE_TABLES
3813 - init_net.ipv6.ip6_prohibit_entry->dst.dev = init_net.loopback_dev;
3814 - init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3815 - init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
3816 - init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
3817 - #endif
3818 ret = fib6_init();
3819 if (ret)
3820 goto out_register_subsys;
3821 diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c
3822 index 369ffaad3799..dc7dec9e64ba 100644
3823 --- a/samples/bpf/test_verifier.c
3824 +++ b/samples/bpf/test_verifier.c
3825 @@ -1218,16 +1218,22 @@ static struct bpf_test tests[] = {
3826 .result = ACCEPT,
3827 },
3828 {
3829 - "unpriv: obfuscate stack pointer",
3830 + "stack pointer arithmetic",
3831 .insns = {
3832 - BPF_MOV64_REG(BPF_REG_2, BPF_REG_10),
3833 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
3834 - BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -8),
3835 + BPF_MOV64_IMM(BPF_REG_1, 4),
3836 + BPF_JMP_IMM(BPF_JA, 0, 0, 0),
3837 + BPF_MOV64_REG(BPF_REG_7, BPF_REG_10),
3838 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_7, -10),
3839 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_7, -10),
3840 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_7),
3841 + BPF_ALU64_REG(BPF_ADD, BPF_REG_2, BPF_REG_1),
3842 + BPF_ST_MEM(0, BPF_REG_2, 4, 0),
3843 + BPF_MOV64_REG(BPF_REG_2, BPF_REG_7),
3844 + BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, 8),
3845 + BPF_ST_MEM(0, BPF_REG_2, 4, 0),
3846 BPF_MOV64_IMM(BPF_REG_0, 0),
3847 BPF_EXIT_INSN(),
3848 },
3849 - .errstr_unpriv = "R2 pointer arithmetic",
3850 - .result_unpriv = REJECT,
3851 .result = ACCEPT,
3852 },
3853 {
3854 diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
3855 index bc4462694aaf..5cb7e04fa4ba 100644
3856 --- a/sound/pci/hda/hda_intel.c
3857 +++ b/sound/pci/hda/hda_intel.c
3858 @@ -2155,7 +2155,20 @@ static void azx_remove(struct pci_dev *pci)
3859 /* cancel the pending probing work */
3860 chip = card->private_data;
3861 hda = container_of(chip, struct hda_intel, chip);
3862 + /* FIXME: below is an ugly workaround.
3863 + * Both device_release_driver() and driver_probe_device()
3864 + * take *both* the device's and its parent's lock before
3865 + * calling the remove() and probe() callbacks. The codec
3866 + * probe takes the locks of both the codec itself and its
3867 + * parent, i.e. the PCI controller dev. Meanwhile, when
3868 + * the PCI controller is unbound, it takes its lock, too
3869 + * ==> ouch, a deadlock!
3870 + * As a workaround, we unlock temporarily here the controller
3871 + * device during cancel_work_sync() call.
3872 + */
3873 + device_unlock(&pci->dev);
3874 cancel_work_sync(&hda->probe_work);
3875 + device_lock(&pci->dev);
3876
3877 snd_card_free(card);
3878 }
3879 diff --git a/tools/power/cpupower/utils/helpers/cpuid.c b/tools/power/cpupower/utils/helpers/cpuid.c
3880 index 93b0aa74ca03..39c2c7d067bb 100644
3881 --- a/tools/power/cpupower/utils/helpers/cpuid.c
3882 +++ b/tools/power/cpupower/utils/helpers/cpuid.c
3883 @@ -156,6 +156,7 @@ int get_cpu_info(unsigned int cpu, struct cpupower_cpu_info *cpu_info)
3884 */
3885 case 0x2C: /* Westmere EP - Gulftown */
3886 cpu_info->caps |= CPUPOWER_CAP_HAS_TURBO_RATIO;
3887 + break;
3888 case 0x2A: /* SNB */
3889 case 0x2D: /* SNB Xeon */
3890 case 0x3A: /* IVB */
3891 diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
3892 index a89f80a5b711..6300c1a41ff6 100644
3893 --- a/tools/testing/selftests/x86/Makefile
3894 +++ b/tools/testing/selftests/x86/Makefile
3895 @@ -5,7 +5,7 @@ include ../lib.mk
3896 .PHONY: all all_32 all_64 warn_32bit_failure clean
3897
3898 TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall test_mremap_vdso \
3899 - check_initial_reg_state sigreturn ldt_gdt iopl \
3900 + check_initial_reg_state sigreturn ldt_gdt iopl mpx-mini-test \
3901 protection_keys
3902 TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault test_syscall_vdso unwind_vdso \
3903 test_FCMOV test_FCOMI test_FISTTP \