Magellan Linux

Contents of /trunk/kernel-alx-legacy/patches-4.9/0358-4.9.259-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3660 - (show annotations) (download)
Mon Oct 24 14:07:38 2022 UTC (19 months ago) by niro
File size: 104627 byte(s)
-linux-4.9.259
1 diff --git a/Makefile b/Makefile
2 index e5955f122ffd3..cdc71bda92c4b 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 258
9 +SUBLEVEL = 259
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
14 index a67ed746b0e37..5fa0beba46ee5 100644
15 --- a/arch/arm/boot/compressed/head.S
16 +++ b/arch/arm/boot/compressed/head.S
17 @@ -1080,9 +1080,9 @@ __armv4_mmu_cache_off:
18 __armv7_mmu_cache_off:
19 mrc p15, 0, r0, c1, c0
20 #ifdef CONFIG_MMU
21 - bic r0, r0, #0x000d
22 + bic r0, r0, #0x0005
23 #else
24 - bic r0, r0, #0x000c
25 + bic r0, r0, #0x0004
26 #endif
27 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
28 mov r12, lr
29 diff --git a/arch/arm/boot/dts/exynos5250-spring.dts b/arch/arm/boot/dts/exynos5250-spring.dts
30 index 4d7bdb735ed3b..e4433ecd9fe41 100644
31 --- a/arch/arm/boot/dts/exynos5250-spring.dts
32 +++ b/arch/arm/boot/dts/exynos5250-spring.dts
33 @@ -112,7 +112,7 @@
34 compatible = "samsung,s5m8767-pmic";
35 reg = <0x66>;
36 interrupt-parent = <&gpx3>;
37 - interrupts = <2 IRQ_TYPE_NONE>;
38 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
39 pinctrl-names = "default";
40 pinctrl-0 = <&s5m8767_irq &s5m8767_dvs &s5m8767_ds>;
41 wakeup-source;
42 diff --git a/arch/arm/boot/dts/exynos5420-arndale-octa.dts b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
43 index e664c33c3c640..4a71bbe1ce542 100644
44 --- a/arch/arm/boot/dts/exynos5420-arndale-octa.dts
45 +++ b/arch/arm/boot/dts/exynos5420-arndale-octa.dts
46 @@ -88,7 +88,7 @@
47 reg = <0x66>;
48
49 interrupt-parent = <&gpx3>;
50 - interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
51 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
52 pinctrl-names = "default";
53 pinctrl-0 = <&s2mps11_irq>;
54
55 diff --git a/arch/arm/boot/dts/omap443x.dtsi b/arch/arm/boot/dts/omap443x.dtsi
56 index fc6a8610c24c5..adcf9d141db6a 100644
57 --- a/arch/arm/boot/dts/omap443x.dtsi
58 +++ b/arch/arm/boot/dts/omap443x.dtsi
59 @@ -35,10 +35,12 @@
60 };
61
62 ocp {
63 + /* 4430 has only gpio_86 tshut and no talert interrupt */
64 bandgap: bandgap@4a002260 {
65 reg = <0x4a002260 0x4
66 0x4a00232C 0x4>;
67 compatible = "ti,omap4430-bandgap";
68 + gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>;
69
70 #thermal-sensor-cells = <0>;
71 };
72 diff --git a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
73 index 2f7d144d556da..e43e804c42c3e 100644
74 --- a/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
75 +++ b/arch/arm64/boot/dts/exynos/exynos7-espresso.dts
76 @@ -64,7 +64,7 @@
77 s2mps15_pmic@66 {
78 compatible = "samsung,s2mps15-pmic";
79 reg = <0x66>;
80 - interrupts = <2 IRQ_TYPE_NONE>;
81 + interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
82 interrupt-parent = <&gpa0>;
83 pinctrl-names = "default";
84 pinctrl-0 = <&pmic_irq>;
85 diff --git a/arch/arm64/boot/dts/nvidia/tegra210.dtsi b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
86 index 87ef72bffd86c..7501bfc2b0f1d 100644
87 --- a/arch/arm64/boot/dts/nvidia/tegra210.dtsi
88 +++ b/arch/arm64/boot/dts/nvidia/tegra210.dtsi
89 @@ -727,6 +727,7 @@
90 <&tegra_car 128>, /* hda2hdmi */
91 <&tegra_car 111>; /* hda2codec_2x */
92 reset-names = "hda", "hda2hdmi", "hda2codec_2x";
93 + power-domains = <&pd_sor>;
94 status = "disabled";
95 };
96
97 diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
98 index fb5001a6879c7..c2557cf43b3dc 100644
99 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
100 +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
101 @@ -62,7 +62,7 @@
102 no-map;
103 };
104
105 - reserved@8668000 {
106 + reserved@86680000 {
107 reg = <0x0 0x86680000 0x0 0x80000>;
108 no-map;
109 };
110 @@ -72,7 +72,7 @@
111 no-map;
112 };
113
114 - rfsa@867e00000 {
115 + rfsa@867e0000 {
116 reg = <0x0 0x867e0000 0x0 0x20000>;
117 no-map;
118 };
119 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
120 index aba534959377b..3875423836622 100644
121 --- a/arch/arm64/kernel/head.S
122 +++ b/arch/arm64/kernel/head.S
123 @@ -846,6 +846,7 @@ __primary_switch:
124
125 tlbi vmalle1 // Remove any stale TLB entries
126 dsb nsh
127 + isb
128
129 msr sctlr_el1, x19 // re-enable the MMU
130 isb
131 diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S
132 index 612b2b3012803..23c5509f3b51b 100644
133 --- a/arch/mips/kernel/vmlinux.lds.S
134 +++ b/arch/mips/kernel/vmlinux.lds.S
135 @@ -92,6 +92,7 @@ SECTIONS
136
137 INIT_TASK_DATA(THREAD_SIZE)
138 NOSAVE_DATA
139 + PAGE_ALIGNED_DATA(PAGE_SIZE)
140 CACHELINE_ALIGNED_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
141 READ_MOSTLY_DATA(1 << CONFIG_MIPS_L1_CACHE_SHIFT)
142 DATA_DATA
143 diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
144 index 7c6f75c2aa4df..e64f678ca12c8 100644
145 --- a/arch/mips/lantiq/irq.c
146 +++ b/arch/mips/lantiq/irq.c
147 @@ -245,7 +245,7 @@ static void ltq_hw_irqdispatch(int module)
148 do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module));
149
150 /* if this is a EBU irq, we need to ack it or get a deadlock */
151 - if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT)
152 + if (irq == LTQ_ICU_EBU_IRQ && !module && LTQ_EBU_PCC_ISTAT != 0)
153 ltq_ebu_w32(ltq_ebu_r32(LTQ_EBU_PCC_ISTAT) | 0x10,
154 LTQ_EBU_PCC_ISTAT);
155 }
156 diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
157 index cb877f86f5fc9..b9dea4ce290c1 100644
158 --- a/arch/mips/mm/c-r4k.c
159 +++ b/arch/mips/mm/c-r4k.c
160 @@ -1630,7 +1630,7 @@ static int probe_scache(void)
161 return 1;
162 }
163
164 -static void __init loongson2_sc_init(void)
165 +static void loongson2_sc_init(void)
166 {
167 struct cpuinfo_mips *c = &current_cpu_data;
168
169 diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
170 index f529d3d9d88d7..6a06411f9bf14 100644
171 --- a/arch/powerpc/Kconfig
172 +++ b/arch/powerpc/Kconfig
173 @@ -622,7 +622,7 @@ config PPC_64K_PAGES
174
175 config PPC_256K_PAGES
176 bool "256k page size"
177 - depends on 44x && !STDBINUTILS
178 + depends on 44x && !STDBINUTILS && !PPC_47x
179 help
180 Make the page size 256k.
181
182 diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
183 index 5abb8e2239a54..647dbd8514c4f 100644
184 --- a/arch/powerpc/platforms/pseries/dlpar.c
185 +++ b/arch/powerpc/platforms/pseries/dlpar.c
186 @@ -139,7 +139,6 @@ void dlpar_free_cc_nodes(struct device_node *dn)
187 #define NEXT_PROPERTY 3
188 #define PREV_PARENT 4
189 #define MORE_MEMORY 5
190 -#define CALL_AGAIN -2
191 #define ERR_CFG_USE -9003
192
193 struct device_node *dlpar_configure_connector(__be32 drc_index,
194 @@ -181,6 +180,9 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
195
196 spin_unlock(&rtas_data_buf_lock);
197
198 + if (rtas_busy_delay(rc))
199 + continue;
200 +
201 switch (rc) {
202 case COMPLETE:
203 break;
204 @@ -233,9 +235,6 @@ struct device_node *dlpar_configure_connector(__be32 drc_index,
205 parent_path = last_dn->parent->full_name;
206 break;
207
208 - case CALL_AGAIN:
209 - break;
210 -
211 case MORE_MEMORY:
212 case ERR_CFG_USE:
213 default:
214 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
215 index cef42d4be2922..f6d9c44b32dfc 100644
216 --- a/arch/sparc/Kconfig
217 +++ b/arch/sparc/Kconfig
218 @@ -562,7 +562,7 @@ config COMPAT
219 bool
220 depends on SPARC64
221 default y
222 - select COMPAT_BINFMT_ELF
223 + select COMPAT_BINFMT_ELF if BINFMT_ELF
224 select HAVE_UID16
225 select ARCH_WANT_OLD_COMPAT_IPC
226 select COMPAT_OLD_SIGACTION
227 diff --git a/arch/sparc/lib/memset.S b/arch/sparc/lib/memset.S
228 index bb539b42b088a..992db8a0f7c90 100644
229 --- a/arch/sparc/lib/memset.S
230 +++ b/arch/sparc/lib/memset.S
231 @@ -140,6 +140,7 @@ __bzero:
232 ZERO_LAST_BLOCKS(%o0, 0x48, %g2)
233 ZERO_LAST_BLOCKS(%o0, 0x08, %g2)
234 13:
235 + EXT(12b, 13b, 21f)
236 be 8f
237 andcc %o1, 4, %g0
238
239 diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
240 index b427dc73ba274..597ce32fa33f2 100644
241 --- a/arch/x86/kernel/reboot.c
242 +++ b/arch/x86/kernel/reboot.c
243 @@ -539,29 +539,20 @@ static void emergency_vmx_disable_all(void)
244 local_irq_disable();
245
246 /*
247 - * We need to disable VMX on all CPUs before rebooting, otherwise
248 - * we risk hanging up the machine, because the CPU ignore INIT
249 - * signals when VMX is enabled.
250 + * Disable VMX on all CPUs before rebooting, otherwise we risk hanging
251 + * the machine, because the CPU blocks INIT when it's in VMX root.
252 *
253 - * We can't take any locks and we may be on an inconsistent
254 - * state, so we use NMIs as IPIs to tell the other CPUs to disable
255 - * VMX and halt.
256 + * We can't take any locks and we may be on an inconsistent state, so
257 + * use NMIs as IPIs to tell the other CPUs to exit VMX root and halt.
258 *
259 - * For safety, we will avoid running the nmi_shootdown_cpus()
260 - * stuff unnecessarily, but we don't have a way to check
261 - * if other CPUs have VMX enabled. So we will call it only if the
262 - * CPU we are running on has VMX enabled.
263 - *
264 - * We will miss cases where VMX is not enabled on all CPUs. This
265 - * shouldn't do much harm because KVM always enable VMX on all
266 - * CPUs anyway. But we can miss it on the small window where KVM
267 - * is still enabling VMX.
268 + * Do the NMI shootdown even if VMX if off on _this_ CPU, as that
269 + * doesn't prevent a different CPU from being in VMX root operation.
270 */
271 - if (cpu_has_vmx() && cpu_vmx_enabled()) {
272 - /* Disable VMX on this CPU. */
273 - cpu_vmxoff();
274 + if (cpu_has_vmx()) {
275 + /* Safely force _this_ CPU out of VMX root operation. */
276 + __cpu_emergency_vmxoff();
277
278 - /* Halt and disable VMX on the other CPUs */
279 + /* Halt and exit VMX root operation on the other CPUs. */
280 nmi_shootdown_cpus(vmxoff_nmi);
281
282 }
283 diff --git a/block/blk-settings.c b/block/blk-settings.c
284 index 0d644f37e3c64..ebff811d5d1dc 100644
285 --- a/block/blk-settings.c
286 +++ b/block/blk-settings.c
287 @@ -494,6 +494,14 @@ void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
288 }
289 EXPORT_SYMBOL(blk_queue_stack_limits);
290
291 +static unsigned int blk_round_down_sectors(unsigned int sectors, unsigned int lbs)
292 +{
293 + sectors = round_down(sectors, lbs >> SECTOR_SHIFT);
294 + if (sectors < PAGE_SIZE >> SECTOR_SHIFT)
295 + sectors = PAGE_SIZE >> SECTOR_SHIFT;
296 + return sectors;
297 +}
298 +
299 /**
300 * blk_stack_limits - adjust queue_limits for stacked devices
301 * @t: the stacking driver limits (top device)
302 @@ -606,6 +614,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
303 ret = -1;
304 }
305
306 + t->max_sectors = blk_round_down_sectors(t->max_sectors, t->logical_block_size);
307 + t->max_hw_sectors = blk_round_down_sectors(t->max_hw_sectors, t->logical_block_size);
308 + t->max_dev_sectors = blk_round_down_sectors(t->max_dev_sectors, t->logical_block_size);
309 +
310 /* Discard alignment and granularity */
311 if (b->discard_granularity) {
312 alignment = queue_limit_discard_alignment(b, start);
313 diff --git a/crypto/ecdh_helper.c b/crypto/ecdh_helper.c
314 index 3cd8a2414e60e..de43ffb538405 100644
315 --- a/crypto/ecdh_helper.c
316 +++ b/crypto/ecdh_helper.c
317 @@ -71,6 +71,9 @@ int crypto_ecdh_decode_key(const char *buf, unsigned int len,
318 if (secret.type != CRYPTO_KPP_SECRET_TYPE_ECDH)
319 return -EINVAL;
320
321 + if (unlikely(len < secret.len))
322 + return -EINVAL;
323 +
324 ptr = ecdh_unpack_data(&params->curve_id, ptr, sizeof(params->curve_id));
325 ptr = ecdh_unpack_data(&params->key_size, ptr, sizeof(params->key_size));
326 if (secret.len != crypto_ecdh_key_len(params))
327 diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
328 index 146a77fb762d5..11bd2d3da886a 100644
329 --- a/drivers/acpi/acpi_configfs.c
330 +++ b/drivers/acpi/acpi_configfs.c
331 @@ -251,7 +251,12 @@ static int __init acpi_configfs_init(void)
332
333 acpi_table_group = configfs_register_default_group(root, "table",
334 &acpi_tables_type);
335 - return PTR_ERR_OR_ZERO(acpi_table_group);
336 + if (IS_ERR(acpi_table_group)) {
337 + configfs_unregister_subsystem(&acpi_configfs);
338 + return PTR_ERR(acpi_table_group);
339 + }
340 +
341 + return 0;
342 }
343 module_init(acpi_configfs_init);
344
345 diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
346 index 93888ccb4e267..5bc8d588d1460 100644
347 --- a/drivers/amba/bus.c
348 +++ b/drivers/amba/bus.c
349 @@ -280,10 +280,11 @@ static int amba_remove(struct device *dev)
350 {
351 struct amba_device *pcdev = to_amba_device(dev);
352 struct amba_driver *drv = to_amba_driver(dev->driver);
353 - int ret;
354 + int ret = 0;
355
356 pm_runtime_get_sync(dev);
357 - ret = drv->remove(pcdev);
358 + if (drv->remove)
359 + ret = drv->remove(pcdev);
360 pm_runtime_put_noidle(dev);
361
362 /* Undo the runtime PM settings in amba_probe() */
363 @@ -300,7 +301,9 @@ static int amba_remove(struct device *dev)
364 static void amba_shutdown(struct device *dev)
365 {
366 struct amba_driver *drv = to_amba_driver(dev->driver);
367 - drv->shutdown(to_amba_device(dev));
368 +
369 + if (drv->shutdown)
370 + drv->shutdown(to_amba_device(dev));
371 }
372
373 /**
374 @@ -313,12 +316,13 @@ static void amba_shutdown(struct device *dev)
375 */
376 int amba_driver_register(struct amba_driver *drv)
377 {
378 - drv->drv.bus = &amba_bustype;
379 + if (!drv->probe)
380 + return -EINVAL;
381
382 -#define SETFN(fn) if (drv->fn) drv->drv.fn = amba_##fn
383 - SETFN(probe);
384 - SETFN(remove);
385 - SETFN(shutdown);
386 + drv->drv.bus = &amba_bustype;
387 + drv->drv.probe = amba_probe;
388 + drv->drv.remove = amba_remove;
389 + drv->drv.shutdown = amba_shutdown;
390
391 return driver_register(&drv->drv);
392 }
393 diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c
394 index f50a76ad63e4a..8354f2de37c31 100644
395 --- a/drivers/ata/ahci_brcm.c
396 +++ b/drivers/ata/ahci_brcm.c
397 @@ -285,6 +285,10 @@ static int brcm_ahci_resume(struct device *dev)
398 if (ret)
399 return ret;
400
401 + ret = ahci_platform_enable_regulators(hpriv);
402 + if (ret)
403 + goto out_disable_clks;
404 +
405 brcm_sata_init(priv);
406 brcm_sata_phys_enable(priv);
407 brcm_sata_alpm_init(hpriv);
408 @@ -314,6 +318,8 @@ out_disable_platform_phys:
409 ahci_platform_disable_phys(hpriv);
410 out_disable_phys:
411 brcm_sata_phys_disable(priv);
412 + ahci_platform_disable_regulators(hpriv);
413 +out_disable_clks:
414 ahci_platform_disable_clks(hpriv);
415 return ret;
416 }
417 @@ -377,6 +383,10 @@ static int brcm_ahci_probe(struct platform_device *pdev)
418 if (ret)
419 goto out_reset;
420
421 + ret = ahci_platform_enable_regulators(hpriv);
422 + if (ret)
423 + goto out_disable_clks;
424 +
425 /* Must be first so as to configure endianness including that
426 * of the standard AHCI register space.
427 */
428 @@ -386,7 +396,7 @@ static int brcm_ahci_probe(struct platform_device *pdev)
429 priv->port_mask = brcm_ahci_get_portmask(hpriv, priv);
430 if (!priv->port_mask) {
431 ret = -ENODEV;
432 - goto out_disable_clks;
433 + goto out_disable_regulators;
434 }
435
436 /* Must be done before ahci_platform_enable_phys() */
437 @@ -417,6 +427,8 @@ out_disable_platform_phys:
438 ahci_platform_disable_phys(hpriv);
439 out_disable_phys:
440 brcm_sata_phys_disable(priv);
441 +out_disable_regulators:
442 + ahci_platform_disable_regulators(hpriv);
443 out_disable_clks:
444 ahci_platform_disable_clks(hpriv);
445 out_reset:
446 diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
447 index 4496e7a492352..64a3dae5381ef 100644
448 --- a/drivers/block/floppy.c
449 +++ b/drivers/block/floppy.c
450 @@ -4067,21 +4067,22 @@ static int floppy_open(struct block_device *bdev, fmode_t mode)
451 if (UFDCS->rawcmd == 1)
452 UFDCS->rawcmd = 2;
453
454 - if (!(mode & FMODE_NDELAY)) {
455 - if (mode & (FMODE_READ|FMODE_WRITE)) {
456 - UDRS->last_checked = 0;
457 - clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
458 - check_disk_change(bdev);
459 - if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
460 - goto out;
461 - if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
462 - goto out;
463 - }
464 - res = -EROFS;
465 - if ((mode & FMODE_WRITE) &&
466 - !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
467 + if (mode & (FMODE_READ|FMODE_WRITE)) {
468 + UDRS->last_checked = 0;
469 + clear_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags);
470 + check_disk_change(bdev);
471 + if (test_bit(FD_DISK_CHANGED_BIT, &UDRS->flags))
472 + goto out;
473 + if (test_bit(FD_OPEN_SHOULD_FAIL_BIT, &UDRS->flags))
474 goto out;
475 }
476 +
477 + res = -EROFS;
478 +
479 + if ((mode & FMODE_WRITE) &&
480 + !test_bit(FD_DISK_WRITABLE_BIT, &UDRS->flags))
481 + goto out;
482 +
483 mutex_unlock(&open_lock);
484 mutex_unlock(&floppy_mutex);
485 return 0;
486 diff --git a/drivers/char/random.c b/drivers/char/random.c
487 index 4cbc73173701d..2184d87623272 100644
488 --- a/drivers/char/random.c
489 +++ b/drivers/char/random.c
490 @@ -1913,7 +1913,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
491 return -EPERM;
492 if (crng_init < 2)
493 return -ENODATA;
494 - crng_reseed(&primary_crng, NULL);
495 + crng_reseed(&primary_crng, &input_pool);
496 crng_global_init_time = jiffies - 1;
497 return 0;
498 default:
499 diff --git a/drivers/clk/meson/clk-pll.c b/drivers/clk/meson/clk-pll.c
500 index 4adc1e89212c9..f9157e7f45f2d 100644
501 --- a/drivers/clk/meson/clk-pll.c
502 +++ b/drivers/clk/meson/clk-pll.c
503 @@ -145,7 +145,7 @@ static int meson_clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
504 if (parent_rate == 0 || rate == 0)
505 return -EINVAL;
506
507 - old_rate = rate;
508 + old_rate = clk_hw_get_rate(hw);
509
510 rate_set = meson_clk_get_pll_settings(pll, rate);
511 if (!rate_set)
512 diff --git a/drivers/clocksource/mxs_timer.c b/drivers/clocksource/mxs_timer.c
513 index 0ba0a913b41d1..b26c3b84c5b6c 100644
514 --- a/drivers/clocksource/mxs_timer.c
515 +++ b/drivers/clocksource/mxs_timer.c
516 @@ -152,10 +152,7 @@ static void mxs_irq_clear(char *state)
517
518 /* Clear pending interrupt */
519 timrot_irq_acknowledge();
520 -
521 -#ifdef DEBUG
522 - pr_info("%s: changing mode to %s\n", __func__, state)
523 -#endif /* DEBUG */
524 + pr_debug("%s: changing mode to %s\n", __func__, state);
525 }
526
527 static int mxs_shutdown(struct clock_event_device *evt)
528 diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
529 index 51c75bf2b9b68..c9a1d59dcb490 100644
530 --- a/drivers/dma/fsldma.c
531 +++ b/drivers/dma/fsldma.c
532 @@ -1331,6 +1331,7 @@ static int fsldma_of_probe(struct platform_device *op)
533 {
534 struct fsldma_device *fdev;
535 struct device_node *child;
536 + unsigned int i;
537 int err;
538
539 fdev = kzalloc(sizeof(*fdev), GFP_KERNEL);
540 @@ -1411,6 +1412,10 @@ static int fsldma_of_probe(struct platform_device *op)
541 return 0;
542
543 out_free_fdev:
544 + for (i = 0; i < FSL_DMA_MAX_CHANS_PER_DEVICE; i++) {
545 + if (fdev->chan[i])
546 + fsl_dma_chan_remove(fdev->chan[i]);
547 + }
548 irq_dispose_mapping(fdev->irq);
549 iounmap(fdev->regs);
550 out_free:
551 @@ -1433,6 +1438,7 @@ static int fsldma_of_remove(struct platform_device *op)
552 if (fdev->chan[i])
553 fsl_dma_chan_remove(fdev->chan[i]);
554 }
555 + irq_dispose_mapping(fdev->irq);
556
557 iounmap(fdev->regs);
558 kfree(fdev);
559 diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
560 index d168410e2338e..2e6081e5ad0b1 100644
561 --- a/drivers/gpio/gpio-pcf857x.c
562 +++ b/drivers/gpio/gpio-pcf857x.c
563 @@ -370,7 +370,7 @@ static int pcf857x_probe(struct i2c_client *client,
564 * reset state. Otherwise it flags pins to be driven low.
565 */
566 gpio->out = ~n_latch;
567 - gpio->status = gpio->out;
568 + gpio->status = gpio->read(gpio->client);
569
570 status = devm_gpiochip_add_data(&client->dev, &gpio->chip, gpio);
571 if (status < 0)
572 diff --git a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
573 index e281070611480..fc9a34ed58bd1 100644
574 --- a/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
575 +++ b/drivers/gpu/drm/gma500/oaktrail_hdmi_i2c.c
576 @@ -279,11 +279,8 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev)
577 hdmi_dev = pci_get_drvdata(dev);
578
579 i2c_dev = kzalloc(sizeof(struct hdmi_i2c_dev), GFP_KERNEL);
580 - if (i2c_dev == NULL) {
581 - DRM_ERROR("Can't allocate interface\n");
582 - ret = -ENOMEM;
583 - goto exit;
584 - }
585 + if (!i2c_dev)
586 + return -ENOMEM;
587
588 i2c_dev->adap = &oaktrail_hdmi_i2c_adapter;
589 i2c_dev->status = I2C_STAT_INIT;
590 @@ -300,16 +297,23 @@ int oaktrail_hdmi_i2c_init(struct pci_dev *dev)
591 oaktrail_hdmi_i2c_adapter.name, hdmi_dev);
592 if (ret) {
593 DRM_ERROR("Failed to request IRQ for I2C controller\n");
594 - goto err;
595 + goto free_dev;
596 }
597
598 /* Adapter registration */
599 ret = i2c_add_numbered_adapter(&oaktrail_hdmi_i2c_adapter);
600 - return ret;
601 + if (ret) {
602 + DRM_ERROR("Failed to add I2C adapter\n");
603 + goto free_irq;
604 + }
605
606 -err:
607 + return 0;
608 +
609 +free_irq:
610 + free_irq(dev->irq, hdmi_dev);
611 +free_dev:
612 kfree(i2c_dev);
613 -exit:
614 +
615 return ret;
616 }
617
618 diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
619 index 8f3ca526bd1bd..29cb552829fe1 100644
620 --- a/drivers/gpu/drm/gma500/psb_drv.c
621 +++ b/drivers/gpu/drm/gma500/psb_drv.c
622 @@ -323,6 +323,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
623 if (ret)
624 goto out_err;
625
626 + ret = -ENOMEM;
627 +
628 dev_priv->mmu = psb_mmu_driver_init(dev, 1, 0, 0);
629 if (!dev_priv->mmu)
630 goto out_err;
631 diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
632 index c757e2070cac7..636e9df3d1181 100644
633 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
634 +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c
635 @@ -146,7 +146,7 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs = {
636 .enable = dsi_20nm_phy_enable,
637 .disable = dsi_20nm_phy_disable,
638 },
639 - .io_start = { 0xfd998300, 0xfd9a0300 },
640 + .io_start = { 0xfd998500, 0xfd9a0500 },
641 .num_dsi_phy = 2,
642 };
643
644 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
645 index d99c9ed5dfe39..40b36e59a8676 100644
646 --- a/drivers/hid/hid-core.c
647 +++ b/drivers/hid/hid-core.c
648 @@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hid_register_report);
649 * Register a new field for this report.
650 */
651
652 -static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
653 +static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages)
654 {
655 struct hid_field *field;
656
657 @@ -102,7 +102,7 @@ static struct hid_field *hid_register_field(struct hid_report *report, unsigned
658
659 field = kzalloc((sizeof(struct hid_field) +
660 usages * sizeof(struct hid_usage) +
661 - values * sizeof(unsigned)), GFP_KERNEL);
662 + usages * sizeof(unsigned)), GFP_KERNEL);
663 if (!field)
664 return NULL;
665
666 @@ -281,7 +281,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
667 usages = max_t(unsigned, parser->local.usage_index,
668 parser->global.report_count);
669
670 - field = hid_register_field(report, usages, parser->global.report_count);
671 + field = hid_register_field(report, usages);
672 if (!field)
673 return 0;
674
675 @@ -1109,6 +1109,9 @@ EXPORT_SYMBOL_GPL(hid_open_report);
676
677 static s32 snto32(__u32 value, unsigned n)
678 {
679 + if (!value || !n)
680 + return 0;
681 +
682 switch (n) {
683 case 8: return ((__s8)value);
684 case 16: return ((__s16)value);
685 diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c
686 index 78792b4d6437c..a658f975605a7 100644
687 --- a/drivers/i2c/busses/i2c-brcmstb.c
688 +++ b/drivers/i2c/busses/i2c-brcmstb.c
689 @@ -318,7 +318,7 @@ static int brcmstb_send_i2c_cmd(struct brcmstb_i2c_dev *dev,
690 goto cmd_out;
691 }
692
693 - if ((CMD_RD || CMD_WR) &&
694 + if ((cmd == CMD_RD || cmd == CMD_WR) &&
695 bsc_readl(dev, iic_enable) & BSC_IIC_EN_NOACK_MASK) {
696 rc = -EREMOTEIO;
697 dev_dbg(dev->device, "controller received NOACK intr for %s\n",
698 diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
699 index cf93a96b63249..bc6458d760330 100644
700 --- a/drivers/infiniband/core/user_mad.c
701 +++ b/drivers/infiniband/core/user_mad.c
702 @@ -343,6 +343,11 @@ static ssize_t ib_umad_read(struct file *filp, char __user *buf,
703
704 mutex_lock(&file->mutex);
705
706 + if (file->agents_dead) {
707 + mutex_unlock(&file->mutex);
708 + return -EIO;
709 + }
710 +
711 while (list_empty(&file->recv_list)) {
712 mutex_unlock(&file->mutex);
713
714 @@ -485,7 +490,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
715
716 agent = __get_agent(file, packet->mad.hdr.id);
717 if (!agent) {
718 - ret = -EINVAL;
719 + ret = -EIO;
720 goto err_up;
721 }
722
723 diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c
724 index db6bb026ae902..ece4fe838e755 100644
725 --- a/drivers/infiniband/sw/rxe/rxe_recv.c
726 +++ b/drivers/infiniband/sw/rxe/rxe_recv.c
727 @@ -36,21 +36,26 @@
728 #include "rxe.h"
729 #include "rxe_loc.h"
730
731 +/* check that QP matches packet opcode type and is in a valid state */
732 static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
733 struct rxe_qp *qp)
734 {
735 + unsigned int pkt_type;
736 +
737 if (unlikely(!qp->valid))
738 goto err1;
739
740 + pkt_type = pkt->opcode & 0xe0;
741 +
742 switch (qp_type(qp)) {
743 case IB_QPT_RC:
744 - if (unlikely((pkt->opcode & IB_OPCODE_RC) != 0)) {
745 + if (unlikely(pkt_type != IB_OPCODE_RC)) {
746 pr_warn_ratelimited("bad qp type\n");
747 goto err1;
748 }
749 break;
750 case IB_QPT_UC:
751 - if (unlikely(!(pkt->opcode & IB_OPCODE_UC))) {
752 + if (unlikely(pkt_type != IB_OPCODE_UC)) {
753 pr_warn_ratelimited("bad qp type\n");
754 goto err1;
755 }
756 @@ -58,7 +63,7 @@ static int check_type_state(struct rxe_dev *rxe, struct rxe_pkt_info *pkt,
757 case IB_QPT_UD:
758 case IB_QPT_SMI:
759 case IB_QPT_GSI:
760 - if (unlikely(!(pkt->opcode & IB_OPCODE_UD))) {
761 + if (unlikely(pkt_type != IB_OPCODE_UD)) {
762 pr_warn_ratelimited("bad qp type\n");
763 goto err1;
764 }
765 diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
766 index f3135ae22df42..1ebce211d875a 100644
767 --- a/drivers/input/joydev.c
768 +++ b/drivers/input/joydev.c
769 @@ -448,7 +448,7 @@ static int joydev_handle_JSIOCSAXMAP(struct joydev *joydev,
770 if (IS_ERR(abspam))
771 return PTR_ERR(abspam);
772
773 - for (i = 0; i < joydev->nabs; i++) {
774 + for (i = 0; i < len && i < joydev->nabs; i++) {
775 if (abspam[i] > ABS_MAX) {
776 retval = -EINVAL;
777 goto out;
778 @@ -472,6 +472,9 @@ static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev,
779 int i;
780 int retval = 0;
781
782 + if (len % sizeof(*keypam))
783 + return -EINVAL;
784 +
785 len = min(len, sizeof(joydev->keypam));
786
787 /* Validate the map. */
788 @@ -479,7 +482,7 @@ static int joydev_handle_JSIOCSBTNMAP(struct joydev *joydev,
789 if (IS_ERR(keypam))
790 return PTR_ERR(keypam);
791
792 - for (i = 0; i < joydev->nkey; i++) {
793 + for (i = 0; i < (len / 2) && i < joydev->nkey; i++) {
794 if (keypam[i] > KEY_MAX || keypam[i] < BTN_MISC) {
795 retval = -EINVAL;
796 goto out;
797 diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
798 index 815b69d35722c..4168ed0ef187e 100644
799 --- a/drivers/input/joystick/xpad.c
800 +++ b/drivers/input/joystick/xpad.c
801 @@ -322,6 +322,7 @@ static const struct xpad_device {
802 { 0x1bad, 0xfd00, "Razer Onza TE", 0, XTYPE_XBOX360 },
803 { 0x1bad, 0xfd01, "Razer Onza", 0, XTYPE_XBOX360 },
804 { 0x20d6, 0x2001, "BDA Xbox Series X Wired Controller", 0, XTYPE_XBOXONE },
805 + { 0x20d6, 0x2009, "PowerA Enhanced Wired Controller for Xbox Series X|S", 0, XTYPE_XBOXONE },
806 { 0x20d6, 0x281f, "PowerA Wired Controller For Xbox 360", 0, XTYPE_XBOX360 },
807 { 0x2e24, 0x0652, "Hyperkin Duke X-Box One pad", 0, XTYPE_XBOXONE },
808 { 0x24c6, 0x5000, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
809 diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
810 index 2317f8d3fef6f..ff0f3c3e2f804 100644
811 --- a/drivers/input/serio/i8042-x86ia64io.h
812 +++ b/drivers/input/serio/i8042-x86ia64io.h
813 @@ -579,6 +579,10 @@ static const struct dmi_system_id i8042_dmi_forcemux_table[] __initconst = {
814 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
815 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-CS"),
816 },
817 + .matches = {
818 + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
819 + DMI_MATCH(DMI_CHASSIS_TYPE, "31"), /* Convertible Notebook */
820 + },
821 },
822 { }
823 };
824 diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
825 index 8051a4b704ea3..e2e31cbd6b2c3 100644
826 --- a/drivers/input/touchscreen/elo.c
827 +++ b/drivers/input/touchscreen/elo.c
828 @@ -345,8 +345,10 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
829 switch (elo->id) {
830
831 case 0: /* 10-byte protocol */
832 - if (elo_setup_10(elo))
833 + if (elo_setup_10(elo)) {
834 + err = -EIO;
835 goto fail3;
836 + }
837
838 break;
839
840 diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
841 index 1f5b6b5b1018a..4b9b11ebf29d9 100644
842 --- a/drivers/input/touchscreen/raydium_i2c_ts.c
843 +++ b/drivers/input/touchscreen/raydium_i2c_ts.c
844 @@ -419,6 +419,7 @@ static int raydium_i2c_write_object(struct i2c_client *client,
845 enum raydium_bl_ack state)
846 {
847 int error;
848 + static const u8 cmd[] = { 0xFF, 0x39 };
849
850 error = raydium_i2c_send(client, RM_CMD_BOOT_WRT, data, len);
851 if (error) {
852 @@ -427,7 +428,7 @@ static int raydium_i2c_write_object(struct i2c_client *client,
853 return error;
854 }
855
856 - error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, NULL, 0);
857 + error = raydium_i2c_send(client, RM_CMD_BOOT_ACK, cmd, sizeof(cmd));
858 if (error) {
859 dev_err(&client->dev, "Ack obj command failed: %d\n", error);
860 return error;
861 diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c
862 index 80e3df1f1f7de..c7151febbb094 100644
863 --- a/drivers/md/dm-era-target.c
864 +++ b/drivers/md/dm-era-target.c
865 @@ -46,6 +46,7 @@ struct writeset {
866 static void writeset_free(struct writeset *ws)
867 {
868 vfree(ws->bits);
869 + ws->bits = NULL;
870 }
871
872 static int setup_on_disk_bitset(struct dm_disk_bitset *info,
873 @@ -70,8 +71,6 @@ static size_t bitset_size(unsigned nr_bits)
874 */
875 static int writeset_alloc(struct writeset *ws, dm_block_t nr_blocks)
876 {
877 - ws->md.nr_bits = nr_blocks;
878 - ws->md.root = INVALID_WRITESET_ROOT;
879 ws->bits = vzalloc(bitset_size(nr_blocks));
880 if (!ws->bits) {
881 DMERR("%s: couldn't allocate in memory bitset", __func__);
882 @@ -84,12 +83,14 @@ static int writeset_alloc(struct writeset *ws, dm_block_t nr_blocks)
883 /*
884 * Wipes the in-core bitset, and creates a new on disk bitset.
885 */
886 -static int writeset_init(struct dm_disk_bitset *info, struct writeset *ws)
887 +static int writeset_init(struct dm_disk_bitset *info, struct writeset *ws,
888 + dm_block_t nr_blocks)
889 {
890 int r;
891
892 - memset(ws->bits, 0, bitset_size(ws->md.nr_bits));
893 + memset(ws->bits, 0, bitset_size(nr_blocks));
894
895 + ws->md.nr_bits = nr_blocks;
896 r = setup_on_disk_bitset(info, ws->md.nr_bits, &ws->md.root);
897 if (r) {
898 DMERR("%s: setup_on_disk_bitset failed", __func__);
899 @@ -133,7 +134,7 @@ static int writeset_test_and_set(struct dm_disk_bitset *info,
900 {
901 int r;
902
903 - if (!test_and_set_bit(block, ws->bits)) {
904 + if (!test_bit(block, ws->bits)) {
905 r = dm_bitset_set_bit(info, ws->md.root, block, &ws->md.root);
906 if (r) {
907 /* FIXME: fail mode */
908 @@ -388,7 +389,7 @@ static void ws_dec(void *context, const void *value)
909
910 static int ws_eq(void *context, const void *value1, const void *value2)
911 {
912 - return !memcmp(value1, value2, sizeof(struct writeset_metadata));
913 + return !memcmp(value1, value2, sizeof(struct writeset_disk));
914 }
915
916 /*----------------------------------------------------------------*/
917 @@ -564,6 +565,15 @@ static int open_metadata(struct era_metadata *md)
918 }
919
920 disk = dm_block_data(sblock);
921 +
922 + /* Verify the data block size hasn't changed */
923 + if (le32_to_cpu(disk->data_block_size) != md->block_size) {
924 + DMERR("changing the data block size (from %u to %llu) is not supported",
925 + le32_to_cpu(disk->data_block_size), md->block_size);
926 + r = -EINVAL;
927 + goto bad;
928 + }
929 +
930 r = dm_tm_open_with_sm(md->bm, SUPERBLOCK_LOCATION,
931 disk->metadata_space_map_root,
932 sizeof(disk->metadata_space_map_root),
933 @@ -575,10 +585,10 @@ static int open_metadata(struct era_metadata *md)
934
935 setup_infos(md);
936
937 - md->block_size = le32_to_cpu(disk->data_block_size);
938 md->nr_blocks = le32_to_cpu(disk->nr_blocks);
939 md->current_era = le32_to_cpu(disk->current_era);
940
941 + ws_unpack(&disk->current_writeset, &md->current_writeset->md);
942 md->writeset_tree_root = le64_to_cpu(disk->writeset_tree_root);
943 md->era_array_root = le64_to_cpu(disk->era_array_root);
944 md->metadata_snap = le64_to_cpu(disk->metadata_snap);
945 @@ -747,6 +757,12 @@ static int metadata_digest_lookup_writeset(struct era_metadata *md,
946 ws_unpack(&disk, &d->writeset);
947 d->value = cpu_to_le32(key);
948
949 + /*
950 + * We initialise another bitset info to avoid any caching side effects
951 + * with the previous one.
952 + */
953 + dm_disk_bitset_init(md->tm, &d->info);
954 +
955 d->nr_bits = min(d->writeset.nr_bits, md->nr_blocks);
956 d->current_bit = 0;
957 d->step = metadata_digest_transcribe_writeset;
958 @@ -760,12 +776,6 @@ static int metadata_digest_start(struct era_metadata *md, struct digest *d)
959 return 0;
960
961 memset(d, 0, sizeof(*d));
962 -
963 - /*
964 - * We initialise another bitset info to avoid any caching side
965 - * effects with the previous one.
966 - */
967 - dm_disk_bitset_init(md->tm, &d->info);
968 d->step = metadata_digest_lookup_writeset;
969
970 return 0;
971 @@ -803,6 +813,8 @@ static struct era_metadata *metadata_open(struct block_device *bdev,
972
973 static void metadata_close(struct era_metadata *md)
974 {
975 + writeset_free(&md->writesets[0]);
976 + writeset_free(&md->writesets[1]);
977 destroy_persistent_data_objects(md);
978 kfree(md);
979 }
980 @@ -840,6 +852,7 @@ static int metadata_resize(struct era_metadata *md, void *arg)
981 r = writeset_alloc(&md->writesets[1], *new_size);
982 if (r) {
983 DMERR("%s: writeset_alloc failed for writeset 1", __func__);
984 + writeset_free(&md->writesets[0]);
985 return r;
986 }
987
988 @@ -850,6 +863,8 @@ static int metadata_resize(struct era_metadata *md, void *arg)
989 &value, &md->era_array_root);
990 if (r) {
991 DMERR("%s: dm_array_resize failed", __func__);
992 + writeset_free(&md->writesets[0]);
993 + writeset_free(&md->writesets[1]);
994 return r;
995 }
996
997 @@ -871,7 +886,6 @@ static int metadata_era_archive(struct era_metadata *md)
998 }
999
1000 ws_pack(&md->current_writeset->md, &value);
1001 - md->current_writeset->md.root = INVALID_WRITESET_ROOT;
1002
1003 keys[0] = md->current_era;
1004 __dm_bless_for_disk(&value);
1005 @@ -883,6 +897,7 @@ static int metadata_era_archive(struct era_metadata *md)
1006 return r;
1007 }
1008
1009 + md->current_writeset->md.root = INVALID_WRITESET_ROOT;
1010 md->archived_writesets = true;
1011
1012 return 0;
1013 @@ -899,7 +914,7 @@ static int metadata_new_era(struct era_metadata *md)
1014 int r;
1015 struct writeset *new_writeset = next_writeset(md);
1016
1017 - r = writeset_init(&md->bitset_info, new_writeset);
1018 + r = writeset_init(&md->bitset_info, new_writeset, md->nr_blocks);
1019 if (r) {
1020 DMERR("%s: writeset_init failed", __func__);
1021 return r;
1022 @@ -952,7 +967,7 @@ static int metadata_commit(struct era_metadata *md)
1023 int r;
1024 struct dm_block *sblock;
1025
1026 - if (md->current_writeset->md.root != SUPERBLOCK_LOCATION) {
1027 + if (md->current_writeset->md.root != INVALID_WRITESET_ROOT) {
1028 r = dm_bitset_flush(&md->bitset_info, md->current_writeset->md.root,
1029 &md->current_writeset->md.root);
1030 if (r) {
1031 @@ -1227,8 +1242,10 @@ static void process_deferred_bios(struct era *era)
1032 int r;
1033 struct bio_list deferred_bios, marked_bios;
1034 struct bio *bio;
1035 + struct blk_plug plug;
1036 bool commit_needed = false;
1037 bool failed = false;
1038 + struct writeset *ws = era->md->current_writeset;
1039
1040 bio_list_init(&deferred_bios);
1041 bio_list_init(&marked_bios);
1042 @@ -1238,9 +1255,11 @@ static void process_deferred_bios(struct era *era)
1043 bio_list_init(&era->deferred_bios);
1044 spin_unlock(&era->deferred_lock);
1045
1046 + if (bio_list_empty(&deferred_bios))
1047 + return;
1048 +
1049 while ((bio = bio_list_pop(&deferred_bios))) {
1050 - r = writeset_test_and_set(&era->md->bitset_info,
1051 - era->md->current_writeset,
1052 + r = writeset_test_and_set(&era->md->bitset_info, ws,
1053 get_block(era, bio));
1054 if (r < 0) {
1055 /*
1056 @@ -1248,7 +1267,6 @@ static void process_deferred_bios(struct era *era)
1057 * FIXME: finish.
1058 */
1059 failed = true;
1060 -
1061 } else if (r == 0)
1062 commit_needed = true;
1063
1064 @@ -1264,9 +1282,19 @@ static void process_deferred_bios(struct era *era)
1065 if (failed)
1066 while ((bio = bio_list_pop(&marked_bios)))
1067 bio_io_error(bio);
1068 - else
1069 - while ((bio = bio_list_pop(&marked_bios)))
1070 + else {
1071 + blk_start_plug(&plug);
1072 + while ((bio = bio_list_pop(&marked_bios))) {
1073 + /*
1074 + * Only update the in-core writeset if the on-disk one
1075 + * was updated too.
1076 + */
1077 + if (commit_needed)
1078 + set_bit(get_block(era, bio), ws->bits);
1079 generic_make_request(bio);
1080 + }
1081 + blk_finish_plug(&plug);
1082 + }
1083 }
1084
1085 static void process_rpc_calls(struct era *era)
1086 @@ -1487,15 +1515,6 @@ static int era_ctr(struct dm_target *ti, unsigned argc, char **argv)
1087 }
1088 era->md = md;
1089
1090 - era->nr_blocks = calc_nr_blocks(era);
1091 -
1092 - r = metadata_resize(era->md, &era->nr_blocks);
1093 - if (r) {
1094 - ti->error = "couldn't resize metadata";
1095 - era_destroy(era);
1096 - return -ENOMEM;
1097 - }
1098 -
1099 era->wq = alloc_ordered_workqueue("dm-" DM_MSG_PREFIX, WQ_MEM_RECLAIM);
1100 if (!era->wq) {
1101 ti->error = "could not create workqueue for metadata object";
1102 @@ -1573,16 +1592,24 @@ static int era_preresume(struct dm_target *ti)
1103 dm_block_t new_size = calc_nr_blocks(era);
1104
1105 if (era->nr_blocks != new_size) {
1106 - r = in_worker1(era, metadata_resize, &new_size);
1107 - if (r)
1108 + r = metadata_resize(era->md, &new_size);
1109 + if (r) {
1110 + DMERR("%s: metadata_resize failed", __func__);
1111 + return r;
1112 + }
1113 +
1114 + r = metadata_commit(era->md);
1115 + if (r) {
1116 + DMERR("%s: metadata_commit failed", __func__);
1117 return r;
1118 + }
1119
1120 era->nr_blocks = new_size;
1121 }
1122
1123 start_worker(era);
1124
1125 - r = in_worker0(era, metadata_new_era);
1126 + r = in_worker0(era, metadata_era_rollover);
1127 if (r) {
1128 DMERR("%s: metadata_era_rollover failed", __func__);
1129 return r;
1130 diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
1131 index 0d4cacb93664e..d58c58e61bde0 100644
1132 --- a/drivers/media/pci/cx25821/cx25821-core.c
1133 +++ b/drivers/media/pci/cx25821/cx25821-core.c
1134 @@ -990,8 +990,10 @@ int cx25821_riscmem_alloc(struct pci_dev *pci,
1135 __le32 *cpu;
1136 dma_addr_t dma = 0;
1137
1138 - if (NULL != risc->cpu && risc->size < size)
1139 + if (risc->cpu && risc->size < size) {
1140 pci_free_consistent(pci, risc->size, risc->cpu, risc->dma);
1141 + risc->cpu = NULL;
1142 + }
1143 if (NULL == risc->cpu) {
1144 cpu = pci_zalloc_consistent(pci, size, &dma);
1145 if (NULL == cpu)
1146 diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c
1147 index f0fe2524259f0..522e1e18850fb 100644
1148 --- a/drivers/media/pci/saa7134/saa7134-empress.c
1149 +++ b/drivers/media/pci/saa7134/saa7134-empress.c
1150 @@ -297,8 +297,11 @@ static int empress_init(struct saa7134_dev *dev)
1151 q->lock = &dev->lock;
1152 q->dev = &dev->pci->dev;
1153 err = vb2_queue_init(q);
1154 - if (err)
1155 + if (err) {
1156 + video_device_release(dev->empress_dev);
1157 + dev->empress_dev = NULL;
1158 return err;
1159 + }
1160 dev->empress_dev->queue = q;
1161
1162 video_set_drvdata(dev->empress_dev, dev);
1163 diff --git a/drivers/media/platform/pxa_camera.c b/drivers/media/platform/pxa_camera.c
1164 index 3fab9f776afa7..425eda460e013 100644
1165 --- a/drivers/media/platform/pxa_camera.c
1166 +++ b/drivers/media/platform/pxa_camera.c
1167 @@ -1420,6 +1420,9 @@ static int pxac_vb2_prepare(struct vb2_buffer *vb)
1168 struct pxa_camera_dev *pcdev = vb2_get_drv_priv(vb->vb2_queue);
1169 struct pxa_buffer *buf = vb2_to_pxa_buffer(vb);
1170 int ret = 0;
1171 +#ifdef DEBUG
1172 + int i;
1173 +#endif
1174
1175 switch (pcdev->channels) {
1176 case 1:
1177 diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
1178 index fcb1838d670d4..8d50a9a9f73da 100644
1179 --- a/drivers/media/platform/vsp1/vsp1_drv.c
1180 +++ b/drivers/media/platform/vsp1/vsp1_drv.c
1181 @@ -764,8 +764,10 @@ static int vsp1_probe(struct platform_device *pdev)
1182 }
1183
1184 done:
1185 - if (ret)
1186 + if (ret) {
1187 pm_runtime_disable(&pdev->dev);
1188 + rcar_fcp_put(vsp1->fcp);
1189 + }
1190
1191 return ret;
1192 }
1193 diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c
1194 index 9af2a155cfca9..416d1eeb9c029 100644
1195 --- a/drivers/media/tuners/qm1d1c0042.c
1196 +++ b/drivers/media/tuners/qm1d1c0042.c
1197 @@ -352,8 +352,10 @@ static int qm1d1c0042_init(struct dvb_frontend *fe)
1198 if (val == reg_initval[reg_index][0x00])
1199 break;
1200 }
1201 - if (reg_index >= QM1D1C0042_NUM_REG_ROWS)
1202 + if (reg_index >= QM1D1C0042_NUM_REG_ROWS) {
1203 + ret = -EINVAL;
1204 goto failed;
1205 + }
1206 memcpy(state->regs, reg_initval[reg_index], QM1D1C0042_NUM_REGS);
1207 usleep_range(2000, 3000);
1208
1209 diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
1210 index 5c4aa247d650f..ca4ed2af53207 100644
1211 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
1212 +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
1213 @@ -446,7 +446,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap)
1214 ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe);
1215
1216 if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK)
1217 - lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa),
1218 + lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa);
1219
1220 lme_int->lme_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1221
1222 diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
1223 index 185c8079d0f93..14f3e8388f357 100644
1224 --- a/drivers/media/usb/tm6000/tm6000-dvb.c
1225 +++ b/drivers/media/usb/tm6000/tm6000-dvb.c
1226 @@ -156,6 +156,10 @@ static int tm6000_start_stream(struct tm6000_core *dev)
1227 if (ret < 0) {
1228 printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",
1229 ret, __func__);
1230 +
1231 + kfree(dvb->bulk_urb->transfer_buffer);
1232 + usb_free_urb(dvb->bulk_urb);
1233 + dvb->bulk_urb = NULL;
1234 return ret;
1235 } else
1236 printk(KERN_ERR "tm6000: pipe resetted\n");
1237 diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
1238 index 5156c971c241c..6a19cf94705b1 100644
1239 --- a/drivers/media/usb/uvc/uvc_v4l2.c
1240 +++ b/drivers/media/usb/uvc/uvc_v4l2.c
1241 @@ -258,7 +258,9 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
1242 goto done;
1243
1244 /* After the probe, update fmt with the values returned from
1245 - * negotiation with the device.
1246 + * negotiation with the device. Some devices return invalid bFormatIndex
1247 + * and bFrameIndex values, in which case we can only assume they have
1248 + * accepted the requested format as-is.
1249 */
1250 for (i = 0; i < stream->nformats; ++i) {
1251 if (probe->bFormatIndex == stream->format[i].index) {
1252 @@ -267,11 +269,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
1253 }
1254 }
1255
1256 - if (i == stream->nformats) {
1257 - uvc_trace(UVC_TRACE_FORMAT, "Unknown bFormatIndex %u\n",
1258 + if (i == stream->nformats)
1259 + uvc_trace(UVC_TRACE_FORMAT,
1260 + "Unknown bFormatIndex %u, using default\n",
1261 probe->bFormatIndex);
1262 - return -EINVAL;
1263 - }
1264
1265 for (i = 0; i < format->nframes; ++i) {
1266 if (probe->bFrameIndex == format->frame[i].bFrameIndex) {
1267 @@ -280,11 +281,10 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
1268 }
1269 }
1270
1271 - if (i == format->nframes) {
1272 - uvc_trace(UVC_TRACE_FORMAT, "Unknown bFrameIndex %u\n",
1273 + if (i == format->nframes)
1274 + uvc_trace(UVC_TRACE_FORMAT,
1275 + "Unknown bFrameIndex %u, using default\n",
1276 probe->bFrameIndex);
1277 - return -EINVAL;
1278 - }
1279
1280 fmt->fmt.pix.width = frame->wWidth;
1281 fmt->fmt.pix.height = frame->wHeight;
1282 diff --git a/drivers/mfd/wm831x-auxadc.c b/drivers/mfd/wm831x-auxadc.c
1283 index fd789d2eb0f52..9f7ae1e1ebcd6 100644
1284 --- a/drivers/mfd/wm831x-auxadc.c
1285 +++ b/drivers/mfd/wm831x-auxadc.c
1286 @@ -98,11 +98,10 @@ static int wm831x_auxadc_read_irq(struct wm831x *wm831x,
1287 wait_for_completion_timeout(&req->done, msecs_to_jiffies(500));
1288
1289 mutex_lock(&wm831x->auxadc_lock);
1290 -
1291 - list_del(&req->list);
1292 ret = req->val;
1293
1294 out:
1295 + list_del(&req->list);
1296 mutex_unlock(&wm831x->auxadc_lock);
1297
1298 kfree(req);
1299 diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
1300 index 94cc035aa8417..d30deee1effda 100644
1301 --- a/drivers/misc/eeprom/eeprom_93xx46.c
1302 +++ b/drivers/misc/eeprom/eeprom_93xx46.c
1303 @@ -533,3 +533,4 @@ MODULE_LICENSE("GPL");
1304 MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs");
1305 MODULE_AUTHOR("Anatolij Gustschin <agust@denx.de>");
1306 MODULE_ALIAS("spi:93xx46");
1307 +MODULE_ALIAS("spi:eeprom-93xx46");
1308 diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1309 index 6ac3c59c9ae78..9c8887d3a4b9c 100644
1310 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
1311 +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1312 @@ -639,6 +639,9 @@ static struct vmci_queue *qp_host_alloc_queue(u64 size)
1313
1314 queue_page_size = num_pages * sizeof(*queue->kernel_if->u.h.page);
1315
1316 + if (queue_size + queue_page_size > KMALLOC_MAX_SIZE)
1317 + return NULL;
1318 +
1319 queue = kzalloc(queue_size + queue_page_size, GFP_KERNEL);
1320 if (queue) {
1321 queue->q_header = NULL;
1322 @@ -732,7 +735,7 @@ static void qp_release_pages(struct page **pages,
1323
1324 for (i = 0; i < num_pages; i++) {
1325 if (dirty)
1326 - set_page_dirty(pages[i]);
1327 + set_page_dirty_lock(pages[i]);
1328
1329 put_page(pages[i]);
1330 pages[i] = NULL;
1331 diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
1332 index b4336534f6285..9e52886b59282 100644
1333 --- a/drivers/mmc/host/sdhci-esdhc-imx.c
1334 +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
1335 @@ -1301,9 +1301,10 @@ static int sdhci_esdhc_imx_remove(struct platform_device *pdev)
1336 struct sdhci_host *host = platform_get_drvdata(pdev);
1337 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1338 struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host);
1339 - int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
1340 + int dead;
1341
1342 pm_runtime_get_sync(&pdev->dev);
1343 + dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
1344 pm_runtime_disable(&pdev->dev);
1345 pm_runtime_put_noidle(&pdev->dev);
1346
1347 diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c
1348 index 1bd5f1a18d4e2..003aecc441223 100644
1349 --- a/drivers/mmc/host/usdhi6rol0.c
1350 +++ b/drivers/mmc/host/usdhi6rol0.c
1351 @@ -1866,10 +1866,12 @@ static int usdhi6_probe(struct platform_device *pdev)
1352
1353 ret = mmc_add_host(mmc);
1354 if (ret < 0)
1355 - goto e_clk_off;
1356 + goto e_release_dma;
1357
1358 return 0;
1359
1360 +e_release_dma:
1361 + usdhi6_dma_release(host);
1362 e_clk_off:
1363 clk_disable_unprepare(host->clk);
1364 e_free_mmc:
1365 diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
1366 index d489fbd07c12b..92de2b408734a 100644
1367 --- a/drivers/mtd/spi-nor/cadence-quadspi.c
1368 +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
1369 @@ -461,7 +461,7 @@ static int cqspi_indirect_read_setup(struct spi_nor *nor,
1370 /* Setup dummy clock cycles */
1371 dummy_clk = nor->read_dummy;
1372 if (dummy_clk > CQSPI_DUMMY_CLKS_MAX)
1373 - dummy_clk = CQSPI_DUMMY_CLKS_MAX;
1374 + return -EOPNOTSUPP;
1375
1376 if (dummy_clk / 8) {
1377 reg |= (1 << CQSPI_REG_RD_INSTR_MODE_EN_LSB);
1378 diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c
1379 index 20378b0d55e98..68be79ba571df 100644
1380 --- a/drivers/mtd/spi-nor/hisi-sfc.c
1381 +++ b/drivers/mtd/spi-nor/hisi-sfc.c
1382 @@ -393,8 +393,10 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
1383
1384 for_each_available_child_of_node(dev->of_node, np) {
1385 ret = hisi_spi_nor_register(np, host);
1386 - if (ret)
1387 + if (ret) {
1388 + of_node_put(np);
1389 goto fail;
1390 + }
1391
1392 if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
1393 dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
1394 diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1395 index f9610f860e6d1..148e1ff2e5e0e 100644
1396 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1397 +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1398 @@ -5095,9 +5095,10 @@ static void bnxt_tx_disable(struct bnxt *bp)
1399 txr->dev_state = BNXT_DEV_STATE_CLOSING;
1400 }
1401 }
1402 + /* Drop carrier first to prevent TX timeout */
1403 + netif_carrier_off(bp->dev);
1404 /* Stop all TX queues */
1405 netif_tx_disable(bp->dev);
1406 - netif_carrier_off(bp->dev);
1407 }
1408
1409 static void bnxt_tx_enable(struct bnxt *bp)
1410 diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
1411 index 2e12ccf73dba0..877b49cc9d3c3 100644
1412 --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
1413 +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
1414 @@ -2452,13 +2452,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags,
1415
1416 l4_proto = ip.v4->protocol;
1417 } else if (*tx_flags & I40E_TX_FLAGS_IPV6) {
1418 + int ret;
1419 +
1420 tunnel |= I40E_TX_CTX_EXT_IP_IPV6;
1421
1422 exthdr = ip.hdr + sizeof(*ip.v6);
1423 l4_proto = ip.v6->nexthdr;
1424 - if (l4.hdr != exthdr)
1425 - ipv6_skip_exthdr(skb, exthdr - skb->data,
1426 - &l4_proto, &frag_off);
1427 + ret = ipv6_skip_exthdr(skb, exthdr - skb->data,
1428 + &l4_proto, &frag_off);
1429 + if (ret < 0)
1430 + return -1;
1431 }
1432
1433 /* define outer transport */
1434 diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
1435 index 43fb77c6c51ed..9b7ef62ed8fbd 100644
1436 --- a/drivers/net/ethernet/intel/igb/igb_main.c
1437 +++ b/drivers/net/ethernet/intel/igb/igb_main.c
1438 @@ -5665,8 +5665,6 @@ static void igb_tsync_interrupt(struct igb_adapter *adapter)
1439 event.type = PTP_CLOCK_PPS;
1440 if (adapter->ptp_caps.pps)
1441 ptp_clock_event(adapter->ptp_clock, &event);
1442 - else
1443 - dev_err(&adapter->pdev->dev, "unexpected SYS WRAP");
1444 ack |= TSINTR_SYS_WRAP;
1445 }
1446
1447 diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
1448 index 7d1e8ab956e64..ab046bffed150 100644
1449 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
1450 +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
1451 @@ -4948,6 +4948,7 @@ static int mlx4_do_mirror_rule(struct mlx4_dev *dev, struct res_fs_rule *fs_rule
1452
1453 if (!fs_rule->mirr_mbox) {
1454 mlx4_err(dev, "rule mirroring mailbox is null\n");
1455 + mlx4_free_cmd_mailbox(dev, mailbox);
1456 return -EINVAL;
1457 }
1458 memcpy(mailbox->buf, fs_rule->mirr_mbox, fs_rule->mirr_mbox_size);
1459 diff --git a/drivers/net/ethernet/sun/sunvnet_common.c b/drivers/net/ethernet/sun/sunvnet_common.c
1460 index 904a5a12a85d0..8408f9551276a 100644
1461 --- a/drivers/net/ethernet/sun/sunvnet_common.c
1462 +++ b/drivers/net/ethernet/sun/sunvnet_common.c
1463 @@ -1263,28 +1263,12 @@ int sunvnet_start_xmit_common(struct sk_buff *skb, struct net_device *dev,
1464 if (vio_version_after_eq(&port->vio, 1, 3))
1465 localmtu -= VLAN_HLEN;
1466
1467 - if (skb->protocol == htons(ETH_P_IP)) {
1468 - struct flowi4 fl4;
1469 - struct rtable *rt = NULL;
1470 -
1471 - memset(&fl4, 0, sizeof(fl4));
1472 - fl4.flowi4_oif = dev->ifindex;
1473 - fl4.flowi4_tos = RT_TOS(ip_hdr(skb)->tos);
1474 - fl4.daddr = ip_hdr(skb)->daddr;
1475 - fl4.saddr = ip_hdr(skb)->saddr;
1476 -
1477 - rt = ip_route_output_key(dev_net(dev), &fl4);
1478 - rcu_read_unlock();
1479 - if (!IS_ERR(rt)) {
1480 - skb_dst_set(skb, &rt->dst);
1481 - icmp_send(skb, ICMP_DEST_UNREACH,
1482 - ICMP_FRAG_NEEDED,
1483 - htonl(localmtu));
1484 - }
1485 - }
1486 + if (skb->protocol == htons(ETH_P_IP))
1487 + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
1488 + htonl(localmtu));
1489 #if IS_ENABLED(CONFIG_IPV6)
1490 else if (skb->protocol == htons(ETH_P_IPV6))
1491 - icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
1492 + icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, localmtu);
1493 #endif
1494 goto out_dropped;
1495 }
1496 diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c
1497 index fe844888e0ed8..e513736ae0d53 100644
1498 --- a/drivers/net/gtp.c
1499 +++ b/drivers/net/gtp.c
1500 @@ -559,9 +559,8 @@ static int gtp_build_skb_ip4(struct sk_buff *skb, struct net_device *dev,
1501 if (!skb_is_gso(skb) && (iph->frag_off & htons(IP_DF)) &&
1502 mtu < ntohs(iph->tot_len)) {
1503 netdev_dbg(dev, "packet too big, fragmentation needed\n");
1504 - memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
1505 - icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
1506 - htonl(mtu));
1507 + icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
1508 + htonl(mtu));
1509 goto err_rt;
1510 }
1511
1512 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1513 index 1c0aec70ee5d2..f9e57405b167b 100644
1514 --- a/drivers/net/usb/qmi_wwan.c
1515 +++ b/drivers/net/usb/qmi_wwan.c
1516 @@ -949,6 +949,7 @@ static const struct usb_device_id products[] = {
1517 {QMI_FIXED_INTF(0x1e2d, 0x0082, 5)}, /* Cinterion PHxx,PXxx (2 RmNet) */
1518 {QMI_FIXED_INTF(0x1e2d, 0x0083, 4)}, /* Cinterion PHxx,PXxx (1 RmNet + USB Audio)*/
1519 {QMI_QUIRK_SET_DTR(0x1e2d, 0x00b0, 4)}, /* Cinterion CLS8 */
1520 + {QMI_FIXED_INTF(0x1e2d, 0x00b7, 0)}, /* Cinterion MV31 RmNet */
1521 {QMI_FIXED_INTF(0x413c, 0x81a2, 8)}, /* Dell Wireless 5806 Gobi(TM) 4G LTE Mobile Broadband Card */
1522 {QMI_FIXED_INTF(0x413c, 0x81a3, 8)}, /* Dell Wireless 5570 HSPA+ (42Mbps) Mobile Broadband Card */
1523 {QMI_FIXED_INTF(0x413c, 0x81a4, 8)}, /* Dell Wireless 5570e HSPA+ (42Mbps) Mobile Broadband Card */
1524 diff --git a/drivers/net/wireless/broadcom/b43/phy_n.c b/drivers/net/wireless/broadcom/b43/phy_n.c
1525 index a5557d70689f4..d1afa74aa144b 100644
1526 --- a/drivers/net/wireless/broadcom/b43/phy_n.c
1527 +++ b/drivers/net/wireless/broadcom/b43/phy_n.c
1528 @@ -5320,7 +5320,7 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
1529
1530 for (i = 0; i < 4; i++) {
1531 if (dev->phy.rev >= 3)
1532 - table[i] = coef[i];
1533 + coef[i] = table[i];
1534 else
1535 coef[i] = 0;
1536 }
1537 diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
1538 index e61073c751428..d9d06dc689edc 100644
1539 --- a/drivers/net/xen-netback/interface.c
1540 +++ b/drivers/net/xen-netback/interface.c
1541 @@ -161,13 +161,15 @@ irqreturn_t xenvif_interrupt(int irq, void *dev_id)
1542 {
1543 struct xenvif_queue *queue = dev_id;
1544 int old;
1545 + bool has_rx, has_tx;
1546
1547 old = atomic_fetch_or(NETBK_COMMON_EOI, &queue->eoi_pending);
1548 WARN(old, "Interrupt while EOI pending\n");
1549
1550 - /* Use bitwise or as we need to call both functions. */
1551 - if ((!xenvif_handle_tx_interrupt(queue) |
1552 - !xenvif_handle_rx_interrupt(queue))) {
1553 + has_tx = xenvif_handle_tx_interrupt(queue);
1554 + has_rx = xenvif_handle_rx_interrupt(queue);
1555 +
1556 + if (!has_rx && !has_tx) {
1557 atomic_andnot(NETBK_COMMON_EOI, &queue->eoi_pending);
1558 xen_irq_lateeoi(irq, XEN_EOI_FLAG_SPURIOUS);
1559 }
1560 diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
1561 index dcb32f34a3024..25b867a9281be 100644
1562 --- a/drivers/nvdimm/dimm_devs.c
1563 +++ b/drivers/nvdimm/dimm_devs.c
1564 @@ -317,16 +317,16 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
1565 }
1566 static DEVICE_ATTR_RO(state);
1567
1568 -static ssize_t available_slots_show(struct device *dev,
1569 - struct device_attribute *attr, char *buf)
1570 +static ssize_t __available_slots_show(struct nvdimm_drvdata *ndd, char *buf)
1571 {
1572 - struct nvdimm_drvdata *ndd = dev_get_drvdata(dev);
1573 + struct device *dev;
1574 ssize_t rc;
1575 u32 nfree;
1576
1577 if (!ndd)
1578 return -ENXIO;
1579
1580 + dev = ndd->dev;
1581 nvdimm_bus_lock(dev);
1582 nfree = nd_label_nfree(ndd);
1583 if (nfree - 1 > nfree) {
1584 @@ -338,6 +338,18 @@ static ssize_t available_slots_show(struct device *dev,
1585 nvdimm_bus_unlock(dev);
1586 return rc;
1587 }
1588 +
1589 +static ssize_t available_slots_show(struct device *dev,
1590 + struct device_attribute *attr, char *buf)
1591 +{
1592 + ssize_t rc;
1593 +
1594 + device_lock(dev);
1595 + rc = __available_slots_show(dev_get_drvdata(dev), buf);
1596 + device_unlock(dev);
1597 +
1598 + return rc;
1599 +}
1600 static DEVICE_ATTR_RO(available_slots);
1601
1602 static struct attribute *nvdimm_attributes[] = {
1603 diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
1604 index e9360d5cbcbac..9054b8f218a78 100644
1605 --- a/drivers/of/fdt.c
1606 +++ b/drivers/of/fdt.c
1607 @@ -1158,8 +1158,16 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
1608 int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
1609 phys_addr_t size, bool nomap)
1610 {
1611 - if (nomap)
1612 - return memblock_remove(base, size);
1613 + if (nomap) {
1614 + /*
1615 + * If the memory is already reserved (by another region), we
1616 + * should not allow it to be marked nomap.
1617 + */
1618 + if (memblock_is_region_reserved(base, size))
1619 + return -EBUSY;
1620 +
1621 + return memblock_mark_nomap(base, size);
1622 + }
1623 return memblock_reserve(base, size);
1624 }
1625
1626 diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
1627 index b91c4da683657..7958250856d36 100644
1628 --- a/drivers/pci/syscall.c
1629 +++ b/drivers/pci/syscall.c
1630 @@ -21,7 +21,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
1631 u16 word;
1632 u32 dword;
1633 long err;
1634 - long cfg_ret;
1635 + int cfg_ret;
1636
1637 if (!capable(CAP_SYS_ADMIN))
1638 return -EPERM;
1639 @@ -47,7 +47,7 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
1640 }
1641
1642 err = -EIO;
1643 - if (cfg_ret != PCIBIOS_SUCCESSFUL)
1644 + if (cfg_ret)
1645 goto error;
1646
1647 switch (len) {
1648 @@ -105,7 +105,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
1649 if (err)
1650 break;
1651 err = pci_user_write_config_byte(dev, off, byte);
1652 - if (err != PCIBIOS_SUCCESSFUL)
1653 + if (err)
1654 err = -EIO;
1655 break;
1656
1657 @@ -114,7 +114,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
1658 if (err)
1659 break;
1660 err = pci_user_write_config_word(dev, off, word);
1661 - if (err != PCIBIOS_SUCCESSFUL)
1662 + if (err)
1663 err = -EIO;
1664 break;
1665
1666 @@ -123,7 +123,7 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
1667 if (err)
1668 break;
1669 err = pci_user_write_config_dword(dev, off, dword);
1670 - if (err != PCIBIOS_SUCCESSFUL)
1671 + if (err)
1672 err = -EIO;
1673 break;
1674
1675 diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
1676 index 04ca990e8f6cb..dcfc7025f384a 100644
1677 --- a/drivers/power/reset/at91-sama5d2_shdwc.c
1678 +++ b/drivers/power/reset/at91-sama5d2_shdwc.c
1679 @@ -36,7 +36,7 @@
1680
1681 #define AT91_SHDW_MR 0x04 /* Shut Down Mode Register */
1682 #define AT91_SHDW_WKUPDBC_SHIFT 24
1683 -#define AT91_SHDW_WKUPDBC_MASK GENMASK(31, 16)
1684 +#define AT91_SHDW_WKUPDBC_MASK GENMASK(26, 24)
1685 #define AT91_SHDW_WKUPDBC(x) (((x) << AT91_SHDW_WKUPDBC_SHIFT) \
1686 & AT91_SHDW_WKUPDBC_MASK)
1687
1688 diff --git a/drivers/pwm/pwm-rockchip.c b/drivers/pwm/pwm-rockchip.c
1689 index 744d56197286a..1cc6717979537 100644
1690 --- a/drivers/pwm/pwm-rockchip.c
1691 +++ b/drivers/pwm/pwm-rockchip.c
1692 @@ -366,7 +366,6 @@ static int rockchip_pwm_probe(struct platform_device *pdev)
1693
1694 ret = pwmchip_add(&pc->chip);
1695 if (ret < 0) {
1696 - clk_unprepare(pc->clk);
1697 dev_err(&pdev->dev, "pwmchip_add() failed: %d\n", ret);
1698 }
1699
1700 diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
1701 index a3ade9e4ef478..86776d45b68e1 100644
1702 --- a/drivers/regulator/axp20x-regulator.c
1703 +++ b/drivers/regulator/axp20x-regulator.c
1704 @@ -415,7 +415,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
1705 static int axp20x_regulator_parse_dt(struct platform_device *pdev)
1706 {
1707 struct device_node *np, *regulators;
1708 - int ret;
1709 + int ret = 0;
1710 u32 dcdcfreq = 0;
1711
1712 np = of_node_get(pdev->dev.parent->of_node);
1713 @@ -430,13 +430,12 @@ static int axp20x_regulator_parse_dt(struct platform_device *pdev)
1714 ret = axp20x_set_dcdc_freq(pdev, dcdcfreq);
1715 if (ret < 0) {
1716 dev_err(&pdev->dev, "Error setting dcdc frequency: %d\n", ret);
1717 - return ret;
1718 }
1719 -
1720 of_node_put(regulators);
1721 }
1722
1723 - return 0;
1724 + of_node_put(np);
1725 + return ret;
1726 }
1727
1728 static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 workmode)
1729 diff --git a/drivers/scsi/bnx2fc/Kconfig b/drivers/scsi/bnx2fc/Kconfig
1730 index d401a096dfc7e..2eb2476852b11 100644
1731 --- a/drivers/scsi/bnx2fc/Kconfig
1732 +++ b/drivers/scsi/bnx2fc/Kconfig
1733 @@ -4,6 +4,7 @@ config SCSI_BNX2X_FCOE
1734 depends on (IPV6 || IPV6=n)
1735 depends on LIBFC
1736 depends on LIBFCOE
1737 + depends on MMU
1738 select NETDEVICES
1739 select ETHERNET
1740 select NET_VENDOR_BROADCOM
1741 diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c
1742 index 58d2d48e16a53..c37e35aeafa44 100644
1743 --- a/drivers/spi/spi-pxa2xx-pci.c
1744 +++ b/drivers/spi/spi-pxa2xx-pci.c
1745 @@ -21,7 +21,8 @@ enum {
1746 PORT_BSW1,
1747 PORT_BSW2,
1748 PORT_CE4100,
1749 - PORT_LPT,
1750 + PORT_LPT0,
1751 + PORT_LPT1,
1752 };
1753
1754 struct pxa_spi_info {
1755 @@ -48,8 +49,10 @@ static struct dw_dma_slave bsw1_rx_param = { .src_id = 7 };
1756 static struct dw_dma_slave bsw2_tx_param = { .dst_id = 8 };
1757 static struct dw_dma_slave bsw2_rx_param = { .src_id = 9 };
1758
1759 -static struct dw_dma_slave lpt_tx_param = { .dst_id = 0 };
1760 -static struct dw_dma_slave lpt_rx_param = { .src_id = 1 };
1761 +static struct dw_dma_slave lpt1_tx_param = { .dst_id = 0 };
1762 +static struct dw_dma_slave lpt1_rx_param = { .src_id = 1 };
1763 +static struct dw_dma_slave lpt0_tx_param = { .dst_id = 2 };
1764 +static struct dw_dma_slave lpt0_rx_param = { .src_id = 3 };
1765
1766 static bool lpss_dma_filter(struct dma_chan *chan, void *param)
1767 {
1768 @@ -158,12 +161,19 @@ static struct pxa_spi_info spi_info_configs[] = {
1769 .num_chipselect = 1,
1770 .max_clk_rate = 50000000,
1771 },
1772 - [PORT_LPT] = {
1773 + [PORT_LPT0] = {
1774 .type = LPSS_LPT_SSP,
1775 .port_id = 0,
1776 .setup = lpss_spi_setup,
1777 - .tx_param = &lpt_tx_param,
1778 - .rx_param = &lpt_rx_param,
1779 + .tx_param = &lpt0_tx_param,
1780 + .rx_param = &lpt0_rx_param,
1781 + },
1782 + [PORT_LPT1] = {
1783 + .type = LPSS_LPT_SSP,
1784 + .port_id = 1,
1785 + .setup = lpss_spi_setup,
1786 + .tx_param = &lpt1_tx_param,
1787 + .rx_param = &lpt1_rx_param,
1788 },
1789 };
1790
1791 @@ -251,8 +261,9 @@ static const struct pci_device_id pxa2xx_spi_pci_devices[] = {
1792 { PCI_VDEVICE(INTEL, 0x2290), PORT_BSW1 },
1793 { PCI_VDEVICE(INTEL, 0x22ac), PORT_BSW2 },
1794 { PCI_VDEVICE(INTEL, 0x2e6a), PORT_CE4100 },
1795 - { PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT },
1796 - { },
1797 + { PCI_VDEVICE(INTEL, 0x9ce5), PORT_LPT0 },
1798 + { PCI_VDEVICE(INTEL, 0x9ce6), PORT_LPT1 },
1799 + { }
1800 };
1801 MODULE_DEVICE_TABLE(pci, pxa2xx_spi_pci_devices);
1802
1803 diff --git a/drivers/spi/spi-s3c24xx-fiq.S b/drivers/spi/spi-s3c24xx-fiq.S
1804 index 059f2dc1fda2d..1565c792da079 100644
1805 --- a/drivers/spi/spi-s3c24xx-fiq.S
1806 +++ b/drivers/spi/spi-s3c24xx-fiq.S
1807 @@ -36,7 +36,6 @@
1808 @ and an offset to the irq acknowledgment word
1809
1810 ENTRY(s3c24xx_spi_fiq_rx)
1811 -s3c24xx_spi_fix_rx:
1812 .word fiq_rx_end - fiq_rx_start
1813 .word fiq_rx_irq_ack - fiq_rx_start
1814 fiq_rx_start:
1815 @@ -50,7 +49,7 @@ fiq_rx_start:
1816 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
1817
1818 subs fiq_rcount, fiq_rcount, #1
1819 - subnes pc, lr, #4 @@ return, still have work to do
1820 + subsne pc, lr, #4 @@ return, still have work to do
1821
1822 @@ set IRQ controller so that next op will trigger IRQ
1823 mov fiq_rtmp, #0
1824 @@ -62,7 +61,6 @@ fiq_rx_irq_ack:
1825 fiq_rx_end:
1826
1827 ENTRY(s3c24xx_spi_fiq_txrx)
1828 -s3c24xx_spi_fiq_txrx:
1829 .word fiq_txrx_end - fiq_txrx_start
1830 .word fiq_txrx_irq_ack - fiq_txrx_start
1831 fiq_txrx_start:
1832 @@ -77,7 +75,7 @@ fiq_txrx_start:
1833 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
1834
1835 subs fiq_rcount, fiq_rcount, #1
1836 - subnes pc, lr, #4 @@ return, still have work to do
1837 + subsne pc, lr, #4 @@ return, still have work to do
1838
1839 mov fiq_rtmp, #0
1840 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
1841 @@ -89,7 +87,6 @@ fiq_txrx_irq_ack:
1842 fiq_txrx_end:
1843
1844 ENTRY(s3c24xx_spi_fiq_tx)
1845 -s3c24xx_spi_fix_tx:
1846 .word fiq_tx_end - fiq_tx_start
1847 .word fiq_tx_irq_ack - fiq_tx_start
1848 fiq_tx_start:
1849 @@ -102,7 +99,7 @@ fiq_tx_start:
1850 strb fiq_rtmp, [ fiq_rspi, # S3C2410_SPTDAT ]
1851
1852 subs fiq_rcount, fiq_rcount, #1
1853 - subnes pc, lr, #4 @@ return, still have work to do
1854 + subsne pc, lr, #4 @@ return, still have work to do
1855
1856 mov fiq_rtmp, #0
1857 str fiq_rtmp, [ fiq_rirq, # S3C2410_INTMOD - S3C24XX_VA_IRQ ]
1858 diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1859 index c14088075c597..3afdb326e2243 100644
1860 --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1861 +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
1862 @@ -49,6 +49,7 @@ static struct usb_device_id rtw_usb_id_tbl[] = {
1863 {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */
1864 {USB_DEVICE(0x2C4E, 0x0102)}, /* MERCUSYS MW150US v2 */
1865 {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */
1866 + {USB_DEVICE(0x7392, 0xb811)}, /* Edimax EW-7811UN V2 */
1867 {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */
1868 {} /* Terminating entry */
1869 };
1870 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1871 index 5d109717ac4e3..2fc735efc3dc5 100644
1872 --- a/drivers/usb/core/quirks.c
1873 +++ b/drivers/usb/core/quirks.c
1874 @@ -230,6 +230,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1875 /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */
1876 { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF },
1877
1878 + /* ELMO L-12F document camera */
1879 + { USB_DEVICE(0x09a1, 0x0028), .driver_info = USB_QUIRK_DELAY_CTRL_MSG },
1880 +
1881 /* Broadcom BCM92035DGROM BT dongle */
1882 { USB_DEVICE(0x0a5c, 0x2021), .driver_info = USB_QUIRK_RESET_RESUME },
1883
1884 diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
1885 index 120c8f716acf8..f2c7cd22b73f2 100644
1886 --- a/drivers/usb/dwc2/hcd.c
1887 +++ b/drivers/usb/dwc2/hcd.c
1888 @@ -1425,19 +1425,20 @@ static void dwc2_hc_start_transfer(struct dwc2_hsotg *hsotg,
1889 if (num_packets > max_hc_pkt_count) {
1890 num_packets = max_hc_pkt_count;
1891 chan->xfer_len = num_packets * chan->max_packet;
1892 + } else if (chan->ep_is_in) {
1893 + /*
1894 + * Always program an integral # of max packets
1895 + * for IN transfers.
1896 + * Note: This assumes that the input buffer is
1897 + * aligned and sized accordingly.
1898 + */
1899 + chan->xfer_len = num_packets * chan->max_packet;
1900 }
1901 } else {
1902 /* Need 1 packet for transfer length of 0 */
1903 num_packets = 1;
1904 }
1905
1906 - if (chan->ep_is_in)
1907 - /*
1908 - * Always program an integral # of max packets for IN
1909 - * transfers
1910 - */
1911 - chan->xfer_len = num_packets * chan->max_packet;
1912 -
1913 if (chan->ep_type == USB_ENDPOINT_XFER_INT ||
1914 chan->ep_type == USB_ENDPOINT_XFER_ISOC)
1915 /*
1916 diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
1917 index 8066fa9ac97ba..e39210bd97100 100644
1918 --- a/drivers/usb/dwc2/hcd_intr.c
1919 +++ b/drivers/usb/dwc2/hcd_intr.c
1920 @@ -488,7 +488,7 @@ static int dwc2_update_urb_state(struct dwc2_hsotg *hsotg,
1921 &short_read);
1922
1923 if (urb->actual_length + xfer_length > urb->length) {
1924 - dev_warn(hsotg->dev, "%s(): trimming xfer length\n", __func__);
1925 + dev_dbg(hsotg->dev, "%s(): trimming xfer length\n", __func__);
1926 xfer_length = urb->length - urb->actual_length;
1927 }
1928
1929 @@ -1921,6 +1921,18 @@ error:
1930 qtd->error_count++;
1931 dwc2_update_urb_state_abn(hsotg, chan, chnum, qtd->urb,
1932 qtd, DWC2_HC_XFER_XACT_ERR);
1933 + /*
1934 + * We can get here after a completed transaction
1935 + * (urb->actual_length >= urb->length) which was not reported
1936 + * as completed. If that is the case, and we do not abort
1937 + * the transfer, a transfer of size 0 will be enqueued
1938 + * subsequently. If urb->actual_length is not DMA-aligned,
1939 + * the buffer will then point to an unaligned address, and
1940 + * the resulting behavior is undefined. Bail out in that
1941 + * situation.
1942 + */
1943 + if (qtd->urb->actual_length >= qtd->urb->length)
1944 + qtd->error_count = 3;
1945 dwc2_hcd_save_data_toggle(hsotg, chan, chnum, qtd);
1946 dwc2_halt_channel(hsotg, chan, qtd, DWC2_HC_XFER_XACT_ERR);
1947 }
1948 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
1949 index bf36eda082d65..e0fb7b3723c53 100644
1950 --- a/drivers/usb/dwc3/gadget.c
1951 +++ b/drivers/usb/dwc3/gadget.c
1952 @@ -528,8 +528,23 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
1953 params.param0 |= DWC3_DEPCFG_FIFO_NUMBER(dep->number >> 1);
1954
1955 if (desc->bInterval) {
1956 - params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(desc->bInterval - 1);
1957 - dep->interval = 1 << (desc->bInterval - 1);
1958 + u8 bInterval_m1;
1959 +
1960 + /*
1961 + * Valid range for DEPCFG.bInterval_m1 is from 0 to 13, and it
1962 + * must be set to 0 when the controller operates in full-speed.
1963 + */
1964 + bInterval_m1 = min_t(u8, desc->bInterval - 1, 13);
1965 + if (dwc->gadget.speed == USB_SPEED_FULL)
1966 + bInterval_m1 = 0;
1967 +
1968 + if (usb_endpoint_type(desc) == USB_ENDPOINT_XFER_INT &&
1969 + dwc->gadget.speed == USB_SPEED_FULL)
1970 + dep->interval = desc->bInterval;
1971 + else
1972 + dep->interval = 1 << (desc->bInterval - 1);
1973 +
1974 + params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1);
1975 }
1976
1977 return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, &params);
1978 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
1979 index c232229162e0c..fcc709c043f09 100644
1980 --- a/drivers/usb/musb/musb_core.c
1981 +++ b/drivers/usb/musb/musb_core.c
1982 @@ -2097,32 +2097,35 @@ int musb_queue_resume_work(struct musb *musb,
1983 {
1984 struct musb_pending_work *w;
1985 unsigned long flags;
1986 + bool is_suspended;
1987 int error;
1988
1989 if (WARN_ON(!callback))
1990 return -EINVAL;
1991
1992 - if (pm_runtime_active(musb->controller))
1993 - return callback(musb, data);
1994 + spin_lock_irqsave(&musb->list_lock, flags);
1995 + is_suspended = musb->is_runtime_suspended;
1996 +
1997 + if (is_suspended) {
1998 + w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
1999 + if (!w) {
2000 + error = -ENOMEM;
2001 + goto out_unlock;
2002 + }
2003
2004 - w = devm_kzalloc(musb->controller, sizeof(*w), GFP_ATOMIC);
2005 - if (!w)
2006 - return -ENOMEM;
2007 + w->callback = callback;
2008 + w->data = data;
2009
2010 - w->callback = callback;
2011 - w->data = data;
2012 - spin_lock_irqsave(&musb->list_lock, flags);
2013 - if (musb->is_runtime_suspended) {
2014 list_add_tail(&w->node, &musb->pending_list);
2015 error = 0;
2016 - } else {
2017 - dev_err(musb->controller, "could not add resume work %p\n",
2018 - callback);
2019 - devm_kfree(musb->controller, w);
2020 - error = -EINPROGRESS;
2021 }
2022 +
2023 +out_unlock:
2024 spin_unlock_irqrestore(&musb->list_lock, flags);
2025
2026 + if (!is_suspended)
2027 + error = callback(musb, data);
2028 +
2029 return error;
2030 }
2031 EXPORT_SYMBOL_GPL(musb_queue_resume_work);
2032 diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
2033 index f6a1ae8abb214..7af85c10caea1 100644
2034 --- a/drivers/usb/renesas_usbhs/fifo.c
2035 +++ b/drivers/usb/renesas_usbhs/fifo.c
2036 @@ -140,6 +140,8 @@ struct usbhs_pkt *usbhs_pkt_pop(struct usbhs_pipe *pipe, struct usbhs_pkt *pkt)
2037 usbhsf_dma_unmap(pkt);
2038 }
2039
2040 + usbhs_pipe_running(pipe, 0);
2041 +
2042 __usbhsf_pkt_del(pkt);
2043 }
2044
2045 diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
2046 index 76c9276b2d75f..b16e37f43247b 100644
2047 --- a/drivers/usb/serial/mos7720.c
2048 +++ b/drivers/usb/serial/mos7720.c
2049 @@ -1239,8 +1239,10 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
2050 if (urb->transfer_buffer == NULL) {
2051 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
2052 GFP_ATOMIC);
2053 - if (!urb->transfer_buffer)
2054 + if (!urb->transfer_buffer) {
2055 + bytes_sent = -ENOMEM;
2056 goto exit;
2057 + }
2058 }
2059 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
2060
2061 diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
2062 index 0c92252c93163..31ca5d925b364 100644
2063 --- a/drivers/usb/serial/mos7840.c
2064 +++ b/drivers/usb/serial/mos7840.c
2065 @@ -1362,8 +1362,10 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
2066 if (urb->transfer_buffer == NULL) {
2067 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
2068 GFP_ATOMIC);
2069 - if (!urb->transfer_buffer)
2070 + if (!urb->transfer_buffer) {
2071 + bytes_sent = -ENOMEM;
2072 goto exit;
2073 + }
2074 }
2075 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
2076
2077 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2078 index 3c536eed07541..351be73862809 100644
2079 --- a/drivers/usb/serial/option.c
2080 +++ b/drivers/usb/serial/option.c
2081 @@ -1551,7 +1551,8 @@ static const struct usb_device_id option_ids[] = {
2082 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1272, 0xff, 0xff, 0xff) },
2083 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1273, 0xff, 0xff, 0xff) },
2084 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1274, 0xff, 0xff, 0xff) },
2085 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1275, 0xff, 0xff, 0xff) },
2086 + { USB_DEVICE(ZTE_VENDOR_ID, 0x1275), /* ZTE P685M */
2087 + .driver_info = RSVD(3) | RSVD(4) },
2088 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1276, 0xff, 0xff, 0xff) },
2089 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1277, 0xff, 0xff, 0xff) },
2090 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1278, 0xff, 0xff, 0xff) },
2091 diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
2092 index 5d3b0db5ce0af..c0d4e645f3b51 100644
2093 --- a/drivers/video/fbdev/Kconfig
2094 +++ b/drivers/video/fbdev/Kconfig
2095 @@ -1405,6 +1405,7 @@ config FB_ATY
2096 select FB_CFB_IMAGEBLIT
2097 select FB_BACKLIGHT if FB_ATY_BACKLIGHT
2098 select FB_MACMODES if PPC
2099 + select FB_ATY_CT if SPARC64 && PCI
2100 help
2101 This driver supports graphics boards with the ATI Mach64 chips.
2102 Say Y if you have such a graphics board.
2103 @@ -1415,7 +1416,6 @@ config FB_ATY
2104 config FB_ATY_CT
2105 bool "Mach64 CT/VT/GT/LT (incl. 3D RAGE) support"
2106 depends on PCI && FB_ATY
2107 - default y if SPARC64 && PCI
2108 help
2109 Say Y here to support use of ATI's 64-bit Rage boards (or other
2110 boards based on the Mach64 CT, VT, GT, and LT chipsets) as a
2111 diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
2112 index 89eeca5bb23e5..0eebd0bd6bc0e 100644
2113 --- a/fs/btrfs/ctree.c
2114 +++ b/fs/btrfs/ctree.c
2115 @@ -279,9 +279,12 @@ int btrfs_copy_root(struct btrfs_trans_handle *trans,
2116 ret = btrfs_inc_ref(trans, root, cow, 1);
2117 else
2118 ret = btrfs_inc_ref(trans, root, cow, 0);
2119 -
2120 - if (ret)
2121 + if (ret) {
2122 + btrfs_tree_unlock(cow);
2123 + free_extent_buffer(cow);
2124 + btrfs_abort_transaction(trans, ret);
2125 return ret;
2126 + }
2127
2128 btrfs_mark_buffer_dirty(cow);
2129 *cow_ret = cow;
2130 diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
2131 index 8e93bd391b352..f74cb39a64e5e 100644
2132 --- a/fs/btrfs/free-space-cache.c
2133 +++ b/fs/btrfs/free-space-cache.c
2134 @@ -753,8 +753,10 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
2135 while (num_entries) {
2136 e = kmem_cache_zalloc(btrfs_free_space_cachep,
2137 GFP_NOFS);
2138 - if (!e)
2139 + if (!e) {
2140 + ret = -ENOMEM;
2141 goto free_cache;
2142 + }
2143
2144 ret = io_ctl_read_entry(&io_ctl, e, &type);
2145 if (ret) {
2146 @@ -763,6 +765,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
2147 }
2148
2149 if (!e->bytes) {
2150 + ret = -1;
2151 kmem_cache_free(btrfs_free_space_cachep, e);
2152 goto free_cache;
2153 }
2154 @@ -782,6 +785,7 @@ static int __load_free_space_cache(struct btrfs_root *root, struct inode *inode,
2155 num_bitmaps--;
2156 e->bitmap = kzalloc(PAGE_SIZE, GFP_NOFS);
2157 if (!e->bitmap) {
2158 + ret = -ENOMEM;
2159 kmem_cache_free(
2160 btrfs_free_space_cachep, e);
2161 goto free_cache;
2162 diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
2163 index 1003b983a8d7a..cd5b86d80e7a0 100644
2164 --- a/fs/btrfs/relocation.c
2165 +++ b/fs/btrfs/relocation.c
2166 @@ -1335,9 +1335,7 @@ static void __del_reloc_root(struct btrfs_root *root)
2167 RB_CLEAR_NODE(&node->rb_node);
2168 }
2169 spin_unlock(&rc->reloc_root_tree.lock);
2170 - if (!node)
2171 - return;
2172 - BUG_ON((struct btrfs_root *)node->data != root);
2173 + ASSERT(!node || (struct btrfs_root *)node->data == root);
2174 }
2175
2176 spin_lock(&root->fs_info->trans_lock);
2177 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
2178 index af78de9ef036c..8508dc8270593 100644
2179 --- a/fs/cifs/connect.c
2180 +++ b/fs/cifs/connect.c
2181 @@ -3488,6 +3488,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
2182 cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
2183 if (cifs_sb->prepath == NULL)
2184 return -ENOMEM;
2185 + cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
2186 }
2187
2188 return 0;
2189 diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
2190 index 0bedcd70b51f4..17f1398929353 100644
2191 --- a/fs/f2fs/file.c
2192 +++ b/fs/f2fs/file.c
2193 @@ -682,7 +682,8 @@ static void __setattr_copy(struct inode *inode, const struct iattr *attr)
2194 if (ia_valid & ATTR_MODE) {
2195 umode_t mode = attr->ia_mode;
2196
2197 - if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
2198 + if (!in_group_p(inode->i_gid) &&
2199 + !capable_wrt_inode_uidgid(inode, CAP_FSETID))
2200 mode &= ~S_ISGID;
2201 set_acl_inode(inode, mode);
2202 }
2203 diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
2204 index 3c3d037df824e..3cbc9147286dd 100644
2205 --- a/fs/gfs2/lock_dlm.c
2206 +++ b/fs/gfs2/lock_dlm.c
2207 @@ -284,7 +284,6 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
2208 {
2209 struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
2210 struct lm_lockstruct *ls = &sdp->sd_lockstruct;
2211 - int lvb_needs_unlock = 0;
2212 int error;
2213
2214 if (gl->gl_lksb.sb_lkid == 0) {
2215 @@ -297,13 +296,10 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
2216 gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
2217 gfs2_update_request_times(gl);
2218
2219 - /* don't want to skip dlm_unlock writing the lvb when lock is ex */
2220 -
2221 - if (gl->gl_lksb.sb_lvbptr && (gl->gl_state == LM_ST_EXCLUSIVE))
2222 - lvb_needs_unlock = 1;
2223 + /* don't want to skip dlm_unlock writing the lvb when lock has one */
2224
2225 if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
2226 - !lvb_needs_unlock) {
2227 + !gl->gl_lksb.sb_lvbptr) {
2228 gfs2_glock_free(gl);
2229 return;
2230 }
2231 diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
2232 index e7599615e4e04..e876a30f90735 100644
2233 --- a/fs/isofs/dir.c
2234 +++ b/fs/isofs/dir.c
2235 @@ -151,6 +151,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,
2236 printk(KERN_NOTICE "iso9660: Corrupted directory entry"
2237 " in block %lu of inode %lu\n", block,
2238 inode->i_ino);
2239 + brelse(bh);
2240 return -EIO;
2241 }
2242
2243 diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c
2244 index aee592767f1d0..2c43de1b034d2 100644
2245 --- a/fs/isofs/namei.c
2246 +++ b/fs/isofs/namei.c
2247 @@ -101,6 +101,7 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry,
2248 printk(KERN_NOTICE "iso9660: Corrupted directory entry"
2249 " in block %lu of inode %lu\n", block,
2250 dir->i_ino);
2251 + brelse(bh);
2252 return 0;
2253 }
2254
2255 diff --git a/fs/jffs2/summary.c b/fs/jffs2/summary.c
2256 index be7c8a6a57480..4fe64519870f1 100644
2257 --- a/fs/jffs2/summary.c
2258 +++ b/fs/jffs2/summary.c
2259 @@ -783,6 +783,8 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
2260 dbg_summary("Writing unknown RWCOMPAT_COPY node type %x\n",
2261 je16_to_cpu(temp->u.nodetype));
2262 jffs2_sum_disable_collecting(c->summary);
2263 + /* The above call removes the list, nothing more to do */
2264 + goto bail_rwcompat;
2265 } else {
2266 BUG(); /* unknown node in summary information */
2267 }
2268 @@ -794,6 +796,7 @@ static int jffs2_sum_write_data(struct jffs2_sb_info *c, struct jffs2_eraseblock
2269
2270 c->summary->sum_num--;
2271 }
2272 + bail_rwcompat:
2273
2274 jffs2_sum_reset_collected(c->summary);
2275
2276 diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
2277 index 2d514c7affc2a..9ff510a489cb1 100644
2278 --- a/fs/jfs/jfs_dmap.c
2279 +++ b/fs/jfs/jfs_dmap.c
2280 @@ -1669,7 +1669,7 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
2281 } else if (rc == -ENOSPC) {
2282 /* search for next smaller log2 block */
2283 l2nb = BLKSTOL2(nblocks) - 1;
2284 - nblocks = 1 << l2nb;
2285 + nblocks = 1LL << l2nb;
2286 } else {
2287 /* Trim any already allocated blocks */
2288 jfs_error(bmp->db_ipbmap->i_sb, "-EIO\n");
2289 diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
2290 index 2aa073b82d30f..a4fa548785d60 100644
2291 --- a/fs/ntfs/inode.c
2292 +++ b/fs/ntfs/inode.c
2293 @@ -661,6 +661,12 @@ static int ntfs_read_locked_inode(struct inode *vi)
2294 }
2295 a = ctx->attr;
2296 /* Get the standard information attribute value. */
2297 + if ((u8 *)a + le16_to_cpu(a->data.resident.value_offset)
2298 + + le32_to_cpu(a->data.resident.value_length) >
2299 + (u8 *)ctx->mrec + vol->mft_record_size) {
2300 + ntfs_error(vi->i_sb, "Corrupt standard information attribute in inode.");
2301 + goto unm_err_out;
2302 + }
2303 si = (STANDARD_INFORMATION*)((u8*)a +
2304 le16_to_cpu(a->data.resident.value_offset));
2305
2306 diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
2307 index 5e8709aa1e7ec..89c71d32dc05b 100644
2308 --- a/fs/ocfs2/cluster/heartbeat.c
2309 +++ b/fs/ocfs2/cluster/heartbeat.c
2310 @@ -2155,7 +2155,7 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
2311 o2hb_nego_timeout_handler,
2312 reg, NULL, &reg->hr_handler_list);
2313 if (ret)
2314 - goto free;
2315 + goto remove_item;
2316
2317 ret = o2net_register_handler(O2HB_NEGO_APPROVE_MSG, reg->hr_key,
2318 sizeof(struct o2hb_nego_msg),
2319 @@ -2174,6 +2174,12 @@ static struct config_item *o2hb_heartbeat_group_make_item(struct config_group *g
2320
2321 unregister_handler:
2322 o2net_unregister_handler_list(&reg->hr_handler_list);
2323 +remove_item:
2324 + spin_lock(&o2hb_live_lock);
2325 + list_del(&reg->hr_all_item);
2326 + if (o2hb_global_heartbeat_active())
2327 + clear_bit(reg->hr_region_num, o2hb_region_bitmap);
2328 + spin_unlock(&o2hb_live_lock);
2329 free:
2330 kfree(reg);
2331 return ERR_PTR(ret);
2332 diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
2333 index 57086e9fc64c6..d87dabac04c1b 100644
2334 --- a/include/linux/icmpv6.h
2335 +++ b/include/linux/icmpv6.h
2336 @@ -2,6 +2,7 @@
2337 #define _LINUX_ICMPV6_H
2338
2339 #include <linux/skbuff.h>
2340 +#include <linux/ipv6.h>
2341 #include <uapi/linux/icmpv6.h>
2342
2343 static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
2344 @@ -12,21 +13,64 @@ static inline struct icmp6hdr *icmp6_hdr(const struct sk_buff *skb)
2345 #include <linux/netdevice.h>
2346
2347 #if IS_ENABLED(CONFIG_IPV6)
2348 -extern void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info);
2349
2350 typedef void ip6_icmp_send_t(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2351 - const struct in6_addr *force_saddr);
2352 + const struct in6_addr *force_saddr,
2353 + const struct inet6_skb_parm *parm);
2354 +void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2355 + const struct in6_addr *force_saddr,
2356 + const struct inet6_skb_parm *parm);
2357 +#if IS_BUILTIN(CONFIG_IPV6)
2358 +static inline void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2359 + const struct inet6_skb_parm *parm)
2360 +{
2361 + icmp6_send(skb, type, code, info, NULL, parm);
2362 +}
2363 +static inline int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
2364 +{
2365 + BUILD_BUG_ON(fn != icmp6_send);
2366 + return 0;
2367 +}
2368 +static inline int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
2369 +{
2370 + BUILD_BUG_ON(fn != icmp6_send);
2371 + return 0;
2372 +}
2373 +#else
2374 +extern void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2375 + const struct inet6_skb_parm *parm);
2376 extern int inet6_register_icmp_sender(ip6_icmp_send_t *fn);
2377 extern int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn);
2378 +#endif
2379 +
2380 +static inline void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
2381 +{
2382 + __icmpv6_send(skb, type, code, info, IP6CB(skb));
2383 +}
2384 +
2385 int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
2386 unsigned int data_len);
2387
2388 +#if IS_ENABLED(CONFIG_NF_NAT)
2389 +void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info);
2390 +#else
2391 +static inline void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
2392 +{
2393 + struct inet6_skb_parm parm = { 0 };
2394 + __icmpv6_send(skb_in, type, code, info, &parm);
2395 +}
2396 +#endif
2397 +
2398 #else
2399
2400 static inline void icmpv6_send(struct sk_buff *skb,
2401 u8 type, u8 code, __u32 info)
2402 {
2403 +}
2404
2405 +static inline void icmpv6_ndo_send(struct sk_buff *skb,
2406 + u8 type, u8 code, __u32 info)
2407 +{
2408 }
2409 #endif
2410
2411 diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
2412 index b9dfca557a6c2..97a4e1667f73d 100644
2413 --- a/include/linux/ipv6.h
2414 +++ b/include/linux/ipv6.h
2415 @@ -2,6 +2,7 @@
2416 #define _IPV6_H
2417
2418 #include <uapi/linux/ipv6.h>
2419 +#include <uapi/linux/icmpv6.h>
2420
2421 #define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
2422 #define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
2423 @@ -73,7 +74,6 @@ struct ipv6_params {
2424 __s32 autoconf;
2425 };
2426 extern struct ipv6_params ipv6_defaults;
2427 -#include <linux/icmpv6.h>
2428 #include <linux/tcp.h>
2429 #include <linux/udp.h>
2430
2431 diff --git a/include/net/icmp.h b/include/net/icmp.h
2432 index 8665bf24e3b7a..ffe4a5d2bbe7e 100644
2433 --- a/include/net/icmp.h
2434 +++ b/include/net/icmp.h
2435 @@ -47,6 +47,16 @@ static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32
2436 __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
2437 }
2438
2439 +#if IS_ENABLED(CONFIG_NF_NAT)
2440 +void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info);
2441 +#else
2442 +static inline void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
2443 +{
2444 + struct ip_options opts = { 0 };
2445 + __icmp_send(skb_in, type, code, info, &opts);
2446 +}
2447 +#endif
2448 +
2449 int icmp_rcv(struct sk_buff *skb);
2450 void icmp_err(struct sk_buff *skb, u32 info);
2451 int icmp_init(void);
2452 diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h
2453 index 533e04e75a9c4..f51b762d68864 100644
2454 --- a/kernel/debug/kdb/kdb_private.h
2455 +++ b/kernel/debug/kdb/kdb_private.h
2456 @@ -234,7 +234,7 @@ extern struct task_struct *kdb_curr_task(int);
2457 #define kdb_do_each_thread(g, p) do_each_thread(g, p)
2458 #define kdb_while_each_thread(g, p) while_each_thread(g, p)
2459
2460 -#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL)
2461 +#define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)
2462
2463 extern void *debug_kmalloc(size_t size, gfp_t flags);
2464 extern void debug_kfree(void *);
2465 diff --git a/kernel/futex.c b/kernel/futex.c
2466 index b65dbb5d60bb1..0b49a8e1e1bec 100644
2467 --- a/kernel/futex.c
2468 +++ b/kernel/futex.c
2469 @@ -1207,11 +1207,11 @@ static int handle_exit_race(u32 __user *uaddr, u32 uval,
2470 u32 uval2;
2471
2472 /*
2473 - * If the futex exit state is not yet FUTEX_STATE_DEAD, wait
2474 - * for it to finish.
2475 + * If the futex exit state is not yet FUTEX_STATE_DEAD, tell the
2476 + * caller that the alleged owner is busy.
2477 */
2478 if (tsk && tsk->futex_state != FUTEX_STATE_DEAD)
2479 - return -EAGAIN;
2480 + return -EBUSY;
2481
2482 /*
2483 * Reread the user space value to handle the following situation:
2484 @@ -2424,9 +2424,6 @@ static int __fixup_pi_state_owner(u32 __user *uaddr, struct futex_q *q,
2485 int err = 0;
2486
2487 oldowner = pi_state->owner;
2488 - /* Owner died? */
2489 - if (!pi_state->owner)
2490 - newtid |= FUTEX_OWNER_DIED;
2491
2492 /*
2493 * We are here because either:
2494 @@ -2484,6 +2481,9 @@ retry:
2495 }
2496
2497 newtid = task_pid_vnr(newowner) | FUTEX_WAITERS;
2498 + /* Owner died? */
2499 + if (!pi_state->owner)
2500 + newtid |= FUTEX_OWNER_DIED;
2501
2502 if (get_futex_value_locked(&uval, uaddr))
2503 goto handle_fault;
2504 diff --git a/kernel/module.c b/kernel/module.c
2505 index 0219301b6109c..cc401a7ffc2e3 100644
2506 --- a/kernel/module.c
2507 +++ b/kernel/module.c
2508 @@ -2209,6 +2209,21 @@ static int verify_export_symbols(struct module *mod)
2509 return 0;
2510 }
2511
2512 +static bool ignore_undef_symbol(Elf_Half emachine, const char *name)
2513 +{
2514 + /*
2515 + * On x86, PIC code and Clang non-PIC code may have call foo@PLT. GNU as
2516 + * before 2.37 produces an unreferenced _GLOBAL_OFFSET_TABLE_ on x86-64.
2517 + * i386 has a similar problem but may not deserve a fix.
2518 + *
2519 + * If we ever have to ignore many symbols, consider refactoring the code to
2520 + * only warn if referenced by a relocation.
2521 + */
2522 + if (emachine == EM_386 || emachine == EM_X86_64)
2523 + return !strcmp(name, "_GLOBAL_OFFSET_TABLE_");
2524 + return false;
2525 +}
2526 +
2527 /* Change all symbols so that st_value encodes the pointer directly. */
2528 static int simplify_symbols(struct module *mod, const struct load_info *info)
2529 {
2530 @@ -2254,8 +2269,10 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
2531 break;
2532 }
2533
2534 - /* Ok if weak. */
2535 - if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
2536 + /* Ok if weak or ignored. */
2537 + if (!ksym &&
2538 + (ELF_ST_BIND(sym[i].st_info) == STB_WEAK ||
2539 + ignore_undef_symbol(info->hdr->e_machine, name)))
2540 break;
2541
2542 pr_warn("%s: Unknown symbol %s (err %li)\n",
2543 diff --git a/kernel/seccomp.c b/kernel/seccomp.c
2544 index 3975856d476c2..ac56ebffeb955 100644
2545 --- a/kernel/seccomp.c
2546 +++ b/kernel/seccomp.c
2547 @@ -669,6 +669,8 @@ static int __seccomp_filter(int this_syscall, const struct seccomp_data *sd,
2548 const bool recheck_after_trace)
2549 {
2550 BUG();
2551 +
2552 + return -1;
2553 }
2554 #endif
2555
2556 diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
2557 index c8e7cc0e6ff6e..88ae873ee6cf3 100644
2558 --- a/kernel/tracepoint.c
2559 +++ b/kernel/tracepoint.c
2560 @@ -59,6 +59,12 @@ struct tp_probes {
2561 struct tracepoint_func probes[0];
2562 };
2563
2564 +/* Called in removal of a func but failed to allocate a new tp_funcs */
2565 +static void tp_stub_func(void)
2566 +{
2567 + return;
2568 +}
2569 +
2570 static inline void *allocate_probes(int count)
2571 {
2572 struct tp_probes *p = kmalloc(count * sizeof(struct tracepoint_func)
2573 @@ -97,6 +103,7 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,
2574 {
2575 struct tracepoint_func *old, *new;
2576 int nr_probes = 0;
2577 + int stub_funcs = 0;
2578 int pos = -1;
2579
2580 if (WARN_ON(!tp_func->func))
2581 @@ -113,14 +120,34 @@ func_add(struct tracepoint_func **funcs, struct tracepoint_func *tp_func,
2582 if (old[nr_probes].func == tp_func->func &&
2583 old[nr_probes].data == tp_func->data)
2584 return ERR_PTR(-EEXIST);
2585 + if (old[nr_probes].func == tp_stub_func)
2586 + stub_funcs++;
2587 }
2588 }
2589 - /* + 2 : one for new probe, one for NULL func */
2590 - new = allocate_probes(nr_probes + 2);
2591 + /* + 2 : one for new probe, one for NULL func - stub functions */
2592 + new = allocate_probes(nr_probes + 2 - stub_funcs);
2593 if (new == NULL)
2594 return ERR_PTR(-ENOMEM);
2595 if (old) {
2596 - if (pos < 0) {
2597 + if (stub_funcs) {
2598 + /* Need to copy one at a time to remove stubs */
2599 + int probes = 0;
2600 +
2601 + pos = -1;
2602 + for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
2603 + if (old[nr_probes].func == tp_stub_func)
2604 + continue;
2605 + if (pos < 0 && old[nr_probes].prio < prio)
2606 + pos = probes++;
2607 + new[probes++] = old[nr_probes];
2608 + }
2609 + nr_probes = probes;
2610 + if (pos < 0)
2611 + pos = probes;
2612 + else
2613 + nr_probes--; /* Account for insertion */
2614 +
2615 + } else if (pos < 0) {
2616 pos = nr_probes;
2617 memcpy(new, old, nr_probes * sizeof(struct tracepoint_func));
2618 } else {
2619 @@ -154,8 +181,9 @@ static void *func_remove(struct tracepoint_func **funcs,
2620 /* (N -> M), (N > 1, M >= 0) probes */
2621 if (tp_func->func) {
2622 for (nr_probes = 0; old[nr_probes].func; nr_probes++) {
2623 - if (old[nr_probes].func == tp_func->func &&
2624 - old[nr_probes].data == tp_func->data)
2625 + if ((old[nr_probes].func == tp_func->func &&
2626 + old[nr_probes].data == tp_func->data) ||
2627 + old[nr_probes].func == tp_stub_func)
2628 nr_del++;
2629 }
2630 }
2631 @@ -174,14 +202,32 @@ static void *func_remove(struct tracepoint_func **funcs,
2632 /* N -> M, (N > 1, M > 0) */
2633 /* + 1 for NULL */
2634 new = allocate_probes(nr_probes - nr_del + 1);
2635 - if (new == NULL)
2636 - return ERR_PTR(-ENOMEM);
2637 - for (i = 0; old[i].func; i++)
2638 - if (old[i].func != tp_func->func
2639 - || old[i].data != tp_func->data)
2640 - new[j++] = old[i];
2641 - new[nr_probes - nr_del].func = NULL;
2642 - *funcs = new;
2643 + if (new) {
2644 + for (i = 0; old[i].func; i++)
2645 + if ((old[i].func != tp_func->func
2646 + || old[i].data != tp_func->data)
2647 + && old[i].func != tp_stub_func)
2648 + new[j++] = old[i];
2649 + new[nr_probes - nr_del].func = NULL;
2650 + *funcs = new;
2651 + } else {
2652 + /*
2653 + * Failed to allocate, replace the old function
2654 + * with calls to tp_stub_func.
2655 + */
2656 + for (i = 0; old[i].func; i++)
2657 + if (old[i].func == tp_func->func &&
2658 + old[i].data == tp_func->data) {
2659 + old[i].func = tp_stub_func;
2660 + /* Set the prio to the next event. */
2661 + if (old[i + 1].func)
2662 + old[i].prio =
2663 + old[i + 1].prio;
2664 + else
2665 + old[i].prio = -1;
2666 + }
2667 + *funcs = old;
2668 + }
2669 }
2670 debug_print_probes(*funcs);
2671 return old;
2672 @@ -234,10 +280,12 @@ static int tracepoint_remove_func(struct tracepoint *tp,
2673 tp_funcs = rcu_dereference_protected(tp->funcs,
2674 lockdep_is_held(&tracepoints_mutex));
2675 old = func_remove(&tp_funcs, func);
2676 - if (IS_ERR(old)) {
2677 - WARN_ON_ONCE(PTR_ERR(old) != -ENOMEM);
2678 + if (WARN_ON_ONCE(IS_ERR(old)))
2679 return PTR_ERR(old);
2680 - }
2681 +
2682 + if (tp_funcs == old)
2683 + /* Failed allocating new tp_funcs, replaced func with stub */
2684 + return 0;
2685
2686 if (!tp_funcs) {
2687 /* Removed last function */
2688 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
2689 index 05ca01ef97f7f..14cd0ef33b628 100644
2690 --- a/mm/huge_memory.c
2691 +++ b/mm/huge_memory.c
2692 @@ -1022,6 +1022,19 @@ int do_huge_pmd_wp_page(struct fault_env *fe, pmd_t orig_pmd)
2693 * We can only reuse the page if nobody else maps the huge page or it's
2694 * part.
2695 */
2696 + if (!trylock_page(page)) {
2697 + get_page(page);
2698 + spin_unlock(fe->ptl);
2699 + lock_page(page);
2700 + spin_lock(fe->ptl);
2701 + if (unlikely(!pmd_same(*fe->pmd, orig_pmd))) {
2702 + unlock_page(page);
2703 + put_page(page);
2704 + goto out_unlock;
2705 + }
2706 + put_page(page);
2707 + }
2708 +
2709 if (page_trans_huge_mapcount(page, NULL) == 1) {
2710 pmd_t entry;
2711 entry = pmd_mkyoung(orig_pmd);
2712 @@ -1029,8 +1042,10 @@ int do_huge_pmd_wp_page(struct fault_env *fe, pmd_t orig_pmd)
2713 if (pmdp_set_access_flags(vma, haddr, fe->pmd, entry, 1))
2714 update_mmu_cache_pmd(vma, fe->address, fe->pmd);
2715 ret |= VM_FAULT_WRITE;
2716 + unlock_page(page);
2717 goto out_unlock;
2718 }
2719 + unlock_page(page);
2720 get_page(page);
2721 spin_unlock(fe->ptl);
2722 alloc:
2723 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2724 index 5a16d892c891c..e814cc1785354 100644
2725 --- a/mm/hugetlb.c
2726 +++ b/mm/hugetlb.c
2727 @@ -66,6 +66,21 @@ DEFINE_SPINLOCK(hugetlb_lock);
2728 static int num_fault_mutexes;
2729 struct mutex *hugetlb_fault_mutex_table ____cacheline_aligned_in_smp;
2730
2731 +static inline bool PageHugeFreed(struct page *head)
2732 +{
2733 + return page_private(head + 4) == -1UL;
2734 +}
2735 +
2736 +static inline void SetPageHugeFreed(struct page *head)
2737 +{
2738 + set_page_private(head + 4, -1UL);
2739 +}
2740 +
2741 +static inline void ClearPageHugeFreed(struct page *head)
2742 +{
2743 + set_page_private(head + 4, 0);
2744 +}
2745 +
2746 /* Forward declaration */
2747 static int hugetlb_acct_memory(struct hstate *h, long delta);
2748
2749 @@ -863,6 +878,7 @@ static void enqueue_huge_page(struct hstate *h, struct page *page)
2750 list_move(&page->lru, &h->hugepage_freelists[nid]);
2751 h->free_huge_pages++;
2752 h->free_huge_pages_node[nid]++;
2753 + SetPageHugeFreed(page);
2754 }
2755
2756 static struct page *dequeue_huge_page_node(struct hstate *h, int nid)
2757 @@ -880,6 +896,7 @@ static struct page *dequeue_huge_page_node(struct hstate *h, int nid)
2758 return NULL;
2759 list_move(&page->lru, &h->hugepage_activelist);
2760 set_page_refcounted(page);
2761 + ClearPageHugeFreed(page);
2762 h->free_huge_pages--;
2763 h->free_huge_pages_node[nid]--;
2764 return page;
2765 @@ -1292,6 +1309,7 @@ static void prep_new_huge_page(struct hstate *h, struct page *page, int nid)
2766 set_hugetlb_cgroup(page, NULL);
2767 h->nr_huge_pages++;
2768 h->nr_huge_pages_node[nid]++;
2769 + ClearPageHugeFreed(page);
2770 spin_unlock(&hugetlb_lock);
2771 put_page(page); /* free it into the hugepage allocator */
2772 }
2773 @@ -1455,6 +1473,7 @@ static int dissolve_free_huge_page(struct page *page)
2774 {
2775 int rc = 0;
2776
2777 +retry:
2778 spin_lock(&hugetlb_lock);
2779 if (PageHuge(page) && !page_count(page)) {
2780 struct page *head = compound_head(page);
2781 @@ -1464,6 +1483,26 @@ static int dissolve_free_huge_page(struct page *page)
2782 rc = -EBUSY;
2783 goto out;
2784 }
2785 +
2786 + /*
2787 + * We should make sure that the page is already on the free list
2788 + * when it is dissolved.
2789 + */
2790 + if (unlikely(!PageHugeFreed(head))) {
2791 + spin_unlock(&hugetlb_lock);
2792 + cond_resched();
2793 +
2794 + /*
2795 + * Theoretically, we should return -EBUSY when we
2796 + * encounter this race. In fact, we have a chance
2797 + * to successfully dissolve the page if we do a
2798 + * retry. Because the race window is quite small.
2799 + * If we seize this opportunity, it is an optimization
2800 + * for increasing the success rate of dissolving page.
2801 + */
2802 + goto retry;
2803 + }
2804 +
2805 list_del(&head->lru);
2806 h->free_huge_pages--;
2807 h->free_huge_pages_node[nid]--;
2808 @@ -2618,8 +2657,10 @@ static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent,
2809 return -ENOMEM;
2810
2811 retval = sysfs_create_group(hstate_kobjs[hi], hstate_attr_group);
2812 - if (retval)
2813 + if (retval) {
2814 kobject_put(hstate_kobjs[hi]);
2815 + hstate_kobjs[hi] = NULL;
2816 + }
2817
2818 return retval;
2819 }
2820 diff --git a/mm/memory.c b/mm/memory.c
2821 index 47248dc0b9e1a..d1cc9923320b4 100644
2822 --- a/mm/memory.c
2823 +++ b/mm/memory.c
2824 @@ -1687,11 +1687,11 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd,
2825 unsigned long addr, unsigned long end,
2826 unsigned long pfn, pgprot_t prot)
2827 {
2828 - pte_t *pte;
2829 + pte_t *pte, *mapped_pte;
2830 spinlock_t *ptl;
2831 int err = 0;
2832
2833 - pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
2834 + mapped_pte = pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
2835 if (!pte)
2836 return -ENOMEM;
2837 arch_enter_lazy_mmu_mode();
2838 @@ -1705,7 +1705,7 @@ static int remap_pte_range(struct mm_struct *mm, pmd_t *pmd,
2839 pfn++;
2840 } while (pte++, addr += PAGE_SIZE, addr != end);
2841 arch_leave_lazy_mmu_mode();
2842 - pte_unmap_unlock(pte - 1, ptl);
2843 + pte_unmap_unlock(mapped_pte, ptl);
2844 return err;
2845 }
2846
2847 diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
2848 index 8f918155685db..fcd819ffda108 100644
2849 --- a/net/bluetooth/a2mp.c
2850 +++ b/net/bluetooth/a2mp.c
2851 @@ -388,9 +388,9 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb,
2852 hdev = hci_dev_get(req->id);
2853 if (!hdev || hdev->amp_type == AMP_TYPE_BREDR || tmp) {
2854 struct a2mp_amp_assoc_rsp rsp;
2855 - rsp.id = req->id;
2856
2857 memset(&rsp, 0, sizeof(rsp));
2858 + rsp.id = req->id;
2859
2860 if (tmp) {
2861 rsp.status = A2MP_STATUS_COLLISION_OCCURED;
2862 @@ -519,6 +519,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
2863 assoc = kmemdup(req->amp_assoc, assoc_len, GFP_KERNEL);
2864 if (!assoc) {
2865 amp_ctrl_put(ctrl);
2866 + hci_dev_put(hdev);
2867 return -ENOMEM;
2868 }
2869
2870 diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
2871 index a70b078ceb3ca..02f44a408edbd 100644
2872 --- a/net/bluetooth/hci_core.c
2873 +++ b/net/bluetooth/hci_core.c
2874 @@ -1243,8 +1243,10 @@ int hci_inquiry(void __user *arg)
2875 * cleared). If it is interrupted by a signal, return -EINTR.
2876 */
2877 if (wait_on_bit(&hdev->flags, HCI_INQUIRY,
2878 - TASK_INTERRUPTIBLE))
2879 - return -EINTR;
2880 + TASK_INTERRUPTIBLE)) {
2881 + err = -EINTR;
2882 + goto done;
2883 + }
2884 }
2885
2886 /* for unlimited number of responses we will use buffer with
2887 diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2888 index 9a21080e24560..27518ea7ec3c8 100644
2889 --- a/net/ipv4/icmp.c
2890 +++ b/net/ipv4/icmp.c
2891 @@ -738,6 +738,40 @@ out:;
2892 }
2893 EXPORT_SYMBOL(__icmp_send);
2894
2895 +#if IS_ENABLED(CONFIG_NF_NAT)
2896 +#include <net/netfilter/nf_conntrack.h>
2897 +void icmp_ndo_send(struct sk_buff *skb_in, int type, int code, __be32 info)
2898 +{
2899 + struct sk_buff *cloned_skb = NULL;
2900 + struct ip_options opts = { 0 };
2901 + enum ip_conntrack_info ctinfo;
2902 + struct nf_conn *ct;
2903 + __be32 orig_ip;
2904 +
2905 + ct = nf_ct_get(skb_in, &ctinfo);
2906 + if (!ct || !(ct->status & IPS_SRC_NAT)) {
2907 + __icmp_send(skb_in, type, code, info, &opts);
2908 + return;
2909 + }
2910 +
2911 + if (skb_shared(skb_in))
2912 + skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
2913 +
2914 + if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
2915 + (skb_network_header(skb_in) + sizeof(struct iphdr)) >
2916 + skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
2917 + skb_network_offset(skb_in) + sizeof(struct iphdr))))
2918 + goto out;
2919 +
2920 + orig_ip = ip_hdr(skb_in)->saddr;
2921 + ip_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.ip;
2922 + __icmp_send(skb_in, type, code, info, &opts);
2923 + ip_hdr(skb_in)->saddr = orig_ip;
2924 +out:
2925 + consume_skb(cloned_skb);
2926 +}
2927 +EXPORT_SYMBOL(icmp_ndo_send);
2928 +#endif
2929
2930 static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
2931 {
2932 diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
2933 index 2772004ba5a18..c879a8202286e 100644
2934 --- a/net/ipv6/icmp.c
2935 +++ b/net/ipv6/icmp.c
2936 @@ -298,10 +298,9 @@ static int icmpv6_getfrag(void *from, char *to, int offset, int len, int odd, st
2937 }
2938
2939 #if IS_ENABLED(CONFIG_IPV6_MIP6)
2940 -static void mip6_addr_swap(struct sk_buff *skb)
2941 +static void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt)
2942 {
2943 struct ipv6hdr *iph = ipv6_hdr(skb);
2944 - struct inet6_skb_parm *opt = IP6CB(skb);
2945 struct ipv6_destopt_hao *hao;
2946 struct in6_addr tmp;
2947 int off;
2948 @@ -318,7 +317,7 @@ static void mip6_addr_swap(struct sk_buff *skb)
2949 }
2950 }
2951 #else
2952 -static inline void mip6_addr_swap(struct sk_buff *skb) {}
2953 +static inline void mip6_addr_swap(struct sk_buff *skb, const struct inet6_skb_parm *opt) {}
2954 #endif
2955
2956 static struct dst_entry *icmpv6_route_lookup(struct net *net,
2957 @@ -388,8 +387,9 @@ relookup_failed:
2958 /*
2959 * Send an ICMP message in response to a packet in error
2960 */
2961 -static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2962 - const struct in6_addr *force_saddr)
2963 +void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2964 + const struct in6_addr *force_saddr,
2965 + const struct inet6_skb_parm *parm)
2966 {
2967 struct net *net = dev_net(skb->dev);
2968 struct inet6_dev *idev = NULL;
2969 @@ -473,7 +473,7 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
2970 return;
2971 }
2972
2973 - mip6_addr_swap(skb);
2974 + mip6_addr_swap(skb, parm);
2975
2976 memset(&fl6, 0, sizeof(fl6));
2977 fl6.flowi6_proto = IPPROTO_ICMPV6;
2978 @@ -556,9 +556,10 @@ out:
2979 */
2980 void icmpv6_param_prob(struct sk_buff *skb, u8 code, int pos)
2981 {
2982 - icmp6_send(skb, ICMPV6_PARAMPROB, code, pos, NULL);
2983 + icmp6_send(skb, ICMPV6_PARAMPROB, code, pos, NULL, IP6CB(skb));
2984 kfree_skb(skb);
2985 }
2986 +EXPORT_SYMBOL(icmp6_send);
2987
2988 /* Generate icmpv6 with type/code ICMPV6_DEST_UNREACH/ICMPV6_ADDR_UNREACH
2989 * if sufficient data bytes are available
2990 @@ -612,10 +613,10 @@ int ip6_err_gen_icmpv6_unreach(struct sk_buff *skb, int nhs, int type,
2991 }
2992 if (type == ICMP_TIME_EXCEEDED)
2993 icmp6_send(skb2, ICMPV6_TIME_EXCEED, ICMPV6_EXC_HOPLIMIT,
2994 - info, &temp_saddr);
2995 + info, &temp_saddr, IP6CB(skb2));
2996 else
2997 icmp6_send(skb2, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH,
2998 - info, &temp_saddr);
2999 + info, &temp_saddr, IP6CB(skb2));
3000 if (rt)
3001 ip6_rt_put(rt);
3002
3003 diff --git a/net/ipv6/ip6_icmp.c b/net/ipv6/ip6_icmp.c
3004 index 713676f14a0ee..05287bc36dbdf 100644
3005 --- a/net/ipv6/ip6_icmp.c
3006 +++ b/net/ipv6/ip6_icmp.c
3007 @@ -8,6 +8,8 @@
3008
3009 #if IS_ENABLED(CONFIG_IPV6)
3010
3011 +#if !IS_BUILTIN(CONFIG_IPV6)
3012 +
3013 static ip6_icmp_send_t __rcu *ip6_icmp_send;
3014
3015 int inet6_register_icmp_sender(ip6_icmp_send_t *fn)
3016 @@ -30,18 +32,52 @@ int inet6_unregister_icmp_sender(ip6_icmp_send_t *fn)
3017 }
3018 EXPORT_SYMBOL(inet6_unregister_icmp_sender);
3019
3020 -void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info)
3021 +void __icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
3022 + const struct inet6_skb_parm *parm)
3023 {
3024 ip6_icmp_send_t *send;
3025
3026 rcu_read_lock();
3027 send = rcu_dereference(ip6_icmp_send);
3028 + if (send)
3029 + send(skb, type, code, info, NULL, parm);
3030 + rcu_read_unlock();
3031 +}
3032 +EXPORT_SYMBOL(__icmpv6_send);
3033 +#endif
3034 +
3035 +#if IS_ENABLED(CONFIG_NF_NAT)
3036 +#include <net/netfilter/nf_conntrack.h>
3037 +void icmpv6_ndo_send(struct sk_buff *skb_in, u8 type, u8 code, __u32 info)
3038 +{
3039 + struct inet6_skb_parm parm = { 0 };
3040 + struct sk_buff *cloned_skb = NULL;
3041 + enum ip_conntrack_info ctinfo;
3042 + struct in6_addr orig_ip;
3043 + struct nf_conn *ct;
3044
3045 - if (!send)
3046 + ct = nf_ct_get(skb_in, &ctinfo);
3047 + if (!ct || !(ct->status & IPS_SRC_NAT)) {
3048 + __icmpv6_send(skb_in, type, code, info, &parm);
3049 + return;
3050 + }
3051 +
3052 + if (skb_shared(skb_in))
3053 + skb_in = cloned_skb = skb_clone(skb_in, GFP_ATOMIC);
3054 +
3055 + if (unlikely(!skb_in || skb_network_header(skb_in) < skb_in->head ||
3056 + (skb_network_header(skb_in) + sizeof(struct ipv6hdr)) >
3057 + skb_tail_pointer(skb_in) || skb_ensure_writable(skb_in,
3058 + skb_network_offset(skb_in) + sizeof(struct ipv6hdr))))
3059 goto out;
3060 - send(skb, type, code, info, NULL);
3061 +
3062 + orig_ip = ipv6_hdr(skb_in)->saddr;
3063 + ipv6_hdr(skb_in)->saddr = ct->tuplehash[0].tuple.src.u3.in6;
3064 + __icmpv6_send(skb_in, type, code, info, &parm);
3065 + ipv6_hdr(skb_in)->saddr = orig_ip;
3066 out:
3067 - rcu_read_unlock();
3068 + consume_skb(cloned_skb);
3069 }
3070 -EXPORT_SYMBOL(icmpv6_send);
3071 +EXPORT_SYMBOL(icmpv6_ndo_send);
3072 +#endif
3073 #endif
3074 diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
3075 index 2fbd100b9e73d..a8b837d0498a4 100644
3076 --- a/net/mac80211/mesh_hwmp.c
3077 +++ b/net/mac80211/mesh_hwmp.c
3078 @@ -355,7 +355,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
3079 */
3080 tx_time = (device_constant + 10 * test_frame_len / rate);
3081 estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
3082 - result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
3083 + result = ((u64)tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
3084 return (u32)result;
3085 }
3086
3087 diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
3088 index faac4b10d8eaf..fb0d25ced2fb3 100755
3089 --- a/scripts/recordmcount.pl
3090 +++ b/scripts/recordmcount.pl
3091 @@ -261,7 +261,11 @@ if ($arch eq "x86_64") {
3092
3093 # force flags for this arch
3094 $ld .= " -m shlelf_linux";
3095 - $objcopy .= " -O elf32-sh-linux";
3096 + if ($endian eq "big") {
3097 + $objcopy .= " -O elf32-shbig-linux";
3098 + } else {
3099 + $objcopy .= " -O elf32-sh-linux";
3100 + }
3101
3102 } elsif ($arch eq "powerpc") {
3103 $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
3104 diff --git a/security/keys/trusted.c b/security/keys/trusted.c
3105 index 4ba2f6b912421..21e40a5c96c6c 100644
3106 --- a/security/keys/trusted.c
3107 +++ b/security/keys/trusted.c
3108 @@ -797,7 +797,7 @@ static int getoptions(char *c, struct trusted_key_payload *pay,
3109 case Opt_migratable:
3110 if (*args[0].from == '0')
3111 pay->migratable = 0;
3112 - else
3113 + else if (*args[0].from != '1')
3114 return -EINVAL;
3115 break;
3116 case Opt_pcrlock:
3117 diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c
3118 index 54c1768bc8185..a2535a7eb4bbd 100644
3119 --- a/sound/soc/codecs/cs42l56.c
3120 +++ b/sound/soc/codecs/cs42l56.c
3121 @@ -1270,6 +1270,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
3122 dev_err(&i2c_client->dev,
3123 "CS42L56 Device ID (%X). Expected %X\n",
3124 devid, CS42L56_DEVID);
3125 + ret = -EINVAL;
3126 goto err_enable;
3127 }
3128 alpha_rev = reg & CS42L56_AREV_MASK;
3129 @@ -1325,7 +1326,7 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client,
3130 ret = snd_soc_register_codec(&i2c_client->dev,
3131 &soc_codec_dev_cs42l56, &cs42l56_dai, 1);
3132 if (ret < 0)
3133 - return ret;
3134 + goto err_enable;
3135
3136 return 0;
3137
3138 diff --git a/tools/perf/tests/sample-parsing.c b/tools/perf/tests/sample-parsing.c
3139 index 5f23710b9fee6..60e5348f0a43f 100644
3140 --- a/tools/perf/tests/sample-parsing.c
3141 +++ b/tools/perf/tests/sample-parsing.c
3142 @@ -167,7 +167,7 @@ static int do_test(u64 sample_type, u64 sample_regs, u64 read_format)
3143 .data = {1, 211, 212, 213},
3144 };
3145 u64 regs[64];
3146 - const u64 raw_data[] = {0x123456780a0b0c0dULL, 0x1102030405060708ULL};
3147 + const u32 raw_data[] = {0x12345678, 0x0a0b0c0d, 0x11020304, 0x05060708, 0 };
3148 const u64 data[] = {0x2211443366558877ULL, 0, 0xaabbccddeeff4321ULL};
3149 struct perf_sample sample = {
3150 .ip = 101,
3151 diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
3152 index 659c41004322d..5742adf4d5e89 100644
3153 --- a/tools/perf/util/event.c
3154 +++ b/tools/perf/util/event.c
3155 @@ -1370,6 +1370,8 @@ int machine__resolve(struct machine *machine, struct addr_location *al,
3156 }
3157
3158 al->sym = map__find_symbol(al->map, al->addr);
3159 + } else if (symbol_conf.dso_list) {
3160 + al->filtered |= (1 << HIST_FILTER__DSO);
3161 }
3162
3163 if (symbol_conf.sym_list &&
3164 diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3165 index 63fa3a95a1d69..7292f73118ed3 100644
3166 --- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3167 +++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
3168 @@ -1508,6 +1508,9 @@ static int intel_pt_walk_psbend(struct intel_pt_decoder *decoder)
3169 break;
3170
3171 case INTEL_PT_CYC:
3172 + intel_pt_calc_cyc_timestamp(decoder);
3173 + break;
3174 +
3175 case INTEL_PT_VMCS:
3176 case INTEL_PT_MNT:
3177 case INTEL_PT_PAD: