Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Sat, 21 Sep 2019 17:12:10
Message-Id: 1569085889.66eff6029f38be9ed1d7319d914910c1c07101a0.mpagano@gentoo
1 commit: 66eff6029f38be9ed1d7319d914910c1c07101a0
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 21 17:11:29 2019 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 21 17:11:29 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=66eff602
7
8 Linux patch 4.19.75
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1074_linux-4.19.75.patch | 2496 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2500 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 7734d78..050c323 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -335,6 +335,10 @@ Patch: 1073_linux-4.19.74.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.74
23
24 +Patch: 1074_linux-4.19.75.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.75
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1074_linux-4.19.75.patch b/1074_linux-4.19.75.patch
33 new file mode 100644
34 index 0000000..e01e663
35 --- /dev/null
36 +++ b/1074_linux-4.19.75.patch
37 @@ -0,0 +1,2496 @@
38 +diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt
39 +index eef7d9d259e8..d7dc9c818b83 100644
40 +--- a/Documentation/filesystems/overlayfs.txt
41 ++++ b/Documentation/filesystems/overlayfs.txt
42 +@@ -302,7 +302,7 @@ beneath or above the path of another overlay lower layer path.
43 +
44 + Using an upper layer path and/or a workdir path that are already used by
45 + another overlay mount is not allowed and may fail with EBUSY. Using
46 +-partially overlapping paths is not allowed but will not fail with EBUSY.
47 ++partially overlapping paths is not allowed and may fail with EBUSY.
48 + If files are accessed from two overlayfs mounts which share or overlap the
49 + upper layer and/or workdir path the behavior of the overlay is undefined,
50 + though it will not result in a crash or deadlock.
51 +diff --git a/Makefile b/Makefile
52 +index 3509e0c6e5ae..4bf6f24916bf 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,7 +1,7 @@
56 + # SPDX-License-Identifier: GPL-2.0
57 + VERSION = 4
58 + PATCHLEVEL = 19
59 +-SUBLEVEL = 74
60 ++SUBLEVEL = 75
61 + EXTRAVERSION =
62 + NAME = "People's Front"
63 +
64 +diff --git a/arch/arm/boot/dts/am571x-idk.dts b/arch/arm/boot/dts/am571x-idk.dts
65 +index d9a2049a1ea8..6bebedfc0f35 100644
66 +--- a/arch/arm/boot/dts/am571x-idk.dts
67 ++++ b/arch/arm/boot/dts/am571x-idk.dts
68 +@@ -98,14 +98,9 @@
69 + };
70 +
71 + &mmc1 {
72 +- pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104";
73 ++ pinctrl-names = "default", "hs";
74 + pinctrl-0 = <&mmc1_pins_default_no_clk_pu>;
75 + pinctrl-1 = <&mmc1_pins_hs>;
76 +- pinctrl-2 = <&mmc1_pins_sdr12>;
77 +- pinctrl-3 = <&mmc1_pins_sdr25>;
78 +- pinctrl-4 = <&mmc1_pins_sdr50>;
79 +- pinctrl-5 = <&mmc1_pins_ddr50_rev20 &mmc1_iodelay_ddr50_conf>;
80 +- pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>;
81 + };
82 +
83 + &mmc2 {
84 +diff --git a/arch/arm/boot/dts/am572x-idk.dts b/arch/arm/boot/dts/am572x-idk.dts
85 +index 3ef9111d0e8b..9235173edbd3 100644
86 +--- a/arch/arm/boot/dts/am572x-idk.dts
87 ++++ b/arch/arm/boot/dts/am572x-idk.dts
88 +@@ -20,14 +20,9 @@
89 + };
90 +
91 + &mmc1 {
92 +- pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104";
93 ++ pinctrl-names = "default", "hs";
94 + pinctrl-0 = <&mmc1_pins_default_no_clk_pu>;
95 + pinctrl-1 = <&mmc1_pins_hs>;
96 +- pinctrl-2 = <&mmc1_pins_sdr12>;
97 +- pinctrl-3 = <&mmc1_pins_sdr25>;
98 +- pinctrl-4 = <&mmc1_pins_sdr50>;
99 +- pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev20_conf>;
100 +- pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>;
101 + };
102 +
103 + &mmc2 {
104 +diff --git a/arch/arm/boot/dts/am574x-idk.dts b/arch/arm/boot/dts/am574x-idk.dts
105 +index 378dfa780ac1..ae43de3297f4 100644
106 +--- a/arch/arm/boot/dts/am574x-idk.dts
107 ++++ b/arch/arm/boot/dts/am574x-idk.dts
108 +@@ -24,14 +24,9 @@
109 + };
110 +
111 + &mmc1 {
112 +- pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104";
113 ++ pinctrl-names = "default", "hs";
114 + pinctrl-0 = <&mmc1_pins_default_no_clk_pu>;
115 + pinctrl-1 = <&mmc1_pins_hs>;
116 +- pinctrl-2 = <&mmc1_pins_default>;
117 +- pinctrl-3 = <&mmc1_pins_hs>;
118 +- pinctrl-4 = <&mmc1_pins_sdr50>;
119 +- pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_conf>;
120 +- pinctrl-6 = <&mmc1_pins_ddr50 &mmc1_iodelay_sdr104_conf>;
121 + };
122 +
123 + &mmc2 {
124 +diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
125 +index ad953113cefb..d53532b47947 100644
126 +--- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
127 ++++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
128 +@@ -433,6 +433,7 @@
129 +
130 + bus-width = <4>;
131 + cd-gpios = <&gpio6 27 GPIO_ACTIVE_LOW>; /* gpio 219 */
132 ++ no-1-8-v;
133 + };
134 +
135 + &mmc2 {
136 +diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts b/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts
137 +index 5a77b334923d..34c69965821b 100644
138 +--- a/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts
139 ++++ b/arch/arm/boot/dts/am57xx-beagle-x15-revb1.dts
140 +@@ -19,14 +19,9 @@
141 + };
142 +
143 + &mmc1 {
144 +- pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104";
145 ++ pinctrl-names = "default", "hs";
146 + pinctrl-0 = <&mmc1_pins_default>;
147 + pinctrl-1 = <&mmc1_pins_hs>;
148 +- pinctrl-2 = <&mmc1_pins_sdr12>;
149 +- pinctrl-3 = <&mmc1_pins_sdr25>;
150 +- pinctrl-4 = <&mmc1_pins_sdr50>;
151 +- pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev11_conf>;
152 +- pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev11_conf>;
153 + vmmc-supply = <&vdd_3v3>;
154 + vqmmc-supply = <&ldo1_reg>;
155 + };
156 +diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts b/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts
157 +index 17c41da3b55f..ccd99160bbdf 100644
158 +--- a/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts
159 ++++ b/arch/arm/boot/dts/am57xx-beagle-x15-revc.dts
160 +@@ -19,14 +19,9 @@
161 + };
162 +
163 + &mmc1 {
164 +- pinctrl-names = "default", "hs", "sdr12", "sdr25", "sdr50", "ddr50", "sdr104";
165 ++ pinctrl-names = "default", "hs";
166 + pinctrl-0 = <&mmc1_pins_default>;
167 + pinctrl-1 = <&mmc1_pins_hs>;
168 +- pinctrl-2 = <&mmc1_pins_sdr12>;
169 +- pinctrl-3 = <&mmc1_pins_sdr25>;
170 +- pinctrl-4 = <&mmc1_pins_sdr50>;
171 +- pinctrl-5 = <&mmc1_pins_ddr50 &mmc1_iodelay_ddr_rev20_conf>;
172 +- pinctrl-6 = <&mmc1_pins_sdr104 &mmc1_iodelay_sdr104_rev20_conf>;
173 + vmmc-supply = <&vdd_3v3>;
174 + vqmmc-supply = <&ldo1_reg>;
175 + };
176 +diff --git a/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi b/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi
177 +index 28ebb4eb884a..214b9e6de2c3 100644
178 +--- a/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi
179 ++++ b/arch/arm/boot/dts/dra74x-mmc-iodelay.dtsi
180 +@@ -32,7 +32,7 @@
181 + *
182 + * Datamanual Revisions:
183 + *
184 +- * AM572x Silicon Revision 2.0: SPRS953B, Revised November 2016
185 ++ * AM572x Silicon Revision 2.0: SPRS953F, Revised May 2019
186 + * AM572x Silicon Revision 1.1: SPRS915R, Revised November 2016
187 + *
188 + */
189 +@@ -229,45 +229,45 @@
190 +
191 + mmc3_pins_default: mmc3_pins_default {
192 + pinctrl-single,pins = <
193 +- DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
194 +- DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
195 +- DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
196 +- DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
197 +- DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
198 +- DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
199 ++ DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
200 ++ DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
201 ++ DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
202 ++ DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
203 ++ DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
204 ++ DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
205 + >;
206 + };
207 +
208 + mmc3_pins_hs: mmc3_pins_hs {
209 + pinctrl-single,pins = <
210 +- DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
211 +- DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
212 +- DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
213 +- DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
214 +- DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
215 +- DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
216 ++ DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
217 ++ DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
218 ++ DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
219 ++ DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
220 ++ DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
221 ++ DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
222 + >;
223 + };
224 +
225 + mmc3_pins_sdr12: mmc3_pins_sdr12 {
226 + pinctrl-single,pins = <
227 +- DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
228 +- DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
229 +- DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
230 +- DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
231 +- DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
232 +- DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
233 ++ DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
234 ++ DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
235 ++ DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
236 ++ DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
237 ++ DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
238 ++ DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
239 + >;
240 + };
241 +
242 + mmc3_pins_sdr25: mmc3_pins_sdr25 {
243 + pinctrl-single,pins = <
244 +- DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
245 +- DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
246 +- DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
247 +- DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
248 +- DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
249 +- DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
250 ++ DRA7XX_CORE_IOPAD(0x377c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_clk.mmc3_clk */
251 ++ DRA7XX_CORE_IOPAD(0x3780, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_cmd.mmc3_cmd */
252 ++ DRA7XX_CORE_IOPAD(0x3784, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat0.mmc3_dat0 */
253 ++ DRA7XX_CORE_IOPAD(0x3788, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat1.mmc3_dat1 */
254 ++ DRA7XX_CORE_IOPAD(0x378c, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat2.mmc3_dat2 */
255 ++ DRA7XX_CORE_IOPAD(0x3790, (PIN_INPUT_PULLUP | MODE_SELECT | MUX_MODE0)) /* mmc3_dat3.mmc3_dat3 */
256 + >;
257 + };
258 +
259 +diff --git a/arch/arm/mach-omap1/ams-delta-fiq-handler.S b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
260 +index ddc27638ba2a..017c792be0a0 100644
261 +--- a/arch/arm/mach-omap1/ams-delta-fiq-handler.S
262 ++++ b/arch/arm/mach-omap1/ams-delta-fiq-handler.S
263 +@@ -135,6 +135,8 @@ restart:
264 + orr r11, r11, r13 @ mask all requested interrupts
265 + str r11, [r12, #OMAP1510_GPIO_INT_MASK]
266 +
267 ++ str r13, [r12, #OMAP1510_GPIO_INT_STATUS] @ ack all requested interrupts
268 ++
269 + ands r10, r13, #KEYBRD_CLK_MASK @ extract keyboard status - set?
270 + beq hksw @ no - try next source
271 +
272 +@@ -142,7 +144,6 @@ restart:
273 + @@@@@@@@@@@@@@@@@@@@@@
274 + @ Keyboard clock FIQ mode interrupt handler
275 + @ r10 now contains KEYBRD_CLK_MASK, use it
276 +- str r10, [r12, #OMAP1510_GPIO_INT_STATUS] @ ack the interrupt
277 + bic r11, r11, r10 @ unmask it
278 + str r11, [r12, #OMAP1510_GPIO_INT_MASK]
279 +
280 +diff --git a/arch/arm/mach-omap1/ams-delta-fiq.c b/arch/arm/mach-omap1/ams-delta-fiq.c
281 +index b0dc7ddf5877..b8ba763fe108 100644
282 +--- a/arch/arm/mach-omap1/ams-delta-fiq.c
283 ++++ b/arch/arm/mach-omap1/ams-delta-fiq.c
284 +@@ -73,9 +73,7 @@ static irqreturn_t deferred_fiq(int irq, void *dev_id)
285 + * interrupts default to since commit 80ac93c27441
286 + * requires interrupt already acked and unmasked.
287 + */
288 +- if (irq_chip->irq_ack)
289 +- irq_chip->irq_ack(d);
290 +- if (irq_chip->irq_unmask)
291 ++ if (!WARN_ON_ONCE(!irq_chip->irq_unmask))
292 + irq_chip->irq_unmask(d);
293 + }
294 + for (; irq_counter[gpio] < fiq_count; irq_counter[gpio]++)
295 +diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
296 +index b226c8aaf8b1..7074cfd1ff41 100644
297 +--- a/arch/arm/mach-omap2/omap4-common.c
298 ++++ b/arch/arm/mach-omap2/omap4-common.c
299 +@@ -131,6 +131,9 @@ static int __init omap4_sram_init(void)
300 + struct device_node *np;
301 + struct gen_pool *sram_pool;
302 +
303 ++ if (!soc_is_omap44xx() && !soc_is_omap54xx())
304 ++ return 0;
305 ++
306 + np = of_find_compatible_node(NULL, NULL, "ti,omap4-mpu");
307 + if (!np)
308 + pr_warn("%s:Unable to allocate sram needed to handle errata I688\n",
309 +diff --git a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
310 +index e6c7061a8e73..3547f32822b6 100644
311 +--- a/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
312 ++++ b/arch/arm/mach-omap2/omap_hwmod_7xx_data.c
313 +@@ -385,7 +385,8 @@ static struct omap_hwmod dra7xx_dcan2_hwmod = {
314 + static struct omap_hwmod_class_sysconfig dra7xx_epwmss_sysc = {
315 + .rev_offs = 0x0,
316 + .sysc_offs = 0x4,
317 +- .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET,
318 ++ .sysc_flags = SYSC_HAS_SIDLEMODE | SYSC_HAS_SOFTRESET |
319 ++ SYSC_HAS_RESET_STATUS,
320 + .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART),
321 + .sysc_fields = &omap_hwmod_sysc_type2,
322 + };
323 +diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
324 +index 0cc8e04295a4..e1d330a26921 100644
325 +--- a/arch/arm/mm/init.c
326 ++++ b/arch/arm/mm/init.c
327 +@@ -196,6 +196,11 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max_low,
328 + #ifdef CONFIG_HAVE_ARCH_PFN_VALID
329 + int pfn_valid(unsigned long pfn)
330 + {
331 ++ phys_addr_t addr = __pfn_to_phys(pfn);
332 ++
333 ++ if (__phys_to_pfn(addr) != pfn)
334 ++ return 0;
335 ++
336 + return memblock_is_map_memory(__pfn_to_phys(pfn));
337 + }
338 + EXPORT_SYMBOL(pfn_valid);
339 +@@ -713,7 +718,8 @@ static void update_sections_early(struct section_perm perms[], int n)
340 + if (t->flags & PF_KTHREAD)
341 + continue;
342 + for_each_thread(t, s)
343 +- set_section_perms(perms, n, true, s->mm);
344 ++ if (s->mm)
345 ++ set_section_perms(perms, n, true, s->mm);
346 + }
347 + set_section_perms(perms, n, true, current->active_mm);
348 + set_section_perms(perms, n, true, &init_mm);
349 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
350 +index 94babc3d0ec2..859d63cc99a3 100644
351 +--- a/arch/arm64/kernel/cpufeature.c
352 ++++ b/arch/arm64/kernel/cpufeature.c
353 +@@ -895,6 +895,12 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
354 + static const struct midr_range kpti_safe_list[] = {
355 + MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2),
356 + MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN),
357 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A35),
358 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A53),
359 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A55),
360 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A57),
361 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A72),
362 ++ MIDR_ALL_VERSIONS(MIDR_CORTEX_A73),
363 + { /* sentinel */ }
364 + };
365 + char const *str = "command line option";
366 +diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
367 +index c879979faa73..3ea4c1f107d7 100644
368 +--- a/arch/powerpc/mm/pgtable-radix.c
369 ++++ b/arch/powerpc/mm/pgtable-radix.c
370 +@@ -521,14 +521,6 @@ void __init radix__early_init_devtree(void)
371 + mmu_psize_defs[MMU_PAGE_64K].shift = 16;
372 + mmu_psize_defs[MMU_PAGE_64K].ap = 0x5;
373 + found:
374 +-#ifdef CONFIG_SPARSEMEM_VMEMMAP
375 +- if (mmu_psize_defs[MMU_PAGE_2M].shift) {
376 +- /*
377 +- * map vmemmap using 2M if available
378 +- */
379 +- mmu_vmemmap_psize = MMU_PAGE_2M;
380 +- }
381 +-#endif /* CONFIG_SPARSEMEM_VMEMMAP */
382 + return;
383 + }
384 +
385 +@@ -567,7 +559,13 @@ void __init radix__early_init_mmu(void)
386 +
387 + #ifdef CONFIG_SPARSEMEM_VMEMMAP
388 + /* vmemmap mapping */
389 +- mmu_vmemmap_psize = mmu_virtual_psize;
390 ++ if (mmu_psize_defs[MMU_PAGE_2M].shift) {
391 ++ /*
392 ++ * map vmemmap using 2M if available
393 ++ */
394 ++ mmu_vmemmap_psize = MMU_PAGE_2M;
395 ++ } else
396 ++ mmu_vmemmap_psize = mmu_virtual_psize;
397 + #endif
398 + /*
399 + * initialize page table size
400 +diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
401 +index d7052cbe984f..2617e426c792 100644
402 +--- a/arch/s390/net/bpf_jit_comp.c
403 ++++ b/arch/s390/net/bpf_jit_comp.c
404 +@@ -841,7 +841,7 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
405 + break;
406 + case BPF_ALU64 | BPF_NEG: /* dst = -dst */
407 + /* lcgr %dst,%dst */
408 +- EMIT4(0xb9130000, dst_reg, dst_reg);
409 ++ EMIT4(0xb9030000, dst_reg, dst_reg);
410 + break;
411 + /*
412 + * BPF_FROM_BE/LE
413 +@@ -1015,8 +1015,8 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
414 + /* llgf %w1,map.max_entries(%b2) */
415 + EMIT6_DISP_LH(0xe3000000, 0x0016, REG_W1, REG_0, BPF_REG_2,
416 + offsetof(struct bpf_array, map.max_entries));
417 +- /* clgrj %b3,%w1,0xa,label0: if %b3 >= %w1 goto out */
418 +- EMIT6_PCREL_LABEL(0xec000000, 0x0065, BPF_REG_3,
419 ++ /* clrj %b3,%w1,0xa,label0: if (u32)%b3 >= (u32)%w1 goto out */
420 ++ EMIT6_PCREL_LABEL(0xec000000, 0x0077, BPF_REG_3,
421 + REG_W1, 0, 0xa);
422 +
423 + /*
424 +@@ -1042,8 +1042,10 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
425 + * goto out;
426 + */
427 +
428 +- /* sllg %r1,%b3,3: %r1 = index * 8 */
429 +- EMIT6_DISP_LH(0xeb000000, 0x000d, REG_1, BPF_REG_3, REG_0, 3);
430 ++ /* llgfr %r1,%b3: %r1 = (u32) index */
431 ++ EMIT4(0xb9160000, REG_1, BPF_REG_3);
432 ++ /* sllg %r1,%r1,3: %r1 *= 8 */
433 ++ EMIT6_DISP_LH(0xeb000000, 0x000d, REG_1, REG_1, REG_0, 3);
434 + /* lg %r1,prog(%b2,%r1) */
435 + EMIT6_DISP_LH(0xe3000000, 0x0004, REG_1, BPF_REG_2,
436 + REG_1, offsetof(struct bpf_array, ptrs));
437 +diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
438 +index d50bb4dc0650..80c6d84cad67 100644
439 +--- a/arch/x86/events/amd/ibs.c
440 ++++ b/arch/x86/events/amd/ibs.c
441 +@@ -672,10 +672,17 @@ fail:
442 +
443 + throttle = perf_event_overflow(event, &data, &regs);
444 + out:
445 +- if (throttle)
446 ++ if (throttle) {
447 + perf_ibs_stop(event, 0);
448 +- else
449 +- perf_ibs_enable_event(perf_ibs, hwc, period >> 4);
450 ++ } else {
451 ++ period >>= 4;
452 ++
453 ++ if ((ibs_caps & IBS_CAPS_RDWROPCNT) &&
454 ++ (*config & IBS_OP_CNT_CTL))
455 ++ period |= *config & IBS_OP_CUR_CNT_RAND;
456 ++
457 ++ perf_ibs_enable_event(perf_ibs, hwc, period);
458 ++ }
459 +
460 + perf_event_update_userpage(event);
461 +
462 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
463 +index db5a2ba61753..2dd8b0d64295 100644
464 +--- a/arch/x86/events/intel/core.c
465 ++++ b/arch/x86/events/intel/core.c
466 +@@ -3319,6 +3319,11 @@ static u64 bdw_limit_period(struct perf_event *event, u64 left)
467 + return left;
468 + }
469 +
470 ++static u64 nhm_limit_period(struct perf_event *event, u64 left)
471 ++{
472 ++ return max(left, 32ULL);
473 ++}
474 ++
475 + PMU_FORMAT_ATTR(event, "config:0-7" );
476 + PMU_FORMAT_ATTR(umask, "config:8-15" );
477 + PMU_FORMAT_ATTR(edge, "config:18" );
478 +@@ -4115,6 +4120,7 @@ __init int intel_pmu_init(void)
479 + x86_pmu.pebs_constraints = intel_nehalem_pebs_event_constraints;
480 + x86_pmu.enable_all = intel_pmu_nhm_enable_all;
481 + x86_pmu.extra_regs = intel_nehalem_extra_regs;
482 ++ x86_pmu.limit_period = nhm_limit_period;
483 +
484 + x86_pmu.cpu_events = nhm_events_attrs;
485 +
486 +diff --git a/arch/x86/hyperv/mmu.c b/arch/x86/hyperv/mmu.c
487 +index ef5f29f913d7..2f34d5275352 100644
488 +--- a/arch/x86/hyperv/mmu.c
489 ++++ b/arch/x86/hyperv/mmu.c
490 +@@ -37,12 +37,14 @@ static inline int fill_gva_list(u64 gva_list[], int offset,
491 + * Lower 12 bits encode the number of additional
492 + * pages to flush (in addition to the 'cur' page).
493 + */
494 +- if (diff >= HV_TLB_FLUSH_UNIT)
495 ++ if (diff >= HV_TLB_FLUSH_UNIT) {
496 + gva_list[gva_n] |= ~PAGE_MASK;
497 +- else if (diff)
498 ++ cur += HV_TLB_FLUSH_UNIT;
499 ++ } else if (diff) {
500 + gva_list[gva_n] |= (diff - 1) >> PAGE_SHIFT;
501 ++ cur = end;
502 ++ }
503 +
504 +- cur += HV_TLB_FLUSH_UNIT;
505 + gva_n++;
506 +
507 + } while (cur < end);
508 +diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
509 +index 78241b736f2a..f6c4915a863e 100644
510 +--- a/arch/x86/include/asm/perf_event.h
511 ++++ b/arch/x86/include/asm/perf_event.h
512 +@@ -209,16 +209,20 @@ struct x86_pmu_capability {
513 + #define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
514 + #define IBSCTL_LVT_OFFSET_MASK 0x0F
515 +
516 +-/* ibs fetch bits/masks */
517 ++/* IBS fetch bits/masks */
518 + #define IBS_FETCH_RAND_EN (1ULL<<57)
519 + #define IBS_FETCH_VAL (1ULL<<49)
520 + #define IBS_FETCH_ENABLE (1ULL<<48)
521 + #define IBS_FETCH_CNT 0xFFFF0000ULL
522 + #define IBS_FETCH_MAX_CNT 0x0000FFFFULL
523 +
524 +-/* ibs op bits/masks */
525 +-/* lower 4 bits of the current count are ignored: */
526 +-#define IBS_OP_CUR_CNT (0xFFFF0ULL<<32)
527 ++/*
528 ++ * IBS op bits/masks
529 ++ * The lower 7 bits of the current count are random bits
530 ++ * preloaded by hardware and ignored in software
531 ++ */
532 ++#define IBS_OP_CUR_CNT (0xFFF80ULL<<32)
533 ++#define IBS_OP_CUR_CNT_RAND (0x0007FULL<<32)
534 + #define IBS_OP_CNT_CTL (1ULL<<19)
535 + #define IBS_OP_VAL (1ULL<<18)
536 + #define IBS_OP_ENABLE (1ULL<<17)
537 +diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
538 +index 4111edb3188e..971830341061 100644
539 +--- a/arch/x86/include/asm/uaccess.h
540 ++++ b/arch/x86/include/asm/uaccess.h
541 +@@ -451,8 +451,10 @@ do { \
542 + ({ \
543 + int __gu_err; \
544 + __inttype(*(ptr)) __gu_val; \
545 ++ __typeof__(ptr) __gu_ptr = (ptr); \
546 ++ __typeof__(size) __gu_size = (size); \
547 + __uaccess_begin_nospec(); \
548 +- __get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
549 ++ __get_user_size(__gu_val, __gu_ptr, __gu_size, __gu_err, -EFAULT); \
550 + __uaccess_end(); \
551 + (x) = (__force __typeof__(*(ptr)))__gu_val; \
552 + __builtin_expect(__gu_err, 0); \
553 +diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
554 +index 4077e309e5c4..ab22eded61d2 100644
555 +--- a/arch/x86/kernel/apic/io_apic.c
556 ++++ b/arch/x86/kernel/apic/io_apic.c
557 +@@ -2432,7 +2432,13 @@ unsigned int arch_dynirq_lower_bound(unsigned int from)
558 + * dmar_alloc_hwirq() may be called before setup_IO_APIC(), so use
559 + * gsi_top if ioapic_dynirq_base hasn't been initialized yet.
560 + */
561 +- return ioapic_initialized ? ioapic_dynirq_base : gsi_top;
562 ++ if (!ioapic_initialized)
563 ++ return gsi_top;
564 ++ /*
565 ++ * For DT enabled machines ioapic_dynirq_base is irrelevant and not
566 ++ * updated. So simply return @from if ioapic_dynirq_base == 0.
567 ++ */
568 ++ return ioapic_dynirq_base ? : from;
569 + }
570 +
571 + #ifdef CONFIG_X86_32
572 +diff --git a/drivers/atm/Kconfig b/drivers/atm/Kconfig
573 +index 2e2efa577437..8c37294f1d1e 100644
574 +--- a/drivers/atm/Kconfig
575 ++++ b/drivers/atm/Kconfig
576 +@@ -200,7 +200,7 @@ config ATM_NICSTAR_USE_SUNI
577 + make the card work).
578 +
579 + config ATM_NICSTAR_USE_IDT77105
580 +- bool "Use IDT77015 PHY driver (25Mbps)"
581 ++ bool "Use IDT77105 PHY driver (25Mbps)"
582 + depends on ATM_NICSTAR
583 + help
584 + Support for the PHYsical layer chip in ForeRunner LE25 cards. In
585 +diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
586 +index 4a9a4d12721a..e71589e244fb 100644
587 +--- a/drivers/block/floppy.c
588 ++++ b/drivers/block/floppy.c
589 +@@ -3791,7 +3791,7 @@ static int compat_getdrvprm(int drive,
590 + v.native_format = UDP->native_format;
591 + mutex_unlock(&floppy_mutex);
592 +
593 +- if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_params)))
594 ++ if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_params)))
595 + return -EFAULT;
596 + return 0;
597 + }
598 +@@ -3827,7 +3827,7 @@ static int compat_getdrvstat(int drive, bool poll,
599 + v.bufblocks = UDRS->bufblocks;
600 + mutex_unlock(&floppy_mutex);
601 +
602 +- if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_struct)))
603 ++ if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_struct)))
604 + return -EFAULT;
605 + return 0;
606 + Eintr:
607 +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
608 +index e4fe954e63a9..e95b26319cd9 100644
609 +--- a/drivers/bus/ti-sysc.c
610 ++++ b/drivers/bus/ti-sysc.c
611 +@@ -1022,10 +1022,7 @@ static int sysc_init_sysc_mask(struct sysc *ddata)
612 + if (error)
613 + return 0;
614 +
615 +- if (val)
616 +- ddata->cfg.sysc_val = val & ddata->cap->sysc_mask;
617 +- else
618 +- ddata->cfg.sysc_val = ddata->cap->sysc_mask;
619 ++ ddata->cfg.sysc_val = val & ddata->cap->sysc_mask;
620 +
621 + return 0;
622 + }
623 +@@ -1688,7 +1685,7 @@ static int sysc_probe(struct platform_device *pdev)
624 +
625 + error = sysc_init_dts_quirks(ddata);
626 + if (error)
627 +- goto unprepare;
628 ++ return error;
629 +
630 + error = sysc_get_clocks(ddata);
631 + if (error)
632 +@@ -1696,27 +1693,27 @@ static int sysc_probe(struct platform_device *pdev)
633 +
634 + error = sysc_map_and_check_registers(ddata);
635 + if (error)
636 +- goto unprepare;
637 ++ return error;
638 +
639 + error = sysc_init_sysc_mask(ddata);
640 + if (error)
641 +- goto unprepare;
642 ++ return error;
643 +
644 + error = sysc_init_idlemodes(ddata);
645 + if (error)
646 +- goto unprepare;
647 ++ return error;
648 +
649 + error = sysc_init_syss_mask(ddata);
650 + if (error)
651 +- goto unprepare;
652 ++ return error;
653 +
654 + error = sysc_init_pdata(ddata);
655 + if (error)
656 +- goto unprepare;
657 ++ return error;
658 +
659 + error = sysc_init_resets(ddata);
660 + if (error)
661 +- return error;
662 ++ goto unprepare;
663 +
664 + pm_runtime_enable(ddata->dev);
665 + error = sysc_init_module(ddata);
666 +diff --git a/drivers/dma/ti/dma-crossbar.c b/drivers/dma/ti/dma-crossbar.c
667 +index 9272b173c746..6574cb5a12fe 100644
668 +--- a/drivers/dma/ti/dma-crossbar.c
669 ++++ b/drivers/dma/ti/dma-crossbar.c
670 +@@ -395,8 +395,10 @@ static int ti_dra7_xbar_probe(struct platform_device *pdev)
671 +
672 + ret = of_property_read_u32_array(node, pname, (u32 *)rsv_events,
673 + nelm * 2);
674 +- if (ret)
675 ++ if (ret) {
676 ++ kfree(rsv_events);
677 + return ret;
678 ++ }
679 +
680 + for (i = 0; i < nelm; i++) {
681 + ti_dra7_xbar_reserve(rsv_events[i][0], rsv_events[i][1],
682 +diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
683 +index aeb9c29e5255..c192bdc30aae 100644
684 +--- a/drivers/dma/ti/omap-dma.c
685 ++++ b/drivers/dma/ti/omap-dma.c
686 +@@ -1543,8 +1543,10 @@ static int omap_dma_probe(struct platform_device *pdev)
687 +
688 + rc = devm_request_irq(&pdev->dev, irq, omap_dma_irq,
689 + IRQF_SHARED, "omap-dma-engine", od);
690 +- if (rc)
691 ++ if (rc) {
692 ++ omap_dma_free(od);
693 + return rc;
694 ++ }
695 + }
696 +
697 + if (omap_dma_glbl_read(od, CAPS_0) & CAPS_0_SUPPORT_LL123)
698 +diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
699 +index 1aa67bb5d8c0..ebd3ffc7ca00 100644
700 +--- a/drivers/firmware/google/vpd.c
701 ++++ b/drivers/firmware/google/vpd.c
702 +@@ -100,8 +100,8 @@ static int vpd_section_check_key_name(const u8 *key, s32 key_len)
703 + return VPD_OK;
704 + }
705 +
706 +-static int vpd_section_attrib_add(const u8 *key, s32 key_len,
707 +- const u8 *value, s32 value_len,
708 ++static int vpd_section_attrib_add(const u8 *key, u32 key_len,
709 ++ const u8 *value, u32 value_len,
710 + void *arg)
711 + {
712 + int ret;
713 +diff --git a/drivers/firmware/google/vpd_decode.c b/drivers/firmware/google/vpd_decode.c
714 +index 943acaa8aa76..e75abe9fa122 100644
715 +--- a/drivers/firmware/google/vpd_decode.c
716 ++++ b/drivers/firmware/google/vpd_decode.c
717 +@@ -19,8 +19,8 @@
718 +
719 + #include "vpd_decode.h"
720 +
721 +-static int vpd_decode_len(const s32 max_len, const u8 *in,
722 +- s32 *length, s32 *decoded_len)
723 ++static int vpd_decode_len(const u32 max_len, const u8 *in,
724 ++ u32 *length, u32 *decoded_len)
725 + {
726 + u8 more;
727 + int i = 0;
728 +@@ -40,18 +40,39 @@ static int vpd_decode_len(const s32 max_len, const u8 *in,
729 + } while (more);
730 +
731 + *decoded_len = i;
732 ++ return VPD_OK;
733 ++}
734 ++
735 ++static int vpd_decode_entry(const u32 max_len, const u8 *input_buf,
736 ++ u32 *_consumed, const u8 **entry, u32 *entry_len)
737 ++{
738 ++ u32 decoded_len;
739 ++ u32 consumed = *_consumed;
740 ++
741 ++ if (vpd_decode_len(max_len - consumed, &input_buf[consumed],
742 ++ entry_len, &decoded_len) != VPD_OK)
743 ++ return VPD_FAIL;
744 ++ if (max_len - consumed < decoded_len)
745 ++ return VPD_FAIL;
746 ++
747 ++ consumed += decoded_len;
748 ++ *entry = input_buf + consumed;
749 ++
750 ++ /* entry_len is untrusted data and must be checked again. */
751 ++ if (max_len - consumed < *entry_len)
752 ++ return VPD_FAIL;
753 +
754 ++ consumed += decoded_len;
755 ++ *_consumed = consumed;
756 + return VPD_OK;
757 + }
758 +
759 +-int vpd_decode_string(const s32 max_len, const u8 *input_buf, s32 *consumed,
760 ++int vpd_decode_string(const u32 max_len, const u8 *input_buf, u32 *consumed,
761 + vpd_decode_callback callback, void *callback_arg)
762 + {
763 + int type;
764 +- int res;
765 +- s32 key_len;
766 +- s32 value_len;
767 +- s32 decoded_len;
768 ++ u32 key_len;
769 ++ u32 value_len;
770 + const u8 *key;
771 + const u8 *value;
772 +
773 +@@ -66,26 +87,14 @@ int vpd_decode_string(const s32 max_len, const u8 *input_buf, s32 *consumed,
774 + case VPD_TYPE_STRING:
775 + (*consumed)++;
776 +
777 +- /* key */
778 +- res = vpd_decode_len(max_len - *consumed, &input_buf[*consumed],
779 +- &key_len, &decoded_len);
780 +- if (res != VPD_OK || *consumed + decoded_len >= max_len)
781 ++ if (vpd_decode_entry(max_len, input_buf, consumed, &key,
782 ++ &key_len) != VPD_OK)
783 + return VPD_FAIL;
784 +
785 +- *consumed += decoded_len;
786 +- key = &input_buf[*consumed];
787 +- *consumed += key_len;
788 +-
789 +- /* value */
790 +- res = vpd_decode_len(max_len - *consumed, &input_buf[*consumed],
791 +- &value_len, &decoded_len);
792 +- if (res != VPD_OK || *consumed + decoded_len > max_len)
793 ++ if (vpd_decode_entry(max_len, input_buf, consumed, &value,
794 ++ &value_len) != VPD_OK)
795 + return VPD_FAIL;
796 +
797 +- *consumed += decoded_len;
798 +- value = &input_buf[*consumed];
799 +- *consumed += value_len;
800 +-
801 + if (type == VPD_TYPE_STRING)
802 + return callback(key, key_len, value, value_len,
803 + callback_arg);
804 +diff --git a/drivers/firmware/google/vpd_decode.h b/drivers/firmware/google/vpd_decode.h
805 +index be3d62c5ca2f..e921456b8e78 100644
806 +--- a/drivers/firmware/google/vpd_decode.h
807 ++++ b/drivers/firmware/google/vpd_decode.h
808 +@@ -33,8 +33,8 @@ enum {
809 + };
810 +
811 + /* Callback for vpd_decode_string to invoke. */
812 +-typedef int vpd_decode_callback(const u8 *key, s32 key_len,
813 +- const u8 *value, s32 value_len,
814 ++typedef int vpd_decode_callback(const u8 *key, u32 key_len,
815 ++ const u8 *value, u32 value_len,
816 + void *arg);
817 +
818 + /*
819 +@@ -52,7 +52,7 @@ typedef int vpd_decode_callback(const u8 *key, s32 key_len,
820 + * If one entry is successfully decoded, sends it to callback and returns the
821 + * result.
822 + */
823 +-int vpd_decode_string(const s32 max_len, const u8 *input_buf, s32 *consumed,
824 ++int vpd_decode_string(const u32 max_len, const u8 *input_buf, u32 *consumed,
825 + vpd_decode_callback callback, void *callback_arg);
826 +
827 + #endif /* __VPD_DECODE_H */
828 +diff --git a/drivers/fpga/altera-ps-spi.c b/drivers/fpga/altera-ps-spi.c
829 +index 24b25c626036..4925cae7dcdd 100644
830 +--- a/drivers/fpga/altera-ps-spi.c
831 ++++ b/drivers/fpga/altera-ps-spi.c
832 +@@ -207,7 +207,7 @@ static int altera_ps_write_complete(struct fpga_manager *mgr,
833 + return -EIO;
834 + }
835 +
836 +- if (!IS_ERR(conf->confd)) {
837 ++ if (conf->confd) {
838 + if (!gpiod_get_raw_value_cansleep(conf->confd)) {
839 + dev_err(&mgr->dev, "CONF_DONE is inactive!\n");
840 + return -EIO;
841 +@@ -265,10 +265,13 @@ static int altera_ps_probe(struct spi_device *spi)
842 + return PTR_ERR(conf->status);
843 + }
844 +
845 +- conf->confd = devm_gpiod_get(&spi->dev, "confd", GPIOD_IN);
846 ++ conf->confd = devm_gpiod_get_optional(&spi->dev, "confd", GPIOD_IN);
847 + if (IS_ERR(conf->confd)) {
848 +- dev_warn(&spi->dev, "Not using confd gpio: %ld\n",
849 +- PTR_ERR(conf->confd));
850 ++ dev_err(&spi->dev, "Failed to get confd gpio: %ld\n",
851 ++ PTR_ERR(conf->confd));
852 ++ return PTR_ERR(conf->confd);
853 ++ } else if (!conf->confd) {
854 ++ dev_warn(&spi->dev, "Not using confd gpio");
855 + }
856 +
857 + /* Register manager with unique name */
858 +diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
859 +index 9cd4705b74bd..5a2d5140c1f4 100644
860 +--- a/drivers/hid/wacom_sys.c
861 ++++ b/drivers/hid/wacom_sys.c
862 +@@ -282,14 +282,16 @@ static void wacom_feature_mapping(struct hid_device *hdev,
863 + /* leave touch_max as is if predefined */
864 + if (!features->touch_max) {
865 + /* read manually */
866 +- data = kzalloc(2, GFP_KERNEL);
867 ++ n = hid_report_len(field->report);
868 ++ data = hid_alloc_report_buf(field->report, GFP_KERNEL);
869 + if (!data)
870 + break;
871 + data[0] = field->report->id;
872 + ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
873 +- data, 2, WAC_CMD_RETRIES);
874 +- if (ret == 2) {
875 +- features->touch_max = data[1];
876 ++ data, n, WAC_CMD_RETRIES);
877 ++ if (ret == n) {
878 ++ ret = hid_report_raw_event(hdev,
879 ++ HID_FEATURE_REPORT, data, n, 0);
880 + } else {
881 + features->touch_max = 16;
882 + hid_warn(hdev, "wacom_feature_mapping: "
883 +diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c
884 +index 50ef7b6cd195..6f5c838f9d47 100644
885 +--- a/drivers/hid/wacom_wac.c
886 ++++ b/drivers/hid/wacom_wac.c
887 +@@ -2533,6 +2533,7 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
888 + struct wacom *wacom = hid_get_drvdata(hdev);
889 + struct wacom_wac *wacom_wac = &wacom->wacom_wac;
890 + unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);
891 ++ struct wacom_features *features = &wacom->wacom_wac.features;
892 +
893 + switch (equivalent_usage) {
894 + case HID_GD_X:
895 +@@ -2553,6 +2554,9 @@ static void wacom_wac_finger_event(struct hid_device *hdev,
896 + case HID_DG_TIPSWITCH:
897 + wacom_wac->hid_data.tipswitch = value;
898 + break;
899 ++ case HID_DG_CONTACTMAX:
900 ++ features->touch_max = value;
901 ++ return;
902 + }
903 +
904 +
905 +diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
906 +index e7f9305b2dd9..f5f001738df5 100644
907 +--- a/drivers/i2c/busses/i2c-designware-slave.c
908 ++++ b/drivers/i2c/busses/i2c-designware-slave.c
909 +@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
910 +
911 + dev->disable_int(dev);
912 + dev->disable(dev);
913 ++ synchronize_irq(dev->irq);
914 + dev->slave = NULL;
915 + pm_runtime_put(dev->dev);
916 +
917 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
918 +index 39dc7be56884..6257be21cbed 100644
919 +--- a/drivers/infiniband/core/cma.c
920 ++++ b/drivers/infiniband/core/cma.c
921 +@@ -1723,8 +1723,8 @@ void rdma_destroy_id(struct rdma_cm_id *id)
922 + mutex_lock(&id_priv->handler_mutex);
923 + mutex_unlock(&id_priv->handler_mutex);
924 +
925 ++ rdma_restrack_del(&id_priv->res);
926 + if (id_priv->cma_dev) {
927 +- rdma_restrack_del(&id_priv->res);
928 + if (rdma_cap_ib_cm(id_priv->id.device, 1)) {
929 + if (id_priv->cm_id.ib)
930 + ib_destroy_cm_id(id_priv->cm_id.ib);
931 +@@ -3463,10 +3463,9 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
932 +
933 + return 0;
934 + err2:
935 +- if (id_priv->cma_dev) {
936 +- rdma_restrack_del(&id_priv->res);
937 ++ rdma_restrack_del(&id_priv->res);
938 ++ if (id_priv->cma_dev)
939 + cma_release_dev(id_priv);
940 +- }
941 + err1:
942 + cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_IDLE);
943 + return ret;
944 +diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c
945 +index 3b7fa0ccaa08..f67fa24b3aff 100644
946 +--- a/drivers/infiniband/core/restrack.c
947 ++++ b/drivers/infiniband/core/restrack.c
948 +@@ -209,7 +209,7 @@ void rdma_restrack_del(struct rdma_restrack_entry *res)
949 + struct ib_device *dev;
950 +
951 + if (!res->valid)
952 +- return;
953 ++ goto out;
954 +
955 + dev = res_to_dev(res);
956 + if (!dev)
957 +@@ -222,8 +222,10 @@ void rdma_restrack_del(struct rdma_restrack_entry *res)
958 + down_write(&dev->res.rwsem);
959 + hash_del(&res->node);
960 + res->valid = false;
961 ++ up_write(&dev->res.rwsem);
962 ++
963 ++out:
964 + if (res->task)
965 + put_task_struct(res->task);
966 +- up_write(&dev->res.rwsem);
967 + }
968 + EXPORT_SYMBOL(rdma_restrack_del);
969 +diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
970 +index f9525d6f0bfe..ae012639ae1d 100644
971 +--- a/drivers/input/mouse/elan_i2c_core.c
972 ++++ b/drivers/input/mouse/elan_i2c_core.c
973 +@@ -1358,7 +1358,7 @@ static const struct acpi_device_id elan_acpi_id[] = {
974 + { "ELAN0618", 0 },
975 + { "ELAN0619", 0 },
976 + { "ELAN061A", 0 },
977 +- { "ELAN061B", 0 },
978 ++/* { "ELAN061B", 0 }, not working on the Lenovo Legion Y7000 */
979 + { "ELAN061C", 0 },
980 + { "ELAN061D", 0 },
981 + { "ELAN061E", 0 },
982 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
983 +index 8d9920ff4134..69c269dc4f1b 100644
984 +--- a/drivers/iommu/amd_iommu.c
985 ++++ b/drivers/iommu/amd_iommu.c
986 +@@ -1153,6 +1153,17 @@ static void amd_iommu_flush_tlb_all(struct amd_iommu *iommu)
987 + iommu_completion_wait(iommu);
988 + }
989 +
990 ++static void amd_iommu_flush_tlb_domid(struct amd_iommu *iommu, u32 dom_id)
991 ++{
992 ++ struct iommu_cmd cmd;
993 ++
994 ++ build_inv_iommu_pages(&cmd, 0, CMD_INV_IOMMU_ALL_PAGES_ADDRESS,
995 ++ dom_id, 1);
996 ++ iommu_queue_command(iommu, &cmd);
997 ++
998 ++ iommu_completion_wait(iommu);
999 ++}
1000 ++
1001 + static void amd_iommu_flush_all(struct amd_iommu *iommu)
1002 + {
1003 + struct iommu_cmd cmd;
1004 +@@ -1329,18 +1340,21 @@ static void domain_flush_devices(struct protection_domain *domain)
1005 + * another level increases the size of the address space by 9 bits to a size up
1006 + * to 64 bits.
1007 + */
1008 +-static bool increase_address_space(struct protection_domain *domain,
1009 ++static void increase_address_space(struct protection_domain *domain,
1010 + gfp_t gfp)
1011 + {
1012 ++ unsigned long flags;
1013 + u64 *pte;
1014 +
1015 +- if (domain->mode == PAGE_MODE_6_LEVEL)
1016 ++ spin_lock_irqsave(&domain->lock, flags);
1017 ++
1018 ++ if (WARN_ON_ONCE(domain->mode == PAGE_MODE_6_LEVEL))
1019 + /* address space already 64 bit large */
1020 +- return false;
1021 ++ goto out;
1022 +
1023 + pte = (void *)get_zeroed_page(gfp);
1024 + if (!pte)
1025 +- return false;
1026 ++ goto out;
1027 +
1028 + *pte = PM_LEVEL_PDE(domain->mode,
1029 + iommu_virt_to_phys(domain->pt_root));
1030 +@@ -1348,7 +1362,10 @@ static bool increase_address_space(struct protection_domain *domain,
1031 + domain->mode += 1;
1032 + domain->updated = true;
1033 +
1034 +- return true;
1035 ++out:
1036 ++ spin_unlock_irqrestore(&domain->lock, flags);
1037 ++
1038 ++ return;
1039 + }
1040 +
1041 + static u64 *alloc_pte(struct protection_domain *domain,
1042 +@@ -1838,6 +1855,7 @@ static void set_dte_entry(u16 devid, struct protection_domain *domain,
1043 + {
1044 + u64 pte_root = 0;
1045 + u64 flags = 0;
1046 ++ u32 old_domid;
1047 +
1048 + if (domain->mode != PAGE_MODE_NONE)
1049 + pte_root = iommu_virt_to_phys(domain->pt_root);
1050 +@@ -1887,8 +1905,20 @@ static void set_dte_entry(u16 devid, struct protection_domain *domain,
1051 + flags &= ~DEV_DOMID_MASK;
1052 + flags |= domain->id;
1053 +
1054 ++ old_domid = amd_iommu_dev_table[devid].data[1] & DEV_DOMID_MASK;
1055 + amd_iommu_dev_table[devid].data[1] = flags;
1056 + amd_iommu_dev_table[devid].data[0] = pte_root;
1057 ++
1058 ++ /*
1059 ++ * A kdump kernel might be replacing a domain ID that was copied from
1060 ++ * the previous kernel--if so, it needs to flush the translation cache
1061 ++ * entries for the old domain ID that is being overwritten
1062 ++ */
1063 ++ if (old_domid) {
1064 ++ struct amd_iommu *iommu = amd_iommu_rlookup_table[devid];
1065 ++
1066 ++ amd_iommu_flush_tlb_domid(iommu, old_domid);
1067 ++ }
1068 + }
1069 +
1070 + static void clear_dte_entry(u16 devid)
1071 +diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c
1072 +index 18d0f8f5283f..8d8e9f56a8be 100644
1073 +--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
1074 ++++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
1075 +@@ -607,10 +607,9 @@ static int technisat_usb2_frontend_attach(struct dvb_usb_adapter *a)
1076 + static int technisat_usb2_get_ir(struct dvb_usb_device *d)
1077 + {
1078 + struct technisat_usb2_state *state = d->priv;
1079 +- u8 *buf = state->buf;
1080 +- u8 *b;
1081 +- int ret;
1082 + struct ir_raw_event ev;
1083 ++ u8 *buf = state->buf;
1084 ++ int i, ret;
1085 +
1086 + buf[0] = GET_IR_DATA_VENDOR_REQUEST;
1087 + buf[1] = 0x08;
1088 +@@ -646,26 +645,25 @@ unlock:
1089 + return 0; /* no key pressed */
1090 +
1091 + /* decoding */
1092 +- b = buf+1;
1093 +
1094 + #if 0
1095 + deb_rc("RC: %d ", ret);
1096 +- debug_dump(b, ret, deb_rc);
1097 ++ debug_dump(buf + 1, ret, deb_rc);
1098 + #endif
1099 +
1100 + ev.pulse = 0;
1101 +- while (1) {
1102 +- ev.pulse = !ev.pulse;
1103 +- ev.duration = (*b * FIRMWARE_CLOCK_DIVISOR * FIRMWARE_CLOCK_TICK) / 1000;
1104 +- ir_raw_event_store(d->rc_dev, &ev);
1105 +-
1106 +- b++;
1107 +- if (*b == 0xff) {
1108 ++ for (i = 1; i < ARRAY_SIZE(state->buf); i++) {
1109 ++ if (buf[i] == 0xff) {
1110 + ev.pulse = 0;
1111 + ev.duration = 888888*2;
1112 + ir_raw_event_store(d->rc_dev, &ev);
1113 + break;
1114 + }
1115 ++
1116 ++ ev.pulse = !ev.pulse;
1117 ++ ev.duration = (buf[i] * FIRMWARE_CLOCK_DIVISOR *
1118 ++ FIRMWARE_CLOCK_TICK) / 1000;
1119 ++ ir_raw_event_store(d->rc_dev, &ev);
1120 + }
1121 +
1122 + ir_raw_event_handle(d->rc_dev);
1123 +diff --git a/drivers/media/usb/tm6000/tm6000-dvb.c b/drivers/media/usb/tm6000/tm6000-dvb.c
1124 +index 3a4e545c6037..3db2fd7f5d7c 100644
1125 +--- a/drivers/media/usb/tm6000/tm6000-dvb.c
1126 ++++ b/drivers/media/usb/tm6000/tm6000-dvb.c
1127 +@@ -105,6 +105,7 @@ static void tm6000_urb_received(struct urb *urb)
1128 + printk(KERN_ERR "tm6000: error %s\n", __func__);
1129 + kfree(urb->transfer_buffer);
1130 + usb_free_urb(urb);
1131 ++ dev->dvb->bulk_urb = NULL;
1132 + }
1133 + }
1134 + }
1135 +@@ -135,6 +136,7 @@ static int tm6000_start_stream(struct tm6000_core *dev)
1136 + dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
1137 + if (!dvb->bulk_urb->transfer_buffer) {
1138 + usb_free_urb(dvb->bulk_urb);
1139 ++ dvb->bulk_urb = NULL;
1140 + return -ENOMEM;
1141 + }
1142 +
1143 +@@ -161,6 +163,7 @@ static int tm6000_start_stream(struct tm6000_core *dev)
1144 +
1145 + kfree(dvb->bulk_urb->transfer_buffer);
1146 + usb_free_urb(dvb->bulk_urb);
1147 ++ dvb->bulk_urb = NULL;
1148 + return ret;
1149 + }
1150 +
1151 +diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-main.c b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
1152 +index b41f23679a08..7ce9c69e9c44 100644
1153 +--- a/drivers/net/ethernet/amd/xgbe/xgbe-main.c
1154 ++++ b/drivers/net/ethernet/amd/xgbe/xgbe-main.c
1155 +@@ -469,13 +469,19 @@ static int __init xgbe_mod_init(void)
1156 +
1157 + ret = xgbe_platform_init();
1158 + if (ret)
1159 +- return ret;
1160 ++ goto err_platform_init;
1161 +
1162 + ret = xgbe_pci_init();
1163 + if (ret)
1164 +- return ret;
1165 ++ goto err_pci_init;
1166 +
1167 + return 0;
1168 ++
1169 ++err_pci_init:
1170 ++ xgbe_platform_exit();
1171 ++err_platform_init:
1172 ++ unregister_netdevice_notifier(&xgbe_netdev_notifier);
1173 ++ return ret;
1174 + }
1175 +
1176 + static void __exit xgbe_mod_exit(void)
1177 +diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
1178 +index d335c334fa56..82582fa54d5d 100644
1179 +--- a/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
1180 ++++ b/drivers/net/ethernet/aquantia/atlantic/aq_vec.c
1181 +@@ -89,6 +89,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget)
1182 + }
1183 + }
1184 +
1185 ++err_exit:
1186 + if (!was_tx_cleaned)
1187 + work_done = budget;
1188 +
1189 +@@ -98,7 +99,7 @@ static int aq_vec_poll(struct napi_struct *napi, int budget)
1190 + 1U << self->aq_ring_param.vec_idx);
1191 + }
1192 + }
1193 +-err_exit:
1194 ++
1195 + return work_done;
1196 + }
1197 +
1198 +diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
1199 +index 255de7d68cd3..5a57be66a487 100644
1200 +--- a/drivers/net/ethernet/ibm/ibmvnic.c
1201 ++++ b/drivers/net/ethernet/ibm/ibmvnic.c
1202 +@@ -1998,6 +1998,10 @@ static void __ibmvnic_reset(struct work_struct *work)
1203 +
1204 + rwi = get_next_rwi(adapter);
1205 + while (rwi) {
1206 ++ if (adapter->state == VNIC_REMOVING ||
1207 ++ adapter->state == VNIC_REMOVED)
1208 ++ goto out;
1209 ++
1210 + if (adapter->force_reset_recovery) {
1211 + adapter->force_reset_recovery = false;
1212 + rc = do_hard_reset(adapter, rwi, reset_state);
1213 +@@ -2022,7 +2026,7 @@ static void __ibmvnic_reset(struct work_struct *work)
1214 + netdev_dbg(adapter->netdev, "Reset failed\n");
1215 + free_all_rwi(adapter);
1216 + }
1217 +-
1218 ++out:
1219 + adapter->resetting = false;
1220 + if (we_lock_rtnl)
1221 + rtnl_unlock();
1222 +diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
1223 +index 4ade864c8d53..d013f30019b6 100644
1224 +--- a/drivers/net/ethernet/marvell/sky2.c
1225 ++++ b/drivers/net/ethernet/marvell/sky2.c
1226 +@@ -4954,6 +4954,13 @@ static const struct dmi_system_id msi_blacklist[] = {
1227 + DMI_MATCH(DMI_BOARD_NAME, "P6T"),
1228 + },
1229 + },
1230 ++ {
1231 ++ .ident = "ASUS P6X",
1232 ++ .matches = {
1233 ++ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
1234 ++ DMI_MATCH(DMI_BOARD_NAME, "P6X"),
1235 ++ },
1236 ++ },
1237 + {}
1238 + };
1239 +
1240 +diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c
1241 +index cf3b0e3dc350..637687b766ff 100644
1242 +--- a/drivers/net/ethernet/qlogic/qed/qed_main.c
1243 ++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c
1244 +@@ -1150,7 +1150,7 @@ static int qed_slowpath_start(struct qed_dev *cdev,
1245 + &drv_version);
1246 + if (rc) {
1247 + DP_NOTICE(cdev, "Failed sending drv version command\n");
1248 +- return rc;
1249 ++ goto err4;
1250 + }
1251 + }
1252 +
1253 +@@ -1158,6 +1158,8 @@ static int qed_slowpath_start(struct qed_dev *cdev,
1254 +
1255 + return 0;
1256 +
1257 ++err4:
1258 ++ qed_ll2_dealloc_if(cdev);
1259 + err3:
1260 + qed_hw_stop(cdev);
1261 + err2:
1262 +diff --git a/drivers/net/ethernet/seeq/sgiseeq.c b/drivers/net/ethernet/seeq/sgiseeq.c
1263 +index 696037d5ac3d..ad557f457b2c 100644
1264 +--- a/drivers/net/ethernet/seeq/sgiseeq.c
1265 ++++ b/drivers/net/ethernet/seeq/sgiseeq.c
1266 +@@ -793,15 +793,16 @@ static int sgiseeq_probe(struct platform_device *pdev)
1267 + printk(KERN_ERR "Sgiseeq: Cannot register net device, "
1268 + "aborting.\n");
1269 + err = -ENODEV;
1270 +- goto err_out_free_page;
1271 ++ goto err_out_free_attrs;
1272 + }
1273 +
1274 + printk(KERN_INFO "%s: %s %pM\n", dev->name, sgiseeqstr, dev->dev_addr);
1275 +
1276 + return 0;
1277 +
1278 +-err_out_free_page:
1279 +- free_page((unsigned long) sp->srings);
1280 ++err_out_free_attrs:
1281 ++ dma_free_attrs(&pdev->dev, sizeof(*sp->srings), sp->srings,
1282 ++ sp->srings_dma, DMA_ATTR_NON_CONSISTENT);
1283 + err_out_free_dev:
1284 + free_netdev(dev);
1285 +
1286 +diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
1287 +index f1ed1744801c..be1f1a86bcd6 100644
1288 +--- a/drivers/net/ieee802154/mac802154_hwsim.c
1289 ++++ b/drivers/net/ieee802154/mac802154_hwsim.c
1290 +@@ -821,7 +821,7 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
1291 + err = hwsim_subscribe_all_others(phy);
1292 + if (err < 0) {
1293 + mutex_unlock(&hwsim_phys_lock);
1294 +- goto err_reg;
1295 ++ goto err_subscribe;
1296 + }
1297 + }
1298 + list_add_tail(&phy->list, &hwsim_phys);
1299 +@@ -831,6 +831,8 @@ static int hwsim_add_one(struct genl_info *info, struct device *dev,
1300 +
1301 + return idx;
1302 +
1303 ++err_subscribe:
1304 ++ ieee802154_unregister_hw(phy->hw);
1305 + err_reg:
1306 + kfree(pib);
1307 + err_pib:
1308 +@@ -920,9 +922,9 @@ static __init int hwsim_init_module(void)
1309 + return 0;
1310 +
1311 + platform_drv:
1312 +- genl_unregister_family(&hwsim_genl_family);
1313 +-platform_dev:
1314 + platform_device_unregister(mac802154hwsim_dev);
1315 ++platform_dev:
1316 ++ genl_unregister_family(&hwsim_genl_family);
1317 + return rc;
1318 + }
1319 +
1320 +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1321 +index f1b5201cc320..a065a6184f7e 100644
1322 +--- a/drivers/net/usb/r8152.c
1323 ++++ b/drivers/net/usb/r8152.c
1324 +@@ -788,8 +788,11 @@ int get_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data)
1325 + ret = usb_control_msg(tp->udev, usb_rcvctrlpipe(tp->udev, 0),
1326 + RTL8152_REQ_GET_REGS, RTL8152_REQT_READ,
1327 + value, index, tmp, size, 500);
1328 ++ if (ret < 0)
1329 ++ memset(data, 0xff, size);
1330 ++ else
1331 ++ memcpy(data, tmp, size);
1332 +
1333 +- memcpy(data, tmp, size);
1334 + kfree(tmp);
1335 +
1336 + return ret;
1337 +diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c b/drivers/net/wireless/marvell/mwifiex/ie.c
1338 +index 801a2d7b020a..a3f4a5e92105 100644
1339 +--- a/drivers/net/wireless/marvell/mwifiex/ie.c
1340 ++++ b/drivers/net/wireless/marvell/mwifiex/ie.c
1341 +@@ -241,6 +241,9 @@ static int mwifiex_update_vs_ie(const u8 *ies, int ies_len,
1342 + }
1343 +
1344 + vs_ie = (struct ieee_types_header *)vendor_ie;
1345 ++ if (le16_to_cpu(ie->ie_length) + vs_ie->len + 2 >
1346 ++ IEEE_MAX_IE_SIZE)
1347 ++ return -EINVAL;
1348 + memcpy(ie->ie_buffer + le16_to_cpu(ie->ie_length),
1349 + vs_ie, vs_ie->len + 2);
1350 + le16_unaligned_add_cpu(&ie->ie_length, vs_ie->len + 2);
1351 +diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
1352 +index 18f7d9bf30b2..0939a8c8f3ab 100644
1353 +--- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
1354 ++++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c
1355 +@@ -265,6 +265,8 @@ mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
1356 +
1357 + rate_ie = (void *)cfg80211_find_ie(WLAN_EID_SUPP_RATES, var_pos, len);
1358 + if (rate_ie) {
1359 ++ if (rate_ie->len > MWIFIEX_SUPPORTED_RATES)
1360 ++ return;
1361 + memcpy(bss_cfg->rates, rate_ie + 1, rate_ie->len);
1362 + rate_len = rate_ie->len;
1363 + }
1364 +@@ -272,8 +274,11 @@ mwifiex_set_uap_rates(struct mwifiex_uap_bss_param *bss_cfg,
1365 + rate_ie = (void *)cfg80211_find_ie(WLAN_EID_EXT_SUPP_RATES,
1366 + params->beacon.tail,
1367 + params->beacon.tail_len);
1368 +- if (rate_ie)
1369 ++ if (rate_ie) {
1370 ++ if (rate_ie->len > MWIFIEX_SUPPORTED_RATES - rate_len)
1371 ++ return;
1372 + memcpy(bss_cfg->rates + rate_len, rate_ie + 1, rate_ie->len);
1373 ++ }
1374 +
1375 + return;
1376 + }
1377 +@@ -391,6 +396,8 @@ mwifiex_set_wmm_params(struct mwifiex_private *priv,
1378 + params->beacon.tail_len);
1379 + if (vendor_ie) {
1380 + wmm_ie = vendor_ie;
1381 ++ if (*(wmm_ie + 1) > sizeof(struct mwifiex_types_wmm_info))
1382 ++ return;
1383 + memcpy(&bss_cfg->wmm_info, wmm_ie +
1384 + sizeof(struct ieee_types_header), *(wmm_ie + 1));
1385 + priv->wmm_enabled = 1;
1386 +diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1387 +index 5b97cc946d70..a2a4c19bc95e 100644
1388 +--- a/drivers/net/xen-netfront.c
1389 ++++ b/drivers/net/xen-netfront.c
1390 +@@ -909,7 +909,7 @@ static RING_IDX xennet_fill_frags(struct netfront_queue *queue,
1391 + __pskb_pull_tail(skb, pull_to - skb_headlen(skb));
1392 + }
1393 + if (unlikely(skb_shinfo(skb)->nr_frags >= MAX_SKB_FRAGS)) {
1394 +- queue->rx.rsp_cons = ++cons;
1395 ++ queue->rx.rsp_cons = ++cons + skb_queue_len(list);
1396 + kfree_skb(nskb);
1397 + return ~0U;
1398 + }
1399 +diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
1400 +index 5352e0c3be82..9b599296205d 100644
1401 +--- a/drivers/pci/controller/dwc/pcie-kirin.c
1402 ++++ b/drivers/pci/controller/dwc/pcie-kirin.c
1403 +@@ -467,8 +467,8 @@ static int kirin_pcie_add_msi(struct dw_pcie *pci,
1404 + return 0;
1405 + }
1406 +
1407 +-static int __init kirin_add_pcie_port(struct dw_pcie *pci,
1408 +- struct platform_device *pdev)
1409 ++static int kirin_add_pcie_port(struct dw_pcie *pci,
1410 ++ struct platform_device *pdev)
1411 + {
1412 + int ret;
1413 +
1414 +diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
1415 +index fb8f05e39cf7..6fb2b6969590 100644
1416 +--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
1417 ++++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
1418 +@@ -66,6 +66,7 @@
1419 + USB2_OBINT_IDDIGCHG)
1420 +
1421 + /* VBCTRL */
1422 ++#define USB2_VBCTRL_OCCLREN BIT(16)
1423 + #define USB2_VBCTRL_DRVVBUSSEL BIT(8)
1424 +
1425 + /* LINECTRL1 */
1426 +@@ -289,6 +290,7 @@ static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch)
1427 + u32 val;
1428 +
1429 + val = readl(usb2_base + USB2_VBCTRL);
1430 ++ val &= ~USB2_VBCTRL_OCCLREN;
1431 + writel(val | USB2_VBCTRL_DRVVBUSSEL, usb2_base + USB2_VBCTRL);
1432 + writel(USB2_OBINT_BITS, usb2_base + USB2_OBINTSTA);
1433 + val = readl(usb2_base + USB2_OBINTEN);
1434 +diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
1435 +index 1cb80fe5f95c..dd8949e8fcd7 100644
1436 +--- a/drivers/tty/serial/atmel_serial.c
1437 ++++ b/drivers/tty/serial/atmel_serial.c
1438 +@@ -1270,7 +1270,6 @@ atmel_handle_transmit(struct uart_port *port, unsigned int pending)
1439 +
1440 + atmel_port->hd_start_rx = false;
1441 + atmel_start_rx(port);
1442 +- return;
1443 + }
1444 +
1445 + atmel_tasklet_schedule(atmel_port, &atmel_port->tasklet_tx);
1446 +diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
1447 +index 828f1143859c..2774af86763e 100644
1448 +--- a/drivers/tty/serial/sprd_serial.c
1449 ++++ b/drivers/tty/serial/sprd_serial.c
1450 +@@ -232,7 +232,7 @@ static inline void sprd_rx(struct uart_port *port)
1451 +
1452 + if (lsr & (SPRD_LSR_BI | SPRD_LSR_PE |
1453 + SPRD_LSR_FE | SPRD_LSR_OE))
1454 +- if (handle_lsr_errors(port, &lsr, &flag))
1455 ++ if (handle_lsr_errors(port, &flag, &lsr))
1456 + continue;
1457 + if (uart_handle_sysrq_char(port, ch))
1458 + continue;
1459 +diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
1460 +index e723ddd79bcf..921ad6998dec 100644
1461 +--- a/drivers/usb/core/config.c
1462 ++++ b/drivers/usb/core/config.c
1463 +@@ -925,7 +925,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
1464 + struct usb_bos_descriptor *bos;
1465 + struct usb_dev_cap_header *cap;
1466 + struct usb_ssp_cap_descriptor *ssp_cap;
1467 +- unsigned char *buffer;
1468 ++ unsigned char *buffer, *buffer0;
1469 + int length, total_len, num, i, ssac;
1470 + __u8 cap_type;
1471 + int ret;
1472 +@@ -970,10 +970,12 @@ int usb_get_bos_descriptor(struct usb_device *dev)
1473 + ret = -ENOMSG;
1474 + goto err;
1475 + }
1476 ++
1477 ++ buffer0 = buffer;
1478 + total_len -= length;
1479 ++ buffer += length;
1480 +
1481 + for (i = 0; i < num; i++) {
1482 +- buffer += length;
1483 + cap = (struct usb_dev_cap_header *)buffer;
1484 +
1485 + if (total_len < sizeof(*cap) || total_len < cap->bLength) {
1486 +@@ -987,8 +989,6 @@ int usb_get_bos_descriptor(struct usb_device *dev)
1487 + break;
1488 + }
1489 +
1490 +- total_len -= length;
1491 +-
1492 + if (cap->bDescriptorType != USB_DT_DEVICE_CAPABILITY) {
1493 + dev_warn(ddev, "descriptor type invalid, skip\n");
1494 + continue;
1495 +@@ -1023,7 +1023,11 @@ int usb_get_bos_descriptor(struct usb_device *dev)
1496 + default:
1497 + break;
1498 + }
1499 ++
1500 ++ total_len -= length;
1501 ++ buffer += length;
1502 + }
1503 ++ dev->bos->desc->wTotalLength = cpu_to_le16(buffer - buffer0);
1504 +
1505 + return 0;
1506 +
1507 +diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c
1508 +index b1cce989bd12..fe37dacc695f 100644
1509 +--- a/drivers/usb/host/xhci-tegra.c
1510 ++++ b/drivers/usb/host/xhci-tegra.c
1511 +@@ -1148,6 +1148,16 @@ static int tegra_xusb_probe(struct platform_device *pdev)
1512 +
1513 + tegra_xusb_ipfs_config(tegra, regs);
1514 +
1515 ++ /*
1516 ++ * The XUSB Falcon microcontroller can only address 40 bits, so set
1517 ++ * the DMA mask accordingly.
1518 ++ */
1519 ++ err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40));
1520 ++ if (err < 0) {
1521 ++ dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err);
1522 ++ goto put_rpm;
1523 ++ }
1524 ++
1525 + err = tegra_xusb_load_firmware(tegra);
1526 + if (err < 0) {
1527 + dev_err(&pdev->dev, "failed to load firmware: %d\n", err);
1528 +diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
1529 +index efae2fb0930a..9a47e4e5dea0 100644
1530 +--- a/fs/binfmt_elf.c
1531 ++++ b/fs/binfmt_elf.c
1532 +@@ -1137,6 +1137,17 @@ static int load_elf_binary(struct linux_binprm *bprm)
1533 + current->mm->start_stack = bprm->p;
1534 +
1535 + if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) {
1536 ++ /*
1537 ++ * For architectures with ELF randomization, when executing
1538 ++ * a loader directly (i.e. no interpreter listed in ELF
1539 ++ * headers), move the brk area out of the mmap region
1540 ++ * (since it grows up, and may collide early with the stack
1541 ++ * growing down), and into the unused ELF_ET_DYN_BASE region.
1542 ++ */
1543 ++ if (IS_ENABLED(CONFIG_ARCH_HAS_ELF_RANDOMIZE) && !interpreter)
1544 ++ current->mm->brk = current->mm->start_brk =
1545 ++ ELF_ET_DYN_BASE;
1546 ++
1547 + current->mm->brk = current->mm->start_brk =
1548 + arch_randomize_brk(current->mm);
1549 + #ifdef compat_brk_randomized
1550 +diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
1551 +index 208430bb66fc..c290e231f918 100644
1552 +--- a/fs/cifs/connect.c
1553 ++++ b/fs/cifs/connect.c
1554 +@@ -2756,6 +2756,7 @@ static int
1555 + cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
1556 + {
1557 + int rc = 0;
1558 ++ int is_domain = 0;
1559 + const char *delim, *payload;
1560 + char *desc;
1561 + ssize_t len;
1562 +@@ -2803,6 +2804,7 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
1563 + rc = PTR_ERR(key);
1564 + goto out_err;
1565 + }
1566 ++ is_domain = 1;
1567 + }
1568 +
1569 + down_read(&key->sem);
1570 +@@ -2860,6 +2862,26 @@ cifs_set_cifscreds(struct smb_vol *vol, struct cifs_ses *ses)
1571 + goto out_key_put;
1572 + }
1573 +
1574 ++ /*
1575 ++ * If we have a domain key then we must set the domainName in the
1576 ++ * for the request.
1577 ++ */
1578 ++ if (is_domain && ses->domainName) {
1579 ++ vol->domainname = kstrndup(ses->domainName,
1580 ++ strlen(ses->domainName),
1581 ++ GFP_KERNEL);
1582 ++ if (!vol->domainname) {
1583 ++ cifs_dbg(FYI, "Unable to allocate %zd bytes for "
1584 ++ "domain\n", len);
1585 ++ rc = -ENOMEM;
1586 ++ kfree(vol->username);
1587 ++ vol->username = NULL;
1588 ++ kzfree(vol->password);
1589 ++ vol->password = NULL;
1590 ++ goto out_key_put;
1591 ++ }
1592 ++ }
1593 ++
1594 + out_key_put:
1595 + up_read(&key->sem);
1596 + key_put(key);
1597 +diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
1598 +index 71b2e390becf..b8d686087952 100644
1599 +--- a/fs/nfs/dir.c
1600 ++++ b/fs/nfs/dir.c
1601 +@@ -1486,7 +1486,7 @@ static int nfs_finish_open(struct nfs_open_context *ctx,
1602 + if (S_ISREG(file->f_path.dentry->d_inode->i_mode))
1603 + nfs_file_set_open_context(file, ctx);
1604 + else
1605 +- err = -ESTALE;
1606 ++ err = -EOPENSTALE;
1607 + out:
1608 + return err;
1609 + }
1610 +diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
1611 +index 61abbb087ed1..75d3cf86f172 100644
1612 +--- a/fs/nfs/nfs4file.c
1613 ++++ b/fs/nfs/nfs4file.c
1614 +@@ -73,13 +73,13 @@ nfs4_file_open(struct inode *inode, struct file *filp)
1615 + if (IS_ERR(inode)) {
1616 + err = PTR_ERR(inode);
1617 + switch (err) {
1618 +- case -EPERM:
1619 +- case -EACCES:
1620 +- case -EDQUOT:
1621 +- case -ENOSPC:
1622 +- case -EROFS:
1623 +- goto out_put_ctx;
1624 + default:
1625 ++ goto out_put_ctx;
1626 ++ case -ENOENT:
1627 ++ case -ESTALE:
1628 ++ case -EISDIR:
1629 ++ case -ENOTDIR:
1630 ++ case -ELOOP:
1631 + goto out_drop;
1632 + }
1633 + }
1634 +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
1635 +index d23ea74b5d20..9cf59e2622f8 100644
1636 +--- a/fs/nfs/pagelist.c
1637 ++++ b/fs/nfs/pagelist.c
1638 +@@ -567,7 +567,7 @@ static void nfs_pgio_rpcsetup(struct nfs_pgio_header *hdr,
1639 + }
1640 +
1641 + hdr->res.fattr = &hdr->fattr;
1642 +- hdr->res.count = count;
1643 ++ hdr->res.count = 0;
1644 + hdr->res.eof = 0;
1645 + hdr->res.verf = &hdr->verf;
1646 + nfs_fattr_init(&hdr->fattr);
1647 +diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
1648 +index e0c257bd62b9..0e0335e77ce6 100644
1649 +--- a/fs/nfs/proc.c
1650 ++++ b/fs/nfs/proc.c
1651 +@@ -594,7 +594,8 @@ static int nfs_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
1652 + /* Emulate the eof flag, which isn't normally needed in NFSv2
1653 + * as it is guaranteed to always return the file attributes
1654 + */
1655 +- if (hdr->args.offset + hdr->res.count >= hdr->res.fattr->size)
1656 ++ if ((hdr->res.count == 0 && hdr->args.count > 0) ||
1657 ++ hdr->args.offset + hdr->res.count >= hdr->res.fattr->size)
1658 + hdr->res.eof = 1;
1659 + }
1660 + return 0;
1661 +@@ -615,8 +616,10 @@ static int nfs_proc_pgio_rpc_prepare(struct rpc_task *task,
1662 +
1663 + static int nfs_write_done(struct rpc_task *task, struct nfs_pgio_header *hdr)
1664 + {
1665 +- if (task->tk_status >= 0)
1666 ++ if (task->tk_status >= 0) {
1667 ++ hdr->res.count = hdr->args.count;
1668 + nfs_writeback_update_inode(hdr);
1669 ++ }
1670 + return 0;
1671 + }
1672 +
1673 +diff --git a/fs/overlayfs/ovl_entry.h b/fs/overlayfs/ovl_entry.h
1674 +index 6ed1ace8f8b3..1a1adc697c55 100644
1675 +--- a/fs/overlayfs/ovl_entry.h
1676 ++++ b/fs/overlayfs/ovl_entry.h
1677 +@@ -69,6 +69,7 @@ struct ovl_fs {
1678 + bool workdir_locked;
1679 + /* Traps in ovl inode cache */
1680 + struct inode *upperdir_trap;
1681 ++ struct inode *workbasedir_trap;
1682 + struct inode *workdir_trap;
1683 + struct inode *indexdir_trap;
1684 + /* Inode numbers in all layers do not use the high xino_bits */
1685 +diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
1686 +index 2d028c02621f..127df4a85c8a 100644
1687 +--- a/fs/overlayfs/super.c
1688 ++++ b/fs/overlayfs/super.c
1689 +@@ -217,6 +217,7 @@ static void ovl_free_fs(struct ovl_fs *ofs)
1690 + {
1691 + unsigned i;
1692 +
1693 ++ iput(ofs->workbasedir_trap);
1694 + iput(ofs->indexdir_trap);
1695 + iput(ofs->workdir_trap);
1696 + iput(ofs->upperdir_trap);
1697 +@@ -1007,6 +1008,25 @@ static int ovl_setup_trap(struct super_block *sb, struct dentry *dir,
1698 + return 0;
1699 + }
1700 +
1701 ++/*
1702 ++ * Determine how we treat concurrent use of upperdir/workdir based on the
1703 ++ * index feature. This is papering over mount leaks of container runtimes,
1704 ++ * for example, an old overlay mount is leaked and now its upperdir is
1705 ++ * attempted to be used as a lower layer in a new overlay mount.
1706 ++ */
1707 ++static int ovl_report_in_use(struct ovl_fs *ofs, const char *name)
1708 ++{
1709 ++ if (ofs->config.index) {
1710 ++ pr_err("overlayfs: %s is in-use as upperdir/workdir of another mount, mount with '-o index=off' to override exclusive upperdir protection.\n",
1711 ++ name);
1712 ++ return -EBUSY;
1713 ++ } else {
1714 ++ pr_warn("overlayfs: %s is in-use as upperdir/workdir of another mount, accessing files from both mounts will result in undefined behavior.\n",
1715 ++ name);
1716 ++ return 0;
1717 ++ }
1718 ++}
1719 ++
1720 + static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs,
1721 + struct path *upperpath)
1722 + {
1723 +@@ -1044,14 +1064,12 @@ static int ovl_get_upper(struct super_block *sb, struct ovl_fs *ofs,
1724 + upper_mnt->mnt_flags &= ~(MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME);
1725 + ofs->upper_mnt = upper_mnt;
1726 +
1727 +- err = -EBUSY;
1728 + if (ovl_inuse_trylock(ofs->upper_mnt->mnt_root)) {
1729 + ofs->upperdir_locked = true;
1730 +- } else if (ofs->config.index) {
1731 +- pr_err("overlayfs: upperdir is in-use by another mount, mount with '-o index=off' to override exclusive upperdir protection.\n");
1732 +- goto out;
1733 + } else {
1734 +- pr_warn("overlayfs: upperdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
1735 ++ err = ovl_report_in_use(ofs, "upperdir");
1736 ++ if (err)
1737 ++ goto out;
1738 + }
1739 +
1740 + err = 0;
1741 +@@ -1161,16 +1179,19 @@ static int ovl_get_workdir(struct super_block *sb, struct ovl_fs *ofs,
1742 +
1743 + ofs->workbasedir = dget(workpath.dentry);
1744 +
1745 +- err = -EBUSY;
1746 + if (ovl_inuse_trylock(ofs->workbasedir)) {
1747 + ofs->workdir_locked = true;
1748 +- } else if (ofs->config.index) {
1749 +- pr_err("overlayfs: workdir is in-use by another mount, mount with '-o index=off' to override exclusive workdir protection.\n");
1750 +- goto out;
1751 + } else {
1752 +- pr_warn("overlayfs: workdir is in-use by another mount, accessing files from both mounts will result in undefined behavior.\n");
1753 ++ err = ovl_report_in_use(ofs, "workdir");
1754 ++ if (err)
1755 ++ goto out;
1756 + }
1757 +
1758 ++ err = ovl_setup_trap(sb, ofs->workbasedir, &ofs->workbasedir_trap,
1759 ++ "workdir");
1760 ++ if (err)
1761 ++ goto out;
1762 ++
1763 + err = ovl_make_workdir(sb, ofs, &workpath);
1764 +
1765 + out:
1766 +@@ -1289,16 +1310,16 @@ static int ovl_get_lower_layers(struct super_block *sb, struct ovl_fs *ofs,
1767 + if (err < 0)
1768 + goto out;
1769 +
1770 +- err = -EBUSY;
1771 +- if (ovl_is_inuse(stack[i].dentry)) {
1772 +- pr_err("overlayfs: lowerdir is in-use as upperdir/workdir\n");
1773 +- goto out;
1774 +- }
1775 +-
1776 + err = ovl_setup_trap(sb, stack[i].dentry, &trap, "lowerdir");
1777 + if (err)
1778 + goto out;
1779 +
1780 ++ if (ovl_is_inuse(stack[i].dentry)) {
1781 ++ err = ovl_report_in_use(ofs, "lowerdir");
1782 ++ if (err)
1783 ++ goto out;
1784 ++ }
1785 ++
1786 + mnt = clone_private_mount(&stack[i]);
1787 + err = PTR_ERR(mnt);
1788 + if (IS_ERR(mnt)) {
1789 +@@ -1445,8 +1466,8 @@ out_err:
1790 + * - another layer of this overlayfs instance
1791 + * - upper/work dir of any overlayfs instance
1792 + */
1793 +-static int ovl_check_layer(struct super_block *sb, struct dentry *dentry,
1794 +- const char *name)
1795 ++static int ovl_check_layer(struct super_block *sb, struct ovl_fs *ofs,
1796 ++ struct dentry *dentry, const char *name)
1797 + {
1798 + struct dentry *next = dentry, *parent;
1799 + int err = 0;
1800 +@@ -1458,13 +1479,11 @@ static int ovl_check_layer(struct super_block *sb, struct dentry *dentry,
1801 +
1802 + /* Walk back ancestors to root (inclusive) looking for traps */
1803 + while (!err && parent != next) {
1804 +- if (ovl_is_inuse(parent)) {
1805 +- err = -EBUSY;
1806 +- pr_err("overlayfs: %s path overlapping in-use upperdir/workdir\n",
1807 +- name);
1808 +- } else if (ovl_lookup_trap_inode(sb, parent)) {
1809 ++ if (ovl_lookup_trap_inode(sb, parent)) {
1810 + err = -ELOOP;
1811 + pr_err("overlayfs: overlapping %s path\n", name);
1812 ++ } else if (ovl_is_inuse(parent)) {
1813 ++ err = ovl_report_in_use(ofs, name);
1814 + }
1815 + next = parent;
1816 + parent = dget_parent(next);
1817 +@@ -1485,7 +1504,8 @@ static int ovl_check_overlapping_layers(struct super_block *sb,
1818 + int i, err;
1819 +
1820 + if (ofs->upper_mnt) {
1821 +- err = ovl_check_layer(sb, ofs->upper_mnt->mnt_root, "upperdir");
1822 ++ err = ovl_check_layer(sb, ofs, ofs->upper_mnt->mnt_root,
1823 ++ "upperdir");
1824 + if (err)
1825 + return err;
1826 +
1827 +@@ -1496,13 +1516,14 @@ static int ovl_check_overlapping_layers(struct super_block *sb,
1828 + * workbasedir. In that case, we already have their traps in
1829 + * inode cache and we will catch that case on lookup.
1830 + */
1831 +- err = ovl_check_layer(sb, ofs->workbasedir, "workdir");
1832 ++ err = ovl_check_layer(sb, ofs, ofs->workbasedir, "workdir");
1833 + if (err)
1834 + return err;
1835 + }
1836 +
1837 + for (i = 0; i < ofs->numlower; i++) {
1838 +- err = ovl_check_layer(sb, ofs->lower_layers[i].mnt->mnt_root,
1839 ++ err = ovl_check_layer(sb, ofs,
1840 ++ ofs->lower_layers[i].mnt->mnt_root,
1841 + "lowerdir");
1842 + if (err)
1843 + return err;
1844 +diff --git a/include/net/sock_reuseport.h b/include/net/sock_reuseport.h
1845 +index 8a5f70c7cdf2..5e69fba181bc 100644
1846 +--- a/include/net/sock_reuseport.h
1847 ++++ b/include/net/sock_reuseport.h
1848 +@@ -21,7 +21,8 @@ struct sock_reuseport {
1849 + unsigned int synq_overflow_ts;
1850 + /* ID stays the same even after the size of socks[] grows. */
1851 + unsigned int reuseport_id;
1852 +- bool bind_inany;
1853 ++ unsigned int bind_inany:1;
1854 ++ unsigned int has_conns:1;
1855 + struct bpf_prog __rcu *prog; /* optional BPF sock selector */
1856 + struct sock *socks[0]; /* array of sock pointers */
1857 + };
1858 +@@ -35,6 +36,24 @@ extern struct sock *reuseport_select_sock(struct sock *sk,
1859 + struct sk_buff *skb,
1860 + int hdr_len);
1861 + extern int reuseport_attach_prog(struct sock *sk, struct bpf_prog *prog);
1862 ++
1863 ++static inline bool reuseport_has_conns(struct sock *sk, bool set)
1864 ++{
1865 ++ struct sock_reuseport *reuse;
1866 ++ bool ret = false;
1867 ++
1868 ++ rcu_read_lock();
1869 ++ reuse = rcu_dereference(sk->sk_reuseport_cb);
1870 ++ if (reuse) {
1871 ++ if (set)
1872 ++ reuse->has_conns = 1;
1873 ++ ret = reuse->has_conns;
1874 ++ }
1875 ++ rcu_read_unlock();
1876 ++
1877 ++ return ret;
1878 ++}
1879 ++
1880 + int reuseport_get_id(struct sock_reuseport *reuse);
1881 +
1882 + #endif /* _SOCK_REUSEPORT_H */
1883 +diff --git a/include/uapi/linux/netfilter/xt_nfacct.h b/include/uapi/linux/netfilter/xt_nfacct.h
1884 +index 5c8a4d760ee3..b5123ab8d54a 100644
1885 +--- a/include/uapi/linux/netfilter/xt_nfacct.h
1886 ++++ b/include/uapi/linux/netfilter/xt_nfacct.h
1887 +@@ -11,4 +11,9 @@ struct xt_nfacct_match_info {
1888 + struct nf_acct *nfacct;
1889 + };
1890 +
1891 ++struct xt_nfacct_match_info_v1 {
1892 ++ char name[NFACCT_NAME_MAX];
1893 ++ struct nf_acct *nfacct __attribute__((aligned(8)));
1894 ++};
1895 ++
1896 + #endif /* _XT_NFACCT_MATCH_H */
1897 +diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
1898 +index 02a0b01380d8..ed87dac8378c 100644
1899 +--- a/kernel/kallsyms.c
1900 ++++ b/kernel/kallsyms.c
1901 +@@ -262,8 +262,10 @@ int kallsyms_lookup_size_offset(unsigned long addr, unsigned long *symbolsize,
1902 + {
1903 + char namebuf[KSYM_NAME_LEN];
1904 +
1905 +- if (is_ksym_addr(addr))
1906 +- return !!get_symbol_pos(addr, symbolsize, offset);
1907 ++ if (is_ksym_addr(addr)) {
1908 ++ get_symbol_pos(addr, symbolsize, offset);
1909 ++ return 1;
1910 ++ }
1911 + return !!module_address_lookup(addr, symbolsize, offset, NULL, namebuf) ||
1912 + !!__bpf_address_lookup(addr, symbolsize, offset, namebuf);
1913 + }
1914 +diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c
1915 +index 2948b41b06d4..d241ccc0ca02 100644
1916 +--- a/net/batman-adv/bat_v_ogm.c
1917 ++++ b/net/batman-adv/bat_v_ogm.c
1918 +@@ -643,17 +643,23 @@ batadv_v_ogm_process_per_outif(struct batadv_priv *bat_priv,
1919 + * batadv_v_ogm_aggr_packet() - checks if there is another OGM aggregated
1920 + * @buff_pos: current position in the skb
1921 + * @packet_len: total length of the skb
1922 +- * @tvlv_len: tvlv length of the previously considered OGM
1923 ++ * @ogm2_packet: potential OGM2 in buffer
1924 + *
1925 + * Return: true if there is enough space for another OGM, false otherwise.
1926 + */
1927 +-static bool batadv_v_ogm_aggr_packet(int buff_pos, int packet_len,
1928 +- __be16 tvlv_len)
1929 ++static bool
1930 ++batadv_v_ogm_aggr_packet(int buff_pos, int packet_len,
1931 ++ const struct batadv_ogm2_packet *ogm2_packet)
1932 + {
1933 + int next_buff_pos = 0;
1934 +
1935 +- next_buff_pos += buff_pos + BATADV_OGM2_HLEN;
1936 +- next_buff_pos += ntohs(tvlv_len);
1937 ++ /* check if there is enough space for the header */
1938 ++ next_buff_pos += buff_pos + sizeof(*ogm2_packet);
1939 ++ if (next_buff_pos > packet_len)
1940 ++ return false;
1941 ++
1942 ++ /* check if there is enough space for the optional TVLV */
1943 ++ next_buff_pos += ntohs(ogm2_packet->tvlv_len);
1944 +
1945 + return (next_buff_pos <= packet_len) &&
1946 + (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES);
1947 +@@ -830,7 +836,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
1948 + ogm_packet = (struct batadv_ogm2_packet *)skb->data;
1949 +
1950 + while (batadv_v_ogm_aggr_packet(ogm_offset, skb_headlen(skb),
1951 +- ogm_packet->tvlv_len)) {
1952 ++ ogm_packet)) {
1953 + batadv_v_ogm_process(skb, ogm_offset, if_incoming);
1954 +
1955 + ogm_offset += BATADV_OGM2_HLEN;
1956 +diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
1957 +index 62ffc989a44a..7d249afa1466 100644
1958 +--- a/net/bridge/netfilter/ebtables.c
1959 ++++ b/net/bridge/netfilter/ebtables.c
1960 +@@ -225,7 +225,7 @@ unsigned int ebt_do_table(struct sk_buff *skb,
1961 + return NF_DROP;
1962 + }
1963 +
1964 +- ADD_COUNTER(*(counter_base + i), 1, skb->len);
1965 ++ ADD_COUNTER(*(counter_base + i), skb->len, 1);
1966 +
1967 + /* these should only watch: not modify, nor tell us
1968 + * what to do with the packet
1969 +@@ -963,8 +963,8 @@ static void get_counters(const struct ebt_counter *oldcounters,
1970 + continue;
1971 + counter_base = COUNTER_BASE(oldcounters, nentries, cpu);
1972 + for (i = 0; i < nentries; i++)
1973 +- ADD_COUNTER(counters[i], counter_base[i].pcnt,
1974 +- counter_base[i].bcnt);
1975 ++ ADD_COUNTER(counters[i], counter_base[i].bcnt,
1976 ++ counter_base[i].pcnt);
1977 + }
1978 + }
1979 +
1980 +@@ -1289,7 +1289,7 @@ static int do_update_counters(struct net *net, const char *name,
1981 +
1982 + /* we add to the counters of the first cpu */
1983 + for (i = 0; i < num_counters; i++)
1984 +- ADD_COUNTER(t->private->counters[i], tmp[i].pcnt, tmp[i].bcnt);
1985 ++ ADD_COUNTER(t->private->counters[i], tmp[i].bcnt, tmp[i].pcnt);
1986 +
1987 + write_unlock_bh(&t->lock);
1988 + ret = 0;
1989 +diff --git a/net/core/filter.c b/net/core/filter.c
1990 +index c996380f2959..e6fa88506c00 100644
1991 +--- a/net/core/filter.c
1992 ++++ b/net/core/filter.c
1993 +@@ -7234,13 +7234,13 @@ sk_reuseport_is_valid_access(int off, int size,
1994 + return size == size_default;
1995 +
1996 + /* Fields that allow narrowing */
1997 +- case offsetof(struct sk_reuseport_md, eth_protocol):
1998 ++ case bpf_ctx_range(struct sk_reuseport_md, eth_protocol):
1999 + if (size < FIELD_SIZEOF(struct sk_buff, protocol))
2000 + return false;
2001 + /* fall through */
2002 +- case offsetof(struct sk_reuseport_md, ip_protocol):
2003 +- case offsetof(struct sk_reuseport_md, bind_inany):
2004 +- case offsetof(struct sk_reuseport_md, len):
2005 ++ case bpf_ctx_range(struct sk_reuseport_md, ip_protocol):
2006 ++ case bpf_ctx_range(struct sk_reuseport_md, bind_inany):
2007 ++ case bpf_ctx_range(struct sk_reuseport_md, len):
2008 + bpf_ctx_record_field_size(info, size_default);
2009 + return bpf_ctx_narrow_access_ok(off, size, size_default);
2010 +
2011 +diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c
2012 +index ba5cba56f574..fd38cf1d2b02 100644
2013 +--- a/net/core/sock_reuseport.c
2014 ++++ b/net/core/sock_reuseport.c
2015 +@@ -292,8 +292,19 @@ struct sock *reuseport_select_sock(struct sock *sk,
2016 +
2017 + select_by_hash:
2018 + /* no bpf or invalid bpf result: fall back to hash usage */
2019 +- if (!sk2)
2020 +- sk2 = reuse->socks[reciprocal_scale(hash, socks)];
2021 ++ if (!sk2) {
2022 ++ int i, j;
2023 ++
2024 ++ i = j = reciprocal_scale(hash, socks);
2025 ++ while (reuse->socks[i]->sk_state == TCP_ESTABLISHED) {
2026 ++ i++;
2027 ++ if (i >= reuse->num_socks)
2028 ++ i = 0;
2029 ++ if (i == j)
2030 ++ goto out;
2031 ++ }
2032 ++ sk2 = reuse->socks[i];
2033 ++ }
2034 + }
2035 +
2036 + out:
2037 +diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c
2038 +index f915abff1350..80107a6a2c4a 100644
2039 +--- a/net/ipv4/datagram.c
2040 ++++ b/net/ipv4/datagram.c
2041 +@@ -19,6 +19,7 @@
2042 + #include <net/sock.h>
2043 + #include <net/route.h>
2044 + #include <net/tcp_states.h>
2045 ++#include <net/sock_reuseport.h>
2046 +
2047 + int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
2048 + {
2049 +@@ -73,6 +74,7 @@ int __ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len
2050 + }
2051 + inet->inet_daddr = fl4->daddr;
2052 + inet->inet_dport = usin->sin_port;
2053 ++ reuseport_has_conns(sk, true);
2054 + sk->sk_state = TCP_ESTABLISHED;
2055 + sk_set_txhash(sk);
2056 + inet->inet_id = jiffies;
2057 +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
2058 +index 6ab68b06fa39..2085fc0046de 100644
2059 +--- a/net/ipv4/udp.c
2060 ++++ b/net/ipv4/udp.c
2061 +@@ -443,12 +443,13 @@ static struct sock *udp4_lib_lookup2(struct net *net,
2062 + score = compute_score(sk, net, saddr, sport,
2063 + daddr, hnum, dif, sdif, exact_dif);
2064 + if (score > badness) {
2065 +- if (sk->sk_reuseport) {
2066 ++ if (sk->sk_reuseport &&
2067 ++ sk->sk_state != TCP_ESTABLISHED) {
2068 + hash = udp_ehashfn(net, daddr, hnum,
2069 + saddr, sport);
2070 + result = reuseport_select_sock(sk, hash, skb,
2071 + sizeof(struct udphdr));
2072 +- if (result)
2073 ++ if (result && !reuseport_has_conns(sk, false))
2074 + return result;
2075 + }
2076 + badness = score;
2077 +diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
2078 +index cb24850d2c7f..971a0fdf1fbc 100644
2079 +--- a/net/ipv6/datagram.c
2080 ++++ b/net/ipv6/datagram.c
2081 +@@ -31,6 +31,7 @@
2082 + #include <net/ip6_route.h>
2083 + #include <net/tcp_states.h>
2084 + #include <net/dsfield.h>
2085 ++#include <net/sock_reuseport.h>
2086 +
2087 + #include <linux/errqueue.h>
2088 + #include <linux/uaccess.h>
2089 +@@ -258,6 +259,7 @@ ipv4_connected:
2090 + goto out;
2091 + }
2092 +
2093 ++ reuseport_has_conns(sk, true);
2094 + sk->sk_state = TCP_ESTABLISHED;
2095 + sk_set_txhash(sk);
2096 + out:
2097 +diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
2098 +index a53ef079a539..a23516e22056 100644
2099 +--- a/net/ipv6/ip6_gre.c
2100 ++++ b/net/ipv6/ip6_gre.c
2101 +@@ -988,7 +988,7 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
2102 + if (unlikely(!tun_info ||
2103 + !(tun_info->mode & IP_TUNNEL_INFO_TX) ||
2104 + ip_tunnel_info_af(tun_info) != AF_INET6))
2105 +- return -EINVAL;
2106 ++ goto tx_err;
2107 +
2108 + key = &tun_info->key;
2109 + memset(&fl6, 0, sizeof(fl6));
2110 +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2111 +index 164f1d01273c..3a27c04ff62f 100644
2112 +--- a/net/ipv6/udp.c
2113 ++++ b/net/ipv6/udp.c
2114 +@@ -177,13 +177,14 @@ static struct sock *udp6_lib_lookup2(struct net *net,
2115 + score = compute_score(sk, net, saddr, sport,
2116 + daddr, hnum, dif, sdif, exact_dif);
2117 + if (score > badness) {
2118 +- if (sk->sk_reuseport) {
2119 ++ if (sk->sk_reuseport &&
2120 ++ sk->sk_state != TCP_ESTABLISHED) {
2121 + hash = udp6_ehashfn(net, daddr, hnum,
2122 + saddr, sport);
2123 +
2124 + result = reuseport_select_sock(sk, hash, skb,
2125 + sizeof(struct udphdr));
2126 +- if (result)
2127 ++ if (result && !reuseport_has_conns(sk, false))
2128 + return result;
2129 + }
2130 + result = sk;
2131 +diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
2132 +index a11c304fb771..efc14c7b4f8e 100644
2133 +--- a/net/netfilter/nf_conntrack_ftp.c
2134 ++++ b/net/netfilter/nf_conntrack_ftp.c
2135 +@@ -323,7 +323,7 @@ static int find_pattern(const char *data, size_t dlen,
2136 + i++;
2137 + }
2138 +
2139 +- pr_debug("Skipped up to `%c'!\n", skip);
2140 ++ pr_debug("Skipped up to 0x%hhx delimiter!\n", skip);
2141 +
2142 + *numoff = i;
2143 + *numlen = getnum(data + i, dlen - i, cmd, term, numoff);
2144 +diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
2145 +index 5df7486bb416..8ade40512944 100644
2146 +--- a/net/netfilter/nf_flow_table_core.c
2147 ++++ b/net/netfilter/nf_flow_table_core.c
2148 +@@ -203,7 +203,7 @@ int flow_offload_add(struct nf_flowtable *flow_table, struct flow_offload *flow)
2149 + return err;
2150 + }
2151 +
2152 +- flow->timeout = (u32)jiffies;
2153 ++ flow->timeout = (u32)jiffies + NF_FLOW_TIMEOUT;
2154 + return 0;
2155 + }
2156 + EXPORT_SYMBOL_GPL(flow_offload_add);
2157 +diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c
2158 +index 69decbe2c988..1ef8cb789c41 100644
2159 +--- a/net/netfilter/nft_flow_offload.c
2160 ++++ b/net/netfilter/nft_flow_offload.c
2161 +@@ -149,6 +149,11 @@ static int nft_flow_offload_validate(const struct nft_ctx *ctx,
2162 + return nft_chain_validate_hooks(ctx->chain, hook_mask);
2163 + }
2164 +
2165 ++static const struct nla_policy nft_flow_offload_policy[NFTA_FLOW_MAX + 1] = {
2166 ++ [NFTA_FLOW_TABLE_NAME] = { .type = NLA_STRING,
2167 ++ .len = NFT_NAME_MAXLEN - 1 },
2168 ++};
2169 ++
2170 + static int nft_flow_offload_init(const struct nft_ctx *ctx,
2171 + const struct nft_expr *expr,
2172 + const struct nlattr * const tb[])
2173 +@@ -207,6 +212,7 @@ static const struct nft_expr_ops nft_flow_offload_ops = {
2174 + static struct nft_expr_type nft_flow_offload_type __read_mostly = {
2175 + .name = "flow_offload",
2176 + .ops = &nft_flow_offload_ops,
2177 ++ .policy = nft_flow_offload_policy,
2178 + .maxattr = NFTA_FLOW_MAX,
2179 + .owner = THIS_MODULE,
2180 + };
2181 +diff --git a/net/netfilter/xt_nfacct.c b/net/netfilter/xt_nfacct.c
2182 +index 6b56f4170860..3241fee9f2a1 100644
2183 +--- a/net/netfilter/xt_nfacct.c
2184 ++++ b/net/netfilter/xt_nfacct.c
2185 +@@ -57,25 +57,39 @@ nfacct_mt_destroy(const struct xt_mtdtor_param *par)
2186 + nfnl_acct_put(info->nfacct);
2187 + }
2188 +
2189 +-static struct xt_match nfacct_mt_reg __read_mostly = {
2190 +- .name = "nfacct",
2191 +- .family = NFPROTO_UNSPEC,
2192 +- .checkentry = nfacct_mt_checkentry,
2193 +- .match = nfacct_mt,
2194 +- .destroy = nfacct_mt_destroy,
2195 +- .matchsize = sizeof(struct xt_nfacct_match_info),
2196 +- .usersize = offsetof(struct xt_nfacct_match_info, nfacct),
2197 +- .me = THIS_MODULE,
2198 ++static struct xt_match nfacct_mt_reg[] __read_mostly = {
2199 ++ {
2200 ++ .name = "nfacct",
2201 ++ .revision = 0,
2202 ++ .family = NFPROTO_UNSPEC,
2203 ++ .checkentry = nfacct_mt_checkentry,
2204 ++ .match = nfacct_mt,
2205 ++ .destroy = nfacct_mt_destroy,
2206 ++ .matchsize = sizeof(struct xt_nfacct_match_info),
2207 ++ .usersize = offsetof(struct xt_nfacct_match_info, nfacct),
2208 ++ .me = THIS_MODULE,
2209 ++ },
2210 ++ {
2211 ++ .name = "nfacct",
2212 ++ .revision = 1,
2213 ++ .family = NFPROTO_UNSPEC,
2214 ++ .checkentry = nfacct_mt_checkentry,
2215 ++ .match = nfacct_mt,
2216 ++ .destroy = nfacct_mt_destroy,
2217 ++ .matchsize = sizeof(struct xt_nfacct_match_info_v1),
2218 ++ .usersize = offsetof(struct xt_nfacct_match_info_v1, nfacct),
2219 ++ .me = THIS_MODULE,
2220 ++ },
2221 + };
2222 +
2223 + static int __init nfacct_mt_init(void)
2224 + {
2225 +- return xt_register_match(&nfacct_mt_reg);
2226 ++ return xt_register_matches(nfacct_mt_reg, ARRAY_SIZE(nfacct_mt_reg));
2227 + }
2228 +
2229 + static void __exit nfacct_mt_exit(void)
2230 + {
2231 +- xt_unregister_match(&nfacct_mt_reg);
2232 ++ xt_unregister_matches(nfacct_mt_reg, ARRAY_SIZE(nfacct_mt_reg));
2233 + }
2234 +
2235 + module_init(nfacct_mt_init);
2236 +diff --git a/net/netfilter/xt_physdev.c b/net/netfilter/xt_physdev.c
2237 +index 05f00fb20b04..cd15ea79e3e2 100644
2238 +--- a/net/netfilter/xt_physdev.c
2239 ++++ b/net/netfilter/xt_physdev.c
2240 +@@ -104,11 +104,9 @@ static int physdev_mt_check(const struct xt_mtchk_param *par)
2241 + if (info->bitmask & (XT_PHYSDEV_OP_OUT | XT_PHYSDEV_OP_ISOUT) &&
2242 + (!(info->bitmask & XT_PHYSDEV_OP_BRIDGED) ||
2243 + info->invert & XT_PHYSDEV_OP_BRIDGED) &&
2244 +- par->hook_mask & ((1 << NF_INET_LOCAL_OUT) |
2245 +- (1 << NF_INET_FORWARD) | (1 << NF_INET_POST_ROUTING))) {
2246 ++ par->hook_mask & (1 << NF_INET_LOCAL_OUT)) {
2247 + pr_info_ratelimited("--physdev-out and --physdev-is-out only supported in the FORWARD and POSTROUTING chains with bridged traffic\n");
2248 +- if (par->hook_mask & (1 << NF_INET_LOCAL_OUT))
2249 +- return -EINVAL;
2250 ++ return -EINVAL;
2251 + }
2252 +
2253 + if (!brnf_probed) {
2254 +diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
2255 +index 875f521bce0d..30e32df5f84a 100644
2256 +--- a/net/sched/sch_generic.c
2257 ++++ b/net/sched/sch_generic.c
2258 +@@ -947,9 +947,13 @@ void qdisc_free(struct Qdisc *qdisc)
2259 +
2260 + void qdisc_destroy(struct Qdisc *qdisc)
2261 + {
2262 +- const struct Qdisc_ops *ops = qdisc->ops;
2263 ++ const struct Qdisc_ops *ops;
2264 + struct sk_buff *skb, *tmp;
2265 +
2266 ++ if (!qdisc)
2267 ++ return;
2268 ++ ops = qdisc->ops;
2269 ++
2270 + if (qdisc->flags & TCQ_F_BUILTIN ||
2271 + !refcount_dec_and_test(&qdisc->refcnt))
2272 + return;
2273 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2274 +index 2a85bff6a8f3..6168db3c35e4 100644
2275 +--- a/net/wireless/nl80211.c
2276 ++++ b/net/wireless/nl80211.c
2277 +@@ -10270,9 +10270,11 @@ static int cfg80211_cqm_rssi_update(struct cfg80211_registered_device *rdev,
2278 + hyst = wdev->cqm_config->rssi_hyst;
2279 + n = wdev->cqm_config->n_rssi_thresholds;
2280 +
2281 +- for (i = 0; i < n; i++)
2282 ++ for (i = 0; i < n; i++) {
2283 ++ i = array_index_nospec(i, n);
2284 + if (last < wdev->cqm_config->rssi_thresholds[i])
2285 + break;
2286 ++ }
2287 +
2288 + low_index = i - 1;
2289 + if (low_index >= 0) {
2290 +diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
2291 +index a3b037fbfecd..8cab91c482ff 100644
2292 +--- a/net/xdp/xdp_umem.c
2293 ++++ b/net/xdp/xdp_umem.c
2294 +@@ -322,7 +322,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
2295 + umem->pages = kcalloc(umem->npgs, sizeof(*umem->pages), GFP_KERNEL);
2296 + if (!umem->pages) {
2297 + err = -ENOMEM;
2298 +- goto out_account;
2299 ++ goto out_pin;
2300 + }
2301 +
2302 + for (i = 0; i < umem->npgs; i++)
2303 +@@ -330,6 +330,8 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
2304 +
2305 + return 0;
2306 +
2307 ++out_pin:
2308 ++ xdp_umem_unpin_pages(umem);
2309 + out_account:
2310 + xdp_umem_unaccount_pages(umem);
2311 + return err;
2312 +diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
2313 +index 5e515791ccd1..1d34b2a5f485 100644
2314 +--- a/security/keys/request_key_auth.c
2315 ++++ b/security/keys/request_key_auth.c
2316 +@@ -71,6 +71,9 @@ static void request_key_auth_describe(const struct key *key,
2317 + {
2318 + struct request_key_auth *rka = get_request_key_auth(key);
2319 +
2320 ++ if (!rka)
2321 ++ return;
2322 ++
2323 + seq_puts(m, "key:");
2324 + seq_puts(m, key->description);
2325 + if (key_is_positive(key))
2326 +@@ -88,6 +91,9 @@ static long request_key_auth_read(const struct key *key,
2327 + size_t datalen;
2328 + long ret;
2329 +
2330 ++ if (!rka)
2331 ++ return -EKEYREVOKED;
2332 ++
2333 + datalen = rka->callout_len;
2334 + ret = datalen;
2335 +
2336 +diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
2337 +index bbba0d61570f..4f9611af4642 100644
2338 +--- a/tools/bpf/bpftool/prog.c
2339 ++++ b/tools/bpf/bpftool/prog.c
2340 +@@ -381,7 +381,9 @@ static int do_show(int argc, char **argv)
2341 + if (fd < 0)
2342 + return -1;
2343 +
2344 +- return show_prog(fd);
2345 ++ err = show_prog(fd);
2346 ++ close(fd);
2347 ++ return err;
2348 + }
2349 +
2350 + if (argc)
2351 +diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
2352 +index fbb53c952b73..71cf7e77291a 100644
2353 +--- a/tools/power/x86/turbostat/turbostat.c
2354 ++++ b/tools/power/x86/turbostat/turbostat.c
2355 +@@ -4953,7 +4953,7 @@ int initialize_counters(int cpu_id)
2356 +
2357 + void allocate_output_buffer()
2358 + {
2359 +- output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
2360 ++ output_buffer = calloc(1, (1 + topo.num_cpus) * 2048);
2361 + outp = output_buffer;
2362 + if (outp == NULL)
2363 + err(-1, "calloc output buffer");
2364 +diff --git a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
2365 +index 65bbe627a425..2aba622d1c5a 100644
2366 +--- a/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
2367 ++++ b/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy.c
2368 +@@ -546,7 +546,7 @@ void cmdline(int argc, char **argv)
2369 +
2370 + progname = argv[0];
2371 +
2372 +- while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw",
2373 ++ while ((opt = getopt_long_only(argc, argv, "+a:c:dD:E:e:f:m:M:rt:u:vw:",
2374 + long_options, &option_index)) != -1) {
2375 + switch (opt) {
2376 + case 'a':
2377 +@@ -1260,6 +1260,15 @@ void probe_dev_msr(void)
2378 + if (system("/sbin/modprobe msr > /dev/null 2>&1"))
2379 + err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" ");
2380 + }
2381 ++
2382 ++static void get_cpuid_or_exit(unsigned int leaf,
2383 ++ unsigned int *eax, unsigned int *ebx,
2384 ++ unsigned int *ecx, unsigned int *edx)
2385 ++{
2386 ++ if (!__get_cpuid(leaf, eax, ebx, ecx, edx))
2387 ++ errx(1, "Processor not supported\n");
2388 ++}
2389 ++
2390 + /*
2391 + * early_cpuid()
2392 + * initialize turbo_is_enabled, has_hwp, has_epb
2393 +@@ -1267,15 +1276,10 @@ void probe_dev_msr(void)
2394 + */
2395 + void early_cpuid(void)
2396 + {
2397 +- unsigned int eax, ebx, ecx, edx, max_level;
2398 ++ unsigned int eax, ebx, ecx, edx;
2399 + unsigned int fms, family, model;
2400 +
2401 +- __get_cpuid(0, &max_level, &ebx, &ecx, &edx);
2402 +-
2403 +- if (max_level < 6)
2404 +- errx(1, "Processor not supported\n");
2405 +-
2406 +- __get_cpuid(1, &fms, &ebx, &ecx, &edx);
2407 ++ get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx);
2408 + family = (fms >> 8) & 0xf;
2409 + model = (fms >> 4) & 0xf;
2410 + if (family == 6 || family == 0xf)
2411 +@@ -1289,7 +1293,7 @@ void early_cpuid(void)
2412 + bdx_highest_ratio = msr & 0xFF;
2413 + }
2414 +
2415 +- __get_cpuid(0x6, &eax, &ebx, &ecx, &edx);
2416 ++ get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx);
2417 + turbo_is_enabled = (eax >> 1) & 1;
2418 + has_hwp = (eax >> 7) & 1;
2419 + has_epb = (ecx >> 3) & 1;
2420 +@@ -1307,7 +1311,7 @@ void parse_cpuid(void)
2421 +
2422 + eax = ebx = ecx = edx = 0;
2423 +
2424 +- __get_cpuid(0, &max_level, &ebx, &ecx, &edx);
2425 ++ get_cpuid_or_exit(0, &max_level, &ebx, &ecx, &edx);
2426 +
2427 + if (ebx == 0x756e6547 && edx == 0x49656e69 && ecx == 0x6c65746e)
2428 + genuine_intel = 1;
2429 +@@ -1316,7 +1320,7 @@ void parse_cpuid(void)
2430 + fprintf(stderr, "CPUID(0): %.4s%.4s%.4s ",
2431 + (char *)&ebx, (char *)&edx, (char *)&ecx);
2432 +
2433 +- __get_cpuid(1, &fms, &ebx, &ecx, &edx);
2434 ++ get_cpuid_or_exit(1, &fms, &ebx, &ecx, &edx);
2435 + family = (fms >> 8) & 0xf;
2436 + model = (fms >> 4) & 0xf;
2437 + stepping = fms & 0xf;
2438 +@@ -1341,7 +1345,7 @@ void parse_cpuid(void)
2439 + errx(1, "CPUID: no MSR");
2440 +
2441 +
2442 +- __get_cpuid(0x6, &eax, &ebx, &ecx, &edx);
2443 ++ get_cpuid_or_exit(0x6, &eax, &ebx, &ecx, &edx);
2444 + /* turbo_is_enabled already set */
2445 + /* has_hwp already set */
2446 + has_hwp_notify = eax & (1 << 8);
2447 +diff --git a/tools/testing/selftests/bpf/test_sock.c b/tools/testing/selftests/bpf/test_sock.c
2448 +index b8ebe2f58074..e9567122070a 100644
2449 +--- a/tools/testing/selftests/bpf/test_sock.c
2450 ++++ b/tools/testing/selftests/bpf/test_sock.c
2451 +@@ -13,6 +13,7 @@
2452 + #include <bpf/bpf.h>
2453 +
2454 + #include "cgroup_helpers.h"
2455 ++#include "bpf_endian.h"
2456 + #include "bpf_rlimit.h"
2457 + #include "bpf_util.h"
2458 +
2459 +@@ -231,7 +232,8 @@ static struct sock_test tests[] = {
2460 + /* if (ip == expected && port == expected) */
2461 + BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_6,
2462 + offsetof(struct bpf_sock, src_ip6[3])),
2463 +- BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0x01000000, 4),
2464 ++ BPF_JMP_IMM(BPF_JNE, BPF_REG_7,
2465 ++ __bpf_constant_ntohl(0x00000001), 4),
2466 + BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_6,
2467 + offsetof(struct bpf_sock, src_port)),
2468 + BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0x2001, 2),
2469 +@@ -260,7 +262,8 @@ static struct sock_test tests[] = {
2470 + /* if (ip == expected && port == expected) */
2471 + BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_6,
2472 + offsetof(struct bpf_sock, src_ip4)),
2473 +- BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0x0100007F, 4),
2474 ++ BPF_JMP_IMM(BPF_JNE, BPF_REG_7,
2475 ++ __bpf_constant_ntohl(0x7F000001), 4),
2476 + BPF_LDX_MEM(BPF_W, BPF_REG_7, BPF_REG_6,
2477 + offsetof(struct bpf_sock, src_port)),
2478 + BPF_JMP_IMM(BPF_JNE, BPF_REG_7, 0x1002, 2),
2479 +diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
2480 +index 9e65feb6fa58..b9336693c87e 100644
2481 +--- a/virt/kvm/coalesced_mmio.c
2482 ++++ b/virt/kvm/coalesced_mmio.c
2483 +@@ -40,7 +40,7 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
2484 + return 1;
2485 + }
2486 +
2487 +-static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev)
2488 ++static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
2489 + {
2490 + struct kvm_coalesced_mmio_ring *ring;
2491 + unsigned avail;
2492 +@@ -52,7 +52,7 @@ static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev)
2493 + * there is always one unused entry in the buffer
2494 + */
2495 + ring = dev->kvm->coalesced_mmio_ring;
2496 +- avail = (ring->first - ring->last - 1) % KVM_COALESCED_MMIO_MAX;
2497 ++ avail = (ring->first - last - 1) % KVM_COALESCED_MMIO_MAX;
2498 + if (avail == 0) {
2499 + /* full */
2500 + return 0;
2501 +@@ -67,24 +67,27 @@ static int coalesced_mmio_write(struct kvm_vcpu *vcpu,
2502 + {
2503 + struct kvm_coalesced_mmio_dev *dev = to_mmio(this);
2504 + struct kvm_coalesced_mmio_ring *ring = dev->kvm->coalesced_mmio_ring;
2505 ++ __u32 insert;
2506 +
2507 + if (!coalesced_mmio_in_range(dev, addr, len))
2508 + return -EOPNOTSUPP;
2509 +
2510 + spin_lock(&dev->kvm->ring_lock);
2511 +
2512 +- if (!coalesced_mmio_has_room(dev)) {
2513 ++ insert = READ_ONCE(ring->last);
2514 ++ if (!coalesced_mmio_has_room(dev, insert) ||
2515 ++ insert >= KVM_COALESCED_MMIO_MAX) {
2516 + spin_unlock(&dev->kvm->ring_lock);
2517 + return -EOPNOTSUPP;
2518 + }
2519 +
2520 + /* copy data in first free entry of the ring */
2521 +
2522 +- ring->coalesced_mmio[ring->last].phys_addr = addr;
2523 +- ring->coalesced_mmio[ring->last].len = len;
2524 +- memcpy(ring->coalesced_mmio[ring->last].data, val, len);
2525 ++ ring->coalesced_mmio[insert].phys_addr = addr;
2526 ++ ring->coalesced_mmio[insert].len = len;
2527 ++ memcpy(ring->coalesced_mmio[insert].data, val, len);
2528 + smp_wmb();
2529 +- ring->last = (ring->last + 1) % KVM_COALESCED_MMIO_MAX;
2530 ++ ring->last = (insert + 1) % KVM_COALESCED_MMIO_MAX;
2531 + spin_unlock(&dev->kvm->ring_lock);
2532 + return 0;
2533 + }