Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0115-4.9.16-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: 52098 byte(s)
-added kerenl-alx-legacy pkg
1 diff --git a/Makefile b/Makefile
2 index 03df4fcacdf2..4e0f962eb434 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 15
9 +SUBLEVEL = 16
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
14 index 5d83ff755547..ec8e9684296d 100644
15 --- a/arch/mips/configs/ip22_defconfig
16 +++ b/arch/mips/configs/ip22_defconfig
17 @@ -67,8 +67,8 @@ CONFIG_NETFILTER_NETLINK_QUEUE=m
18 CONFIG_NF_CONNTRACK=m
19 CONFIG_NF_CONNTRACK_SECMARK=y
20 CONFIG_NF_CONNTRACK_EVENTS=y
21 -CONFIG_NF_CT_PROTO_DCCP=m
22 -CONFIG_NF_CT_PROTO_UDPLITE=m
23 +CONFIG_NF_CT_PROTO_DCCP=y
24 +CONFIG_NF_CT_PROTO_UDPLITE=y
25 CONFIG_NF_CONNTRACK_AMANDA=m
26 CONFIG_NF_CONNTRACK_FTP=m
27 CONFIG_NF_CONNTRACK_H323=m
28 diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
29 index 2b74aee320a1..e582069b44fd 100644
30 --- a/arch/mips/configs/ip27_defconfig
31 +++ b/arch/mips/configs/ip27_defconfig
32 @@ -133,7 +133,7 @@ CONFIG_LIBFC=m
33 CONFIG_SCSI_QLOGIC_1280=y
34 CONFIG_SCSI_PMCRAID=m
35 CONFIG_SCSI_BFA_FC=m
36 -CONFIG_SCSI_DH=m
37 +CONFIG_SCSI_DH=y
38 CONFIG_SCSI_DH_RDAC=m
39 CONFIG_SCSI_DH_HP_SW=m
40 CONFIG_SCSI_DH_EMC=m
41 @@ -205,7 +205,6 @@ CONFIG_MLX4_EN=m
42 # CONFIG_MLX4_DEBUG is not set
43 CONFIG_TEHUTI=m
44 CONFIG_BNX2X=m
45 -CONFIG_QLGE=m
46 CONFIG_SFC=m
47 CONFIG_BE2NET=m
48 CONFIG_LIBERTAS_THINFIRM=m
49 diff --git a/arch/mips/configs/lemote2f_defconfig b/arch/mips/configs/lemote2f_defconfig
50 index 5da76e0e120f..0cdb431bff80 100644
51 --- a/arch/mips/configs/lemote2f_defconfig
52 +++ b/arch/mips/configs/lemote2f_defconfig
53 @@ -39,7 +39,7 @@ CONFIG_HIBERNATION=y
54 CONFIG_PM_STD_PARTITION="/dev/hda3"
55 CONFIG_CPU_FREQ=y
56 CONFIG_CPU_FREQ_DEBUG=y
57 -CONFIG_CPU_FREQ_STAT=m
58 +CONFIG_CPU_FREQ_STAT=y
59 CONFIG_CPU_FREQ_STAT_DETAILS=y
60 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
61 CONFIG_CPU_FREQ_GOV_POWERSAVE=m
62 diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
63 index 58d43f3c348d..078ecac071ab 100644
64 --- a/arch/mips/configs/malta_defconfig
65 +++ b/arch/mips/configs/malta_defconfig
66 @@ -59,8 +59,8 @@ CONFIG_NETFILTER=y
67 CONFIG_NF_CONNTRACK=m
68 CONFIG_NF_CONNTRACK_SECMARK=y
69 CONFIG_NF_CONNTRACK_EVENTS=y
70 -CONFIG_NF_CT_PROTO_DCCP=m
71 -CONFIG_NF_CT_PROTO_UDPLITE=m
72 +CONFIG_NF_CT_PROTO_DCCP=y
73 +CONFIG_NF_CT_PROTO_UDPLITE=y
74 CONFIG_NF_CONNTRACK_AMANDA=m
75 CONFIG_NF_CONNTRACK_FTP=m
76 CONFIG_NF_CONNTRACK_H323=m
77 diff --git a/arch/mips/configs/malta_kvm_defconfig b/arch/mips/configs/malta_kvm_defconfig
78 index c8f7e2835840..e233f878afef 100644
79 --- a/arch/mips/configs/malta_kvm_defconfig
80 +++ b/arch/mips/configs/malta_kvm_defconfig
81 @@ -60,8 +60,8 @@ CONFIG_NETFILTER=y
82 CONFIG_NF_CONNTRACK=m
83 CONFIG_NF_CONNTRACK_SECMARK=y
84 CONFIG_NF_CONNTRACK_EVENTS=y
85 -CONFIG_NF_CT_PROTO_DCCP=m
86 -CONFIG_NF_CT_PROTO_UDPLITE=m
87 +CONFIG_NF_CT_PROTO_DCCP=y
88 +CONFIG_NF_CT_PROTO_UDPLITE=y
89 CONFIG_NF_CONNTRACK_AMANDA=m
90 CONFIG_NF_CONNTRACK_FTP=m
91 CONFIG_NF_CONNTRACK_H323=m
92 diff --git a/arch/mips/configs/malta_kvm_guest_defconfig b/arch/mips/configs/malta_kvm_guest_defconfig
93 index d2f54e55356c..fbe085c328ab 100644
94 --- a/arch/mips/configs/malta_kvm_guest_defconfig
95 +++ b/arch/mips/configs/malta_kvm_guest_defconfig
96 @@ -59,8 +59,8 @@ CONFIG_NETFILTER=y
97 CONFIG_NF_CONNTRACK=m
98 CONFIG_NF_CONNTRACK_SECMARK=y
99 CONFIG_NF_CONNTRACK_EVENTS=y
100 -CONFIG_NF_CT_PROTO_DCCP=m
101 -CONFIG_NF_CT_PROTO_UDPLITE=m
102 +CONFIG_NF_CT_PROTO_DCCP=y
103 +CONFIG_NF_CT_PROTO_UDPLITE=y
104 CONFIG_NF_CONNTRACK_AMANDA=m
105 CONFIG_NF_CONNTRACK_FTP=m
106 CONFIG_NF_CONNTRACK_H323=m
107 diff --git a/arch/mips/configs/maltaup_xpa_defconfig b/arch/mips/configs/maltaup_xpa_defconfig
108 index 3d0d9cb9673f..2942610e4082 100644
109 --- a/arch/mips/configs/maltaup_xpa_defconfig
110 +++ b/arch/mips/configs/maltaup_xpa_defconfig
111 @@ -61,8 +61,8 @@ CONFIG_NETFILTER=y
112 CONFIG_NF_CONNTRACK=m
113 CONFIG_NF_CONNTRACK_SECMARK=y
114 CONFIG_NF_CONNTRACK_EVENTS=y
115 -CONFIG_NF_CT_PROTO_DCCP=m
116 -CONFIG_NF_CT_PROTO_UDPLITE=m
117 +CONFIG_NF_CT_PROTO_DCCP=y
118 +CONFIG_NF_CT_PROTO_UDPLITE=y
119 CONFIG_NF_CONNTRACK_AMANDA=m
120 CONFIG_NF_CONNTRACK_FTP=m
121 CONFIG_NF_CONNTRACK_H323=m
122 diff --git a/arch/mips/configs/nlm_xlp_defconfig b/arch/mips/configs/nlm_xlp_defconfig
123 index b496c25fced6..07d01827a973 100644
124 --- a/arch/mips/configs/nlm_xlp_defconfig
125 +++ b/arch/mips/configs/nlm_xlp_defconfig
126 @@ -110,7 +110,7 @@ CONFIG_NETFILTER=y
127 CONFIG_NF_CONNTRACK=m
128 CONFIG_NF_CONNTRACK_SECMARK=y
129 CONFIG_NF_CONNTRACK_EVENTS=y
130 -CONFIG_NF_CT_PROTO_UDPLITE=m
131 +CONFIG_NF_CT_PROTO_UDPLITE=y
132 CONFIG_NF_CONNTRACK_AMANDA=m
133 CONFIG_NF_CONNTRACK_FTP=m
134 CONFIG_NF_CONNTRACK_H323=m
135 diff --git a/arch/mips/configs/nlm_xlr_defconfig b/arch/mips/configs/nlm_xlr_defconfig
136 index 8e99ad807a57..f59969acb724 100644
137 --- a/arch/mips/configs/nlm_xlr_defconfig
138 +++ b/arch/mips/configs/nlm_xlr_defconfig
139 @@ -90,7 +90,7 @@ CONFIG_NETFILTER=y
140 CONFIG_NF_CONNTRACK=m
141 CONFIG_NF_CONNTRACK_SECMARK=y
142 CONFIG_NF_CONNTRACK_EVENTS=y
143 -CONFIG_NF_CT_PROTO_UDPLITE=m
144 +CONFIG_NF_CT_PROTO_UDPLITE=y
145 CONFIG_NF_CONNTRACK_AMANDA=m
146 CONFIG_NF_CONNTRACK_FTP=m
147 CONFIG_NF_CONNTRACK_H323=m
148 diff --git a/arch/mips/include/asm/mach-ip27/spaces.h b/arch/mips/include/asm/mach-ip27/spaces.h
149 index 4775a1136a5b..24d5e31bcfa6 100644
150 --- a/arch/mips/include/asm/mach-ip27/spaces.h
151 +++ b/arch/mips/include/asm/mach-ip27/spaces.h
152 @@ -12,14 +12,16 @@
153
154 /*
155 * IP27 uses the R10000's uncached attribute feature. Attribute 3 selects
156 - * uncached memory addressing.
157 + * uncached memory addressing. Hide the definitions on 32-bit compilation
158 + * of the compat-vdso code.
159 */
160 -
161 +#ifdef CONFIG_64BIT
162 #define HSPEC_BASE 0x9000000000000000
163 #define IO_BASE 0x9200000000000000
164 #define MSPEC_BASE 0x9400000000000000
165 #define UNCAC_BASE 0x9600000000000000
166 #define CAC_BASE 0xa800000000000000
167 +#endif
168
169 #define TO_MSPEC(x) (MSPEC_BASE | ((x) & TO_PHYS_MASK))
170 #define TO_HSPEC(x) (HSPEC_BASE | ((x) & TO_PHYS_MASK))
171 diff --git a/arch/mips/ralink/prom.c b/arch/mips/ralink/prom.c
172 index 5a73c5e14221..23198c9050e5 100644
173 --- a/arch/mips/ralink/prom.c
174 +++ b/arch/mips/ralink/prom.c
175 @@ -30,8 +30,10 @@ const char *get_system_type(void)
176 return soc_info.sys_type;
177 }
178
179 -static __init void prom_init_cmdline(int argc, char **argv)
180 +static __init void prom_init_cmdline(void)
181 {
182 + int argc;
183 + char **argv;
184 int i;
185
186 pr_debug("prom: fw_arg0=%08x fw_arg1=%08x fw_arg2=%08x fw_arg3=%08x\n",
187 @@ -60,14 +62,11 @@ static __init void prom_init_cmdline(int argc, char **argv)
188
189 void __init prom_init(void)
190 {
191 - int argc;
192 - char **argv;
193 -
194 prom_soc_init(&soc_info);
195
196 pr_info("SoC Type: %s\n", get_system_type());
197
198 - prom_init_cmdline(argc, argv);
199 + prom_init_cmdline();
200 }
201
202 void __init prom_free_prom_memory(void)
203 diff --git a/arch/mips/ralink/rt288x.c b/arch/mips/ralink/rt288x.c
204 index 285796e6d75c..2b76e3643869 100644
205 --- a/arch/mips/ralink/rt288x.c
206 +++ b/arch/mips/ralink/rt288x.c
207 @@ -40,16 +40,6 @@ static struct rt2880_pmx_group rt2880_pinmux_data_act[] = {
208 { 0 }
209 };
210
211 -static void rt288x_wdt_reset(void)
212 -{
213 - u32 t;
214 -
215 - /* enable WDT reset output on pin SRAM_CS_N */
216 - t = rt_sysc_r32(SYSC_REG_CLKCFG);
217 - t |= CLKCFG_SRAM_CS_N_WDT;
218 - rt_sysc_w32(t, SYSC_REG_CLKCFG);
219 -}
220 -
221 void __init ralink_clk_init(void)
222 {
223 unsigned long cpu_rate, wmac_rate = 40000000;
224 diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c
225 index c8a28c4bf29e..e778e0b54ffb 100644
226 --- a/arch/mips/ralink/rt305x.c
227 +++ b/arch/mips/ralink/rt305x.c
228 @@ -89,17 +89,6 @@ static struct rt2880_pmx_group rt5350_pinmux_data[] = {
229 { 0 }
230 };
231
232 -static void rt305x_wdt_reset(void)
233 -{
234 - u32 t;
235 -
236 - /* enable WDT reset output on pin SRAM_CS_N */
237 - t = rt_sysc_r32(SYSC_REG_SYSTEM_CONFIG);
238 - t |= RT305X_SYSCFG_SRAM_CS0_MODE_WDT <<
239 - RT305X_SYSCFG_SRAM_CS0_MODE_SHIFT;
240 - rt_sysc_w32(t, SYSC_REG_SYSTEM_CONFIG);
241 -}
242 -
243 static unsigned long rt5350_get_mem_size(void)
244 {
245 void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE);
246 diff --git a/arch/mips/ralink/rt3883.c b/arch/mips/ralink/rt3883.c
247 index 4cef9162bd9b..3e0aa09c6b55 100644
248 --- a/arch/mips/ralink/rt3883.c
249 +++ b/arch/mips/ralink/rt3883.c
250 @@ -63,16 +63,6 @@ static struct rt2880_pmx_group rt3883_pinmux_data[] = {
251 { 0 }
252 };
253
254 -static void rt3883_wdt_reset(void)
255 -{
256 - u32 t;
257 -
258 - /* enable WDT reset output on GPIO 2 */
259 - t = rt_sysc_r32(RT3883_SYSC_REG_SYSCFG1);
260 - t |= RT3883_SYSCFG1_GPIO2_AS_WDT_OUT;
261 - rt_sysc_w32(t, RT3883_SYSC_REG_SYSCFG1);
262 -}
263 -
264 void __init ralink_clk_init(void)
265 {
266 unsigned long cpu_rate, sys_rate;
267 diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c
268 index 8077ff39bdea..d4469b20d176 100644
269 --- a/arch/mips/ralink/timer.c
270 +++ b/arch/mips/ralink/timer.c
271 @@ -71,11 +71,6 @@ static int rt_timer_request(struct rt_timer *rt)
272 return err;
273 }
274
275 -static void rt_timer_free(struct rt_timer *rt)
276 -{
277 - free_irq(rt->irq, rt);
278 -}
279 -
280 static int rt_timer_config(struct rt_timer *rt, unsigned long divisor)
281 {
282 if (rt->timer_freq < divisor)
283 @@ -101,15 +96,6 @@ static int rt_timer_enable(struct rt_timer *rt)
284 return 0;
285 }
286
287 -static void rt_timer_disable(struct rt_timer *rt)
288 -{
289 - u32 t;
290 -
291 - t = rt_timer_r32(rt, TIMER_REG_TMR0CTL);
292 - t &= ~TMR0CTL_ENABLE;
293 - rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
294 -}
295 -
296 static int rt_timer_probe(struct platform_device *pdev)
297 {
298 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
299 diff --git a/arch/mips/sgi-ip22/Platform b/arch/mips/sgi-ip22/Platform
300 index b7a4b7e04c38..e8f6b3a42a48 100644
301 --- a/arch/mips/sgi-ip22/Platform
302 +++ b/arch/mips/sgi-ip22/Platform
303 @@ -25,7 +25,7 @@ endif
304 # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys
305 #
306 ifdef CONFIG_SGI_IP28
307 - ifeq ($(call cc-option-yn,-mr10k-cache-barrier=store), n)
308 + ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n)
309 $(error gcc doesn't support needed option -mr10k-cache-barrier=store)
310 endif
311 endif
312 diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
313 index 3362299b1859..6ca3b902f7b9 100644
314 --- a/arch/powerpc/lib/sstep.c
315 +++ b/arch/powerpc/lib/sstep.c
316 @@ -1807,8 +1807,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
317 goto instr_done;
318
319 case LARX:
320 - if (regs->msr & MSR_LE)
321 - return 0;
322 if (op.ea & (size - 1))
323 break; /* can't handle misaligned */
324 err = -EFAULT;
325 @@ -1832,8 +1830,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
326 goto ldst_done;
327
328 case STCX:
329 - if (regs->msr & MSR_LE)
330 - return 0;
331 if (op.ea & (size - 1))
332 break; /* can't handle misaligned */
333 err = -EFAULT;
334 @@ -1859,8 +1855,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
335 goto ldst_done;
336
337 case LOAD:
338 - if (regs->msr & MSR_LE)
339 - return 0;
340 err = read_mem(&regs->gpr[op.reg], op.ea, size, regs);
341 if (!err) {
342 if (op.type & SIGNEXT)
343 @@ -1872,8 +1866,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
344
345 #ifdef CONFIG_PPC_FPU
346 case LOAD_FP:
347 - if (regs->msr & MSR_LE)
348 - return 0;
349 if (size == 4)
350 err = do_fp_load(op.reg, do_lfs, op.ea, size, regs);
351 else
352 @@ -1882,15 +1874,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
353 #endif
354 #ifdef CONFIG_ALTIVEC
355 case LOAD_VMX:
356 - if (regs->msr & MSR_LE)
357 - return 0;
358 err = do_vec_load(op.reg, do_lvx, op.ea & ~0xfUL, regs);
359 goto ldst_done;
360 #endif
361 #ifdef CONFIG_VSX
362 case LOAD_VSX:
363 - if (regs->msr & MSR_LE)
364 - return 0;
365 err = do_vsx_load(op.reg, do_lxvd2x, op.ea, regs);
366 goto ldst_done;
367 #endif
368 @@ -1913,8 +1901,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
369 goto instr_done;
370
371 case STORE:
372 - if (regs->msr & MSR_LE)
373 - return 0;
374 if ((op.type & UPDATE) && size == sizeof(long) &&
375 op.reg == 1 && op.update_reg == 1 &&
376 !(regs->msr & MSR_PR) &&
377 @@ -1927,8 +1913,6 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
378
379 #ifdef CONFIG_PPC_FPU
380 case STORE_FP:
381 - if (regs->msr & MSR_LE)
382 - return 0;
383 if (size == 4)
384 err = do_fp_store(op.reg, do_stfs, op.ea, size, regs);
385 else
386 @@ -1937,15 +1921,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
387 #endif
388 #ifdef CONFIG_ALTIVEC
389 case STORE_VMX:
390 - if (regs->msr & MSR_LE)
391 - return 0;
392 err = do_vec_store(op.reg, do_stvx, op.ea & ~0xfUL, regs);
393 goto ldst_done;
394 #endif
395 #ifdef CONFIG_VSX
396 case STORE_VSX:
397 - if (regs->msr & MSR_LE)
398 - return 0;
399 err = do_vsx_store(op.reg, do_stxvd2x, op.ea, regs);
400 goto ldst_done;
401 #endif
402 diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics/icp-opal.c
403 index c96c0cb95d87..32c46b424dd0 100644
404 --- a/arch/powerpc/sysdev/xics/icp-opal.c
405 +++ b/arch/powerpc/sysdev/xics/icp-opal.c
406 @@ -91,6 +91,16 @@ static unsigned int icp_opal_get_irq(void)
407
408 static void icp_opal_set_cpu_priority(unsigned char cppr)
409 {
410 + /*
411 + * Here be dragons. The caller has asked to allow only IPI's and not
412 + * external interrupts. But OPAL XIVE doesn't support that. So instead
413 + * of allowing no interrupts allow all. That's still not right, but
414 + * currently the only caller who does this is xics_migrate_irqs_away()
415 + * and it works in that case.
416 + */
417 + if (cppr >= DEFAULT_PRIORITY)
418 + cppr = LOWEST_PRIORITY;
419 +
420 xics_set_base_cppr(cppr);
421 opal_int_set_cppr(cppr);
422 iosync();
423 diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
424 index 69d858e51ac7..23efe4e42172 100644
425 --- a/arch/powerpc/sysdev/xics/xics-common.c
426 +++ b/arch/powerpc/sysdev/xics/xics-common.c
427 @@ -20,6 +20,7 @@
428 #include <linux/of.h>
429 #include <linux/slab.h>
430 #include <linux/spinlock.h>
431 +#include <linux/delay.h>
432
433 #include <asm/prom.h>
434 #include <asm/io.h>
435 @@ -198,9 +199,6 @@ void xics_migrate_irqs_away(void)
436 /* Remove ourselves from the global interrupt queue */
437 xics_set_cpu_giq(xics_default_distrib_server, 0);
438
439 - /* Allow IPIs again... */
440 - icp_ops->set_priority(DEFAULT_PRIORITY);
441 -
442 for_each_irq_desc(virq, desc) {
443 struct irq_chip *chip;
444 long server;
445 @@ -255,6 +253,19 @@ void xics_migrate_irqs_away(void)
446 unlock:
447 raw_spin_unlock_irqrestore(&desc->lock, flags);
448 }
449 +
450 + /* Allow "sufficient" time to drop any inflight IRQ's */
451 + mdelay(5);
452 +
453 + /*
454 + * Allow IPIs again. This is done at the very end, after migrating all
455 + * interrupts, the expectation is that we'll only get woken up by an IPI
456 + * interrupt beyond this point, but leave externals masked just to be
457 + * safe. If we're using icp-opal this may actually allow all
458 + * interrupts anyway, but that should be OK.
459 + */
460 + icp_ops->set_priority(DEFAULT_PRIORITY);
461 +
462 }
463 #endif /* CONFIG_HOTPLUG_CPU */
464
465 diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
466 index d56ef26d4681..7678f7956409 100644
467 --- a/arch/s390/mm/pgtable.c
468 +++ b/arch/s390/mm/pgtable.c
469 @@ -606,12 +606,29 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
470 bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
471 {
472 spinlock_t *ptl;
473 + pgd_t *pgd;
474 + pud_t *pud;
475 + pmd_t *pmd;
476 pgste_t pgste;
477 pte_t *ptep;
478 pte_t pte;
479 bool dirty;
480
481 - ptep = get_locked_pte(mm, addr, &ptl);
482 + pgd = pgd_offset(mm, addr);
483 + pud = pud_alloc(mm, pgd, addr);
484 + if (!pud)
485 + return false;
486 + pmd = pmd_alloc(mm, pud, addr);
487 + if (!pmd)
488 + return false;
489 + /* We can't run guests backed by huge pages, but userspace can
490 + * still set them up and then try to migrate them without any
491 + * migration support.
492 + */
493 + if (pmd_large(*pmd))
494 + return true;
495 +
496 + ptep = pte_alloc_map_lock(mm, pmd, addr, &ptl);
497 if (unlikely(!ptep))
498 return false;
499
500 diff --git a/crypto/Makefile b/crypto/Makefile
501 index bd6a029094e6..9e52b3c528df 100644
502 --- a/crypto/Makefile
503 +++ b/crypto/Makefile
504 @@ -71,6 +71,7 @@ obj-$(CONFIG_CRYPTO_SHA256) += sha256_generic.o
505 obj-$(CONFIG_CRYPTO_SHA512) += sha512_generic.o
506 obj-$(CONFIG_CRYPTO_SHA3) += sha3_generic.o
507 obj-$(CONFIG_CRYPTO_WP512) += wp512.o
508 +CFLAGS_wp512.o := $(call cc-option,-fno-schedule-insns) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
509 obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
510 obj-$(CONFIG_CRYPTO_GF128MUL) += gf128mul.o
511 obj-$(CONFIG_CRYPTO_ECB) += ecb.o
512 @@ -94,6 +95,7 @@ obj-$(CONFIG_CRYPTO_BLOWFISH_COMMON) += blowfish_common.o
513 obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
514 obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
515 obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
516 +CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure) # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
517 obj-$(CONFIG_CRYPTO_AES) += aes_generic.o
518 obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
519 obj-$(CONFIG_CRYPTO_CAST_COMMON) += cast_common.o
520 diff --git a/drivers/firmware/efi/arm-runtime.c b/drivers/firmware/efi/arm-runtime.c
521 index 7c75a8d9091a..6bdf39e1e385 100644
522 --- a/drivers/firmware/efi/arm-runtime.c
523 +++ b/drivers/firmware/efi/arm-runtime.c
524 @@ -65,6 +65,7 @@ static bool __init efi_virtmap_init(void)
525 bool systab_found;
526
527 efi_mm.pgd = pgd_alloc(&efi_mm);
528 + mm_init_cpumask(&efi_mm);
529 init_new_context(NULL, &efi_mm);
530
531 systab_found = false;
532 diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
533 index 83768e85a919..2178266bca79 100644
534 --- a/drivers/i2c/i2c-mux.c
535 +++ b/drivers/i2c/i2c-mux.c
536 @@ -429,6 +429,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
537 while (muxc->num_adapters) {
538 struct i2c_adapter *adap = muxc->adapter[--muxc->num_adapters];
539 struct i2c_mux_priv *priv = adap->algo_data;
540 + struct device_node *np = adap->dev.of_node;
541
542 muxc->adapter[muxc->num_adapters] = NULL;
543
544 @@ -438,6 +439,7 @@ void i2c_mux_del_adapters(struct i2c_mux_core *muxc)
545
546 sysfs_remove_link(&priv->adap.dev.kobj, "mux_device");
547 i2c_del_adapter(adap);
548 + of_node_put(np);
549 kfree(priv);
550 }
551 }
552 diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
553 index 4cab29ea394c..11bfa27b022c 100644
554 --- a/drivers/infiniband/hw/mlx5/main.c
555 +++ b/drivers/infiniband/hw/mlx5/main.c
556 @@ -3141,9 +3141,11 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
557 if (err)
558 goto err_rsrc;
559
560 - err = mlx5_ib_alloc_q_counters(dev);
561 - if (err)
562 - goto err_odp;
563 + if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt)) {
564 + err = mlx5_ib_alloc_q_counters(dev);
565 + if (err)
566 + goto err_odp;
567 + }
568
569 err = ib_register_device(&dev->ib_dev, NULL);
570 if (err)
571 @@ -3171,7 +3173,8 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
572 ib_unregister_device(&dev->ib_dev);
573
574 err_q_cnt:
575 - mlx5_ib_dealloc_q_counters(dev);
576 + if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
577 + mlx5_ib_dealloc_q_counters(dev);
578
579 err_odp:
580 mlx5_ib_odp_remove_one(dev);
581 @@ -3201,7 +3204,8 @@ static void mlx5_ib_remove(struct mlx5_core_dev *mdev, void *context)
582
583 mlx5_remove_roce_notifier(dev);
584 ib_unregister_device(&dev->ib_dev);
585 - mlx5_ib_dealloc_q_counters(dev);
586 + if (MLX5_CAP_GEN(dev->mdev, max_qp_cnt))
587 + mlx5_ib_dealloc_q_counters(dev);
588 destroy_umrc_res(dev);
589 mlx5_ib_odp_remove_one(dev);
590 destroy_dev_resources(&dev->devr);
591 diff --git a/drivers/md/dm.c b/drivers/md/dm.c
592 index ef7bf1dd6900..628ba001bb3c 100644
593 --- a/drivers/md/dm.c
594 +++ b/drivers/md/dm.c
595 @@ -972,10 +972,61 @@ void dm_accept_partial_bio(struct bio *bio, unsigned n_sectors)
596 }
597 EXPORT_SYMBOL_GPL(dm_accept_partial_bio);
598
599 +/*
600 + * Flush current->bio_list when the target map method blocks.
601 + * This fixes deadlocks in snapshot and possibly in other targets.
602 + */
603 +struct dm_offload {
604 + struct blk_plug plug;
605 + struct blk_plug_cb cb;
606 +};
607 +
608 +static void flush_current_bio_list(struct blk_plug_cb *cb, bool from_schedule)
609 +{
610 + struct dm_offload *o = container_of(cb, struct dm_offload, cb);
611 + struct bio_list list;
612 + struct bio *bio;
613 +
614 + INIT_LIST_HEAD(&o->cb.list);
615 +
616 + if (unlikely(!current->bio_list))
617 + return;
618 +
619 + list = *current->bio_list;
620 + bio_list_init(current->bio_list);
621 +
622 + while ((bio = bio_list_pop(&list))) {
623 + struct bio_set *bs = bio->bi_pool;
624 + if (unlikely(!bs) || bs == fs_bio_set) {
625 + bio_list_add(current->bio_list, bio);
626 + continue;
627 + }
628 +
629 + spin_lock(&bs->rescue_lock);
630 + bio_list_add(&bs->rescue_list, bio);
631 + queue_work(bs->rescue_workqueue, &bs->rescue_work);
632 + spin_unlock(&bs->rescue_lock);
633 + }
634 +}
635 +
636 +static void dm_offload_start(struct dm_offload *o)
637 +{
638 + blk_start_plug(&o->plug);
639 + o->cb.callback = flush_current_bio_list;
640 + list_add(&o->cb.list, &current->plug->cb_list);
641 +}
642 +
643 +static void dm_offload_end(struct dm_offload *o)
644 +{
645 + list_del(&o->cb.list);
646 + blk_finish_plug(&o->plug);
647 +}
648 +
649 static void __map_bio(struct dm_target_io *tio)
650 {
651 int r;
652 sector_t sector;
653 + struct dm_offload o;
654 struct bio *clone = &tio->clone;
655 struct dm_target *ti = tio->ti;
656
657 @@ -988,7 +1039,11 @@ static void __map_bio(struct dm_target_io *tio)
658 */
659 atomic_inc(&tio->io->io_count);
660 sector = clone->bi_iter.bi_sector;
661 +
662 + dm_offload_start(&o);
663 r = ti->type->map(ti, clone);
664 + dm_offload_end(&o);
665 +
666 if (r == DM_MAPIO_REMAPPED) {
667 /* the bio has been remapped so dispatch it */
668
669 diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
670 index d9c1f2ff7119..aba77357ab23 100644
671 --- a/drivers/media/rc/rc-main.c
672 +++ b/drivers/media/rc/rc-main.c
673 @@ -1411,6 +1411,7 @@ int rc_register_device(struct rc_dev *dev)
674 int attr = 0;
675 int minor;
676 int rc;
677 + u64 rc_type;
678
679 if (!dev || !dev->map_name)
680 return -EINVAL;
681 @@ -1496,14 +1497,18 @@ int rc_register_device(struct rc_dev *dev)
682 goto out_input;
683 }
684
685 + rc_type = BIT_ULL(rc_map->rc_type);
686 +
687 if (dev->change_protocol) {
688 - u64 rc_type = (1ll << rc_map->rc_type);
689 rc = dev->change_protocol(dev, &rc_type);
690 if (rc < 0)
691 goto out_raw;
692 dev->enabled_protocols = rc_type;
693 }
694
695 + if (dev->driver_type == RC_DRIVER_IR_RAW)
696 + ir_raw_load_modules(&rc_type);
697 +
698 /* Allow the RC sysfs nodes to be accessible */
699 atomic_set(&dev->initialized, 1);
700
701 diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
702 index 2c720cb2fb00..c3e67347a977 100644
703 --- a/drivers/media/usb/dvb-usb/dw2102.c
704 +++ b/drivers/media/usb/dvb-usb/dw2102.c
705 @@ -68,6 +68,7 @@
706 struct dw2102_state {
707 u8 initialized;
708 u8 last_lock;
709 + u8 data[MAX_XFER_SIZE + 4];
710 struct i2c_client *i2c_client_demod;
711 struct i2c_client *i2c_client_tuner;
712
713 @@ -662,62 +663,72 @@ static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
714 int num)
715 {
716 struct dvb_usb_device *d = i2c_get_adapdata(adap);
717 - u8 obuf[0x40], ibuf[0x40];
718 + struct dw2102_state *state;
719
720 if (!d)
721 return -ENODEV;
722 +
723 + state = d->priv;
724 +
725 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
726 return -EAGAIN;
727 + if (mutex_lock_interruptible(&d->data_mutex) < 0) {
728 + mutex_unlock(&d->i2c_mutex);
729 + return -EAGAIN;
730 + }
731
732 switch (num) {
733 case 1:
734 switch (msg[0].addr) {
735 case SU3000_STREAM_CTRL:
736 - obuf[0] = msg[0].buf[0] + 0x36;
737 - obuf[1] = 3;
738 - obuf[2] = 0;
739 - if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 0, 0) < 0)
740 + state->data[0] = msg[0].buf[0] + 0x36;
741 + state->data[1] = 3;
742 + state->data[2] = 0;
743 + if (dvb_usb_generic_rw(d, state->data, 3,
744 + state->data, 0, 0) < 0)
745 err("i2c transfer failed.");
746 break;
747 case DW2102_RC_QUERY:
748 - obuf[0] = 0x10;
749 - if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 2, 0) < 0)
750 + state->data[0] = 0x10;
751 + if (dvb_usb_generic_rw(d, state->data, 1,
752 + state->data, 2, 0) < 0)
753 err("i2c transfer failed.");
754 - msg[0].buf[1] = ibuf[0];
755 - msg[0].buf[0] = ibuf[1];
756 + msg[0].buf[1] = state->data[0];
757 + msg[0].buf[0] = state->data[1];
758 break;
759 default:
760 /* always i2c write*/
761 - obuf[0] = 0x08;
762 - obuf[1] = msg[0].addr;
763 - obuf[2] = msg[0].len;
764 + state->data[0] = 0x08;
765 + state->data[1] = msg[0].addr;
766 + state->data[2] = msg[0].len;
767
768 - memcpy(&obuf[3], msg[0].buf, msg[0].len);
769 + memcpy(&state->data[3], msg[0].buf, msg[0].len);
770
771 - if (dvb_usb_generic_rw(d, obuf, msg[0].len + 3,
772 - ibuf, 1, 0) < 0)
773 + if (dvb_usb_generic_rw(d, state->data, msg[0].len + 3,
774 + state->data, 1, 0) < 0)
775 err("i2c transfer failed.");
776
777 }
778 break;
779 case 2:
780 /* always i2c read */
781 - obuf[0] = 0x09;
782 - obuf[1] = msg[0].len;
783 - obuf[2] = msg[1].len;
784 - obuf[3] = msg[0].addr;
785 - memcpy(&obuf[4], msg[0].buf, msg[0].len);
786 -
787 - if (dvb_usb_generic_rw(d, obuf, msg[0].len + 4,
788 - ibuf, msg[1].len + 1, 0) < 0)
789 + state->data[0] = 0x09;
790 + state->data[1] = msg[0].len;
791 + state->data[2] = msg[1].len;
792 + state->data[3] = msg[0].addr;
793 + memcpy(&state->data[4], msg[0].buf, msg[0].len);
794 +
795 + if (dvb_usb_generic_rw(d, state->data, msg[0].len + 4,
796 + state->data, msg[1].len + 1, 0) < 0)
797 err("i2c transfer failed.");
798
799 - memcpy(msg[1].buf, &ibuf[1], msg[1].len);
800 + memcpy(msg[1].buf, &state->data[1], msg[1].len);
801 break;
802 default:
803 warn("more than 2 i2c messages at a time is not handled yet.");
804 break;
805 }
806 + mutex_unlock(&d->data_mutex);
807 mutex_unlock(&d->i2c_mutex);
808 return num;
809 }
810 @@ -845,17 +856,23 @@ static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
811 static int su3000_power_ctrl(struct dvb_usb_device *d, int i)
812 {
813 struct dw2102_state *state = (struct dw2102_state *)d->priv;
814 - u8 obuf[] = {0xde, 0};
815 + int ret = 0;
816
817 info("%s: %d, initialized %d", __func__, i, state->initialized);
818
819 if (i && !state->initialized) {
820 + mutex_lock(&d->data_mutex);
821 +
822 + state->data[0] = 0xde;
823 + state->data[1] = 0;
824 +
825 state->initialized = 1;
826 /* reset board */
827 - return dvb_usb_generic_rw(d, obuf, 2, NULL, 0, 0);
828 + ret = dvb_usb_generic_rw(d, state->data, 2, NULL, 0, 0);
829 + mutex_unlock(&d->data_mutex);
830 }
831
832 - return 0;
833 + return ret;
834 }
835
836 static int su3000_read_mac_address(struct dvb_usb_device *d, u8 mac[6])
837 @@ -1310,49 +1327,57 @@ static int prof_7500_frontend_attach(struct dvb_usb_adapter *d)
838 return 0;
839 }
840
841 -static int su3000_frontend_attach(struct dvb_usb_adapter *d)
842 +static int su3000_frontend_attach(struct dvb_usb_adapter *adap)
843 {
844 - u8 obuf[3] = { 0xe, 0x80, 0 };
845 - u8 ibuf[] = { 0 };
846 + struct dvb_usb_device *d = adap->dev;
847 + struct dw2102_state *state = d->priv;
848 +
849 + mutex_lock(&d->data_mutex);
850 +
851 + state->data[0] = 0xe;
852 + state->data[1] = 0x80;
853 + state->data[2] = 0;
854
855 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
856 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
857 err("command 0x0e transfer failed.");
858
859 - obuf[0] = 0xe;
860 - obuf[1] = 0x02;
861 - obuf[2] = 1;
862 + state->data[0] = 0xe;
863 + state->data[1] = 0x02;
864 + state->data[2] = 1;
865
866 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
867 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
868 err("command 0x0e transfer failed.");
869 msleep(300);
870
871 - obuf[0] = 0xe;
872 - obuf[1] = 0x83;
873 - obuf[2] = 0;
874 + state->data[0] = 0xe;
875 + state->data[1] = 0x83;
876 + state->data[2] = 0;
877
878 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
879 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
880 err("command 0x0e transfer failed.");
881
882 - obuf[0] = 0xe;
883 - obuf[1] = 0x83;
884 - obuf[2] = 1;
885 + state->data[0] = 0xe;
886 + state->data[1] = 0x83;
887 + state->data[2] = 1;
888
889 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
890 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
891 err("command 0x0e transfer failed.");
892
893 - obuf[0] = 0x51;
894 + state->data[0] = 0x51;
895
896 - if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
897 + if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
898 err("command 0x51 transfer failed.");
899
900 - d->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
901 - &d->dev->i2c_adap);
902 - if (d->fe_adap[0].fe == NULL)
903 + mutex_unlock(&d->data_mutex);
904 +
905 + adap->fe_adap[0].fe = dvb_attach(ds3000_attach, &su3000_ds3000_config,
906 + &d->i2c_adap);
907 + if (adap->fe_adap[0].fe == NULL)
908 return -EIO;
909
910 - if (dvb_attach(ts2020_attach, d->fe_adap[0].fe,
911 + if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
912 &dw2104_ts2020_config,
913 - &d->dev->i2c_adap)) {
914 + &d->i2c_adap)) {
915 info("Attached DS3000/TS2020!");
916 return 0;
917 }
918 @@ -1361,47 +1386,55 @@ static int su3000_frontend_attach(struct dvb_usb_adapter *d)
919 return -EIO;
920 }
921
922 -static int t220_frontend_attach(struct dvb_usb_adapter *d)
923 +static int t220_frontend_attach(struct dvb_usb_adapter *adap)
924 {
925 - u8 obuf[3] = { 0xe, 0x87, 0 };
926 - u8 ibuf[] = { 0 };
927 + struct dvb_usb_device *d = adap->dev;
928 + struct dw2102_state *state = d->priv;
929 +
930 + mutex_lock(&d->data_mutex);
931
932 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
933 + state->data[0] = 0xe;
934 + state->data[1] = 0x87;
935 + state->data[2] = 0x0;
936 +
937 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
938 err("command 0x0e transfer failed.");
939
940 - obuf[0] = 0xe;
941 - obuf[1] = 0x86;
942 - obuf[2] = 1;
943 + state->data[0] = 0xe;
944 + state->data[1] = 0x86;
945 + state->data[2] = 1;
946
947 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
948 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
949 err("command 0x0e transfer failed.");
950
951 - obuf[0] = 0xe;
952 - obuf[1] = 0x80;
953 - obuf[2] = 0;
954 + state->data[0] = 0xe;
955 + state->data[1] = 0x80;
956 + state->data[2] = 0;
957
958 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
959 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
960 err("command 0x0e transfer failed.");
961
962 msleep(50);
963
964 - obuf[0] = 0xe;
965 - obuf[1] = 0x80;
966 - obuf[2] = 1;
967 + state->data[0] = 0xe;
968 + state->data[1] = 0x80;
969 + state->data[2] = 1;
970
971 - if (dvb_usb_generic_rw(d->dev, obuf, 3, ibuf, 1, 0) < 0)
972 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
973 err("command 0x0e transfer failed.");
974
975 - obuf[0] = 0x51;
976 + state->data[0] = 0x51;
977
978 - if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
979 + if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
980 err("command 0x51 transfer failed.");
981
982 - d->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
983 - &d->dev->i2c_adap, NULL);
984 - if (d->fe_adap[0].fe != NULL) {
985 - if (dvb_attach(tda18271_attach, d->fe_adap[0].fe, 0x60,
986 - &d->dev->i2c_adap, &tda18271_config)) {
987 + mutex_unlock(&d->data_mutex);
988 +
989 + adap->fe_adap[0].fe = dvb_attach(cxd2820r_attach, &cxd2820r_config,
990 + &d->i2c_adap, NULL);
991 + if (adap->fe_adap[0].fe != NULL) {
992 + if (dvb_attach(tda18271_attach, adap->fe_adap[0].fe, 0x60,
993 + &d->i2c_adap, &tda18271_config)) {
994 info("Attached TDA18271HD/CXD2820R!");
995 return 0;
996 }
997 @@ -1411,23 +1444,30 @@ static int t220_frontend_attach(struct dvb_usb_adapter *d)
998 return -EIO;
999 }
1000
1001 -static int m88rs2000_frontend_attach(struct dvb_usb_adapter *d)
1002 +static int m88rs2000_frontend_attach(struct dvb_usb_adapter *adap)
1003 {
1004 - u8 obuf[] = { 0x51 };
1005 - u8 ibuf[] = { 0 };
1006 + struct dvb_usb_device *d = adap->dev;
1007 + struct dw2102_state *state = d->priv;
1008 +
1009 + mutex_lock(&d->data_mutex);
1010
1011 - if (dvb_usb_generic_rw(d->dev, obuf, 1, ibuf, 1, 0) < 0)
1012 + state->data[0] = 0x51;
1013 +
1014 + if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1015 err("command 0x51 transfer failed.");
1016
1017 - d->fe_adap[0].fe = dvb_attach(m88rs2000_attach, &s421_m88rs2000_config,
1018 - &d->dev->i2c_adap);
1019 + mutex_unlock(&d->data_mutex);
1020
1021 - if (d->fe_adap[0].fe == NULL)
1022 + adap->fe_adap[0].fe = dvb_attach(m88rs2000_attach,
1023 + &s421_m88rs2000_config,
1024 + &d->i2c_adap);
1025 +
1026 + if (adap->fe_adap[0].fe == NULL)
1027 return -EIO;
1028
1029 - if (dvb_attach(ts2020_attach, d->fe_adap[0].fe,
1030 + if (dvb_attach(ts2020_attach, adap->fe_adap[0].fe,
1031 &dw2104_ts2020_config,
1032 - &d->dev->i2c_adap)) {
1033 + &d->i2c_adap)) {
1034 info("Attached RS2000/TS2020!");
1035 return 0;
1036 }
1037 @@ -1440,44 +1480,50 @@ static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap)
1038 {
1039 struct dvb_usb_device *d = adap->dev;
1040 struct dw2102_state *state = d->priv;
1041 - u8 obuf[3] = { 0xe, 0x80, 0 };
1042 - u8 ibuf[] = { 0 };
1043 struct i2c_adapter *i2c_adapter;
1044 struct i2c_client *client;
1045 struct i2c_board_info board_info;
1046 struct m88ds3103_platform_data m88ds3103_pdata = {};
1047 struct ts2020_config ts2020_config = {};
1048
1049 - if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1050 + mutex_lock(&d->data_mutex);
1051 +
1052 + state->data[0] = 0xe;
1053 + state->data[1] = 0x80;
1054 + state->data[2] = 0x0;
1055 +
1056 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1057 err("command 0x0e transfer failed.");
1058
1059 - obuf[0] = 0xe;
1060 - obuf[1] = 0x02;
1061 - obuf[2] = 1;
1062 + state->data[0] = 0xe;
1063 + state->data[1] = 0x02;
1064 + state->data[2] = 1;
1065
1066 - if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1067 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1068 err("command 0x0e transfer failed.");
1069 msleep(300);
1070
1071 - obuf[0] = 0xe;
1072 - obuf[1] = 0x83;
1073 - obuf[2] = 0;
1074 + state->data[0] = 0xe;
1075 + state->data[1] = 0x83;
1076 + state->data[2] = 0;
1077
1078 - if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1079 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1080 err("command 0x0e transfer failed.");
1081
1082 - obuf[0] = 0xe;
1083 - obuf[1] = 0x83;
1084 - obuf[2] = 1;
1085 + state->data[0] = 0xe;
1086 + state->data[1] = 0x83;
1087 + state->data[2] = 1;
1088
1089 - if (dvb_usb_generic_rw(d, obuf, 3, ibuf, 1, 0) < 0)
1090 + if (dvb_usb_generic_rw(d, state->data, 3, state->data, 1, 0) < 0)
1091 err("command 0x0e transfer failed.");
1092
1093 - obuf[0] = 0x51;
1094 + state->data[0] = 0x51;
1095
1096 - if (dvb_usb_generic_rw(d, obuf, 1, ibuf, 1, 0) < 0)
1097 + if (dvb_usb_generic_rw(d, state->data, 1, state->data, 1, 0) < 0)
1098 err("command 0x51 transfer failed.");
1099
1100 + mutex_unlock(&d->data_mutex);
1101 +
1102 /* attach demod */
1103 m88ds3103_pdata.clk = 27000000;
1104 m88ds3103_pdata.i2c_wr_max = 33;
1105 diff --git a/drivers/mtd/maps/pmcmsp-flash.c b/drivers/mtd/maps/pmcmsp-flash.c
1106 index f9fa3fad728e..2051f28ddac6 100644
1107 --- a/drivers/mtd/maps/pmcmsp-flash.c
1108 +++ b/drivers/mtd/maps/pmcmsp-flash.c
1109 @@ -139,15 +139,13 @@ static int __init init_msp_flash(void)
1110 }
1111
1112 msp_maps[i].bankwidth = 1;
1113 - msp_maps[i].name = kmalloc(7, GFP_KERNEL);
1114 + msp_maps[i].name = kstrndup(flash_name, 7, GFP_KERNEL);
1115 if (!msp_maps[i].name) {
1116 iounmap(msp_maps[i].virt);
1117 kfree(msp_parts[i]);
1118 goto cleanup_loop;
1119 }
1120
1121 - msp_maps[i].name = strncpy(msp_maps[i].name, flash_name, 7);
1122 -
1123 for (j = 0; j < pcnt; j++) {
1124 part_name[5] = '0' + i;
1125 part_name[7] = '0' + j;
1126 diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
1127 index 537090952c45..08d91efceed0 100644
1128 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
1129 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
1130 @@ -913,6 +913,8 @@ static int bcm_enet_open(struct net_device *dev)
1131 priv->old_link = 0;
1132 priv->old_duplex = -1;
1133 priv->old_pause = -1;
1134 + } else {
1135 + phydev = NULL;
1136 }
1137
1138 /* mask all interrupts and request them */
1139 @@ -1083,7 +1085,7 @@ static int bcm_enet_open(struct net_device *dev)
1140 enet_dmac_writel(priv, priv->dma_chan_int_mask,
1141 ENETDMAC_IRMASK, priv->tx_chan);
1142
1143 - if (priv->has_phy)
1144 + if (phydev)
1145 phy_start(phydev);
1146 else
1147 bcm_enet_adjust_link(dev);
1148 @@ -1126,7 +1128,7 @@ static int bcm_enet_open(struct net_device *dev)
1149 free_irq(dev->irq, dev);
1150
1151 out_phy_disconnect:
1152 - if (priv->has_phy)
1153 + if (phydev)
1154 phy_disconnect(phydev);
1155
1156 return ret;
1157 diff --git a/drivers/net/ethernet/ti/cpmac.c b/drivers/net/ethernet/ti/cpmac.c
1158 index 28097be2ff28..5127b7e48fcb 100644
1159 --- a/drivers/net/ethernet/ti/cpmac.c
1160 +++ b/drivers/net/ethernet/ti/cpmac.c
1161 @@ -1211,7 +1211,7 @@ int cpmac_init(void)
1162 goto fail_alloc;
1163 }
1164
1165 -#warning FIXME: unhardcode gpio&reset bits
1166 + /* FIXME: unhardcode gpio&reset bits */
1167 ar7_gpio_disable(26);
1168 ar7_gpio_disable(27);
1169 ar7_device_reset(AR7_RESET_BIT_CPMAC_LO);
1170 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1171 index 3a035e073889..087a218a875f 100644
1172 --- a/drivers/pci/quirks.c
1173 +++ b/drivers/pci/quirks.c
1174 @@ -2173,6 +2173,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005d, quirk_blacklist_vpd);
1175 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LSI_LOGIC, 0x005f, quirk_blacklist_vpd);
1176 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATTANSIC, PCI_ANY_ID,
1177 quirk_blacklist_vpd);
1178 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_QLOGIC, 0x2261, quirk_blacklist_vpd);
1179
1180 /*
1181 * For Broadcom 5706, 5708, 5709 rev. A nics, any read beyond the
1182 diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
1183 index f44615fa474d..3e2ef4fd7382 100644
1184 --- a/drivers/tty/serial/samsung.c
1185 +++ b/drivers/tty/serial/samsung.c
1186 @@ -1036,8 +1036,10 @@ static int s3c64xx_serial_startup(struct uart_port *port)
1187 if (ourport->dma) {
1188 ret = s3c24xx_serial_request_dma(ourport);
1189 if (ret < 0) {
1190 - dev_warn(port->dev, "DMA request failed\n");
1191 - return ret;
1192 + dev_warn(port->dev,
1193 + "DMA request failed, DMA will not be used\n");
1194 + devm_kfree(port->dev, ourport->dma);
1195 + ourport->dma = NULL;
1196 }
1197 }
1198
1199 diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
1200 index 29e80cc9b634..5dd1832564c7 100644
1201 --- a/drivers/usb/dwc3/dwc3-omap.c
1202 +++ b/drivers/usb/dwc3/dwc3-omap.c
1203 @@ -249,6 +249,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
1204 val = dwc3_omap_read_utmi_ctrl(omap);
1205 val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG;
1206 dwc3_omap_write_utmi_ctrl(omap, val);
1207 + break;
1208
1209 case OMAP_DWC3_VBUS_OFF:
1210 val = dwc3_omap_read_utmi_ctrl(omap);
1211 diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
1212 index e4a1d974a5ae..39459b718e98 100644
1213 --- a/drivers/usb/dwc3/gadget.h
1214 +++ b/drivers/usb/dwc3/gadget.h
1215 @@ -28,23 +28,23 @@ struct dwc3;
1216 #define gadget_to_dwc(g) (container_of(g, struct dwc3, gadget))
1217
1218 /* DEPCFG parameter 1 */
1219 -#define DWC3_DEPCFG_INT_NUM(n) ((n) << 0)
1220 +#define DWC3_DEPCFG_INT_NUM(n) (((n) & 0x1f) << 0)
1221 #define DWC3_DEPCFG_XFER_COMPLETE_EN (1 << 8)
1222 #define DWC3_DEPCFG_XFER_IN_PROGRESS_EN (1 << 9)
1223 #define DWC3_DEPCFG_XFER_NOT_READY_EN (1 << 10)
1224 #define DWC3_DEPCFG_FIFO_ERROR_EN (1 << 11)
1225 #define DWC3_DEPCFG_STREAM_EVENT_EN (1 << 13)
1226 -#define DWC3_DEPCFG_BINTERVAL_M1(n) ((n) << 16)
1227 +#define DWC3_DEPCFG_BINTERVAL_M1(n) (((n) & 0xff) << 16)
1228 #define DWC3_DEPCFG_STREAM_CAPABLE (1 << 24)
1229 -#define DWC3_DEPCFG_EP_NUMBER(n) ((n) << 25)
1230 +#define DWC3_DEPCFG_EP_NUMBER(n) (((n) & 0x1f) << 25)
1231 #define DWC3_DEPCFG_BULK_BASED (1 << 30)
1232 #define DWC3_DEPCFG_FIFO_BASED (1 << 31)
1233
1234 /* DEPCFG parameter 0 */
1235 -#define DWC3_DEPCFG_EP_TYPE(n) ((n) << 1)
1236 -#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) ((n) << 3)
1237 -#define DWC3_DEPCFG_FIFO_NUMBER(n) ((n) << 17)
1238 -#define DWC3_DEPCFG_BURST_SIZE(n) ((n) << 22)
1239 +#define DWC3_DEPCFG_EP_TYPE(n) (((n) & 0x3) << 1)
1240 +#define DWC3_DEPCFG_MAX_PACKET_SIZE(n) (((n) & 0x7ff) << 3)
1241 +#define DWC3_DEPCFG_FIFO_NUMBER(n) (((n) & 0x1f) << 17)
1242 +#define DWC3_DEPCFG_BURST_SIZE(n) (((n) & 0xf) << 22)
1243 #define DWC3_DEPCFG_DATA_SEQ_NUM(n) ((n) << 26)
1244 /* This applies for core versions earlier than 1.94a */
1245 #define DWC3_DEPCFG_IGN_SEQ_NUM (1 << 31)
1246 diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
1247 index 8d412d8b1f29..89081b834615 100644
1248 --- a/drivers/usb/gadget/function/f_fs.c
1249 +++ b/drivers/usb/gadget/function/f_fs.c
1250 @@ -1833,11 +1833,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1251 spin_lock_irqsave(&func->ffs->eps_lock, flags);
1252 do {
1253 struct usb_endpoint_descriptor *ds;
1254 + struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
1255 + int needs_comp_desc = false;
1256 int desc_idx;
1257
1258 - if (ffs->gadget->speed == USB_SPEED_SUPER)
1259 + if (ffs->gadget->speed == USB_SPEED_SUPER) {
1260 desc_idx = 2;
1261 - else if (ffs->gadget->speed == USB_SPEED_HIGH)
1262 + needs_comp_desc = true;
1263 + } else if (ffs->gadget->speed == USB_SPEED_HIGH)
1264 desc_idx = 1;
1265 else
1266 desc_idx = 0;
1267 @@ -1854,6 +1857,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
1268
1269 ep->ep->driver_data = ep;
1270 ep->ep->desc = ds;
1271 +
1272 + comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
1273 + USB_DT_ENDPOINT_SIZE);
1274 + ep->ep->maxburst = comp_desc->bMaxBurst + 1;
1275 +
1276 + if (needs_comp_desc)
1277 + ep->ep->comp_desc = comp_desc;
1278 +
1279 ret = usb_ep_enable(ep->ep);
1280 if (likely(!ret)) {
1281 epfile->ep = ep;
1282 diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
1283 index 27ed51b5082f..29b41b5dee04 100644
1284 --- a/drivers/usb/gadget/function/f_uvc.c
1285 +++ b/drivers/usb/gadget/function/f_uvc.c
1286 @@ -258,13 +258,6 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
1287 memcpy(&uvc_event->req, ctrl, sizeof(uvc_event->req));
1288 v4l2_event_queue(&uvc->vdev, &v4l2_event);
1289
1290 - /* Pass additional setup data to userspace */
1291 - if (uvc->event_setup_out && uvc->event_length) {
1292 - uvc->control_req->length = uvc->event_length;
1293 - return usb_ep_queue(uvc->func.config->cdev->gadget->ep0,
1294 - uvc->control_req, GFP_ATOMIC);
1295 - }
1296 -
1297 return 0;
1298 }
1299
1300 diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
1301 index a81d9ab861dc..4fa5de2eb501 100644
1302 --- a/drivers/usb/gadget/udc/dummy_hcd.c
1303 +++ b/drivers/usb/gadget/udc/dummy_hcd.c
1304 @@ -1031,6 +1031,8 @@ static int dummy_udc_probe(struct platform_device *pdev)
1305 int rc;
1306
1307 dum = *((void **)dev_get_platdata(&pdev->dev));
1308 + /* Clear usb_gadget region for new registration to udc-core */
1309 + memzero_explicit(&dum->gadget, sizeof(struct usb_gadget));
1310 dum->gadget.name = gadget_name;
1311 dum->gadget.ops = &dummy_ops;
1312 dum->gadget.max_speed = USB_SPEED_SUPER;
1313 diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
1314 index b38a228134df..af0566da77e7 100644
1315 --- a/drivers/usb/host/ohci-at91.c
1316 +++ b/drivers/usb/host/ohci-at91.c
1317 @@ -361,7 +361,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1318
1319 case USB_PORT_FEAT_SUSPEND:
1320 dev_dbg(hcd->self.controller, "SetPortFeat: SUSPEND\n");
1321 - if (valid_port(wIndex)) {
1322 + if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
1323 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
1324 1);
1325 return 0;
1326 @@ -404,7 +404,7 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1327
1328 case USB_PORT_FEAT_SUSPEND:
1329 dev_dbg(hcd->self.controller, "ClearPortFeature: SUSPEND\n");
1330 - if (valid_port(wIndex)) {
1331 + if (valid_port(wIndex) && ohci_at91->sfr_regmap) {
1332 ohci_at91_port_suspend(ohci_at91->sfr_regmap,
1333 0);
1334 return 0;
1335 diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c
1336 index 74c42f722678..3425154baf8b 100644
1337 --- a/drivers/usb/host/xhci-dbg.c
1338 +++ b/drivers/usb/host/xhci-dbg.c
1339 @@ -111,7 +111,7 @@ static void xhci_print_cap_regs(struct xhci_hcd *xhci)
1340 xhci_dbg(xhci, "RTSOFF 0x%x:\n", temp & RTSOFF_MASK);
1341
1342 /* xhci 1.1 controllers have the HCCPARAMS2 register */
1343 - if (hci_version > 100) {
1344 + if (hci_version > 0x100) {
1345 temp = readl(&xhci->cap_regs->hcc_params2);
1346 xhci_dbg(xhci, "HCC PARAMS2 0x%x:\n", (unsigned int) temp);
1347 xhci_dbg(xhci, " HC %s Force save context capability",
1348 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
1349 index abe360684f0b..5895e84f9dcc 100644
1350 --- a/drivers/usb/host/xhci-plat.c
1351 +++ b/drivers/usb/host/xhci-plat.c
1352 @@ -274,6 +274,8 @@ static int xhci_plat_remove(struct platform_device *dev)
1353 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
1354 struct clk *clk = xhci->clk;
1355
1356 + xhci->xhc_state |= XHCI_STATE_REMOVING;
1357 +
1358 usb_remove_hcd(xhci->shared_hcd);
1359 usb_phy_shutdown(hcd->usb_phy);
1360
1361 diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
1362 index 095778ff984d..37c63cb39714 100644
1363 --- a/drivers/usb/misc/iowarrior.c
1364 +++ b/drivers/usb/misc/iowarrior.c
1365 @@ -781,12 +781,6 @@ static int iowarrior_probe(struct usb_interface *interface,
1366 iface_desc = interface->cur_altsetting;
1367 dev->product_id = le16_to_cpu(udev->descriptor.idProduct);
1368
1369 - if (iface_desc->desc.bNumEndpoints < 1) {
1370 - dev_err(&interface->dev, "Invalid number of endpoints\n");
1371 - retval = -EINVAL;
1372 - goto error;
1373 - }
1374 -
1375 /* set up the endpoint information */
1376 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
1377 endpoint = &iface_desc->endpoint[i].desc;
1378 @@ -797,6 +791,21 @@ static int iowarrior_probe(struct usb_interface *interface,
1379 /* this one will match for the IOWarrior56 only */
1380 dev->int_out_endpoint = endpoint;
1381 }
1382 +
1383 + if (!dev->int_in_endpoint) {
1384 + dev_err(&interface->dev, "no interrupt-in endpoint found\n");
1385 + retval = -ENODEV;
1386 + goto error;
1387 + }
1388 +
1389 + if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW56) {
1390 + if (!dev->int_out_endpoint) {
1391 + dev_err(&interface->dev, "no interrupt-out endpoint found\n");
1392 + retval = -ENODEV;
1393 + goto error;
1394 + }
1395 + }
1396 +
1397 /* we have to check the report_size often, so remember it in the endianness suitable for our machine */
1398 dev->report_size = usb_endpoint_maxp(dev->int_in_endpoint);
1399 if ((dev->interface->cur_altsetting->desc.bInterfaceNumber == 0) &&
1400 diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
1401 index 6a1df9e824ca..30bf0f5db82d 100644
1402 --- a/drivers/usb/serial/digi_acceleport.c
1403 +++ b/drivers/usb/serial/digi_acceleport.c
1404 @@ -1482,16 +1482,20 @@ static int digi_read_oob_callback(struct urb *urb)
1405 struct usb_serial *serial = port->serial;
1406 struct tty_struct *tty;
1407 struct digi_port *priv = usb_get_serial_port_data(port);
1408 + unsigned char *buf = urb->transfer_buffer;
1409 int opcode, line, status, val;
1410 int i;
1411 unsigned int rts;
1412
1413 + if (urb->actual_length < 4)
1414 + return -1;
1415 +
1416 /* handle each oob command */
1417 - for (i = 0; i < urb->actual_length - 3;) {
1418 - opcode = ((unsigned char *)urb->transfer_buffer)[i++];
1419 - line = ((unsigned char *)urb->transfer_buffer)[i++];
1420 - status = ((unsigned char *)urb->transfer_buffer)[i++];
1421 - val = ((unsigned char *)urb->transfer_buffer)[i++];
1422 + for (i = 0; i < urb->actual_length - 3; i += 4) {
1423 + opcode = buf[i];
1424 + line = buf[i + 1];
1425 + status = buf[i + 2];
1426 + val = buf[i + 3];
1427
1428 dev_dbg(&port->dev, "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d\n",
1429 opcode, line, status, val);
1430 diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
1431 index c02808a30436..f1a8fdcd8674 100644
1432 --- a/drivers/usb/serial/io_ti.c
1433 +++ b/drivers/usb/serial/io_ti.c
1434 @@ -1674,6 +1674,12 @@ static void edge_interrupt_callback(struct urb *urb)
1435 function = TIUMP_GET_FUNC_FROM_CODE(data[0]);
1436 dev_dbg(dev, "%s - port_number %d, function %d, info 0x%x\n", __func__,
1437 port_number, function, data[1]);
1438 +
1439 + if (port_number >= edge_serial->serial->num_ports) {
1440 + dev_err(dev, "bad port number %d\n", port_number);
1441 + goto exit;
1442 + }
1443 +
1444 port = edge_serial->serial->port[port_number];
1445 edge_port = usb_get_serial_port_data(port);
1446 if (!edge_port) {
1447 @@ -1755,7 +1761,7 @@ static void edge_bulk_in_callback(struct urb *urb)
1448
1449 port_number = edge_port->port->port_number;
1450
1451 - if (edge_port->lsr_event) {
1452 + if (urb->actual_length > 0 && edge_port->lsr_event) {
1453 edge_port->lsr_event = 0;
1454 dev_dbg(dev, "%s ===== Port %u LSR Status = %02x, Data = %02x ======\n",
1455 __func__, port_number, edge_port->lsr_mask, *data);
1456 diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
1457 index a180b17d2432..76564b3bebb9 100644
1458 --- a/drivers/usb/serial/omninet.c
1459 +++ b/drivers/usb/serial/omninet.c
1460 @@ -142,12 +142,6 @@ static int omninet_port_remove(struct usb_serial_port *port)
1461
1462 static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
1463 {
1464 - struct usb_serial *serial = port->serial;
1465 - struct usb_serial_port *wport;
1466 -
1467 - wport = serial->port[1];
1468 - tty_port_tty_set(&wport->port, tty);
1469 -
1470 return usb_serial_generic_open(tty, port);
1471 }
1472
1473 diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
1474 index 93c6c9b08daa..8a069aa154ed 100644
1475 --- a/drivers/usb/serial/safe_serial.c
1476 +++ b/drivers/usb/serial/safe_serial.c
1477 @@ -200,6 +200,11 @@ static void safe_process_read_urb(struct urb *urb)
1478 if (!safe)
1479 goto out;
1480
1481 + if (length < 2) {
1482 + dev_err(&port->dev, "malformed packet\n");
1483 + return;
1484 + }
1485 +
1486 fcs = fcs_compute10(data, length, CRC10_INITFCS);
1487 if (fcs) {
1488 dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
1489 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1490 index 1d4f5faa04b5..dc9d64ac5969 100644
1491 --- a/fs/ext4/inode.c
1492 +++ b/fs/ext4/inode.c
1493 @@ -3824,6 +3824,10 @@ static int ext4_block_truncate_page(handle_t *handle,
1494 unsigned blocksize;
1495 struct inode *inode = mapping->host;
1496
1497 + /* If we are processing an encrypted inode during orphan list handling */
1498 + if (ext4_encrypted_inode(inode) && !fscrypt_has_encryption_key(inode))
1499 + return 0;
1500 +
1501 blocksize = inode->i_sb->s_blocksize;
1502 length = blocksize - (offset & (blocksize - 1));
1503
1504 diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h
1505 index eb209d4523f5..dc797739f164 100644
1506 --- a/include/linux/user_namespace.h
1507 +++ b/include/linux/user_namespace.h
1508 @@ -65,7 +65,7 @@ struct ucounts {
1509 struct hlist_node node;
1510 struct user_namespace *ns;
1511 kuid_t uid;
1512 - atomic_t count;
1513 + int count;
1514 atomic_t ucount[UCOUNT_COUNTS];
1515 };
1516
1517 diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
1518 index 14e49c798135..b35533b94277 100644
1519 --- a/include/trace/events/syscalls.h
1520 +++ b/include/trace/events/syscalls.h
1521 @@ -1,5 +1,6 @@
1522 #undef TRACE_SYSTEM
1523 #define TRACE_SYSTEM raw_syscalls
1524 +#undef TRACE_INCLUDE_FILE
1525 #define TRACE_INCLUDE_FILE syscalls
1526
1527 #if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
1528 diff --git a/kernel/ucount.c b/kernel/ucount.c
1529 index 4bbd38ec3788..f4ac18509ecf 100644
1530 --- a/kernel/ucount.c
1531 +++ b/kernel/ucount.c
1532 @@ -139,7 +139,7 @@ static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid)
1533
1534 new->ns = ns;
1535 new->uid = uid;
1536 - atomic_set(&new->count, 0);
1537 + new->count = 0;
1538
1539 spin_lock_irq(&ucounts_lock);
1540 ucounts = find_ucounts(ns, uid, hashent);
1541 @@ -150,8 +150,10 @@ static struct ucounts *get_ucounts(struct user_namespace *ns, kuid_t uid)
1542 ucounts = new;
1543 }
1544 }
1545 - if (!atomic_add_unless(&ucounts->count, 1, INT_MAX))
1546 + if (ucounts->count == INT_MAX)
1547 ucounts = NULL;
1548 + else
1549 + ucounts->count += 1;
1550 spin_unlock_irq(&ucounts_lock);
1551 return ucounts;
1552 }
1553 @@ -160,13 +162,15 @@ static void put_ucounts(struct ucounts *ucounts)
1554 {
1555 unsigned long flags;
1556
1557 - if (atomic_dec_and_test(&ucounts->count)) {
1558 - spin_lock_irqsave(&ucounts_lock, flags);
1559 + spin_lock_irqsave(&ucounts_lock, flags);
1560 + ucounts->count -= 1;
1561 + if (!ucounts->count)
1562 hlist_del_init(&ucounts->node);
1563 - spin_unlock_irqrestore(&ucounts_lock, flags);
1564 + else
1565 + ucounts = NULL;
1566 + spin_unlock_irqrestore(&ucounts_lock, flags);
1567
1568 - kfree(ucounts);
1569 - }
1570 + kfree(ucounts);
1571 }
1572
1573 static inline bool atomic_inc_below(atomic_t *v, int u)
1574 diff --git a/virt/kvm/arm/vgic/vgic-mmio.c b/virt/kvm/arm/vgic/vgic-mmio.c
1575 index ebe1b9fa3c4d..85814d1bad11 100644
1576 --- a/virt/kvm/arm/vgic/vgic-mmio.c
1577 +++ b/virt/kvm/arm/vgic/vgic-mmio.c
1578 @@ -187,21 +187,37 @@ unsigned long vgic_mmio_read_active(struct kvm_vcpu *vcpu,
1579 static void vgic_mmio_change_active(struct kvm_vcpu *vcpu, struct vgic_irq *irq,
1580 bool new_active_state)
1581 {
1582 + struct kvm_vcpu *requester_vcpu;
1583 spin_lock(&irq->irq_lock);
1584 +
1585 + /*
1586 + * The vcpu parameter here can mean multiple things depending on how
1587 + * this function is called; when handling a trap from the kernel it
1588 + * depends on the GIC version, and these functions are also called as
1589 + * part of save/restore from userspace.
1590 + *
1591 + * Therefore, we have to figure out the requester in a reliable way.
1592 + *
1593 + * When accessing VGIC state from user space, the requester_vcpu is
1594 + * NULL, which is fine, because we guarantee that no VCPUs are running
1595 + * when accessing VGIC state from user space so irq->vcpu->cpu is
1596 + * always -1.
1597 + */
1598 + requester_vcpu = kvm_arm_get_running_vcpu();
1599 +
1600 /*
1601 * If this virtual IRQ was written into a list register, we
1602 * have to make sure the CPU that runs the VCPU thread has
1603 - * synced back LR state to the struct vgic_irq. We can only
1604 - * know this for sure, when either this irq is not assigned to
1605 - * anyone's AP list anymore, or the VCPU thread is not
1606 - * running on any CPUs.
1607 + * synced back the LR state to the struct vgic_irq.
1608 *
1609 - * In the opposite case, we know the VCPU thread may be on its
1610 - * way back from the guest and still has to sync back this
1611 - * IRQ, so we release and re-acquire the spin_lock to let the
1612 - * other thread sync back the IRQ.
1613 + * As long as the conditions below are true, we know the VCPU thread
1614 + * may be on its way back from the guest (we kicked the VCPU thread in
1615 + * vgic_change_active_prepare) and still has to sync back this IRQ,
1616 + * so we release and re-acquire the spin_lock to let the other thread
1617 + * sync back the IRQ.
1618 */
1619 while (irq->vcpu && /* IRQ may have state in an LR somewhere */
1620 + irq->vcpu != requester_vcpu && /* Current thread is not the VCPU thread */
1621 irq->vcpu->cpu != -1) /* VCPU thread is running */
1622 cond_resched_lock(&irq->irq_lock);
1623