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