Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:5.4 commit in: /
Date: Wed, 03 Jun 2020 11:43:25
Message-Id: 1591184590.32f277919977365296c2c26c068a8a0ab72a87d5.mpagano@gentoo
1 commit: 32f277919977365296c2c26c068a8a0ab72a87d5
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jun 3 11:43:10 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 3 11:43:10 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=32f27791
7
8 Linux patch 5.4.44
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1043_linux-5.4.44.patch | 4629 +++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 4633 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 750ca68..a5f1550 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -215,6 +215,10 @@ Patch: 1042_linux-5.4.43.patch
21 From: http://www.kernel.org
22 Desc: Linux 5.4.43
23
24 +Patch: 1043_linux-5.4.44.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 5.4.44
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/1043_linux-5.4.44.patch b/1043_linux-5.4.44.patch
33 new file mode 100644
34 index 0000000..48842cd
35 --- /dev/null
36 +++ b/1043_linux-5.4.44.patch
37 @@ -0,0 +1,4629 @@
38 +diff --git a/Makefile b/Makefile
39 +index 7d7cf0082443..ef4697fcb8ea 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 5
45 + PATCHLEVEL = 4
46 +-SUBLEVEL = 43
47 ++SUBLEVEL = 44
48 + EXTRAVERSION =
49 + NAME = Kleptomaniac Octopus
50 +
51 +diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S
52 +index fc7ed03d8b93..51b078604978 100644
53 +--- a/arch/arm/boot/compressed/vmlinux.lds.S
54 ++++ b/arch/arm/boot/compressed/vmlinux.lds.S
55 +@@ -43,7 +43,7 @@ SECTIONS
56 + }
57 + .table : ALIGN(4) {
58 + _table_start = .;
59 +- LONG(ZIMAGE_MAGIC(2))
60 ++ LONG(ZIMAGE_MAGIC(4))
61 + LONG(ZIMAGE_MAGIC(0x5a534c4b))
62 + LONG(ZIMAGE_MAGIC(__piggy_size_addr - _start))
63 + LONG(ZIMAGE_MAGIC(_kernel_bss_size))
64 +diff --git a/arch/arm/boot/dts/bcm-hr2.dtsi b/arch/arm/boot/dts/bcm-hr2.dtsi
65 +index e4d49731287f..e35398cc60a0 100644
66 +--- a/arch/arm/boot/dts/bcm-hr2.dtsi
67 ++++ b/arch/arm/boot/dts/bcm-hr2.dtsi
68 +@@ -75,7 +75,7 @@
69 + timer@20200 {
70 + compatible = "arm,cortex-a9-global-timer";
71 + reg = <0x20200 0x100>;
72 +- interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
73 ++ interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
74 + clocks = <&periph_clk>;
75 + };
76 +
77 +@@ -83,7 +83,7 @@
78 + compatible = "arm,cortex-a9-twd-timer";
79 + reg = <0x20600 0x20>;
80 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(1) |
81 +- IRQ_TYPE_LEVEL_HIGH)>;
82 ++ IRQ_TYPE_EDGE_RISING)>;
83 + clocks = <&periph_clk>;
84 + };
85 +
86 +@@ -91,7 +91,7 @@
87 + compatible = "arm,cortex-a9-twd-wdt";
88 + reg = <0x20620 0x20>;
89 + interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(1) |
90 +- IRQ_TYPE_LEVEL_HIGH)>;
91 ++ IRQ_TYPE_EDGE_RISING)>;
92 + clocks = <&periph_clk>;
93 + };
94 +
95 +diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
96 +index 4c3f606e5b8d..f65448c01e31 100644
97 +--- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
98 ++++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
99 +@@ -24,7 +24,7 @@
100 +
101 + leds {
102 + act {
103 +- gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
104 ++ gpios = <&gpio 47 GPIO_ACTIVE_LOW>;
105 + };
106 + };
107 +
108 +diff --git a/arch/arm/boot/dts/imx6q-b450v3.dts b/arch/arm/boot/dts/imx6q-b450v3.dts
109 +index 95b8f2d71821..fb0980190aa0 100644
110 +--- a/arch/arm/boot/dts/imx6q-b450v3.dts
111 ++++ b/arch/arm/boot/dts/imx6q-b450v3.dts
112 +@@ -65,13 +65,6 @@
113 + };
114 + };
115 +
116 +-&clks {
117 +- assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
118 +- <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
119 +- assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
120 +- <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
121 +-};
122 +-
123 + &ldb {
124 + status = "okay";
125 +
126 +diff --git a/arch/arm/boot/dts/imx6q-b650v3.dts b/arch/arm/boot/dts/imx6q-b650v3.dts
127 +index 611cb7ae7e55..8f762d9c5ae9 100644
128 +--- a/arch/arm/boot/dts/imx6q-b650v3.dts
129 ++++ b/arch/arm/boot/dts/imx6q-b650v3.dts
130 +@@ -65,13 +65,6 @@
131 + };
132 + };
133 +
134 +-&clks {
135 +- assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
136 +- <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
137 +- assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
138 +- <&clks IMX6QDL_CLK_PLL3_USB_OTG>;
139 +-};
140 +-
141 + &ldb {
142 + status = "okay";
143 +
144 +diff --git a/arch/arm/boot/dts/imx6q-b850v3.dts b/arch/arm/boot/dts/imx6q-b850v3.dts
145 +index e4cb118f88c6..1ea64ecf4291 100644
146 +--- a/arch/arm/boot/dts/imx6q-b850v3.dts
147 ++++ b/arch/arm/boot/dts/imx6q-b850v3.dts
148 +@@ -53,17 +53,6 @@
149 + };
150 + };
151 +
152 +-&clks {
153 +- assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
154 +- <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
155 +- <&clks IMX6QDL_CLK_IPU1_DI0_PRE_SEL>,
156 +- <&clks IMX6QDL_CLK_IPU2_DI0_PRE_SEL>;
157 +- assigned-clock-parents = <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
158 +- <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
159 +- <&clks IMX6QDL_CLK_PLL2_PFD2_396M>,
160 +- <&clks IMX6QDL_CLK_PLL2_PFD2_396M>;
161 +-};
162 +-
163 + &ldb {
164 + fsl,dual-channel;
165 + status = "okay";
166 +diff --git a/arch/arm/boot/dts/imx6q-bx50v3.dtsi b/arch/arm/boot/dts/imx6q-bx50v3.dtsi
167 +index fa27dcdf06f1..1938b04199c4 100644
168 +--- a/arch/arm/boot/dts/imx6q-bx50v3.dtsi
169 ++++ b/arch/arm/boot/dts/imx6q-bx50v3.dtsi
170 +@@ -377,3 +377,18 @@
171 + #interrupt-cells = <1>;
172 + };
173 + };
174 ++
175 ++&clks {
176 ++ assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
177 ++ <&clks IMX6QDL_CLK_LDB_DI1_SEL>,
178 ++ <&clks IMX6QDL_CLK_IPU1_DI0_PRE_SEL>,
179 ++ <&clks IMX6QDL_CLK_IPU1_DI1_PRE_SEL>,
180 ++ <&clks IMX6QDL_CLK_IPU2_DI0_PRE_SEL>,
181 ++ <&clks IMX6QDL_CLK_IPU2_DI1_PRE_SEL>;
182 ++ assigned-clock-parents = <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
183 ++ <&clks IMX6QDL_CLK_PLL5_VIDEO_DIV>,
184 ++ <&clks IMX6QDL_CLK_PLL2_PFD0_352M>,
185 ++ <&clks IMX6QDL_CLK_PLL2_PFD0_352M>,
186 ++ <&clks IMX6QDL_CLK_PLL2_PFD0_352M>,
187 ++ <&clks IMX6QDL_CLK_PLL2_PFD0_352M>;
188 ++};
189 +diff --git a/arch/arm/boot/dts/rk3036.dtsi b/arch/arm/boot/dts/rk3036.dtsi
190 +index c776321b2cc4..d282a7b638d8 100644
191 +--- a/arch/arm/boot/dts/rk3036.dtsi
192 ++++ b/arch/arm/boot/dts/rk3036.dtsi
193 +@@ -128,7 +128,7 @@
194 + assigned-clocks = <&cru SCLK_GPU>;
195 + assigned-clock-rates = <100000000>;
196 + clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>;
197 +- clock-names = "core", "bus";
198 ++ clock-names = "bus", "core";
199 + resets = <&cru SRST_GPU>;
200 + status = "disabled";
201 + };
202 +diff --git a/arch/arm/boot/dts/rk3228-evb.dts b/arch/arm/boot/dts/rk3228-evb.dts
203 +index 5670b33fd1bd..aed879db6c15 100644
204 +--- a/arch/arm/boot/dts/rk3228-evb.dts
205 ++++ b/arch/arm/boot/dts/rk3228-evb.dts
206 +@@ -46,7 +46,7 @@
207 + #address-cells = <1>;
208 + #size-cells = <0>;
209 +
210 +- phy: phy@0 {
211 ++ phy: ethernet-phy@0 {
212 + compatible = "ethernet-phy-id1234.d400", "ethernet-phy-ieee802.3-c22";
213 + reg = <0>;
214 + clocks = <&cru SCLK_MAC_PHY>;
215 +diff --git a/arch/arm/boot/dts/rk3229-xms6.dts b/arch/arm/boot/dts/rk3229-xms6.dts
216 +index 679fc2b00e5a..933ef69da32a 100644
217 +--- a/arch/arm/boot/dts/rk3229-xms6.dts
218 ++++ b/arch/arm/boot/dts/rk3229-xms6.dts
219 +@@ -150,7 +150,7 @@
220 + #address-cells = <1>;
221 + #size-cells = <0>;
222 +
223 +- phy: phy@0 {
224 ++ phy: ethernet-phy@0 {
225 + compatible = "ethernet-phy-id1234.d400",
226 + "ethernet-phy-ieee802.3-c22";
227 + reg = <0>;
228 +diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
229 +index 340ed6ccb08f..6bb78b19c555 100644
230 +--- a/arch/arm/boot/dts/rk322x.dtsi
231 ++++ b/arch/arm/boot/dts/rk322x.dtsi
232 +@@ -561,7 +561,7 @@
233 + "pp1",
234 + "ppmmu1";
235 + clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
236 +- clock-names = "core", "bus";
237 ++ clock-names = "bus", "core";
238 + resets = <&cru SRST_GPU_A>;
239 + status = "disabled";
240 + };
241 +@@ -1033,7 +1033,7 @@
242 + };
243 + };
244 +
245 +- spi-0 {
246 ++ spi0 {
247 + spi0_clk: spi0-clk {
248 + rockchip,pins = <0 RK_PB1 2 &pcfg_pull_up>;
249 + };
250 +@@ -1051,7 +1051,7 @@
251 + };
252 + };
253 +
254 +- spi-1 {
255 ++ spi1 {
256 + spi1_clk: spi1-clk {
257 + rockchip,pins = <0 RK_PC7 2 &pcfg_pull_up>;
258 + };
259 +diff --git a/arch/arm/boot/dts/rk3xxx.dtsi b/arch/arm/boot/dts/rk3xxx.dtsi
260 +index 97307a405e60..bce0b05ef7bf 100644
261 +--- a/arch/arm/boot/dts/rk3xxx.dtsi
262 ++++ b/arch/arm/boot/dts/rk3xxx.dtsi
263 +@@ -84,7 +84,7 @@
264 + compatible = "arm,mali-400";
265 + reg = <0x10090000 0x10000>;
266 + clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>;
267 +- clock-names = "core", "bus";
268 ++ clock-names = "bus", "core";
269 + assigned-clocks = <&cru ACLK_GPU>;
270 + assigned-clock-rates = <100000000>;
271 + resets = <&cru SRST_GPU>;
272 +diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
273 +index 99929122dad7..3546d294d55f 100644
274 +--- a/arch/arm/include/asm/assembler.h
275 ++++ b/arch/arm/include/asm/assembler.h
276 +@@ -18,11 +18,11 @@
277 + #endif
278 +
279 + #include <asm/ptrace.h>
280 +-#include <asm/domain.h>
281 + #include <asm/opcodes-virt.h>
282 + #include <asm/asm-offsets.h>
283 + #include <asm/page.h>
284 + #include <asm/thread_info.h>
285 ++#include <asm/uaccess-asm.h>
286 +
287 + #define IOMEM(x) (x)
288 +
289 +@@ -446,79 +446,6 @@ THUMB( orr \reg , \reg , #PSR_T_BIT )
290 + .size \name , . - \name
291 + .endm
292 +
293 +- .macro csdb
294 +-#ifdef CONFIG_THUMB2_KERNEL
295 +- .inst.w 0xf3af8014
296 +-#else
297 +- .inst 0xe320f014
298 +-#endif
299 +- .endm
300 +-
301 +- .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
302 +-#ifndef CONFIG_CPU_USE_DOMAINS
303 +- adds \tmp, \addr, #\size - 1
304 +- sbcscc \tmp, \tmp, \limit
305 +- bcs \bad
306 +-#ifdef CONFIG_CPU_SPECTRE
307 +- movcs \addr, #0
308 +- csdb
309 +-#endif
310 +-#endif
311 +- .endm
312 +-
313 +- .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req
314 +-#ifdef CONFIG_CPU_SPECTRE
315 +- sub \tmp, \limit, #1
316 +- subs \tmp, \tmp, \addr @ tmp = limit - 1 - addr
317 +- addhs \tmp, \tmp, #1 @ if (tmp >= 0) {
318 +- subshs \tmp, \tmp, \size @ tmp = limit - (addr + size) }
319 +- movlo \addr, #0 @ if (tmp < 0) addr = NULL
320 +- csdb
321 +-#endif
322 +- .endm
323 +-
324 +- .macro uaccess_disable, tmp, isb=1
325 +-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
326 +- /*
327 +- * Whenever we re-enter userspace, the domains should always be
328 +- * set appropriately.
329 +- */
330 +- mov \tmp, #DACR_UACCESS_DISABLE
331 +- mcr p15, 0, \tmp, c3, c0, 0 @ Set domain register
332 +- .if \isb
333 +- instr_sync
334 +- .endif
335 +-#endif
336 +- .endm
337 +-
338 +- .macro uaccess_enable, tmp, isb=1
339 +-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
340 +- /*
341 +- * Whenever we re-enter userspace, the domains should always be
342 +- * set appropriately.
343 +- */
344 +- mov \tmp, #DACR_UACCESS_ENABLE
345 +- mcr p15, 0, \tmp, c3, c0, 0
346 +- .if \isb
347 +- instr_sync
348 +- .endif
349 +-#endif
350 +- .endm
351 +-
352 +- .macro uaccess_save, tmp
353 +-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
354 +- mrc p15, 0, \tmp, c3, c0, 0
355 +- str \tmp, [sp, #SVC_DACR]
356 +-#endif
357 +- .endm
358 +-
359 +- .macro uaccess_restore
360 +-#ifdef CONFIG_CPU_SW_DOMAIN_PAN
361 +- ldr r0, [sp, #SVC_DACR]
362 +- mcr p15, 0, r0, c3, c0, 0
363 +-#endif
364 +- .endm
365 +-
366 + .irp c,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo
367 + .macro ret\c, reg
368 + #if __LINUX_ARM_ARCH__ < 6
369 +diff --git a/arch/arm/include/asm/uaccess-asm.h b/arch/arm/include/asm/uaccess-asm.h
370 +new file mode 100644
371 +index 000000000000..907571fd05c6
372 +--- /dev/null
373 ++++ b/arch/arm/include/asm/uaccess-asm.h
374 +@@ -0,0 +1,117 @@
375 ++/* SPDX-License-Identifier: GPL-2.0-only */
376 ++
377 ++#ifndef __ASM_UACCESS_ASM_H__
378 ++#define __ASM_UACCESS_ASM_H__
379 ++
380 ++#include <asm/asm-offsets.h>
381 ++#include <asm/domain.h>
382 ++#include <asm/memory.h>
383 ++#include <asm/thread_info.h>
384 ++
385 ++ .macro csdb
386 ++#ifdef CONFIG_THUMB2_KERNEL
387 ++ .inst.w 0xf3af8014
388 ++#else
389 ++ .inst 0xe320f014
390 ++#endif
391 ++ .endm
392 ++
393 ++ .macro check_uaccess, addr:req, size:req, limit:req, tmp:req, bad:req
394 ++#ifndef CONFIG_CPU_USE_DOMAINS
395 ++ adds \tmp, \addr, #\size - 1
396 ++ sbcscc \tmp, \tmp, \limit
397 ++ bcs \bad
398 ++#ifdef CONFIG_CPU_SPECTRE
399 ++ movcs \addr, #0
400 ++ csdb
401 ++#endif
402 ++#endif
403 ++ .endm
404 ++
405 ++ .macro uaccess_mask_range_ptr, addr:req, size:req, limit:req, tmp:req
406 ++#ifdef CONFIG_CPU_SPECTRE
407 ++ sub \tmp, \limit, #1
408 ++ subs \tmp, \tmp, \addr @ tmp = limit - 1 - addr
409 ++ addhs \tmp, \tmp, #1 @ if (tmp >= 0) {
410 ++ subshs \tmp, \tmp, \size @ tmp = limit - (addr + size) }
411 ++ movlo \addr, #0 @ if (tmp < 0) addr = NULL
412 ++ csdb
413 ++#endif
414 ++ .endm
415 ++
416 ++ .macro uaccess_disable, tmp, isb=1
417 ++#ifdef CONFIG_CPU_SW_DOMAIN_PAN
418 ++ /*
419 ++ * Whenever we re-enter userspace, the domains should always be
420 ++ * set appropriately.
421 ++ */
422 ++ mov \tmp, #DACR_UACCESS_DISABLE
423 ++ mcr p15, 0, \tmp, c3, c0, 0 @ Set domain register
424 ++ .if \isb
425 ++ instr_sync
426 ++ .endif
427 ++#endif
428 ++ .endm
429 ++
430 ++ .macro uaccess_enable, tmp, isb=1
431 ++#ifdef CONFIG_CPU_SW_DOMAIN_PAN
432 ++ /*
433 ++ * Whenever we re-enter userspace, the domains should always be
434 ++ * set appropriately.
435 ++ */
436 ++ mov \tmp, #DACR_UACCESS_ENABLE
437 ++ mcr p15, 0, \tmp, c3, c0, 0
438 ++ .if \isb
439 ++ instr_sync
440 ++ .endif
441 ++#endif
442 ++ .endm
443 ++
444 ++#if defined(CONFIG_CPU_SW_DOMAIN_PAN) || defined(CONFIG_CPU_USE_DOMAINS)
445 ++#define DACR(x...) x
446 ++#else
447 ++#define DACR(x...)
448 ++#endif
449 ++
450 ++ /*
451 ++ * Save the address limit on entry to a privileged exception.
452 ++ *
453 ++ * If we are using the DACR for kernel access by the user accessors
454 ++ * (CONFIG_CPU_USE_DOMAINS=y), always reset the DACR kernel domain
455 ++ * back to client mode, whether or not \disable is set.
456 ++ *
457 ++ * If we are using SW PAN, set the DACR user domain to no access
458 ++ * if \disable is set.
459 ++ */
460 ++ .macro uaccess_entry, tsk, tmp0, tmp1, tmp2, disable
461 ++ ldr \tmp1, [\tsk, #TI_ADDR_LIMIT]
462 ++ mov \tmp2, #TASK_SIZE
463 ++ str \tmp2, [\tsk, #TI_ADDR_LIMIT]
464 ++ DACR( mrc p15, 0, \tmp0, c3, c0, 0)
465 ++ DACR( str \tmp0, [sp, #SVC_DACR])
466 ++ str \tmp1, [sp, #SVC_ADDR_LIMIT]
467 ++ .if \disable && IS_ENABLED(CONFIG_CPU_SW_DOMAIN_PAN)
468 ++ /* kernel=client, user=no access */
469 ++ mov \tmp2, #DACR_UACCESS_DISABLE
470 ++ mcr p15, 0, \tmp2, c3, c0, 0
471 ++ instr_sync
472 ++ .elseif IS_ENABLED(CONFIG_CPU_USE_DOMAINS)
473 ++ /* kernel=client */
474 ++ bic \tmp2, \tmp0, #domain_mask(DOMAIN_KERNEL)
475 ++ orr \tmp2, \tmp2, #domain_val(DOMAIN_KERNEL, DOMAIN_CLIENT)
476 ++ mcr p15, 0, \tmp2, c3, c0, 0
477 ++ instr_sync
478 ++ .endif
479 ++ .endm
480 ++
481 ++ /* Restore the user access state previously saved by uaccess_entry */
482 ++ .macro uaccess_exit, tsk, tmp0, tmp1
483 ++ ldr \tmp1, [sp, #SVC_ADDR_LIMIT]
484 ++ DACR( ldr \tmp0, [sp, #SVC_DACR])
485 ++ str \tmp1, [\tsk, #TI_ADDR_LIMIT]
486 ++ DACR( mcr p15, 0, \tmp0, c3, c0, 0)
487 ++ .endm
488 ++
489 ++#undef DACR
490 ++
491 ++#endif /* __ASM_UACCESS_ASM_H__ */
492 +diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
493 +index 858d4e541532..a874b753397e 100644
494 +--- a/arch/arm/kernel/entry-armv.S
495 ++++ b/arch/arm/kernel/entry-armv.S
496 +@@ -27,6 +27,7 @@
497 + #include <asm/unistd.h>
498 + #include <asm/tls.h>
499 + #include <asm/system_info.h>
500 ++#include <asm/uaccess-asm.h>
501 +
502 + #include "entry-header.S"
503 + #include <asm/entry-macro-multi.S>
504 +@@ -179,15 +180,7 @@ ENDPROC(__und_invalid)
505 + stmia r7, {r2 - r6}
506 +
507 + get_thread_info tsk
508 +- ldr r0, [tsk, #TI_ADDR_LIMIT]
509 +- mov r1, #TASK_SIZE
510 +- str r1, [tsk, #TI_ADDR_LIMIT]
511 +- str r0, [sp, #SVC_ADDR_LIMIT]
512 +-
513 +- uaccess_save r0
514 +- .if \uaccess
515 +- uaccess_disable r0
516 +- .endif
517 ++ uaccess_entry tsk, r0, r1, r2, \uaccess
518 +
519 + .if \trace
520 + #ifdef CONFIG_TRACE_IRQFLAGS
521 +diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
522 +index 32051ec5b33f..40db0f9188b6 100644
523 +--- a/arch/arm/kernel/entry-header.S
524 ++++ b/arch/arm/kernel/entry-header.S
525 +@@ -6,6 +6,7 @@
526 + #include <asm/asm-offsets.h>
527 + #include <asm/errno.h>
528 + #include <asm/thread_info.h>
529 ++#include <asm/uaccess-asm.h>
530 + #include <asm/v7m.h>
531 +
532 + @ Bad Abort numbers
533 +@@ -217,9 +218,7 @@
534 + blne trace_hardirqs_off
535 + #endif
536 + .endif
537 +- ldr r1, [sp, #SVC_ADDR_LIMIT]
538 +- uaccess_restore
539 +- str r1, [tsk, #TI_ADDR_LIMIT]
540 ++ uaccess_exit tsk, r0, r1
541 +
542 + #ifndef CONFIG_THUMB2_KERNEL
543 + @ ARM mode SVC restore
544 +@@ -263,9 +262,7 @@
545 + @ on the stack remains correct).
546 + @
547 + .macro svc_exit_via_fiq
548 +- ldr r1, [sp, #SVC_ADDR_LIMIT]
549 +- uaccess_restore
550 +- str r1, [tsk, #TI_ADDR_LIMIT]
551 ++ uaccess_exit tsk, r0, r1
552 + #ifndef CONFIG_THUMB2_KERNEL
553 + @ ARM mode restore
554 + mov r0, sp
555 +diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
556 +index 15f1842f6df3..5891b7151432 100644
557 +--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
558 ++++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
559 +@@ -1397,8 +1397,8 @@
560 + "venc_lt_sel";
561 + assigned-clocks = <&topckgen CLK_TOP_VENC_SEL>,
562 + <&topckgen CLK_TOP_VENC_LT_SEL>;
563 +- assigned-clock-parents = <&topckgen CLK_TOP_VENCPLL_D2>,
564 +- <&topckgen CLK_TOP_UNIVPLL1_D2>;
565 ++ assigned-clock-parents = <&topckgen CLK_TOP_VCODECPLL>,
566 ++ <&topckgen CLK_TOP_VCODECPLL_370P5>;
567 + };
568 +
569 + vencltsys: clock-controller@19000000 {
570 +diff --git a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
571 +index 6abc6f4a86cf..05265b38cc02 100644
572 +--- a/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
573 ++++ b/arch/arm64/boot/dts/rockchip/rk3328-evb.dts
574 +@@ -86,7 +86,7 @@
575 + assigned-clock-rate = <50000000>;
576 + assigned-clocks = <&cru SCLK_MAC2PHY>;
577 + assigned-clock-parents = <&cru SCLK_MAC2PHY_SRC>;
578 +-
579 ++ status = "okay";
580 + };
581 +
582 + &i2c1 {
583 +diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
584 +index cd97016b7c18..c5d8d1c58291 100644
585 +--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
586 ++++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
587 +@@ -1881,10 +1881,10 @@
588 + gpu: gpu@ff9a0000 {
589 + compatible = "rockchip,rk3399-mali", "arm,mali-t860";
590 + reg = <0x0 0xff9a0000 0x0 0x10000>;
591 +- interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>,
592 +- <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>,
593 +- <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>;
594 +- interrupt-names = "gpu", "job", "mmu";
595 ++ interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH 0>,
596 ++ <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH 0>,
597 ++ <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH 0>;
598 ++ interrupt-names = "job", "mmu", "gpu";
599 + clocks = <&cru ACLK_GPU>;
600 + power-domains = <&power RK3399_PD_GPU>;
601 + status = "disabled";
602 +diff --git a/arch/csky/abiv1/inc/abi/entry.h b/arch/csky/abiv1/inc/abi/entry.h
603 +index 5056ebb902d1..61d94ec7dd16 100644
604 +--- a/arch/csky/abiv1/inc/abi/entry.h
605 ++++ b/arch/csky/abiv1/inc/abi/entry.h
606 +@@ -167,8 +167,8 @@
607 + * BA Reserved C D V
608 + */
609 + cprcr r6, cpcr30
610 +- lsri r6, 28
611 +- lsli r6, 28
612 ++ lsri r6, 29
613 ++ lsli r6, 29
614 + addi r6, 0xe
615 + cpwcr r6, cpcr30
616 +
617 +diff --git a/arch/csky/abiv2/inc/abi/entry.h b/arch/csky/abiv2/inc/abi/entry.h
618 +index 111973c6c713..9023828ede97 100644
619 +--- a/arch/csky/abiv2/inc/abi/entry.h
620 ++++ b/arch/csky/abiv2/inc/abi/entry.h
621 +@@ -225,8 +225,8 @@
622 + */
623 + mfcr r6, cr<30, 15> /* Get MSA0 */
624 + 2:
625 +- lsri r6, 28
626 +- lsli r6, 28
627 ++ lsri r6, 29
628 ++ lsli r6, 29
629 + addi r6, 0x1ce
630 + mtcr r6, cr<30, 15> /* Set MSA0 */
631 +
632 +diff --git a/arch/csky/include/asm/uaccess.h b/arch/csky/include/asm/uaccess.h
633 +index eaa1c3403a42..60f8a4112588 100644
634 +--- a/arch/csky/include/asm/uaccess.h
635 ++++ b/arch/csky/include/asm/uaccess.h
636 +@@ -254,7 +254,7 @@ do { \
637 +
638 + extern int __get_user_bad(void);
639 +
640 +-#define __copy_user(to, from, n) \
641 ++#define ___copy_to_user(to, from, n) \
642 + do { \
643 + int w0, w1, w2, w3; \
644 + asm volatile( \
645 +@@ -289,31 +289,34 @@ do { \
646 + " subi %0, 4 \n" \
647 + " br 3b \n" \
648 + "5: cmpnei %0, 0 \n" /* 1B */ \
649 +- " bf 8f \n" \
650 ++ " bf 13f \n" \
651 + " ldb %3, (%2, 0) \n" \
652 + "6: stb %3, (%1, 0) \n" \
653 + " addi %2, 1 \n" \
654 + " addi %1, 1 \n" \
655 + " subi %0, 1 \n" \
656 + " br 5b \n" \
657 +- "7: br 8f \n" \
658 ++ "7: subi %0, 4 \n" \
659 ++ "8: subi %0, 4 \n" \
660 ++ "12: subi %0, 4 \n" \
661 ++ " br 13f \n" \
662 + ".section __ex_table, \"a\" \n" \
663 + ".align 2 \n" \
664 +- ".long 2b, 7b \n" \
665 +- ".long 9b, 7b \n" \
666 +- ".long 10b, 7b \n" \
667 ++ ".long 2b, 13f \n" \
668 ++ ".long 4b, 13f \n" \
669 ++ ".long 6b, 13f \n" \
670 ++ ".long 9b, 12b \n" \
671 ++ ".long 10b, 8b \n" \
672 + ".long 11b, 7b \n" \
673 +- ".long 4b, 7b \n" \
674 +- ".long 6b, 7b \n" \
675 + ".previous \n" \
676 +- "8: \n" \
677 ++ "13: \n" \
678 + : "=r"(n), "=r"(to), "=r"(from), "=r"(w0), \
679 + "=r"(w1), "=r"(w2), "=r"(w3) \
680 + : "0"(n), "1"(to), "2"(from) \
681 + : "memory"); \
682 + } while (0)
683 +
684 +-#define __copy_user_zeroing(to, from, n) \
685 ++#define ___copy_from_user(to, from, n) \
686 + do { \
687 + int tmp; \
688 + int nsave; \
689 +@@ -356,22 +359,22 @@ do { \
690 + " addi %1, 1 \n" \
691 + " subi %0, 1 \n" \
692 + " br 5b \n" \
693 +- "8: mov %3, %0 \n" \
694 +- " movi %4, 0 \n" \
695 +- "9: stb %4, (%1, 0) \n" \
696 +- " addi %1, 1 \n" \
697 +- " subi %3, 1 \n" \
698 +- " cmpnei %3, 0 \n" \
699 +- " bt 9b \n" \
700 +- " br 7f \n" \
701 ++ "8: stw %3, (%1, 0) \n" \
702 ++ " subi %0, 4 \n" \
703 ++ " bf 7f \n" \
704 ++ "9: subi %0, 8 \n" \
705 ++ " bf 7f \n" \
706 ++ "13: stw %3, (%1, 8) \n" \
707 ++ " subi %0, 12 \n" \
708 ++ " bf 7f \n" \
709 + ".section __ex_table, \"a\" \n" \
710 + ".align 2 \n" \
711 +- ".long 2b, 8b \n" \
712 ++ ".long 2b, 7f \n" \
713 ++ ".long 4b, 7f \n" \
714 ++ ".long 6b, 7f \n" \
715 + ".long 10b, 8b \n" \
716 +- ".long 11b, 8b \n" \
717 +- ".long 12b, 8b \n" \
718 +- ".long 4b, 8b \n" \
719 +- ".long 6b, 8b \n" \
720 ++ ".long 11b, 9b \n" \
721 ++ ".long 12b,13b \n" \
722 + ".previous \n" \
723 + "7: \n" \
724 + : "=r"(n), "=r"(to), "=r"(from), "=r"(nsave), \
725 +diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
726 +index a7a5b67df898..65c55f22532a 100644
727 +--- a/arch/csky/kernel/entry.S
728 ++++ b/arch/csky/kernel/entry.S
729 +@@ -318,8 +318,6 @@ ENTRY(__switch_to)
730 +
731 + mfcr a2, psr /* Save PSR value */
732 + stw a2, (a3, THREAD_SR) /* Save PSR in task struct */
733 +- bclri a2, 6 /* Disable interrupts */
734 +- mtcr a2, psr
735 +
736 + SAVE_SWITCH_STACK
737 +
738 +diff --git a/arch/csky/kernel/perf_callchain.c b/arch/csky/kernel/perf_callchain.c
739 +index e68ff375c8f8..ab55e98ee8f6 100644
740 +--- a/arch/csky/kernel/perf_callchain.c
741 ++++ b/arch/csky/kernel/perf_callchain.c
742 +@@ -12,12 +12,17 @@ struct stackframe {
743 +
744 + static int unwind_frame_kernel(struct stackframe *frame)
745 + {
746 +- if (kstack_end((void *)frame->fp))
747 ++ unsigned long low = (unsigned long)task_stack_page(current);
748 ++ unsigned long high = low + THREAD_SIZE;
749 ++
750 ++ if (unlikely(frame->fp < low || frame->fp > high))
751 + return -EPERM;
752 +- if (frame->fp & 0x3 || frame->fp < TASK_SIZE)
753 ++
754 ++ if (kstack_end((void *)frame->fp) || frame->fp & 0x3)
755 + return -EPERM;
756 +
757 + *frame = *(struct stackframe *)frame->fp;
758 ++
759 + if (__kernel_text_address(frame->lr)) {
760 + int graph = 0;
761 +
762 +diff --git a/arch/csky/lib/usercopy.c b/arch/csky/lib/usercopy.c
763 +index 647a23986fb5..3c9bd645e643 100644
764 +--- a/arch/csky/lib/usercopy.c
765 ++++ b/arch/csky/lib/usercopy.c
766 +@@ -7,10 +7,7 @@
767 + unsigned long raw_copy_from_user(void *to, const void *from,
768 + unsigned long n)
769 + {
770 +- if (access_ok(from, n))
771 +- __copy_user_zeroing(to, from, n);
772 +- else
773 +- memset(to, 0, n);
774 ++ ___copy_from_user(to, from, n);
775 + return n;
776 + }
777 + EXPORT_SYMBOL(raw_copy_from_user);
778 +@@ -18,8 +15,7 @@ EXPORT_SYMBOL(raw_copy_from_user);
779 + unsigned long raw_copy_to_user(void *to, const void *from,
780 + unsigned long n)
781 + {
782 +- if (access_ok(to, n))
783 +- __copy_user(to, from, n);
784 ++ ___copy_to_user(to, from, n);
785 + return n;
786 + }
787 + EXPORT_SYMBOL(raw_copy_to_user);
788 +diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
789 +index ddca8287d43b..3e54484797f6 100644
790 +--- a/arch/parisc/mm/init.c
791 ++++ b/arch/parisc/mm/init.c
792 +@@ -588,7 +588,7 @@ void __init mem_init(void)
793 + > BITS_PER_LONG);
794 +
795 + high_memory = __va((max_pfn << PAGE_SHIFT));
796 +- set_max_mapnr(page_to_pfn(virt_to_page(high_memory - 1)) + 1);
797 ++ set_max_mapnr(max_low_pfn);
798 + memblock_free_all();
799 +
800 + #ifdef CONFIG_PA11
801 +diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
802 +index 0940681d2f68..19e46f4160cc 100644
803 +--- a/arch/riscv/kernel/stacktrace.c
804 ++++ b/arch/riscv/kernel/stacktrace.c
805 +@@ -63,7 +63,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
806 +
807 + #else /* !CONFIG_FRAME_POINTER */
808 +
809 +-static void notrace walk_stackframe(struct task_struct *task,
810 ++void notrace walk_stackframe(struct task_struct *task,
811 + struct pt_regs *regs, bool (*fn)(unsigned long, void *), void *arg)
812 + {
813 + unsigned long sp, pc;
814 +diff --git a/arch/x86/include/asm/dma.h b/arch/x86/include/asm/dma.h
815 +index 00f7cf45e699..8e95aa4b0d17 100644
816 +--- a/arch/x86/include/asm/dma.h
817 ++++ b/arch/x86/include/asm/dma.h
818 +@@ -74,7 +74,7 @@
819 + #define MAX_DMA_PFN ((16UL * 1024 * 1024) >> PAGE_SHIFT)
820 +
821 + /* 4GB broken PCI/AGP hardware bus master zone */
822 +-#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
823 ++#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
824 +
825 + #ifdef CONFIG_X86_32
826 + /* The maximum address that we can perform a DMA transfer to on this platform */
827 +diff --git a/arch/x86/include/uapi/asm/unistd.h b/arch/x86/include/uapi/asm/unistd.h
828 +index 196fdd02b8b1..be5e2e747f50 100644
829 +--- a/arch/x86/include/uapi/asm/unistd.h
830 ++++ b/arch/x86/include/uapi/asm/unistd.h
831 +@@ -2,8 +2,15 @@
832 + #ifndef _UAPI_ASM_X86_UNISTD_H
833 + #define _UAPI_ASM_X86_UNISTD_H
834 +
835 +-/* x32 syscall flag bit */
836 +-#define __X32_SYSCALL_BIT 0x40000000UL
837 ++/*
838 ++ * x32 syscall flag bit. Some user programs expect syscall NR macros
839 ++ * and __X32_SYSCALL_BIT to have type int, even though syscall numbers
840 ++ * are, for practical purposes, unsigned long.
841 ++ *
842 ++ * Fortunately, expressions like (nr & ~__X32_SYSCALL_BIT) do the right
843 ++ * thing regardless.
844 ++ */
845 ++#define __X32_SYSCALL_BIT 0x40000000
846 +
847 + #ifndef __KERNEL__
848 + # ifdef __i386__
849 +diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
850 +index e5cb67d67c03..c94fec268ef2 100644
851 +--- a/arch/x86/kernel/fpu/xstate.c
852 ++++ b/arch/x86/kernel/fpu/xstate.c
853 +@@ -952,18 +952,31 @@ static inline bool xfeatures_mxcsr_quirk(u64 xfeatures)
854 + return true;
855 + }
856 +
857 +-/*
858 +- * This is similar to user_regset_copyout(), but will not add offset to
859 +- * the source data pointer or increment pos, count, kbuf, and ubuf.
860 +- */
861 +-static inline void
862 +-__copy_xstate_to_kernel(void *kbuf, const void *data,
863 +- unsigned int offset, unsigned int size, unsigned int size_total)
864 ++static void fill_gap(unsigned to, void **kbuf, unsigned *pos, unsigned *count)
865 + {
866 +- if (offset < size_total) {
867 +- unsigned int copy = min(size, size_total - offset);
868 ++ if (*pos < to) {
869 ++ unsigned size = to - *pos;
870 ++
871 ++ if (size > *count)
872 ++ size = *count;
873 ++ memcpy(*kbuf, (void *)&init_fpstate.xsave + *pos, size);
874 ++ *kbuf += size;
875 ++ *pos += size;
876 ++ *count -= size;
877 ++ }
878 ++}
879 +
880 +- memcpy(kbuf + offset, data, copy);
881 ++static void copy_part(unsigned offset, unsigned size, void *from,
882 ++ void **kbuf, unsigned *pos, unsigned *count)
883 ++{
884 ++ fill_gap(offset, kbuf, pos, count);
885 ++ if (size > *count)
886 ++ size = *count;
887 ++ if (size) {
888 ++ memcpy(*kbuf, from, size);
889 ++ *kbuf += size;
890 ++ *pos += size;
891 ++ *count -= size;
892 + }
893 + }
894 +
895 +@@ -976,8 +989,9 @@ __copy_xstate_to_kernel(void *kbuf, const void *data,
896 + */
897 + int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int offset_start, unsigned int size_total)
898 + {
899 +- unsigned int offset, size;
900 + struct xstate_header header;
901 ++ const unsigned off_mxcsr = offsetof(struct fxregs_state, mxcsr);
902 ++ unsigned count = size_total;
903 + int i;
904 +
905 + /*
906 +@@ -993,46 +1007,42 @@ int copy_xstate_to_kernel(void *kbuf, struct xregs_state *xsave, unsigned int of
907 + header.xfeatures = xsave->header.xfeatures;
908 + header.xfeatures &= ~XFEATURE_MASK_SUPERVISOR;
909 +
910 ++ if (header.xfeatures & XFEATURE_MASK_FP)
911 ++ copy_part(0, off_mxcsr,
912 ++ &xsave->i387, &kbuf, &offset_start, &count);
913 ++ if (header.xfeatures & (XFEATURE_MASK_SSE | XFEATURE_MASK_YMM))
914 ++ copy_part(off_mxcsr, MXCSR_AND_FLAGS_SIZE,
915 ++ &xsave->i387.mxcsr, &kbuf, &offset_start, &count);
916 ++ if (header.xfeatures & XFEATURE_MASK_FP)
917 ++ copy_part(offsetof(struct fxregs_state, st_space), 128,
918 ++ &xsave->i387.st_space, &kbuf, &offset_start, &count);
919 ++ if (header.xfeatures & XFEATURE_MASK_SSE)
920 ++ copy_part(xstate_offsets[XFEATURE_MASK_SSE], 256,
921 ++ &xsave->i387.xmm_space, &kbuf, &offset_start, &count);
922 ++ /*
923 ++ * Fill xsave->i387.sw_reserved value for ptrace frame:
924 ++ */
925 ++ copy_part(offsetof(struct fxregs_state, sw_reserved), 48,
926 ++ xstate_fx_sw_bytes, &kbuf, &offset_start, &count);
927 + /*
928 + * Copy xregs_state->header:
929 + */
930 +- offset = offsetof(struct xregs_state, header);
931 +- size = sizeof(header);
932 +-
933 +- __copy_xstate_to_kernel(kbuf, &header, offset, size, size_total);
934 ++ copy_part(offsetof(struct xregs_state, header), sizeof(header),
935 ++ &header, &kbuf, &offset_start, &count);
936 +
937 +- for (i = 0; i < XFEATURE_MAX; i++) {
938 ++ for (i = FIRST_EXTENDED_XFEATURE; i < XFEATURE_MAX; i++) {
939 + /*
940 + * Copy only in-use xstates:
941 + */
942 + if ((header.xfeatures >> i) & 1) {
943 + void *src = __raw_xsave_addr(xsave, i);
944 +
945 +- offset = xstate_offsets[i];
946 +- size = xstate_sizes[i];
947 +-
948 +- /* The next component has to fit fully into the output buffer: */
949 +- if (offset + size > size_total)
950 +- break;
951 +-
952 +- __copy_xstate_to_kernel(kbuf, src, offset, size, size_total);
953 ++ copy_part(xstate_offsets[i], xstate_sizes[i],
954 ++ src, &kbuf, &offset_start, &count);
955 + }
956 +
957 + }
958 +-
959 +- if (xfeatures_mxcsr_quirk(header.xfeatures)) {
960 +- offset = offsetof(struct fxregs_state, mxcsr);
961 +- size = MXCSR_AND_FLAGS_SIZE;
962 +- __copy_xstate_to_kernel(kbuf, &xsave->i387.mxcsr, offset, size, size_total);
963 +- }
964 +-
965 +- /*
966 +- * Fill xsave->i387.sw_reserved value for ptrace frame:
967 +- */
968 +- offset = offsetof(struct fxregs_state, sw_reserved);
969 +- size = sizeof(xstate_fx_sw_bytes);
970 +-
971 +- __copy_xstate_to_kernel(kbuf, xstate_fx_sw_bytes, offset, size, size_total);
972 ++ fill_gap(size_total, &kbuf, &offset_start, &count);
973 +
974 + return 0;
975 + }
976 +diff --git a/block/blk-core.c b/block/blk-core.c
977 +index 1075aaff606d..d5e668ec751b 100644
978 +--- a/block/blk-core.c
979 ++++ b/block/blk-core.c
980 +@@ -886,14 +886,11 @@ generic_make_request_checks(struct bio *bio)
981 + }
982 +
983 + /*
984 +- * Non-mq queues do not honor REQ_NOWAIT, so complete a bio
985 +- * with BLK_STS_AGAIN status in order to catch -EAGAIN and
986 +- * to give a chance to the caller to repeat request gracefully.
987 ++ * For a REQ_NOWAIT based request, return -EOPNOTSUPP
988 ++ * if queue is not a request based queue.
989 + */
990 +- if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q)) {
991 +- status = BLK_STS_AGAIN;
992 +- goto end_io;
993 +- }
994 ++ if ((bio->bi_opf & REQ_NOWAIT) && !queue_is_mq(q))
995 ++ goto not_supported;
996 +
997 + if (should_fail_bio(bio))
998 + goto end_io;
999 +diff --git a/drivers/clk/qcom/gcc-sm8150.c b/drivers/clk/qcom/gcc-sm8150.c
1000 +index 20877214acff..e3959ff5cb55 100644
1001 +--- a/drivers/clk/qcom/gcc-sm8150.c
1002 ++++ b/drivers/clk/qcom/gcc-sm8150.c
1003 +@@ -75,8 +75,7 @@ static struct clk_alpha_pll_postdiv gpll0_out_even = {
1004 + .clkr.hw.init = &(struct clk_init_data){
1005 + .name = "gpll0_out_even",
1006 + .parent_data = &(const struct clk_parent_data){
1007 +- .fw_name = "bi_tcxo",
1008 +- .name = "bi_tcxo",
1009 ++ .hw = &gpll0.clkr.hw,
1010 + },
1011 + .num_parents = 1,
1012 + .ops = &clk_trion_pll_postdiv_ops,
1013 +diff --git a/drivers/clk/ti/clk-33xx.c b/drivers/clk/ti/clk-33xx.c
1014 +index a360d3109555..73f567d8022f 100644
1015 +--- a/drivers/clk/ti/clk-33xx.c
1016 ++++ b/drivers/clk/ti/clk-33xx.c
1017 +@@ -212,7 +212,7 @@ static const struct omap_clkctrl_reg_data am3_mpu_clkctrl_regs[] __initconst = {
1018 + };
1019 +
1020 + static const struct omap_clkctrl_reg_data am3_l4_rtc_clkctrl_regs[] __initconst = {
1021 +- { AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk_32768_ck" },
1022 ++ { AM3_L4_RTC_RTC_CLKCTRL, NULL, CLKF_SW_SUP, "clk-24mhz-clkctrl:0000:0" },
1023 + { 0 },
1024 + };
1025 +
1026 +diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c
1027 +index 98bc5a4cd5e7..ce1f1d5d7cd5 100644
1028 +--- a/drivers/crypto/chelsio/chtls/chtls_io.c
1029 ++++ b/drivers/crypto/chelsio/chtls/chtls_io.c
1030 +@@ -682,7 +682,7 @@ int chtls_push_frames(struct chtls_sock *csk, int comp)
1031 + make_tx_data_wr(sk, skb, immdlen, len,
1032 + credits_needed, completion);
1033 + tp->snd_nxt += len;
1034 +- tp->lsndtime = tcp_time_stamp(tp);
1035 ++ tp->lsndtime = tcp_jiffies32;
1036 + if (completion)
1037 + ULP_SKB_CB(skb)->flags &= ~ULPCB_FLAG_NEED_HDR;
1038 + } else {
1039 +diff --git a/drivers/gpio/gpio-bcm-kona.c b/drivers/gpio/gpio-bcm-kona.c
1040 +index 9fa6d3a967d2..100575973e1f 100644
1041 +--- a/drivers/gpio/gpio-bcm-kona.c
1042 ++++ b/drivers/gpio/gpio-bcm-kona.c
1043 +@@ -619,7 +619,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
1044 +
1045 + kona_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
1046 + if (IS_ERR(kona_gpio->reg_base)) {
1047 +- ret = -ENXIO;
1048 ++ ret = PTR_ERR(kona_gpio->reg_base);
1049 + goto err_irq_domain;
1050 + }
1051 +
1052 +diff --git a/drivers/gpio/gpio-exar.c b/drivers/gpio/gpio-exar.c
1053 +index fae327d5b06e..6890d32d9f25 100644
1054 +--- a/drivers/gpio/gpio-exar.c
1055 ++++ b/drivers/gpio/gpio-exar.c
1056 +@@ -145,8 +145,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
1057 + mutex_init(&exar_gpio->lock);
1058 +
1059 + index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
1060 +- if (index < 0)
1061 +- goto err_destroy;
1062 ++ if (index < 0) {
1063 ++ ret = index;
1064 ++ goto err_mutex_destroy;
1065 ++ }
1066 +
1067 + sprintf(exar_gpio->name, "exar_gpio%d", index);
1068 + exar_gpio->gpio_chip.label = exar_gpio->name;
1069 +@@ -173,6 +175,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
1070 +
1071 + err_destroy:
1072 + ida_simple_remove(&ida_index, index);
1073 ++err_mutex_destroy:
1074 + mutex_destroy(&exar_gpio->lock);
1075 + return ret;
1076 + }
1077 +diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c
1078 +index 9888b62f37af..432c487f77b4 100644
1079 +--- a/drivers/gpio/gpio-pxa.c
1080 ++++ b/drivers/gpio/gpio-pxa.c
1081 +@@ -663,8 +663,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
1082 + pchip->irq1 = irq1;
1083 +
1084 + gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
1085 +- if (!gpio_reg_base)
1086 +- return -EINVAL;
1087 ++ if (IS_ERR(gpio_reg_base))
1088 ++ return PTR_ERR(gpio_reg_base);
1089 +
1090 + clk = clk_get(&pdev->dev, NULL);
1091 + if (IS_ERR(clk)) {
1092 +diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
1093 +index 8a01d3694b28..cecde5440a39 100644
1094 +--- a/drivers/gpio/gpio-tegra.c
1095 ++++ b/drivers/gpio/gpio-tegra.c
1096 +@@ -365,6 +365,7 @@ static void tegra_gpio_irq_shutdown(struct irq_data *d)
1097 + struct tegra_gpio_info *tgi = bank->tgi;
1098 + unsigned int gpio = d->hwirq;
1099 +
1100 ++ tegra_gpio_irq_mask(d);
1101 + gpiochip_unlock_as_irq(&tgi->gc, gpio);
1102 + }
1103 +
1104 +diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
1105 +index a8cf55eb54d8..abdf448b11a3 100644
1106 +--- a/drivers/gpio/gpiolib.c
1107 ++++ b/drivers/gpio/gpiolib.c
1108 +@@ -3894,7 +3894,9 @@ int gpiochip_lock_as_irq(struct gpio_chip *chip, unsigned int offset)
1109 + }
1110 + }
1111 +
1112 +- if (test_bit(FLAG_IS_OUT, &desc->flags)) {
1113 ++ /* To be valid for IRQ the line needs to be input or open drain */
1114 ++ if (test_bit(FLAG_IS_OUT, &desc->flags) &&
1115 ++ !test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
1116 + chip_err(chip,
1117 + "%s: tried to flag a GPIO set as output for IRQ\n",
1118 + __func__);
1119 +@@ -3957,7 +3959,12 @@ void gpiochip_enable_irq(struct gpio_chip *chip, unsigned int offset)
1120 +
1121 + if (!IS_ERR(desc) &&
1122 + !WARN_ON(!test_bit(FLAG_USED_AS_IRQ, &desc->flags))) {
1123 +- WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags));
1124 ++ /*
1125 ++ * We must not be output when using IRQ UNLESS we are
1126 ++ * open drain.
1127 ++ */
1128 ++ WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags) &&
1129 ++ !test_bit(FLAG_OPEN_DRAIN, &desc->flags));
1130 + set_bit(FLAG_IRQ_IS_ENABLED, &desc->flags);
1131 + }
1132 + }
1133 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
1134 +index 6d021ecc8d59..edb561baf8b9 100644
1135 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
1136 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
1137 +@@ -1288,7 +1288,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
1138 + }
1139 +
1140 + /* Free the BO*/
1141 +- amdgpu_bo_unref(&mem->bo);
1142 ++ drm_gem_object_put_unlocked(&mem->bo->tbo.base);
1143 + mutex_destroy(&mem->lock);
1144 + kfree(mem);
1145 +
1146 +@@ -1630,7 +1630,8 @@ int amdgpu_amdkfd_gpuvm_import_dmabuf(struct kgd_dev *kgd,
1147 + AMDGPU_VM_PAGE_READABLE | AMDGPU_VM_PAGE_WRITEABLE |
1148 + AMDGPU_VM_PAGE_EXECUTABLE | AMDGPU_VM_MTYPE_NC;
1149 +
1150 +- (*mem)->bo = amdgpu_bo_ref(bo);
1151 ++ drm_gem_object_get(&bo->tbo.base);
1152 ++ (*mem)->bo = bo;
1153 + (*mem)->va = va;
1154 + (*mem)->domain = (bo->preferred_domains & AMDGPU_GEM_DOMAIN_VRAM) ?
1155 + AMDGPU_GEM_DOMAIN_VRAM : AMDGPU_GEM_DOMAIN_GTT;
1156 +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
1157 +index 14417cebe38b..6f118292e40f 100644
1158 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
1159 ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
1160 +@@ -4290,11 +4290,7 @@ static int gfx_v10_0_set_powergating_state(void *handle,
1161 + switch (adev->asic_type) {
1162 + case CHIP_NAVI10:
1163 + case CHIP_NAVI14:
1164 +- if (!enable) {
1165 +- amdgpu_gfx_off_ctrl(adev, false);
1166 +- cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
1167 +- } else
1168 +- amdgpu_gfx_off_ctrl(adev, true);
1169 ++ amdgpu_gfx_off_ctrl(adev, enable);
1170 + break;
1171 + default:
1172 + break;
1173 +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1174 +index c34ddaa65324..6004fdacc866 100644
1175 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1176 ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
1177 +@@ -4839,10 +4839,9 @@ static int gfx_v9_0_set_powergating_state(void *handle,
1178 + switch (adev->asic_type) {
1179 + case CHIP_RAVEN:
1180 + case CHIP_RENOIR:
1181 +- if (!enable) {
1182 ++ if (!enable)
1183 + amdgpu_gfx_off_ctrl(adev, false);
1184 +- cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
1185 +- }
1186 ++
1187 + if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
1188 + gfx_v9_0_enable_sck_slow_down_on_power_up(adev, true);
1189 + gfx_v9_0_enable_sck_slow_down_on_power_down(adev, true);
1190 +@@ -4868,12 +4867,7 @@ static int gfx_v9_0_set_powergating_state(void *handle,
1191 + amdgpu_gfx_off_ctrl(adev, true);
1192 + break;
1193 + case CHIP_VEGA12:
1194 +- if (!enable) {
1195 +- amdgpu_gfx_off_ctrl(adev, false);
1196 +- cancel_delayed_work_sync(&adev->gfx.gfx_off_delay_work);
1197 +- } else {
1198 +- amdgpu_gfx_off_ctrl(adev, true);
1199 +- }
1200 ++ amdgpu_gfx_off_ctrl(adev, enable);
1201 + break;
1202 + default:
1203 + break;
1204 +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1205 +index 9f30343262f3..9fd12e108a70 100644
1206 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1207 ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
1208 +@@ -6951,13 +6951,6 @@ static int dm_update_plane_state(struct dc *dc,
1209 + return -EINVAL;
1210 + }
1211 +
1212 +- if (new_plane_state->crtc_x <= -new_acrtc->max_cursor_width ||
1213 +- new_plane_state->crtc_y <= -new_acrtc->max_cursor_height) {
1214 +- DRM_DEBUG_ATOMIC("Bad cursor position %d, %d\n",
1215 +- new_plane_state->crtc_x, new_plane_state->crtc_y);
1216 +- return -EINVAL;
1217 +- }
1218 +-
1219 + return 0;
1220 + }
1221 +
1222 +diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
1223 +index 8bb5fbef7de0..9eb3a0dcd1f2 100644
1224 +--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
1225 ++++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
1226 +@@ -320,12 +320,12 @@ static void pp_dpm_en_umd_pstate(struct pp_hwmgr *hwmgr,
1227 + if (*level & profile_mode_mask) {
1228 + hwmgr->saved_dpm_level = hwmgr->dpm_level;
1229 + hwmgr->en_umd_pstate = true;
1230 +- amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
1231 +- AMD_IP_BLOCK_TYPE_GFX,
1232 +- AMD_CG_STATE_UNGATE);
1233 + amdgpu_device_ip_set_powergating_state(hwmgr->adev,
1234 + AMD_IP_BLOCK_TYPE_GFX,
1235 + AMD_PG_STATE_UNGATE);
1236 ++ amdgpu_device_ip_set_clockgating_state(hwmgr->adev,
1237 ++ AMD_IP_BLOCK_TYPE_GFX,
1238 ++ AMD_CG_STATE_UNGATE);
1239 + }
1240 + } else {
1241 + /* exit umd pstate, restore level, enable gfx cg*/
1242 +diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
1243 +index a066e9297777..b51a124e505a 100644
1244 +--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
1245 ++++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
1246 +@@ -1541,12 +1541,12 @@ static int smu_enable_umd_pstate(void *handle,
1247 + if (*level & profile_mode_mask) {
1248 + smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level;
1249 + smu_dpm_ctx->enable_umd_pstate = true;
1250 +- amdgpu_device_ip_set_clockgating_state(smu->adev,
1251 +- AMD_IP_BLOCK_TYPE_GFX,
1252 +- AMD_CG_STATE_UNGATE);
1253 + amdgpu_device_ip_set_powergating_state(smu->adev,
1254 + AMD_IP_BLOCK_TYPE_GFX,
1255 + AMD_PG_STATE_UNGATE);
1256 ++ amdgpu_device_ip_set_clockgating_state(smu->adev,
1257 ++ AMD_IP_BLOCK_TYPE_GFX,
1258 ++ AMD_CG_STATE_UNGATE);
1259 + }
1260 + } else {
1261 + /* exit umd pstate, restore level, enable gfx cg*/
1262 +diff --git a/drivers/gpu/drm/ingenic/ingenic-drm.c b/drivers/gpu/drm/ingenic/ingenic-drm.c
1263 +index 9e95f6fd5406..376fca6ca9f4 100644
1264 +--- a/drivers/gpu/drm/ingenic/ingenic-drm.c
1265 ++++ b/drivers/gpu/drm/ingenic/ingenic-drm.c
1266 +@@ -467,7 +467,7 @@ static int ingenic_drm_encoder_atomic_check(struct drm_encoder *encoder,
1267 +
1268 + static irqreturn_t ingenic_drm_irq_handler(int irq, void *arg)
1269 + {
1270 +- struct ingenic_drm *priv = arg;
1271 ++ struct ingenic_drm *priv = drm_device_get_priv(arg);
1272 + unsigned int state;
1273 +
1274 + regmap_read(priv->map, JZ_REG_LCD_STATE, &state);
1275 +diff --git a/drivers/hwmon/nct7904.c b/drivers/hwmon/nct7904.c
1276 +index 281c81edabc6..dfb122b5e1b7 100644
1277 +--- a/drivers/hwmon/nct7904.c
1278 ++++ b/drivers/hwmon/nct7904.c
1279 +@@ -356,6 +356,7 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
1280 + struct nct7904_data *data = dev_get_drvdata(dev);
1281 + int ret, temp;
1282 + unsigned int reg1, reg2, reg3;
1283 ++ s8 temps;
1284 +
1285 + switch (attr) {
1286 + case hwmon_temp_input:
1287 +@@ -461,7 +462,8 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
1288 +
1289 + if (ret < 0)
1290 + return ret;
1291 +- *val = ret * 1000;
1292 ++ temps = ret;
1293 ++ *val = temps * 1000;
1294 + return 0;
1295 + }
1296 +
1297 +diff --git a/drivers/infiniband/core/rdma_core.c b/drivers/infiniband/core/rdma_core.c
1298 +index 1c95fefa1f06..d0580eed3bcb 100644
1299 +--- a/drivers/infiniband/core/rdma_core.c
1300 ++++ b/drivers/infiniband/core/rdma_core.c
1301 +@@ -160,9 +160,9 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
1302 + uobj->context = NULL;
1303 +
1304 + /*
1305 +- * For DESTROY the usecnt is held write locked, the caller is expected
1306 +- * to put it unlock and put the object when done with it. Only DESTROY
1307 +- * can remove the IDR handle.
1308 ++ * For DESTROY the usecnt is not changed, the caller is expected to
1309 ++ * manage it via uobj_put_destroy(). Only DESTROY can remove the IDR
1310 ++ * handle.
1311 + */
1312 + if (reason != RDMA_REMOVE_DESTROY)
1313 + atomic_set(&uobj->usecnt, 0);
1314 +@@ -194,7 +194,7 @@ static int uverbs_destroy_uobject(struct ib_uobject *uobj,
1315 + /*
1316 + * This calls uverbs_destroy_uobject() using the RDMA_REMOVE_DESTROY
1317 + * sequence. It should only be used from command callbacks. On success the
1318 +- * caller must pair this with rdma_lookup_put_uobject(LOOKUP_WRITE). This
1319 ++ * caller must pair this with uobj_put_destroy(). This
1320 + * version requires the caller to have already obtained an
1321 + * LOOKUP_DESTROY uobject kref.
1322 + */
1323 +@@ -205,6 +205,13 @@ int uobj_destroy(struct ib_uobject *uobj, struct uverbs_attr_bundle *attrs)
1324 +
1325 + down_read(&ufile->hw_destroy_rwsem);
1326 +
1327 ++ /*
1328 ++ * Once the uobject is destroyed by RDMA_REMOVE_DESTROY then it is left
1329 ++ * write locked as the callers put it back with UVERBS_LOOKUP_DESTROY.
1330 ++ * This is because any other concurrent thread can still see the object
1331 ++ * in the xarray due to RCU. Leaving it locked ensures nothing else will
1332 ++ * touch it.
1333 ++ */
1334 + ret = uverbs_try_lock_object(uobj, UVERBS_LOOKUP_WRITE);
1335 + if (ret)
1336 + goto out_unlock;
1337 +@@ -223,7 +230,7 @@ out_unlock:
1338 + /*
1339 + * uobj_get_destroy destroys the HW object and returns a handle to the uobj
1340 + * with a NULL object pointer. The caller must pair this with
1341 +- * uverbs_put_destroy.
1342 ++ * uobj_put_destroy().
1343 + */
1344 + struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
1345 + u32 id, struct uverbs_attr_bundle *attrs)
1346 +@@ -257,8 +264,7 @@ int __uobj_perform_destroy(const struct uverbs_api_object *obj, u32 id,
1347 + uobj = __uobj_get_destroy(obj, id, attrs);
1348 + if (IS_ERR(uobj))
1349 + return PTR_ERR(uobj);
1350 +-
1351 +- rdma_lookup_put_uobject(uobj, UVERBS_LOOKUP_WRITE);
1352 ++ uobj_put_destroy(uobj);
1353 + return 0;
1354 + }
1355 +
1356 +diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c
1357 +index 2d6a378e8560..b1df93b69df4 100644
1358 +--- a/drivers/infiniband/hw/i40iw/i40iw_cm.c
1359 ++++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c
1360 +@@ -1987,7 +1987,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device *iwdev,
1361 + struct rtable *rt;
1362 + struct neighbour *neigh;
1363 + int rc = arpindex;
1364 +- struct net_device *netdev = iwdev->netdev;
1365 + __be32 dst_ipaddr = htonl(dst_ip);
1366 + __be32 src_ipaddr = htonl(src_ip);
1367 +
1368 +@@ -1997,9 +1996,6 @@ static int i40iw_addr_resolve_neigh(struct i40iw_device *iwdev,
1369 + return rc;
1370 + }
1371 +
1372 +- if (netif_is_bond_slave(netdev))
1373 +- netdev = netdev_master_upper_dev_get(netdev);
1374 +-
1375 + neigh = dst_neigh_lookup(&rt->dst, &dst_ipaddr);
1376 +
1377 + rcu_read_lock();
1378 +@@ -2065,7 +2061,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev,
1379 + {
1380 + struct neighbour *neigh;
1381 + int rc = arpindex;
1382 +- struct net_device *netdev = iwdev->netdev;
1383 + struct dst_entry *dst;
1384 + struct sockaddr_in6 dst_addr;
1385 + struct sockaddr_in6 src_addr;
1386 +@@ -2086,9 +2081,6 @@ static int i40iw_addr_resolve_neigh_ipv6(struct i40iw_device *iwdev,
1387 + return rc;
1388 + }
1389 +
1390 +- if (netif_is_bond_slave(netdev))
1391 +- netdev = netdev_master_upper_dev_get(netdev);
1392 +-
1393 + neigh = dst_neigh_lookup(dst, dst_addr.sin6_addr.in6_u.u6_addr32);
1394 +
1395 + rcu_read_lock();
1396 +diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c
1397 +index 568b21eb6ea1..021df0654ba7 100644
1398 +--- a/drivers/infiniband/hw/qib/qib_sysfs.c
1399 ++++ b/drivers/infiniband/hw/qib/qib_sysfs.c
1400 +@@ -760,7 +760,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
1401 + qib_dev_err(dd,
1402 + "Skipping linkcontrol sysfs info, (err %d) port %u\n",
1403 + ret, port_num);
1404 +- goto bail;
1405 ++ goto bail_link;
1406 + }
1407 + kobject_uevent(&ppd->pport_kobj, KOBJ_ADD);
1408 +
1409 +@@ -770,7 +770,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
1410 + qib_dev_err(dd,
1411 + "Skipping sl2vl sysfs info, (err %d) port %u\n",
1412 + ret, port_num);
1413 +- goto bail_link;
1414 ++ goto bail_sl;
1415 + }
1416 + kobject_uevent(&ppd->sl2vl_kobj, KOBJ_ADD);
1417 +
1418 +@@ -780,7 +780,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
1419 + qib_dev_err(dd,
1420 + "Skipping diag_counters sysfs info, (err %d) port %u\n",
1421 + ret, port_num);
1422 +- goto bail_sl;
1423 ++ goto bail_diagc;
1424 + }
1425 + kobject_uevent(&ppd->diagc_kobj, KOBJ_ADD);
1426 +
1427 +@@ -793,7 +793,7 @@ int qib_create_port_files(struct ib_device *ibdev, u8 port_num,
1428 + qib_dev_err(dd,
1429 + "Skipping Congestion Control sysfs info, (err %d) port %u\n",
1430 + ret, port_num);
1431 +- goto bail_diagc;
1432 ++ goto bail_cc;
1433 + }
1434 +
1435 + kobject_uevent(&ppd->pport_cc_kobj, KOBJ_ADD);
1436 +@@ -854,6 +854,7 @@ void qib_verbs_unregister_sysfs(struct qib_devdata *dd)
1437 + &cc_table_bin_attr);
1438 + kobject_put(&ppd->pport_cc_kobj);
1439 + }
1440 ++ kobject_put(&ppd->diagc_kobj);
1441 + kobject_put(&ppd->sl2vl_kobj);
1442 + kobject_put(&ppd->pport_kobj);
1443 + }
1444 +diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1445 +index e580ae9cc55a..780fd2dfc07e 100644
1446 +--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1447 ++++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
1448 +@@ -829,7 +829,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev,
1449 + !(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {
1450 + dev_err(&pdev->dev, "PCI BAR region not MMIO\n");
1451 + ret = -ENOMEM;
1452 +- goto err_free_device;
1453 ++ goto err_disable_pdev;
1454 + }
1455 +
1456 + ret = pci_request_regions(pdev, DRV_NAME);
1457 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
1458 +index 2aa3457a30ce..0e5f27caf2b2 100644
1459 +--- a/drivers/infiniband/ulp/ipoib/ipoib.h
1460 ++++ b/drivers/infiniband/ulp/ipoib/ipoib.h
1461 +@@ -377,8 +377,12 @@ struct ipoib_dev_priv {
1462 + struct ipoib_rx_buf *rx_ring;
1463 +
1464 + struct ipoib_tx_buf *tx_ring;
1465 ++ /* cyclic ring variables for managing tx_ring, for UD only */
1466 + unsigned int tx_head;
1467 + unsigned int tx_tail;
1468 ++ /* cyclic ring variables for counting overall outstanding send WRs */
1469 ++ unsigned int global_tx_head;
1470 ++ unsigned int global_tx_tail;
1471 + struct ib_sge tx_sge[MAX_SKB_FRAGS + 1];
1472 + struct ib_ud_wr tx_wr;
1473 + struct ib_wc send_wc[MAX_SEND_CQE];
1474 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1475 +index c59e00a0881f..9bf0fa30df28 100644
1476 +--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1477 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
1478 +@@ -756,7 +756,8 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
1479 + return;
1480 + }
1481 +
1482 +- if ((priv->tx_head - priv->tx_tail) == ipoib_sendq_size - 1) {
1483 ++ if ((priv->global_tx_head - priv->global_tx_tail) ==
1484 ++ ipoib_sendq_size - 1) {
1485 + ipoib_dbg(priv, "TX ring 0x%x full, stopping kernel net queue\n",
1486 + tx->qp->qp_num);
1487 + netif_stop_queue(dev);
1488 +@@ -786,7 +787,7 @@ void ipoib_cm_send(struct net_device *dev, struct sk_buff *skb, struct ipoib_cm_
1489 + } else {
1490 + netif_trans_update(dev);
1491 + ++tx->tx_head;
1492 +- ++priv->tx_head;
1493 ++ ++priv->global_tx_head;
1494 + }
1495 + }
1496 +
1497 +@@ -820,10 +821,11 @@ void ipoib_cm_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
1498 + netif_tx_lock(dev);
1499 +
1500 + ++tx->tx_tail;
1501 +- ++priv->tx_tail;
1502 ++ ++priv->global_tx_tail;
1503 +
1504 + if (unlikely(netif_queue_stopped(dev) &&
1505 +- (priv->tx_head - priv->tx_tail) <= ipoib_sendq_size >> 1 &&
1506 ++ ((priv->global_tx_head - priv->global_tx_tail) <=
1507 ++ ipoib_sendq_size >> 1) &&
1508 + test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)))
1509 + netif_wake_queue(dev);
1510 +
1511 +@@ -1232,8 +1234,9 @@ timeout:
1512 + dev_kfree_skb_any(tx_req->skb);
1513 + netif_tx_lock_bh(p->dev);
1514 + ++p->tx_tail;
1515 +- ++priv->tx_tail;
1516 +- if (unlikely(priv->tx_head - priv->tx_tail == ipoib_sendq_size >> 1) &&
1517 ++ ++priv->global_tx_tail;
1518 ++ if (unlikely((priv->global_tx_head - priv->global_tx_tail) <=
1519 ++ ipoib_sendq_size >> 1) &&
1520 + netif_queue_stopped(p->dev) &&
1521 + test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
1522 + netif_wake_queue(p->dev);
1523 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1524 +index c332b4761816..da3c5315bbb5 100644
1525 +--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1526 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
1527 +@@ -407,9 +407,11 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)
1528 + dev_kfree_skb_any(tx_req->skb);
1529 +
1530 + ++priv->tx_tail;
1531 ++ ++priv->global_tx_tail;
1532 +
1533 + if (unlikely(netif_queue_stopped(dev) &&
1534 +- ((priv->tx_head - priv->tx_tail) <= ipoib_sendq_size >> 1) &&
1535 ++ ((priv->global_tx_head - priv->global_tx_tail) <=
1536 ++ ipoib_sendq_size >> 1) &&
1537 + test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags)))
1538 + netif_wake_queue(dev);
1539 +
1540 +@@ -634,7 +636,8 @@ int ipoib_send(struct net_device *dev, struct sk_buff *skb,
1541 + else
1542 + priv->tx_wr.wr.send_flags &= ~IB_SEND_IP_CSUM;
1543 + /* increase the tx_head after send success, but use it for queue state */
1544 +- if (priv->tx_head - priv->tx_tail == ipoib_sendq_size - 1) {
1545 ++ if ((priv->global_tx_head - priv->global_tx_tail) ==
1546 ++ ipoib_sendq_size - 1) {
1547 + ipoib_dbg(priv, "TX ring full, stopping kernel net queue\n");
1548 + netif_stop_queue(dev);
1549 + }
1550 +@@ -662,6 +665,7 @@ int ipoib_send(struct net_device *dev, struct sk_buff *skb,
1551 +
1552 + rc = priv->tx_head;
1553 + ++priv->tx_head;
1554 ++ ++priv->global_tx_head;
1555 + }
1556 + return rc;
1557 + }
1558 +@@ -807,6 +811,7 @@ int ipoib_ib_dev_stop_default(struct net_device *dev)
1559 + ipoib_dma_unmap_tx(priv, tx_req);
1560 + dev_kfree_skb_any(tx_req->skb);
1561 + ++priv->tx_tail;
1562 ++ ++priv->global_tx_tail;
1563 + }
1564 +
1565 + for (i = 0; i < ipoib_recvq_size; ++i) {
1566 +diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1567 +index ac0583ff280d..4fd095fd63b6 100644
1568 +--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
1569 ++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
1570 +@@ -1188,9 +1188,11 @@ static void ipoib_timeout(struct net_device *dev)
1571 +
1572 + ipoib_warn(priv, "transmit timeout: latency %d msecs\n",
1573 + jiffies_to_msecs(jiffies - dev_trans_start(dev)));
1574 +- ipoib_warn(priv, "queue stopped %d, tx_head %u, tx_tail %u\n",
1575 +- netif_queue_stopped(dev),
1576 +- priv->tx_head, priv->tx_tail);
1577 ++ ipoib_warn(priv,
1578 ++ "queue stopped %d, tx_head %u, tx_tail %u, global_tx_head %u, global_tx_tail %u\n",
1579 ++ netif_queue_stopped(dev), priv->tx_head, priv->tx_tail,
1580 ++ priv->global_tx_head, priv->global_tx_tail);
1581 ++
1582 + /* XXX reset QP, etc. */
1583 + }
1584 +
1585 +@@ -1705,7 +1707,7 @@ static int ipoib_dev_init_default(struct net_device *dev)
1586 + goto out_rx_ring_cleanup;
1587 + }
1588 +
1589 +- /* priv->tx_head, tx_tail & tx_outstanding are already 0 */
1590 ++ /* priv->tx_head, tx_tail and global_tx_tail/head are already 0 */
1591 +
1592 + if (ipoib_transport_dev_init(dev, priv->ca)) {
1593 + pr_warn("%s: ipoib_transport_dev_init failed\n",
1594 +diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
1595 +index cb6e3a5f509c..0d57e51b8ba1 100644
1596 +--- a/drivers/input/evdev.c
1597 ++++ b/drivers/input/evdev.c
1598 +@@ -326,20 +326,6 @@ static int evdev_fasync(int fd, struct file *file, int on)
1599 + return fasync_helper(fd, file, on, &client->fasync);
1600 + }
1601 +
1602 +-static int evdev_flush(struct file *file, fl_owner_t id)
1603 +-{
1604 +- struct evdev_client *client = file->private_data;
1605 +- struct evdev *evdev = client->evdev;
1606 +-
1607 +- mutex_lock(&evdev->mutex);
1608 +-
1609 +- if (evdev->exist && !client->revoked)
1610 +- input_flush_device(&evdev->handle, file);
1611 +-
1612 +- mutex_unlock(&evdev->mutex);
1613 +- return 0;
1614 +-}
1615 +-
1616 + static void evdev_free(struct device *dev)
1617 + {
1618 + struct evdev *evdev = container_of(dev, struct evdev, dev);
1619 +@@ -453,6 +439,10 @@ static int evdev_release(struct inode *inode, struct file *file)
1620 + unsigned int i;
1621 +
1622 + mutex_lock(&evdev->mutex);
1623 ++
1624 ++ if (evdev->exist && !client->revoked)
1625 ++ input_flush_device(&evdev->handle, file);
1626 ++
1627 + evdev_ungrab(evdev, client);
1628 + mutex_unlock(&evdev->mutex);
1629 +
1630 +@@ -1310,7 +1300,6 @@ static const struct file_operations evdev_fops = {
1631 + .compat_ioctl = evdev_ioctl_compat,
1632 + #endif
1633 + .fasync = evdev_fasync,
1634 +- .flush = evdev_flush,
1635 + .llseek = no_llseek,
1636 + };
1637 +
1638 +diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
1639 +index 6b40a1c68f9f..c77cdb3b62b5 100644
1640 +--- a/drivers/input/joystick/xpad.c
1641 ++++ b/drivers/input/joystick/xpad.c
1642 +@@ -458,6 +458,16 @@ static const u8 xboxone_fw2015_init[] = {
1643 + 0x05, 0x20, 0x00, 0x01, 0x00
1644 + };
1645 +
1646 ++/*
1647 ++ * This packet is required for Xbox One S (0x045e:0x02ea)
1648 ++ * and Xbox One Elite Series 2 (0x045e:0x0b00) pads to
1649 ++ * initialize the controller that was previously used in
1650 ++ * Bluetooth mode.
1651 ++ */
1652 ++static const u8 xboxone_s_init[] = {
1653 ++ 0x05, 0x20, 0x00, 0x0f, 0x06
1654 ++};
1655 ++
1656 + /*
1657 + * This packet is required for the Titanfall 2 Xbox One pads
1658 + * (0x0e6f:0x0165) to finish initialization and for Hori pads
1659 +@@ -516,6 +526,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
1660 + XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
1661 + XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
1662 + XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
1663 ++ XBOXONE_INIT_PKT(0x045e, 0x02ea, xboxone_s_init),
1664 ++ XBOXONE_INIT_PKT(0x045e, 0x0b00, xboxone_s_init),
1665 + XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init1),
1666 + XBOXONE_INIT_PKT(0x0e6f, 0x0000, xboxone_pdp_init2),
1667 + XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
1668 +diff --git a/drivers/input/keyboard/dlink-dir685-touchkeys.c b/drivers/input/keyboard/dlink-dir685-touchkeys.c
1669 +index b0ead7199c40..a69dcc3bd30c 100644
1670 +--- a/drivers/input/keyboard/dlink-dir685-touchkeys.c
1671 ++++ b/drivers/input/keyboard/dlink-dir685-touchkeys.c
1672 +@@ -143,7 +143,7 @@ MODULE_DEVICE_TABLE(of, dir685_tk_of_match);
1673 +
1674 + static struct i2c_driver dir685_tk_i2c_driver = {
1675 + .driver = {
1676 +- .name = "dlin-dir685-touchkeys",
1677 ++ .name = "dlink-dir685-touchkeys",
1678 + .of_match_table = of_match_ptr(dir685_tk_of_match),
1679 + },
1680 + .probe = dir685_tk_probe,
1681 +diff --git a/drivers/input/rmi4/rmi_driver.c b/drivers/input/rmi4/rmi_driver.c
1682 +index 190b9974526b..258d5fe3d395 100644
1683 +--- a/drivers/input/rmi4/rmi_driver.c
1684 ++++ b/drivers/input/rmi4/rmi_driver.c
1685 +@@ -205,7 +205,7 @@ static irqreturn_t rmi_irq_fn(int irq, void *dev_id)
1686 +
1687 + if (count) {
1688 + kfree(attn_data.data);
1689 +- attn_data.data = NULL;
1690 ++ drvdata->attn_data.data = NULL;
1691 + }
1692 +
1693 + if (!kfifo_is_empty(&drvdata->attn_fifo))
1694 +@@ -1210,7 +1210,8 @@ static int rmi_driver_probe(struct device *dev)
1695 + if (data->input) {
1696 + rmi_driver_set_input_name(rmi_dev, data->input);
1697 + if (!rmi_dev->xport->input) {
1698 +- if (input_register_device(data->input)) {
1699 ++ retval = input_register_device(data->input);
1700 ++ if (retval) {
1701 + dev_err(dev, "%s: Failed to register input device.\n",
1702 + __func__);
1703 + goto err_destroy_functions;
1704 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
1705 +index 08e919dbeb5d..7e048b557462 100644
1706 +--- a/drivers/input/serio/i8042-x86ia64io.h
1707 ++++ b/drivers/input/serio/i8042-x86ia64io.h
1708 +@@ -662,6 +662,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
1709 + DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
1710 + },
1711 + },
1712 ++ {
1713 ++ /* Lenovo ThinkPad Twist S230u */
1714 ++ .matches = {
1715 ++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1716 ++ DMI_MATCH(DMI_PRODUCT_NAME, "33474HU"),
1717 ++ },
1718 ++ },
1719 + { }
1720 + };
1721 +
1722 +diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
1723 +index 16d70201de4a..397cb1d3f481 100644
1724 +--- a/drivers/input/touchscreen/usbtouchscreen.c
1725 ++++ b/drivers/input/touchscreen/usbtouchscreen.c
1726 +@@ -182,6 +182,7 @@ static const struct usb_device_id usbtouch_devices[] = {
1727 + #endif
1728 +
1729 + #ifdef CONFIG_TOUCHSCREEN_USB_IRTOUCH
1730 ++ {USB_DEVICE(0x255e, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
1731 + {USB_DEVICE(0x595a, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
1732 + {USB_DEVICE(0x6615, 0x0001), .driver_info = DEVTYPE_IRTOUCH},
1733 + {USB_DEVICE(0x6615, 0x0012), .driver_info = DEVTYPE_IRTOUCH_HIRES},
1734 +diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
1735 +index cd3c0ea56657..9d7232e26ecf 100644
1736 +--- a/drivers/iommu/iommu.c
1737 ++++ b/drivers/iommu/iommu.c
1738 +@@ -492,7 +492,7 @@ struct iommu_group *iommu_group_alloc(void)
1739 + NULL, "%d", group->id);
1740 + if (ret) {
1741 + ida_simple_remove(&iommu_group_ida, group->id);
1742 +- kfree(group);
1743 ++ kobject_put(&group->kobj);
1744 + return ERR_PTR(ret);
1745 + }
1746 +
1747 +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
1748 +index 9d01b5dca519..7f480c6b1981 100644
1749 +--- a/drivers/mmc/core/block.c
1750 ++++ b/drivers/mmc/core/block.c
1751 +@@ -2475,8 +2475,8 @@ static int mmc_rpmb_chrdev_release(struct inode *inode, struct file *filp)
1752 + struct mmc_rpmb_data *rpmb = container_of(inode->i_cdev,
1753 + struct mmc_rpmb_data, chrdev);
1754 +
1755 +- put_device(&rpmb->dev);
1756 + mmc_blk_put(rpmb->md);
1757 ++ put_device(&rpmb->dev);
1758 +
1759 + return 0;
1760 + }
1761 +diff --git a/drivers/net/bonding/bond_sysfs_slave.c b/drivers/net/bonding/bond_sysfs_slave.c
1762 +index 007481557191..9b8346638f69 100644
1763 +--- a/drivers/net/bonding/bond_sysfs_slave.c
1764 ++++ b/drivers/net/bonding/bond_sysfs_slave.c
1765 +@@ -149,8 +149,10 @@ int bond_sysfs_slave_add(struct slave *slave)
1766 +
1767 + err = kobject_init_and_add(&slave->kobj, &slave_ktype,
1768 + &(slave->dev->dev.kobj), "bonding_slave");
1769 +- if (err)
1770 ++ if (err) {
1771 ++ kobject_put(&slave->kobj);
1772 + return err;
1773 ++ }
1774 +
1775 + for (a = slave_attrs; *a; ++a) {
1776 + err = sysfs_create_file(&slave->kobj, &((*a)->attr));
1777 +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
1778 +index cffaf4fdd772..6027bb65f7f6 100644
1779 +--- a/drivers/net/dsa/mt7530.c
1780 ++++ b/drivers/net/dsa/mt7530.c
1781 +@@ -639,11 +639,8 @@ mt7530_cpu_port_enable(struct mt7530_priv *priv,
1782 + mt7530_write(priv, MT7530_PVC_P(port),
1783 + PORT_SPEC_TAG);
1784 +
1785 +- /* Disable auto learning on the cpu port */
1786 +- mt7530_set(priv, MT7530_PSC_P(port), SA_DIS);
1787 +-
1788 +- /* Unknown unicast frame fordwarding to the cpu port */
1789 +- mt7530_set(priv, MT7530_MFC, UNU_FFP(BIT(port)));
1790 ++ /* Unknown multicast frame forwarding to the cpu port */
1791 ++ mt7530_rmw(priv, MT7530_MFC, UNM_FFP_MASK, UNM_FFP(BIT(port)));
1792 +
1793 + /* Set CPU port number */
1794 + if (priv->id == ID_MT7621)
1795 +@@ -1246,8 +1243,6 @@ mt7530_setup(struct dsa_switch *ds)
1796 + /* Enable and reset MIB counters */
1797 + mt7530_mib_reset(ds);
1798 +
1799 +- mt7530_clear(priv, MT7530_MFC, UNU_FFP_MASK);
1800 +-
1801 + for (i = 0; i < MT7530_NUM_PORTS; i++) {
1802 + /* Disable forwarding by default on all ports */
1803 + mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK,
1804 +diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
1805 +index 756140b7dfd5..0e7e36d8f994 100644
1806 +--- a/drivers/net/dsa/mt7530.h
1807 ++++ b/drivers/net/dsa/mt7530.h
1808 +@@ -31,6 +31,7 @@ enum {
1809 + #define MT7530_MFC 0x10
1810 + #define BC_FFP(x) (((x) & 0xff) << 24)
1811 + #define UNM_FFP(x) (((x) & 0xff) << 16)
1812 ++#define UNM_FFP_MASK UNM_FFP(~0)
1813 + #define UNU_FFP(x) (((x) & 0xff) << 8)
1814 + #define UNU_FFP_MASK UNU_FFP(~0)
1815 + #define CPU_EN BIT(7)
1816 +diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1817 +index edf8452a2574..63ee0c49be7c 100644
1818 +--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1819 ++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
1820 +@@ -9285,7 +9285,7 @@ static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init,
1821 + bnxt_free_skbs(bp);
1822 +
1823 + /* Save ring stats before shutdown */
1824 +- if (bp->bnapi)
1825 ++ if (bp->bnapi && irq_re_init)
1826 + bnxt_get_ring_stats(bp, &bp->net_stats_prev);
1827 + if (irq_re_init) {
1828 + bnxt_free_irq(bp);
1829 +diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig
1830 +index 6a7e8993119f..941c7e667afc 100644
1831 +--- a/drivers/net/ethernet/freescale/Kconfig
1832 ++++ b/drivers/net/ethernet/freescale/Kconfig
1833 +@@ -77,6 +77,7 @@ config UCC_GETH
1834 + depends on QUICC_ENGINE
1835 + select FSL_PQ_MDIO
1836 + select PHYLIB
1837 ++ select FIXED_PHY
1838 + ---help---
1839 + This driver supports the Gigabit Ethernet mode of the QUICC Engine,
1840 + which is available on some Freescale SOCs.
1841 +@@ -90,6 +91,7 @@ config GIANFAR
1842 + depends on HAS_DMA
1843 + select FSL_PQ_MDIO
1844 + select PHYLIB
1845 ++ select FIXED_PHY
1846 + select CRC32
1847 + ---help---
1848 + This driver supports the Gigabit TSEC on the MPC83xx, MPC85xx,
1849 +diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig
1850 +index 3b325733a4f8..0a54c7e0e4ae 100644
1851 +--- a/drivers/net/ethernet/freescale/dpaa/Kconfig
1852 ++++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
1853 +@@ -3,6 +3,7 @@ menuconfig FSL_DPAA_ETH
1854 + tristate "DPAA Ethernet"
1855 + depends on FSL_DPAA && FSL_FMAN
1856 + select PHYLIB
1857 ++ select FIXED_PHY
1858 + select FSL_FMAN_MAC
1859 + ---help---
1860 + Data Path Acceleration Architecture Ethernet driver,
1861 +diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
1862 +index 00c4beb760c3..cd9d08695cc1 100644
1863 +--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
1864 ++++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
1865 +@@ -2802,7 +2802,7 @@ static int dpaa_eth_probe(struct platform_device *pdev)
1866 + }
1867 +
1868 + /* Do this here, so we can be verbose early */
1869 +- SET_NETDEV_DEV(net_dev, dev);
1870 ++ SET_NETDEV_DEV(net_dev, dev->parent);
1871 + dev_set_drvdata(dev, net_dev);
1872 +
1873 + priv = netdev_priv(net_dev);
1874 +diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
1875 +index 4344a59c823f..6122057d60c0 100644
1876 +--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
1877 ++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
1878 +@@ -1070,7 +1070,7 @@ void mvpp2_cls_oversize_rxq_set(struct mvpp2_port *port)
1879 + (port->first_rxq >> MVPP2_CLS_OVERSIZE_RXQ_LOW_BITS));
1880 +
1881 + val = mvpp2_read(port->priv, MVPP2_CLS_SWFWD_PCTRL_REG);
1882 +- val |= MVPP2_CLS_SWFWD_PCTRL_MASK(port->id);
1883 ++ val &= ~MVPP2_CLS_SWFWD_PCTRL_MASK(port->id);
1884 + mvpp2_write(port->priv, MVPP2_CLS_SWFWD_PCTRL_REG, val);
1885 + }
1886 +
1887 +diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c
1888 +index 6e501af0e532..f6ff9620a137 100644
1889 +--- a/drivers/net/ethernet/mellanox/mlx4/fw.c
1890 ++++ b/drivers/net/ethernet/mellanox/mlx4/fw.c
1891 +@@ -2734,7 +2734,7 @@ void mlx4_opreq_action(struct work_struct *work)
1892 + if (err) {
1893 + mlx4_err(dev, "Failed to retrieve required operation: %d\n",
1894 + err);
1895 +- return;
1896 ++ goto out;
1897 + }
1898 + MLX4_GET(modifier, outbox, GET_OP_REQ_MODIFIER_OFFSET);
1899 + MLX4_GET(token, outbox, GET_OP_REQ_TOKEN_OFFSET);
1900 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1901 +index 08048a2d7259..b6a3370068f1 100644
1902 +--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1903 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1904 +@@ -861,6 +861,7 @@ static void cmd_work_handler(struct work_struct *work)
1905 + int alloc_ret;
1906 + int cmd_mode;
1907 +
1908 ++ complete(&ent->handling);
1909 + sem = ent->page_queue ? &cmd->pages_sem : &cmd->sem;
1910 + down(sem);
1911 + if (!ent->page_queue) {
1912 +@@ -978,6 +979,11 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent)
1913 + struct mlx5_cmd *cmd = &dev->cmd;
1914 + int err;
1915 +
1916 ++ if (!wait_for_completion_timeout(&ent->handling, timeout) &&
1917 ++ cancel_work_sync(&ent->work)) {
1918 ++ ent->ret = -ECANCELED;
1919 ++ goto out_err;
1920 ++ }
1921 + if (cmd->mode == CMD_MODE_POLLING || ent->polling) {
1922 + wait_for_completion(&ent->done);
1923 + } else if (!wait_for_completion_timeout(&ent->done, timeout)) {
1924 +@@ -985,12 +991,17 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent)
1925 + mlx5_cmd_comp_handler(dev, 1UL << ent->idx, true);
1926 + }
1927 +
1928 ++out_err:
1929 + err = ent->ret;
1930 +
1931 + if (err == -ETIMEDOUT) {
1932 + mlx5_core_warn(dev, "%s(0x%x) timeout. Will cause a leak of a command resource\n",
1933 + mlx5_command_str(msg_to_opcode(ent->in)),
1934 + msg_to_opcode(ent->in));
1935 ++ } else if (err == -ECANCELED) {
1936 ++ mlx5_core_warn(dev, "%s(0x%x) canceled on out of queue timeout.\n",
1937 ++ mlx5_command_str(msg_to_opcode(ent->in)),
1938 ++ msg_to_opcode(ent->in));
1939 + }
1940 + mlx5_core_dbg(dev, "err %d, delivery status %s(%d)\n",
1941 + err, deliv_status_to_str(ent->status), ent->status);
1942 +@@ -1026,6 +1037,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in,
1943 + ent->token = token;
1944 + ent->polling = force_polling;
1945 +
1946 ++ init_completion(&ent->handling);
1947 + if (!callback)
1948 + init_completion(&ent->done);
1949 +
1950 +@@ -1045,6 +1057,8 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in,
1951 + err = wait_func(dev, ent);
1952 + if (err == -ETIMEDOUT)
1953 + goto out;
1954 ++ if (err == -ECANCELED)
1955 ++ goto out_free;
1956 +
1957 + ds = ent->ts2 - ent->ts1;
1958 + op = MLX5_GET(mbox_in, in->first.data, opcode);
1959 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
1960 +index 38aa55638bbe..98304c42e495 100644
1961 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
1962 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
1963 +@@ -1103,7 +1103,7 @@ void mlx5e_close_drop_rq(struct mlx5e_rq *drop_rq);
1964 + int mlx5e_create_indirect_rqt(struct mlx5e_priv *priv);
1965 +
1966 + int mlx5e_create_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
1967 +-void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc);
1968 ++void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv);
1969 +
1970 + int mlx5e_create_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs);
1971 + void mlx5e_destroy_direct_rqts(struct mlx5e_priv *priv, struct mlx5e_tir *tirs);
1972 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
1973 +index 46725cd743a3..7d1985fa0d4f 100644
1974 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
1975 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c
1976 +@@ -69,8 +69,8 @@ static void mlx5e_ktls_del(struct net_device *netdev,
1977 + struct mlx5e_ktls_offload_context_tx *tx_priv =
1978 + mlx5e_get_ktls_tx_priv_ctx(tls_ctx);
1979 +
1980 +- mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id);
1981 + mlx5e_destroy_tis(priv->mdev, tx_priv->tisn);
1982 ++ mlx5_ktls_destroy_key(priv->mdev, tx_priv->key_id);
1983 + kvfree(tx_priv);
1984 + }
1985 +
1986 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
1987 +index 0e340893ca00..c133beb6a7a5 100644
1988 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
1989 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
1990 +@@ -2758,7 +2758,8 @@ void mlx5e_modify_tirs_hash(struct mlx5e_priv *priv, void *in, int inlen)
1991 + mlx5_core_modify_tir(mdev, priv->indir_tir[tt].tirn, in, inlen);
1992 + }
1993 +
1994 +- if (!mlx5e_tunnel_inner_ft_supported(priv->mdev))
1995 ++ /* Verify inner tirs resources allocated */
1996 ++ if (!priv->inner_indir_tir[0].tirn)
1997 + return;
1998 +
1999 + for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) {
2000 +@@ -3405,14 +3406,15 @@ out:
2001 + return err;
2002 + }
2003 +
2004 +-void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv, bool inner_ttc)
2005 ++void mlx5e_destroy_indirect_tirs(struct mlx5e_priv *priv)
2006 + {
2007 + int i;
2008 +
2009 + for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
2010 + mlx5e_destroy_tir(priv->mdev, &priv->indir_tir[i]);
2011 +
2012 +- if (!inner_ttc || !mlx5e_tunnel_inner_ft_supported(priv->mdev))
2013 ++ /* Verify inner tirs resources allocated */
2014 ++ if (!priv->inner_indir_tir[0].tirn)
2015 + return;
2016 +
2017 + for (i = 0; i < MLX5E_NUM_INDIR_TIRS; i++)
2018 +@@ -5119,7 +5121,7 @@ err_destroy_xsk_rqts:
2019 + err_destroy_direct_tirs:
2020 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2021 + err_destroy_indirect_tirs:
2022 +- mlx5e_destroy_indirect_tirs(priv, true);
2023 ++ mlx5e_destroy_indirect_tirs(priv);
2024 + err_destroy_direct_rqts:
2025 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2026 + err_destroy_indirect_rqts:
2027 +@@ -5138,7 +5140,7 @@ static void mlx5e_cleanup_nic_rx(struct mlx5e_priv *priv)
2028 + mlx5e_destroy_direct_tirs(priv, priv->xsk_tir);
2029 + mlx5e_destroy_direct_rqts(priv, priv->xsk_tir);
2030 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2031 +- mlx5e_destroy_indirect_tirs(priv, true);
2032 ++ mlx5e_destroy_indirect_tirs(priv);
2033 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2034 + mlx5e_destroy_rqt(priv, &priv->indir_rqt);
2035 + mlx5e_close_drop_rq(&priv->drop_rq);
2036 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2037 +index fddf644ba349..9b232ef36d53 100644
2038 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2039 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
2040 +@@ -1597,7 +1597,7 @@ err_destroy_ttc_table:
2041 + err_destroy_direct_tirs:
2042 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2043 + err_destroy_indirect_tirs:
2044 +- mlx5e_destroy_indirect_tirs(priv, false);
2045 ++ mlx5e_destroy_indirect_tirs(priv);
2046 + err_destroy_direct_rqts:
2047 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2048 + err_destroy_indirect_rqts:
2049 +@@ -1614,7 +1614,7 @@ static void mlx5e_cleanup_rep_rx(struct mlx5e_priv *priv)
2050 + mlx5_del_flow_rules(rpriv->vport_rx_rule);
2051 + mlx5e_destroy_ttc_table(priv, &priv->fs.ttc);
2052 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2053 +- mlx5e_destroy_indirect_tirs(priv, false);
2054 ++ mlx5e_destroy_indirect_tirs(priv);
2055 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2056 + mlx5e_destroy_rqt(priv, &priv->indir_rqt);
2057 + mlx5e_close_drop_rq(&priv->drop_rq);
2058 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
2059 +index dee12f17f9c2..d9e0fc146741 100644
2060 +--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
2061 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
2062 +@@ -537,10 +537,9 @@ bool mlx5e_poll_tx_cq(struct mlx5e_cq *cq, int napi_budget)
2063 + void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq)
2064 + {
2065 + struct mlx5e_tx_wqe_info *wi;
2066 ++ u32 dma_fifo_cc, nbytes = 0;
2067 ++ u16 ci, sqcc, npkts = 0;
2068 + struct sk_buff *skb;
2069 +- u32 dma_fifo_cc;
2070 +- u16 sqcc;
2071 +- u16 ci;
2072 + int i;
2073 +
2074 + sqcc = sq->cc;
2075 +@@ -565,11 +564,15 @@ void mlx5e_free_txqsq_descs(struct mlx5e_txqsq *sq)
2076 + }
2077 +
2078 + dev_kfree_skb_any(skb);
2079 ++ npkts++;
2080 ++ nbytes += wi->num_bytes;
2081 + sqcc += wi->num_wqebbs;
2082 + }
2083 +
2084 + sq->dma_fifo_cc = dma_fifo_cc;
2085 + sq->cc = sqcc;
2086 ++
2087 ++ netdev_tx_completed_queue(sq->txq, npkts, nbytes);
2088 + }
2089 +
2090 + #ifdef CONFIG_MLX5_CORE_IPOIB
2091 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/events.c b/drivers/net/ethernet/mellanox/mlx5/core/events.c
2092 +index 8bcf3426b9c6..3ce17c3d7a00 100644
2093 +--- a/drivers/net/ethernet/mellanox/mlx5/core/events.c
2094 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/events.c
2095 +@@ -346,8 +346,10 @@ int mlx5_events_init(struct mlx5_core_dev *dev)
2096 + events->dev = dev;
2097 + dev->priv.events = events;
2098 + events->wq = create_singlethread_workqueue("mlx5_events");
2099 +- if (!events->wq)
2100 ++ if (!events->wq) {
2101 ++ kfree(events);
2102 + return -ENOMEM;
2103 ++ }
2104 + INIT_WORK(&events->pcie_core_work, mlx5_pcie_event);
2105 +
2106 + return 0;
2107 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2108 +index 86e6bbb57482..8d9aab45fd8e 100644
2109 +--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2110 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
2111 +@@ -417,6 +417,12 @@ static void del_sw_ns(struct fs_node *node)
2112 +
2113 + static void del_sw_prio(struct fs_node *node)
2114 + {
2115 ++ struct mlx5_flow_root_namespace *root_ns;
2116 ++ struct mlx5_flow_namespace *ns;
2117 ++
2118 ++ fs_get_obj(ns, node);
2119 ++ root_ns = container_of(ns, struct mlx5_flow_root_namespace, ns);
2120 ++ mutex_destroy(&root_ns->chain_lock);
2121 + kfree(node);
2122 + }
2123 +
2124 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
2125 +index 3ed8ab2d703d..0fed2419623d 100644
2126 +--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
2127 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c
2128 +@@ -396,7 +396,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv)
2129 + err_destroy_direct_tirs:
2130 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2131 + err_destroy_indirect_tirs:
2132 +- mlx5e_destroy_indirect_tirs(priv, true);
2133 ++ mlx5e_destroy_indirect_tirs(priv);
2134 + err_destroy_direct_rqts:
2135 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2136 + err_destroy_indirect_rqts:
2137 +@@ -412,7 +412,7 @@ static void mlx5i_cleanup_rx(struct mlx5e_priv *priv)
2138 + {
2139 + mlx5i_destroy_flow_steering(priv);
2140 + mlx5e_destroy_direct_tirs(priv, priv->direct_tir);
2141 +- mlx5e_destroy_indirect_tirs(priv, true);
2142 ++ mlx5e_destroy_indirect_tirs(priv);
2143 + mlx5e_destroy_direct_rqts(priv, priv->direct_tir);
2144 + mlx5e_destroy_rqt(priv, &priv->indir_rqt);
2145 + mlx5e_close_drop_rq(&priv->drop_rq);
2146 +diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2147 +index c96a0e501007..7dcdda9ca351 100644
2148 +--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
2149 ++++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
2150 +@@ -1183,7 +1183,7 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, bool boot)
2151 +
2152 + err = mlx5_function_setup(dev, boot);
2153 + if (err)
2154 +- goto out;
2155 ++ goto err_function;
2156 +
2157 + if (boot) {
2158 + err = mlx5_init_once(dev);
2159 +@@ -1229,6 +1229,7 @@ err_load:
2160 + mlx5_cleanup_once(dev);
2161 + function_teardown:
2162 + mlx5_function_teardown(dev, boot);
2163 ++err_function:
2164 + dev->state = MLX5_DEVICE_STATE_INTERNAL_ERROR;
2165 + mutex_unlock(&dev->intf_state_mutex);
2166 +
2167 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
2168 +index a806c6190bb1..6a432bb93dbb 100644
2169 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
2170 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
2171 +@@ -3932,6 +3932,7 @@ static void mlxsw_sp_ports_remove(struct mlxsw_sp *mlxsw_sp)
2172 + mlxsw_sp_cpu_port_remove(mlxsw_sp);
2173 + kfree(mlxsw_sp->port_to_module);
2174 + kfree(mlxsw_sp->ports);
2175 ++ mlxsw_sp->ports = NULL;
2176 + }
2177 +
2178 + static int mlxsw_sp_ports_create(struct mlxsw_sp *mlxsw_sp)
2179 +@@ -3986,6 +3987,7 @@ err_cpu_port_create:
2180 + kfree(mlxsw_sp->port_to_module);
2181 + err_port_to_module_alloc:
2182 + kfree(mlxsw_sp->ports);
2183 ++ mlxsw_sp->ports = NULL;
2184 + return err;
2185 + }
2186 +
2187 +@@ -4040,6 +4042,14 @@ static void mlxsw_sp_port_unsplit_create(struct mlxsw_sp *mlxsw_sp,
2188 + }
2189 + }
2190 +
2191 ++static struct mlxsw_sp_port *
2192 ++mlxsw_sp_port_get_by_local_port(struct mlxsw_sp *mlxsw_sp, u8 local_port)
2193 ++{
2194 ++ if (mlxsw_sp->ports && mlxsw_sp->ports[local_port])
2195 ++ return mlxsw_sp->ports[local_port];
2196 ++ return NULL;
2197 ++}
2198 ++
2199 + static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
2200 + unsigned int count,
2201 + struct netlink_ext_ack *extack)
2202 +@@ -4058,7 +4068,7 @@ static int mlxsw_sp_port_split(struct mlxsw_core *mlxsw_core, u8 local_port,
2203 + local_ports_in_1x = MLXSW_CORE_RES_GET(mlxsw_core, LOCAL_PORTS_IN_1X);
2204 + local_ports_in_2x = MLXSW_CORE_RES_GET(mlxsw_core, LOCAL_PORTS_IN_2X);
2205 +
2206 +- mlxsw_sp_port = mlxsw_sp->ports[local_port];
2207 ++ mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
2208 + if (!mlxsw_sp_port) {
2209 + dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
2210 + local_port);
2211 +@@ -4136,7 +4146,7 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port,
2212 + local_ports_in_1x = MLXSW_CORE_RES_GET(mlxsw_core, LOCAL_PORTS_IN_1X);
2213 + local_ports_in_2x = MLXSW_CORE_RES_GET(mlxsw_core, LOCAL_PORTS_IN_2X);
2214 +
2215 +- mlxsw_sp_port = mlxsw_sp->ports[local_port];
2216 ++ mlxsw_sp_port = mlxsw_sp_port_get_by_local_port(mlxsw_sp, local_port);
2217 + if (!mlxsw_sp_port) {
2218 + dev_err(mlxsw_sp->bus_info->dev, "Port number \"%d\" does not exist\n",
2219 + local_port);
2220 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
2221 +index 63e7a058b7c6..059cc1600890 100644
2222 +--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
2223 ++++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
2224 +@@ -1258,6 +1258,7 @@ static void mlxsw_sx_ports_remove(struct mlxsw_sx *mlxsw_sx)
2225 + if (mlxsw_sx_port_created(mlxsw_sx, i))
2226 + mlxsw_sx_port_remove(mlxsw_sx, i);
2227 + kfree(mlxsw_sx->ports);
2228 ++ mlxsw_sx->ports = NULL;
2229 + }
2230 +
2231 + static int mlxsw_sx_ports_create(struct mlxsw_sx *mlxsw_sx)
2232 +@@ -1292,6 +1293,7 @@ err_port_module_info_get:
2233 + if (mlxsw_sx_port_created(mlxsw_sx, i))
2234 + mlxsw_sx_port_remove(mlxsw_sx, i);
2235 + kfree(mlxsw_sx->ports);
2236 ++ mlxsw_sx->ports = NULL;
2237 + return err;
2238 + }
2239 +
2240 +@@ -1375,6 +1377,12 @@ static int mlxsw_sx_port_type_set(struct mlxsw_core *mlxsw_core, u8 local_port,
2241 + u8 module, width;
2242 + int err;
2243 +
2244 ++ if (!mlxsw_sx->ports || !mlxsw_sx->ports[local_port]) {
2245 ++ dev_err(mlxsw_sx->bus_info->dev, "Port number \"%d\" does not exist\n",
2246 ++ local_port);
2247 ++ return -EINVAL;
2248 ++ }
2249 ++
2250 + if (new_type == DEVLINK_PORT_TYPE_AUTO)
2251 + return -EOPNOTSUPP;
2252 +
2253 +diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c
2254 +index 52c41d11f565..c3a6edc0ddf6 100644
2255 +--- a/drivers/net/ethernet/microchip/encx24j600.c
2256 ++++ b/drivers/net/ethernet/microchip/encx24j600.c
2257 +@@ -1070,7 +1070,7 @@ static int encx24j600_spi_probe(struct spi_device *spi)
2258 + if (unlikely(ret)) {
2259 + netif_err(priv, probe, ndev, "Error %d initializing card encx24j600 card\n",
2260 + ret);
2261 +- goto out_free;
2262 ++ goto out_stop;
2263 + }
2264 +
2265 + eidled = encx24j600_read_reg(priv, EIDLED);
2266 +@@ -1088,6 +1088,8 @@ static int encx24j600_spi_probe(struct spi_device *spi)
2267 +
2268 + out_unregister:
2269 + unregister_netdev(priv->ndev);
2270 ++out_stop:
2271 ++ kthread_stop(priv->kworker_task);
2272 + out_free:
2273 + free_netdev(ndev);
2274 +
2275 +@@ -1100,6 +1102,7 @@ static int encx24j600_spi_remove(struct spi_device *spi)
2276 + struct encx24j600_priv *priv = dev_get_drvdata(&spi->dev);
2277 +
2278 + unregister_netdev(priv->ndev);
2279 ++ kthread_stop(priv->kworker_task);
2280 +
2281 + free_netdev(priv->ndev);
2282 +
2283 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
2284 +index 2a533280b124..29b9c728a65e 100644
2285 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
2286 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
2287 +@@ -3651,7 +3651,7 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev)
2288 + ahw->diag_cnt = 0;
2289 + ret = qlcnic_alloc_mbx_args(&cmd, adapter, QLCNIC_CMD_INTRPT_TEST);
2290 + if (ret)
2291 +- goto fail_diag_irq;
2292 ++ goto fail_mbx_args;
2293 +
2294 + if (adapter->flags & QLCNIC_MSIX_ENABLED)
2295 + intrpt_id = ahw->intr_tbl[0].id;
2296 +@@ -3681,6 +3681,8 @@ int qlcnic_83xx_interrupt_test(struct net_device *netdev)
2297 +
2298 + done:
2299 + qlcnic_free_mbx_args(&cmd);
2300 ++
2301 ++fail_mbx_args:
2302 + qlcnic_83xx_diag_free_res(netdev, drv_sds_rings);
2303 +
2304 + fail_diag_irq:
2305 +diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
2306 +index c91876f8c536..6e78a33aa5e4 100644
2307 +--- a/drivers/net/ethernet/sun/cassini.c
2308 ++++ b/drivers/net/ethernet/sun/cassini.c
2309 +@@ -4971,7 +4971,7 @@ static int cas_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
2310 + cas_cacheline_size)) {
2311 + dev_err(&pdev->dev, "Could not set PCI cache "
2312 + "line size\n");
2313 +- goto err_write_cacheline;
2314 ++ goto err_out_free_res;
2315 + }
2316 + }
2317 + #endif
2318 +@@ -5144,7 +5144,6 @@ err_out_iounmap:
2319 + err_out_free_res:
2320 + pci_release_regions(pdev);
2321 +
2322 +-err_write_cacheline:
2323 + /* Try to restore it in case the error occurred after we
2324 + * set it.
2325 + */
2326 +diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
2327 +index d7a953c647b4..39df8c8feb6c 100644
2328 +--- a/drivers/net/ethernet/ti/cpsw.c
2329 ++++ b/drivers/net/ethernet/ti/cpsw.c
2330 +@@ -2999,11 +2999,15 @@ static int cpsw_suspend(struct device *dev)
2331 + struct cpsw_common *cpsw = dev_get_drvdata(dev);
2332 + int i;
2333 +
2334 ++ rtnl_lock();
2335 ++
2336 + for (i = 0; i < cpsw->data.slaves; i++)
2337 + if (cpsw->slaves[i].ndev)
2338 + if (netif_running(cpsw->slaves[i].ndev))
2339 + cpsw_ndo_stop(cpsw->slaves[i].ndev);
2340 +
2341 ++ rtnl_unlock();
2342 ++
2343 + /* Select sleep pin state */
2344 + pinctrl_pm_select_sleep_state(dev);
2345 +
2346 +diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
2347 +index fbea6f232819..e2ad3c2e8df5 100644
2348 +--- a/drivers/net/hamradio/bpqether.c
2349 ++++ b/drivers/net/hamradio/bpqether.c
2350 +@@ -127,7 +127,8 @@ static inline struct net_device *bpq_get_ax25_dev(struct net_device *dev)
2351 + {
2352 + struct bpqdev *bpq;
2353 +
2354 +- list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list) {
2355 ++ list_for_each_entry_rcu(bpq, &bpq_devices, bpq_list,
2356 ++ lockdep_rtnl_is_held()) {
2357 + if (bpq->ethdev == dev)
2358 + return bpq->axdev;
2359 + }
2360 +diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
2361 +index fe630438f67b..9bb37ac99a10 100644
2362 +--- a/drivers/net/usb/cdc_ether.c
2363 ++++ b/drivers/net/usb/cdc_ether.c
2364 +@@ -808,14 +808,21 @@ static const struct usb_device_id products[] = {
2365 + .driver_info = 0,
2366 + },
2367 +
2368 +-/* Microsoft Surface 3 dock (based on Realtek RTL8153) */
2369 ++/* Microsoft Surface Ethernet Adapter (based on Realtek RTL8153) */
2370 + {
2371 + USB_DEVICE_AND_INTERFACE_INFO(MICROSOFT_VENDOR_ID, 0x07c6, USB_CLASS_COMM,
2372 + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
2373 + .driver_info = 0,
2374 + },
2375 +
2376 +- /* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
2377 ++/* Microsoft Surface Ethernet Adapter (based on Realtek RTL8153B) */
2378 ++{
2379 ++ USB_DEVICE_AND_INTERFACE_INFO(MICROSOFT_VENDOR_ID, 0x0927, USB_CLASS_COMM,
2380 ++ USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
2381 ++ .driver_info = 0,
2382 ++},
2383 ++
2384 ++/* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
2385 + {
2386 + USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM,
2387 + USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
2388 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
2389 +index 44ea5dcc43fd..cd1a07175e11 100644
2390 +--- a/drivers/net/usb/r8152.c
2391 ++++ b/drivers/net/usb/r8152.c
2392 +@@ -5837,6 +5837,7 @@ static const struct usb_device_id rtl8152_table[] = {
2393 + {REALTEK_USB_DEVICE(VENDOR_ID_REALTEK, 0x8153)},
2394 + {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07ab)},
2395 + {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x07c6)},
2396 ++ {REALTEK_USB_DEVICE(VENDOR_ID_MICROSOFT, 0x0927)},
2397 + {REALTEK_USB_DEVICE(VENDOR_ID_SAMSUNG, 0xa101)},
2398 + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x304f)},
2399 + {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x3062)},
2400 +diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
2401 +index 73a852b2f417..34eec26b0c1f 100644
2402 +--- a/drivers/soc/mediatek/mtk-cmdq-helper.c
2403 ++++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
2404 +@@ -258,7 +258,9 @@ int cmdq_pkt_flush_async(struct cmdq_pkt *pkt, cmdq_async_flush_cb cb,
2405 + spin_unlock_irqrestore(&client->lock, flags);
2406 + }
2407 +
2408 +- mbox_send_message(client->chan, pkt);
2409 ++ err = mbox_send_message(client->chan, pkt);
2410 ++ if (err < 0)
2411 ++ return err;
2412 + /* We can send next packet immediately, so just call txdone. */
2413 + mbox_client_txdone(client->chan, 0);
2414 +
2415 +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
2416 +index 7051611229c9..b67372737dc9 100644
2417 +--- a/drivers/usb/dwc3/dwc3-pci.c
2418 ++++ b/drivers/usb/dwc3/dwc3-pci.c
2419 +@@ -114,6 +114,7 @@ static const struct property_entry dwc3_pci_intel_properties[] = {
2420 +
2421 + static const struct property_entry dwc3_pci_mrfld_properties[] = {
2422 + PROPERTY_ENTRY_STRING("dr_mode", "otg"),
2423 ++ PROPERTY_ENTRY_STRING("linux,extcon-name", "mrfld_bcove_pwrsrc"),
2424 + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"),
2425 + {}
2426 + };
2427 +diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c
2428 +index b47938dff1a2..238f555fe494 100644
2429 +--- a/drivers/usb/gadget/legacy/inode.c
2430 ++++ b/drivers/usb/gadget/legacy/inode.c
2431 +@@ -1361,7 +1361,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
2432 +
2433 + req->buf = dev->rbuf;
2434 + req->context = NULL;
2435 +- value = -EOPNOTSUPP;
2436 + switch (ctrl->bRequest) {
2437 +
2438 + case USB_REQ_GET_DESCRIPTOR:
2439 +@@ -1784,7 +1783,7 @@ static ssize_t
2440 + dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
2441 + {
2442 + struct dev_data *dev = fd->private_data;
2443 +- ssize_t value = len, length = len;
2444 ++ ssize_t value, length = len;
2445 + unsigned total;
2446 + u32 tag;
2447 + char *kbuf;
2448 +diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
2449 +index bfebf1f2e991..9a7e655d5280 100644
2450 +--- a/drivers/usb/phy/phy-twl6030-usb.c
2451 ++++ b/drivers/usb/phy/phy-twl6030-usb.c
2452 +@@ -377,7 +377,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
2453 + if (status < 0) {
2454 + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
2455 + twl->irq1, status);
2456 +- return status;
2457 ++ goto err_put_regulator;
2458 + }
2459 +
2460 + status = request_threaded_irq(twl->irq2, NULL, twl6030_usb_irq,
2461 +@@ -386,8 +386,7 @@ static int twl6030_usb_probe(struct platform_device *pdev)
2462 + if (status < 0) {
2463 + dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
2464 + twl->irq2, status);
2465 +- free_irq(twl->irq1, twl);
2466 +- return status;
2467 ++ goto err_free_irq1;
2468 + }
2469 +
2470 + twl->asleep = 0;
2471 +@@ -396,6 +395,13 @@ static int twl6030_usb_probe(struct platform_device *pdev)
2472 + dev_info(&pdev->dev, "Initialized TWL6030 USB module\n");
2473 +
2474 + return 0;
2475 ++
2476 ++err_free_irq1:
2477 ++ free_irq(twl->irq1, twl);
2478 ++err_put_regulator:
2479 ++ regulator_put(twl->usb3v3);
2480 ++
2481 ++ return status;
2482 + }
2483 +
2484 + static int twl6030_usb_remove(struct platform_device *pdev)
2485 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
2486 +index c5642bcb6b46..7ce3cfd965d2 100644
2487 +--- a/fs/binfmt_elf.c
2488 ++++ b/fs/binfmt_elf.c
2489 +@@ -1731,7 +1731,7 @@ static int fill_thread_core_info(struct elf_thread_core_info *t,
2490 + (!regset->active || regset->active(t->task, regset) > 0)) {
2491 + int ret;
2492 + size_t size = regset_size(t->task, regset);
2493 +- void *data = kmalloc(size, GFP_KERNEL);
2494 ++ void *data = kzalloc(size, GFP_KERNEL);
2495 + if (unlikely(!data))
2496 + return 0;
2497 + ret = regset->get(t->task, regset,
2498 +diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
2499 +index 44a3ce1e4ce4..ad057ed2b30b 100644
2500 +--- a/fs/cachefiles/rdwr.c
2501 ++++ b/fs/cachefiles/rdwr.c
2502 +@@ -60,9 +60,9 @@ static int cachefiles_read_waiter(wait_queue_entry_t *wait, unsigned mode,
2503 + object = container_of(op->op.object, struct cachefiles_object, fscache);
2504 + spin_lock(&object->work_lock);
2505 + list_add_tail(&monitor->op_link, &op->to_do);
2506 ++ fscache_enqueue_retrieval(op);
2507 + spin_unlock(&object->work_lock);
2508 +
2509 +- fscache_enqueue_retrieval(op);
2510 + fscache_put_retrieval(op);
2511 + return 0;
2512 + }
2513 +diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
2514 +index 2d602c2b0ff6..b2695919435e 100644
2515 +--- a/fs/ceph/caps.c
2516 ++++ b/fs/ceph/caps.c
2517 +@@ -3938,7 +3938,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2518 + __ceph_queue_cap_release(session, cap);
2519 + spin_unlock(&session->s_cap_lock);
2520 + }
2521 +- goto done;
2522 ++ goto flush_cap_releases;
2523 + }
2524 +
2525 + /* these will work even if we don't have a cap yet */
2526 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
2527 +index b095094c0842..4959dbe740f7 100644
2528 +--- a/fs/cifs/file.c
2529 ++++ b/fs/cifs/file.c
2530 +@@ -3997,7 +3997,7 @@ cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset)
2531 + * than it negotiated since it will refuse the read
2532 + * then.
2533 + */
2534 +- if ((tcon->ses) && !(tcon->ses->capabilities &
2535 ++ if (!(tcon->ses->capabilities &
2536 + tcon->ses->server->vals->cap_large_files)) {
2537 + current_read_size = min_t(uint,
2538 + current_read_size, CIFSMaxBufSize);
2539 +diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
2540 +index 47bc27d4169e..110e5c4db819 100644
2541 +--- a/fs/gfs2/log.c
2542 ++++ b/fs/gfs2/log.c
2543 +@@ -598,13 +598,13 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
2544 + struct buffer_head *bh = bd->bd_bh;
2545 + struct gfs2_glock *gl = bd->bd_gl;
2546 +
2547 ++ sdp->sd_log_num_revoke++;
2548 ++ if (atomic_inc_return(&gl->gl_revokes) == 1)
2549 ++ gfs2_glock_hold(gl);
2550 + bh->b_private = NULL;
2551 + bd->bd_blkno = bh->b_blocknr;
2552 + gfs2_remove_from_ail(bd); /* drops ref on bh */
2553 + bd->bd_bh = NULL;
2554 +- sdp->sd_log_num_revoke++;
2555 +- if (atomic_inc_return(&gl->gl_revokes) == 1)
2556 +- gfs2_glock_hold(gl);
2557 + set_bit(GLF_LFLUSH, &gl->gl_flags);
2558 + list_add(&bd->bd_list, &sdp->sd_log_revokes);
2559 + }
2560 +diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
2561 +index 7c016a082aa6..cbee745169b8 100644
2562 +--- a/fs/gfs2/quota.c
2563 ++++ b/fs/gfs2/quota.c
2564 +@@ -1040,8 +1040,7 @@ int gfs2_quota_lock(struct gfs2_inode *ip, kuid_t uid, kgid_t gid)
2565 + u32 x;
2566 + int error = 0;
2567 +
2568 +- if (capable(CAP_SYS_RESOURCE) ||
2569 +- sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
2570 ++ if (sdp->sd_args.ar_quota != GFS2_QUOTA_ON)
2571 + return 0;
2572 +
2573 + error = gfs2_quota_hold(ip, uid, gid);
2574 +diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
2575 +index 765627d9a91e..fe68a91dc16f 100644
2576 +--- a/fs/gfs2/quota.h
2577 ++++ b/fs/gfs2/quota.h
2578 +@@ -44,7 +44,8 @@ static inline int gfs2_quota_lock_check(struct gfs2_inode *ip,
2579 + int ret;
2580 +
2581 + ap->allowed = UINT_MAX; /* Assume we are permitted a whole lot */
2582 +- if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
2583 ++ if (capable(CAP_SYS_RESOURCE) ||
2584 ++ sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
2585 + return 0;
2586 + ret = gfs2_quota_lock(ip, NO_UID_QUOTA_CHANGE, NO_GID_QUOTA_CHANGE);
2587 + if (ret)
2588 +diff --git a/include/asm-generic/topology.h b/include/asm-generic/topology.h
2589 +index 238873739550..5aa8705df87e 100644
2590 +--- a/include/asm-generic/topology.h
2591 ++++ b/include/asm-generic/topology.h
2592 +@@ -48,7 +48,7 @@
2593 + #ifdef CONFIG_NEED_MULTIPLE_NODES
2594 + #define cpumask_of_node(node) ((node) == 0 ? cpu_online_mask : cpu_none_mask)
2595 + #else
2596 +- #define cpumask_of_node(node) ((void)node, cpu_online_mask)
2597 ++ #define cpumask_of_node(node) ((void)(node), cpu_online_mask)
2598 + #endif
2599 + #endif
2600 + #ifndef pcibus_to_node
2601 +diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
2602 +index 7f3486e32e5d..624d2643bfba 100644
2603 +--- a/include/linux/ieee80211.h
2604 ++++ b/include/linux/ieee80211.h
2605 +@@ -2047,7 +2047,7 @@ ieee80211_he_ppe_size(u8 ppe_thres_hdr, const u8 *phy_cap_info)
2606 + }
2607 +
2608 + /* HE Operation defines */
2609 +-#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000003
2610 ++#define IEEE80211_HE_OPERATION_DFLT_PE_DURATION_MASK 0x00000007
2611 + #define IEEE80211_HE_OPERATION_TWT_REQUIRED 0x00000008
2612 + #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_MASK 0x00003ff0
2613 + #define IEEE80211_HE_OPERATION_RTS_THRESHOLD_OFFSET 4
2614 +diff --git a/include/linux/mlx5/driver.h b/include/linux/mlx5/driver.h
2615 +index 3e80f03a387f..897829651204 100644
2616 +--- a/include/linux/mlx5/driver.h
2617 ++++ b/include/linux/mlx5/driver.h
2618 +@@ -756,6 +756,7 @@ struct mlx5_cmd_work_ent {
2619 + struct delayed_work cb_timeout_work;
2620 + void *context;
2621 + int idx;
2622 ++ struct completion handling;
2623 + struct completion done;
2624 + struct mlx5_cmd *cmd;
2625 + struct work_struct work;
2626 +diff --git a/include/linux/mm.h b/include/linux/mm.h
2627 +index afa77b683a04..53bad834adf5 100644
2628 +--- a/include/linux/mm.h
2629 ++++ b/include/linux/mm.h
2630 +@@ -695,6 +695,11 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags)
2631 +
2632 + extern void kvfree(const void *addr);
2633 +
2634 ++/*
2635 ++ * Mapcount of compound page as a whole, does not include mapped sub-pages.
2636 ++ *
2637 ++ * Must be called only for compound pages or any their tail sub-pages.
2638 ++ */
2639 + static inline int compound_mapcount(struct page *page)
2640 + {
2641 + VM_BUG_ON_PAGE(!PageCompound(page), page);
2642 +@@ -714,10 +719,16 @@ static inline void page_mapcount_reset(struct page *page)
2643 +
2644 + int __page_mapcount(struct page *page);
2645 +
2646 ++/*
2647 ++ * Mapcount of 0-order page; when compound sub-page, includes
2648 ++ * compound_mapcount().
2649 ++ *
2650 ++ * Result is undefined for pages which cannot be mapped into userspace.
2651 ++ * For example SLAB or special types of pages. See function page_has_type().
2652 ++ * They use this place in struct page differently.
2653 ++ */
2654 + static inline int page_mapcount(struct page *page)
2655 + {
2656 +- VM_BUG_ON_PAGE(PageSlab(page), page);
2657 +-
2658 + if (unlikely(PageCompound(page)))
2659 + return __page_mapcount(page);
2660 + return atomic_read(&page->_mapcount) + 1;
2661 +diff --git a/include/linux/netfilter/nf_conntrack_pptp.h b/include/linux/netfilter/nf_conntrack_pptp.h
2662 +index fcc409de31a4..a28aa289afdc 100644
2663 +--- a/include/linux/netfilter/nf_conntrack_pptp.h
2664 ++++ b/include/linux/netfilter/nf_conntrack_pptp.h
2665 +@@ -10,7 +10,7 @@
2666 + #include <net/netfilter/nf_conntrack_expect.h>
2667 + #include <uapi/linux/netfilter/nf_conntrack_tuple_common.h>
2668 +
2669 +-extern const char *const pptp_msg_name[];
2670 ++const char *pptp_msg_name(u_int16_t msg);
2671 +
2672 + /* state of the control session */
2673 + enum pptp_ctrlsess_state {
2674 +diff --git a/include/net/act_api.h b/include/net/act_api.h
2675 +index b18c699681ca..59d05feecfb8 100644
2676 +--- a/include/net/act_api.h
2677 ++++ b/include/net/act_api.h
2678 +@@ -69,7 +69,8 @@ static inline void tcf_tm_dump(struct tcf_t *dtm, const struct tcf_t *stm)
2679 + {
2680 + dtm->install = jiffies_to_clock_t(jiffies - stm->install);
2681 + dtm->lastuse = jiffies_to_clock_t(jiffies - stm->lastuse);
2682 +- dtm->firstuse = jiffies_to_clock_t(jiffies - stm->firstuse);
2683 ++ dtm->firstuse = stm->firstuse ?
2684 ++ jiffies_to_clock_t(jiffies - stm->firstuse) : 0;
2685 + dtm->expires = jiffies_to_clock_t(stm->expires);
2686 + }
2687 +
2688 +diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
2689 +index ab1ca9e238d2..ffbae7683450 100644
2690 +--- a/include/net/ip_fib.h
2691 ++++ b/include/net/ip_fib.h
2692 +@@ -244,7 +244,6 @@ struct fib_dump_filter {
2693 + u32 table_id;
2694 + /* filter_set is an optimization that an entry is set */
2695 + bool filter_set;
2696 +- bool dump_all_families;
2697 + bool dump_routes;
2698 + bool dump_exceptions;
2699 + unsigned char protocol;
2700 +@@ -423,6 +422,16 @@ static inline int fib_num_tclassid_users(struct net *net)
2701 + #endif
2702 + int fib_unmerge(struct net *net);
2703 +
2704 ++static inline bool nhc_l3mdev_matches_dev(const struct fib_nh_common *nhc,
2705 ++const struct net_device *dev)
2706 ++{
2707 ++ if (nhc->nhc_dev == dev ||
2708 ++ l3mdev_master_ifindex_rcu(nhc->nhc_dev) == dev->ifindex)
2709 ++ return true;
2710 ++
2711 ++ return false;
2712 ++}
2713 ++
2714 + /* Exported by fib_semantics.c */
2715 + int ip_fib_check_default(__be32 gw, struct net_device *dev);
2716 + int fib_sync_down_dev(struct net_device *dev, unsigned long event, bool force);
2717 +diff --git a/include/net/nexthop.h b/include/net/nexthop.h
2718 +index 331ebbc94fe7..3bb618e5ecf7 100644
2719 +--- a/include/net/nexthop.h
2720 ++++ b/include/net/nexthop.h
2721 +@@ -70,6 +70,7 @@ struct nh_grp_entry {
2722 + };
2723 +
2724 + struct nh_group {
2725 ++ struct nh_group *spare; /* spare group for removals */
2726 + u16 num_nh;
2727 + bool mpath;
2728 + bool has_v4;
2729 +@@ -136,21 +137,20 @@ static inline unsigned int nexthop_num_path(const struct nexthop *nh)
2730 + {
2731 + unsigned int rc = 1;
2732 +
2733 +- if (nexthop_is_multipath(nh)) {
2734 ++ if (nh->is_group) {
2735 + struct nh_group *nh_grp;
2736 +
2737 + nh_grp = rcu_dereference_rtnl(nh->nh_grp);
2738 +- rc = nh_grp->num_nh;
2739 ++ if (nh_grp->mpath)
2740 ++ rc = nh_grp->num_nh;
2741 + }
2742 +
2743 + return rc;
2744 + }
2745 +
2746 + static inline
2747 +-struct nexthop *nexthop_mpath_select(const struct nexthop *nh, int nhsel)
2748 ++struct nexthop *nexthop_mpath_select(const struct nh_group *nhg, int nhsel)
2749 + {
2750 +- const struct nh_group *nhg = rcu_dereference_rtnl(nh->nh_grp);
2751 +-
2752 + /* for_nexthops macros in fib_semantics.c grabs a pointer to
2753 + * the nexthop before checking nhsel
2754 + */
2755 +@@ -185,12 +185,14 @@ static inline bool nexthop_is_blackhole(const struct nexthop *nh)
2756 + {
2757 + const struct nh_info *nhi;
2758 +
2759 +- if (nexthop_is_multipath(nh)) {
2760 +- if (nexthop_num_path(nh) > 1)
2761 +- return false;
2762 +- nh = nexthop_mpath_select(nh, 0);
2763 +- if (!nh)
2764 ++ if (nh->is_group) {
2765 ++ struct nh_group *nh_grp;
2766 ++
2767 ++ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
2768 ++ if (nh_grp->num_nh > 1)
2769 + return false;
2770 ++
2771 ++ nh = nh_grp->nh_entries[0].nh;
2772 + }
2773 +
2774 + nhi = rcu_dereference_rtnl(nh->nh_info);
2775 +@@ -216,16 +218,46 @@ struct fib_nh_common *nexthop_fib_nhc(struct nexthop *nh, int nhsel)
2776 + BUILD_BUG_ON(offsetof(struct fib_nh, nh_common) != 0);
2777 + BUILD_BUG_ON(offsetof(struct fib6_nh, nh_common) != 0);
2778 +
2779 +- if (nexthop_is_multipath(nh)) {
2780 +- nh = nexthop_mpath_select(nh, nhsel);
2781 +- if (!nh)
2782 +- return NULL;
2783 ++ if (nh->is_group) {
2784 ++ struct nh_group *nh_grp;
2785 ++
2786 ++ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
2787 ++ if (nh_grp->mpath) {
2788 ++ nh = nexthop_mpath_select(nh_grp, nhsel);
2789 ++ if (!nh)
2790 ++ return NULL;
2791 ++ }
2792 + }
2793 +
2794 + nhi = rcu_dereference_rtnl(nh->nh_info);
2795 + return &nhi->fib_nhc;
2796 + }
2797 +
2798 ++static inline bool nexthop_uses_dev(const struct nexthop *nh,
2799 ++ const struct net_device *dev)
2800 ++{
2801 ++ struct nh_info *nhi;
2802 ++
2803 ++ if (nh->is_group) {
2804 ++ struct nh_group *nhg = rcu_dereference(nh->nh_grp);
2805 ++ int i;
2806 ++
2807 ++ for (i = 0; i < nhg->num_nh; i++) {
2808 ++ struct nexthop *nhe = nhg->nh_entries[i].nh;
2809 ++
2810 ++ nhi = rcu_dereference(nhe->nh_info);
2811 ++ if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
2812 ++ return true;
2813 ++ }
2814 ++ } else {
2815 ++ nhi = rcu_dereference(nh->nh_info);
2816 ++ if (nhc_l3mdev_matches_dev(&nhi->fib_nhc, dev))
2817 ++ return true;
2818 ++ }
2819 ++
2820 ++ return false;
2821 ++}
2822 ++
2823 + static inline unsigned int fib_info_num_path(const struct fib_info *fi)
2824 + {
2825 + if (unlikely(fi->nh))
2826 +@@ -263,8 +295,11 @@ static inline struct fib6_nh *nexthop_fib6_nh(struct nexthop *nh)
2827 + {
2828 + struct nh_info *nhi;
2829 +
2830 +- if (nexthop_is_multipath(nh)) {
2831 +- nh = nexthop_mpath_select(nh, 0);
2832 ++ if (nh->is_group) {
2833 ++ struct nh_group *nh_grp;
2834 ++
2835 ++ nh_grp = rcu_dereference_rtnl(nh->nh_grp);
2836 ++ nh = nexthop_mpath_select(nh_grp, 0);
2837 + if (!nh)
2838 + return NULL;
2839 + }
2840 +diff --git a/include/net/tls.h b/include/net/tls.h
2841 +index 093abb5a3dff..db26e3ec918f 100644
2842 +--- a/include/net/tls.h
2843 ++++ b/include/net/tls.h
2844 +@@ -157,6 +157,8 @@ struct tls_sw_context_tx {
2845 + struct tls_rec *open_rec;
2846 + struct list_head tx_list;
2847 + atomic_t encrypt_pending;
2848 ++ /* protect crypto_wait with encrypt_pending */
2849 ++ spinlock_t encrypt_compl_lock;
2850 + int async_notify;
2851 + int async_capable;
2852 +
2853 +@@ -177,6 +179,8 @@ struct tls_sw_context_rx {
2854 + int async_capable;
2855 + bool decrypted;
2856 + atomic_t decrypt_pending;
2857 ++ /* protect crypto_wait with decrypt_pending*/
2858 ++ spinlock_t decrypt_compl_lock;
2859 + bool async_notify;
2860 + };
2861 +
2862 +diff --git a/include/rdma/uverbs_std_types.h b/include/rdma/uverbs_std_types.h
2863 +index 05eabfd5d0d3..9f382e7d4579 100644
2864 +--- a/include/rdma/uverbs_std_types.h
2865 ++++ b/include/rdma/uverbs_std_types.h
2866 +@@ -88,7 +88,7 @@ struct ib_uobject *__uobj_get_destroy(const struct uverbs_api_object *obj,
2867 +
2868 + static inline void uobj_put_destroy(struct ib_uobject *uobj)
2869 + {
2870 +- rdma_lookup_put_uobject(uobj, UVERBS_LOOKUP_WRITE);
2871 ++ rdma_lookup_put_uobject(uobj, UVERBS_LOOKUP_DESTROY);
2872 + }
2873 +
2874 + static inline void uobj_put_read(struct ib_uobject *uobj)
2875 +diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
2876 +index 5f3b9fec7b5f..ff7cfdc6cb44 100644
2877 +--- a/include/uapi/linux/xfrm.h
2878 ++++ b/include/uapi/linux/xfrm.h
2879 +@@ -304,7 +304,7 @@ enum xfrm_attr_type_t {
2880 + XFRMA_PROTO, /* __u8 */
2881 + XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
2882 + XFRMA_PAD,
2883 +- XFRMA_OFFLOAD_DEV, /* struct xfrm_state_offload */
2884 ++ XFRMA_OFFLOAD_DEV, /* struct xfrm_user_offload */
2885 + XFRMA_SET_MARK, /* __u32 */
2886 + XFRMA_SET_MARK_MASK, /* __u32 */
2887 + XFRMA_IF_ID, /* __u32 */
2888 +diff --git a/mm/khugepaged.c b/mm/khugepaged.c
2889 +index a8a57bebb5fa..f765475be359 100644
2890 +--- a/mm/khugepaged.c
2891 ++++ b/mm/khugepaged.c
2892 +@@ -1655,6 +1655,7 @@ static void collapse_file(struct mm_struct *mm,
2893 + if (page_has_private(page) &&
2894 + !try_to_release_page(page, GFP_KERNEL)) {
2895 + result = SCAN_PAGE_HAS_PRIVATE;
2896 ++ putback_lru_page(page);
2897 + goto out_unlock;
2898 + }
2899 +
2900 +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
2901 +index bb222b882b67..e5a3dc28116d 100644
2902 +--- a/net/ax25/af_ax25.c
2903 ++++ b/net/ax25/af_ax25.c
2904 +@@ -635,8 +635,10 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,
2905 + break;
2906 +
2907 + case SO_BINDTODEVICE:
2908 +- if (optlen > IFNAMSIZ)
2909 +- optlen = IFNAMSIZ;
2910 ++ if (optlen > IFNAMSIZ - 1)
2911 ++ optlen = IFNAMSIZ - 1;
2912 ++
2913 ++ memset(devname, 0, sizeof(devname));
2914 +
2915 + if (copy_from_user(devname, optval, optlen)) {
2916 + res = -EFAULT;
2917 +diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c
2918 +index b325b569e761..f48cf4cfb80f 100644
2919 +--- a/net/bridge/netfilter/nft_reject_bridge.c
2920 ++++ b/net/bridge/netfilter/nft_reject_bridge.c
2921 +@@ -31,6 +31,12 @@ static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb,
2922 + ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source);
2923 + eth->h_proto = eth_hdr(oldskb)->h_proto;
2924 + skb_pull(nskb, ETH_HLEN);
2925 ++
2926 ++ if (skb_vlan_tag_present(oldskb)) {
2927 ++ u16 vid = skb_vlan_tag_get(oldskb);
2928 ++
2929 ++ __vlan_hwaccel_put_tag(nskb, oldskb->vlan_proto, vid);
2930 ++ }
2931 + }
2932 +
2933 + static int nft_bridge_iphdr_validate(struct sk_buff *skb)
2934 +diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
2935 +index 2352afa62d1f..e513b8876d13 100644
2936 +--- a/net/ceph/osd_client.c
2937 ++++ b/net/ceph/osd_client.c
2938 +@@ -3652,7 +3652,9 @@ static void handle_reply(struct ceph_osd *osd, struct ceph_msg *msg)
2939 + * supported.
2940 + */
2941 + req->r_t.target_oloc.pool = m.redirect.oloc.pool;
2942 +- req->r_flags |= CEPH_OSD_FLAG_REDIRECTED;
2943 ++ req->r_flags |= CEPH_OSD_FLAG_REDIRECTED |
2944 ++ CEPH_OSD_FLAG_IGNORE_OVERLAY |
2945 ++ CEPH_OSD_FLAG_IGNORE_CACHE;
2946 + req->r_tid = 0;
2947 + __submit_request(req, false);
2948 + goto out_unlock_osdc;
2949 +diff --git a/net/core/dev.c b/net/core/dev.c
2950 +index 120b994af31c..8552874e5aac 100644
2951 +--- a/net/core/dev.c
2952 ++++ b/net/core/dev.c
2953 +@@ -4713,11 +4713,12 @@ static inline int nf_ingress(struct sk_buff *skb, struct packet_type **pt_prev,
2954 + return 0;
2955 + }
2956 +
2957 +-static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,
2958 ++static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
2959 + struct packet_type **ppt_prev)
2960 + {
2961 + struct packet_type *ptype, *pt_prev;
2962 + rx_handler_func_t *rx_handler;
2963 ++ struct sk_buff *skb = *pskb;
2964 + struct net_device *orig_dev;
2965 + bool deliver_exact = false;
2966 + int ret = NET_RX_DROP;
2967 +@@ -4748,8 +4749,10 @@ another_round:
2968 + ret2 = do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);
2969 + preempt_enable();
2970 +
2971 +- if (ret2 != XDP_PASS)
2972 +- return NET_RX_DROP;
2973 ++ if (ret2 != XDP_PASS) {
2974 ++ ret = NET_RX_DROP;
2975 ++ goto out;
2976 ++ }
2977 + skb_reset_mac_len(skb);
2978 + }
2979 +
2980 +@@ -4899,6 +4902,13 @@ drop:
2981 + }
2982 +
2983 + out:
2984 ++ /* The invariant here is that if *ppt_prev is not NULL
2985 ++ * then skb should also be non-NULL.
2986 ++ *
2987 ++ * Apparently *ppt_prev assignment above holds this invariant due to
2988 ++ * skb dereferencing near it.
2989 ++ */
2990 ++ *pskb = skb;
2991 + return ret;
2992 + }
2993 +
2994 +@@ -4908,7 +4918,7 @@ static int __netif_receive_skb_one_core(struct sk_buff *skb, bool pfmemalloc)
2995 + struct packet_type *pt_prev = NULL;
2996 + int ret;
2997 +
2998 +- ret = __netif_receive_skb_core(skb, pfmemalloc, &pt_prev);
2999 ++ ret = __netif_receive_skb_core(&skb, pfmemalloc, &pt_prev);
3000 + if (pt_prev)
3001 + ret = INDIRECT_CALL_INET(pt_prev->func, ipv6_rcv, ip_rcv, skb,
3002 + skb->dev, pt_prev, orig_dev);
3003 +@@ -4986,7 +4996,7 @@ static void __netif_receive_skb_list_core(struct list_head *head, bool pfmemallo
3004 + struct packet_type *pt_prev = NULL;
3005 +
3006 + skb_list_del_init(skb);
3007 +- __netif_receive_skb_core(skb, pfmemalloc, &pt_prev);
3008 ++ __netif_receive_skb_core(&skb, pfmemalloc, &pt_prev);
3009 + if (!pt_prev)
3010 + continue;
3011 + if (pt_curr != pt_prev || od_curr != orig_dev) {
3012 +diff --git a/net/dsa/slave.c b/net/dsa/slave.c
3013 +index 23c2210fa7ec..f734ce0bcb56 100644
3014 +--- a/net/dsa/slave.c
3015 ++++ b/net/dsa/slave.c
3016 +@@ -1409,6 +1409,7 @@ int dsa_slave_create(struct dsa_port *port)
3017 + if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
3018 + slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
3019 + slave_dev->hw_features |= NETIF_F_HW_TC;
3020 ++ slave_dev->features |= NETIF_F_LLTX;
3021 + slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
3022 + if (!IS_ERR_OR_NULL(port->mac))
3023 + ether_addr_copy(slave_dev->dev_addr, port->mac);
3024 +diff --git a/net/dsa/tag_mtk.c b/net/dsa/tag_mtk.c
3025 +index b5705cba8318..d6619edd53e5 100644
3026 +--- a/net/dsa/tag_mtk.c
3027 ++++ b/net/dsa/tag_mtk.c
3028 +@@ -15,6 +15,7 @@
3029 + #define MTK_HDR_XMIT_TAGGED_TPID_8100 1
3030 + #define MTK_HDR_RECV_SOURCE_PORT_MASK GENMASK(2, 0)
3031 + #define MTK_HDR_XMIT_DP_BIT_MASK GENMASK(5, 0)
3032 ++#define MTK_HDR_XMIT_SA_DIS BIT(6)
3033 +
3034 + static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
3035 + struct net_device *dev)
3036 +@@ -22,6 +23,9 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
3037 + struct dsa_port *dp = dsa_slave_to_port(dev);
3038 + u8 *mtk_tag;
3039 + bool is_vlan_skb = true;
3040 ++ unsigned char *dest = eth_hdr(skb)->h_dest;
3041 ++ bool is_multicast_skb = is_multicast_ether_addr(dest) &&
3042 ++ !is_broadcast_ether_addr(dest);
3043 +
3044 + /* Build the special tag after the MAC Source Address. If VLAN header
3045 + * is present, it's required that VLAN header and special tag is
3046 +@@ -47,6 +51,10 @@ static struct sk_buff *mtk_tag_xmit(struct sk_buff *skb,
3047 + MTK_HDR_XMIT_UNTAGGED;
3048 + mtk_tag[1] = (1 << dp->index) & MTK_HDR_XMIT_DP_BIT_MASK;
3049 +
3050 ++ /* Disable SA learning for multicast frames */
3051 ++ if (unlikely(is_multicast_skb))
3052 ++ mtk_tag[1] |= MTK_HDR_XMIT_SA_DIS;
3053 ++
3054 + /* Tag control information is kept for 802.1Q */
3055 + if (!is_vlan_skb) {
3056 + mtk_tag[2] = 0;
3057 +@@ -61,6 +69,9 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
3058 + {
3059 + int port;
3060 + __be16 *phdr, hdr;
3061 ++ unsigned char *dest = eth_hdr(skb)->h_dest;
3062 ++ bool is_multicast_skb = is_multicast_ether_addr(dest) &&
3063 ++ !is_broadcast_ether_addr(dest);
3064 +
3065 + if (unlikely(!pskb_may_pull(skb, MTK_HDR_LEN)))
3066 + return NULL;
3067 +@@ -86,6 +97,10 @@ static struct sk_buff *mtk_tag_rcv(struct sk_buff *skb, struct net_device *dev,
3068 + if (!skb->dev)
3069 + return NULL;
3070 +
3071 ++ /* Only unicast or broadcast frames are offloaded */
3072 ++ if (likely(!is_multicast_skb))
3073 ++ skb->offload_fwd_mark = 1;
3074 ++
3075 + return skb;
3076 + }
3077 +
3078 +diff --git a/net/ipv4/esp4_offload.c b/net/ipv4/esp4_offload.c
3079 +index e2e219c7854a..25c8ba6732df 100644
3080 +--- a/net/ipv4/esp4_offload.c
3081 ++++ b/net/ipv4/esp4_offload.c
3082 +@@ -63,10 +63,8 @@ static struct sk_buff *esp4_gro_receive(struct list_head *head,
3083 + sp->olen++;
3084 +
3085 + xo = xfrm_offload(skb);
3086 +- if (!xo) {
3087 +- xfrm_state_put(x);
3088 ++ if (!xo)
3089 + goto out_reset;
3090 +- }
3091 + }
3092 +
3093 + xo->flags |= XFRM_GRO;
3094 +diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
3095 +index 48bf3b9be475..2b0521feadaa 100644
3096 +--- a/net/ipv4/fib_frontend.c
3097 ++++ b/net/ipv4/fib_frontend.c
3098 +@@ -319,17 +319,18 @@ bool fib_info_nh_uses_dev(struct fib_info *fi, const struct net_device *dev)
3099 + {
3100 + bool dev_match = false;
3101 + #ifdef CONFIG_IP_ROUTE_MULTIPATH
3102 +- int ret;
3103 ++ if (unlikely(fi->nh)) {
3104 ++ dev_match = nexthop_uses_dev(fi->nh, dev);
3105 ++ } else {
3106 ++ int ret;
3107 +
3108 +- for (ret = 0; ret < fib_info_num_path(fi); ret++) {
3109 +- const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
3110 ++ for (ret = 0; ret < fib_info_num_path(fi); ret++) {
3111 ++ const struct fib_nh_common *nhc = fib_info_nhc(fi, ret);
3112 +
3113 +- if (nhc->nhc_dev == dev) {
3114 +- dev_match = true;
3115 +- break;
3116 +- } else if (l3mdev_master_ifindex_rcu(nhc->nhc_dev) == dev->ifindex) {
3117 +- dev_match = true;
3118 +- break;
3119 ++ if (nhc_l3mdev_matches_dev(nhc, dev)) {
3120 ++ dev_match = true;
3121 ++ break;
3122 ++ }
3123 + }
3124 + }
3125 + #else
3126 +@@ -928,7 +929,6 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
3127 + else
3128 + filter->dump_exceptions = false;
3129 +
3130 +- filter->dump_all_families = (rtm->rtm_family == AF_UNSPEC);
3131 + filter->flags = rtm->rtm_flags;
3132 + filter->protocol = rtm->rtm_protocol;
3133 + filter->rt_type = rtm->rtm_type;
3134 +@@ -1000,7 +1000,7 @@ static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
3135 + if (filter.table_id) {
3136 + tb = fib_get_table(net, filter.table_id);
3137 + if (!tb) {
3138 +- if (filter.dump_all_families)
3139 ++ if (rtnl_msg_family(cb->nlh) != PF_INET)
3140 + return skb->len;
3141 +
3142 + NL_SET_ERR_MSG(cb->extack, "ipv4: FIB table does not exist");
3143 +diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
3144 +index b0010c710802..5e486895d67c 100644
3145 +--- a/net/ipv4/inet_connection_sock.c
3146 ++++ b/net/ipv4/inet_connection_sock.c
3147 +@@ -24,17 +24,19 @@
3148 + #include <net/addrconf.h>
3149 +
3150 + #if IS_ENABLED(CONFIG_IPV6)
3151 +-/* match_wildcard == true: IPV6_ADDR_ANY equals to any IPv6 addresses if IPv6
3152 +- * only, and any IPv4 addresses if not IPv6 only
3153 +- * match_wildcard == false: addresses must be exactly the same, i.e.
3154 +- * IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY,
3155 +- * and 0.0.0.0 equals to 0.0.0.0 only
3156 ++/* match_sk*_wildcard == true: IPV6_ADDR_ANY equals to any IPv6 addresses
3157 ++ * if IPv6 only, and any IPv4 addresses
3158 ++ * if not IPv6 only
3159 ++ * match_sk*_wildcard == false: addresses must be exactly the same, i.e.
3160 ++ * IPV6_ADDR_ANY only equals to IPV6_ADDR_ANY,
3161 ++ * and 0.0.0.0 equals to 0.0.0.0 only
3162 + */
3163 + static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
3164 + const struct in6_addr *sk2_rcv_saddr6,
3165 + __be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
3166 + bool sk1_ipv6only, bool sk2_ipv6only,
3167 +- bool match_wildcard)
3168 ++ bool match_sk1_wildcard,
3169 ++ bool match_sk2_wildcard)
3170 + {
3171 + int addr_type = ipv6_addr_type(sk1_rcv_saddr6);
3172 + int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
3173 +@@ -44,8 +46,8 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
3174 + if (!sk2_ipv6only) {
3175 + if (sk1_rcv_saddr == sk2_rcv_saddr)
3176 + return true;
3177 +- if (!sk1_rcv_saddr || !sk2_rcv_saddr)
3178 +- return match_wildcard;
3179 ++ return (match_sk1_wildcard && !sk1_rcv_saddr) ||
3180 ++ (match_sk2_wildcard && !sk2_rcv_saddr);
3181 + }
3182 + return false;
3183 + }
3184 +@@ -53,11 +55,11 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
3185 + if (addr_type == IPV6_ADDR_ANY && addr_type2 == IPV6_ADDR_ANY)
3186 + return true;
3187 +
3188 +- if (addr_type2 == IPV6_ADDR_ANY && match_wildcard &&
3189 ++ if (addr_type2 == IPV6_ADDR_ANY && match_sk2_wildcard &&
3190 + !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
3191 + return true;
3192 +
3193 +- if (addr_type == IPV6_ADDR_ANY && match_wildcard &&
3194 ++ if (addr_type == IPV6_ADDR_ANY && match_sk1_wildcard &&
3195 + !(sk1_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
3196 + return true;
3197 +
3198 +@@ -69,18 +71,19 @@ static bool ipv6_rcv_saddr_equal(const struct in6_addr *sk1_rcv_saddr6,
3199 + }
3200 + #endif
3201 +
3202 +-/* match_wildcard == true: 0.0.0.0 equals to any IPv4 addresses
3203 +- * match_wildcard == false: addresses must be exactly the same, i.e.
3204 +- * 0.0.0.0 only equals to 0.0.0.0
3205 ++/* match_sk*_wildcard == true: 0.0.0.0 equals to any IPv4 addresses
3206 ++ * match_sk*_wildcard == false: addresses must be exactly the same, i.e.
3207 ++ * 0.0.0.0 only equals to 0.0.0.0
3208 + */
3209 + static bool ipv4_rcv_saddr_equal(__be32 sk1_rcv_saddr, __be32 sk2_rcv_saddr,
3210 +- bool sk2_ipv6only, bool match_wildcard)
3211 ++ bool sk2_ipv6only, bool match_sk1_wildcard,
3212 ++ bool match_sk2_wildcard)
3213 + {
3214 + if (!sk2_ipv6only) {
3215 + if (sk1_rcv_saddr == sk2_rcv_saddr)
3216 + return true;
3217 +- if (!sk1_rcv_saddr || !sk2_rcv_saddr)
3218 +- return match_wildcard;
3219 ++ return (match_sk1_wildcard && !sk1_rcv_saddr) ||
3220 ++ (match_sk2_wildcard && !sk2_rcv_saddr);
3221 + }
3222 + return false;
3223 + }
3224 +@@ -96,10 +99,12 @@ bool inet_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2,
3225 + sk2->sk_rcv_saddr,
3226 + ipv6_only_sock(sk),
3227 + ipv6_only_sock(sk2),
3228 ++ match_wildcard,
3229 + match_wildcard);
3230 + #endif
3231 + return ipv4_rcv_saddr_equal(sk->sk_rcv_saddr, sk2->sk_rcv_saddr,
3232 +- ipv6_only_sock(sk2), match_wildcard);
3233 ++ ipv6_only_sock(sk2), match_wildcard,
3234 ++ match_wildcard);
3235 + }
3236 + EXPORT_SYMBOL(inet_rcv_saddr_equal);
3237 +
3238 +@@ -273,10 +278,10 @@ static inline int sk_reuseport_match(struct inet_bind_bucket *tb,
3239 + tb->fast_rcv_saddr,
3240 + sk->sk_rcv_saddr,
3241 + tb->fast_ipv6_only,
3242 +- ipv6_only_sock(sk), true);
3243 ++ ipv6_only_sock(sk), true, false);
3244 + #endif
3245 + return ipv4_rcv_saddr_equal(tb->fast_rcv_saddr, sk->sk_rcv_saddr,
3246 +- ipv6_only_sock(sk), true);
3247 ++ ipv6_only_sock(sk), true, false);
3248 + }
3249 +
3250 + /* Obtain a reference to a local port for the given sock,
3251 +diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
3252 +index 8ecaf0f26973..bd41354ed8c1 100644
3253 +--- a/net/ipv4/ip_vti.c
3254 ++++ b/net/ipv4/ip_vti.c
3255 +@@ -93,7 +93,28 @@ static int vti_rcv_proto(struct sk_buff *skb)
3256 +
3257 + static int vti_rcv_tunnel(struct sk_buff *skb)
3258 + {
3259 +- return vti_rcv(skb, ip_hdr(skb)->saddr, true);
3260 ++ struct ip_tunnel_net *itn = net_generic(dev_net(skb->dev), vti_net_id);
3261 ++ const struct iphdr *iph = ip_hdr(skb);
3262 ++ struct ip_tunnel *tunnel;
3263 ++
3264 ++ tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,
3265 ++ iph->saddr, iph->daddr, 0);
3266 ++ if (tunnel) {
3267 ++ struct tnl_ptk_info tpi = {
3268 ++ .proto = htons(ETH_P_IP),
3269 ++ };
3270 ++
3271 ++ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
3272 ++ goto drop;
3273 ++ if (iptunnel_pull_header(skb, 0, tpi.proto, false))
3274 ++ goto drop;
3275 ++ return ip_tunnel_rcv(tunnel, skb, &tpi, NULL, false);
3276 ++ }
3277 ++
3278 ++ return -EINVAL;
3279 ++drop:
3280 ++ kfree_skb(skb);
3281 ++ return 0;
3282 + }
3283 +
3284 + static int vti_rcv_cb(struct sk_buff *skb, int err)
3285 +diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
3286 +index 2f01cf6fa0de..678575adaf3b 100644
3287 +--- a/net/ipv4/ipip.c
3288 ++++ b/net/ipv4/ipip.c
3289 +@@ -698,7 +698,7 @@ out:
3290 +
3291 + rtnl_link_failed:
3292 + #if IS_ENABLED(CONFIG_MPLS)
3293 +- xfrm4_tunnel_deregister(&mplsip_handler, AF_INET);
3294 ++ xfrm4_tunnel_deregister(&mplsip_handler, AF_MPLS);
3295 + xfrm_tunnel_mplsip_failed:
3296 +
3297 + #endif
3298 +diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
3299 +index 58007439cffd..d71935618871 100644
3300 +--- a/net/ipv4/ipmr.c
3301 ++++ b/net/ipv4/ipmr.c
3302 +@@ -2609,7 +2609,7 @@ static int ipmr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb)
3303 +
3304 + mrt = ipmr_get_table(sock_net(skb->sk), filter.table_id);
3305 + if (!mrt) {
3306 +- if (filter.dump_all_families)
3307 ++ if (rtnl_msg_family(cb->nlh) != RTNL_FAMILY_IPMR)
3308 + return skb->len;
3309 +
3310 + NL_SET_ERR_MSG(cb->extack, "ipv4: MR table does not exist");
3311 +diff --git a/net/ipv4/netfilter/nf_nat_pptp.c b/net/ipv4/netfilter/nf_nat_pptp.c
3312 +index b2aeb7bf5dac..2a1e10f4ae93 100644
3313 +--- a/net/ipv4/netfilter/nf_nat_pptp.c
3314 ++++ b/net/ipv4/netfilter/nf_nat_pptp.c
3315 +@@ -166,8 +166,7 @@ pptp_outbound_pkt(struct sk_buff *skb,
3316 + break;
3317 + default:
3318 + pr_debug("unknown outbound packet 0x%04x:%s\n", msg,
3319 +- msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
3320 +- pptp_msg_name[0]);
3321 ++ pptp_msg_name(msg));
3322 + /* fall through */
3323 + case PPTP_SET_LINK_INFO:
3324 + /* only need to NAT in case PAC is behind NAT box */
3325 +@@ -268,9 +267,7 @@ pptp_inbound_pkt(struct sk_buff *skb,
3326 + pcid_off = offsetof(union pptp_ctrl_union, setlink.peersCallID);
3327 + break;
3328 + default:
3329 +- pr_debug("unknown inbound packet %s\n",
3330 +- msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] :
3331 +- pptp_msg_name[0]);
3332 ++ pr_debug("unknown inbound packet %s\n", pptp_msg_name(msg));
3333 + /* fall through */
3334 + case PPTP_START_SESSION_REQUEST:
3335 + case PPTP_START_SESSION_REPLY:
3336 +diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
3337 +index 3737d32ad11a..a01f500d6a6b 100644
3338 +--- a/net/ipv4/nexthop.c
3339 ++++ b/net/ipv4/nexthop.c
3340 +@@ -64,9 +64,16 @@ static void nexthop_free_mpath(struct nexthop *nh)
3341 + int i;
3342 +
3343 + nhg = rcu_dereference_raw(nh->nh_grp);
3344 +- for (i = 0; i < nhg->num_nh; ++i)
3345 +- WARN_ON(nhg->nh_entries[i].nh);
3346 ++ for (i = 0; i < nhg->num_nh; ++i) {
3347 ++ struct nh_grp_entry *nhge = &nhg->nh_entries[i];
3348 ++
3349 ++ WARN_ON(!list_empty(&nhge->nh_list));
3350 ++ nexthop_put(nhge->nh);
3351 ++ }
3352 ++
3353 ++ WARN_ON(nhg->spare == nhg);
3354 +
3355 ++ kfree(nhg->spare);
3356 + kfree(nhg);
3357 + }
3358 +
3359 +@@ -277,6 +284,7 @@ out:
3360 + return 0;
3361 +
3362 + nla_put_failure:
3363 ++ nlmsg_cancel(skb, nlh);
3364 + return -EMSGSIZE;
3365 + }
3366 +
3367 +@@ -434,7 +442,7 @@ static int nh_check_attr_group(struct net *net, struct nlattr *tb[],
3368 + if (!valid_group_nh(nh, len, extack))
3369 + return -EINVAL;
3370 + }
3371 +- for (i = NHA_GROUP + 1; i < __NHA_MAX; ++i) {
3372 ++ for (i = NHA_GROUP_TYPE + 1; i < __NHA_MAX; ++i) {
3373 + if (!tb[i])
3374 + continue;
3375 +
3376 +@@ -694,41 +702,56 @@ static void nh_group_rebalance(struct nh_group *nhg)
3377 + }
3378 + }
3379 +
3380 +-static void remove_nh_grp_entry(struct nh_grp_entry *nhge,
3381 +- struct nh_group *nhg,
3382 ++static void remove_nh_grp_entry(struct net *net, struct nh_grp_entry *nhge,
3383 + struct nl_info *nlinfo)
3384 + {
3385 ++ struct nh_grp_entry *nhges, *new_nhges;
3386 ++ struct nexthop *nhp = nhge->nh_parent;
3387 + struct nexthop *nh = nhge->nh;
3388 +- struct nh_grp_entry *nhges;
3389 +- bool found = false;
3390 +- int i;
3391 ++ struct nh_group *nhg, *newg;
3392 ++ int i, j;
3393 +
3394 + WARN_ON(!nh);
3395 +
3396 +- nhges = nhg->nh_entries;
3397 +- for (i = 0; i < nhg->num_nh; ++i) {
3398 +- if (found) {
3399 +- nhges[i-1].nh = nhges[i].nh;
3400 +- nhges[i-1].weight = nhges[i].weight;
3401 +- list_del(&nhges[i].nh_list);
3402 +- list_add(&nhges[i-1].nh_list, &nhges[i-1].nh->grp_list);
3403 +- } else if (nhg->nh_entries[i].nh == nh) {
3404 +- found = true;
3405 +- }
3406 +- }
3407 ++ nhg = rtnl_dereference(nhp->nh_grp);
3408 ++ newg = nhg->spare;
3409 +
3410 +- if (WARN_ON(!found))
3411 ++ /* last entry, keep it visible and remove the parent */
3412 ++ if (nhg->num_nh == 1) {
3413 ++ remove_nexthop(net, nhp, nlinfo);
3414 + return;
3415 ++ }
3416 ++
3417 ++ newg->has_v4 = nhg->has_v4;
3418 ++ newg->mpath = nhg->mpath;
3419 ++ newg->num_nh = nhg->num_nh;
3420 +
3421 +- nhg->num_nh--;
3422 +- nhg->nh_entries[nhg->num_nh].nh = NULL;
3423 ++ /* copy old entries to new except the one getting removed */
3424 ++ nhges = nhg->nh_entries;
3425 ++ new_nhges = newg->nh_entries;
3426 ++ for (i = 0, j = 0; i < nhg->num_nh; ++i) {
3427 ++ /* current nexthop getting removed */
3428 ++ if (nhg->nh_entries[i].nh == nh) {
3429 ++ newg->num_nh--;
3430 ++ continue;
3431 ++ }
3432 +
3433 +- nh_group_rebalance(nhg);
3434 ++ list_del(&nhges[i].nh_list);
3435 ++ new_nhges[j].nh_parent = nhges[i].nh_parent;
3436 ++ new_nhges[j].nh = nhges[i].nh;
3437 ++ new_nhges[j].weight = nhges[i].weight;
3438 ++ list_add(&new_nhges[j].nh_list, &new_nhges[j].nh->grp_list);
3439 ++ j++;
3440 ++ }
3441 +
3442 +- nexthop_put(nh);
3443 ++ nh_group_rebalance(newg);
3444 ++ rcu_assign_pointer(nhp->nh_grp, newg);
3445 ++
3446 ++ list_del(&nhge->nh_list);
3447 ++ nexthop_put(nhge->nh);
3448 +
3449 + if (nlinfo)
3450 +- nexthop_notify(RTM_NEWNEXTHOP, nhge->nh_parent, nlinfo);
3451 ++ nexthop_notify(RTM_NEWNEXTHOP, nhp, nlinfo);
3452 + }
3453 +
3454 + static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
3455 +@@ -736,17 +759,11 @@ static void remove_nexthop_from_groups(struct net *net, struct nexthop *nh,
3456 + {
3457 + struct nh_grp_entry *nhge, *tmp;
3458 +
3459 +- list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) {
3460 +- struct nh_group *nhg;
3461 +-
3462 +- list_del(&nhge->nh_list);
3463 +- nhg = rtnl_dereference(nhge->nh_parent->nh_grp);
3464 +- remove_nh_grp_entry(nhge, nhg, nlinfo);
3465 ++ list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list)
3466 ++ remove_nh_grp_entry(net, nhge, nlinfo);
3467 +
3468 +- /* if this group has no more entries then remove it */
3469 +- if (!nhg->num_nh)
3470 +- remove_nexthop(net, nhge->nh_parent, nlinfo);
3471 +- }
3472 ++ /* make sure all see the newly published array before releasing rtnl */
3473 ++ synchronize_rcu();
3474 + }
3475 +
3476 + static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo)
3477 +@@ -760,10 +777,7 @@ static void remove_nexthop_group(struct nexthop *nh, struct nl_info *nlinfo)
3478 + if (WARN_ON(!nhge->nh))
3479 + continue;
3480 +
3481 +- list_del(&nhge->nh_list);
3482 +- nexthop_put(nhge->nh);
3483 +- nhge->nh = NULL;
3484 +- nhg->num_nh--;
3485 ++ list_del_init(&nhge->nh_list);
3486 + }
3487 + }
3488 +
3489 +@@ -1086,6 +1100,7 @@ static struct nexthop *nexthop_create_group(struct net *net,
3490 + {
3491 + struct nlattr *grps_attr = cfg->nh_grp;
3492 + struct nexthop_grp *entry = nla_data(grps_attr);
3493 ++ u16 num_nh = nla_len(grps_attr) / sizeof(*entry);
3494 + struct nh_group *nhg;
3495 + struct nexthop *nh;
3496 + int i;
3497 +@@ -1096,12 +1111,21 @@ static struct nexthop *nexthop_create_group(struct net *net,
3498 +
3499 + nh->is_group = 1;
3500 +
3501 +- nhg = nexthop_grp_alloc(nla_len(grps_attr) / sizeof(*entry));
3502 ++ nhg = nexthop_grp_alloc(num_nh);
3503 + if (!nhg) {
3504 + kfree(nh);
3505 + return ERR_PTR(-ENOMEM);
3506 + }
3507 +
3508 ++ /* spare group used for removals */
3509 ++ nhg->spare = nexthop_grp_alloc(num_nh);
3510 ++ if (!nhg) {
3511 ++ kfree(nhg);
3512 ++ kfree(nh);
3513 ++ return NULL;
3514 ++ }
3515 ++ nhg->spare->spare = nhg;
3516 ++
3517 + for (i = 0; i < nhg->num_nh; ++i) {
3518 + struct nexthop *nhe;
3519 + struct nh_info *nhi;
3520 +@@ -1133,6 +1157,7 @@ out_no_nh:
3521 + for (; i >= 0; --i)
3522 + nexthop_put(nhg->nh_entries[i].nh);
3523 +
3524 ++ kfree(nhg->spare);
3525 + kfree(nhg);
3526 + kfree(nh);
3527 +
3528 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3529 +index 558ddf7ab395..b3a8d32f7d8d 100644
3530 +--- a/net/ipv4/route.c
3531 ++++ b/net/ipv4/route.c
3532 +@@ -490,18 +490,16 @@ u32 ip_idents_reserve(u32 hash, int segs)
3533 + atomic_t *p_id = ip_idents + hash % IP_IDENTS_SZ;
3534 + u32 old = READ_ONCE(*p_tstamp);
3535 + u32 now = (u32)jiffies;
3536 +- u32 new, delta = 0;
3537 ++ u32 delta = 0;
3538 +
3539 + if (old != now && cmpxchg(p_tstamp, old, now) == old)
3540 + delta = prandom_u32_max(now - old);
3541 +
3542 +- /* Do not use atomic_add_return() as it makes UBSAN unhappy */
3543 +- do {
3544 +- old = (u32)atomic_read(p_id);
3545 +- new = old + delta + segs;
3546 +- } while (atomic_cmpxchg(p_id, old, new) != old);
3547 +-
3548 +- return new - segs;
3549 ++ /* If UBSAN reports an error there, please make sure your compiler
3550 ++ * supports -fno-strict-overflow before reporting it that was a bug
3551 ++ * in UBSAN, and it has been fixed in GCC-8.
3552 ++ */
3553 ++ return atomic_add_return(segs + delta, p_id) - segs;
3554 + }
3555 + EXPORT_SYMBOL(ip_idents_reserve);
3556 +
3557 +diff --git a/net/ipv6/esp6_offload.c b/net/ipv6/esp6_offload.c
3558 +index fd535053245b..93e086cf058a 100644
3559 +--- a/net/ipv6/esp6_offload.c
3560 ++++ b/net/ipv6/esp6_offload.c
3561 +@@ -85,10 +85,8 @@ static struct sk_buff *esp6_gro_receive(struct list_head *head,
3562 + sp->olen++;
3563 +
3564 + xo = xfrm_offload(skb);
3565 +- if (!xo) {
3566 +- xfrm_state_put(x);
3567 ++ if (!xo)
3568 + goto out_reset;
3569 +- }
3570 + }
3571 +
3572 + xo->flags |= XFRM_GRO;
3573 +@@ -123,9 +121,16 @@ static void esp6_gso_encap(struct xfrm_state *x, struct sk_buff *skb)
3574 + struct ip_esp_hdr *esph;
3575 + struct ipv6hdr *iph = ipv6_hdr(skb);
3576 + struct xfrm_offload *xo = xfrm_offload(skb);
3577 +- int proto = iph->nexthdr;
3578 ++ u8 proto = iph->nexthdr;
3579 +
3580 + skb_push(skb, -skb_network_offset(skb));
3581 ++
3582 ++ if (x->outer_mode.encap == XFRM_MODE_TRANSPORT) {
3583 ++ __be16 frag;
3584 ++
3585 ++ ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &proto, &frag);
3586 ++ }
3587 ++
3588 + esph = ip_esp_hdr(skb);
3589 + *skb_mac_header(skb) = IPPROTO_ESP;
3590 +
3591 +diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
3592 +index c75274e0745c..7a0c877ca306 100644
3593 +--- a/net/ipv6/ip6_fib.c
3594 ++++ b/net/ipv6/ip6_fib.c
3595 +@@ -613,7 +613,7 @@ static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
3596 + if (arg.filter.table_id) {
3597 + tb = fib6_get_table(net, arg.filter.table_id);
3598 + if (!tb) {
3599 +- if (arg.filter.dump_all_families)
3600 ++ if (rtnl_msg_family(cb->nlh) != PF_INET6)
3601 + goto out;
3602 +
3603 + NL_SET_ERR_MSG_MOD(cb->extack, "FIB table does not exist");
3604 +diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
3605 +index 857a89ad4d6c..dd41313d7fa5 100644
3606 +--- a/net/ipv6/ip6mr.c
3607 ++++ b/net/ipv6/ip6mr.c
3608 +@@ -2498,7 +2498,7 @@ static int ip6mr_rtm_dumproute(struct sk_buff *skb, struct netlink_callback *cb)
3609 +
3610 + mrt = ip6mr_get_table(sock_net(skb->sk), filter.table_id);
3611 + if (!mrt) {
3612 +- if (filter.dump_all_families)
3613 ++ if (rtnl_msg_family(cb->nlh) != RTNL_FAMILY_IP6MR)
3614 + return skb->len;
3615 +
3616 + NL_SET_ERR_MSG_MOD(cb->extack, "MR table does not exist");
3617 +diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
3618 +index 38a0383dfbcf..aa5150929996 100644
3619 +--- a/net/mac80211/mesh_hwmp.c
3620 ++++ b/net/mac80211/mesh_hwmp.c
3621 +@@ -1103,7 +1103,14 @@ void mesh_path_start_discovery(struct ieee80211_sub_if_data *sdata)
3622 + mesh_path_sel_frame_tx(MPATH_PREQ, 0, sdata->vif.addr, ifmsh->sn,
3623 + target_flags, mpath->dst, mpath->sn, da, 0,
3624 + ttl, lifetime, 0, ifmsh->preq_id++, sdata);
3625 ++
3626 ++ spin_lock_bh(&mpath->state_lock);
3627 ++ if (mpath->flags & MESH_PATH_DELETED) {
3628 ++ spin_unlock_bh(&mpath->state_lock);
3629 ++ goto enddiscovery;
3630 ++ }
3631 + mod_timer(&mpath->timer, jiffies + mpath->discovery_timeout);
3632 ++ spin_unlock_bh(&mpath->state_lock);
3633 +
3634 + enddiscovery:
3635 + rcu_read_unlock();
3636 +diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
3637 +index 67ac50104e6f..63908123f7ba 100644
3638 +--- a/net/netfilter/ipset/ip_set_list_set.c
3639 ++++ b/net/netfilter/ipset/ip_set_list_set.c
3640 +@@ -59,7 +59,7 @@ list_set_ktest(struct ip_set *set, const struct sk_buff *skb,
3641 + /* Don't lookup sub-counters at all */
3642 + opt->cmdflags &= ~IPSET_FLAG_MATCH_COUNTERS;
3643 + if (opt->cmdflags & IPSET_FLAG_SKIP_SUBCOUNTER_UPDATE)
3644 +- opt->cmdflags &= ~IPSET_FLAG_SKIP_COUNTER_UPDATE;
3645 ++ opt->cmdflags |= IPSET_FLAG_SKIP_COUNTER_UPDATE;
3646 + list_for_each_entry_rcu(e, &map->members, list) {
3647 + ret = ip_set_test(e->id, skb, par, opt);
3648 + if (ret <= 0)
3649 +diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
3650 +index c2ad462f33f1..48db4aec02de 100644
3651 +--- a/net/netfilter/nf_conntrack_core.c
3652 ++++ b/net/netfilter/nf_conntrack_core.c
3653 +@@ -1879,22 +1879,18 @@ static void nf_conntrack_attach(struct sk_buff *nskb, const struct sk_buff *skb)
3654 + nf_conntrack_get(skb_nfct(nskb));
3655 + }
3656 +
3657 +-static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
3658 ++static int __nf_conntrack_update(struct net *net, struct sk_buff *skb,
3659 ++ struct nf_conn *ct,
3660 ++ enum ip_conntrack_info ctinfo)
3661 + {
3662 + struct nf_conntrack_tuple_hash *h;
3663 + struct nf_conntrack_tuple tuple;
3664 +- enum ip_conntrack_info ctinfo;
3665 + struct nf_nat_hook *nat_hook;
3666 + unsigned int status;
3667 +- struct nf_conn *ct;
3668 + int dataoff;
3669 + u16 l3num;
3670 + u8 l4num;
3671 +
3672 +- ct = nf_ct_get(skb, &ctinfo);
3673 +- if (!ct || nf_ct_is_confirmed(ct))
3674 +- return 0;
3675 +-
3676 + l3num = nf_ct_l3num(ct);
3677 +
3678 + dataoff = get_l4proto(skb, skb_network_offset(skb), l3num, &l4num);
3679 +@@ -1951,6 +1947,76 @@ static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
3680 + return 0;
3681 + }
3682 +
3683 ++/* This packet is coming from userspace via nf_queue, complete the packet
3684 ++ * processing after the helper invocation in nf_confirm().
3685 ++ */
3686 ++static int nf_confirm_cthelper(struct sk_buff *skb, struct nf_conn *ct,
3687 ++ enum ip_conntrack_info ctinfo)
3688 ++{
3689 ++ const struct nf_conntrack_helper *helper;
3690 ++ const struct nf_conn_help *help;
3691 ++ int protoff;
3692 ++
3693 ++ help = nfct_help(ct);
3694 ++ if (!help)
3695 ++ return 0;
3696 ++
3697 ++ helper = rcu_dereference(help->helper);
3698 ++ if (!(helper->flags & NF_CT_HELPER_F_USERSPACE))
3699 ++ return 0;
3700 ++
3701 ++ switch (nf_ct_l3num(ct)) {
3702 ++ case NFPROTO_IPV4:
3703 ++ protoff = skb_network_offset(skb) + ip_hdrlen(skb);
3704 ++ break;
3705 ++#if IS_ENABLED(CONFIG_IPV6)
3706 ++ case NFPROTO_IPV6: {
3707 ++ __be16 frag_off;
3708 ++ u8 pnum;
3709 ++
3710 ++ pnum = ipv6_hdr(skb)->nexthdr;
3711 ++ protoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum,
3712 ++ &frag_off);
3713 ++ if (protoff < 0 || (frag_off & htons(~0x7)) != 0)
3714 ++ return 0;
3715 ++ break;
3716 ++ }
3717 ++#endif
3718 ++ default:
3719 ++ return 0;
3720 ++ }
3721 ++
3722 ++ if (test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) &&
3723 ++ !nf_is_loopback_packet(skb)) {
3724 ++ if (!nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) {
3725 ++ NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
3726 ++ return -1;
3727 ++ }
3728 ++ }
3729 ++
3730 ++ /* We've seen it coming out the other side: confirm it */
3731 ++ return nf_conntrack_confirm(skb) == NF_DROP ? - 1 : 0;
3732 ++}
3733 ++
3734 ++static int nf_conntrack_update(struct net *net, struct sk_buff *skb)
3735 ++{
3736 ++ enum ip_conntrack_info ctinfo;
3737 ++ struct nf_conn *ct;
3738 ++ int err;
3739 ++
3740 ++ ct = nf_ct_get(skb, &ctinfo);
3741 ++ if (!ct)
3742 ++ return 0;
3743 ++
3744 ++ if (!nf_ct_is_confirmed(ct)) {
3745 ++ err = __nf_conntrack_update(net, skb, ct, ctinfo);
3746 ++ if (err < 0)
3747 ++ return err;
3748 ++ }
3749 ++
3750 ++ return nf_confirm_cthelper(skb, ct, ctinfo);
3751 ++}
3752 ++
3753 + static bool nf_conntrack_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
3754 + const struct sk_buff *skb)
3755 + {
3756 +diff --git a/net/netfilter/nf_conntrack_pptp.c b/net/netfilter/nf_conntrack_pptp.c
3757 +index a971183f11af..1f44d523b512 100644
3758 +--- a/net/netfilter/nf_conntrack_pptp.c
3759 ++++ b/net/netfilter/nf_conntrack_pptp.c
3760 +@@ -72,24 +72,32 @@ EXPORT_SYMBOL_GPL(nf_nat_pptp_hook_expectfn);
3761 +
3762 + #if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
3763 + /* PptpControlMessageType names */
3764 +-const char *const pptp_msg_name[] = {
3765 +- "UNKNOWN_MESSAGE",
3766 +- "START_SESSION_REQUEST",
3767 +- "START_SESSION_REPLY",
3768 +- "STOP_SESSION_REQUEST",
3769 +- "STOP_SESSION_REPLY",
3770 +- "ECHO_REQUEST",
3771 +- "ECHO_REPLY",
3772 +- "OUT_CALL_REQUEST",
3773 +- "OUT_CALL_REPLY",
3774 +- "IN_CALL_REQUEST",
3775 +- "IN_CALL_REPLY",
3776 +- "IN_CALL_CONNECT",
3777 +- "CALL_CLEAR_REQUEST",
3778 +- "CALL_DISCONNECT_NOTIFY",
3779 +- "WAN_ERROR_NOTIFY",
3780 +- "SET_LINK_INFO"
3781 ++static const char *const pptp_msg_name_array[PPTP_MSG_MAX + 1] = {
3782 ++ [0] = "UNKNOWN_MESSAGE",
3783 ++ [PPTP_START_SESSION_REQUEST] = "START_SESSION_REQUEST",
3784 ++ [PPTP_START_SESSION_REPLY] = "START_SESSION_REPLY",
3785 ++ [PPTP_STOP_SESSION_REQUEST] = "STOP_SESSION_REQUEST",
3786 ++ [PPTP_STOP_SESSION_REPLY] = "STOP_SESSION_REPLY",
3787 ++ [PPTP_ECHO_REQUEST] = "ECHO_REQUEST",
3788 ++ [PPTP_ECHO_REPLY] = "ECHO_REPLY",
3789 ++ [PPTP_OUT_CALL_REQUEST] = "OUT_CALL_REQUEST",
3790 ++ [PPTP_OUT_CALL_REPLY] = "OUT_CALL_REPLY",
3791 ++ [PPTP_IN_CALL_REQUEST] = "IN_CALL_REQUEST",
3792 ++ [PPTP_IN_CALL_REPLY] = "IN_CALL_REPLY",
3793 ++ [PPTP_IN_CALL_CONNECT] = "IN_CALL_CONNECT",
3794 ++ [PPTP_CALL_CLEAR_REQUEST] = "CALL_CLEAR_REQUEST",
3795 ++ [PPTP_CALL_DISCONNECT_NOTIFY] = "CALL_DISCONNECT_NOTIFY",
3796 ++ [PPTP_WAN_ERROR_NOTIFY] = "WAN_ERROR_NOTIFY",
3797 ++ [PPTP_SET_LINK_INFO] = "SET_LINK_INFO"
3798 + };
3799 ++
3800 ++const char *pptp_msg_name(u_int16_t msg)
3801 ++{
3802 ++ if (msg > PPTP_MSG_MAX)
3803 ++ return pptp_msg_name_array[0];
3804 ++
3805 ++ return pptp_msg_name_array[msg];
3806 ++}
3807 + EXPORT_SYMBOL(pptp_msg_name);
3808 + #endif
3809 +
3810 +@@ -276,7 +284,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3811 + typeof(nf_nat_pptp_hook_inbound) nf_nat_pptp_inbound;
3812 +
3813 + msg = ntohs(ctlh->messageType);
3814 +- pr_debug("inbound control message %s\n", pptp_msg_name[msg]);
3815 ++ pr_debug("inbound control message %s\n", pptp_msg_name(msg));
3816 +
3817 + switch (msg) {
3818 + case PPTP_START_SESSION_REPLY:
3819 +@@ -311,7 +319,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3820 + pcid = pptpReq->ocack.peersCallID;
3821 + if (info->pns_call_id != pcid)
3822 + goto invalid;
3823 +- pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name[msg],
3824 ++ pr_debug("%s, CID=%X, PCID=%X\n", pptp_msg_name(msg),
3825 + ntohs(cid), ntohs(pcid));
3826 +
3827 + if (pptpReq->ocack.resultCode == PPTP_OUTCALL_CONNECT) {
3828 +@@ -328,7 +336,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3829 + goto invalid;
3830 +
3831 + cid = pptpReq->icreq.callID;
3832 +- pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
3833 ++ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
3834 + info->cstate = PPTP_CALL_IN_REQ;
3835 + info->pac_call_id = cid;
3836 + break;
3837 +@@ -347,7 +355,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3838 + if (info->pns_call_id != pcid)
3839 + goto invalid;
3840 +
3841 +- pr_debug("%s, PCID=%X\n", pptp_msg_name[msg], ntohs(pcid));
3842 ++ pr_debug("%s, PCID=%X\n", pptp_msg_name(msg), ntohs(pcid));
3843 + info->cstate = PPTP_CALL_IN_CONF;
3844 +
3845 + /* we expect a GRE connection from PAC to PNS */
3846 +@@ -357,7 +365,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3847 + case PPTP_CALL_DISCONNECT_NOTIFY:
3848 + /* server confirms disconnect */
3849 + cid = pptpReq->disc.callID;
3850 +- pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
3851 ++ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
3852 + info->cstate = PPTP_CALL_NONE;
3853 +
3854 + /* untrack this call id, unexpect GRE packets */
3855 +@@ -384,7 +392,7 @@ pptp_inbound_pkt(struct sk_buff *skb, unsigned int protoff,
3856 + invalid:
3857 + pr_debug("invalid %s: type=%d cid=%u pcid=%u "
3858 + "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n",
3859 +- msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0],
3860 ++ pptp_msg_name(msg),
3861 + msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate,
3862 + ntohs(info->pns_call_id), ntohs(info->pac_call_id));
3863 + return NF_ACCEPT;
3864 +@@ -404,7 +412,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
3865 + typeof(nf_nat_pptp_hook_outbound) nf_nat_pptp_outbound;
3866 +
3867 + msg = ntohs(ctlh->messageType);
3868 +- pr_debug("outbound control message %s\n", pptp_msg_name[msg]);
3869 ++ pr_debug("outbound control message %s\n", pptp_msg_name(msg));
3870 +
3871 + switch (msg) {
3872 + case PPTP_START_SESSION_REQUEST:
3873 +@@ -426,7 +434,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
3874 + info->cstate = PPTP_CALL_OUT_REQ;
3875 + /* track PNS call id */
3876 + cid = pptpReq->ocreq.callID;
3877 +- pr_debug("%s, CID=%X\n", pptp_msg_name[msg], ntohs(cid));
3878 ++ pr_debug("%s, CID=%X\n", pptp_msg_name(msg), ntohs(cid));
3879 + info->pns_call_id = cid;
3880 + break;
3881 +
3882 +@@ -440,7 +448,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
3883 + pcid = pptpReq->icack.peersCallID;
3884 + if (info->pac_call_id != pcid)
3885 + goto invalid;
3886 +- pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name[msg],
3887 ++ pr_debug("%s, CID=%X PCID=%X\n", pptp_msg_name(msg),
3888 + ntohs(cid), ntohs(pcid));
3889 +
3890 + if (pptpReq->icack.resultCode == PPTP_INCALL_ACCEPT) {
3891 +@@ -480,7 +488,7 @@ pptp_outbound_pkt(struct sk_buff *skb, unsigned int protoff,
3892 + invalid:
3893 + pr_debug("invalid %s: type=%d cid=%u pcid=%u "
3894 + "cstate=%d sstate=%d pns_cid=%u pac_cid=%u\n",
3895 +- msg <= PPTP_MSG_MAX ? pptp_msg_name[msg] : pptp_msg_name[0],
3896 ++ pptp_msg_name(msg),
3897 + msg, ntohs(cid), ntohs(pcid), info->cstate, info->sstate,
3898 + ntohs(info->pns_call_id), ntohs(info->pac_call_id));
3899 + return NF_ACCEPT;
3900 +diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c
3901 +index 60838d5fb8e0..81406b93f126 100644
3902 +--- a/net/netfilter/nfnetlink_cthelper.c
3903 ++++ b/net/netfilter/nfnetlink_cthelper.c
3904 +@@ -103,7 +103,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)
3905 + if (help->helper->data_len == 0)
3906 + return -EINVAL;
3907 +
3908 +- nla_memcpy(help->data, nla_data(attr), sizeof(help->data));
3909 ++ nla_memcpy(help->data, attr, sizeof(help->data));
3910 + return 0;
3911 + }
3912 +
3913 +@@ -240,6 +240,7 @@ nfnl_cthelper_create(const struct nlattr * const tb[],
3914 + ret = -ENOMEM;
3915 + goto err2;
3916 + }
3917 ++ helper->data_len = size;
3918 +
3919 + helper->flags |= NF_CT_HELPER_F_USERSPACE;
3920 + memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));
3921 +diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
3922 +index 930f48a20546..2a4d50e04441 100644
3923 +--- a/net/qrtr/qrtr.c
3924 ++++ b/net/qrtr/qrtr.c
3925 +@@ -711,7 +711,7 @@ static int qrtr_bcast_enqueue(struct qrtr_node *node, struct sk_buff *skb,
3926 + }
3927 + mutex_unlock(&qrtr_node_lock);
3928 +
3929 +- qrtr_local_enqueue(node, skb, type, from, to);
3930 ++ qrtr_local_enqueue(NULL, skb, type, from, to);
3931 +
3932 + return 0;
3933 + }
3934 +diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
3935 +index b06cae508158..6927b658dad3 100644
3936 +--- a/net/sctp/sm_sideeffect.c
3937 ++++ b/net/sctp/sm_sideeffect.c
3938 +@@ -1522,9 +1522,17 @@ static int sctp_cmd_interpreter(enum sctp_event_type event_type,
3939 + timeout = asoc->timeouts[cmd->obj.to];
3940 + BUG_ON(!timeout);
3941 +
3942 +- timer->expires = jiffies + timeout;
3943 +- sctp_association_hold(asoc);
3944 +- add_timer(timer);
3945 ++ /*
3946 ++ * SCTP has a hard time with timer starts. Because we process
3947 ++ * timer starts as side effects, it can be hard to tell if we
3948 ++ * have already started a timer or not, which leads to BUG
3949 ++ * halts when we call add_timer. So here, instead of just starting
3950 ++ * a timer, if the timer is already started, and just mod
3951 ++ * the timer with the shorter of the two expiration times
3952 ++ */
3953 ++ if (!timer_pending(timer))
3954 ++ sctp_association_hold(asoc);
3955 ++ timer_reduce(timer, jiffies + timeout);
3956 + break;
3957 +
3958 + case SCTP_CMD_TIMER_RESTART:
3959 +diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
3960 +index 5625a9500f21..84138a07e936 100644
3961 +--- a/net/sctp/sm_statefuns.c
3962 ++++ b/net/sctp/sm_statefuns.c
3963 +@@ -1856,12 +1856,13 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
3964 + /* Update the content of current association. */
3965 + sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc));
3966 + sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev));
3967 +- if (sctp_state(asoc, SHUTDOWN_PENDING) &&
3968 ++ if ((sctp_state(asoc, SHUTDOWN_PENDING) ||
3969 ++ sctp_state(asoc, SHUTDOWN_SENT)) &&
3970 + (sctp_sstate(asoc->base.sk, CLOSING) ||
3971 + sock_flag(asoc->base.sk, SOCK_DEAD))) {
3972 +- /* if were currently in SHUTDOWN_PENDING, but the socket
3973 +- * has been closed by user, don't transition to ESTABLISHED.
3974 +- * Instead trigger SHUTDOWN bundled with COOKIE_ACK.
3975 ++ /* If the socket has been closed by user, don't
3976 ++ * transition to ESTABLISHED. Instead trigger SHUTDOWN
3977 ++ * bundled with COOKIE_ACK.
3978 + */
3979 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl));
3980 + return sctp_sf_do_9_2_start_shutdown(net, ep, asoc,
3981 +diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
3982 +index 186c78431217..8f0977a9d423 100644
3983 +--- a/net/tipc/udp_media.c
3984 ++++ b/net/tipc/udp_media.c
3985 +@@ -161,9 +161,11 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb,
3986 + struct udp_bearer *ub, struct udp_media_addr *src,
3987 + struct udp_media_addr *dst, struct dst_cache *cache)
3988 + {
3989 +- struct dst_entry *ndst = dst_cache_get(cache);
3990 ++ struct dst_entry *ndst;
3991 + int ttl, err = 0;
3992 +
3993 ++ local_bh_disable();
3994 ++ ndst = dst_cache_get(cache);
3995 + if (dst->proto == htons(ETH_P_IP)) {
3996 + struct rtable *rt = (struct rtable *)ndst;
3997 +
3998 +@@ -210,9 +212,11 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb,
3999 + src->port, dst->port, false);
4000 + #endif
4001 + }
4002 ++ local_bh_enable();
4003 + return err;
4004 +
4005 + tx_error:
4006 ++ local_bh_enable();
4007 + kfree_skb(skb);
4008 + return err;
4009 + }
4010 +diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
4011 +index 5513a08a4308..fbf6a496ee8b 100644
4012 +--- a/net/tls/tls_sw.c
4013 ++++ b/net/tls/tls_sw.c
4014 +@@ -203,10 +203,12 @@ static void tls_decrypt_done(struct crypto_async_request *req, int err)
4015 +
4016 + kfree(aead_req);
4017 +
4018 ++ spin_lock_bh(&ctx->decrypt_compl_lock);
4019 + pending = atomic_dec_return(&ctx->decrypt_pending);
4020 +
4021 +- if (!pending && READ_ONCE(ctx->async_notify))
4022 ++ if (!pending && ctx->async_notify)
4023 + complete(&ctx->async_wait.completion);
4024 ++ spin_unlock_bh(&ctx->decrypt_compl_lock);
4025 + }
4026 +
4027 + static int tls_do_decryption(struct sock *sk,
4028 +@@ -464,10 +466,12 @@ static void tls_encrypt_done(struct crypto_async_request *req, int err)
4029 + ready = true;
4030 + }
4031 +
4032 ++ spin_lock_bh(&ctx->encrypt_compl_lock);
4033 + pending = atomic_dec_return(&ctx->encrypt_pending);
4034 +
4035 +- if (!pending && READ_ONCE(ctx->async_notify))
4036 ++ if (!pending && ctx->async_notify)
4037 + complete(&ctx->async_wait.completion);
4038 ++ spin_unlock_bh(&ctx->encrypt_compl_lock);
4039 +
4040 + if (!ready)
4041 + return;
4042 +@@ -777,7 +781,7 @@ static int tls_push_record(struct sock *sk, int flags,
4043 +
4044 + static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk,
4045 + bool full_record, u8 record_type,
4046 +- size_t *copied, int flags)
4047 ++ ssize_t *copied, int flags)
4048 + {
4049 + struct tls_context *tls_ctx = tls_get_ctx(sk);
4050 + struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx);
4051 +@@ -793,9 +797,10 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk,
4052 + psock = sk_psock_get(sk);
4053 + if (!psock || !policy) {
4054 + err = tls_push_record(sk, flags, record_type);
4055 +- if (err && err != -EINPROGRESS) {
4056 ++ if (err && sk->sk_err == EBADMSG) {
4057 + *copied -= sk_msg_free(sk, msg);
4058 + tls_free_open_rec(sk);
4059 ++ err = -sk->sk_err;
4060 + }
4061 + if (psock)
4062 + sk_psock_put(sk, psock);
4063 +@@ -821,9 +826,10 @@ more_data:
4064 + switch (psock->eval) {
4065 + case __SK_PASS:
4066 + err = tls_push_record(sk, flags, record_type);
4067 +- if (err && err != -EINPROGRESS) {
4068 ++ if (err && sk->sk_err == EBADMSG) {
4069 + *copied -= sk_msg_free(sk, msg);
4070 + tls_free_open_rec(sk);
4071 ++ err = -sk->sk_err;
4072 + goto out_err;
4073 + }
4074 + break;
4075 +@@ -913,7 +919,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
4076 + unsigned char record_type = TLS_RECORD_TYPE_DATA;
4077 + bool is_kvec = iov_iter_is_kvec(&msg->msg_iter);
4078 + bool eor = !(msg->msg_flags & MSG_MORE);
4079 +- size_t try_to_copy, copied = 0;
4080 ++ size_t try_to_copy;
4081 ++ ssize_t copied = 0;
4082 + struct sk_msg *msg_pl, *msg_en;
4083 + struct tls_rec *rec;
4084 + int required_size;
4085 +@@ -923,6 +930,7 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
4086 + int num_zc = 0;
4087 + int orig_size;
4088 + int ret = 0;
4089 ++ int pending;
4090 +
4091 + if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
4092 + return -EOPNOTSUPP;
4093 +@@ -1089,13 +1097,19 @@ trim_sgl:
4094 + goto send_end;
4095 + } else if (num_zc) {
4096 + /* Wait for pending encryptions to get completed */
4097 +- smp_store_mb(ctx->async_notify, true);
4098 ++ spin_lock_bh(&ctx->encrypt_compl_lock);
4099 ++ ctx->async_notify = true;
4100 +
4101 +- if (atomic_read(&ctx->encrypt_pending))
4102 ++ pending = atomic_read(&ctx->encrypt_pending);
4103 ++ spin_unlock_bh(&ctx->encrypt_compl_lock);
4104 ++ if (pending)
4105 + crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
4106 + else
4107 + reinit_completion(&ctx->async_wait.completion);
4108 +
4109 ++ /* There can be no concurrent accesses, since we have no
4110 ++ * pending encrypt operations
4111 ++ */
4112 + WRITE_ONCE(ctx->async_notify, false);
4113 +
4114 + if (ctx->async_wait.err) {
4115 +@@ -1115,7 +1129,7 @@ send_end:
4116 +
4117 + release_sock(sk);
4118 + mutex_unlock(&tls_ctx->tx_lock);
4119 +- return copied ? copied : ret;
4120 ++ return copied > 0 ? copied : ret;
4121 + }
4122 +
4123 + static int tls_sw_do_sendpage(struct sock *sk, struct page *page,
4124 +@@ -1129,7 +1143,7 @@ static int tls_sw_do_sendpage(struct sock *sk, struct page *page,
4125 + struct sk_msg *msg_pl;
4126 + struct tls_rec *rec;
4127 + int num_async = 0;
4128 +- size_t copied = 0;
4129 ++ ssize_t copied = 0;
4130 + bool full_record;
4131 + int record_room;
4132 + int ret = 0;
4133 +@@ -1231,7 +1245,7 @@ wait_for_memory:
4134 + }
4135 + sendpage_end:
4136 + ret = sk_stream_error(sk, flags, ret);
4137 +- return copied ? copied : ret;
4138 ++ return copied > 0 ? copied : ret;
4139 + }
4140 +
4141 + int tls_sw_sendpage_locked(struct sock *sk, struct page *page,
4142 +@@ -1724,6 +1738,7 @@ int tls_sw_recvmsg(struct sock *sk,
4143 + bool is_kvec = iov_iter_is_kvec(&msg->msg_iter);
4144 + bool is_peek = flags & MSG_PEEK;
4145 + int num_async = 0;
4146 ++ int pending;
4147 +
4148 + flags |= nonblock;
4149 +
4150 +@@ -1886,8 +1901,11 @@ pick_next_record:
4151 + recv_end:
4152 + if (num_async) {
4153 + /* Wait for all previously submitted records to be decrypted */
4154 +- smp_store_mb(ctx->async_notify, true);
4155 +- if (atomic_read(&ctx->decrypt_pending)) {
4156 ++ spin_lock_bh(&ctx->decrypt_compl_lock);
4157 ++ ctx->async_notify = true;
4158 ++ pending = atomic_read(&ctx->decrypt_pending);
4159 ++ spin_unlock_bh(&ctx->decrypt_compl_lock);
4160 ++ if (pending) {
4161 + err = crypto_wait_req(-EINPROGRESS, &ctx->async_wait);
4162 + if (err) {
4163 + /* one of async decrypt failed */
4164 +@@ -1899,6 +1917,10 @@ recv_end:
4165 + } else {
4166 + reinit_completion(&ctx->async_wait.completion);
4167 + }
4168 ++
4169 ++ /* There can be no concurrent accesses, since we have no
4170 ++ * pending decrypt operations
4171 ++ */
4172 + WRITE_ONCE(ctx->async_notify, false);
4173 +
4174 + /* Drain records from the rx_list & copy if required */
4175 +@@ -2285,6 +2307,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
4176 +
4177 + if (tx) {
4178 + crypto_init_wait(&sw_ctx_tx->async_wait);
4179 ++ spin_lock_init(&sw_ctx_tx->encrypt_compl_lock);
4180 + crypto_info = &ctx->crypto_send.info;
4181 + cctx = &ctx->tx;
4182 + aead = &sw_ctx_tx->aead_send;
4183 +@@ -2293,6 +2316,7 @@ int tls_set_sw_offload(struct sock *sk, struct tls_context *ctx, int tx)
4184 + sw_ctx_tx->tx_work.sk = sk;
4185 + } else {
4186 + crypto_init_wait(&sw_ctx_rx->async_wait);
4187 ++ spin_lock_init(&sw_ctx_rx->decrypt_compl_lock);
4188 + crypto_info = &ctx->crypto_recv.info;
4189 + cctx = &ctx->rx;
4190 + skb_queue_head_init(&sw_ctx_rx->rx_list);
4191 +diff --git a/net/wireless/core.c b/net/wireless/core.c
4192 +index 3e25229a059d..ee5bb8d8af04 100644
4193 +--- a/net/wireless/core.c
4194 ++++ b/net/wireless/core.c
4195 +@@ -142,7 +142,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
4196 + if (result)
4197 + return result;
4198 +
4199 +- if (rdev->wiphy.debugfsdir)
4200 ++ if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
4201 + debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
4202 + rdev->wiphy.debugfsdir,
4203 + rdev->wiphy.debugfsdir->d_parent, newname);
4204 +diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
4205 +index c5dba371a765..993f14acbb9f 100644
4206 +--- a/net/xdp/xdp_umem.c
4207 ++++ b/net/xdp/xdp_umem.c
4208 +@@ -341,8 +341,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
4209 + {
4210 + bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
4211 + u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
4212 ++ u64 npgs, addr = mr->addr, size = mr->len;
4213 + unsigned int chunks, chunks_per_page;
4214 +- u64 addr = mr->addr, size = mr->len;
4215 + int err;
4216 +
4217 + if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
4218 +@@ -372,6 +372,10 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
4219 + if ((addr + size) < addr)
4220 + return -EINVAL;
4221 +
4222 ++ npgs = div_u64(size, PAGE_SIZE);
4223 ++ if (npgs > U32_MAX)
4224 ++ return -EINVAL;
4225 ++
4226 + chunks = (unsigned int)div_u64(size, chunk_size);
4227 + if (chunks == 0)
4228 + return -EINVAL;
4229 +@@ -391,7 +395,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
4230 + umem->size = size;
4231 + umem->headroom = headroom;
4232 + umem->chunk_size_nohr = chunk_size - headroom;
4233 +- umem->npgs = size / PAGE_SIZE;
4234 ++ umem->npgs = (u32)npgs;
4235 + umem->pgs = NULL;
4236 + umem->user = NULL;
4237 + umem->flags = mr->flags;
4238 +diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
4239 +index 64486ad81341..c365b918be35 100644
4240 +--- a/net/xfrm/xfrm_device.c
4241 ++++ b/net/xfrm/xfrm_device.c
4242 +@@ -25,12 +25,10 @@ static void __xfrm_transport_prep(struct xfrm_state *x, struct sk_buff *skb,
4243 + struct xfrm_offload *xo = xfrm_offload(skb);
4244 +
4245 + skb_reset_mac_len(skb);
4246 +- pskb_pull(skb, skb->mac_len + hsize + x->props.header_len);
4247 +-
4248 +- if (xo->flags & XFRM_GSO_SEGMENT) {
4249 +- skb_reset_transport_header(skb);
4250 ++ if (xo->flags & XFRM_GSO_SEGMENT)
4251 + skb->transport_header -= x->props.header_len;
4252 +- }
4253 ++
4254 ++ pskb_pull(skb, skb_transport_offset(skb) + x->props.header_len);
4255 + }
4256 +
4257 + static void __xfrm_mode_tunnel_prep(struct xfrm_state *x, struct sk_buff *skb,
4258 +diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
4259 +index 2c86a2fc3915..7a8474547791 100644
4260 +--- a/net/xfrm/xfrm_input.c
4261 ++++ b/net/xfrm/xfrm_input.c
4262 +@@ -643,7 +643,7 @@ resume:
4263 + dev_put(skb->dev);
4264 +
4265 + spin_lock(&x->lock);
4266 +- if (nexthdr <= 0) {
4267 ++ if (nexthdr < 0) {
4268 + if (nexthdr == -EBADMSG) {
4269 + xfrm_audit_state_icvfail(x, skb,
4270 + x->type->proto);
4271 +diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c
4272 +index 4d5627e274fe..0ab2b35c95de 100644
4273 +--- a/net/xfrm/xfrm_interface.c
4274 ++++ b/net/xfrm/xfrm_interface.c
4275 +@@ -772,7 +772,28 @@ static void __net_exit xfrmi_exit_net(struct net *net)
4276 + rtnl_unlock();
4277 + }
4278 +
4279 ++static void __net_exit xfrmi_exit_batch_net(struct list_head *net_exit_list)
4280 ++{
4281 ++ struct net *net;
4282 ++ LIST_HEAD(list);
4283 ++
4284 ++ rtnl_lock();
4285 ++ list_for_each_entry(net, net_exit_list, exit_list) {
4286 ++ struct xfrmi_net *xfrmn = net_generic(net, xfrmi_net_id);
4287 ++ struct xfrm_if __rcu **xip;
4288 ++ struct xfrm_if *xi;
4289 ++
4290 ++ for (xip = &xfrmn->xfrmi[0];
4291 ++ (xi = rtnl_dereference(*xip)) != NULL;
4292 ++ xip = &xi->next)
4293 ++ unregister_netdevice_queue(xi->dev, &list);
4294 ++ }
4295 ++ unregister_netdevice_many(&list);
4296 ++ rtnl_unlock();
4297 ++}
4298 ++
4299 + static struct pernet_operations xfrmi_net_ops = {
4300 ++ .exit_batch = xfrmi_exit_batch_net,
4301 + .exit = xfrmi_exit_net,
4302 + .id = &xfrmi_net_id,
4303 + .size = sizeof(struct xfrmi_net),
4304 +diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
4305 +index b1db55b50ba1..9a6a8c4008ab 100644
4306 +--- a/net/xfrm/xfrm_output.c
4307 ++++ b/net/xfrm/xfrm_output.c
4308 +@@ -586,18 +586,20 @@ int xfrm_output(struct sock *sk, struct sk_buff *skb)
4309 + xfrm_state_hold(x);
4310 +
4311 + if (skb_is_gso(skb)) {
4312 +- skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
4313 ++ if (skb->inner_protocol)
4314 ++ return xfrm_output_gso(net, sk, skb);
4315 +
4316 +- return xfrm_output2(net, sk, skb);
4317 ++ skb_shinfo(skb)->gso_type |= SKB_GSO_ESP;
4318 ++ goto out;
4319 + }
4320 +
4321 + if (x->xso.dev && x->xso.dev->features & NETIF_F_HW_ESP_TX_CSUM)
4322 + goto out;
4323 ++ } else {
4324 ++ if (skb_is_gso(skb))
4325 ++ return xfrm_output_gso(net, sk, skb);
4326 + }
4327 +
4328 +- if (skb_is_gso(skb))
4329 +- return xfrm_output_gso(net, sk, skb);
4330 +-
4331 + if (skb->ip_summed == CHECKSUM_PARTIAL) {
4332 + err = skb_checksum_help(skb);
4333 + if (err) {
4334 +@@ -643,7 +645,8 @@ void xfrm_local_error(struct sk_buff *skb, int mtu)
4335 +
4336 + if (skb->protocol == htons(ETH_P_IP))
4337 + proto = AF_INET;
4338 +- else if (skb->protocol == htons(ETH_P_IPV6))
4339 ++ else if (skb->protocol == htons(ETH_P_IPV6) &&
4340 ++ skb->sk->sk_family == AF_INET6)
4341 + proto = AF_INET6;
4342 + else
4343 + return;
4344 +diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
4345 +index 264cf05a4eaa..6a1a21ae47bb 100644
4346 +--- a/net/xfrm/xfrm_policy.c
4347 ++++ b/net/xfrm/xfrm_policy.c
4348 +@@ -1433,12 +1433,7 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
4349 + static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
4350 + struct xfrm_policy *pol)
4351 + {
4352 +- u32 mark = policy->mark.v & policy->mark.m;
4353 +-
4354 +- if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
4355 +- return true;
4356 +-
4357 +- if ((mark & pol->mark.m) == pol->mark.v &&
4358 ++ if (policy->mark.v == pol->mark.v &&
4359 + policy->priority == pol->priority)
4360 + return true;
4361 +
4362 +diff --git a/samples/bpf/lwt_len_hist_user.c b/samples/bpf/lwt_len_hist_user.c
4363 +index 587b68b1f8dd..430a4b7e353e 100644
4364 +--- a/samples/bpf/lwt_len_hist_user.c
4365 ++++ b/samples/bpf/lwt_len_hist_user.c
4366 +@@ -15,8 +15,6 @@
4367 + #define MAX_INDEX 64
4368 + #define MAX_STARS 38
4369 +
4370 +-char bpf_log_buf[BPF_LOG_BUF_SIZE];
4371 +-
4372 + static void stars(char *str, long val, long max, int width)
4373 + {
4374 + int i;
4375 +diff --git a/security/commoncap.c b/security/commoncap.c
4376 +index f4ee0ae106b2..0ca31c8bc0b1 100644
4377 +--- a/security/commoncap.c
4378 ++++ b/security/commoncap.c
4379 +@@ -812,6 +812,7 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
4380 + int ret;
4381 + kuid_t root_uid;
4382 +
4383 ++ new->cap_ambient = old->cap_ambient;
4384 + if (WARN_ON(!cap_ambient_invariant_ok(old)))
4385 + return -EPERM;
4386 +
4387 +diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
4388 +index 00cb5aed10a9..28bec15b0959 100644
4389 +--- a/sound/core/hwdep.c
4390 ++++ b/sound/core/hwdep.c
4391 +@@ -216,12 +216,12 @@ static int snd_hwdep_dsp_load(struct snd_hwdep *hw,
4392 + if (info.index >= 32)
4393 + return -EINVAL;
4394 + /* check whether the dsp was already loaded */
4395 +- if (hw->dsp_loaded & (1 << info.index))
4396 ++ if (hw->dsp_loaded & (1u << info.index))
4397 + return -EBUSY;
4398 + err = hw->ops.dsp_load(hw, &info);
4399 + if (err < 0)
4400 + return err;
4401 +- hw->dsp_loaded |= (1 << info.index);
4402 ++ hw->dsp_loaded |= (1u << info.index);
4403 + return 0;
4404 + }
4405 +
4406 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
4407 +index c5bec191e003..da4d21445e80 100644
4408 +--- a/sound/pci/hda/patch_realtek.c
4409 ++++ b/sound/pci/hda/patch_realtek.c
4410 +@@ -384,6 +384,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
4411 + case 0x10ec0282:
4412 + case 0x10ec0283:
4413 + case 0x10ec0286:
4414 ++ case 0x10ec0287:
4415 + case 0x10ec0288:
4416 + case 0x10ec0285:
4417 + case 0x10ec0298:
4418 +@@ -5484,18 +5485,9 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4419 + { 0x19, 0x21a11010 }, /* dock mic */
4420 + { }
4421 + };
4422 +- /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
4423 +- * the speaker output becomes too low by some reason on Thinkpads with
4424 +- * ALC298 codec
4425 +- */
4426 +- static const hda_nid_t preferred_pairs[] = {
4427 +- 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
4428 +- 0
4429 +- };
4430 + struct alc_spec *spec = codec->spec;
4431 +
4432 + if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4433 +- spec->gen.preferred_dacs = preferred_pairs;
4434 + spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4435 + snd_hda_apply_pincfgs(codec, pincfgs);
4436 + } else if (action == HDA_FIXUP_ACT_INIT) {
4437 +@@ -5508,6 +5500,23 @@ static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4438 + }
4439 + }
4440 +
4441 ++static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
4442 ++ const struct hda_fixup *fix, int action)
4443 ++{
4444 ++ /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
4445 ++ * the speaker output becomes too low by some reason on Thinkpads with
4446 ++ * ALC298 codec
4447 ++ */
4448 ++ static const hda_nid_t preferred_pairs[] = {
4449 ++ 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
4450 ++ 0
4451 ++ };
4452 ++ struct alc_spec *spec = codec->spec;
4453 ++
4454 ++ if (action == HDA_FIXUP_ACT_PRE_PROBE)
4455 ++ spec->gen.preferred_dacs = preferred_pairs;
4456 ++}
4457 ++
4458 + static void alc_shutup_dell_xps13(struct hda_codec *codec)
4459 + {
4460 + struct alc_spec *spec = codec->spec;
4461 +@@ -6063,6 +6072,7 @@ enum {
4462 + ALC700_FIXUP_INTEL_REFERENCE,
4463 + ALC274_FIXUP_DELL_BIND_DACS,
4464 + ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
4465 ++ ALC298_FIXUP_TPT470_DOCK_FIX,
4466 + ALC298_FIXUP_TPT470_DOCK,
4467 + ALC255_FIXUP_DUMMY_LINEOUT_VERB,
4468 + ALC255_FIXUP_DELL_HEADSET_MIC,
4469 +@@ -6994,12 +7004,18 @@ static const struct hda_fixup alc269_fixups[] = {
4470 + .chained = true,
4471 + .chain_id = ALC274_FIXUP_DELL_BIND_DACS
4472 + },
4473 +- [ALC298_FIXUP_TPT470_DOCK] = {
4474 ++ [ALC298_FIXUP_TPT470_DOCK_FIX] = {
4475 + .type = HDA_FIXUP_FUNC,
4476 + .v.func = alc_fixup_tpt470_dock,
4477 + .chained = true,
4478 + .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
4479 + },
4480 ++ [ALC298_FIXUP_TPT470_DOCK] = {
4481 ++ .type = HDA_FIXUP_FUNC,
4482 ++ .v.func = alc_fixup_tpt470_dacs,
4483 ++ .chained = true,
4484 ++ .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
4485 ++ },
4486 + [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
4487 + .type = HDA_FIXUP_PINS,
4488 + .v.pins = (const struct hda_pintbl[]) {
4489 +@@ -7638,6 +7654,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
4490 + {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
4491 + {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
4492 + {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
4493 ++ {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
4494 + {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
4495 + {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
4496 + {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
4497 +@@ -8305,6 +8322,7 @@ static int patch_alc269(struct hda_codec *codec)
4498 + case 0x10ec0215:
4499 + case 0x10ec0245:
4500 + case 0x10ec0285:
4501 ++ case 0x10ec0287:
4502 + case 0x10ec0289:
4503 + spec->codec_variant = ALC269_TYPE_ALC215;
4504 + spec->shutup = alc225_shutup;
4505 +@@ -9583,6 +9601,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
4506 + HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
4507 + HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
4508 + HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
4509 ++ HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
4510 + HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
4511 + HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
4512 + HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
4513 +diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
4514 +index 583edacc9fe8..f55afe3a98e3 100644
4515 +--- a/sound/usb/mixer.c
4516 ++++ b/sound/usb/mixer.c
4517 +@@ -1171,6 +1171,14 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
4518 + cval->res = 384;
4519 + }
4520 + break;
4521 ++ case USB_ID(0x0495, 0x3042): /* ESS Technology Asus USB DAC */
4522 ++ if ((strstr(kctl->id.name, "Playback Volume") != NULL) ||
4523 ++ strstr(kctl->id.name, "Capture Volume") != NULL) {
4524 ++ cval->min >>= 8;
4525 ++ cval->max = 0;
4526 ++ cval->res = 1;
4527 ++ }
4528 ++ break;
4529 + }
4530 + }
4531 +
4532 +diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
4533 +index 39d6c6fa5e33..ac84f0b2b0bc 100644
4534 +--- a/sound/usb/mixer_maps.c
4535 ++++ b/sound/usb/mixer_maps.c
4536 +@@ -387,6 +387,21 @@ static const struct usbmix_connector_map trx40_mobo_connector_map[] = {
4537 + {}
4538 + };
4539 +
4540 ++/* Rear panel + front mic on Gigabyte TRX40 Aorus Master with ALC1220-VB */
4541 ++static const struct usbmix_name_map aorus_master_alc1220vb_map[] = {
4542 ++ { 17, NULL }, /* OT, IEC958?, disabled */
4543 ++ { 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */
4544 ++ { 16, "Line Out" }, /* OT */
4545 ++ { 22, "Line Out Playback" }, /* FU */
4546 ++ { 7, "Line" }, /* IT */
4547 ++ { 19, "Line Capture" }, /* FU */
4548 ++ { 8, "Mic" }, /* IT */
4549 ++ { 20, "Mic Capture" }, /* FU */
4550 ++ { 9, "Front Mic" }, /* IT */
4551 ++ { 21, "Front Mic Capture" }, /* FU */
4552 ++ {}
4553 ++};
4554 ++
4555 + /*
4556 + * Control map entries
4557 + */
4558 +@@ -506,6 +521,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
4559 + .id = USB_ID(0x05a7, 0x1020),
4560 + .map = bose_companion5_map,
4561 + },
4562 ++ { /* Gigabyte TRX40 Aorus Master (rear panel + front mic) */
4563 ++ .id = USB_ID(0x0414, 0xa001),
4564 ++ .map = aorus_master_alc1220vb_map,
4565 ++ },
4566 + { /* Gigabyte TRX40 Aorus Pro WiFi */
4567 + .id = USB_ID(0x0414, 0xa002),
4568 + .map = trx40_mobo_map,
4569 +@@ -529,6 +548,11 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
4570 + .map = trx40_mobo_map,
4571 + .connector_map = trx40_mobo_connector_map,
4572 + },
4573 ++ { /* Asrock TRX40 Creator */
4574 ++ .id = USB_ID(0x26ce, 0x0a01),
4575 ++ .map = trx40_mobo_map,
4576 ++ .connector_map = trx40_mobo_connector_map,
4577 ++ },
4578 + { 0 } /* terminator */
4579 + };
4580 +
4581 +diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
4582 +index 8c2f5c23e1b4..bbae11605a4c 100644
4583 +--- a/sound/usb/quirks-table.h
4584 ++++ b/sound/usb/quirks-table.h
4585 +@@ -3647,6 +3647,32 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
4586 + ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
4587 + ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
4588 + ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
4589 ++ALC1220_VB_DESKTOP(0x26ce, 0x0a01), /* Asrock TRX40 Creator */
4590 + #undef ALC1220_VB_DESKTOP
4591 +
4592 ++/* Two entries for Gigabyte TRX40 Aorus Master:
4593 ++ * TRX40 Aorus Master has two USB-audio devices, one for the front headphone
4594 ++ * with ESS SABRE9218 DAC chip, while another for the rest I/O (the rear
4595 ++ * panel and the front mic) with Realtek ALC1220-VB.
4596 ++ * Here we provide two distinct names for making UCM profiles easier.
4597 ++ */
4598 ++{
4599 ++ USB_DEVICE(0x0414, 0xa000),
4600 ++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
4601 ++ .vendor_name = "Gigabyte",
4602 ++ .product_name = "Aorus Master Front Headphone",
4603 ++ .profile_name = "Gigabyte-Aorus-Master-Front-Headphone",
4604 ++ .ifnum = QUIRK_NO_INTERFACE
4605 ++ }
4606 ++},
4607 ++{
4608 ++ USB_DEVICE(0x0414, 0xa001),
4609 ++ .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
4610 ++ .vendor_name = "Gigabyte",
4611 ++ .product_name = "Aorus Master Main Audio",
4612 ++ .profile_name = "Gigabyte-Aorus-Master-Main-Audio",
4613 ++ .ifnum = QUIRK_NO_INTERFACE
4614 ++ }
4615 ++},
4616 ++
4617 + #undef USB_DEVICE_VENDOR_SPEC
4618 +diff --git a/tools/arch/x86/include/uapi/asm/unistd.h b/tools/arch/x86/include/uapi/asm/unistd.h
4619 +index 196fdd02b8b1..30d7d04d72d6 100644
4620 +--- a/tools/arch/x86/include/uapi/asm/unistd.h
4621 ++++ b/tools/arch/x86/include/uapi/asm/unistd.h
4622 +@@ -3,7 +3,7 @@
4623 + #define _UAPI_ASM_X86_UNISTD_H
4624 +
4625 + /* x32 syscall flag bit */
4626 +-#define __X32_SYSCALL_BIT 0x40000000UL
4627 ++#define __X32_SYSCALL_BIT 0x40000000
4628 +
4629 + #ifndef __KERNEL__
4630 + # ifdef __i386__
4631 +diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
4632 +index 6ccf6f6d09df..5b7d6c16d33f 100644
4633 +--- a/tools/perf/util/srcline.c
4634 ++++ b/tools/perf/util/srcline.c
4635 +@@ -193,16 +193,30 @@ static void find_address_in_section(bfd *abfd, asection *section, void *data)
4636 + bfd_vma pc, vma;
4637 + bfd_size_type size;
4638 + struct a2l_data *a2l = data;
4639 ++ flagword flags;
4640 +
4641 + if (a2l->found)
4642 + return;
4643 +
4644 +- if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
4645 ++#ifdef bfd_get_section_flags
4646 ++ flags = bfd_get_section_flags(abfd, section);
4647 ++#else
4648 ++ flags = bfd_section_flags(section);
4649 ++#endif
4650 ++ if ((flags & SEC_ALLOC) == 0)
4651 + return;
4652 +
4653 + pc = a2l->addr;
4654 ++#ifdef bfd_get_section_vma
4655 + vma = bfd_get_section_vma(abfd, section);
4656 ++#else
4657 ++ vma = bfd_section_vma(section);
4658 ++#endif
4659 ++#ifdef bfd_get_section_size
4660 + size = bfd_get_section_size(section);
4661 ++#else
4662 ++ size = bfd_section_size(section);
4663 ++#endif
4664 +
4665 + if (pc < vma || pc >= vma + size)
4666 + return;