Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Wed, 30 Jun 2021 14:26:38
Message-Id: 1625063174.b4dd90b1bc402c72ed0d3e4fad8c8dadaf1197d2.mpagano@gentoo
1 commit: b4dd90b1bc402c72ed0d3e4fad8c8dadaf1197d2
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 30 14:26:14 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 30 14:26:14 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b4dd90b1
7
8 Linux patch 4.14.238
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1237_linux-4.14.238.patch | 2489 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2493 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 165f37f..487ae9d 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -991,6 +991,10 @@ Patch: 1236_linux-4.14.237.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.14.237
23
24 +Patch: 1237_linux-4.14.238.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.14.238
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1237_linux-4.14.238.patch b/1237_linux-4.14.238.patch
33 new file mode 100644
34 index 0000000..bf167cd
35 --- /dev/null
36 +++ b/1237_linux-4.14.238.patch
37 @@ -0,0 +1,2489 @@
38 +diff --git a/Makefile b/Makefile
39 +index bc9833fdca1ae..5442918651e00 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 14
46 +-SUBLEVEL = 237
47 ++SUBLEVEL = 238
48 + EXTRAVERSION =
49 + NAME = Petit Gorille
50 +
51 +@@ -716,12 +716,11 @@ KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
52 + # See modpost pattern 2
53 + KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
54 + KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
55 +-else
56 ++endif
57 +
58 + # These warnings generated too much noise in a regular build.
59 + # Use make W=1 to enable them (see scripts/Makefile.extrawarn)
60 + KBUILD_CFLAGS += $(call cc-disable-warning, unused-but-set-variable)
61 +-endif
62 +
63 + KBUILD_CFLAGS += $(call cc-disable-warning, unused-const-variable)
64 + ifdef CONFIG_FRAME_POINTER
65 +diff --git a/arch/arc/include/uapi/asm/sigcontext.h b/arch/arc/include/uapi/asm/sigcontext.h
66 +index 95f8a4380e110..7a5449dfcb290 100644
67 +--- a/arch/arc/include/uapi/asm/sigcontext.h
68 ++++ b/arch/arc/include/uapi/asm/sigcontext.h
69 +@@ -18,6 +18,7 @@
70 + */
71 + struct sigcontext {
72 + struct user_regs_struct regs;
73 ++ struct user_regs_arcv2 v2abi;
74 + };
75 +
76 + #endif /* _ASM_ARC_SIGCONTEXT_H */
77 +diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
78 +index da243420bcb58..68901f6f18bab 100644
79 +--- a/arch/arc/kernel/signal.c
80 ++++ b/arch/arc/kernel/signal.c
81 +@@ -64,6 +64,41 @@ struct rt_sigframe {
82 + unsigned int sigret_magic;
83 + };
84 +
85 ++static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
86 ++{
87 ++ int err = 0;
88 ++#ifndef CONFIG_ISA_ARCOMPACT
89 ++ struct user_regs_arcv2 v2abi;
90 ++
91 ++ v2abi.r30 = regs->r30;
92 ++#ifdef CONFIG_ARC_HAS_ACCL_REGS
93 ++ v2abi.r58 = regs->r58;
94 ++ v2abi.r59 = regs->r59;
95 ++#else
96 ++ v2abi.r58 = v2abi.r59 = 0;
97 ++#endif
98 ++ err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
99 ++#endif
100 ++ return err;
101 ++}
102 ++
103 ++static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
104 ++{
105 ++ int err = 0;
106 ++#ifndef CONFIG_ISA_ARCOMPACT
107 ++ struct user_regs_arcv2 v2abi;
108 ++
109 ++ err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
110 ++
111 ++ regs->r30 = v2abi.r30;
112 ++#ifdef CONFIG_ARC_HAS_ACCL_REGS
113 ++ regs->r58 = v2abi.r58;
114 ++ regs->r59 = v2abi.r59;
115 ++#endif
116 ++#endif
117 ++ return err;
118 ++}
119 ++
120 + static int
121 + stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
122 + sigset_t *set)
123 +@@ -97,6 +132,10 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
124 +
125 + err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
126 + sizeof(sf->uc.uc_mcontext.regs.scratch));
127 ++
128 ++ if (is_isa_arcv2())
129 ++ err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
130 ++
131 + err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
132 +
133 + return err ? -EFAULT : 0;
134 +@@ -112,6 +151,10 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
135 + err |= __copy_from_user(&uregs.scratch,
136 + &(sf->uc.uc_mcontext.regs.scratch),
137 + sizeof(sf->uc.uc_mcontext.regs.scratch));
138 ++
139 ++ if (is_isa_arcv2())
140 ++ err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
141 ++
142 + if (err)
143 + return -EFAULT;
144 +
145 +diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
146 +index a6d27284105a1..ac4ffd97ae823 100644
147 +--- a/arch/arm/kernel/setup.c
148 ++++ b/arch/arm/kernel/setup.c
149 +@@ -547,9 +547,11 @@ void notrace cpu_init(void)
150 + * In Thumb-2, msr with an immediate value is not allowed.
151 + */
152 + #ifdef CONFIG_THUMB2_KERNEL
153 +-#define PLC "r"
154 ++#define PLC_l "l"
155 ++#define PLC_r "r"
156 + #else
157 +-#define PLC "I"
158 ++#define PLC_l "I"
159 ++#define PLC_r "I"
160 + #endif
161 +
162 + /*
163 +@@ -571,15 +573,15 @@ void notrace cpu_init(void)
164 + "msr cpsr_c, %9"
165 + :
166 + : "r" (stk),
167 +- PLC (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
168 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | IRQ_MODE),
169 + "I" (offsetof(struct stack, irq[0])),
170 +- PLC (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
171 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | ABT_MODE),
172 + "I" (offsetof(struct stack, abt[0])),
173 +- PLC (PSR_F_BIT | PSR_I_BIT | UND_MODE),
174 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | UND_MODE),
175 + "I" (offsetof(struct stack, und[0])),
176 +- PLC (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
177 ++ PLC_r (PSR_F_BIT | PSR_I_BIT | FIQ_MODE),
178 + "I" (offsetof(struct stack, fiq[0])),
179 +- PLC (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
180 ++ PLC_l (PSR_F_BIT | PSR_I_BIT | SVC_MODE)
181 + : "r14");
182 + #endif
183 + }
184 +diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
185 +index 20f25539d5726..47abea1475d46 100644
186 +--- a/arch/arm/mach-omap2/board-n8x0.c
187 ++++ b/arch/arm/mach-omap2/board-n8x0.c
188 +@@ -325,6 +325,7 @@ static int n8x0_mmc_get_cover_state(struct device *dev, int slot)
189 +
190 + static void n8x0_mmc_callback(void *data, u8 card_mask)
191 + {
192 ++#ifdef CONFIG_MMC_OMAP
193 + int bit, *openp, index;
194 +
195 + if (board_is_n800()) {
196 +@@ -342,7 +343,6 @@ static void n8x0_mmc_callback(void *data, u8 card_mask)
197 + else
198 + *openp = 0;
199 +
200 +-#ifdef CONFIG_MMC_OMAP
201 + omap_mmc_notify_cover_event(mmc_device, index, *openp);
202 + #else
203 + pr_warn("MMC: notify cover event not available\n");
204 +diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c
205 +index 53df84b2a07f4..4ee1228d29eb8 100644
206 +--- a/arch/arm64/kernel/perf_event.c
207 ++++ b/arch/arm64/kernel/perf_event.c
208 +@@ -670,6 +670,28 @@ static void armv8pmu_disable_event(struct perf_event *event)
209 + raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
210 + }
211 +
212 ++static void armv8pmu_start(struct arm_pmu *cpu_pmu)
213 ++{
214 ++ unsigned long flags;
215 ++ struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
216 ++
217 ++ raw_spin_lock_irqsave(&events->pmu_lock, flags);
218 ++ /* Enable all counters */
219 ++ armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E);
220 ++ raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
221 ++}
222 ++
223 ++static void armv8pmu_stop(struct arm_pmu *cpu_pmu)
224 ++{
225 ++ unsigned long flags;
226 ++ struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
227 ++
228 ++ raw_spin_lock_irqsave(&events->pmu_lock, flags);
229 ++ /* Disable all counters */
230 ++ armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E);
231 ++ raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
232 ++}
233 ++
234 + static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
235 + {
236 + u32 pmovsr;
237 +@@ -695,6 +717,11 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
238 + */
239 + regs = get_irq_regs();
240 +
241 ++ /*
242 ++ * Stop the PMU while processing the counter overflows
243 ++ * to prevent skews in group events.
244 ++ */
245 ++ armv8pmu_stop(cpu_pmu);
246 + for (idx = 0; idx < cpu_pmu->num_events; ++idx) {
247 + struct perf_event *event = cpuc->events[idx];
248 + struct hw_perf_event *hwc;
249 +@@ -719,6 +746,7 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
250 + if (perf_event_overflow(event, &data, regs))
251 + cpu_pmu->disable(event);
252 + }
253 ++ armv8pmu_start(cpu_pmu);
254 +
255 + /*
256 + * Handle the pending perf events.
257 +@@ -732,28 +760,6 @@ static irqreturn_t armv8pmu_handle_irq(int irq_num, void *dev)
258 + return IRQ_HANDLED;
259 + }
260 +
261 +-static void armv8pmu_start(struct arm_pmu *cpu_pmu)
262 +-{
263 +- unsigned long flags;
264 +- struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
265 +-
266 +- raw_spin_lock_irqsave(&events->pmu_lock, flags);
267 +- /* Enable all counters */
268 +- armv8pmu_pmcr_write(armv8pmu_pmcr_read() | ARMV8_PMU_PMCR_E);
269 +- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
270 +-}
271 +-
272 +-static void armv8pmu_stop(struct arm_pmu *cpu_pmu)
273 +-{
274 +- unsigned long flags;
275 +- struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events);
276 +-
277 +- raw_spin_lock_irqsave(&events->pmu_lock, flags);
278 +- /* Disable all counters */
279 +- armv8pmu_pmcr_write(armv8pmu_pmcr_read() & ~ARMV8_PMU_PMCR_E);
280 +- raw_spin_unlock_irqrestore(&events->pmu_lock, flags);
281 +-}
282 +-
283 + static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc,
284 + struct perf_event *event)
285 + {
286 +diff --git a/arch/mips/generic/board-boston.its.S b/arch/mips/generic/board-boston.its.S
287 +index a7f51f97b9102..c45ad27594218 100644
288 +--- a/arch/mips/generic/board-boston.its.S
289 ++++ b/arch/mips/generic/board-boston.its.S
290 +@@ -1,22 +1,22 @@
291 + / {
292 + images {
293 +- fdt@boston {
294 ++ fdt-boston {
295 + description = "img,boston Device Tree";
296 + data = /incbin/("boot/dts/img/boston.dtb");
297 + type = "flat_dt";
298 + arch = "mips";
299 + compression = "none";
300 +- hash@0 {
301 ++ hash {
302 + algo = "sha1";
303 + };
304 + };
305 + };
306 +
307 + configurations {
308 +- conf@boston {
309 ++ conf-boston {
310 + description = "Boston Linux kernel";
311 +- kernel = "kernel@0";
312 +- fdt = "fdt@boston";
313 ++ kernel = "kernel";
314 ++ fdt = "fdt-boston";
315 + };
316 + };
317 + };
318 +diff --git a/arch/mips/generic/board-ni169445.its.S b/arch/mips/generic/board-ni169445.its.S
319 +index e4cb4f95a8cc1..0a2e8f7a8526f 100644
320 +--- a/arch/mips/generic/board-ni169445.its.S
321 ++++ b/arch/mips/generic/board-ni169445.its.S
322 +@@ -1,22 +1,22 @@
323 + / {
324 + images {
325 +- fdt@ni169445 {
326 ++ fdt-ni169445 {
327 + description = "NI 169445 device tree";
328 + data = /incbin/("boot/dts/ni/169445.dtb");
329 + type = "flat_dt";
330 + arch = "mips";
331 + compression = "none";
332 +- hash@0 {
333 ++ hash {
334 + algo = "sha1";
335 + };
336 + };
337 + };
338 +
339 + configurations {
340 +- conf@ni169445 {
341 ++ conf-ni169445 {
342 + description = "NI 169445 Linux Kernel";
343 +- kernel = "kernel@0";
344 +- fdt = "fdt@ni169445";
345 ++ kernel = "kernel";
346 ++ fdt = "fdt-ni169445";
347 + };
348 + };
349 + };
350 +diff --git a/arch/mips/generic/vmlinux.its.S b/arch/mips/generic/vmlinux.its.S
351 +index 1a08438fd8930..3e254676540f4 100644
352 +--- a/arch/mips/generic/vmlinux.its.S
353 ++++ b/arch/mips/generic/vmlinux.its.S
354 +@@ -6,7 +6,7 @@
355 + #address-cells = <ADDR_CELLS>;
356 +
357 + images {
358 +- kernel@0 {
359 ++ kernel {
360 + description = KERNEL_NAME;
361 + data = /incbin/(VMLINUX_BINARY);
362 + type = "kernel";
363 +@@ -15,18 +15,18 @@
364 + compression = VMLINUX_COMPRESSION;
365 + load = /bits/ ADDR_BITS <VMLINUX_LOAD_ADDRESS>;
366 + entry = /bits/ ADDR_BITS <VMLINUX_ENTRY_ADDRESS>;
367 +- hash@0 {
368 ++ hash {
369 + algo = "sha1";
370 + };
371 + };
372 + };
373 +
374 + configurations {
375 +- default = "conf@default";
376 ++ default = "conf-default";
377 +
378 +- conf@default {
379 ++ conf-default {
380 + description = "Generic Linux kernel";
381 +- kernel = "kernel@0";
382 ++ kernel = "kernel";
383 + };
384 + };
385 + };
386 +diff --git a/arch/x86/kernel/fpu/signal.c b/arch/x86/kernel/fpu/signal.c
387 +index d99a8ee9e185e..86a231338bbfe 100644
388 +--- a/arch/x86/kernel/fpu/signal.c
389 ++++ b/arch/x86/kernel/fpu/signal.c
390 +@@ -272,6 +272,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
391 + int state_size = fpu_kernel_xstate_size;
392 + u64 xfeatures = 0;
393 + int fx_only = 0;
394 ++ int ret = 0;
395 +
396 + ia32_fxstate &= (IS_ENABLED(CONFIG_X86_32) ||
397 + IS_ENABLED(CONFIG_IA32_EMULATION));
398 +@@ -281,15 +282,21 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
399 + return 0;
400 + }
401 +
402 +- if (!access_ok(VERIFY_READ, buf, size))
403 +- return -EACCES;
404 ++ if (!access_ok(VERIFY_READ, buf, size)) {
405 ++ ret = -EACCES;
406 ++ goto out_err;
407 ++ }
408 +
409 + fpu__initialize(fpu);
410 +
411 +- if (!static_cpu_has(X86_FEATURE_FPU))
412 +- return fpregs_soft_set(current, NULL,
413 +- 0, sizeof(struct user_i387_ia32_struct),
414 +- NULL, buf) != 0;
415 ++ if (!static_cpu_has(X86_FEATURE_FPU)) {
416 ++ ret = fpregs_soft_set(current, NULL,
417 ++ 0, sizeof(struct user_i387_ia32_struct),
418 ++ NULL, buf) != 0;
419 ++ if (ret)
420 ++ goto out_err;
421 ++ return 0;
422 ++ }
423 +
424 + if (use_xsave()) {
425 + struct _fpx_sw_bytes fx_sw_user;
426 +@@ -349,6 +356,7 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
427 + fpu__restore(fpu);
428 + local_bh_enable();
429 +
430 ++ /* Failure is already handled */
431 + return err;
432 + } else {
433 + /*
434 +@@ -356,13 +364,14 @@ static int __fpu__restore_sig(void __user *buf, void __user *buf_fx, int size)
435 + * state to the registers directly (with exceptions handled).
436 + */
437 + user_fpu_begin();
438 +- if (copy_user_to_fpregs_zeroing(buf_fx, xfeatures, fx_only)) {
439 +- fpu__clear(fpu);
440 +- return -1;
441 +- }
442 ++ if (!copy_user_to_fpregs_zeroing(buf_fx, xfeatures, fx_only))
443 ++ return 0;
444 ++ ret = -1;
445 + }
446 +
447 +- return 0;
448 ++out_err:
449 ++ fpu__clear(fpu);
450 ++ return ret;
451 + }
452 +
453 + static inline int xstate_sigframe_size(void)
454 +diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
455 +index 79b809dbfda01..ff69feefc1c67 100644
456 +--- a/drivers/dma/Kconfig
457 ++++ b/drivers/dma/Kconfig
458 +@@ -58,6 +58,7 @@ config DMA_OF
459 + #devices
460 + config ALTERA_MSGDMA
461 + tristate "Altera / Intel mSGDMA Engine"
462 ++ depends on HAS_IOMEM
463 + select DMA_ENGINE
464 + help
465 + Enable support for Altera / Intel mSGDMA controller.
466 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
467 +index c034f506e015a..a8cea236099a1 100644
468 +--- a/drivers/dma/pl330.c
469 ++++ b/drivers/dma/pl330.c
470 +@@ -2563,13 +2563,15 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
471 + for (i = 0; i < len / period_len; i++) {
472 + desc = pl330_get_desc(pch);
473 + if (!desc) {
474 ++ unsigned long iflags;
475 ++
476 + dev_err(pch->dmac->ddma.dev, "%s:%d Unable to fetch desc\n",
477 + __func__, __LINE__);
478 +
479 + if (!first)
480 + return NULL;
481 +
482 +- spin_lock_irqsave(&pl330->pool_lock, flags);
483 ++ spin_lock_irqsave(&pl330->pool_lock, iflags);
484 +
485 + while (!list_empty(&first->node)) {
486 + desc = list_entry(first->node.next,
487 +@@ -2579,7 +2581,7 @@ static struct dma_async_tx_descriptor *pl330_prep_dma_cyclic(
488 +
489 + list_move_tail(&first->node, &pl330->desc_pool);
490 +
491 +- spin_unlock_irqrestore(&pl330->pool_lock, flags);
492 ++ spin_unlock_irqrestore(&pl330->pool_lock, iflags);
493 +
494 + return NULL;
495 + }
496 +diff --git a/drivers/dma/qcom/Kconfig b/drivers/dma/qcom/Kconfig
497 +index a7761c4025f41..a97c7123d913c 100644
498 +--- a/drivers/dma/qcom/Kconfig
499 ++++ b/drivers/dma/qcom/Kconfig
500 +@@ -9,6 +9,7 @@ config QCOM_BAM_DMA
501 +
502 + config QCOM_HIDMA_MGMT
503 + tristate "Qualcomm Technologies HIDMA Management support"
504 ++ depends on HAS_IOMEM
505 + select DMA_ENGINE
506 + help
507 + Enable support for the Qualcomm Technologies HIDMA Management.
508 +diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
509 +index 90feb6a05e59b..ee15d4fefbad2 100644
510 +--- a/drivers/dma/ste_dma40.c
511 ++++ b/drivers/dma/ste_dma40.c
512 +@@ -3656,6 +3656,9 @@ static int __init d40_probe(struct platform_device *pdev)
513 +
514 + kfree(base->lcla_pool.base_unaligned);
515 +
516 ++ if (base->lcpa_base)
517 ++ iounmap(base->lcpa_base);
518 ++
519 + if (base->phy_lcpa)
520 + release_mem_region(base->phy_lcpa,
521 + base->lcpa_size);
522 +diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
523 +index 1fefc93af1d78..bbfce7b9d03e1 100644
524 +--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
525 ++++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
526 +@@ -98,7 +98,22 @@ int nouveau_gem_prime_pin(struct drm_gem_object *obj)
527 + if (ret)
528 + return -EINVAL;
529 +
530 +- return 0;
531 ++ ret = ttm_bo_reserve(&nvbo->bo, false, false, NULL);
532 ++ if (ret)
533 ++ goto error;
534 ++
535 ++ if (nvbo->bo.moving)
536 ++ ret = dma_fence_wait(nvbo->bo.moving, true);
537 ++
538 ++ ttm_bo_unreserve(&nvbo->bo);
539 ++ if (ret)
540 ++ goto error;
541 ++
542 ++ return ret;
543 ++
544 ++error:
545 ++ nouveau_bo_unpin(nvbo);
546 ++ return ret;
547 + }
548 +
549 + void nouveau_gem_prime_unpin(struct drm_gem_object *obj)
550 +diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
551 +index 7110d403322c4..c138e07f51a3e 100644
552 +--- a/drivers/gpu/drm/radeon/radeon_prime.c
553 ++++ b/drivers/gpu/drm/radeon/radeon_prime.c
554 +@@ -92,9 +92,19 @@ int radeon_gem_prime_pin(struct drm_gem_object *obj)
555 +
556 + /* pin buffer into GTT */
557 + ret = radeon_bo_pin(bo, RADEON_GEM_DOMAIN_GTT, NULL);
558 +- if (likely(ret == 0))
559 +- bo->prime_shared_count++;
560 +-
561 ++ if (unlikely(ret))
562 ++ goto error;
563 ++
564 ++ if (bo->tbo.moving) {
565 ++ ret = dma_fence_wait(bo->tbo.moving, false);
566 ++ if (unlikely(ret)) {
567 ++ radeon_bo_unpin(bo);
568 ++ goto error;
569 ++ }
570 ++ }
571 ++
572 ++ bo->prime_shared_count++;
573 ++error:
574 + radeon_bo_unreserve(bo);
575 + return ret;
576 + }
577 +diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
578 +index 95f4db70dd223..fde9c69ecc869 100644
579 +--- a/drivers/gpu/drm/radeon/radeon_uvd.c
580 ++++ b/drivers/gpu/drm/radeon/radeon_uvd.c
581 +@@ -286,7 +286,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
582 + if (rdev->uvd.vcpu_bo == NULL)
583 + return -EINVAL;
584 +
585 +- memcpy(rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
586 ++ memcpy_toio((void __iomem *)rdev->uvd.cpu_addr, rdev->uvd_fw->data, rdev->uvd_fw->size);
587 +
588 + size = radeon_bo_size(rdev->uvd.vcpu_bo);
589 + size -= rdev->uvd_fw->size;
590 +@@ -294,7 +294,7 @@ int radeon_uvd_resume(struct radeon_device *rdev)
591 + ptr = rdev->uvd.cpu_addr;
592 + ptr += rdev->uvd_fw->size;
593 +
594 +- memset(ptr, 0, size);
595 ++ memset_io((void __iomem *)ptr, 0, size);
596 +
597 + return 0;
598 + }
599 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
600 +index 71ee1267d2efc..381ab96c1e389 100644
601 +--- a/drivers/hid/hid-core.c
602 ++++ b/drivers/hid/hid-core.c
603 +@@ -1824,6 +1824,9 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
604 + case BUS_I2C:
605 + bus = "I2C";
606 + break;
607 ++ case BUS_VIRTUAL:
608 ++ bus = "VIRTUAL";
609 ++ break;
610 + default:
611 + bus = "<UNKNOWN>";
612 + }
613 +diff --git a/drivers/hid/hid-gt683r.c b/drivers/hid/hid-gt683r.c
614 +index a298fbd8db6b9..8ca4c1baeda89 100644
615 +--- a/drivers/hid/hid-gt683r.c
616 ++++ b/drivers/hid/hid-gt683r.c
617 +@@ -64,6 +64,7 @@ static const struct hid_device_id gt683r_led_id[] = {
618 + { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
619 + { }
620 + };
621 ++MODULE_DEVICE_TABLE(hid, gt683r_led_id);
622 +
623 + static void gt683r_brightness_set(struct led_classdev *led_cdev,
624 + enum led_brightness brightness)
625 +diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
626 +index aa078c1dad14f..6c7e12d8e7d93 100644
627 +--- a/drivers/hid/hid-sensor-hub.c
628 ++++ b/drivers/hid/hid-sensor-hub.c
629 +@@ -223,16 +223,21 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id,
630 + buffer_size = buffer_size / sizeof(__s32);
631 + if (buffer_size) {
632 + for (i = 0; i < buffer_size; ++i) {
633 +- hid_set_field(report->field[field_index], i,
634 +- (__force __s32)cpu_to_le32(*buf32));
635 ++ ret = hid_set_field(report->field[field_index], i,
636 ++ (__force __s32)cpu_to_le32(*buf32));
637 ++ if (ret)
638 ++ goto done_proc;
639 ++
640 + ++buf32;
641 + }
642 + }
643 + if (remaining_bytes) {
644 + value = 0;
645 + memcpy(&value, (u8 *)buf32, remaining_bytes);
646 +- hid_set_field(report->field[field_index], i,
647 +- (__force __s32)cpu_to_le32(value));
648 ++ ret = hid_set_field(report->field[field_index], i,
649 ++ (__force __s32)cpu_to_le32(value));
650 ++ if (ret)
651 ++ goto done_proc;
652 + }
653 + hid_hw_request(hsdev->hdev, report, HID_REQ_SET_REPORT);
654 + hid_hw_wait(hsdev->hdev);
655 +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
656 +index 98916fb4191a7..46b8f4c353def 100644
657 +--- a/drivers/hid/usbhid/hid-core.c
658 ++++ b/drivers/hid/usbhid/hid-core.c
659 +@@ -373,7 +373,7 @@ static int hid_submit_ctrl(struct hid_device *hid)
660 + raw_report = usbhid->ctrl[usbhid->ctrltail].raw_report;
661 + dir = usbhid->ctrl[usbhid->ctrltail].dir;
662 +
663 +- len = ((report->size - 1) >> 3) + 1 + (report->id > 0);
664 ++ len = hid_report_len(report);
665 + if (dir == USB_DIR_OUT) {
666 + usbhid->urbctrl->pipe = usb_sndctrlpipe(hid_to_usb_dev(hid), 0);
667 + usbhid->urbctrl->transfer_buffer_length = len;
668 +diff --git a/drivers/hwmon/scpi-hwmon.c b/drivers/hwmon/scpi-hwmon.c
669 +index 7e49da50bc69b..562f3e287297a 100644
670 +--- a/drivers/hwmon/scpi-hwmon.c
671 ++++ b/drivers/hwmon/scpi-hwmon.c
672 +@@ -107,6 +107,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
673 +
674 + scpi_scale_reading(&value, sensor);
675 +
676 ++ /*
677 ++ * Temperature sensor values are treated as signed values based on
678 ++ * observation even though that is not explicitly specified, and
679 ++ * because an unsigned u64 temperature does not really make practical
680 ++ * sense especially when the temperature is below zero degrees Celsius.
681 ++ */
682 ++ if (sensor->info.class == TEMPERATURE)
683 ++ return sprintf(buf, "%lld\n", (s64)value);
684 ++
685 + return sprintf(buf, "%llu\n", value);
686 + }
687 +
688 +diff --git a/drivers/i2c/busses/i2c-robotfuzz-osif.c b/drivers/i2c/busses/i2c-robotfuzz-osif.c
689 +index 9c0f52b7ff7ec..b9b4758c6be7a 100644
690 +--- a/drivers/i2c/busses/i2c-robotfuzz-osif.c
691 ++++ b/drivers/i2c/busses/i2c-robotfuzz-osif.c
692 +@@ -89,7 +89,7 @@ static int osif_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,
693 + }
694 + }
695 +
696 +- ret = osif_usb_read(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
697 ++ ret = osif_usb_write(adapter, OSIFI2C_STOP, 0, 0, NULL, 0);
698 + if (ret) {
699 + dev_err(&adapter->dev, "failure sending STOP\n");
700 + return -EREMOTEIO;
701 +@@ -159,7 +159,7 @@ static int osif_probe(struct usb_interface *interface,
702 + * Set bus frequency. The frequency is:
703 + * 120,000,000 / ( 16 + 2 * div * 4^prescale).
704 + * Using dev = 52, prescale = 0 give 100KHz */
705 +- ret = osif_usb_read(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
706 ++ ret = osif_usb_write(&priv->adapter, OSIFI2C_SET_BIT_RATE, 52, 0,
707 + NULL, 0);
708 + if (ret) {
709 + dev_err(&interface->dev, "failure sending bit rate");
710 +diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
711 +index ce76ed50a1a25..1516d621e0402 100644
712 +--- a/drivers/net/caif/caif_serial.c
713 ++++ b/drivers/net/caif/caif_serial.c
714 +@@ -360,6 +360,7 @@ static int ldisc_open(struct tty_struct *tty)
715 + rtnl_lock();
716 + result = register_netdevice(dev);
717 + if (result) {
718 ++ tty_kref_put(tty);
719 + rtnl_unlock();
720 + free_netdev(dev);
721 + return -ENODEV;
722 +diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c
723 +index a09e3f6c2c504..6b0c6009dde0d 100644
724 +--- a/drivers/net/can/usb/mcba_usb.c
725 ++++ b/drivers/net/can/usb/mcba_usb.c
726 +@@ -93,6 +93,8 @@ struct mcba_priv {
727 + bool can_ka_first_pass;
728 + bool can_speed_check;
729 + atomic_t free_ctx_cnt;
730 ++ void *rxbuf[MCBA_MAX_RX_URBS];
731 ++ dma_addr_t rxbuf_dma[MCBA_MAX_RX_URBS];
732 + };
733 +
734 + /* CAN frame */
735 +@@ -644,6 +646,7 @@ static int mcba_usb_start(struct mcba_priv *priv)
736 + for (i = 0; i < MCBA_MAX_RX_URBS; i++) {
737 + struct urb *urb = NULL;
738 + u8 *buf;
739 ++ dma_addr_t buf_dma;
740 +
741 + /* create a URB, and a buffer for it */
742 + urb = usb_alloc_urb(0, GFP_KERNEL);
743 +@@ -653,7 +656,7 @@ static int mcba_usb_start(struct mcba_priv *priv)
744 + }
745 +
746 + buf = usb_alloc_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
747 +- GFP_KERNEL, &urb->transfer_dma);
748 ++ GFP_KERNEL, &buf_dma);
749 + if (!buf) {
750 + netdev_err(netdev, "No memory left for USB buffer\n");
751 + usb_free_urb(urb);
752 +@@ -672,11 +675,14 @@ static int mcba_usb_start(struct mcba_priv *priv)
753 + if (err) {
754 + usb_unanchor_urb(urb);
755 + usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
756 +- buf, urb->transfer_dma);
757 ++ buf, buf_dma);
758 + usb_free_urb(urb);
759 + break;
760 + }
761 +
762 ++ priv->rxbuf[i] = buf;
763 ++ priv->rxbuf_dma[i] = buf_dma;
764 ++
765 + /* Drop reference, USB core will take care of freeing it */
766 + usb_free_urb(urb);
767 + }
768 +@@ -719,7 +725,14 @@ static int mcba_usb_open(struct net_device *netdev)
769 +
770 + static void mcba_urb_unlink(struct mcba_priv *priv)
771 + {
772 ++ int i;
773 ++
774 + usb_kill_anchored_urbs(&priv->rx_submitted);
775 ++
776 ++ for (i = 0; i < MCBA_MAX_RX_URBS; ++i)
777 ++ usb_free_coherent(priv->udev, MCBA_USB_RX_BUFF_SIZE,
778 ++ priv->rxbuf[i], priv->rxbuf_dma[i]);
779 ++
780 + usb_kill_anchored_urbs(&priv->tx_submitted);
781 + }
782 +
783 +diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
784 +index ce2e644108237..bb0e217460c93 100644
785 +--- a/drivers/net/ethernet/atheros/alx/main.c
786 ++++ b/drivers/net/ethernet/atheros/alx/main.c
787 +@@ -1857,6 +1857,7 @@ out_free_netdev:
788 + free_netdev(netdev);
789 + out_pci_release:
790 + pci_release_mem_regions(pdev);
791 ++ pci_disable_pcie_error_reporting(pdev);
792 + out_pci_disable:
793 + pci_disable_device(pdev);
794 + return err;
795 +diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c
796 +index 1b79a6defd56d..5561dd2953248 100644
797 +--- a/drivers/net/ethernet/ec_bhf.c
798 ++++ b/drivers/net/ethernet/ec_bhf.c
799 +@@ -585,10 +585,12 @@ static void ec_bhf_remove(struct pci_dev *dev)
800 + struct ec_bhf_priv *priv = netdev_priv(net_dev);
801 +
802 + unregister_netdev(net_dev);
803 +- free_netdev(net_dev);
804 +
805 + pci_iounmap(dev, priv->dma_io);
806 + pci_iounmap(dev, priv->io);
807 ++
808 ++ free_netdev(net_dev);
809 ++
810 + pci_release_regions(dev);
811 + pci_clear_master(dev);
812 + pci_disable_device(dev);
813 +diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
814 +index cabeb1790db76..43ae124cabff6 100644
815 +--- a/drivers/net/ethernet/emulex/benet/be_main.c
816 ++++ b/drivers/net/ethernet/emulex/benet/be_main.c
817 +@@ -5926,6 +5926,7 @@ drv_cleanup:
818 + unmap_bars:
819 + be_unmap_pci_bars(adapter);
820 + free_netdev:
821 ++ pci_disable_pcie_error_reporting(pdev);
822 + free_netdev(netdev);
823 + rel_reg:
824 + pci_release_regions(pdev);
825 +diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
826 +index e63df6455fbad..40c5c09f60dc6 100644
827 +--- a/drivers/net/ethernet/freescale/fec_ptp.c
828 ++++ b/drivers/net/ethernet/freescale/fec_ptp.c
829 +@@ -586,6 +586,10 @@ void fec_ptp_init(struct platform_device *pdev)
830 + fep->ptp_caps.enable = fec_ptp_enable;
831 +
832 + fep->cycle_speed = clk_get_rate(fep->clk_ptp);
833 ++ if (!fep->cycle_speed) {
834 ++ fep->cycle_speed = NSEC_PER_SEC;
835 ++ dev_err(&fep->pdev->dev, "clk_ptp clock rate is zero\n");
836 ++ }
837 + fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
838 +
839 + spin_lock_init(&fep->tmreg_lock);
840 +diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
841 +index a0a555052d8ca..1ac2bc75edb1f 100644
842 +--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
843 ++++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
844 +@@ -3853,6 +3853,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
845 + dev_err(&pdev->dev,
846 + "invalid sram_size %dB or board span %ldB\n",
847 + mgp->sram_size, mgp->board_span);
848 ++ status = -EINVAL;
849 + goto abort_with_ioremap;
850 + }
851 + memcpy_fromio(mgp->eeprom_strings,
852 +diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
853 +index 8f8a1894378e3..5b91c8f823ffa 100644
854 +--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
855 ++++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
856 +@@ -1624,6 +1624,8 @@ err_out_free_netdev:
857 + free_netdev(netdev);
858 +
859 + err_out_free_res:
860 ++ if (NX_IS_REVISION_P3(pdev->revision))
861 ++ pci_disable_pcie_error_reporting(pdev);
862 + pci_release_regions(pdev);
863 +
864 + err_out_disable_pdev:
865 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
866 +index d62dccb855394..1ee58a24afe31 100644
867 +--- a/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
868 ++++ b/drivers/net/ethernet/qlogic/qed/qed_dcbx.c
869 +@@ -1259,9 +1259,11 @@ int qed_dcbx_get_config_params(struct qed_hwfn *p_hwfn,
870 + p_hwfn->p_dcbx_info->set.ver_num |= DCBX_CONFIG_VERSION_STATIC;
871 +
872 + p_hwfn->p_dcbx_info->set.enabled = dcbx_info->operational.enabled;
873 ++ BUILD_BUG_ON(sizeof(dcbx_info->operational.params) !=
874 ++ sizeof(p_hwfn->p_dcbx_info->set.config.params));
875 + memcpy(&p_hwfn->p_dcbx_info->set.config.params,
876 + &dcbx_info->operational.params,
877 +- sizeof(struct qed_dcbx_admin_params));
878 ++ sizeof(p_hwfn->p_dcbx_info->set.config.params));
879 + p_hwfn->p_dcbx_info->set.config.valid = true;
880 +
881 + memcpy(params, &p_hwfn->p_dcbx_info->set, sizeof(struct qed_dcbx_set));
882 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
883 +index 6684a4cb8b88b..45361310eea0a 100644
884 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
885 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
886 +@@ -2711,6 +2711,7 @@ err_out_free_hw_res:
887 + kfree(ahw);
888 +
889 + err_out_free_res:
890 ++ pci_disable_pcie_error_reporting(pdev);
891 + pci_release_regions(pdev);
892 +
893 + err_out_disable_pdev:
894 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
895 +index 530b8da11960a..191531a03415a 100644
896 +--- a/drivers/net/ethernet/realtek/r8169.c
897 ++++ b/drivers/net/ethernet/realtek/r8169.c
898 +@@ -2355,7 +2355,7 @@ static void rtl8169_get_strings(struct net_device *dev, u32 stringset, u8 *data)
899 + {
900 + switch(stringset) {
901 + case ETH_SS_STATS:
902 +- memcpy(data, *rtl8169_gstrings, sizeof(rtl8169_gstrings));
903 ++ memcpy(data, rtl8169_gstrings, sizeof(rtl8169_gstrings));
904 + break;
905 + }
906 + }
907 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
908 +index dab1597287b96..36f1019809ea6 100644
909 +--- a/drivers/net/ethernet/renesas/sh_eth.c
910 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
911 +@@ -2197,7 +2197,7 @@ static void sh_eth_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
912 + {
913 + switch (stringset) {
914 + case ETH_SS_STATS:
915 +- memcpy(data, *sh_eth_gstrings_stats,
916 ++ memcpy(data, sh_eth_gstrings_stats,
917 + sizeof(sh_eth_gstrings_stats));
918 + break;
919 + }
920 +diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
921 +index c02d36629c528..6f7ed3aaff1b1 100644
922 +--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
923 ++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
924 +@@ -87,10 +87,10 @@ enum power_event {
925 + #define LPI_CTRL_STATUS_TLPIEN 0x00000001 /* Transmit LPI Entry */
926 +
927 + /* GMAC HW ADDR regs */
928 +-#define GMAC_ADDR_HIGH(reg) (((reg > 15) ? 0x00000800 : 0x00000040) + \
929 +- (reg * 8))
930 +-#define GMAC_ADDR_LOW(reg) (((reg > 15) ? 0x00000804 : 0x00000044) + \
931 +- (reg * 8))
932 ++#define GMAC_ADDR_HIGH(reg) ((reg > 15) ? 0x00000800 + (reg - 16) * 8 : \
933 ++ 0x00000040 + (reg * 8))
934 ++#define GMAC_ADDR_LOW(reg) ((reg > 15) ? 0x00000804 + (reg - 16) * 8 : \
935 ++ 0x00000044 + (reg * 8))
936 + #define GMAC_MAX_PERFECT_ADDRESSES 1
937 +
938 + #define GMAC_PCS_BASE 0x000000c0 /* PCS register base */
939 +diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
940 +index 2241f98970926..939de185bc6b8 100644
941 +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
942 ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
943 +@@ -736,6 +736,11 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
944 + /* Kick off the transfer */
945 + lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
946 +
947 ++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
948 ++ netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
949 ++ netif_stop_queue(ndev);
950 ++ }
951 ++
952 + return NETDEV_TX_OK;
953 + }
954 +
955 +diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
956 +index 9fd7dab42a534..2074fc55a88ad 100644
957 +--- a/drivers/net/hamradio/mkiss.c
958 ++++ b/drivers/net/hamradio/mkiss.c
959 +@@ -810,6 +810,7 @@ static void mkiss_close(struct tty_struct *tty)
960 + ax->tty = NULL;
961 +
962 + unregister_netdev(ax->dev);
963 ++ free_netdev(ax->dev);
964 + }
965 +
966 + /* Perform I/O control on an active ax25 channel. */
967 +diff --git a/drivers/net/usb/cdc_eem.c b/drivers/net/usb/cdc_eem.c
968 +index f7180f8db39e1..9c15e1a1261be 100644
969 +--- a/drivers/net/usb/cdc_eem.c
970 ++++ b/drivers/net/usb/cdc_eem.c
971 +@@ -138,10 +138,10 @@ static struct sk_buff *eem_tx_fixup(struct usbnet *dev, struct sk_buff *skb,
972 + }
973 +
974 + skb2 = skb_copy_expand(skb, EEM_HEAD, ETH_FCS_LEN + padlen, flags);
975 ++ dev_kfree_skb_any(skb);
976 + if (!skb2)
977 + return NULL;
978 +
979 +- dev_kfree_skb_any(skb);
980 + skb = skb2;
981 +
982 + done:
983 +diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
984 +index 468db50eb5e7e..5b5156508f7c6 100644
985 +--- a/drivers/net/usb/cdc_ncm.c
986 ++++ b/drivers/net/usb/cdc_ncm.c
987 +@@ -1667,7 +1667,7 @@ static void cdc_ncm_status(struct usbnet *dev, struct urb *urb)
988 + static const struct driver_info cdc_ncm_info = {
989 + .description = "CDC NCM",
990 + .flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
991 +- | FLAG_LINK_INTR,
992 ++ | FLAG_LINK_INTR | FLAG_ETHER,
993 + .bind = cdc_ncm_bind,
994 + .unbind = cdc_ncm_unbind,
995 + .manage_power = usbnet_manage_power,
996 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
997 +index f9c531a6ce064..8da3c891c9e80 100644
998 +--- a/drivers/net/usb/r8152.c
999 ++++ b/drivers/net/usb/r8152.c
1000 +@@ -4640,7 +4640,7 @@ static void rtl8152_get_strings(struct net_device *dev, u32 stringset, u8 *data)
1001 + {
1002 + switch (stringset) {
1003 + case ETH_SS_STATS:
1004 +- memcpy(data, *rtl8152_gstrings, sizeof(rtl8152_gstrings));
1005 ++ memcpy(data, rtl8152_gstrings, sizeof(rtl8152_gstrings));
1006 + break;
1007 + }
1008 + }
1009 +diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
1010 +index 62f2862c9775e..8b9fd4e071f3d 100644
1011 +--- a/drivers/net/usb/smsc75xx.c
1012 ++++ b/drivers/net/usb/smsc75xx.c
1013 +@@ -1495,7 +1495,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
1014 + ret = smsc75xx_wait_ready(dev, 0);
1015 + if (ret < 0) {
1016 + netdev_warn(dev->net, "device not ready in smsc75xx_bind\n");
1017 +- goto err;
1018 ++ goto free_pdata;
1019 + }
1020 +
1021 + smsc75xx_init_mac_address(dev);
1022 +@@ -1504,7 +1504,7 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
1023 + ret = smsc75xx_reset(dev);
1024 + if (ret < 0) {
1025 + netdev_warn(dev->net, "smsc75xx_reset error %d\n", ret);
1026 +- goto err;
1027 ++ goto cancel_work;
1028 + }
1029 +
1030 + dev->net->netdev_ops = &smsc75xx_netdev_ops;
1031 +@@ -1515,8 +1515,11 @@ static int smsc75xx_bind(struct usbnet *dev, struct usb_interface *intf)
1032 + dev->net->max_mtu = MAX_SINGLE_PACKET_SIZE;
1033 + return 0;
1034 +
1035 +-err:
1036 ++cancel_work:
1037 ++ cancel_work_sync(&pdata->set_multicast);
1038 ++free_pdata:
1039 + kfree(pdata);
1040 ++ dev->data[0] = 0;
1041 + return ret;
1042 + }
1043 +
1044 +@@ -1527,7 +1530,6 @@ static void smsc75xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1045 + cancel_work_sync(&pdata->set_multicast);
1046 + netif_dbg(dev, ifdown, dev->net, "free pdata\n");
1047 + kfree(pdata);
1048 +- pdata = NULL;
1049 + dev->data[0] = 0;
1050 + }
1051 + }
1052 +diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
1053 +index 3388d2788fe05..7a0a10777cd13 100644
1054 +--- a/drivers/nvme/target/loop.c
1055 ++++ b/drivers/nvme/target/loop.c
1056 +@@ -287,7 +287,8 @@ static const struct blk_mq_ops nvme_loop_admin_mq_ops = {
1057 +
1058 + static void nvme_loop_destroy_admin_queue(struct nvme_loop_ctrl *ctrl)
1059 + {
1060 +- clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
1061 ++ if (!test_and_clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags))
1062 ++ return;
1063 + nvmet_sq_destroy(&ctrl->queues[0].nvme_sq);
1064 + blk_cleanup_queue(ctrl->ctrl.admin_q);
1065 + blk_mq_free_tag_set(&ctrl->admin_tag_set);
1066 +@@ -322,6 +323,7 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl)
1067 + clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags);
1068 + nvmet_sq_destroy(&ctrl->queues[i].nvme_sq);
1069 + }
1070 ++ ctrl->ctrl.queue_count = 1;
1071 + }
1072 +
1073 + static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl)
1074 +@@ -429,6 +431,7 @@ static int nvme_loop_configure_admin_queue(struct nvme_loop_ctrl *ctrl)
1075 + return 0;
1076 +
1077 + out_cleanup_queue:
1078 ++ clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[0].flags);
1079 + blk_cleanup_queue(ctrl->ctrl.admin_q);
1080 + out_free_tagset:
1081 + blk_mq_free_tag_set(&ctrl->admin_tag_set);
1082 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1083 +index 1993e5e28ea7b..c847b5554db6d 100644
1084 +--- a/drivers/pci/pci.c
1085 ++++ b/drivers/pci/pci.c
1086 +@@ -1378,11 +1378,21 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
1087 + int err;
1088 + int i, bars = 0;
1089 +
1090 +- if (atomic_inc_return(&dev->enable_cnt) > 1) {
1091 +- pci_update_current_state(dev, dev->current_state);
1092 +- return 0; /* already enabled */
1093 ++ /*
1094 ++ * Power state could be unknown at this point, either due to a fresh
1095 ++ * boot or a device removal call. So get the current power state
1096 ++ * so that things like MSI message writing will behave as expected
1097 ++ * (e.g. if the device really is in D0 at enable time).
1098 ++ */
1099 ++ if (dev->pm_cap) {
1100 ++ u16 pmcsr;
1101 ++ pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1102 ++ dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
1103 + }
1104 +
1105 ++ if (atomic_inc_return(&dev->enable_cnt) > 1)
1106 ++ return 0; /* already enabled */
1107 ++
1108 + bridge = pci_upstream_bridge(dev);
1109 + if (bridge)
1110 + pci_enable_bridge(bridge);
1111 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1112 +index 510cb05aa96ff..db1ec8209b568 100644
1113 +--- a/drivers/pci/quirks.c
1114 ++++ b/drivers/pci/quirks.c
1115 +@@ -3389,6 +3389,18 @@ static void quirk_no_bus_reset(struct pci_dev *dev)
1116 + dev->dev_flags |= PCI_DEV_FLAGS_NO_BUS_RESET;
1117 + }
1118 +
1119 ++/*
1120 ++ * Some NVIDIA GPU devices do not work with bus reset, SBR needs to be
1121 ++ * prevented for those affected devices.
1122 ++ */
1123 ++static void quirk_nvidia_no_bus_reset(struct pci_dev *dev)
1124 ++{
1125 ++ if ((dev->device & 0xffc0) == 0x2340)
1126 ++ quirk_no_bus_reset(dev);
1127 ++}
1128 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
1129 ++ quirk_nvidia_no_bus_reset);
1130 ++
1131 + /*
1132 + * Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset.
1133 + * The device will throw a Link Down error on AER-capable systems and
1134 +@@ -3402,6 +3414,16 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x003c, quirk_no_bus_reset);
1135 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0033, quirk_no_bus_reset);
1136 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATHEROS, 0x0034, quirk_no_bus_reset);
1137 +
1138 ++/*
1139 ++ * Some TI KeyStone C667X devices do not support bus/hot reset. The PCIESS
1140 ++ * automatically disables LTSSM when Secondary Bus Reset is received and
1141 ++ * the device stops working. Prevent bus reset for these devices. With
1142 ++ * this change, the device can be assigned to VMs with VFIO, but it will
1143 ++ * leak state between VMs. Reference
1144 ++ * https://e2e.ti.com/support/processors/f/791/t/954382
1145 ++ */
1146 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, 0xb005, quirk_no_bus_reset);
1147 ++
1148 + static void quirk_no_pm_reset(struct pci_dev *dev)
1149 + {
1150 + /*
1151 +@@ -3853,6 +3875,69 @@ static int reset_chelsio_generic_dev(struct pci_dev *dev, int probe)
1152 + #define PCI_DEVICE_ID_INTEL_IVB_M_VGA 0x0156
1153 + #define PCI_DEVICE_ID_INTEL_IVB_M2_VGA 0x0166
1154 +
1155 ++#define PCI_DEVICE_ID_HINIC_VF 0x375E
1156 ++#define HINIC_VF_FLR_TYPE 0x1000
1157 ++#define HINIC_VF_FLR_CAP_BIT (1UL << 30)
1158 ++#define HINIC_VF_OP 0xE80
1159 ++#define HINIC_VF_FLR_PROC_BIT (1UL << 18)
1160 ++#define HINIC_OPERATION_TIMEOUT 15000 /* 15 seconds */
1161 ++
1162 ++/* Device-specific reset method for Huawei Intelligent NIC virtual functions */
1163 ++static int reset_hinic_vf_dev(struct pci_dev *pdev, int probe)
1164 ++{
1165 ++ unsigned long timeout;
1166 ++ void __iomem *bar;
1167 ++ u32 val;
1168 ++
1169 ++ if (probe)
1170 ++ return 0;
1171 ++
1172 ++ bar = pci_iomap(pdev, 0, 0);
1173 ++ if (!bar)
1174 ++ return -ENOTTY;
1175 ++
1176 ++ /* Get and check firmware capabilities */
1177 ++ val = ioread32be(bar + HINIC_VF_FLR_TYPE);
1178 ++ if (!(val & HINIC_VF_FLR_CAP_BIT)) {
1179 ++ pci_iounmap(pdev, bar);
1180 ++ return -ENOTTY;
1181 ++ }
1182 ++
1183 ++ /* Set HINIC_VF_FLR_PROC_BIT for the start of FLR */
1184 ++ val = ioread32be(bar + HINIC_VF_OP);
1185 ++ val = val | HINIC_VF_FLR_PROC_BIT;
1186 ++ iowrite32be(val, bar + HINIC_VF_OP);
1187 ++
1188 ++ pcie_flr(pdev);
1189 ++
1190 ++ /*
1191 ++ * The device must recapture its Bus and Device Numbers after FLR
1192 ++ * in order generate Completions. Issue a config write to let the
1193 ++ * device capture this information.
1194 ++ */
1195 ++ pci_write_config_word(pdev, PCI_VENDOR_ID, 0);
1196 ++
1197 ++ /* Firmware clears HINIC_VF_FLR_PROC_BIT when reset is complete */
1198 ++ timeout = jiffies + msecs_to_jiffies(HINIC_OPERATION_TIMEOUT);
1199 ++ do {
1200 ++ val = ioread32be(bar + HINIC_VF_OP);
1201 ++ if (!(val & HINIC_VF_FLR_PROC_BIT))
1202 ++ goto reset_complete;
1203 ++ msleep(20);
1204 ++ } while (time_before(jiffies, timeout));
1205 ++
1206 ++ val = ioread32be(bar + HINIC_VF_OP);
1207 ++ if (!(val & HINIC_VF_FLR_PROC_BIT))
1208 ++ goto reset_complete;
1209 ++
1210 ++ pci_warn(pdev, "Reset dev timeout, FLR ack reg: %#010x\n", val);
1211 ++
1212 ++reset_complete:
1213 ++ pci_iounmap(pdev, bar);
1214 ++
1215 ++ return 0;
1216 ++}
1217 ++
1218 + static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
1219 + { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
1220 + reset_intel_82599_sfp_virtfn },
1221 +@@ -3862,6 +3947,8 @@ static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
1222 + reset_ivb_igd },
1223 + { PCI_VENDOR_ID_CHELSIO, PCI_ANY_ID,
1224 + reset_chelsio_generic_dev },
1225 ++ { PCI_VENDOR_ID_HUAWEI, PCI_DEVICE_ID_HINIC_VF,
1226 ++ reset_hinic_vf_dev },
1227 + { 0 }
1228 + };
1229 +
1230 +@@ -4662,6 +4749,8 @@ static const struct pci_dev_acs_enabled {
1231 + { PCI_VENDOR_ID_AMPERE, 0xE00A, pci_quirk_xgene_acs },
1232 + { PCI_VENDOR_ID_AMPERE, 0xE00B, pci_quirk_xgene_acs },
1233 + { PCI_VENDOR_ID_AMPERE, 0xE00C, pci_quirk_xgene_acs },
1234 ++ /* Broadcom multi-function device */
1235 ++ { PCI_VENDOR_ID_BROADCOM, 0x16D7, pci_quirk_mf_endpoint_acs },
1236 + { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs },
1237 + { 0 }
1238 + };
1239 +diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
1240 +index 072bd11074c6f..b38e82a868df8 100644
1241 +--- a/drivers/pinctrl/stm32/pinctrl-stm32.c
1242 ++++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
1243 +@@ -956,7 +956,7 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
1244 + struct resource res;
1245 + struct reset_control *rstc;
1246 + int npins = STM32_GPIO_PINS_PER_BANK;
1247 +- int bank_nr, err;
1248 ++ int bank_nr, err, i = 0;
1249 +
1250 + rstc = of_reset_control_get_exclusive(np, NULL);
1251 + if (!IS_ERR(rstc))
1252 +@@ -985,9 +985,14 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl,
1253 +
1254 + of_property_read_string(np, "st,bank-name", &bank->gpio_chip.label);
1255 +
1256 +- if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &args)) {
1257 ++ if (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, i, &args)) {
1258 + bank_nr = args.args[1] / STM32_GPIO_PINS_PER_BANK;
1259 + bank->gpio_chip.base = args.args[1];
1260 ++
1261 ++ npins = args.args[2];
1262 ++ while (!of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3,
1263 ++ ++i, &args))
1264 ++ npins += args.args[2];
1265 + } else {
1266 + bank_nr = pctl->nbanks;
1267 + bank->gpio_chip.base = bank_nr * STM32_GPIO_PINS_PER_BANK;
1268 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
1269 +index 0d0be7d8b9d64..852680e859217 100644
1270 +--- a/drivers/target/target_core_transport.c
1271 ++++ b/drivers/target/target_core_transport.c
1272 +@@ -2966,9 +2966,7 @@ __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
1273 + __releases(&cmd->t_state_lock)
1274 + __acquires(&cmd->t_state_lock)
1275 + {
1276 +-
1277 +- assert_spin_locked(&cmd->t_state_lock);
1278 +- WARN_ON_ONCE(!irqs_disabled());
1279 ++ lockdep_assert_held(&cmd->t_state_lock);
1280 +
1281 + if (fabric_stop)
1282 + cmd->transport_state |= CMD_T_FABRIC_STOP;
1283 +diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1284 +index 40743e9e9d937..276a63ae510e6 100644
1285 +--- a/drivers/usb/core/hub.c
1286 ++++ b/drivers/usb/core/hub.c
1287 +@@ -38,6 +38,8 @@
1288 + #define USB_VENDOR_GENESYS_LOGIC 0x05e3
1289 + #define USB_VENDOR_SMSC 0x0424
1290 + #define USB_PRODUCT_USB5534B 0x5534
1291 ++#define USB_VENDOR_CYPRESS 0x04b4
1292 ++#define USB_PRODUCT_CY7C65632 0x6570
1293 + #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01
1294 + #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02
1295 +
1296 +@@ -5325,6 +5327,11 @@ static const struct usb_device_id hub_id_table[] = {
1297 + .idProduct = USB_PRODUCT_USB5534B,
1298 + .bInterfaceClass = USB_CLASS_HUB,
1299 + .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
1300 ++ { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
1301 ++ | USB_DEVICE_ID_MATCH_PRODUCT,
1302 ++ .idVendor = USB_VENDOR_CYPRESS,
1303 ++ .idProduct = USB_PRODUCT_CY7C65632,
1304 ++ .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND},
1305 + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR
1306 + | USB_DEVICE_ID_MATCH_INT_CLASS,
1307 + .idVendor = USB_VENDOR_GENESYS_LOGIC,
1308 +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1309 +index f3fca4537d255..0e179274ba7cd 100644
1310 +--- a/drivers/usb/dwc3/core.c
1311 ++++ b/drivers/usb/dwc3/core.c
1312 +@@ -1337,8 +1337,8 @@ static int dwc3_remove(struct platform_device *pdev)
1313 + */
1314 + res->start -= DWC3_GLOBALS_REGS_START;
1315 +
1316 +- dwc3_debugfs_exit(dwc);
1317 + dwc3_core_exit_mode(dwc);
1318 ++ dwc3_debugfs_exit(dwc);
1319 +
1320 + dwc3_core_exit(dwc);
1321 + dwc3_ulpi_exit(dwc);
1322 +diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
1323 +index 0a0dd3178483e..be969f24ccf04 100644
1324 +--- a/fs/gfs2/glock.c
1325 ++++ b/fs/gfs2/glock.c
1326 +@@ -1456,6 +1456,7 @@ __acquires(&lru_lock)
1327 + while(!list_empty(list)) {
1328 + gl = list_entry(list->next, struct gfs2_glock, gl_lru);
1329 + list_del_init(&gl->gl_lru);
1330 ++ clear_bit(GLF_LRU, &gl->gl_flags);
1331 + if (!spin_trylock(&gl->gl_lockref.lock)) {
1332 + add_back_to_lru:
1333 + list_add(&gl->gl_lru, &lru_list);
1334 +@@ -1501,7 +1502,6 @@ static long gfs2_scan_glock_lru(int nr)
1335 + if (!test_bit(GLF_LOCK, &gl->gl_flags)) {
1336 + list_move(&gl->gl_lru, &dispose);
1337 + atomic_dec(&lru_count);
1338 +- clear_bit(GLF_LRU, &gl->gl_flags);
1339 + freed++;
1340 + continue;
1341 + }
1342 +diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
1343 +index 5019058e0f6ab..610267585f8f9 100644
1344 +--- a/fs/kernfs/mount.c
1345 ++++ b/fs/kernfs/mount.c
1346 +@@ -320,6 +320,7 @@ struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
1347 +
1348 + info->root = root;
1349 + info->ns = ns;
1350 ++ INIT_LIST_HEAD(&info->node);
1351 +
1352 + sb = sget_userns(fs_type, kernfs_test_super, kernfs_set_super, flags,
1353 + &init_user_ns, info);
1354 +diff --git a/fs/nilfs2/sysfs.c b/fs/nilfs2/sysfs.c
1355 +index 490303e3d5179..e9903bceb2bf1 100644
1356 +--- a/fs/nilfs2/sysfs.c
1357 ++++ b/fs/nilfs2/sysfs.c
1358 +@@ -1064,6 +1064,7 @@ void nilfs_sysfs_delete_device_group(struct the_nilfs *nilfs)
1359 + nilfs_sysfs_delete_superblock_group(nilfs);
1360 + nilfs_sysfs_delete_segctor_group(nilfs);
1361 + kobject_del(&nilfs->ns_dev_kobj);
1362 ++ kobject_put(&nilfs->ns_dev_kobj);
1363 + kfree(nilfs->ns_dev_subgroups);
1364 + }
1365 +
1366 +diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
1367 +index 20b8f82e115b6..2bbe84d9c0a81 100644
1368 +--- a/fs/sysfs/mount.c
1369 ++++ b/fs/sysfs/mount.c
1370 +@@ -28,7 +28,7 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
1371 + {
1372 + struct dentry *root;
1373 + void *ns;
1374 +- bool new_sb;
1375 ++ bool new_sb = false;
1376 +
1377 + if (!(flags & MS_KERNMOUNT)) {
1378 + if (!kobj_ns_current_may_mount(KOBJ_NS_TYPE_NET))
1379 +@@ -38,9 +38,9 @@ static struct dentry *sysfs_mount(struct file_system_type *fs_type,
1380 + ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
1381 + root = kernfs_mount_ns(fs_type, flags, sysfs_root,
1382 + SYSFS_MAGIC, &new_sb, ns);
1383 +- if (IS_ERR(root) || !new_sb)
1384 ++ if (!new_sb)
1385 + kobj_ns_drop(KOBJ_NS_TYPE_NET, ns);
1386 +- else if (new_sb)
1387 ++ else if (!IS_ERR(root))
1388 + root->d_sb->s_iflags |= SB_I_USERNS_VISIBLE;
1389 +
1390 + return root;
1391 +diff --git a/include/linux/hid.h b/include/linux/hid.h
1392 +index d07fe33a90457..5a2c55ed33fac 100644
1393 +--- a/include/linux/hid.h
1394 ++++ b/include/linux/hid.h
1395 +@@ -1114,8 +1114,7 @@ static inline void hid_hw_wait(struct hid_device *hdev)
1396 + */
1397 + static inline u32 hid_report_len(struct hid_report *report)
1398 + {
1399 +- /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
1400 +- return ((report->size - 1) >> 3) + 1 + (report->id > 0);
1401 ++ return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
1402 + }
1403 +
1404 + int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
1405 +diff --git a/include/net/sock.h b/include/net/sock.h
1406 +index 55d16db84ea44..70fe85bee4e56 100644
1407 +--- a/include/net/sock.h
1408 ++++ b/include/net/sock.h
1409 +@@ -1744,7 +1744,8 @@ static inline u32 net_tx_rndhash(void)
1410 +
1411 + static inline void sk_set_txhash(struct sock *sk)
1412 + {
1413 +- sk->sk_txhash = net_tx_rndhash();
1414 ++ /* This pairs with READ_ONCE() in skb_set_hash_from_sk() */
1415 ++ WRITE_ONCE(sk->sk_txhash, net_tx_rndhash());
1416 + }
1417 +
1418 + static inline void sk_rethink_txhash(struct sock *sk)
1419 +@@ -2018,9 +2019,12 @@ static inline void sock_poll_wait(struct file *filp,
1420 +
1421 + static inline void skb_set_hash_from_sk(struct sk_buff *skb, struct sock *sk)
1422 + {
1423 +- if (sk->sk_txhash) {
1424 ++ /* This pairs with WRITE_ONCE() in sk_set_txhash() */
1425 ++ u32 txhash = READ_ONCE(sk->sk_txhash);
1426 ++
1427 ++ if (txhash) {
1428 + skb->l4_hash = 1;
1429 +- skb->hash = sk->sk_txhash;
1430 ++ skb->hash = txhash;
1431 + }
1432 + }
1433 +
1434 +diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
1435 +index 48e8a225b985a..2a66ab49f14dd 100644
1436 +--- a/include/uapi/linux/in.h
1437 ++++ b/include/uapi/linux/in.h
1438 +@@ -280,6 +280,9 @@ struct sockaddr_in {
1439 + /* Address indicating an error return. */
1440 + #define INADDR_NONE ((unsigned long int) 0xffffffff)
1441 +
1442 ++/* Dummy address for src of ICMP replies if no real address is set (RFC7600). */
1443 ++#define INADDR_DUMMY ((unsigned long int) 0xc0000008)
1444 ++
1445 + /* Network number for local host loopback. */
1446 + #define IN_LOOPBACKNET 127
1447 +
1448 +diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1449 +index 42531ee852ffb..0cc67bc0666e4 100644
1450 +--- a/kernel/trace/trace.c
1451 ++++ b/kernel/trace/trace.c
1452 +@@ -1737,9 +1737,6 @@ struct saved_cmdlines_buffer {
1453 + };
1454 + static struct saved_cmdlines_buffer *savedcmd;
1455 +
1456 +-/* temporary disable recording */
1457 +-static atomic_t trace_record_taskinfo_disabled __read_mostly;
1458 +-
1459 + static inline char *get_saved_cmdlines(int idx)
1460 + {
1461 + return &savedcmd->saved_cmdlines[idx * TASK_COMM_LEN];
1462 +@@ -2024,8 +2021,6 @@ static bool tracing_record_taskinfo_skip(int flags)
1463 + {
1464 + if (unlikely(!(flags & (TRACE_RECORD_CMDLINE | TRACE_RECORD_TGID))))
1465 + return true;
1466 +- if (atomic_read(&trace_record_taskinfo_disabled) || !tracing_is_on())
1467 +- return true;
1468 + if (!__this_cpu_read(trace_taskinfo_save))
1469 + return true;
1470 + return false;
1471 +@@ -3259,9 +3254,6 @@ static void *s_start(struct seq_file *m, loff_t *pos)
1472 + return ERR_PTR(-EBUSY);
1473 + #endif
1474 +
1475 +- if (!iter->snapshot)
1476 +- atomic_inc(&trace_record_taskinfo_disabled);
1477 +-
1478 + if (*pos != iter->pos) {
1479 + iter->ent = NULL;
1480 + iter->cpu = 0;
1481 +@@ -3304,9 +3296,6 @@ static void s_stop(struct seq_file *m, void *p)
1482 + return;
1483 + #endif
1484 +
1485 +- if (!iter->snapshot)
1486 +- atomic_dec(&trace_record_taskinfo_disabled);
1487 +-
1488 + trace_access_unlock(iter->cpu_file);
1489 + trace_event_read_unlock();
1490 + }
1491 +diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c
1492 +index c82875834c425..b3b02d2c29266 100644
1493 +--- a/kernel/trace/trace_clock.c
1494 ++++ b/kernel/trace/trace_clock.c
1495 +@@ -114,9 +114,9 @@ u64 notrace trace_clock_global(void)
1496 + prev_time = READ_ONCE(trace_clock_struct.prev_time);
1497 + now = sched_clock_cpu(this_cpu);
1498 +
1499 +- /* Make sure that now is always greater than prev_time */
1500 ++ /* Make sure that now is always greater than or equal to prev_time */
1501 + if ((s64)(now - prev_time) < 0)
1502 +- now = prev_time + 1;
1503 ++ now = prev_time;
1504 +
1505 + /*
1506 + * If in an NMI context then dont risk lockups and simply return
1507 +@@ -130,7 +130,7 @@ u64 notrace trace_clock_global(void)
1508 + /* Reread prev_time in case it was already updated */
1509 + prev_time = READ_ONCE(trace_clock_struct.prev_time);
1510 + if ((s64)(now - prev_time) < 0)
1511 +- now = prev_time + 1;
1512 ++ now = prev_time;
1513 +
1514 + trace_clock_struct.prev_time = now;
1515 +
1516 +diff --git a/mm/memory-failure.c b/mm/memory-failure.c
1517 +index 001b6bfccbfbd..e7827b9e63976 100644
1518 +--- a/mm/memory-failure.c
1519 ++++ b/mm/memory-failure.c
1520 +@@ -1267,7 +1267,12 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
1521 + return 0;
1522 + }
1523 +
1524 +- if (!PageTransTail(p) && !PageLRU(p))
1525 ++ /*
1526 ++ * __munlock_pagevec may clear a writeback page's LRU flag without
1527 ++ * page_lock. We need wait writeback completion for this page or it
1528 ++ * may trigger vfs BUG while evict inode.
1529 ++ */
1530 ++ if (!PageTransTail(p) && !PageLRU(p) && !PageWriteback(p))
1531 + goto identify_page_state;
1532 +
1533 + /*
1534 +diff --git a/mm/slub.c b/mm/slub.c
1535 +index a0cb3568b0b5d..484a75296a12b 100644
1536 +--- a/mm/slub.c
1537 ++++ b/mm/slub.c
1538 +@@ -15,6 +15,7 @@
1539 + #include <linux/module.h>
1540 + #include <linux/bit_spinlock.h>
1541 + #include <linux/interrupt.h>
1542 ++#include <linux/swab.h>
1543 + #include <linux/bitops.h>
1544 + #include <linux/slab.h>
1545 + #include "slab.h"
1546 +diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
1547 +index 7a723e124dbb5..3ec16c48e7681 100644
1548 +--- a/net/batman-adv/bat_iv_ogm.c
1549 ++++ b/net/batman-adv/bat_iv_ogm.c
1550 +@@ -585,8 +585,10 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)
1551 + if (WARN_ON(!forw_packet->if_outgoing))
1552 + return;
1553 +
1554 +- if (WARN_ON(forw_packet->if_outgoing->soft_iface != soft_iface))
1555 ++ if (forw_packet->if_outgoing->soft_iface != soft_iface) {
1556 ++ pr_warn("%s: soft interface switch for queued OGM\n", __func__);
1557 + return;
1558 ++ }
1559 +
1560 + if (forw_packet->if_incoming->if_status != BATADV_IF_ACTIVE)
1561 + return;
1562 +diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
1563 +index 14ff034e561c5..50a55553a25c5 100644
1564 +--- a/net/bridge/br_private.h
1565 ++++ b/net/bridge/br_private.h
1566 +@@ -93,8 +93,8 @@ struct br_vlan_stats {
1567 + };
1568 +
1569 + struct br_tunnel_info {
1570 +- __be64 tunnel_id;
1571 +- struct metadata_dst *tunnel_dst;
1572 ++ __be64 tunnel_id;
1573 ++ struct metadata_dst __rcu *tunnel_dst;
1574 + };
1575 +
1576 + /**
1577 +diff --git a/net/bridge/br_vlan_tunnel.c b/net/bridge/br_vlan_tunnel.c
1578 +index 6d2c4eed2dc89..adb6845ceba46 100644
1579 +--- a/net/bridge/br_vlan_tunnel.c
1580 ++++ b/net/bridge/br_vlan_tunnel.c
1581 +@@ -46,26 +46,33 @@ static struct net_bridge_vlan *br_vlan_tunnel_lookup(struct rhashtable *tbl,
1582 + br_vlan_tunnel_rht_params);
1583 + }
1584 +
1585 ++static void vlan_tunnel_info_release(struct net_bridge_vlan *vlan)
1586 ++{
1587 ++ struct metadata_dst *tdst = rtnl_dereference(vlan->tinfo.tunnel_dst);
1588 ++
1589 ++ WRITE_ONCE(vlan->tinfo.tunnel_id, 0);
1590 ++ RCU_INIT_POINTER(vlan->tinfo.tunnel_dst, NULL);
1591 ++ dst_release(&tdst->dst);
1592 ++}
1593 ++
1594 + void vlan_tunnel_info_del(struct net_bridge_vlan_group *vg,
1595 + struct net_bridge_vlan *vlan)
1596 + {
1597 +- if (!vlan->tinfo.tunnel_dst)
1598 ++ if (!rcu_access_pointer(vlan->tinfo.tunnel_dst))
1599 + return;
1600 + rhashtable_remove_fast(&vg->tunnel_hash, &vlan->tnode,
1601 + br_vlan_tunnel_rht_params);
1602 +- vlan->tinfo.tunnel_id = 0;
1603 +- dst_release(&vlan->tinfo.tunnel_dst->dst);
1604 +- vlan->tinfo.tunnel_dst = NULL;
1605 ++ vlan_tunnel_info_release(vlan);
1606 + }
1607 +
1608 + static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg,
1609 + struct net_bridge_vlan *vlan, u32 tun_id)
1610 + {
1611 +- struct metadata_dst *metadata = NULL;
1612 ++ struct metadata_dst *metadata = rtnl_dereference(vlan->tinfo.tunnel_dst);
1613 + __be64 key = key32_to_tunnel_id(cpu_to_be32(tun_id));
1614 + int err;
1615 +
1616 +- if (vlan->tinfo.tunnel_dst)
1617 ++ if (metadata)
1618 + return -EEXIST;
1619 +
1620 + metadata = __ip_tun_set_dst(0, 0, 0, 0, 0, TUNNEL_KEY,
1621 +@@ -74,8 +81,8 @@ static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg,
1622 + return -EINVAL;
1623 +
1624 + metadata->u.tun_info.mode |= IP_TUNNEL_INFO_TX | IP_TUNNEL_INFO_BRIDGE;
1625 +- vlan->tinfo.tunnel_dst = metadata;
1626 +- vlan->tinfo.tunnel_id = key;
1627 ++ rcu_assign_pointer(vlan->tinfo.tunnel_dst, metadata);
1628 ++ WRITE_ONCE(vlan->tinfo.tunnel_id, key);
1629 +
1630 + err = rhashtable_lookup_insert_fast(&vg->tunnel_hash, &vlan->tnode,
1631 + br_vlan_tunnel_rht_params);
1632 +@@ -84,9 +91,7 @@ static int __vlan_tunnel_info_add(struct net_bridge_vlan_group *vg,
1633 +
1634 + return 0;
1635 + out:
1636 +- dst_release(&vlan->tinfo.tunnel_dst->dst);
1637 +- vlan->tinfo.tunnel_dst = NULL;
1638 +- vlan->tinfo.tunnel_id = 0;
1639 ++ vlan_tunnel_info_release(vlan);
1640 +
1641 + return err;
1642 + }
1643 +@@ -186,12 +191,15 @@ int br_handle_ingress_vlan_tunnel(struct sk_buff *skb,
1644 + int br_handle_egress_vlan_tunnel(struct sk_buff *skb,
1645 + struct net_bridge_vlan *vlan)
1646 + {
1647 ++ struct metadata_dst *tunnel_dst;
1648 ++ __be64 tunnel_id;
1649 + int err;
1650 +
1651 +- if (!vlan || !vlan->tinfo.tunnel_id)
1652 ++ if (!vlan)
1653 + return 0;
1654 +
1655 +- if (unlikely(!skb_vlan_tag_present(skb)))
1656 ++ tunnel_id = READ_ONCE(vlan->tinfo.tunnel_id);
1657 ++ if (!tunnel_id || unlikely(!skb_vlan_tag_present(skb)))
1658 + return 0;
1659 +
1660 + skb_dst_drop(skb);
1661 +@@ -199,7 +207,9 @@ int br_handle_egress_vlan_tunnel(struct sk_buff *skb,
1662 + if (err)
1663 + return err;
1664 +
1665 +- skb_dst_set(skb, dst_clone(&vlan->tinfo.tunnel_dst->dst));
1666 ++ tunnel_dst = rcu_dereference(vlan->tinfo.tunnel_dst);
1667 ++ if (tunnel_dst && dst_hold_safe(&tunnel_dst->dst))
1668 ++ skb_dst_set(skb, &tunnel_dst->dst);
1669 +
1670 + return 0;
1671 + }
1672 +diff --git a/net/can/bcm.c b/net/can/bcm.c
1673 +index 12d851c4604dc..8c8b02e544322 100644
1674 +--- a/net/can/bcm.c
1675 ++++ b/net/can/bcm.c
1676 +@@ -125,7 +125,7 @@ struct bcm_sock {
1677 + struct sock sk;
1678 + int bound;
1679 + int ifindex;
1680 +- struct notifier_block notifier;
1681 ++ struct list_head notifier;
1682 + struct list_head rx_ops;
1683 + struct list_head tx_ops;
1684 + unsigned long dropped_usr_msgs;
1685 +@@ -133,6 +133,10 @@ struct bcm_sock {
1686 + char procname [32]; /* inode number in decimal with \0 */
1687 + };
1688 +
1689 ++static LIST_HEAD(bcm_notifier_list);
1690 ++static DEFINE_SPINLOCK(bcm_notifier_lock);
1691 ++static struct bcm_sock *bcm_busy_notifier;
1692 ++
1693 + static inline struct bcm_sock *bcm_sk(const struct sock *sk)
1694 + {
1695 + return (struct bcm_sock *)sk;
1696 +@@ -406,6 +410,7 @@ static void bcm_tx_timeout_tsklet(unsigned long data)
1697 + if (!op->count && (op->flags & TX_COUNTEVT)) {
1698 +
1699 + /* create notification to user */
1700 ++ memset(&msg_head, 0, sizeof(msg_head));
1701 + msg_head.opcode = TX_EXPIRED;
1702 + msg_head.flags = op->flags;
1703 + msg_head.count = op->count;
1704 +@@ -453,6 +458,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data)
1705 + /* this element is not throttled anymore */
1706 + data->flags &= (BCM_CAN_FLAGS_MASK|RX_RECV);
1707 +
1708 ++ memset(&head, 0, sizeof(head));
1709 + head.opcode = RX_CHANGED;
1710 + head.flags = op->flags;
1711 + head.count = op->count;
1712 +@@ -567,6 +573,7 @@ static void bcm_rx_timeout_tsklet(unsigned long data)
1713 + struct bcm_msg_head msg_head;
1714 +
1715 + /* create notification to user */
1716 ++ memset(&msg_head, 0, sizeof(msg_head));
1717 + msg_head.opcode = RX_TIMEOUT;
1718 + msg_head.flags = op->flags;
1719 + msg_head.count = op->count;
1720 +@@ -1439,20 +1446,15 @@ static int bcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
1721 + /*
1722 + * notification handler for netdevice status changes
1723 + */
1724 +-static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
1725 +- void *ptr)
1726 ++static void bcm_notify(struct bcm_sock *bo, unsigned long msg,
1727 ++ struct net_device *dev)
1728 + {
1729 +- struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1730 +- struct bcm_sock *bo = container_of(nb, struct bcm_sock, notifier);
1731 + struct sock *sk = &bo->sk;
1732 + struct bcm_op *op;
1733 + int notify_enodev = 0;
1734 +
1735 + if (!net_eq(dev_net(dev), sock_net(sk)))
1736 +- return NOTIFY_DONE;
1737 +-
1738 +- if (dev->type != ARPHRD_CAN)
1739 +- return NOTIFY_DONE;
1740 ++ return;
1741 +
1742 + switch (msg) {
1743 +
1744 +@@ -1487,7 +1489,28 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
1745 + sk->sk_error_report(sk);
1746 + }
1747 + }
1748 ++}
1749 +
1750 ++static int bcm_notifier(struct notifier_block *nb, unsigned long msg,
1751 ++ void *ptr)
1752 ++{
1753 ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1754 ++
1755 ++ if (dev->type != ARPHRD_CAN)
1756 ++ return NOTIFY_DONE;
1757 ++ if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
1758 ++ return NOTIFY_DONE;
1759 ++ if (unlikely(bcm_busy_notifier)) /* Check for reentrant bug. */
1760 ++ return NOTIFY_DONE;
1761 ++
1762 ++ spin_lock(&bcm_notifier_lock);
1763 ++ list_for_each_entry(bcm_busy_notifier, &bcm_notifier_list, notifier) {
1764 ++ spin_unlock(&bcm_notifier_lock);
1765 ++ bcm_notify(bcm_busy_notifier, msg, dev);
1766 ++ spin_lock(&bcm_notifier_lock);
1767 ++ }
1768 ++ bcm_busy_notifier = NULL;
1769 ++ spin_unlock(&bcm_notifier_lock);
1770 + return NOTIFY_DONE;
1771 + }
1772 +
1773 +@@ -1507,9 +1530,9 @@ static int bcm_init(struct sock *sk)
1774 + INIT_LIST_HEAD(&bo->rx_ops);
1775 +
1776 + /* set notifier */
1777 +- bo->notifier.notifier_call = bcm_notifier;
1778 +-
1779 +- register_netdevice_notifier(&bo->notifier);
1780 ++ spin_lock(&bcm_notifier_lock);
1781 ++ list_add_tail(&bo->notifier, &bcm_notifier_list);
1782 ++ spin_unlock(&bcm_notifier_lock);
1783 +
1784 + return 0;
1785 + }
1786 +@@ -1532,7 +1555,14 @@ static int bcm_release(struct socket *sock)
1787 +
1788 + /* remove bcm_ops, timer, rx_unregister(), etc. */
1789 +
1790 +- unregister_netdevice_notifier(&bo->notifier);
1791 ++ spin_lock(&bcm_notifier_lock);
1792 ++ while (bcm_busy_notifier == bo) {
1793 ++ spin_unlock(&bcm_notifier_lock);
1794 ++ schedule_timeout_uninterruptible(1);
1795 ++ spin_lock(&bcm_notifier_lock);
1796 ++ }
1797 ++ list_del(&bo->notifier);
1798 ++ spin_unlock(&bcm_notifier_lock);
1799 +
1800 + lock_sock(sk);
1801 +
1802 +@@ -1747,6 +1777,10 @@ static struct pernet_operations canbcm_pernet_ops __read_mostly = {
1803 + .exit = canbcm_pernet_exit,
1804 + };
1805 +
1806 ++static struct notifier_block canbcm_notifier = {
1807 ++ .notifier_call = bcm_notifier
1808 ++};
1809 ++
1810 + static int __init bcm_module_init(void)
1811 + {
1812 + int err;
1813 +@@ -1760,12 +1794,14 @@ static int __init bcm_module_init(void)
1814 + }
1815 +
1816 + register_pernet_subsys(&canbcm_pernet_ops);
1817 ++ register_netdevice_notifier(&canbcm_notifier);
1818 + return 0;
1819 + }
1820 +
1821 + static void __exit bcm_module_exit(void)
1822 + {
1823 + can_proto_unregister(&bcm_can_proto);
1824 ++ unregister_netdevice_notifier(&canbcm_notifier);
1825 + unregister_pernet_subsys(&canbcm_pernet_ops);
1826 + }
1827 +
1828 +diff --git a/net/can/raw.c b/net/can/raw.c
1829 +index e1f26441b49ac..24af08164b614 100644
1830 +--- a/net/can/raw.c
1831 ++++ b/net/can/raw.c
1832 +@@ -84,7 +84,7 @@ struct raw_sock {
1833 + struct sock sk;
1834 + int bound;
1835 + int ifindex;
1836 +- struct notifier_block notifier;
1837 ++ struct list_head notifier;
1838 + int loopback;
1839 + int recv_own_msgs;
1840 + int fd_frames;
1841 +@@ -96,6 +96,10 @@ struct raw_sock {
1842 + struct uniqframe __percpu *uniq;
1843 + };
1844 +
1845 ++static LIST_HEAD(raw_notifier_list);
1846 ++static DEFINE_SPINLOCK(raw_notifier_lock);
1847 ++static struct raw_sock *raw_busy_notifier;
1848 ++
1849 + /*
1850 + * Return pointer to store the extra msg flags for raw_recvmsg().
1851 + * We use the space of one unsigned int beyond the 'struct sockaddr_can'
1852 +@@ -266,21 +270,16 @@ static int raw_enable_allfilters(struct net *net, struct net_device *dev,
1853 + return err;
1854 + }
1855 +
1856 +-static int raw_notifier(struct notifier_block *nb,
1857 +- unsigned long msg, void *ptr)
1858 ++static void raw_notify(struct raw_sock *ro, unsigned long msg,
1859 ++ struct net_device *dev)
1860 + {
1861 +- struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1862 +- struct raw_sock *ro = container_of(nb, struct raw_sock, notifier);
1863 + struct sock *sk = &ro->sk;
1864 +
1865 + if (!net_eq(dev_net(dev), sock_net(sk)))
1866 +- return NOTIFY_DONE;
1867 +-
1868 +- if (dev->type != ARPHRD_CAN)
1869 +- return NOTIFY_DONE;
1870 ++ return;
1871 +
1872 + if (ro->ifindex != dev->ifindex)
1873 +- return NOTIFY_DONE;
1874 ++ return;
1875 +
1876 + switch (msg) {
1877 +
1878 +@@ -309,7 +308,28 @@ static int raw_notifier(struct notifier_block *nb,
1879 + sk->sk_error_report(sk);
1880 + break;
1881 + }
1882 ++}
1883 ++
1884 ++static int raw_notifier(struct notifier_block *nb, unsigned long msg,
1885 ++ void *ptr)
1886 ++{
1887 ++ struct net_device *dev = netdev_notifier_info_to_dev(ptr);
1888 ++
1889 ++ if (dev->type != ARPHRD_CAN)
1890 ++ return NOTIFY_DONE;
1891 ++ if (msg != NETDEV_UNREGISTER && msg != NETDEV_DOWN)
1892 ++ return NOTIFY_DONE;
1893 ++ if (unlikely(raw_busy_notifier)) /* Check for reentrant bug. */
1894 ++ return NOTIFY_DONE;
1895 +
1896 ++ spin_lock(&raw_notifier_lock);
1897 ++ list_for_each_entry(raw_busy_notifier, &raw_notifier_list, notifier) {
1898 ++ spin_unlock(&raw_notifier_lock);
1899 ++ raw_notify(raw_busy_notifier, msg, dev);
1900 ++ spin_lock(&raw_notifier_lock);
1901 ++ }
1902 ++ raw_busy_notifier = NULL;
1903 ++ spin_unlock(&raw_notifier_lock);
1904 + return NOTIFY_DONE;
1905 + }
1906 +
1907 +@@ -338,9 +358,9 @@ static int raw_init(struct sock *sk)
1908 + return -ENOMEM;
1909 +
1910 + /* set notifier */
1911 +- ro->notifier.notifier_call = raw_notifier;
1912 +-
1913 +- register_netdevice_notifier(&ro->notifier);
1914 ++ spin_lock(&raw_notifier_lock);
1915 ++ list_add_tail(&ro->notifier, &raw_notifier_list);
1916 ++ spin_unlock(&raw_notifier_lock);
1917 +
1918 + return 0;
1919 + }
1920 +@@ -355,7 +375,14 @@ static int raw_release(struct socket *sock)
1921 +
1922 + ro = raw_sk(sk);
1923 +
1924 +- unregister_netdevice_notifier(&ro->notifier);
1925 ++ spin_lock(&raw_notifier_lock);
1926 ++ while (raw_busy_notifier == ro) {
1927 ++ spin_unlock(&raw_notifier_lock);
1928 ++ schedule_timeout_uninterruptible(1);
1929 ++ spin_lock(&raw_notifier_lock);
1930 ++ }
1931 ++ list_del(&ro->notifier);
1932 ++ spin_unlock(&raw_notifier_lock);
1933 +
1934 + lock_sock(sk);
1935 +
1936 +@@ -870,6 +897,10 @@ static const struct can_proto raw_can_proto = {
1937 + .prot = &raw_proto,
1938 + };
1939 +
1940 ++static struct notifier_block canraw_notifier = {
1941 ++ .notifier_call = raw_notifier
1942 ++};
1943 ++
1944 + static __init int raw_module_init(void)
1945 + {
1946 + int err;
1947 +@@ -879,6 +910,8 @@ static __init int raw_module_init(void)
1948 + err = can_proto_register(&raw_can_proto);
1949 + if (err < 0)
1950 + printk(KERN_ERR "can: registration of raw protocol failed\n");
1951 ++ else
1952 ++ register_netdevice_notifier(&canraw_notifier);
1953 +
1954 + return err;
1955 + }
1956 +@@ -886,6 +919,7 @@ static __init int raw_module_init(void)
1957 + static __exit void raw_module_exit(void)
1958 + {
1959 + can_proto_unregister(&raw_can_proto);
1960 ++ unregister_netdevice_notifier(&canraw_notifier);
1961 + }
1962 +
1963 + module_init(raw_module_init);
1964 +diff --git a/net/compat.c b/net/compat.c
1965 +index 45349658ed010..2ec822f4e4090 100644
1966 +--- a/net/compat.c
1967 ++++ b/net/compat.c
1968 +@@ -158,7 +158,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
1969 + if (kcmlen > stackbuf_size)
1970 + kcmsg_base = kcmsg = sock_kmalloc(sk, kcmlen, GFP_KERNEL);
1971 + if (kcmsg == NULL)
1972 +- return -ENOBUFS;
1973 ++ return -ENOMEM;
1974 +
1975 + /* Now copy them over neatly. */
1976 + memset(kcmsg, 0, kcmlen);
1977 +diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
1978 +index 9bb321df08698..76c3f602ee153 100644
1979 +--- a/net/core/fib_rules.c
1980 ++++ b/net/core/fib_rules.c
1981 +@@ -928,7 +928,7 @@ static void notify_rule_change(int event, struct fib_rule *rule,
1982 + {
1983 + struct net *net;
1984 + struct sk_buff *skb;
1985 +- int err = -ENOBUFS;
1986 ++ int err = -ENOMEM;
1987 +
1988 + net = ops->fro_net;
1989 + skb = nlmsg_new(fib_rule_nlmsg_size(ops, rule), GFP_KERNEL);
1990 +diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
1991 +index 0168c700a2014..3bcaecc7ba69f 100644
1992 +--- a/net/core/rtnetlink.c
1993 ++++ b/net/core/rtnetlink.c
1994 +@@ -3648,6 +3648,10 @@ static int rtnl_bridge_notify(struct net_device *dev)
1995 + if (err < 0)
1996 + goto errout;
1997 +
1998 ++ /* Notification info is only filled for bridge ports, not the bridge
1999 ++ * device itself. Therefore, a zero notification length is valid and
2000 ++ * should not result in an error.
2001 ++ */
2002 + if (!skb->len)
2003 + goto errout;
2004 +
2005 +diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c
2006 +index b1c55db737648..6d4c71a52b6b2 100644
2007 +--- a/net/ieee802154/nl802154.c
2008 ++++ b/net/ieee802154/nl802154.c
2009 +@@ -1315,19 +1315,20 @@ ieee802154_llsec_parse_dev_addr(struct nlattr *nla,
2010 + nl802154_dev_addr_policy, NULL))
2011 + return -EINVAL;
2012 +
2013 +- if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] ||
2014 +- !attrs[NL802154_DEV_ADDR_ATTR_MODE] ||
2015 +- !(attrs[NL802154_DEV_ADDR_ATTR_SHORT] ||
2016 +- attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]))
2017 ++ if (!attrs[NL802154_DEV_ADDR_ATTR_PAN_ID] || !attrs[NL802154_DEV_ADDR_ATTR_MODE])
2018 + return -EINVAL;
2019 +
2020 + addr->pan_id = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_PAN_ID]);
2021 + addr->mode = nla_get_u32(attrs[NL802154_DEV_ADDR_ATTR_MODE]);
2022 + switch (addr->mode) {
2023 + case NL802154_DEV_ADDR_SHORT:
2024 ++ if (!attrs[NL802154_DEV_ADDR_ATTR_SHORT])
2025 ++ return -EINVAL;
2026 + addr->short_addr = nla_get_le16(attrs[NL802154_DEV_ADDR_ATTR_SHORT]);
2027 + break;
2028 + case NL802154_DEV_ADDR_EXTENDED:
2029 ++ if (!attrs[NL802154_DEV_ADDR_ATTR_EXTENDED])
2030 ++ return -EINVAL;
2031 + addr->extended_addr = nla_get_le64(attrs[NL802154_DEV_ADDR_ATTR_EXTENDED]);
2032 + break;
2033 + default:
2034 +diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
2035 +index 6a1b52b34e205..e8b8dd1cb1576 100644
2036 +--- a/net/ipv4/cipso_ipv4.c
2037 ++++ b/net/ipv4/cipso_ipv4.c
2038 +@@ -486,6 +486,7 @@ void cipso_v4_doi_free(struct cipso_v4_doi *doi_def)
2039 + kfree(doi_def->map.std->lvl.local);
2040 + kfree(doi_def->map.std->cat.cipso);
2041 + kfree(doi_def->map.std->cat.local);
2042 ++ kfree(doi_def->map.std);
2043 + break;
2044 + }
2045 + kfree(doi_def);
2046 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2047 +index 96ee1fbd999ef..ba07f128d7ad1 100644
2048 +--- a/net/ipv4/icmp.c
2049 ++++ b/net/ipv4/icmp.c
2050 +@@ -743,6 +743,13 @@ void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
2051 + icmp_param.data_len = room;
2052 + icmp_param.head_len = sizeof(struct icmphdr);
2053 +
2054 ++ /* if we don't have a source address at this point, fall back to the
2055 ++ * dummy address instead of sending out a packet with a source address
2056 ++ * of 0.0.0.0
2057 ++ */
2058 ++ if (!fl4.saddr)
2059 ++ fl4.saddr = htonl(INADDR_DUMMY);
2060 ++
2061 + icmp_push_reply(&icmp_param, &fl4, &ipc, &rt);
2062 + ende:
2063 + ip_rt_put(rt);
2064 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
2065 +index b6f0ee01f2e0b..a6b048ff30e6a 100644
2066 +--- a/net/ipv4/igmp.c
2067 ++++ b/net/ipv4/igmp.c
2068 +@@ -1790,6 +1790,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev)
2069 + while ((i = rtnl_dereference(in_dev->mc_list)) != NULL) {
2070 + in_dev->mc_list = i->next_rcu;
2071 + in_dev->mc_count--;
2072 ++ ip_mc_clear_src(i);
2073 + ip_ma_put(i);
2074 + }
2075 + }
2076 +diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
2077 +index f0782c91514ce..41e384834d509 100644
2078 +--- a/net/ipv4/ipconfig.c
2079 ++++ b/net/ipv4/ipconfig.c
2080 +@@ -881,7 +881,7 @@ static void __init ic_bootp_send_if(struct ic_device *d, unsigned long jiffies_d
2081 +
2082 +
2083 + /*
2084 +- * Copy BOOTP-supplied string if not already set.
2085 ++ * Copy BOOTP-supplied string
2086 + */
2087 + static int __init ic_bootp_string(char *dest, char *src, int len, int max)
2088 + {
2089 +@@ -930,12 +930,15 @@ static void __init ic_do_bootp_ext(u8 *ext)
2090 + }
2091 + break;
2092 + case 12: /* Host name */
2093 +- ic_bootp_string(utsname()->nodename, ext+1, *ext,
2094 +- __NEW_UTS_LEN);
2095 +- ic_host_name_set = 1;
2096 ++ if (!ic_host_name_set) {
2097 ++ ic_bootp_string(utsname()->nodename, ext+1, *ext,
2098 ++ __NEW_UTS_LEN);
2099 ++ ic_host_name_set = 1;
2100 ++ }
2101 + break;
2102 + case 15: /* Domain name (DNS) */
2103 +- ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
2104 ++ if (!ic_domain[0])
2105 ++ ic_bootp_string(ic_domain, ext+1, *ext, sizeof(ic_domain));
2106 + break;
2107 + case 17: /* Root path */
2108 + if (!root_server_path[0])
2109 +diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
2110 +index 186fdf0922d2f..aab141c4a3892 100644
2111 +--- a/net/ipv4/ping.c
2112 ++++ b/net/ipv4/ping.c
2113 +@@ -978,6 +978,7 @@ bool ping_rcv(struct sk_buff *skb)
2114 + struct sock *sk;
2115 + struct net *net = dev_net(skb->dev);
2116 + struct icmphdr *icmph = icmp_hdr(skb);
2117 ++ bool rc = false;
2118 +
2119 + /* We assume the packet has already been checked by icmp_rcv */
2120 +
2121 +@@ -992,14 +993,15 @@ bool ping_rcv(struct sk_buff *skb)
2122 + struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
2123 +
2124 + pr_debug("rcv on socket %p\n", sk);
2125 +- if (skb2)
2126 +- ping_queue_rcv_skb(sk, skb2);
2127 ++ if (skb2 && !ping_queue_rcv_skb(sk, skb2))
2128 ++ rc = true;
2129 + sock_put(sk);
2130 +- return true;
2131 + }
2132 +- pr_debug("no socket, dropping\n");
2133 +
2134 +- return false;
2135 ++ if (!rc)
2136 ++ pr_debug("no socket, dropping\n");
2137 ++
2138 ++ return rc;
2139 + }
2140 + EXPORT_SYMBOL_GPL(ping_rcv);
2141 +
2142 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2143 +index 78d6bc61a1d87..81901b0529077 100644
2144 +--- a/net/ipv4/route.c
2145 ++++ b/net/ipv4/route.c
2146 +@@ -70,6 +70,7 @@
2147 + #include <linux/types.h>
2148 + #include <linux/kernel.h>
2149 + #include <linux/mm.h>
2150 ++#include <linux/bootmem.h>
2151 + #include <linux/string.h>
2152 + #include <linux/socket.h>
2153 + #include <linux/sockios.h>
2154 +@@ -485,8 +486,10 @@ static void ipv4_confirm_neigh(const struct dst_entry *dst, const void *daddr)
2155 + __ipv4_confirm_neigh(dev, *(__force u32 *)pkey);
2156 + }
2157 +
2158 +-#define IP_IDENTS_SZ 2048u
2159 +-
2160 ++/* Hash tables of size 2048..262144 depending on RAM size.
2161 ++ * Each bucket uses 8 bytes.
2162 ++ */
2163 ++static u32 ip_idents_mask __read_mostly;
2164 + static atomic_t *ip_idents __read_mostly;
2165 + static u32 *ip_tstamps __read_mostly;
2166 +
2167 +@@ -496,12 +499,16 @@ static u32 *ip_tstamps __read_mostly;
2168 + */
2169 + u32 ip_idents_reserve(u32 hash, int segs)
2170 + {
2171 +- u32 *p_tstamp = ip_tstamps + hash % IP_IDENTS_SZ;
2172 +- atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
2173 +- u32 old = ACCESS_ONCE(*p_tstamp);
2174 +- u32 now = (u32)jiffies;
2175 ++ u32 bucket, old, now = (u32)jiffies;
2176 ++ atomic_t *p_id;
2177 ++ u32 *p_tstamp;
2178 + u32 delta = 0;
2179 +
2180 ++ bucket = hash & ip_idents_mask;
2181 ++ p_tstamp = ip_tstamps + bucket;
2182 ++ p_id = ip_idents + bucket;
2183 ++ old = ACCESS_ONCE(*p_tstamp);
2184 ++
2185 + if (old != now && cmpxchg(p_tstamp, old, now) == old)
2186 + delta = prandom_u32_max(now - old);
2187 +
2188 +@@ -3098,18 +3105,26 @@ struct ip_rt_acct __percpu *ip_rt_acct __read_mostly;
2189 +
2190 + int __init ip_rt_init(void)
2191 + {
2192 ++ void *idents_hash;
2193 + int rc = 0;
2194 + int cpu;
2195 +
2196 +- ip_idents = kmalloc(IP_IDENTS_SZ * sizeof(*ip_idents), GFP_KERNEL);
2197 +- if (!ip_idents)
2198 +- panic("IP: failed to allocate ip_idents\n");
2199 ++ /* For modern hosts, this will use 2 MB of memory */
2200 ++ idents_hash = alloc_large_system_hash("IP idents",
2201 ++ sizeof(*ip_idents) + sizeof(*ip_tstamps),
2202 ++ 0,
2203 ++ 16, /* one bucket per 64 KB */
2204 ++ HASH_ZERO,
2205 ++ NULL,
2206 ++ &ip_idents_mask,
2207 ++ 2048,
2208 ++ 256*1024);
2209 ++
2210 ++ ip_idents = idents_hash;
2211 +
2212 +- prandom_bytes(ip_idents, IP_IDENTS_SZ * sizeof(*ip_idents));
2213 ++ prandom_bytes(ip_idents, (ip_idents_mask + 1) * sizeof(*ip_idents));
2214 +
2215 +- ip_tstamps = kcalloc(IP_IDENTS_SZ, sizeof(*ip_tstamps), GFP_KERNEL);
2216 +- if (!ip_tstamps)
2217 +- panic("IP: failed to allocate ip_tstamps\n");
2218 ++ ip_tstamps = idents_hash + (ip_idents_mask + 1) * sizeof(*ip_idents);
2219 +
2220 + for_each_possible_cpu(cpu) {
2221 + struct uncached_list *ul = &per_cpu(rt_uncached_list, cpu);
2222 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
2223 +index 8f298f27f6ecf..cf5c4d2f68c1a 100644
2224 +--- a/net/ipv4/udp.c
2225 ++++ b/net/ipv4/udp.c
2226 +@@ -2337,6 +2337,9 @@ void udp_destroy_sock(struct sock *sk)
2227 + {
2228 + struct udp_sock *up = udp_sk(sk);
2229 + bool slow = lock_sock_fast(sk);
2230 ++
2231 ++ /* protects from races with udp_abort() */
2232 ++ sock_set_flag(sk, SOCK_DEAD);
2233 + udp_flush_pending_frames(sk);
2234 + unlock_sock_fast(sk, slow);
2235 + if (static_key_false(&udp_encap_needed) && up->encap_type) {
2236 +@@ -2570,10 +2573,17 @@ int udp_abort(struct sock *sk, int err)
2237 + {
2238 + lock_sock(sk);
2239 +
2240 ++ /* udp{v6}_destroy_sock() sets it under the sk lock, avoid racing
2241 ++ * with close()
2242 ++ */
2243 ++ if (sock_flag(sk, SOCK_DEAD))
2244 ++ goto out;
2245 ++
2246 + sk->sk_err = err;
2247 + sk->sk_error_report(sk);
2248 + __udp_disconnect(sk, 0);
2249 +
2250 ++out:
2251 + release_sock(sk);
2252 +
2253 + return 0;
2254 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2255 +index 38ad3fac8c37f..d9d25b9c07aea 100644
2256 +--- a/net/ipv6/udp.c
2257 ++++ b/net/ipv6/udp.c
2258 +@@ -1434,6 +1434,9 @@ void udpv6_destroy_sock(struct sock *sk)
2259 + {
2260 + struct udp_sock *up = udp_sk(sk);
2261 + lock_sock(sk);
2262 ++
2263 ++ /* protects from races with udp_abort() */
2264 ++ sock_set_flag(sk, SOCK_DEAD);
2265 + udp_v6_flush_pending_frames(sk);
2266 + release_sock(sk);
2267 +
2268 +diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
2269 +index 790c771e8108e..0d4f7258b243b 100644
2270 +--- a/net/mac80211/ieee80211_i.h
2271 ++++ b/net/mac80211/ieee80211_i.h
2272 +@@ -1393,7 +1393,7 @@ ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
2273 + rcu_read_lock();
2274 + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2275 +
2276 +- if (WARN_ON_ONCE(!chanctx_conf)) {
2277 ++ if (!chanctx_conf) {
2278 + rcu_read_unlock();
2279 + return NULL;
2280 + }
2281 +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
2282 +index 6b4fd56800f74..ac2c52709e1c7 100644
2283 +--- a/net/mac80211/rx.c
2284 ++++ b/net/mac80211/rx.c
2285 +@@ -2014,17 +2014,15 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
2286 + sc = le16_to_cpu(hdr->seq_ctrl);
2287 + frag = sc & IEEE80211_SCTL_FRAG;
2288 +
2289 +- if (is_multicast_ether_addr(hdr->addr1)) {
2290 +- I802_DEBUG_INC(rx->local->dot11MulticastReceivedFrameCount);
2291 +- goto out_no_led;
2292 +- }
2293 +-
2294 + if (rx->sta)
2295 + cache = &rx->sta->frags;
2296 +
2297 + if (likely(!ieee80211_has_morefrags(fc) && frag == 0))
2298 + goto out;
2299 +
2300 ++ if (is_multicast_ether_addr(hdr->addr1))
2301 ++ return RX_DROP_MONITOR;
2302 ++
2303 + I802_DEBUG_INC(rx->local->rx_handlers_fragments);
2304 +
2305 + if (skb_linearize(rx->skb))
2306 +@@ -2150,7 +2148,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
2307 +
2308 + out:
2309 + ieee80211_led_rx(rx->local);
2310 +- out_no_led:
2311 + if (rx->sta)
2312 + rx->sta->rx_stats.packets++;
2313 + return RX_CONTINUE;
2314 +diff --git a/net/netfilter/nf_synproxy_core.c b/net/netfilter/nf_synproxy_core.c
2315 +index 49bd8bb16b181..9ff26eb0309a1 100644
2316 +--- a/net/netfilter/nf_synproxy_core.c
2317 ++++ b/net/netfilter/nf_synproxy_core.c
2318 +@@ -34,6 +34,9 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
2319 + int length = (th->doff * 4) - sizeof(*th);
2320 + u8 buf[40], *ptr;
2321 +
2322 ++ if (unlikely(length < 0))
2323 ++ return false;
2324 ++
2325 + ptr = skb_header_pointer(skb, doff + sizeof(*th), length, buf);
2326 + if (ptr == NULL)
2327 + return false;
2328 +@@ -50,6 +53,8 @@ synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
2329 + length--;
2330 + continue;
2331 + default:
2332 ++ if (length < 2)
2333 ++ return true;
2334 + opsize = *ptr++;
2335 + if (opsize < 2)
2336 + return true;
2337 +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
2338 +index b62ec43ed54f4..50ca70b3c1759 100644
2339 +--- a/net/packet/af_packet.c
2340 ++++ b/net/packet/af_packet.c
2341 +@@ -2694,7 +2694,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
2342 + }
2343 + if (likely(saddr == NULL)) {
2344 + dev = packet_cached_dev_get(po);
2345 +- proto = po->num;
2346 ++ proto = READ_ONCE(po->num);
2347 + } else {
2348 + err = -EINVAL;
2349 + if (msg->msg_namelen < sizeof(struct sockaddr_ll))
2350 +@@ -2907,7 +2907,7 @@ static int packet_snd(struct socket *sock, struct msghdr *msg, size_t len)
2351 +
2352 + if (likely(saddr == NULL)) {
2353 + dev = packet_cached_dev_get(po);
2354 +- proto = po->num;
2355 ++ proto = READ_ONCE(po->num);
2356 + } else {
2357 + err = -EINVAL;
2358 + if (msg->msg_namelen < sizeof(struct sockaddr_ll))
2359 +@@ -3177,7 +3177,7 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
2360 + /* prevents packet_notifier() from calling
2361 + * register_prot_hook()
2362 + */
2363 +- po->num = 0;
2364 ++ WRITE_ONCE(po->num, 0);
2365 + __unregister_prot_hook(sk, true);
2366 + rcu_read_lock();
2367 + dev_curr = po->prot_hook.dev;
2368 +@@ -3187,17 +3187,17 @@ static int packet_do_bind(struct sock *sk, const char *name, int ifindex,
2369 + }
2370 +
2371 + BUG_ON(po->running);
2372 +- po->num = proto;
2373 ++ WRITE_ONCE(po->num, proto);
2374 + po->prot_hook.type = proto;
2375 +
2376 + if (unlikely(unlisted)) {
2377 + dev_put(dev);
2378 + po->prot_hook.dev = NULL;
2379 +- po->ifindex = -1;
2380 ++ WRITE_ONCE(po->ifindex, -1);
2381 + packet_cached_dev_reset(po);
2382 + } else {
2383 + po->prot_hook.dev = dev;
2384 +- po->ifindex = dev ? dev->ifindex : 0;
2385 ++ WRITE_ONCE(po->ifindex, dev ? dev->ifindex : 0);
2386 + packet_cached_dev_assign(po, dev);
2387 + }
2388 + }
2389 +@@ -3512,7 +3512,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr,
2390 + uaddr->sa_family = AF_PACKET;
2391 + memset(uaddr->sa_data, 0, sizeof(uaddr->sa_data));
2392 + rcu_read_lock();
2393 +- dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex);
2394 ++ dev = dev_get_by_index_rcu(sock_net(sk), READ_ONCE(pkt_sk(sk)->ifindex));
2395 + if (dev)
2396 + strlcpy(uaddr->sa_data, dev->name, sizeof(uaddr->sa_data));
2397 + rcu_read_unlock();
2398 +@@ -3528,16 +3528,18 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr,
2399 + struct sock *sk = sock->sk;
2400 + struct packet_sock *po = pkt_sk(sk);
2401 + DECLARE_SOCKADDR(struct sockaddr_ll *, sll, uaddr);
2402 ++ int ifindex;
2403 +
2404 + if (peer)
2405 + return -EOPNOTSUPP;
2406 +
2407 ++ ifindex = READ_ONCE(po->ifindex);
2408 + sll->sll_family = AF_PACKET;
2409 +- sll->sll_ifindex = po->ifindex;
2410 +- sll->sll_protocol = po->num;
2411 ++ sll->sll_ifindex = ifindex;
2412 ++ sll->sll_protocol = READ_ONCE(po->num);
2413 + sll->sll_pkttype = 0;
2414 + rcu_read_lock();
2415 +- dev = dev_get_by_index_rcu(sock_net(sk), po->ifindex);
2416 ++ dev = dev_get_by_index_rcu(sock_net(sk), ifindex);
2417 + if (dev) {
2418 + sll->sll_hatype = dev->type;
2419 + sll->sll_halen = dev->addr_len;
2420 +@@ -4117,7 +4119,7 @@ static int packet_notifier(struct notifier_block *this,
2421 + }
2422 + if (msg == NETDEV_UNREGISTER) {
2423 + packet_cached_dev_reset(po);
2424 +- po->ifindex = -1;
2425 ++ WRITE_ONCE(po->ifindex, -1);
2426 + if (po->prot_hook.dev)
2427 + dev_put(po->prot_hook.dev);
2428 + po->prot_hook.dev = NULL;
2429 +@@ -4429,7 +4431,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
2430 + was_running = po->running;
2431 + num = po->num;
2432 + if (was_running) {
2433 +- po->num = 0;
2434 ++ WRITE_ONCE(po->num, 0);
2435 + __unregister_prot_hook(sk, false);
2436 + }
2437 + spin_unlock(&po->bind_lock);
2438 +@@ -4464,7 +4466,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
2439 +
2440 + spin_lock(&po->bind_lock);
2441 + if (was_running) {
2442 +- po->num = num;
2443 ++ WRITE_ONCE(po->num, num);
2444 + register_prot_hook(sk);
2445 + }
2446 + spin_unlock(&po->bind_lock);
2447 +@@ -4635,8 +4637,8 @@ static int packet_seq_show(struct seq_file *seq, void *v)
2448 + s,
2449 + refcount_read(&s->sk_refcnt),
2450 + s->sk_type,
2451 +- ntohs(po->num),
2452 +- po->ifindex,
2453 ++ ntohs(READ_ONCE(po->num)),
2454 ++ READ_ONCE(po->ifindex),
2455 + po->running,
2456 + atomic_read(&s->sk_rmem_alloc),
2457 + from_kuid_munged(seq_user_ns(seq), sock_i_uid(s)),
2458 +diff --git a/net/rds/recv.c b/net/rds/recv.c
2459 +index ef022d24f87ae..a1b2bdab6655d 100644
2460 +--- a/net/rds/recv.c
2461 ++++ b/net/rds/recv.c
2462 +@@ -663,7 +663,7 @@ int rds_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
2463 +
2464 + if (rds_cmsg_recv(inc, msg, rs)) {
2465 + ret = -EFAULT;
2466 +- goto out;
2467 ++ break;
2468 + }
2469 +
2470 + rds_stats_inc(s_recv_delivered);
2471 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
2472 +index 44ff3f5c22dfd..8e7054fc27f8b 100644
2473 +--- a/net/unix/af_unix.c
2474 ++++ b/net/unix/af_unix.c
2475 +@@ -535,12 +535,14 @@ static void unix_release_sock(struct sock *sk, int embrion)
2476 + u->path.mnt = NULL;
2477 + state = sk->sk_state;
2478 + sk->sk_state = TCP_CLOSE;
2479 ++
2480 ++ skpair = unix_peer(sk);
2481 ++ unix_peer(sk) = NULL;
2482 ++
2483 + unix_state_unlock(sk);
2484 +
2485 + wake_up_interruptible_all(&u->peer_wait);
2486 +
2487 +- skpair = unix_peer(sk);
2488 +-
2489 + if (skpair != NULL) {
2490 + if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) {
2491 + unix_state_lock(skpair);
2492 +@@ -555,7 +557,6 @@ static void unix_release_sock(struct sock *sk, int embrion)
2493 +
2494 + unix_dgram_peer_wake_disconnect(sk, skpair);
2495 + sock_put(skpair); /* It may now die */
2496 +- unix_peer(sk) = NULL;
2497 + }
2498 +
2499 + /* Try to flush out this socket. Throw out buffers at least */
2500 +diff --git a/net/wireless/util.c b/net/wireless/util.c
2501 +index b3895a8a48ab2..bf4dd297a4db4 100644
2502 +--- a/net/wireless/util.c
2503 ++++ b/net/wireless/util.c
2504 +@@ -1041,6 +1041,9 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
2505 + case NL80211_IFTYPE_MESH_POINT:
2506 + /* mesh should be handled? */
2507 + break;
2508 ++ case NL80211_IFTYPE_OCB:
2509 ++ cfg80211_leave_ocb(rdev, dev);
2510 ++ break;
2511 + default:
2512 + break;
2513 + }
2514 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
2515 +index 987e5f8cafbe3..fd0a6c6c77b62 100644
2516 +--- a/net/x25/af_x25.c
2517 ++++ b/net/x25/af_x25.c
2518 +@@ -550,7 +550,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol,
2519 + if (protocol)
2520 + goto out;
2521 +
2522 +- rc = -ENOBUFS;
2523 ++ rc = -ENOMEM;
2524 + if ((sk = x25_alloc_socket(net, kern)) == NULL)
2525 + goto out;
2526 +