Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.14 commit in: /
Date: Sat, 15 Sep 2018 10:12:05
Message-Id: 1537006310.058a26df642340dd4e261fa7133624380b7bee50.mpagano@gentoo
1 commit: 058a26df642340dd4e261fa7133624380b7bee50
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 15 10:11:50 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 15 10:11:50 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=058a26df
7
8 Linux patch 4.14.70
9
10 0000_README | 4 +
11 1069_linux-4.14.70.patch | 3428 ++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 3432 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index 2a8e1bb..2e98e70 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -319,6 +319,10 @@ Patch: 1068_linux-4.14.69.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.14.69
21
22 +Patch: 1069_linux-4.14.70.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.14.70
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1069_linux-4.14.70.patch b/1069_linux-4.14.70.patch
31 new file mode 100644
32 index 0000000..8091deb
33 --- /dev/null
34 +++ b/1069_linux-4.14.70.patch
35 @@ -0,0 +1,3428 @@
36 +diff --git a/Makefile b/Makefile
37 +index 3ecda1d2e23a..aa458afa7fa2 100644
38 +--- a/Makefile
39 ++++ b/Makefile
40 +@@ -1,7 +1,7 @@
41 + # SPDX-License-Identifier: GPL-2.0
42 + VERSION = 4
43 + PATCHLEVEL = 14
44 +-SUBLEVEL = 69
45 ++SUBLEVEL = 70
46 + EXTRAVERSION =
47 + NAME = Petit Gorille
48 +
49 +diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
50 +index 21ac9f02407e..32acac9ab81a 100644
51 +--- a/arch/arm/configs/imx_v6_v7_defconfig
52 ++++ b/arch/arm/configs/imx_v6_v7_defconfig
53 +@@ -289,7 +289,6 @@ CONFIG_USB_STORAGE=y
54 + CONFIG_USB_CHIPIDEA=y
55 + CONFIG_USB_CHIPIDEA_UDC=y
56 + CONFIG_USB_CHIPIDEA_HOST=y
57 +-CONFIG_USB_CHIPIDEA_ULPI=y
58 + CONFIG_USB_SERIAL=m
59 + CONFIG_USB_SERIAL_GENERIC=y
60 + CONFIG_USB_SERIAL_FTDI_SIO=m
61 +@@ -326,7 +325,6 @@ CONFIG_USB_GADGETFS=m
62 + CONFIG_USB_FUNCTIONFS=m
63 + CONFIG_USB_MASS_STORAGE=m
64 + CONFIG_USB_G_SERIAL=m
65 +-CONFIG_USB_ULPI_BUS=y
66 + CONFIG_MMC=y
67 + CONFIG_MMC_SDHCI=y
68 + CONFIG_MMC_SDHCI_PLTFM=y
69 +diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
70 +index a4065966881a..57f0bc4cd9b8 100644
71 +--- a/arch/arm/mach-rockchip/Kconfig
72 ++++ b/arch/arm/mach-rockchip/Kconfig
73 +@@ -18,6 +18,7 @@ config ARCH_ROCKCHIP
74 + select ARM_GLOBAL_TIMER
75 + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
76 + select ZONE_DMA if ARM_LPAE
77 ++ select PM
78 + help
79 + Support for Rockchip's Cortex-A9 Single-to-Quad-Core-SoCs
80 + containing the RK2928, RK30xx and RK31xx series.
81 +diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
82 +index 6b54ee8c1262..456d21542250 100644
83 +--- a/arch/arm64/Kconfig.platforms
84 ++++ b/arch/arm64/Kconfig.platforms
85 +@@ -148,6 +148,7 @@ config ARCH_ROCKCHIP
86 + select GPIOLIB
87 + select PINCTRL
88 + select PINCTRL_ROCKCHIP
89 ++ select PM
90 + select ROCKCHIP_TIMER
91 + help
92 + This enables support for the ARMv8 based Rockchip chipsets,
93 +diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h
94 +index ea9bb4e0e9bb..e40f8a2df545 100644
95 +--- a/arch/arm64/include/asm/cache.h
96 ++++ b/arch/arm64/include/asm/cache.h
97 +@@ -20,9 +20,14 @@
98 +
99 + #define CTR_L1IP_SHIFT 14
100 + #define CTR_L1IP_MASK 3
101 ++#define CTR_DMINLINE_SHIFT 16
102 ++#define CTR_IMINLINE_SHIFT 0
103 + #define CTR_CWG_SHIFT 24
104 + #define CTR_CWG_MASK 15
105 +
106 ++#define CTR_CACHE_MINLINE_MASK \
107 ++ (0xf << CTR_DMINLINE_SHIFT | 0xf << CTR_IMINLINE_SHIFT)
108 ++
109 + #define CTR_L1IP(ctr) (((ctr) >> CTR_L1IP_SHIFT) & CTR_L1IP_MASK)
110 +
111 + #define ICACHE_POLICY_VPIPT 0
112 +diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h
113 +index 76c0d23ca161..7d6425d426ac 100644
114 +--- a/arch/arm64/include/asm/cpucaps.h
115 ++++ b/arch/arm64/include/asm/cpucaps.h
116 +@@ -44,7 +44,8 @@
117 + #define ARM64_HARDEN_BRANCH_PREDICTOR 24
118 + #define ARM64_HARDEN_BP_POST_GUEST_EXIT 25
119 + #define ARM64_SSBD 26
120 ++#define ARM64_MISMATCHED_CACHE_TYPE 27
121 +
122 +-#define ARM64_NCAPS 27
123 ++#define ARM64_NCAPS 28
124 +
125 + #endif /* __ASM_CPUCAPS_H */
126 +diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c
127 +index eccdb28b4a39..3d6d7fae45de 100644
128 +--- a/arch/arm64/kernel/cpu_errata.c
129 ++++ b/arch/arm64/kernel/cpu_errata.c
130 +@@ -16,6 +16,8 @@
131 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
132 + */
133 +
134 ++#include <linux/arm-smccc.h>
135 ++#include <linux/psci.h>
136 + #include <linux/types.h>
137 + #include <asm/cpu.h>
138 + #include <asm/cputype.h>
139 +@@ -45,12 +47,18 @@ is_kryo_midr(const struct arm64_cpu_capabilities *entry, int scope)
140 + }
141 +
142 + static bool
143 +-has_mismatched_cache_line_size(const struct arm64_cpu_capabilities *entry,
144 +- int scope)
145 ++has_mismatched_cache_type(const struct arm64_cpu_capabilities *entry,
146 ++ int scope)
147 + {
148 ++ u64 mask = CTR_CACHE_MINLINE_MASK;
149 ++
150 ++ /* Skip matching the min line sizes for cache type check */
151 ++ if (entry->capability == ARM64_MISMATCHED_CACHE_TYPE)
152 ++ mask ^= arm64_ftr_reg_ctrel0.strict_mask;
153 ++
154 + WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible());
155 +- return (read_cpuid_cachetype() & arm64_ftr_reg_ctrel0.strict_mask) !=
156 +- (arm64_ftr_reg_ctrel0.sys_val & arm64_ftr_reg_ctrel0.strict_mask);
157 ++ return (read_cpuid_cachetype() & mask) !=
158 ++ (arm64_ftr_reg_ctrel0.sys_val & mask);
159 + }
160 +
161 + static int cpu_enable_trap_ctr_access(void *__unused)
162 +@@ -511,7 +519,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = {
163 + {
164 + .desc = "Mismatched cache line size",
165 + .capability = ARM64_MISMATCHED_CACHE_LINE_SIZE,
166 +- .matches = has_mismatched_cache_line_size,
167 ++ .matches = has_mismatched_cache_type,
168 ++ .def_scope = SCOPE_LOCAL_CPU,
169 ++ .enable = cpu_enable_trap_ctr_access,
170 ++ },
171 ++ {
172 ++ .desc = "Mismatched cache type",
173 ++ .capability = ARM64_MISMATCHED_CACHE_TYPE,
174 ++ .matches = has_mismatched_cache_type,
175 + .def_scope = SCOPE_LOCAL_CPU,
176 + .enable = cpu_enable_trap_ctr_access,
177 + },
178 +diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
179 +index 376cf12edf0c..003dd39225a0 100644
180 +--- a/arch/arm64/kernel/cpufeature.c
181 ++++ b/arch/arm64/kernel/cpufeature.c
182 +@@ -180,14 +180,14 @@ static const struct arm64_ftr_bits ftr_ctr[] = {
183 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 28, 1, 1), /* IDC */
184 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 24, 4, 0), /* CWG */
185 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, 20, 4, 0), /* ERG */
186 +- ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 16, 4, 1), /* DminLine */
187 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, CTR_DMINLINE_SHIFT, 4, 1),
188 + /*
189 + * Linux can handle differing I-cache policies. Userspace JITs will
190 + * make use of *minLine.
191 + * If we have differing I-cache policies, report it as the weakest - VIPT.
192 + */
193 + ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_EXACT, 14, 2, ICACHE_POLICY_VIPT), /* L1Ip */
194 +- ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, 0, 4, 0), /* IminLine */
195 ++ ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, CTR_IMINLINE_SHIFT, 4, 0),
196 + ARM64_FTR_END,
197 + };
198 +
199 +diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
200 +index 11f4bd07cce0..565cead12be2 100644
201 +--- a/arch/powerpc/include/asm/uaccess.h
202 ++++ b/arch/powerpc/include/asm/uaccess.h
203 +@@ -223,10 +223,17 @@ do { \
204 + } \
205 + } while (0)
206 +
207 ++/*
208 ++ * This is a type: either unsigned long, if the argument fits into
209 ++ * that type, or otherwise unsigned long long.
210 ++ */
211 ++#define __long_type(x) \
212 ++ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
213 ++
214 + #define __get_user_nocheck(x, ptr, size) \
215 + ({ \
216 + long __gu_err; \
217 +- unsigned long __gu_val; \
218 ++ __long_type(*(ptr)) __gu_val; \
219 + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
220 + __chk_user_ptr(ptr); \
221 + if (!is_kernel_addr((unsigned long)__gu_addr)) \
222 +@@ -239,7 +246,7 @@ do { \
223 + #define __get_user_check(x, ptr, size) \
224 + ({ \
225 + long __gu_err = -EFAULT; \
226 +- unsigned long __gu_val = 0; \
227 ++ __long_type(*(ptr)) __gu_val = 0; \
228 + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
229 + might_fault(); \
230 + if (access_ok(VERIFY_READ, __gu_addr, (size))) \
231 +@@ -251,7 +258,7 @@ do { \
232 + #define __get_user_nosleep(x, ptr, size) \
233 + ({ \
234 + long __gu_err; \
235 +- unsigned long __gu_val; \
236 ++ __long_type(*(ptr)) __gu_val; \
237 + const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
238 + __chk_user_ptr(ptr); \
239 + __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
240 +diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
241 +index c09f0a6f8495..f65bb53df43b 100644
242 +--- a/arch/powerpc/kernel/exceptions-64s.S
243 ++++ b/arch/powerpc/kernel/exceptions-64s.S
244 +@@ -1452,6 +1452,8 @@ TRAMP_REAL_BEGIN(stf_barrier_fallback)
245 + TRAMP_REAL_BEGIN(rfi_flush_fallback)
246 + SET_SCRATCH0(r13);
247 + GET_PACA(r13);
248 ++ std r1,PACA_EXRFI+EX_R12(r13)
249 ++ ld r1,PACAKSAVE(r13)
250 + std r9,PACA_EXRFI+EX_R9(r13)
251 + std r10,PACA_EXRFI+EX_R10(r13)
252 + std r11,PACA_EXRFI+EX_R11(r13)
253 +@@ -1486,12 +1488,15 @@ TRAMP_REAL_BEGIN(rfi_flush_fallback)
254 + ld r9,PACA_EXRFI+EX_R9(r13)
255 + ld r10,PACA_EXRFI+EX_R10(r13)
256 + ld r11,PACA_EXRFI+EX_R11(r13)
257 ++ ld r1,PACA_EXRFI+EX_R12(r13)
258 + GET_SCRATCH0(r13);
259 + rfid
260 +
261 + TRAMP_REAL_BEGIN(hrfi_flush_fallback)
262 + SET_SCRATCH0(r13);
263 + GET_PACA(r13);
264 ++ std r1,PACA_EXRFI+EX_R12(r13)
265 ++ ld r1,PACAKSAVE(r13)
266 + std r9,PACA_EXRFI+EX_R9(r13)
267 + std r10,PACA_EXRFI+EX_R10(r13)
268 + std r11,PACA_EXRFI+EX_R11(r13)
269 +@@ -1526,6 +1531,7 @@ TRAMP_REAL_BEGIN(hrfi_flush_fallback)
270 + ld r9,PACA_EXRFI+EX_R9(r13)
271 + ld r10,PACA_EXRFI+EX_R10(r13)
272 + ld r11,PACA_EXRFI+EX_R11(r13)
273 ++ ld r1,PACA_EXRFI+EX_R12(r13)
274 + GET_SCRATCH0(r13);
275 + hrfid
276 +
277 +diff --git a/arch/powerpc/platforms/85xx/t1042rdb_diu.c b/arch/powerpc/platforms/85xx/t1042rdb_diu.c
278 +index 58fa3d319f1c..dac36ba82fea 100644
279 +--- a/arch/powerpc/platforms/85xx/t1042rdb_diu.c
280 ++++ b/arch/powerpc/platforms/85xx/t1042rdb_diu.c
281 +@@ -9,8 +9,10 @@
282 + * option) any later version.
283 + */
284 +
285 ++#include <linux/init.h>
286 + #include <linux/io.h>
287 + #include <linux/kernel.h>
288 ++#include <linux/module.h>
289 + #include <linux/of.h>
290 + #include <linux/of_address.h>
291 +
292 +@@ -150,3 +152,5 @@ static int __init t1042rdb_diu_init(void)
293 + }
294 +
295 + early_initcall(t1042rdb_diu_init);
296 ++
297 ++MODULE_LICENSE("GPL");
298 +diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
299 +index 2edc673be137..99d1152ae224 100644
300 +--- a/arch/powerpc/platforms/pseries/ras.c
301 ++++ b/arch/powerpc/platforms/pseries/ras.c
302 +@@ -371,7 +371,7 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs)
303 + int len, error_log_length;
304 +
305 + error_log_length = 8 + rtas_error_extended_log_length(h);
306 +- len = max_t(int, error_log_length, RTAS_ERROR_LOG_MAX);
307 ++ len = min_t(int, error_log_length, RTAS_ERROR_LOG_MAX);
308 + memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX);
309 + memcpy(global_mce_data_buf, h, len);
310 + errhdr = (struct rtas_error_log *)global_mce_data_buf;
311 +diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
312 +index eb69a5186243..280e964e1aa8 100644
313 +--- a/arch/powerpc/sysdev/mpic_msgr.c
314 ++++ b/arch/powerpc/sysdev/mpic_msgr.c
315 +@@ -196,7 +196,7 @@ static int mpic_msgr_probe(struct platform_device *dev)
316 +
317 + /* IO map the message register block. */
318 + of_address_to_resource(np, 0, &rsrc);
319 +- msgr_block_addr = ioremap(rsrc.start, rsrc.end - rsrc.start);
320 ++ msgr_block_addr = ioremap(rsrc.start, resource_size(&rsrc));
321 + if (!msgr_block_addr) {
322 + dev_err(&dev->dev, "Failed to iomap MPIC message registers");
323 + return -EFAULT;
324 +diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c
325 +index 9f5ea9d87069..9b0216d571ad 100644
326 +--- a/arch/s390/kernel/crash_dump.c
327 ++++ b/arch/s390/kernel/crash_dump.c
328 +@@ -404,11 +404,13 @@ static void *get_vmcoreinfo_old(unsigned long *size)
329 + if (copy_oldmem_kernel(nt_name, addr + sizeof(note),
330 + sizeof(nt_name) - 1))
331 + return NULL;
332 +- if (strcmp(nt_name, "VMCOREINFO") != 0)
333 ++ if (strcmp(nt_name, VMCOREINFO_NOTE_NAME) != 0)
334 + return NULL;
335 + vmcoreinfo = kzalloc_panic(note.n_descsz);
336 +- if (copy_oldmem_kernel(vmcoreinfo, addr + 24, note.n_descsz))
337 ++ if (copy_oldmem_kernel(vmcoreinfo, addr + 24, note.n_descsz)) {
338 ++ kfree(vmcoreinfo);
339 + return NULL;
340 ++ }
341 + *size = note.n_descsz;
342 + return vmcoreinfo;
343 + }
344 +@@ -418,15 +420,20 @@ static void *get_vmcoreinfo_old(unsigned long *size)
345 + */
346 + static void *nt_vmcoreinfo(void *ptr)
347 + {
348 ++ const char *name = VMCOREINFO_NOTE_NAME;
349 + unsigned long size;
350 + void *vmcoreinfo;
351 +
352 + vmcoreinfo = os_info_old_entry(OS_INFO_VMCOREINFO, &size);
353 +- if (!vmcoreinfo)
354 +- vmcoreinfo = get_vmcoreinfo_old(&size);
355 ++ if (vmcoreinfo)
356 ++ return nt_init_name(ptr, 0, vmcoreinfo, size, name);
357 ++
358 ++ vmcoreinfo = get_vmcoreinfo_old(&size);
359 + if (!vmcoreinfo)
360 + return ptr;
361 +- return nt_init_name(ptr, 0, vmcoreinfo, size, "VMCOREINFO");
362 ++ ptr = nt_init_name(ptr, 0, vmcoreinfo, size, name);
363 ++ kfree(vmcoreinfo);
364 ++ return ptr;
365 + }
366 +
367 + /*
368 +diff --git a/arch/s390/lib/mem.S b/arch/s390/lib/mem.S
369 +index e1fa974ac500..37e52118d7e9 100644
370 +--- a/arch/s390/lib/mem.S
371 ++++ b/arch/s390/lib/mem.S
372 +@@ -17,7 +17,7 @@
373 + ENTRY(memmove)
374 + ltgr %r4,%r4
375 + lgr %r1,%r2
376 +- bzr %r14
377 ++ jz .Lmemmove_exit
378 + aghi %r4,-1
379 + clgr %r2,%r3
380 + jnh .Lmemmove_forward
381 +@@ -36,6 +36,7 @@ ENTRY(memmove)
382 + .Lmemmove_forward_remainder:
383 + larl %r5,.Lmemmove_mvc
384 + ex %r4,0(%r5)
385 ++.Lmemmove_exit:
386 + BR_EX %r14
387 + .Lmemmove_reverse:
388 + ic %r0,0(%r4,%r3)
389 +@@ -65,7 +66,7 @@ EXPORT_SYMBOL(memmove)
390 + */
391 + ENTRY(memset)
392 + ltgr %r4,%r4
393 +- bzr %r14
394 ++ jz .Lmemset_exit
395 + ltgr %r3,%r3
396 + jnz .Lmemset_fill
397 + aghi %r4,-1
398 +@@ -80,12 +81,13 @@ ENTRY(memset)
399 + .Lmemset_clear_remainder:
400 + larl %r3,.Lmemset_xc
401 + ex %r4,0(%r3)
402 ++.Lmemset_exit:
403 + BR_EX %r14
404 + .Lmemset_fill:
405 + stc %r3,0(%r2)
406 + cghi %r4,1
407 + lgr %r1,%r2
408 +- ber %r14
409 ++ je .Lmemset_fill_exit
410 + aghi %r4,-2
411 + srlg %r3,%r4,8
412 + ltgr %r3,%r3
413 +@@ -97,6 +99,7 @@ ENTRY(memset)
414 + .Lmemset_fill_remainder:
415 + larl %r3,.Lmemset_mvc
416 + ex %r4,0(%r3)
417 ++.Lmemset_fill_exit:
418 + BR_EX %r14
419 + .Lmemset_xc:
420 + xc 0(1,%r1),0(%r1)
421 +@@ -111,7 +114,7 @@ EXPORT_SYMBOL(memset)
422 + */
423 + ENTRY(memcpy)
424 + ltgr %r4,%r4
425 +- bzr %r14
426 ++ jz .Lmemcpy_exit
427 + aghi %r4,-1
428 + srlg %r5,%r4,8
429 + ltgr %r5,%r5
430 +@@ -120,6 +123,7 @@ ENTRY(memcpy)
431 + .Lmemcpy_remainder:
432 + larl %r5,.Lmemcpy_mvc
433 + ex %r4,0(%r5)
434 ++.Lmemcpy_exit:
435 + BR_EX %r14
436 + .Lmemcpy_loop:
437 + mvc 0(256,%r1),0(%r3)
438 +diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
439 +index 340070415c2c..90fef69e4c5a 100644
440 +--- a/arch/x86/include/asm/mce.h
441 ++++ b/arch/x86/include/asm/mce.h
442 +@@ -200,6 +200,7 @@ enum mce_notifier_prios {
443 + MCE_PRIO_LOWEST = 0,
444 + };
445 +
446 ++struct notifier_block;
447 + extern void mce_register_decode_chain(struct notifier_block *nb);
448 + extern void mce_unregister_decode_chain(struct notifier_block *nb);
449 +
450 +diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
451 +index 9dc19b4a2a87..c5d4931d1ef9 100644
452 +--- a/arch/x86/include/asm/pgtable-3level.h
453 ++++ b/arch/x86/include/asm/pgtable-3level.h
454 +@@ -2,6 +2,8 @@
455 + #ifndef _ASM_X86_PGTABLE_3LEVEL_H
456 + #define _ASM_X86_PGTABLE_3LEVEL_H
457 +
458 ++#include <asm/atomic64_32.h>
459 ++
460 + /*
461 + * Intel Physical Address Extension (PAE) Mode - three-level page
462 + * tables on PPro+ CPUs.
463 +@@ -147,10 +149,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *ptep)
464 + {
465 + pte_t res;
466 +
467 +- /* xchg acts as a barrier before the setting of the high bits */
468 +- res.pte_low = xchg(&ptep->pte_low, 0);
469 +- res.pte_high = ptep->pte_high;
470 +- ptep->pte_high = 0;
471 ++ res.pte = (pteval_t)atomic64_xchg((atomic64_t *)ptep, 0);
472 +
473 + return res;
474 + }
475 +diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
476 +index 00e2ae033a0f..1dfb808abd23 100644
477 +--- a/arch/x86/kvm/mmu.c
478 ++++ b/arch/x86/kvm/mmu.c
479 +@@ -220,6 +220,17 @@ static const u64 shadow_acc_track_saved_bits_mask = PT64_EPT_READABLE_MASK |
480 + PT64_EPT_EXECUTABLE_MASK;
481 + static const u64 shadow_acc_track_saved_bits_shift = PT64_SECOND_AVAIL_BITS_SHIFT;
482 +
483 ++/*
484 ++ * This mask must be set on all non-zero Non-Present or Reserved SPTEs in order
485 ++ * to guard against L1TF attacks.
486 ++ */
487 ++static u64 __read_mostly shadow_nonpresent_or_rsvd_mask;
488 ++
489 ++/*
490 ++ * The number of high-order 1 bits to use in the mask above.
491 ++ */
492 ++static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;
493 ++
494 + static void mmu_spte_set(u64 *sptep, u64 spte);
495 + static void mmu_free_roots(struct kvm_vcpu *vcpu);
496 +
497 +@@ -308,9 +319,13 @@ static void mark_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, u64 gfn,
498 + {
499 + unsigned int gen = kvm_current_mmio_generation(vcpu);
500 + u64 mask = generation_mmio_spte_mask(gen);
501 ++ u64 gpa = gfn << PAGE_SHIFT;
502 +
503 + access &= ACC_WRITE_MASK | ACC_USER_MASK;
504 +- mask |= shadow_mmio_value | access | gfn << PAGE_SHIFT;
505 ++ mask |= shadow_mmio_value | access;
506 ++ mask |= gpa | shadow_nonpresent_or_rsvd_mask;
507 ++ mask |= (gpa & shadow_nonpresent_or_rsvd_mask)
508 ++ << shadow_nonpresent_or_rsvd_mask_len;
509 +
510 + trace_mark_mmio_spte(sptep, gfn, access, gen);
511 + mmu_spte_set(sptep, mask);
512 +@@ -323,8 +338,14 @@ static bool is_mmio_spte(u64 spte)
513 +
514 + static gfn_t get_mmio_spte_gfn(u64 spte)
515 + {
516 +- u64 mask = generation_mmio_spte_mask(MMIO_GEN_MASK) | shadow_mmio_mask;
517 +- return (spte & ~mask) >> PAGE_SHIFT;
518 ++ u64 mask = generation_mmio_spte_mask(MMIO_GEN_MASK) | shadow_mmio_mask |
519 ++ shadow_nonpresent_or_rsvd_mask;
520 ++ u64 gpa = spte & ~mask;
521 ++
522 ++ gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len)
523 ++ & shadow_nonpresent_or_rsvd_mask;
524 ++
525 ++ return gpa >> PAGE_SHIFT;
526 + }
527 +
528 + static unsigned get_mmio_spte_access(u64 spte)
529 +@@ -381,7 +402,7 @@ void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
530 + }
531 + EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
532 +
533 +-void kvm_mmu_clear_all_pte_masks(void)
534 ++static void kvm_mmu_reset_all_pte_masks(void)
535 + {
536 + shadow_user_mask = 0;
537 + shadow_accessed_mask = 0;
538 +@@ -391,6 +412,18 @@ void kvm_mmu_clear_all_pte_masks(void)
539 + shadow_mmio_mask = 0;
540 + shadow_present_mask = 0;
541 + shadow_acc_track_mask = 0;
542 ++
543 ++ /*
544 ++ * If the CPU has 46 or less physical address bits, then set an
545 ++ * appropriate mask to guard against L1TF attacks. Otherwise, it is
546 ++ * assumed that the CPU is not vulnerable to L1TF.
547 ++ */
548 ++ if (boot_cpu_data.x86_phys_bits <
549 ++ 52 - shadow_nonpresent_or_rsvd_mask_len)
550 ++ shadow_nonpresent_or_rsvd_mask =
551 ++ rsvd_bits(boot_cpu_data.x86_phys_bits -
552 ++ shadow_nonpresent_or_rsvd_mask_len,
553 ++ boot_cpu_data.x86_phys_bits - 1);
554 + }
555 +
556 + static int is_cpuid_PSE36(void)
557 +@@ -5473,7 +5506,7 @@ static void mmu_destroy_caches(void)
558 +
559 + int kvm_mmu_module_init(void)
560 + {
561 +- kvm_mmu_clear_all_pte_masks();
562 ++ kvm_mmu_reset_all_pte_masks();
563 +
564 + pte_list_desc_cache = kmem_cache_create("pte_list_desc",
565 + sizeof(struct pte_list_desc),
566 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
567 +index a466ee14ad41..4e5a8e30cc4e 100644
568 +--- a/arch/x86/kvm/vmx.c
569 ++++ b/arch/x86/kvm/vmx.c
570 +@@ -749,17 +749,21 @@ struct vcpu_vmx {
571 + /*
572 + * loaded_vmcs points to the VMCS currently used in this vcpu. For a
573 + * non-nested (L1) guest, it always points to vmcs01. For a nested
574 +- * guest (L2), it points to a different VMCS.
575 ++ * guest (L2), it points to a different VMCS. loaded_cpu_state points
576 ++ * to the VMCS whose state is loaded into the CPU registers that only
577 ++ * need to be switched when transitioning to/from the kernel; a NULL
578 ++ * value indicates that host state is loaded.
579 + */
580 + struct loaded_vmcs vmcs01;
581 + struct loaded_vmcs *loaded_vmcs;
582 ++ struct loaded_vmcs *loaded_cpu_state;
583 + bool __launched; /* temporary, used in vmx_vcpu_run */
584 + struct msr_autoload {
585 + struct vmx_msrs guest;
586 + struct vmx_msrs host;
587 + } msr_autoload;
588 ++
589 + struct {
590 +- int loaded;
591 + u16 fs_sel, gs_sel, ldt_sel;
592 + #ifdef CONFIG_X86_64
593 + u16 ds_sel, es_sel;
594 +@@ -2336,10 +2340,11 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
595 + struct vcpu_vmx *vmx = to_vmx(vcpu);
596 + int i;
597 +
598 +- if (vmx->host_state.loaded)
599 ++ if (vmx->loaded_cpu_state)
600 + return;
601 +
602 +- vmx->host_state.loaded = 1;
603 ++ vmx->loaded_cpu_state = vmx->loaded_vmcs;
604 ++
605 + /*
606 + * Set host fs and gs selectors. Unfortunately, 22.2.3 does not
607 + * allow segment selectors with cpl > 0 or ti == 1.
608 +@@ -2390,11 +2395,14 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu)
609 +
610 + static void __vmx_load_host_state(struct vcpu_vmx *vmx)
611 + {
612 +- if (!vmx->host_state.loaded)
613 ++ if (!vmx->loaded_cpu_state)
614 + return;
615 +
616 ++ WARN_ON_ONCE(vmx->loaded_cpu_state != vmx->loaded_vmcs);
617 ++
618 + ++vmx->vcpu.stat.host_state_reload;
619 +- vmx->host_state.loaded = 0;
620 ++ vmx->loaded_cpu_state = NULL;
621 ++
622 + #ifdef CONFIG_X86_64
623 + if (is_long_mode(&vmx->vcpu))
624 + rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base);
625 +@@ -7582,7 +7590,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
626 +
627 + /* CPL=0 must be checked manually. */
628 + if (vmx_get_cpl(vcpu)) {
629 +- kvm_queue_exception(vcpu, UD_VECTOR);
630 ++ kvm_inject_gp(vcpu, 0);
631 + return 1;
632 + }
633 +
634 +@@ -7646,7 +7654,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
635 + static int nested_vmx_check_permission(struct kvm_vcpu *vcpu)
636 + {
637 + if (vmx_get_cpl(vcpu)) {
638 +- kvm_queue_exception(vcpu, UD_VECTOR);
639 ++ kvm_inject_gp(vcpu, 0);
640 + return 0;
641 + }
642 +
643 +@@ -9944,8 +9952,8 @@ static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs)
644 + return;
645 +
646 + cpu = get_cpu();
647 +- vmx->loaded_vmcs = vmcs;
648 + vmx_vcpu_put(vcpu);
649 ++ vmx->loaded_vmcs = vmcs;
650 + vmx_vcpu_load(vcpu, cpu);
651 + vcpu->cpu = cpu;
652 + put_cpu();
653 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
654 +index 5c2c09f6c1c3..3856828ee1dc 100644
655 +--- a/arch/x86/kvm/x86.c
656 ++++ b/arch/x86/kvm/x86.c
657 +@@ -6194,20 +6194,22 @@ static void kvm_set_mmio_spte_mask(void)
658 + * Set the reserved bits and the present bit of an paging-structure
659 + * entry to generate page fault with PFER.RSV = 1.
660 + */
661 +- /* Mask the reserved physical address bits. */
662 +- mask = rsvd_bits(maxphyaddr, 51);
663 ++
664 ++ /*
665 ++ * Mask the uppermost physical address bit, which would be reserved as
666 ++ * long as the supported physical address width is less than 52.
667 ++ */
668 ++ mask = 1ull << 51;
669 +
670 + /* Set the present bit. */
671 + mask |= 1ull;
672 +
673 +-#ifdef CONFIG_X86_64
674 + /*
675 + * If reserved bit is not supported, clear the present bit to disable
676 + * mmio page fault.
677 + */
678 +- if (maxphyaddr == 52)
679 ++ if (IS_ENABLED(CONFIG_X86_64) && maxphyaddr == 52)
680 + mask &= ~1ull;
681 +-#endif
682 +
683 + kvm_mmu_set_mmio_spte_mask(mask, mask);
684 + }
685 +diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
686 +index b3526a98a5a5..42cfad67b6ac 100644
687 +--- a/arch/x86/xen/mmu_pv.c
688 ++++ b/arch/x86/xen/mmu_pv.c
689 +@@ -425,14 +425,13 @@ static void xen_set_pud(pud_t *ptr, pud_t val)
690 + static void xen_set_pte_atomic(pte_t *ptep, pte_t pte)
691 + {
692 + trace_xen_mmu_set_pte_atomic(ptep, pte);
693 +- set_64bit((u64 *)ptep, native_pte_val(pte));
694 ++ __xen_set_pte(ptep, pte);
695 + }
696 +
697 + static void xen_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
698 + {
699 + trace_xen_mmu_pte_clear(mm, addr, ptep);
700 +- if (!xen_batched_set_pte(ptep, native_make_pte(0)))
701 +- native_pte_clear(mm, addr, ptep);
702 ++ __xen_set_pte(ptep, native_make_pte(0));
703 + }
704 +
705 + static void xen_pmd_clear(pmd_t *pmdp)
706 +@@ -1543,7 +1542,7 @@ static void __init xen_set_pte_init(pte_t *ptep, pte_t pte)
707 + pte = __pte_ma(((pte_val_ma(*ptep) & _PAGE_RW) | ~_PAGE_RW) &
708 + pte_val_ma(pte));
709 + #endif
710 +- native_set_pte(ptep, pte);
711 ++ __xen_set_pte(ptep, pte);
712 + }
713 +
714 + /* Early in boot, while setting up the initial pagetable, assume
715 +diff --git a/block/bio.c b/block/bio.c
716 +index 194d28cdc642..2e5d881423b8 100644
717 +--- a/block/bio.c
718 ++++ b/block/bio.c
719 +@@ -156,7 +156,7 @@ out:
720 +
721 + unsigned int bvec_nr_vecs(unsigned short idx)
722 + {
723 +- return bvec_slabs[idx].nr_vecs;
724 ++ return bvec_slabs[--idx].nr_vecs;
725 + }
726 +
727 + void bvec_free(mempool_t *pool, struct bio_vec *bv, unsigned int idx)
728 +diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
729 +index 9f342ef1ad42..9c4f1c496c90 100644
730 +--- a/block/cfq-iosched.c
731 ++++ b/block/cfq-iosched.c
732 +@@ -4741,12 +4741,13 @@ USEC_SHOW_FUNCTION(cfq_target_latency_us_show, cfqd->cfq_target_latency);
733 + static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \
734 + { \
735 + struct cfq_data *cfqd = e->elevator_data; \
736 +- unsigned int __data; \
737 ++ unsigned int __data, __min = (MIN), __max = (MAX); \
738 ++ \
739 + cfq_var_store(&__data, (page)); \
740 +- if (__data < (MIN)) \
741 +- __data = (MIN); \
742 +- else if (__data > (MAX)) \
743 +- __data = (MAX); \
744 ++ if (__data < __min) \
745 ++ __data = __min; \
746 ++ else if (__data > __max) \
747 ++ __data = __max; \
748 + if (__CONV) \
749 + *(__PTR) = (u64)__data * NSEC_PER_MSEC; \
750 + else \
751 +@@ -4775,12 +4776,13 @@ STORE_FUNCTION(cfq_target_latency_store, &cfqd->cfq_target_latency, 1, UINT_MAX,
752 + static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count) \
753 + { \
754 + struct cfq_data *cfqd = e->elevator_data; \
755 +- unsigned int __data; \
756 ++ unsigned int __data, __min = (MIN), __max = (MAX); \
757 ++ \
758 + cfq_var_store(&__data, (page)); \
759 +- if (__data < (MIN)) \
760 +- __data = (MIN); \
761 +- else if (__data > (MAX)) \
762 +- __data = (MAX); \
763 ++ if (__data < __min) \
764 ++ __data = __min; \
765 ++ else if (__data > __max) \
766 ++ __data = __max; \
767 + *(__PTR) = (u64)__data * NSEC_PER_USEC; \
768 + return count; \
769 + }
770 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
771 +index c0984d33c4c8..2eddbb1fae6a 100644
772 +--- a/drivers/acpi/scan.c
773 ++++ b/drivers/acpi/scan.c
774 +@@ -1599,7 +1599,8 @@ static int acpi_add_single_object(struct acpi_device **child,
775 + * Note this must be done before the get power-/wakeup_dev-flags calls.
776 + */
777 + if (type == ACPI_BUS_TYPE_DEVICE)
778 +- acpi_bus_get_status(device);
779 ++ if (acpi_bus_get_status(device) < 0)
780 ++ acpi_set_device_status(device, 0);
781 +
782 + acpi_bus_get_power_flags(device);
783 + acpi_bus_get_wakeup_device_flags(device);
784 +@@ -1677,7 +1678,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type,
785 + * acpi_add_single_object updates this once we've an acpi_device
786 + * so that acpi_bus_get_status' quirk handling can be used.
787 + */
788 +- *sta = 0;
789 ++ *sta = ACPI_STA_DEFAULT;
790 + break;
791 + case ACPI_TYPE_PROCESSOR:
792 + *type = ACPI_BUS_TYPE_PROCESSOR;
793 +diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c
794 +index 62d0a69f8da0..3acf5f041e3c 100644
795 +--- a/drivers/clk/rockchip/clk-rk3399.c
796 ++++ b/drivers/clk/rockchip/clk-rk3399.c
797 +@@ -1522,6 +1522,7 @@ static const char *const rk3399_pmucru_critical_clocks[] __initconst = {
798 + "pclk_pmu_src",
799 + "fclk_cm0s_src_pmu",
800 + "clk_timer_src_pmu",
801 ++ "pclk_rkpwm_pmu",
802 + };
803 +
804 + static void __init rk3399_clk_init(struct device_node *np)
805 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
806 +index 8c2204c7b384..7ad8fa891ce6 100644
807 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
808 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
809 +@@ -134,6 +134,11 @@ psp_cmd_submit_buf(struct psp_context *psp,
810 + msleep(1);
811 + }
812 +
813 ++ if (ucode) {
814 ++ ucode->tmr_mc_addr_lo = psp->cmd_buf_mem->resp.fw_addr_lo;
815 ++ ucode->tmr_mc_addr_hi = psp->cmd_buf_mem->resp.fw_addr_hi;
816 ++ }
817 ++
818 + return ret;
819 + }
820 +
821 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
822 +index 30b5500dc152..fa7b25e1e5d2 100644
823 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
824 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h
825 +@@ -172,6 +172,7 @@ enum AMDGPU_UCODE_ID {
826 + AMDGPU_UCODE_ID_SMC,
827 + AMDGPU_UCODE_ID_UVD,
828 + AMDGPU_UCODE_ID_VCE,
829 ++ AMDGPU_UCODE_ID_VCN,
830 + AMDGPU_UCODE_ID_MAXIMUM,
831 + };
832 +
833 +@@ -204,6 +205,9 @@ struct amdgpu_firmware_info {
834 + void *kaddr;
835 + /* ucode_size_bytes */
836 + uint32_t ucode_size;
837 ++ /* starting tmr mc address */
838 ++ uint32_t tmr_mc_addr_lo;
839 ++ uint32_t tmr_mc_addr_hi;
840 + };
841 +
842 + void amdgpu_ucode_print_mc_hdr(const struct common_firmware_header *hdr);
843 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
844 +index 308a9755eae3..1612d8aa6ad6 100644
845 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
846 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
847 +@@ -93,9 +93,10 @@ int amdgpu_vcn_sw_init(struct amdgpu_device *adev)
848 + version_major, version_minor, family_id);
849 +
850 +
851 +- bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
852 +- + AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_HEAP_SIZE
853 ++ bo_size = AMDGPU_VCN_STACK_SIZE + AMDGPU_VCN_HEAP_SIZE
854 + + AMDGPU_VCN_SESSION_SIZE * 40;
855 ++ if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP)
856 ++ bo_size += AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8);
857 + r = amdgpu_bo_create_kernel(adev, bo_size, PAGE_SIZE,
858 + AMDGPU_GEM_DOMAIN_VRAM, &adev->vcn.vcpu_bo,
859 + &adev->vcn.gpu_addr, &adev->vcn.cpu_addr);
860 +@@ -191,11 +192,13 @@ int amdgpu_vcn_resume(struct amdgpu_device *adev)
861 + unsigned offset;
862 +
863 + hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
864 +- offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
865 +- memcpy_toio(adev->vcn.cpu_addr, adev->vcn.fw->data + offset,
866 +- le32_to_cpu(hdr->ucode_size_bytes));
867 +- size -= le32_to_cpu(hdr->ucode_size_bytes);
868 +- ptr += le32_to_cpu(hdr->ucode_size_bytes);
869 ++ if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
870 ++ offset = le32_to_cpu(hdr->ucode_array_offset_bytes);
871 ++ memcpy_toio(adev->vcn.cpu_addr, adev->vcn.fw->data + offset,
872 ++ le32_to_cpu(hdr->ucode_size_bytes));
873 ++ size -= le32_to_cpu(hdr->ucode_size_bytes);
874 ++ ptr += le32_to_cpu(hdr->ucode_size_bytes);
875 ++ }
876 + memset_io(ptr, 0, size);
877 + }
878 +
879 +diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
880 +index 1a30c54a0889..3981915e2311 100644
881 +--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
882 ++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
883 +@@ -3113,7 +3113,7 @@ static void gfx_v9_0_enter_rlc_safe_mode(struct amdgpu_device *adev)
884 +
885 + /* wait for RLC_SAFE_MODE */
886 + for (i = 0; i < adev->usec_timeout; i++) {
887 +- if (!REG_GET_FIELD(SOC15_REG_OFFSET(GC, 0, mmRLC_SAFE_MODE), RLC_SAFE_MODE, CMD))
888 ++ if (!REG_GET_FIELD(RREG32_SOC15(GC, 0, mmRLC_SAFE_MODE), RLC_SAFE_MODE, CMD))
889 + break;
890 + udelay(1);
891 + }
892 +diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
893 +index f7cf994b1da2..86db90ff693a 100644
894 +--- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
895 ++++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
896 +@@ -78,6 +78,9 @@ psp_v10_0_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *
897 + case AMDGPU_UCODE_ID_VCE:
898 + *type = GFX_FW_TYPE_VCE;
899 + break;
900 ++ case AMDGPU_UCODE_ID_VCN:
901 ++ *type = GFX_FW_TYPE_VCN;
902 ++ break;
903 + case AMDGPU_UCODE_ID_MAXIMUM:
904 + default:
905 + return -EINVAL;
906 +diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
907 +index a098712bdd2f..f7b8caccab9f 100644
908 +--- a/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
909 ++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v1_0.c
910 +@@ -91,6 +91,16 @@ static int vcn_v1_0_sw_init(void *handle)
911 + if (r)
912 + return r;
913 +
914 ++ if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
915 ++ const struct common_firmware_header *hdr;
916 ++ hdr = (const struct common_firmware_header *)adev->vcn.fw->data;
917 ++ adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].ucode_id = AMDGPU_UCODE_ID_VCN;
918 ++ adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].fw = adev->vcn.fw;
919 ++ adev->firmware.fw_size +=
920 ++ ALIGN(le32_to_cpu(hdr->ucode_size_bytes), PAGE_SIZE);
921 ++ DRM_INFO("PSP loading VCN firmware\n");
922 ++ }
923 ++
924 + r = amdgpu_vcn_resume(adev);
925 + if (r)
926 + return r;
927 +@@ -248,26 +258,38 @@ static int vcn_v1_0_resume(void *handle)
928 + static void vcn_v1_0_mc_resume(struct amdgpu_device *adev)
929 + {
930 + uint32_t size = AMDGPU_GPU_PAGE_ALIGN(adev->vcn.fw->size + 4);
931 +-
932 +- WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
933 ++ uint32_t offset;
934 ++
935 ++ if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
936 ++ WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
937 ++ (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_lo));
938 ++ WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
939 ++ (adev->firmware.ucode[AMDGPU_UCODE_ID_VCN].tmr_mc_addr_hi));
940 ++ WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0, 0);
941 ++ offset = 0;
942 ++ } else {
943 ++ WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW,
944 + lower_32_bits(adev->vcn.gpu_addr));
945 +- WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
946 ++ WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH,
947 + upper_32_bits(adev->vcn.gpu_addr));
948 +- WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0,
949 +- AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
950 ++ offset = size;
951 ++ WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0,
952 ++ AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
953 ++ }
954 ++
955 + WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE0, size);
956 +
957 + WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW,
958 +- lower_32_bits(adev->vcn.gpu_addr + size));
959 ++ lower_32_bits(adev->vcn.gpu_addr + offset));
960 + WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_HIGH,
961 +- upper_32_bits(adev->vcn.gpu_addr + size));
962 ++ upper_32_bits(adev->vcn.gpu_addr + offset));
963 + WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET1, 0);
964 + WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE1, AMDGPU_VCN_HEAP_SIZE);
965 +
966 + WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_LOW,
967 +- lower_32_bits(adev->vcn.gpu_addr + size + AMDGPU_VCN_HEAP_SIZE));
968 ++ lower_32_bits(adev->vcn.gpu_addr + offset + AMDGPU_VCN_HEAP_SIZE));
969 + WREG32_SOC15(UVD, 0, mmUVD_LMI_VCPU_CACHE2_64BIT_BAR_HIGH,
970 +- upper_32_bits(adev->vcn.gpu_addr + size + AMDGPU_VCN_HEAP_SIZE));
971 ++ upper_32_bits(adev->vcn.gpu_addr + offset + AMDGPU_VCN_HEAP_SIZE));
972 + WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_OFFSET2, 0);
973 + WREG32_SOC15(UVD, 0, mmUVD_VCPU_CACHE_SIZE2,
974 + AMDGPU_VCN_STACK_SIZE + (AMDGPU_VCN_SESSION_SIZE * 40));
975 +diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
976 +index 1dc31aa72781..12856de09f57 100644
977 +--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
978 ++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
979 +@@ -403,6 +403,49 @@ static const struct gpu_pt_config_reg DIDTConfig_Polaris12[] = {
980 + { ixDIDT_SQ_CTRL1, DIDT_SQ_CTRL1__MAX_POWER_MASK, DIDT_SQ_CTRL1__MAX_POWER__SHIFT, 0xffff, GPU_CONFIGREG_DIDT_IND },
981 +
982 + { ixDIDT_SQ_CTRL_OCP, DIDT_SQ_CTRL_OCP__UNUSED_0_MASK, DIDT_SQ_CTRL_OCP__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
983 ++ { ixDIDT_SQ_CTRL_OCP, DIDT_SQ_CTRL_OCP__OCP_MAX_POWER_MASK, DIDT_SQ_CTRL_OCP__OCP_MAX_POWER__SHIFT, 0xffff, GPU_CONFIGREG_DIDT_IND },
984 ++
985 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__MAX_POWER_DELTA_MASK, DIDT_SQ_CTRL2__MAX_POWER_DELTA__SHIFT, 0x3853, GPU_CONFIGREG_DIDT_IND },
986 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__UNUSED_0_MASK, DIDT_SQ_CTRL2__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
987 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__SHORT_TERM_INTERVAL_SIZE_MASK, DIDT_SQ_CTRL2__SHORT_TERM_INTERVAL_SIZE__SHIFT, 0x005a, GPU_CONFIGREG_DIDT_IND },
988 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__UNUSED_1_MASK, DIDT_SQ_CTRL2__UNUSED_1__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
989 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__LONG_TERM_INTERVAL_RATIO_MASK, DIDT_SQ_CTRL2__LONG_TERM_INTERVAL_RATIO__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
990 ++ { ixDIDT_SQ_CTRL2, DIDT_SQ_CTRL2__UNUSED_2_MASK, DIDT_SQ_CTRL2__UNUSED_2__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
991 ++
992 ++ { ixDIDT_SQ_STALL_CTRL, DIDT_SQ_STALL_CTRL__DIDT_STALL_CTRL_ENABLE_MASK, DIDT_SQ_STALL_CTRL__DIDT_STALL_CTRL_ENABLE__SHIFT, 0x0001, GPU_CONFIGREG_DIDT_IND },
993 ++ { ixDIDT_SQ_STALL_CTRL, DIDT_SQ_STALL_CTRL__DIDT_STALL_DELAY_HI_MASK, DIDT_SQ_STALL_CTRL__DIDT_STALL_DELAY_HI__SHIFT, 0x0001, GPU_CONFIGREG_DIDT_IND },
994 ++ { ixDIDT_SQ_STALL_CTRL, DIDT_SQ_STALL_CTRL__DIDT_STALL_DELAY_LO_MASK, DIDT_SQ_STALL_CTRL__DIDT_STALL_DELAY_LO__SHIFT, 0x0001, GPU_CONFIGREG_DIDT_IND },
995 ++ { ixDIDT_SQ_STALL_CTRL, DIDT_SQ_STALL_CTRL__DIDT_HI_POWER_THRESHOLD_MASK, DIDT_SQ_STALL_CTRL__DIDT_HI_POWER_THRESHOLD__SHIFT, 0x0ebb, GPU_CONFIGREG_DIDT_IND },
996 ++ { ixDIDT_SQ_STALL_CTRL, DIDT_SQ_STALL_CTRL__UNUSED_0_MASK, DIDT_SQ_STALL_CTRL__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
997 ++
998 ++ { ixDIDT_SQ_TUNING_CTRL, DIDT_SQ_TUNING_CTRL__DIDT_TUNING_ENABLE_MASK, DIDT_SQ_TUNING_CTRL__DIDT_TUNING_ENABLE__SHIFT, 0x0001, GPU_CONFIGREG_DIDT_IND },
999 ++ { ixDIDT_SQ_TUNING_CTRL, DIDT_SQ_TUNING_CTRL__MAX_POWER_DELTA_HI_MASK, DIDT_SQ_TUNING_CTRL__MAX_POWER_DELTA_HI__SHIFT, 0x3853, GPU_CONFIGREG_DIDT_IND },
1000 ++ { ixDIDT_SQ_TUNING_CTRL, DIDT_SQ_TUNING_CTRL__MAX_POWER_DELTA_LO_MASK, DIDT_SQ_TUNING_CTRL__MAX_POWER_DELTA_LO__SHIFT, 0x3153, GPU_CONFIGREG_DIDT_IND },
1001 ++ { ixDIDT_SQ_TUNING_CTRL, DIDT_SQ_TUNING_CTRL__UNUSED_0_MASK, DIDT_SQ_TUNING_CTRL__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1002 ++
1003 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__DIDT_CTRL_EN_MASK, DIDT_SQ_CTRL0__DIDT_CTRL_EN__SHIFT, 0x0001, GPU_CONFIGREG_DIDT_IND },
1004 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__USE_REF_CLOCK_MASK, DIDT_SQ_CTRL0__USE_REF_CLOCK__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1005 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__PHASE_OFFSET_MASK, DIDT_SQ_CTRL0__PHASE_OFFSET__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1006 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__DIDT_CTRL_RST_MASK, DIDT_SQ_CTRL0__DIDT_CTRL_RST__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1007 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__DIDT_CLK_EN_OVERRIDE_MASK, DIDT_SQ_CTRL0__DIDT_CLK_EN_OVERRIDE__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1008 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__DIDT_MAX_STALLS_ALLOWED_HI_MASK, DIDT_SQ_CTRL0__DIDT_MAX_STALLS_ALLOWED_HI__SHIFT, 0x0010, GPU_CONFIGREG_DIDT_IND },
1009 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__DIDT_MAX_STALLS_ALLOWED_LO_MASK, DIDT_SQ_CTRL0__DIDT_MAX_STALLS_ALLOWED_LO__SHIFT, 0x0010, GPU_CONFIGREG_DIDT_IND },
1010 ++ { ixDIDT_SQ_CTRL0, DIDT_SQ_CTRL0__UNUSED_0_MASK, DIDT_SQ_CTRL0__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1011 ++
1012 ++ { ixDIDT_TD_WEIGHT0_3, DIDT_TD_WEIGHT0_3__WEIGHT0_MASK, DIDT_TD_WEIGHT0_3__WEIGHT0__SHIFT, 0x000a, GPU_CONFIGREG_DIDT_IND },
1013 ++ { ixDIDT_TD_WEIGHT0_3, DIDT_TD_WEIGHT0_3__WEIGHT1_MASK, DIDT_TD_WEIGHT0_3__WEIGHT1__SHIFT, 0x0010, GPU_CONFIGREG_DIDT_IND },
1014 ++ { ixDIDT_TD_WEIGHT0_3, DIDT_TD_WEIGHT0_3__WEIGHT2_MASK, DIDT_TD_WEIGHT0_3__WEIGHT2__SHIFT, 0x0017, GPU_CONFIGREG_DIDT_IND },
1015 ++ { ixDIDT_TD_WEIGHT0_3, DIDT_TD_WEIGHT0_3__WEIGHT3_MASK, DIDT_TD_WEIGHT0_3__WEIGHT3__SHIFT, 0x002f, GPU_CONFIGREG_DIDT_IND },
1016 ++
1017 ++ { ixDIDT_TD_WEIGHT4_7, DIDT_TD_WEIGHT4_7__WEIGHT4_MASK, DIDT_TD_WEIGHT4_7__WEIGHT4__SHIFT, 0x0046, GPU_CONFIGREG_DIDT_IND },
1018 ++ { ixDIDT_TD_WEIGHT4_7, DIDT_TD_WEIGHT4_7__WEIGHT5_MASK, DIDT_TD_WEIGHT4_7__WEIGHT5__SHIFT, 0x005d, GPU_CONFIGREG_DIDT_IND },
1019 ++ { ixDIDT_TD_WEIGHT4_7, DIDT_TD_WEIGHT4_7__WEIGHT6_MASK, DIDT_TD_WEIGHT4_7__WEIGHT6__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1020 ++ { ixDIDT_TD_WEIGHT4_7, DIDT_TD_WEIGHT4_7__WEIGHT7_MASK, DIDT_TD_WEIGHT4_7__WEIGHT7__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1021 ++
1022 ++ { ixDIDT_TD_CTRL1, DIDT_TD_CTRL1__MIN_POWER_MASK, DIDT_TD_CTRL1__MIN_POWER__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1023 ++ { ixDIDT_TD_CTRL1, DIDT_TD_CTRL1__MAX_POWER_MASK, DIDT_TD_CTRL1__MAX_POWER__SHIFT, 0xffff, GPU_CONFIGREG_DIDT_IND },
1024 ++
1025 ++ { ixDIDT_TD_CTRL_OCP, DIDT_TD_CTRL_OCP__UNUSED_0_MASK, DIDT_TD_CTRL_OCP__UNUSED_0__SHIFT, 0x0000, GPU_CONFIGREG_DIDT_IND },
1026 + { ixDIDT_TD_CTRL_OCP, DIDT_TD_CTRL_OCP__OCP_MAX_POWER_MASK, DIDT_TD_CTRL_OCP__OCP_MAX_POWER__SHIFT, 0x00ff, GPU_CONFIGREG_DIDT_IND },
1027 +
1028 + { ixDIDT_TD_CTRL2, DIDT_TD_CTRL2__MAX_POWER_DELTA_MASK, DIDT_TD_CTRL2__MAX_POWER_DELTA__SHIFT, 0x3fff, GPU_CONFIGREG_DIDT_IND },
1029 +diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
1030 +index 1f1fd3139c5b..c29dea895605 100644
1031 +--- a/drivers/gpu/drm/drm_edid.c
1032 ++++ b/drivers/gpu/drm/drm_edid.c
1033 +@@ -114,6 +114,9 @@ static const struct edid_quirk {
1034 + /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */
1035 + { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC },
1036 +
1037 ++ /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */
1038 ++ { "SDC", 0x3652, EDID_QUIRK_FORCE_6BPC },
1039 ++
1040 + /* Belinea 10 15 55 */
1041 + { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60 },
1042 + { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60 },
1043 +diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
1044 +index 2fdf302ebdad..8a541d0e3e80 100644
1045 +--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
1046 ++++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
1047 +@@ -128,9 +128,7 @@ lpe_audio_platdev_create(struct drm_i915_private *dev_priv)
1048 +
1049 + kfree(rsc);
1050 +
1051 +- pm_runtime_forbid(&platdev->dev);
1052 +- pm_runtime_set_active(&platdev->dev);
1053 +- pm_runtime_enable(&platdev->dev);
1054 ++ pm_runtime_no_callbacks(&platdev->dev);
1055 +
1056 + return platdev;
1057 +
1058 +diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
1059 +index beb9baaf2f2e..f71fef10ecc6 100644
1060 +--- a/drivers/gpu/drm/i915/intel_lspcon.c
1061 ++++ b/drivers/gpu/drm/i915/intel_lspcon.c
1062 +@@ -75,7 +75,7 @@ static enum drm_lspcon_mode lspcon_wait_mode(struct intel_lspcon *lspcon,
1063 + lspcon_mode_name(mode));
1064 +
1065 + wait_for((current_mode = lspcon_get_current_mode(lspcon)) == mode ||
1066 +- current_mode == DRM_LSPCON_MODE_INVALID, 100);
1067 ++ current_mode == DRM_LSPCON_MODE_INVALID, 400);
1068 + if (current_mode != mode)
1069 + DRM_DEBUG_KMS("LSPCON mode hasn't settled\n");
1070 +
1071 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
1072 +index 9e478f03e845..81ee1d026648 100644
1073 +--- a/drivers/hid/hid-ids.h
1074 ++++ b/drivers/hid/hid-ids.h
1075 +@@ -528,6 +528,7 @@
1076 + #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A 0x0a4a
1077 + #define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a
1078 + #define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a
1079 ++#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A 0x094a
1080 +
1081 + #define USB_VENDOR_ID_HUION 0x256c
1082 + #define USB_DEVICE_ID_HUION_TABLET 0x006e
1083 +diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
1084 +index f489a5cfcb48..e10eda031b01 100644
1085 +--- a/drivers/hid/usbhid/hid-quirks.c
1086 ++++ b/drivers/hid/usbhid/hid-quirks.c
1087 +@@ -99,6 +99,7 @@ static const struct hid_blacklist {
1088 + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL },
1089 + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL },
1090 + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
1091 ++ { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE_094A, HID_QUIRK_ALWAYS_POLL },
1092 + { USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6680, HID_QUIRK_MULTI_INPUT },
1093 + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C007, HID_QUIRK_ALWAYS_POLL },
1094 + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
1095 +diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
1096 +index b5fab55cc275..b197e925fe36 100644
1097 +--- a/drivers/infiniband/hw/hfi1/affinity.c
1098 ++++ b/drivers/infiniband/hw/hfi1/affinity.c
1099 +@@ -146,7 +146,7 @@ int node_affinity_init(void)
1100 + while ((dev = pci_get_device(ids->vendor, ids->device, dev))) {
1101 + node = pcibus_to_node(dev->bus);
1102 + if (node < 0)
1103 +- node = numa_node_id();
1104 ++ goto out;
1105 +
1106 + hfi1_per_node_cntr[node]++;
1107 + }
1108 +@@ -154,6 +154,18 @@ int node_affinity_init(void)
1109 + }
1110 +
1111 + return 0;
1112 ++
1113 ++out:
1114 ++ /*
1115 ++ * Invalid PCI NUMA node information found, note it, and populate
1116 ++ * our database 1:1.
1117 ++ */
1118 ++ pr_err("HFI: Invalid PCI NUMA node. Performance may be affected\n");
1119 ++ pr_err("HFI: System BIOS may need to be upgraded\n");
1120 ++ for (node = 0; node < node_affinity.num_possible_nodes; node++)
1121 ++ hfi1_per_node_cntr[node] = 1;
1122 ++
1123 ++ return 0;
1124 + }
1125 +
1126 + void node_affinity_destroy(void)
1127 +@@ -227,8 +239,14 @@ int hfi1_dev_affinity_init(struct hfi1_devdata *dd)
1128 + const struct cpumask *local_mask;
1129 + int curr_cpu, possible, i;
1130 +
1131 +- if (node < 0)
1132 +- node = numa_node_id();
1133 ++ /*
1134 ++ * If the BIOS does not have the NUMA node information set, select
1135 ++ * NUMA 0 so we get consistent performance.
1136 ++ */
1137 ++ if (node < 0) {
1138 ++ dd_dev_err(dd, "Invalid PCI NUMA node. Performance may be affected\n");
1139 ++ node = 0;
1140 ++ }
1141 + dd->node = node;
1142 +
1143 + local_mask = cpumask_of_node(dd->node);
1144 +diff --git a/drivers/infiniband/hw/hns/hns_roce_pd.c b/drivers/infiniband/hw/hns/hns_roce_pd.c
1145 +index a64500fa1145..3cef53c65133 100644
1146 +--- a/drivers/infiniband/hw/hns/hns_roce_pd.c
1147 ++++ b/drivers/infiniband/hw/hns/hns_roce_pd.c
1148 +@@ -35,7 +35,7 @@
1149 +
1150 + static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
1151 + {
1152 +- return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn);
1153 ++ return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn) ? -ENOMEM : 0;
1154 + }
1155 +
1156 + static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
1157 +diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c
1158 +index f5dd21c2d275..3a37d26889df 100644
1159 +--- a/drivers/infiniband/hw/hns/hns_roce_qp.c
1160 ++++ b/drivers/infiniband/hw/hns/hns_roce_qp.c
1161 +@@ -114,7 +114,10 @@ static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt,
1162 + {
1163 + struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
1164 +
1165 +- return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base);
1166 ++ return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align,
1167 ++ base) ?
1168 ++ -ENOMEM :
1169 ++ 0;
1170 + }
1171 +
1172 + enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state)
1173 +diff --git a/drivers/input/input.c b/drivers/input/input.c
1174 +index 762bfb9487dc..50d425fe6706 100644
1175 +--- a/drivers/input/input.c
1176 ++++ b/drivers/input/input.c
1177 +@@ -480,11 +480,19 @@ EXPORT_SYMBOL(input_inject_event);
1178 + */
1179 + void input_alloc_absinfo(struct input_dev *dev)
1180 + {
1181 +- if (!dev->absinfo)
1182 +- dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo),
1183 +- GFP_KERNEL);
1184 ++ if (dev->absinfo)
1185 ++ return;
1186 +
1187 +- WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__);
1188 ++ dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), GFP_KERNEL);
1189 ++ if (!dev->absinfo) {
1190 ++ dev_err(dev->dev.parent ?: &dev->dev,
1191 ++ "%s: unable to allocate memory\n", __func__);
1192 ++ /*
1193 ++ * We will handle this allocation failure in
1194 ++ * input_register_device() when we refuse to register input
1195 ++ * device with ABS bits but without absinfo.
1196 ++ */
1197 ++ }
1198 + }
1199 + EXPORT_SYMBOL(input_alloc_absinfo);
1200 +
1201 +diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
1202 +index bd67e1b2c64e..57960cb5e045 100644
1203 +--- a/drivers/iommu/omap-iommu.c
1204 ++++ b/drivers/iommu/omap-iommu.c
1205 +@@ -529,7 +529,7 @@ static u32 *iopte_alloc(struct omap_iommu *obj, u32 *iopgd,
1206 +
1207 + pte_ready:
1208 + iopte = iopte_offset(iopgd, da);
1209 +- *pt_dma = virt_to_phys(iopte);
1210 ++ *pt_dma = iopgd_page_paddr(iopgd);
1211 + dev_vdbg(obj->dev,
1212 + "%s: da:%08x pgd:%p *pgd:%08x pte:%p *pte:%08x\n",
1213 + __func__, da, iopgd, *iopgd, iopte, *iopte);
1214 +@@ -717,7 +717,7 @@ static size_t iopgtable_clear_entry_core(struct omap_iommu *obj, u32 da)
1215 + }
1216 + bytes *= nent;
1217 + memset(iopte, 0, nent * sizeof(*iopte));
1218 +- pt_dma = virt_to_phys(iopte);
1219 ++ pt_dma = iopgd_page_paddr(iopgd);
1220 + flush_iopte_range(obj->dev, pt_dma, pt_offset, nent);
1221 +
1222 + /*
1223 +diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
1224 +index 55cfb986225b..0b9a8b709abf 100644
1225 +--- a/drivers/irqchip/irq-bcm7038-l1.c
1226 ++++ b/drivers/irqchip/irq-bcm7038-l1.c
1227 +@@ -217,6 +217,7 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,
1228 + return 0;
1229 + }
1230 +
1231 ++#ifdef CONFIG_SMP
1232 + static void bcm7038_l1_cpu_offline(struct irq_data *d)
1233 + {
1234 + struct cpumask *mask = irq_data_get_affinity_mask(d);
1235 +@@ -241,6 +242,7 @@ static void bcm7038_l1_cpu_offline(struct irq_data *d)
1236 + }
1237 + irq_set_affinity_locked(d, &new_affinity, false);
1238 + }
1239 ++#endif
1240 +
1241 + static int __init bcm7038_l1_init_one(struct device_node *dn,
1242 + unsigned int idx,
1243 +@@ -293,7 +295,9 @@ static struct irq_chip bcm7038_l1_irq_chip = {
1244 + .irq_mask = bcm7038_l1_mask,
1245 + .irq_unmask = bcm7038_l1_unmask,
1246 + .irq_set_affinity = bcm7038_l1_set_affinity,
1247 ++#ifdef CONFIG_SMP
1248 + .irq_cpu_offline = bcm7038_l1_cpu_offline,
1249 ++#endif
1250 + };
1251 +
1252 + static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
1253 +diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
1254 +index 3f0ddc0d7393..3fb65778e03d 100644
1255 +--- a/drivers/lightnvm/pblk-core.c
1256 ++++ b/drivers/lightnvm/pblk-core.c
1257 +@@ -190,7 +190,6 @@ void pblk_bio_free_pages(struct pblk *pblk, struct bio *bio, int off,
1258 +
1259 + WARN_ON(off + nr_pages != bio->bi_vcnt);
1260 +
1261 +- bio_advance(bio, off * PBLK_EXPOSED_PAGE_SIZE);
1262 + for (i = off; i < nr_pages + off; i++) {
1263 + bv = bio->bi_io_vec[i];
1264 + mempool_free(bv.bv_page, pblk->page_bio_pool);
1265 +diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c
1266 +index 3ad9e56d2473..d89ac573f8d8 100644
1267 +--- a/drivers/lightnvm/pblk-write.c
1268 ++++ b/drivers/lightnvm/pblk-write.c
1269 +@@ -33,6 +33,10 @@ static unsigned long pblk_end_w_bio(struct pblk *pblk, struct nvm_rq *rqd,
1270 + bio_endio(original_bio);
1271 + }
1272 +
1273 ++ if (c_ctx->nr_padded)
1274 ++ pblk_bio_free_pages(pblk, rqd->bio, c_ctx->nr_valid,
1275 ++ c_ctx->nr_padded);
1276 ++
1277 + #ifdef CONFIG_NVM_DEBUG
1278 + atomic_long_add(c_ctx->nr_valid, &pblk->sync_writes);
1279 + #endif
1280 +@@ -521,7 +525,8 @@ static void pblk_free_write_rqd(struct pblk *pblk, struct nvm_rq *rqd)
1281 + struct bio *bio = rqd->bio;
1282 +
1283 + if (c_ctx->nr_padded)
1284 +- pblk_bio_free_pages(pblk, bio, rqd->nr_ppas, c_ctx->nr_padded);
1285 ++ pblk_bio_free_pages(pblk, bio, c_ctx->nr_valid,
1286 ++ c_ctx->nr_padded);
1287 + }
1288 +
1289 + static int pblk_submit_write(struct pblk *pblk)
1290 +diff --git a/drivers/md/dm-kcopyd.c b/drivers/md/dm-kcopyd.c
1291 +index cf2c67e35eaf..d4b326914f06 100644
1292 +--- a/drivers/md/dm-kcopyd.c
1293 ++++ b/drivers/md/dm-kcopyd.c
1294 +@@ -484,6 +484,8 @@ static int run_complete_job(struct kcopyd_job *job)
1295 + if (atomic_dec_and_test(&kc->nr_jobs))
1296 + wake_up(&kc->destroyq);
1297 +
1298 ++ cond_resched();
1299 ++
1300 + return 0;
1301 + }
1302 +
1303 +diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
1304 +index 40534352e574..3270b8dbc949 100644
1305 +--- a/drivers/mfd/sm501.c
1306 ++++ b/drivers/mfd/sm501.c
1307 +@@ -714,6 +714,7 @@ sm501_create_subdev(struct sm501_devdata *sm, char *name,
1308 + smdev->pdev.name = name;
1309 + smdev->pdev.id = sm->pdev_id;
1310 + smdev->pdev.dev.parent = sm->dev;
1311 ++ smdev->pdev.dev.coherent_dma_mask = 0xffffffff;
1312 +
1313 + if (res_count) {
1314 + smdev->pdev.resource = (struct resource *)(smdev+1);
1315 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1316 +index 4c49d0b97748..9d499c5c8f8a 100644
1317 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1318 ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
1319 +@@ -185,6 +185,9 @@ struct bcmgenet_mib_counters {
1320 + #define UMAC_MAC1 0x010
1321 + #define UMAC_MAX_FRAME_LEN 0x014
1322 +
1323 ++#define UMAC_MODE 0x44
1324 ++#define MODE_LINK_STATUS (1 << 5)
1325 ++
1326 + #define UMAC_EEE_CTRL 0x064
1327 + #define EN_LPI_RX_PAUSE (1 << 0)
1328 + #define EN_LPI_TX_PFC (1 << 1)
1329 +diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1330 +index 18f5723be2c9..6ad0ca7ed3e9 100644
1331 +--- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
1332 ++++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1333 +@@ -115,8 +115,14 @@ void bcmgenet_mii_setup(struct net_device *dev)
1334 + static int bcmgenet_fixed_phy_link_update(struct net_device *dev,
1335 + struct fixed_phy_status *status)
1336 + {
1337 +- if (dev && dev->phydev && status)
1338 +- status->link = dev->phydev->link;
1339 ++ struct bcmgenet_priv *priv;
1340 ++ u32 reg;
1341 ++
1342 ++ if (dev && dev->phydev && status) {
1343 ++ priv = netdev_priv(dev);
1344 ++ reg = bcmgenet_umac_readl(priv, UMAC_MODE);
1345 ++ status->link = !!(reg & MODE_LINK_STATUS);
1346 ++ }
1347 +
1348 + return 0;
1349 + }
1350 +diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
1351 +index 6df2cad61647..dfef4ec167c1 100644
1352 +--- a/drivers/net/ethernet/cadence/macb_main.c
1353 ++++ b/drivers/net/ethernet/cadence/macb_main.c
1354 +@@ -1884,14 +1884,17 @@ static void macb_reset_hw(struct macb *bp)
1355 + {
1356 + struct macb_queue *queue;
1357 + unsigned int q;
1358 ++ u32 ctrl = macb_readl(bp, NCR);
1359 +
1360 + /* Disable RX and TX (XXX: Should we halt the transmission
1361 + * more gracefully?)
1362 + */
1363 +- macb_writel(bp, NCR, 0);
1364 ++ ctrl &= ~(MACB_BIT(RE) | MACB_BIT(TE));
1365 +
1366 + /* Clear the stats registers (XXX: Update stats first?) */
1367 +- macb_writel(bp, NCR, MACB_BIT(CLRSTAT));
1368 ++ ctrl |= MACB_BIT(CLRSTAT);
1369 ++
1370 ++ macb_writel(bp, NCR, ctrl);
1371 +
1372 + /* Clear all status flags */
1373 + macb_writel(bp, TSR, -1);
1374 +@@ -2070,7 +2073,7 @@ static void macb_init_hw(struct macb *bp)
1375 + }
1376 +
1377 + /* Enable TX and RX */
1378 +- macb_writel(bp, NCR, MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(MPE));
1379 ++ macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
1380 + }
1381 +
1382 + /* The hash address register is 64 bits long and takes up two
1383 +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
1384 +index c133491ad9fa..654aad6e748b 100644
1385 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
1386 ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
1387 +@@ -3105,7 +3105,7 @@ static bool hclge_is_all_function_id_zero(struct hclge_desc *desc)
1388 + #define HCLGE_FUNC_NUMBER_PER_DESC 6
1389 + int i, j;
1390 +
1391 +- for (i = 0; i < HCLGE_DESC_NUMBER; i++)
1392 ++ for (i = 1; i < HCLGE_DESC_NUMBER; i++)
1393 + for (j = 0; j < HCLGE_FUNC_NUMBER_PER_DESC; j++)
1394 + if (desc[i].data[j])
1395 + return false;
1396 +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
1397 +index f32d719c4f77..8f90dd1be6b5 100644
1398 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
1399 ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mdio.c
1400 +@@ -187,6 +187,8 @@ int hclge_mac_start_phy(struct hclge_dev *hdev)
1401 + if (!phydev)
1402 + return 0;
1403 +
1404 ++ phydev->supported &= ~SUPPORTED_FIBRE;
1405 ++
1406 + ret = phy_connect_direct(netdev, phydev,
1407 + hclge_mac_adjust_link,
1408 + PHY_INTERFACE_MODE_SGMII);
1409 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
1410 +index 8c4ce0a0cc82..06eeea6b2f93 100644
1411 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
1412 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.h
1413 +@@ -395,6 +395,8 @@ int mlxsw_sp_netdevice_vrf_event(struct net_device *l3_dev, unsigned long event,
1414 + void
1415 + mlxsw_sp_port_vlan_router_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan);
1416 + void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif);
1417 ++void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp,
1418 ++ struct net_device *dev);
1419 +
1420 + /* spectrum_kvdl.c */
1421 + int mlxsw_sp_kvdl_alloc(struct mlxsw_sp *mlxsw_sp, unsigned int entry_count,
1422 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
1423 +index 516e63244606..3ed4fb346f23 100644
1424 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
1425 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
1426 +@@ -5131,6 +5131,17 @@ void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif)
1427 + mlxsw_sp_vr_put(vr);
1428 + }
1429 +
1430 ++void mlxsw_sp_rif_destroy_by_dev(struct mlxsw_sp *mlxsw_sp,
1431 ++ struct net_device *dev)
1432 ++{
1433 ++ struct mlxsw_sp_rif *rif;
1434 ++
1435 ++ rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev);
1436 ++ if (!rif)
1437 ++ return;
1438 ++ mlxsw_sp_rif_destroy(rif);
1439 ++}
1440 ++
1441 + static void
1442 + mlxsw_sp_rif_subport_params_init(struct mlxsw_sp_rif_params *params,
1443 + struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
1444 +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
1445 +index 7924f241e3ad..32c25772f755 100644
1446 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
1447 ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
1448 +@@ -140,6 +140,24 @@ bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp,
1449 + return !!mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev);
1450 + }
1451 +
1452 ++static int mlxsw_sp_bridge_device_upper_rif_destroy(struct net_device *dev,
1453 ++ void *data)
1454 ++{
1455 ++ struct mlxsw_sp *mlxsw_sp = data;
1456 ++
1457 ++ mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev);
1458 ++ return 0;
1459 ++}
1460 ++
1461 ++static void mlxsw_sp_bridge_device_rifs_destroy(struct mlxsw_sp *mlxsw_sp,
1462 ++ struct net_device *dev)
1463 ++{
1464 ++ mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev);
1465 ++ netdev_walk_all_upper_dev_rcu(dev,
1466 ++ mlxsw_sp_bridge_device_upper_rif_destroy,
1467 ++ mlxsw_sp);
1468 ++}
1469 ++
1470 + static struct mlxsw_sp_bridge_device *
1471 + mlxsw_sp_bridge_device_create(struct mlxsw_sp_bridge *bridge,
1472 + struct net_device *br_dev)
1473 +@@ -176,6 +194,8 @@ static void
1474 + mlxsw_sp_bridge_device_destroy(struct mlxsw_sp_bridge *bridge,
1475 + struct mlxsw_sp_bridge_device *bridge_device)
1476 + {
1477 ++ mlxsw_sp_bridge_device_rifs_destroy(bridge->mlxsw_sp,
1478 ++ bridge_device->dev);
1479 + list_del(&bridge_device->list);
1480 + if (bridge_device->vlan_enabled)
1481 + bridge->vlan_enabled_exists = false;
1482 +diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1483 +index 8d53a593fb27..b482a8fb0e92 100644
1484 +--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1485 ++++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
1486 +@@ -227,29 +227,16 @@ done:
1487 + spin_unlock_bh(&nn->reconfig_lock);
1488 + }
1489 +
1490 +-/**
1491 +- * nfp_net_reconfig() - Reconfigure the firmware
1492 +- * @nn: NFP Net device to reconfigure
1493 +- * @update: The value for the update field in the BAR config
1494 +- *
1495 +- * Write the update word to the BAR and ping the reconfig queue. The
1496 +- * poll until the firmware has acknowledged the update by zeroing the
1497 +- * update word.
1498 +- *
1499 +- * Return: Negative errno on error, 0 on success
1500 +- */
1501 +-int nfp_net_reconfig(struct nfp_net *nn, u32 update)
1502 ++static void nfp_net_reconfig_sync_enter(struct nfp_net *nn)
1503 + {
1504 + bool cancelled_timer = false;
1505 + u32 pre_posted_requests;
1506 +- int ret;
1507 +
1508 + spin_lock_bh(&nn->reconfig_lock);
1509 +
1510 + nn->reconfig_sync_present = true;
1511 +
1512 + if (nn->reconfig_timer_active) {
1513 +- del_timer(&nn->reconfig_timer);
1514 + nn->reconfig_timer_active = false;
1515 + cancelled_timer = true;
1516 + }
1517 +@@ -258,14 +245,43 @@ int nfp_net_reconfig(struct nfp_net *nn, u32 update)
1518 +
1519 + spin_unlock_bh(&nn->reconfig_lock);
1520 +
1521 +- if (cancelled_timer)
1522 ++ if (cancelled_timer) {
1523 ++ del_timer_sync(&nn->reconfig_timer);
1524 + nfp_net_reconfig_wait(nn, nn->reconfig_timer.expires);
1525 ++ }
1526 +
1527 + /* Run the posted reconfigs which were issued before we started */
1528 + if (pre_posted_requests) {
1529 + nfp_net_reconfig_start(nn, pre_posted_requests);
1530 + nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT);
1531 + }
1532 ++}
1533 ++
1534 ++static void nfp_net_reconfig_wait_posted(struct nfp_net *nn)
1535 ++{
1536 ++ nfp_net_reconfig_sync_enter(nn);
1537 ++
1538 ++ spin_lock_bh(&nn->reconfig_lock);
1539 ++ nn->reconfig_sync_present = false;
1540 ++ spin_unlock_bh(&nn->reconfig_lock);
1541 ++}
1542 ++
1543 ++/**
1544 ++ * nfp_net_reconfig() - Reconfigure the firmware
1545 ++ * @nn: NFP Net device to reconfigure
1546 ++ * @update: The value for the update field in the BAR config
1547 ++ *
1548 ++ * Write the update word to the BAR and ping the reconfig queue. The
1549 ++ * poll until the firmware has acknowledged the update by zeroing the
1550 ++ * update word.
1551 ++ *
1552 ++ * Return: Negative errno on error, 0 on success
1553 ++ */
1554 ++int nfp_net_reconfig(struct nfp_net *nn, u32 update)
1555 ++{
1556 ++ int ret;
1557 ++
1558 ++ nfp_net_reconfig_sync_enter(nn);
1559 +
1560 + nfp_net_reconfig_start(nn, update);
1561 + ret = nfp_net_reconfig_wait(nn, jiffies + HZ * NFP_NET_POLL_TIMEOUT);
1562 +@@ -3560,6 +3576,7 @@ struct nfp_net *nfp_net_alloc(struct pci_dev *pdev, bool needs_netdev,
1563 + */
1564 + void nfp_net_free(struct nfp_net *nn)
1565 + {
1566 ++ WARN_ON(timer_pending(&nn->reconfig_timer) || nn->reconfig_posted);
1567 + if (nn->xdp_prog)
1568 + bpf_prog_put(nn->xdp_prog);
1569 +
1570 +@@ -3829,4 +3846,5 @@ void nfp_net_clean(struct nfp_net *nn)
1571 + return;
1572 +
1573 + unregister_netdev(nn->dp.netdev);
1574 ++ nfp_net_reconfig_wait_posted(nn);
1575 + }
1576 +diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
1577 +index 9feec7009443..0e3b2890b925 100644
1578 +--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
1579 ++++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
1580 +@@ -2386,26 +2386,20 @@ static int qlge_update_hw_vlan_features(struct net_device *ndev,
1581 + return status;
1582 + }
1583 +
1584 +-static netdev_features_t qlge_fix_features(struct net_device *ndev,
1585 +- netdev_features_t features)
1586 +-{
1587 +- int err;
1588 +-
1589 +- /* Update the behavior of vlan accel in the adapter */
1590 +- err = qlge_update_hw_vlan_features(ndev, features);
1591 +- if (err)
1592 +- return err;
1593 +-
1594 +- return features;
1595 +-}
1596 +-
1597 + static int qlge_set_features(struct net_device *ndev,
1598 + netdev_features_t features)
1599 + {
1600 + netdev_features_t changed = ndev->features ^ features;
1601 ++ int err;
1602 ++
1603 ++ if (changed & NETIF_F_HW_VLAN_CTAG_RX) {
1604 ++ /* Update the behavior of vlan accel in the adapter */
1605 ++ err = qlge_update_hw_vlan_features(ndev, features);
1606 ++ if (err)
1607 ++ return err;
1608 +
1609 +- if (changed & NETIF_F_HW_VLAN_CTAG_RX)
1610 + qlge_vlan_mode(ndev, features);
1611 ++ }
1612 +
1613 + return 0;
1614 + }
1615 +@@ -4719,7 +4713,6 @@ static const struct net_device_ops qlge_netdev_ops = {
1616 + .ndo_set_mac_address = qlge_set_mac_address,
1617 + .ndo_validate_addr = eth_validate_addr,
1618 + .ndo_tx_timeout = qlge_tx_timeout,
1619 +- .ndo_fix_features = qlge_fix_features,
1620 + .ndo_set_features = qlge_set_features,
1621 + .ndo_vlan_rx_add_vid = qlge_vlan_rx_add_vid,
1622 + .ndo_vlan_rx_kill_vid = qlge_vlan_rx_kill_vid,
1623 +diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
1624 +index b98fcc9e93e5..3669005b9294 100644
1625 +--- a/drivers/net/ethernet/realtek/r8169.c
1626 ++++ b/drivers/net/ethernet/realtek/r8169.c
1627 +@@ -329,6 +329,7 @@ static const struct pci_device_id rtl8169_pci_tbl[] = {
1628 + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8161), 0, 0, RTL_CFG_1 },
1629 + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8167), 0, 0, RTL_CFG_0 },
1630 + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8168), 0, 0, RTL_CFG_1 },
1631 ++ { PCI_DEVICE(PCI_VENDOR_ID_NCUBE, 0x8168), 0, 0, RTL_CFG_1 },
1632 + { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x8169), 0, 0, RTL_CFG_0 },
1633 + { PCI_VENDOR_ID_DLINK, 0x4300,
1634 + PCI_VENDOR_ID_DLINK, 0x4b10, 0, 0, RTL_CFG_1 },
1635 +diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
1636 +index 6a77ef38c549..aba16d81e9bb 100644
1637 +--- a/drivers/net/hyperv/netvsc_drv.c
1638 ++++ b/drivers/net/hyperv/netvsc_drv.c
1639 +@@ -29,6 +29,7 @@
1640 + #include <linux/netdevice.h>
1641 + #include <linux/inetdevice.h>
1642 + #include <linux/etherdevice.h>
1643 ++#include <linux/pci.h>
1644 + #include <linux/skbuff.h>
1645 + #include <linux/if_vlan.h>
1646 + #include <linux/in.h>
1647 +@@ -1895,11 +1896,15 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
1648 + {
1649 + struct net_device *ndev;
1650 + struct net_device_context *net_device_ctx;
1651 ++ struct device *pdev = vf_netdev->dev.parent;
1652 + struct netvsc_device *netvsc_dev;
1653 +
1654 + if (vf_netdev->addr_len != ETH_ALEN)
1655 + return NOTIFY_DONE;
1656 +
1657 ++ if (!pdev || !dev_is_pci(pdev) || dev_is_pf(pdev))
1658 ++ return NOTIFY_DONE;
1659 ++
1660 + /*
1661 + * We will use the MAC address to locate the synthetic interface to
1662 + * associate with the VF interface. If we don't find a matching
1663 +@@ -2039,6 +2044,16 @@ static int netvsc_probe(struct hv_device *dev,
1664 +
1665 + memcpy(net->dev_addr, device_info.mac_adr, ETH_ALEN);
1666 +
1667 ++ /* We must get rtnl lock before scheduling nvdev->subchan_work,
1668 ++ * otherwise netvsc_subchan_work() can get rtnl lock first and wait
1669 ++ * all subchannels to show up, but that may not happen because
1670 ++ * netvsc_probe() can't get rtnl lock and as a result vmbus_onoffer()
1671 ++ * -> ... -> device_add() -> ... -> __device_attach() can't get
1672 ++ * the device lock, so all the subchannels can't be processed --
1673 ++ * finally netvsc_subchan_work() hangs for ever.
1674 ++ */
1675 ++ rtnl_lock();
1676 ++
1677 + if (nvdev->num_chn > 1)
1678 + schedule_work(&nvdev->subchan_work);
1679 +
1680 +@@ -2057,7 +2072,6 @@ static int netvsc_probe(struct hv_device *dev,
1681 + else
1682 + net->max_mtu = ETH_DATA_LEN;
1683 +
1684 +- rtnl_lock();
1685 + ret = register_netdevice(net);
1686 + if (ret != 0) {
1687 + pr_err("Unable to register netdev.\n");
1688 +diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
1689 +index 8d88f19dc171..12c1c1851ee6 100644
1690 +--- a/drivers/pci/host/pci-mvebu.c
1691 ++++ b/drivers/pci/host/pci-mvebu.c
1692 +@@ -1220,7 +1220,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
1693 + pcie->realio.start = PCIBIOS_MIN_IO;
1694 + pcie->realio.end = min_t(resource_size_t,
1695 + IO_SPACE_LIMIT,
1696 +- resource_size(&pcie->io));
1697 ++ resource_size(&pcie->io) - 1);
1698 + } else
1699 + pcie->realio = pcie->io;
1700 +
1701 +diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c
1702 +index 5269a01d9bdd..a6a33327f5e7 100644
1703 +--- a/drivers/platform/x86/asus-nb-wmi.c
1704 ++++ b/drivers/platform/x86/asus-nb-wmi.c
1705 +@@ -487,6 +487,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
1706 + { KE_KEY, 0xC4, { KEY_KBDILLUMUP } },
1707 + { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } },
1708 + { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */
1709 ++ { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */
1710 + { KE_END, 0},
1711 + };
1712 +
1713 +diff --git a/drivers/platform/x86/intel_punit_ipc.c b/drivers/platform/x86/intel_punit_ipc.c
1714 +index b5b890127479..b7dfe06261f1 100644
1715 +--- a/drivers/platform/x86/intel_punit_ipc.c
1716 ++++ b/drivers/platform/x86/intel_punit_ipc.c
1717 +@@ -17,6 +17,7 @@
1718 + #include <linux/bitops.h>
1719 + #include <linux/device.h>
1720 + #include <linux/interrupt.h>
1721 ++#include <linux/io.h>
1722 + #include <linux/platform_device.h>
1723 + #include <asm/intel_punit_ipc.h>
1724 +
1725 +diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
1726 +index d589331d1884..3540d00425d0 100644
1727 +--- a/drivers/pwm/pwm-meson.c
1728 ++++ b/drivers/pwm/pwm-meson.c
1729 +@@ -432,7 +432,6 @@ static int meson_pwm_init_channels(struct meson_pwm *meson,
1730 + struct meson_pwm_channel *channels)
1731 + {
1732 + struct device *dev = meson->chip.dev;
1733 +- struct device_node *np = dev->of_node;
1734 + struct clk_init_data init;
1735 + unsigned int i;
1736 + char name[255];
1737 +@@ -441,7 +440,7 @@ static int meson_pwm_init_channels(struct meson_pwm *meson,
1738 + for (i = 0; i < meson->chip.npwm; i++) {
1739 + struct meson_pwm_channel *channel = &channels[i];
1740 +
1741 +- snprintf(name, sizeof(name), "%pOF#mux%u", np, i);
1742 ++ snprintf(name, sizeof(name), "%s#mux%u", dev_name(dev), i);
1743 +
1744 + init.name = name;
1745 + init.ops = &clk_mux_ops;
1746 +diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
1747 +index 5ede251c52ca..4c7c8455da96 100644
1748 +--- a/drivers/s390/block/dasd_eckd.c
1749 ++++ b/drivers/s390/block/dasd_eckd.c
1750 +@@ -1778,6 +1778,9 @@ static void dasd_eckd_uncheck_device(struct dasd_device *device)
1751 + struct dasd_eckd_private *private = device->private;
1752 + int i;
1753 +
1754 ++ if (!private)
1755 ++ return;
1756 ++
1757 + dasd_alias_disconnect_device_from_lcu(device);
1758 + private->ned = NULL;
1759 + private->sneq = NULL;
1760 +@@ -2032,8 +2035,11 @@ static int dasd_eckd_basic_to_ready(struct dasd_device *device)
1761 +
1762 + static int dasd_eckd_online_to_ready(struct dasd_device *device)
1763 + {
1764 +- cancel_work_sync(&device->reload_device);
1765 +- cancel_work_sync(&device->kick_validate);
1766 ++ if (cancel_work_sync(&device->reload_device))
1767 ++ dasd_put_device(device);
1768 ++ if (cancel_work_sync(&device->kick_validate))
1769 ++ dasd_put_device(device);
1770 ++
1771 + return 0;
1772 + };
1773 +
1774 +diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
1775 +index 6c838865ac5a..4a4746cc6745 100644
1776 +--- a/drivers/scsi/aic94xx/aic94xx_init.c
1777 ++++ b/drivers/scsi/aic94xx/aic94xx_init.c
1778 +@@ -1030,8 +1030,10 @@ static int __init aic94xx_init(void)
1779 +
1780 + aic94xx_transport_template =
1781 + sas_domain_attach_transport(&aic94xx_transport_functions);
1782 +- if (!aic94xx_transport_template)
1783 ++ if (!aic94xx_transport_template) {
1784 ++ err = -ENOMEM;
1785 + goto out_destroy_caches;
1786 ++ }
1787 +
1788 + err = pci_register_driver(&aic94xx_pci_driver);
1789 + if (err)
1790 +diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
1791 +index 2cac160993bb..158f3e83efb6 100644
1792 +--- a/drivers/staging/comedi/drivers/ni_mio_common.c
1793 ++++ b/drivers/staging/comedi/drivers/ni_mio_common.c
1794 +@@ -5453,11 +5453,11 @@ static int ni_E_init(struct comedi_device *dev,
1795 + /* Digital I/O (PFI) subdevice */
1796 + s = &dev->subdevices[NI_PFI_DIO_SUBDEV];
1797 + s->type = COMEDI_SUBD_DIO;
1798 +- s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
1799 + s->maxdata = 1;
1800 + if (devpriv->is_m_series) {
1801 + s->n_chan = 16;
1802 + s->insn_bits = ni_pfi_insn_bits;
1803 ++ s->subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL;
1804 +
1805 + ni_writew(dev, s->state, NI_M_PFI_DO_REG);
1806 + for (i = 0; i < NUM_PFI_OUTPUT_SELECT_REGS; ++i) {
1807 +@@ -5466,6 +5466,7 @@ static int ni_E_init(struct comedi_device *dev,
1808 + }
1809 + } else {
1810 + s->n_chan = 10;
1811 ++ s->subdev_flags = SDF_INTERNAL;
1812 + }
1813 + s->insn_config = ni_pfi_insn_config;
1814 +
1815 +diff --git a/drivers/staging/irda/net/af_irda.c b/drivers/staging/irda/net/af_irda.c
1816 +index 23fa7c8b09a5..cebe9878ca03 100644
1817 +--- a/drivers/staging/irda/net/af_irda.c
1818 ++++ b/drivers/staging/irda/net/af_irda.c
1819 +@@ -775,6 +775,13 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1820 + return -EINVAL;
1821 +
1822 + lock_sock(sk);
1823 ++
1824 ++ /* Ensure that the socket is not already bound */
1825 ++ if (self->ias_obj) {
1826 ++ err = -EINVAL;
1827 ++ goto out;
1828 ++ }
1829 ++
1830 + #ifdef CONFIG_IRDA_ULTRA
1831 + /* Special care for Ultra sockets */
1832 + if ((sk->sk_type == SOCK_DGRAM) &&
1833 +@@ -2012,7 +2019,11 @@ static int irda_setsockopt(struct socket *sock, int level, int optname,
1834 + err = -EINVAL;
1835 + goto out;
1836 + }
1837 +- irias_insert_object(ias_obj);
1838 ++
1839 ++ /* Only insert newly allocated objects */
1840 ++ if (free_ias)
1841 ++ irias_insert_object(ias_obj);
1842 ++
1843 + kfree(ias_opt);
1844 + break;
1845 + case IRLMP_IAS_DEL:
1846 +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1847 +index dca78bb20e5d..8b323a360e03 100644
1848 +--- a/drivers/usb/dwc3/core.c
1849 ++++ b/drivers/usb/dwc3/core.c
1850 +@@ -511,6 +511,22 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
1851 + parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8);
1852 + }
1853 +
1854 ++static int dwc3_core_ulpi_init(struct dwc3 *dwc)
1855 ++{
1856 ++ int intf;
1857 ++ int ret = 0;
1858 ++
1859 ++ intf = DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3);
1860 ++
1861 ++ if (intf == DWC3_GHWPARAMS3_HSPHY_IFC_ULPI ||
1862 ++ (intf == DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI &&
1863 ++ dwc->hsphy_interface &&
1864 ++ !strncmp(dwc->hsphy_interface, "ulpi", 4)))
1865 ++ ret = dwc3_ulpi_init(dwc);
1866 ++
1867 ++ return ret;
1868 ++}
1869 ++
1870 + /**
1871 + * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
1872 + * @dwc: Pointer to our controller context structure
1873 +@@ -522,7 +538,6 @@ static void dwc3_cache_hwparams(struct dwc3 *dwc)
1874 + static int dwc3_phy_setup(struct dwc3 *dwc)
1875 + {
1876 + u32 reg;
1877 +- int ret;
1878 +
1879 + reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
1880 +
1881 +@@ -593,9 +608,6 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
1882 + }
1883 + /* FALLTHROUGH */
1884 + case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
1885 +- ret = dwc3_ulpi_init(dwc);
1886 +- if (ret)
1887 +- return ret;
1888 + /* FALLTHROUGH */
1889 + default:
1890 + break;
1891 +@@ -752,6 +764,7 @@ static void dwc3_core_setup_global_control(struct dwc3 *dwc)
1892 + }
1893 +
1894 + static int dwc3_core_get_phy(struct dwc3 *dwc);
1895 ++static int dwc3_core_ulpi_init(struct dwc3 *dwc);
1896 +
1897 + /**
1898 + * dwc3_core_init - Low-level initialization of DWC3 Core
1899 +@@ -783,17 +796,27 @@ static int dwc3_core_init(struct dwc3 *dwc)
1900 + dwc->maximum_speed = USB_SPEED_HIGH;
1901 + }
1902 +
1903 +- ret = dwc3_core_get_phy(dwc);
1904 ++ ret = dwc3_phy_setup(dwc);
1905 + if (ret)
1906 + goto err0;
1907 +
1908 +- ret = dwc3_core_soft_reset(dwc);
1909 +- if (ret)
1910 +- goto err0;
1911 ++ if (!dwc->ulpi_ready) {
1912 ++ ret = dwc3_core_ulpi_init(dwc);
1913 ++ if (ret)
1914 ++ goto err0;
1915 ++ dwc->ulpi_ready = true;
1916 ++ }
1917 +
1918 +- ret = dwc3_phy_setup(dwc);
1919 ++ if (!dwc->phys_ready) {
1920 ++ ret = dwc3_core_get_phy(dwc);
1921 ++ if (ret)
1922 ++ goto err0a;
1923 ++ dwc->phys_ready = true;
1924 ++ }
1925 ++
1926 ++ ret = dwc3_core_soft_reset(dwc);
1927 + if (ret)
1928 +- goto err0;
1929 ++ goto err0a;
1930 +
1931 + dwc3_core_setup_global_control(dwc);
1932 + dwc3_core_num_eps(dwc);
1933 +@@ -866,6 +889,9 @@ err1:
1934 + phy_exit(dwc->usb2_generic_phy);
1935 + phy_exit(dwc->usb3_generic_phy);
1936 +
1937 ++err0a:
1938 ++ dwc3_ulpi_exit(dwc);
1939 ++
1940 + err0:
1941 + return ret;
1942 + }
1943 +@@ -1256,7 +1282,6 @@ err4:
1944 +
1945 + err3:
1946 + dwc3_free_event_buffers(dwc);
1947 +- dwc3_ulpi_exit(dwc);
1948 +
1949 + err2:
1950 + pm_runtime_allow(&pdev->dev);
1951 +diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
1952 +index b782ba58a7fc..abd1142c9e4d 100644
1953 +--- a/drivers/usb/dwc3/core.h
1954 ++++ b/drivers/usb/dwc3/core.h
1955 +@@ -805,7 +805,9 @@ struct dwc3_scratchpad_array {
1956 + * @usb3_phy: pointer to USB3 PHY
1957 + * @usb2_generic_phy: pointer to USB2 PHY
1958 + * @usb3_generic_phy: pointer to USB3 PHY
1959 ++ * @phys_ready: flag to indicate that PHYs are ready
1960 + * @ulpi: pointer to ulpi interface
1961 ++ * @ulpi_ready: flag to indicate that ULPI is initialized
1962 + * @isoch_delay: wValue from Set Isochronous Delay request;
1963 + * @u2sel: parameter from Set SEL request.
1964 + * @u2pel: parameter from Set SEL request.
1965 +@@ -903,7 +905,10 @@ struct dwc3 {
1966 + struct phy *usb2_generic_phy;
1967 + struct phy *usb3_generic_phy;
1968 +
1969 ++ bool phys_ready;
1970 ++
1971 + struct ulpi *ulpi;
1972 ++ bool ulpi_ready;
1973 +
1974 + void __iomem *regs;
1975 + size_t regs_size;
1976 +diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
1977 +index 3cf74f54c7a1..7ee3167bc083 100644
1978 +--- a/drivers/vhost/vhost.c
1979 ++++ b/drivers/vhost/vhost.c
1980 +@@ -960,7 +960,7 @@ static void vhost_iotlb_notify_vq(struct vhost_dev *d,
1981 + list_for_each_entry_safe(node, n, &d->pending_list, node) {
1982 + struct vhost_iotlb_msg *vq_msg = &node->msg.iotlb;
1983 + if (msg->iova <= vq_msg->iova &&
1984 +- msg->iova + msg->size - 1 > vq_msg->iova &&
1985 ++ msg->iova + msg->size - 1 >= vq_msg->iova &&
1986 + vq_msg->type == VHOST_IOTLB_MISS) {
1987 + vhost_poll_queue(&node->vq->poll);
1988 + list_del(&node->node);
1989 +diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c
1990 +index 2780886e8ba3..de062fb201bc 100644
1991 +--- a/drivers/virtio/virtio_pci_legacy.c
1992 ++++ b/drivers/virtio/virtio_pci_legacy.c
1993 +@@ -122,6 +122,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
1994 + struct virtqueue *vq;
1995 + u16 num;
1996 + int err;
1997 ++ u64 q_pfn;
1998 +
1999 + /* Select the queue we're interested in */
2000 + iowrite16(index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
2001 +@@ -141,9 +142,17 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
2002 + if (!vq)
2003 + return ERR_PTR(-ENOMEM);
2004 +
2005 ++ q_pfn = virtqueue_get_desc_addr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT;
2006 ++ if (q_pfn >> 32) {
2007 ++ dev_err(&vp_dev->pci_dev->dev,
2008 ++ "platform bug: legacy virtio-mmio must not be used with RAM above 0x%llxGB\n",
2009 ++ 0x1ULL << (32 + PAGE_SHIFT - 30));
2010 ++ err = -E2BIG;
2011 ++ goto out_del_vq;
2012 ++ }
2013 ++
2014 + /* activate the queue */
2015 +- iowrite32(virtqueue_get_desc_addr(vq) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT,
2016 +- vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
2017 ++ iowrite32(q_pfn, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
2018 +
2019 + vq->priv = (void __force *)vp_dev->ioaddr + VIRTIO_PCI_QUEUE_NOTIFY;
2020 +
2021 +@@ -160,6 +169,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
2022 +
2023 + out_deactivate:
2024 + iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
2025 ++out_del_vq:
2026 + vring_del_virtqueue(vq);
2027 + return ERR_PTR(err);
2028 + }
2029 +diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
2030 +index b437fccd4e62..294f35ce9e46 100644
2031 +--- a/drivers/xen/xen-balloon.c
2032 ++++ b/drivers/xen/xen-balloon.c
2033 +@@ -81,7 +81,7 @@ static void watch_target(struct xenbus_watch *watch,
2034 + static_max = new_target;
2035 + else
2036 + static_max >>= PAGE_SHIFT - 10;
2037 +- target_diff = xen_pv_domain() ? 0
2038 ++ target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
2039 + : static_max - balloon_stats.target_pages;
2040 + }
2041 +
2042 +diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
2043 +index 7c655f9a7a50..dd80a1bdf9e2 100644
2044 +--- a/fs/btrfs/dev-replace.c
2045 ++++ b/fs/btrfs/dev-replace.c
2046 +@@ -588,6 +588,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
2047 +
2048 + btrfs_rm_dev_replace_unblocked(fs_info);
2049 +
2050 ++ /*
2051 ++ * Increment dev_stats_ccnt so that btrfs_run_dev_stats() will
2052 ++ * update on-disk dev stats value during commit transaction
2053 ++ */
2054 ++ atomic_inc(&tgt_device->dev_stats_ccnt);
2055 ++
2056 + /*
2057 + * this is again a consistent state where no dev_replace procedure
2058 + * is running, the target device is part of the filesystem, the
2059 +diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
2060 +index bbabe37c2e8c..f96f72659693 100644
2061 +--- a/fs/btrfs/extent-tree.c
2062 ++++ b/fs/btrfs/extent-tree.c
2063 +@@ -10757,7 +10757,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
2064 + /* Don't want to race with allocators so take the groups_sem */
2065 + down_write(&space_info->groups_sem);
2066 + spin_lock(&block_group->lock);
2067 +- if (block_group->reserved ||
2068 ++ if (block_group->reserved || block_group->pinned ||
2069 + btrfs_block_group_used(&block_group->item) ||
2070 + block_group->ro ||
2071 + list_is_singular(&block_group->list)) {
2072 +diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
2073 +index 9841faef08ea..b80b03e0c5d3 100644
2074 +--- a/fs/btrfs/relocation.c
2075 ++++ b/fs/btrfs/relocation.c
2076 +@@ -1334,18 +1334,19 @@ static void __del_reloc_root(struct btrfs_root *root)
2077 + struct mapping_node *node = NULL;
2078 + struct reloc_control *rc = fs_info->reloc_ctl;
2079 +
2080 +- spin_lock(&rc->reloc_root_tree.lock);
2081 +- rb_node = tree_search(&rc->reloc_root_tree.rb_root,
2082 +- root->node->start);
2083 +- if (rb_node) {
2084 +- node = rb_entry(rb_node, struct mapping_node, rb_node);
2085 +- rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root);
2086 ++ if (rc) {
2087 ++ spin_lock(&rc->reloc_root_tree.lock);
2088 ++ rb_node = tree_search(&rc->reloc_root_tree.rb_root,
2089 ++ root->node->start);
2090 ++ if (rb_node) {
2091 ++ node = rb_entry(rb_node, struct mapping_node, rb_node);
2092 ++ rb_erase(&node->rb_node, &rc->reloc_root_tree.rb_root);
2093 ++ }
2094 ++ spin_unlock(&rc->reloc_root_tree.lock);
2095 ++ if (!node)
2096 ++ return;
2097 ++ BUG_ON((struct btrfs_root *)node->data != root);
2098 + }
2099 +- spin_unlock(&rc->reloc_root_tree.lock);
2100 +-
2101 +- if (!node)
2102 +- return;
2103 +- BUG_ON((struct btrfs_root *)node->data != root);
2104 +
2105 + spin_lock(&fs_info->trans_lock);
2106 + list_del_init(&root->root_list);
2107 +diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
2108 +index 08afafb6ecf7..a39b1f0b0606 100644
2109 +--- a/fs/btrfs/volumes.c
2110 ++++ b/fs/btrfs/volumes.c
2111 +@@ -6492,10 +6492,14 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
2112 + write_lock(&map_tree->map_tree.lock);
2113 + ret = add_extent_mapping(&map_tree->map_tree, em, 0);
2114 + write_unlock(&map_tree->map_tree.lock);
2115 +- BUG_ON(ret); /* Tree corruption */
2116 ++ if (ret < 0) {
2117 ++ btrfs_err(fs_info,
2118 ++ "failed to add chunk map, start=%llu len=%llu: %d",
2119 ++ em->start, em->len, ret);
2120 ++ }
2121 + free_extent_map(em);
2122 +
2123 +- return 0;
2124 ++ return ret;
2125 + }
2126 +
2127 + static void fill_device_from_item(struct extent_buffer *leaf,
2128 +diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
2129 +index 53c9c49f0fbb..2565cee702e4 100644
2130 +--- a/fs/cifs/cifs_debug.c
2131 ++++ b/fs/cifs/cifs_debug.c
2132 +@@ -289,6 +289,10 @@ static ssize_t cifs_stats_proc_write(struct file *file,
2133 + atomic_set(&totBufAllocCount, 0);
2134 + atomic_set(&totSmBufAllocCount, 0);
2135 + #endif /* CONFIG_CIFS_STATS2 */
2136 ++ spin_lock(&GlobalMid_Lock);
2137 ++ GlobalMaxActiveXid = 0;
2138 ++ GlobalCurrentXid = 0;
2139 ++ spin_unlock(&GlobalMid_Lock);
2140 + spin_lock(&cifs_tcp_ses_lock);
2141 + list_for_each(tmp1, &cifs_tcp_ses_list) {
2142 + server = list_entry(tmp1, struct TCP_Server_Info,
2143 +@@ -301,6 +305,10 @@ static ssize_t cifs_stats_proc_write(struct file *file,
2144 + struct cifs_tcon,
2145 + tcon_list);
2146 + atomic_set(&tcon->num_smbs_sent, 0);
2147 ++ spin_lock(&tcon->stat_lock);
2148 ++ tcon->bytes_read = 0;
2149 ++ tcon->bytes_written = 0;
2150 ++ spin_unlock(&tcon->stat_lock);
2151 + if (server->ops->clear_stats)
2152 + server->ops->clear_stats(tcon);
2153 + }
2154 +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
2155 +index 7b08a1446a7f..efdfdb47a7dd 100644
2156 +--- a/fs/cifs/smb2misc.c
2157 ++++ b/fs/cifs/smb2misc.c
2158 +@@ -211,6 +211,13 @@ smb2_check_message(char *buf, unsigned int length, struct TCP_Server_Info *srvr)
2159 + if (clc_len == 4 + len + 1)
2160 + return 0;
2161 +
2162 ++ /*
2163 ++ * Some windows servers (win2016) will pad also the final
2164 ++ * PDU in a compound to 8 bytes.
2165 ++ */
2166 ++ if (((clc_len + 7) & ~7) == len)
2167 ++ return 0;
2168 ++
2169 + /*
2170 + * MacOS server pads after SMB2.1 write response with 3 bytes
2171 + * of junk. Other servers match RFC1001 len to actual
2172 +diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
2173 +index e317e9a400c1..58842b36481d 100644
2174 +--- a/fs/cifs/smb2pdu.c
2175 ++++ b/fs/cifs/smb2pdu.c
2176 +@@ -393,7 +393,7 @@ small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon,
2177 + pdu->hdr.smb2_buf_length = cpu_to_be32(total_len);
2178 +
2179 + if (tcon != NULL) {
2180 +-#ifdef CONFIG_CIFS_STATS2
2181 ++#ifdef CONFIG_CIFS_STATS
2182 + uint16_t com_code = le16_to_cpu(smb2_command);
2183 + cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
2184 + #endif
2185 +diff --git a/fs/dcache.c b/fs/dcache.c
2186 +index 8d4935978fec..c1a7c174a905 100644
2187 +--- a/fs/dcache.c
2188 ++++ b/fs/dcache.c
2189 +@@ -291,7 +291,8 @@ void take_dentry_name_snapshot(struct name_snapshot *name, struct dentry *dentry
2190 + spin_unlock(&dentry->d_lock);
2191 + name->name = p->name;
2192 + } else {
2193 +- memcpy(name->inline_name, dentry->d_iname, DNAME_INLINE_LEN);
2194 ++ memcpy(name->inline_name, dentry->d_iname,
2195 ++ dentry->d_name.len + 1);
2196 + spin_unlock(&dentry->d_lock);
2197 + name->name = name->inline_name;
2198 + }
2199 +diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
2200 +index 85142e5df88b..e10bd73f0723 100644
2201 +--- a/fs/f2fs/data.c
2202 ++++ b/fs/f2fs/data.c
2203 +@@ -2190,6 +2190,10 @@ static int f2fs_set_data_page_dirty(struct page *page)
2204 + if (!PageUptodate(page))
2205 + SetPageUptodate(page);
2206 +
2207 ++ /* don't remain PG_checked flag which was set during GC */
2208 ++ if (is_cold_data(page))
2209 ++ clear_cold_data(page);
2210 ++
2211 + if (f2fs_is_atomic_file(inode) && !f2fs_is_commit_atomic_write(inode)) {
2212 + if (!IS_ATOMIC_WRITTEN_PAGE(page)) {
2213 + register_inmem_page(inode, page);
2214 +diff --git a/fs/fat/cache.c b/fs/fat/cache.c
2215 +index e9bed49df6b7..78d501c1fb65 100644
2216 +--- a/fs/fat/cache.c
2217 ++++ b/fs/fat/cache.c
2218 +@@ -225,7 +225,8 @@ static inline void cache_init(struct fat_cache_id *cid, int fclus, int dclus)
2219 + int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
2220 + {
2221 + struct super_block *sb = inode->i_sb;
2222 +- const int limit = sb->s_maxbytes >> MSDOS_SB(sb)->cluster_bits;
2223 ++ struct msdos_sb_info *sbi = MSDOS_SB(sb);
2224 ++ const int limit = sb->s_maxbytes >> sbi->cluster_bits;
2225 + struct fat_entry fatent;
2226 + struct fat_cache_id cid;
2227 + int nr;
2228 +@@ -234,6 +235,12 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
2229 +
2230 + *fclus = 0;
2231 + *dclus = MSDOS_I(inode)->i_start;
2232 ++ if (!fat_valid_entry(sbi, *dclus)) {
2233 ++ fat_fs_error_ratelimit(sb,
2234 ++ "%s: invalid start cluster (i_pos %lld, start %08x)",
2235 ++ __func__, MSDOS_I(inode)->i_pos, *dclus);
2236 ++ return -EIO;
2237 ++ }
2238 + if (cluster == 0)
2239 + return 0;
2240 +
2241 +@@ -250,9 +257,8 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
2242 + /* prevent the infinite loop of cluster chain */
2243 + if (*fclus > limit) {
2244 + fat_fs_error_ratelimit(sb,
2245 +- "%s: detected the cluster chain loop"
2246 +- " (i_pos %lld)", __func__,
2247 +- MSDOS_I(inode)->i_pos);
2248 ++ "%s: detected the cluster chain loop (i_pos %lld)",
2249 ++ __func__, MSDOS_I(inode)->i_pos);
2250 + nr = -EIO;
2251 + goto out;
2252 + }
2253 +@@ -262,9 +268,8 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus)
2254 + goto out;
2255 + else if (nr == FAT_ENT_FREE) {
2256 + fat_fs_error_ratelimit(sb,
2257 +- "%s: invalid cluster chain (i_pos %lld)",
2258 +- __func__,
2259 +- MSDOS_I(inode)->i_pos);
2260 ++ "%s: invalid cluster chain (i_pos %lld)",
2261 ++ __func__, MSDOS_I(inode)->i_pos);
2262 + nr = -EIO;
2263 + goto out;
2264 + } else if (nr == FAT_ENT_EOF) {
2265 +diff --git a/fs/fat/fat.h b/fs/fat/fat.h
2266 +index 8fc1093da47d..a0a00f3734bc 100644
2267 +--- a/fs/fat/fat.h
2268 ++++ b/fs/fat/fat.h
2269 +@@ -348,6 +348,11 @@ static inline void fatent_brelse(struct fat_entry *fatent)
2270 + fatent->fat_inode = NULL;
2271 + }
2272 +
2273 ++static inline bool fat_valid_entry(struct msdos_sb_info *sbi, int entry)
2274 ++{
2275 ++ return FAT_START_ENT <= entry && entry < sbi->max_cluster;
2276 ++}
2277 ++
2278 + extern void fat_ent_access_init(struct super_block *sb);
2279 + extern int fat_ent_read(struct inode *inode, struct fat_entry *fatent,
2280 + int entry);
2281 +diff --git a/fs/fat/fatent.c b/fs/fat/fatent.c
2282 +index 48b2336692f9..a40f36b1b292 100644
2283 +--- a/fs/fat/fatent.c
2284 ++++ b/fs/fat/fatent.c
2285 +@@ -23,7 +23,7 @@ static void fat12_ent_blocknr(struct super_block *sb, int entry,
2286 + {
2287 + struct msdos_sb_info *sbi = MSDOS_SB(sb);
2288 + int bytes = entry + (entry >> 1);
2289 +- WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry);
2290 ++ WARN_ON(!fat_valid_entry(sbi, entry));
2291 + *offset = bytes & (sb->s_blocksize - 1);
2292 + *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits);
2293 + }
2294 +@@ -33,7 +33,7 @@ static void fat_ent_blocknr(struct super_block *sb, int entry,
2295 + {
2296 + struct msdos_sb_info *sbi = MSDOS_SB(sb);
2297 + int bytes = (entry << sbi->fatent_shift);
2298 +- WARN_ON(entry < FAT_START_ENT || sbi->max_cluster <= entry);
2299 ++ WARN_ON(!fat_valid_entry(sbi, entry));
2300 + *offset = bytes & (sb->s_blocksize - 1);
2301 + *blocknr = sbi->fat_start + (bytes >> sb->s_blocksize_bits);
2302 + }
2303 +@@ -353,7 +353,7 @@ int fat_ent_read(struct inode *inode, struct fat_entry *fatent, int entry)
2304 + int err, offset;
2305 + sector_t blocknr;
2306 +
2307 +- if (entry < FAT_START_ENT || sbi->max_cluster <= entry) {
2308 ++ if (!fat_valid_entry(sbi, entry)) {
2309 + fatent_brelse(fatent);
2310 + fat_fs_error(sb, "invalid access to FAT (entry 0x%08x)", entry);
2311 + return -EIO;
2312 +diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
2313 +index ad04a5741016..9a8772465a90 100644
2314 +--- a/fs/hfs/brec.c
2315 ++++ b/fs/hfs/brec.c
2316 +@@ -75,9 +75,10 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)
2317 + if (!fd->bnode) {
2318 + if (!tree->root)
2319 + hfs_btree_inc_height(tree);
2320 +- fd->bnode = hfs_bnode_find(tree, tree->leaf_head);
2321 +- if (IS_ERR(fd->bnode))
2322 +- return PTR_ERR(fd->bnode);
2323 ++ node = hfs_bnode_find(tree, tree->leaf_head);
2324 ++ if (IS_ERR(node))
2325 ++ return PTR_ERR(node);
2326 ++ fd->bnode = node;
2327 + fd->record = -1;
2328 + }
2329 + new_node = NULL;
2330 +diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
2331 +index e8120a282435..1a44c4621e74 100644
2332 +--- a/fs/hfsplus/dir.c
2333 ++++ b/fs/hfsplus/dir.c
2334 +@@ -78,13 +78,13 @@ again:
2335 + cpu_to_be32(HFSP_HARDLINK_TYPE) &&
2336 + entry.file.user_info.fdCreator ==
2337 + cpu_to_be32(HFSP_HFSPLUS_CREATOR) &&
2338 ++ HFSPLUS_SB(sb)->hidden_dir &&
2339 + (entry.file.create_date ==
2340 + HFSPLUS_I(HFSPLUS_SB(sb)->hidden_dir)->
2341 + create_date ||
2342 + entry.file.create_date ==
2343 + HFSPLUS_I(d_inode(sb->s_root))->
2344 +- create_date) &&
2345 +- HFSPLUS_SB(sb)->hidden_dir) {
2346 ++ create_date)) {
2347 + struct qstr str;
2348 + char name[32];
2349 +
2350 +diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
2351 +index 3cba08c931ee..410f59372f19 100644
2352 +--- a/fs/hfsplus/super.c
2353 ++++ b/fs/hfsplus/super.c
2354 +@@ -524,8 +524,10 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
2355 + goto out_put_root;
2356 + if (!hfs_brec_read(&fd, &entry, sizeof(entry))) {
2357 + hfs_find_exit(&fd);
2358 +- if (entry.type != cpu_to_be16(HFSPLUS_FOLDER))
2359 ++ if (entry.type != cpu_to_be16(HFSPLUS_FOLDER)) {
2360 ++ err = -EINVAL;
2361 + goto out_put_root;
2362 ++ }
2363 + inode = hfsplus_iget(sb, be32_to_cpu(entry.folder.id));
2364 + if (IS_ERR(inode)) {
2365 + err = PTR_ERR(inode);
2366 +diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
2367 +index dda4a3a3ef6e..77c7d29fcd3b 100644
2368 +--- a/fs/nfs/nfs4proc.c
2369 ++++ b/fs/nfs/nfs4proc.c
2370 +@@ -7497,7 +7497,7 @@ static int nfs4_sp4_select_mode(struct nfs_client *clp,
2371 + }
2372 + out:
2373 + clp->cl_sp4_flags = flags;
2374 +- return 0;
2375 ++ return ret;
2376 + }
2377 +
2378 + struct nfs41_exchange_id_data {
2379 +diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
2380 +index e64ecb9f2720..66c373230e60 100644
2381 +--- a/fs/proc/kcore.c
2382 ++++ b/fs/proc/kcore.c
2383 +@@ -384,8 +384,10 @@ static void elf_kcore_store_hdr(char *bufp, int nphdr, int dataoff)
2384 + phdr->p_flags = PF_R|PF_W|PF_X;
2385 + phdr->p_offset = kc_vaddr_to_offset(m->addr) + dataoff;
2386 + phdr->p_vaddr = (size_t)m->addr;
2387 +- if (m->type == KCORE_RAM || m->type == KCORE_TEXT)
2388 ++ if (m->type == KCORE_RAM)
2389 + phdr->p_paddr = __pa(m->addr);
2390 ++ else if (m->type == KCORE_TEXT)
2391 ++ phdr->p_paddr = __pa_symbol(m->addr);
2392 + else
2393 + phdr->p_paddr = (elf_addr_t)-1;
2394 + phdr->p_filesz = phdr->p_memsz = m->size;
2395 +diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h
2396 +index 48835a659948..eabf85371ece 100644
2397 +--- a/fs/reiserfs/reiserfs.h
2398 ++++ b/fs/reiserfs/reiserfs.h
2399 +@@ -271,7 +271,7 @@ struct reiserfs_journal_list {
2400 +
2401 + struct mutex j_commit_mutex;
2402 + unsigned int j_trans_id;
2403 +- time_t j_timestamp;
2404 ++ time64_t j_timestamp; /* write-only but useful for crash dump analysis */
2405 + struct reiserfs_list_bitmap *j_list_bitmap;
2406 + struct buffer_head *j_commit_bh; /* commit buffer head */
2407 + struct reiserfs_journal_cnode *j_realblock;
2408 +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
2409 +index ab20dc5db423..7fa3f1498b34 100644
2410 +--- a/include/linux/pci_ids.h
2411 ++++ b/include/linux/pci_ids.h
2412 +@@ -3062,4 +3062,6 @@
2413 +
2414 + #define PCI_VENDOR_ID_OCZ 0x1b85
2415 +
2416 ++#define PCI_VENDOR_ID_NCUBE 0x10ff
2417 ++
2418 + #endif /* _LINUX_PCI_IDS_H */
2419 +diff --git a/include/net/tcp.h b/include/net/tcp.h
2420 +index eca8d65cad1e..0c828aac7e04 100644
2421 +--- a/include/net/tcp.h
2422 ++++ b/include/net/tcp.h
2423 +@@ -2063,6 +2063,10 @@ int tcp_set_ulp(struct sock *sk, const char *name);
2424 + void tcp_get_available_ulp(char *buf, size_t len);
2425 + void tcp_cleanup_ulp(struct sock *sk);
2426 +
2427 ++#define MODULE_ALIAS_TCP_ULP(name) \
2428 ++ __MODULE_INFO(alias, alias_userspace, name); \
2429 ++ __MODULE_INFO(alias, alias_tcp_ulp, "tcp-ulp-" name)
2430 ++
2431 + /* Call BPF_SOCK_OPS program that returns an int. If the return value
2432 + * is < 0, then the BPF op failed (for example if the loaded BPF
2433 + * program does not support the chosen operation or there is no BPF
2434 +diff --git a/include/uapi/linux/keyctl.h b/include/uapi/linux/keyctl.h
2435 +index 7b8c9e19bad1..910cc4334b21 100644
2436 +--- a/include/uapi/linux/keyctl.h
2437 ++++ b/include/uapi/linux/keyctl.h
2438 +@@ -65,7 +65,7 @@
2439 +
2440 + /* keyctl structures */
2441 + struct keyctl_dh_params {
2442 +- __s32 private;
2443 ++ __s32 dh_private;
2444 + __s32 prime;
2445 + __s32 base;
2446 + };
2447 +diff --git a/kernel/fork.c b/kernel/fork.c
2448 +index 91907a3701ce..6a219fea4926 100644
2449 +--- a/kernel/fork.c
2450 ++++ b/kernel/fork.c
2451 +@@ -1350,7 +1350,9 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
2452 + return -ENOMEM;
2453 +
2454 + atomic_set(&sig->count, 1);
2455 ++ spin_lock_irq(&current->sighand->siglock);
2456 + memcpy(sig->action, current->sighand->action, sizeof(sig->action));
2457 ++ spin_unlock_irq(&current->sighand->siglock);
2458 + return 0;
2459 + }
2460 +
2461 +diff --git a/kernel/memremap.c b/kernel/memremap.c
2462 +index 4712ce646e04..2b136d4988f7 100644
2463 +--- a/kernel/memremap.c
2464 ++++ b/kernel/memremap.c
2465 +@@ -248,13 +248,16 @@ int device_private_entry_fault(struct vm_area_struct *vma,
2466 + EXPORT_SYMBOL(device_private_entry_fault);
2467 + #endif /* CONFIG_DEVICE_PRIVATE */
2468 +
2469 +-static void pgmap_radix_release(struct resource *res)
2470 ++static void pgmap_radix_release(struct resource *res, unsigned long end_pgoff)
2471 + {
2472 + unsigned long pgoff, order;
2473 +
2474 + mutex_lock(&pgmap_lock);
2475 +- foreach_order_pgoff(res, order, pgoff)
2476 ++ foreach_order_pgoff(res, order, pgoff) {
2477 ++ if (pgoff >= end_pgoff)
2478 ++ break;
2479 + radix_tree_delete(&pgmap_radix, PHYS_PFN(res->start) + pgoff);
2480 ++ }
2481 + mutex_unlock(&pgmap_lock);
2482 +
2483 + synchronize_rcu();
2484 +@@ -309,7 +312,7 @@ static void devm_memremap_pages_release(struct device *dev, void *data)
2485 + mem_hotplug_done();
2486 +
2487 + untrack_pfn(NULL, PHYS_PFN(align_start), align_size);
2488 +- pgmap_radix_release(res);
2489 ++ pgmap_radix_release(res, -1);
2490 + dev_WARN_ONCE(dev, pgmap->altmap && pgmap->altmap->alloc,
2491 + "%s: failed to free all reserved pages\n", __func__);
2492 + }
2493 +@@ -459,7 +462,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
2494 + untrack_pfn(NULL, PHYS_PFN(align_start), align_size);
2495 + err_pfn_remap:
2496 + err_radix:
2497 +- pgmap_radix_release(res);
2498 ++ pgmap_radix_release(res, pgoff);
2499 + devres_free(page_map);
2500 + return ERR_PTR(error);
2501 + }
2502 +diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
2503 +index 501f17c642ab..b2589c7e9439 100644
2504 +--- a/kernel/sched/deadline.c
2505 ++++ b/kernel/sched/deadline.c
2506 +@@ -1365,6 +1365,10 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se,
2507 + update_dl_entity(dl_se, pi_se);
2508 + } else if (flags & ENQUEUE_REPLENISH) {
2509 + replenish_dl_entity(dl_se, pi_se);
2510 ++ } else if ((flags & ENQUEUE_RESTORE) &&
2511 ++ dl_time_before(dl_se->deadline,
2512 ++ rq_clock(rq_of_dl_rq(dl_rq_of_se(dl_se))))) {
2513 ++ setup_new_dl_entity(dl_se);
2514 + }
2515 +
2516 + __enqueue_dl_entity(dl_se);
2517 +@@ -2256,13 +2260,6 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p)
2518 +
2519 + return;
2520 + }
2521 +- /*
2522 +- * If p is boosted we already updated its params in
2523 +- * rt_mutex_setprio()->enqueue_task(..., ENQUEUE_REPLENISH),
2524 +- * p's deadline being now already after rq_clock(rq).
2525 +- */
2526 +- if (dl_time_before(p->dl.deadline, rq_clock(rq)))
2527 +- setup_new_dl_entity(&p->dl);
2528 +
2529 + if (rq->curr != p) {
2530 + #ifdef CONFIG_SMP
2531 +diff --git a/lib/debugobjects.c b/lib/debugobjects.c
2532 +index 2f5349c6e81a..99308479b1c8 100644
2533 +--- a/lib/debugobjects.c
2534 ++++ b/lib/debugobjects.c
2535 +@@ -322,9 +322,12 @@ static void debug_object_is_on_stack(void *addr, int onstack)
2536 +
2537 + limit++;
2538 + if (is_on_stack)
2539 +- pr_warn("object is on stack, but not annotated\n");
2540 ++ pr_warn("object %p is on stack %p, but NOT annotated.\n", addr,
2541 ++ task_stack_page(current));
2542 + else
2543 +- pr_warn("object is not on stack, but annotated\n");
2544 ++ pr_warn("object %p is NOT on stack %p, but annotated.\n", addr,
2545 ++ task_stack_page(current));
2546 ++
2547 + WARN_ON(1);
2548 + }
2549 +
2550 +diff --git a/mm/fadvise.c b/mm/fadvise.c
2551 +index 767887f5f3bf..3f5f68ad5708 100644
2552 +--- a/mm/fadvise.c
2553 ++++ b/mm/fadvise.c
2554 +@@ -71,8 +71,12 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice)
2555 + goto out;
2556 + }
2557 +
2558 +- /* Careful about overflows. Len == 0 means "as much as possible" */
2559 +- endbyte = offset + len;
2560 ++ /*
2561 ++ * Careful about overflows. Len == 0 means "as much as possible". Use
2562 ++ * unsigned math because signed overflows are undefined and UBSan
2563 ++ * complains.
2564 ++ */
2565 ++ endbyte = (u64)offset + (u64)len;
2566 + if (!len || endbyte < len)
2567 + endbyte = -1;
2568 + else
2569 +diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
2570 +index 38e21a1e97bc..a9c65f13b7f5 100644
2571 +--- a/net/9p/trans_fd.c
2572 ++++ b/net/9p/trans_fd.c
2573 +@@ -199,15 +199,14 @@ static void p9_mux_poll_stop(struct p9_conn *m)
2574 + static void p9_conn_cancel(struct p9_conn *m, int err)
2575 + {
2576 + struct p9_req_t *req, *rtmp;
2577 +- unsigned long flags;
2578 + LIST_HEAD(cancel_list);
2579 +
2580 + p9_debug(P9_DEBUG_ERROR, "mux %p err %d\n", m, err);
2581 +
2582 +- spin_lock_irqsave(&m->client->lock, flags);
2583 ++ spin_lock(&m->client->lock);
2584 +
2585 + if (m->err) {
2586 +- spin_unlock_irqrestore(&m->client->lock, flags);
2587 ++ spin_unlock(&m->client->lock);
2588 + return;
2589 + }
2590 +
2591 +@@ -219,7 +218,6 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
2592 + list_for_each_entry_safe(req, rtmp, &m->unsent_req_list, req_list) {
2593 + list_move(&req->req_list, &cancel_list);
2594 + }
2595 +- spin_unlock_irqrestore(&m->client->lock, flags);
2596 +
2597 + list_for_each_entry_safe(req, rtmp, &cancel_list, req_list) {
2598 + p9_debug(P9_DEBUG_ERROR, "call back req %p\n", req);
2599 +@@ -228,6 +226,7 @@ static void p9_conn_cancel(struct p9_conn *m, int err)
2600 + req->t_err = err;
2601 + p9_client_cb(m->client, req, REQ_STATUS_ERROR);
2602 + }
2603 ++ spin_unlock(&m->client->lock);
2604 + }
2605 +
2606 + static int
2607 +@@ -385,8 +384,9 @@ static void p9_read_work(struct work_struct *work)
2608 + if (m->req->status != REQ_STATUS_ERROR)
2609 + status = REQ_STATUS_RCVD;
2610 + list_del(&m->req->req_list);
2611 +- spin_unlock(&m->client->lock);
2612 ++ /* update req->status while holding client->lock */
2613 + p9_client_cb(m->client, m->req, status);
2614 ++ spin_unlock(&m->client->lock);
2615 + m->rc.sdata = NULL;
2616 + m->rc.offset = 0;
2617 + m->rc.capacity = 0;
2618 +diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
2619 +index da0d3b257459..e73fd647065a 100644
2620 +--- a/net/9p/trans_virtio.c
2621 ++++ b/net/9p/trans_virtio.c
2622 +@@ -571,7 +571,7 @@ static int p9_virtio_probe(struct virtio_device *vdev)
2623 + chan->vq = virtio_find_single_vq(vdev, req_done, "requests");
2624 + if (IS_ERR(chan->vq)) {
2625 + err = PTR_ERR(chan->vq);
2626 +- goto out_free_vq;
2627 ++ goto out_free_chan;
2628 + }
2629 + chan->vq->vdev->priv = chan;
2630 + spin_lock_init(&chan->lock);
2631 +@@ -624,6 +624,7 @@ out_free_tag:
2632 + kfree(tag);
2633 + out_free_vq:
2634 + vdev->config->del_vqs(vdev);
2635 ++out_free_chan:
2636 + kfree(chan);
2637 + fail:
2638 + return err;
2639 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
2640 +index a95ccdceb797..0e1a670dabd9 100644
2641 +--- a/net/ipv4/tcp_ipv4.c
2642 ++++ b/net/ipv4/tcp_ipv4.c
2643 +@@ -2468,6 +2468,12 @@ static int __net_init tcp_sk_init(struct net *net)
2644 + if (res)
2645 + goto fail;
2646 + sock_set_flag(sk, SOCK_USE_WRITE_QUEUE);
2647 ++
2648 ++ /* Please enforce IP_DF and IPID==0 for RST and
2649 ++ * ACK sent in SYN-RECV and TIME-WAIT state.
2650 ++ */
2651 ++ inet_sk(sk)->pmtudisc = IP_PMTUDISC_DO;
2652 ++
2653 + *per_cpu_ptr(net->ipv4.tcp_sk, cpu) = sk;
2654 + }
2655 +
2656 +diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
2657 +index 420fecbb98fe..61584638dba7 100644
2658 +--- a/net/ipv4/tcp_minisocks.c
2659 ++++ b/net/ipv4/tcp_minisocks.c
2660 +@@ -185,8 +185,9 @@ kill:
2661 + inet_twsk_deschedule_put(tw);
2662 + return TCP_TW_SUCCESS;
2663 + }
2664 ++ } else {
2665 ++ inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN);
2666 + }
2667 +- inet_twsk_reschedule(tw, TCP_TIMEWAIT_LEN);
2668 +
2669 + if (tmp_opt.saw_tstamp) {
2670 + tcptw->tw_ts_recent = tmp_opt.rcv_tsval;
2671 +diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
2672 +index 6bb9e14c710a..1feecb72f4fc 100644
2673 +--- a/net/ipv4/tcp_ulp.c
2674 ++++ b/net/ipv4/tcp_ulp.c
2675 +@@ -39,7 +39,7 @@ static const struct tcp_ulp_ops *__tcp_ulp_find_autoload(const char *name)
2676 + #ifdef CONFIG_MODULES
2677 + if (!ulp && capable(CAP_NET_ADMIN)) {
2678 + rcu_read_unlock();
2679 +- request_module("%s", name);
2680 ++ request_module("tcp-ulp-%s", name);
2681 + rcu_read_lock();
2682 + ulp = tcp_ulp_find(name);
2683 + }
2684 +diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
2685 +index b9e638cc955f..db5a24f09335 100644
2686 +--- a/net/ipv6/ip6_vti.c
2687 ++++ b/net/ipv6/ip6_vti.c
2688 +@@ -481,7 +481,7 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
2689 + }
2690 +
2691 + mtu = dst_mtu(dst);
2692 +- if (!skb->ignore_df && skb->len > mtu) {
2693 ++ if (skb->len > mtu) {
2694 + skb_dst_update_pmtu(skb, mtu);
2695 +
2696 + if (skb->protocol == htons(ETH_P_IPV6)) {
2697 +diff --git a/net/ipv6/netfilter/ip6t_rpfilter.c b/net/ipv6/netfilter/ip6t_rpfilter.c
2698 +index 1c4a5de3f301..40eb16bd9786 100644
2699 +--- a/net/ipv6/netfilter/ip6t_rpfilter.c
2700 ++++ b/net/ipv6/netfilter/ip6t_rpfilter.c
2701 +@@ -26,6 +26,12 @@ static bool rpfilter_addr_unicast(const struct in6_addr *addr)
2702 + return addr_type & IPV6_ADDR_UNICAST;
2703 + }
2704 +
2705 ++static bool rpfilter_addr_linklocal(const struct in6_addr *addr)
2706 ++{
2707 ++ int addr_type = ipv6_addr_type(addr);
2708 ++ return addr_type & IPV6_ADDR_LINKLOCAL;
2709 ++}
2710 ++
2711 + static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
2712 + const struct net_device *dev, u8 flags)
2713 + {
2714 +@@ -48,7 +54,11 @@ static bool rpfilter_lookup_reverse6(struct net *net, const struct sk_buff *skb,
2715 + }
2716 +
2717 + fl6.flowi6_mark = flags & XT_RPFILTER_VALID_MARK ? skb->mark : 0;
2718 +- if ((flags & XT_RPFILTER_LOOSE) == 0)
2719 ++
2720 ++ if (rpfilter_addr_linklocal(&iph->saddr)) {
2721 ++ lookup_flags |= RT6_LOOKUP_F_IFACE;
2722 ++ fl6.flowi6_oif = dev->ifindex;
2723 ++ } else if ((flags & XT_RPFILTER_LOOSE) == 0)
2724 + fl6.flowi6_oif = dev->ifindex;
2725 +
2726 + rt = (void *) ip6_route_lookup(net, &fl6, lookup_flags);
2727 +diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
2728 +index 5cb7cac9177d..1bd53b1e7672 100644
2729 +--- a/net/netfilter/ipvs/ip_vs_core.c
2730 ++++ b/net/netfilter/ipvs/ip_vs_core.c
2731 +@@ -1960,13 +1960,20 @@ ip_vs_in(struct netns_ipvs *ipvs, unsigned int hooknum, struct sk_buff *skb, int
2732 + if (cp->dest && !(cp->dest->flags & IP_VS_DEST_F_AVAILABLE)) {
2733 + /* the destination server is not available */
2734 +
2735 +- if (sysctl_expire_nodest_conn(ipvs)) {
2736 ++ __u32 flags = cp->flags;
2737 ++
2738 ++ /* when timer already started, silently drop the packet.*/
2739 ++ if (timer_pending(&cp->timer))
2740 ++ __ip_vs_conn_put(cp);
2741 ++ else
2742 ++ ip_vs_conn_put(cp);
2743 ++
2744 ++ if (sysctl_expire_nodest_conn(ipvs) &&
2745 ++ !(flags & IP_VS_CONN_F_ONE_PACKET)) {
2746 + /* try to expire the connection immediately */
2747 + ip_vs_conn_expire_now(cp);
2748 + }
2749 +- /* don't restart its timer, and silently
2750 +- drop the packet. */
2751 +- __ip_vs_conn_put(cp);
2752 ++
2753 + return NF_DROP;
2754 + }
2755 +
2756 +diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
2757 +index de4053d84364..48dab1403b2c 100644
2758 +--- a/net/netfilter/nf_conntrack_netlink.c
2759 ++++ b/net/netfilter/nf_conntrack_netlink.c
2760 +@@ -788,6 +788,21 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[])
2761 + #endif
2762 + }
2763 +
2764 ++static int ctnetlink_start(struct netlink_callback *cb)
2765 ++{
2766 ++ const struct nlattr * const *cda = cb->data;
2767 ++ struct ctnetlink_filter *filter = NULL;
2768 ++
2769 ++ if (cda[CTA_MARK] && cda[CTA_MARK_MASK]) {
2770 ++ filter = ctnetlink_alloc_filter(cda);
2771 ++ if (IS_ERR(filter))
2772 ++ return PTR_ERR(filter);
2773 ++ }
2774 ++
2775 ++ cb->data = filter;
2776 ++ return 0;
2777 ++}
2778 ++
2779 + static int ctnetlink_filter_match(struct nf_conn *ct, void *data)
2780 + {
2781 + struct ctnetlink_filter *filter = data;
2782 +@@ -1194,19 +1209,12 @@ static int ctnetlink_get_conntrack(struct net *net, struct sock *ctnl,
2783 +
2784 + if (nlh->nlmsg_flags & NLM_F_DUMP) {
2785 + struct netlink_dump_control c = {
2786 ++ .start = ctnetlink_start,
2787 + .dump = ctnetlink_dump_table,
2788 + .done = ctnetlink_done,
2789 ++ .data = (void *)cda,
2790 + };
2791 +
2792 +- if (cda[CTA_MARK] && cda[CTA_MARK_MASK]) {
2793 +- struct ctnetlink_filter *filter;
2794 +-
2795 +- filter = ctnetlink_alloc_filter(cda);
2796 +- if (IS_ERR(filter))
2797 +- return PTR_ERR(filter);
2798 +-
2799 +- c.data = filter;
2800 +- }
2801 + return netlink_dump_start(ctnl, skb, nlh, &c);
2802 + }
2803 +
2804 +diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c
2805 +index c45e6d4358ab..75624d17fc69 100644
2806 +--- a/net/netfilter/nfnetlink_acct.c
2807 ++++ b/net/netfilter/nfnetlink_acct.c
2808 +@@ -238,29 +238,33 @@ static const struct nla_policy filter_policy[NFACCT_FILTER_MAX + 1] = {
2809 + [NFACCT_FILTER_VALUE] = { .type = NLA_U32 },
2810 + };
2811 +
2812 +-static struct nfacct_filter *
2813 +-nfacct_filter_alloc(const struct nlattr * const attr)
2814 ++static int nfnl_acct_start(struct netlink_callback *cb)
2815 + {
2816 +- struct nfacct_filter *filter;
2817 ++ const struct nlattr *const attr = cb->data;
2818 + struct nlattr *tb[NFACCT_FILTER_MAX + 1];
2819 ++ struct nfacct_filter *filter;
2820 + int err;
2821 +
2822 ++ if (!attr)
2823 ++ return 0;
2824 ++
2825 + err = nla_parse_nested(tb, NFACCT_FILTER_MAX, attr, filter_policy,
2826 + NULL);
2827 + if (err < 0)
2828 +- return ERR_PTR(err);
2829 ++ return err;
2830 +
2831 + if (!tb[NFACCT_FILTER_MASK] || !tb[NFACCT_FILTER_VALUE])
2832 +- return ERR_PTR(-EINVAL);
2833 ++ return -EINVAL;
2834 +
2835 + filter = kzalloc(sizeof(struct nfacct_filter), GFP_KERNEL);
2836 + if (!filter)
2837 +- return ERR_PTR(-ENOMEM);
2838 ++ return -ENOMEM;
2839 +
2840 + filter->mask = ntohl(nla_get_be32(tb[NFACCT_FILTER_MASK]));
2841 + filter->value = ntohl(nla_get_be32(tb[NFACCT_FILTER_VALUE]));
2842 ++ cb->data = filter;
2843 +
2844 +- return filter;
2845 ++ return 0;
2846 + }
2847 +
2848 + static int nfnl_acct_get(struct net *net, struct sock *nfnl,
2849 +@@ -275,18 +279,11 @@ static int nfnl_acct_get(struct net *net, struct sock *nfnl,
2850 + if (nlh->nlmsg_flags & NLM_F_DUMP) {
2851 + struct netlink_dump_control c = {
2852 + .dump = nfnl_acct_dump,
2853 ++ .start = nfnl_acct_start,
2854 + .done = nfnl_acct_done,
2855 ++ .data = (void *)tb[NFACCT_FILTER],
2856 + };
2857 +
2858 +- if (tb[NFACCT_FILTER]) {
2859 +- struct nfacct_filter *filter;
2860 +-
2861 +- filter = nfacct_filter_alloc(tb[NFACCT_FILTER]);
2862 +- if (IS_ERR(filter))
2863 +- return PTR_ERR(filter);
2864 +-
2865 +- c.data = filter;
2866 +- }
2867 + return netlink_dump_start(nfnl, skb, nlh, &c);
2868 + }
2869 +
2870 +diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c
2871 +index 48332a6ed738..d290416e79e9 100644
2872 +--- a/net/rds/ib_frmr.c
2873 ++++ b/net/rds/ib_frmr.c
2874 +@@ -61,6 +61,7 @@ static struct rds_ib_mr *rds_ib_alloc_frmr(struct rds_ib_device *rds_ibdev,
2875 + pool->fmr_attr.max_pages);
2876 + if (IS_ERR(frmr->mr)) {
2877 + pr_warn("RDS/IB: %s failed to allocate MR", __func__);
2878 ++ err = PTR_ERR(frmr->mr);
2879 + goto out_no_cigar;
2880 + }
2881 +
2882 +diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
2883 +index 85757af7f150..31de26c99023 100644
2884 +--- a/net/sched/act_ife.c
2885 ++++ b/net/sched/act_ife.c
2886 +@@ -249,10 +249,8 @@ static int ife_validate_metatype(struct tcf_meta_ops *ops, void *val, int len)
2887 + }
2888 +
2889 + /* called when adding new meta information
2890 +- * under ife->tcf_lock for existing action
2891 + */
2892 +-static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
2893 +- void *val, int len, bool exists)
2894 ++static int load_metaops_and_vet(u32 metaid, void *val, int len)
2895 + {
2896 + struct tcf_meta_ops *ops = find_ife_oplist(metaid);
2897 + int ret = 0;
2898 +@@ -260,13 +258,9 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
2899 + if (!ops) {
2900 + ret = -ENOENT;
2901 + #ifdef CONFIG_MODULES
2902 +- if (exists)
2903 +- spin_unlock_bh(&ife->tcf_lock);
2904 + rtnl_unlock();
2905 + request_module("ifemeta%u", metaid);
2906 + rtnl_lock();
2907 +- if (exists)
2908 +- spin_lock_bh(&ife->tcf_lock);
2909 + ops = find_ife_oplist(metaid);
2910 + #endif
2911 + }
2912 +@@ -283,24 +277,17 @@ static int load_metaops_and_vet(struct tcf_ife_info *ife, u32 metaid,
2913 + }
2914 +
2915 + /* called when adding new meta information
2916 +- * under ife->tcf_lock for existing action
2917 + */
2918 +-static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,
2919 +- int len, bool atomic)
2920 ++static int __add_metainfo(const struct tcf_meta_ops *ops,
2921 ++ struct tcf_ife_info *ife, u32 metaid, void *metaval,
2922 ++ int len, bool atomic, bool exists)
2923 + {
2924 + struct tcf_meta_info *mi = NULL;
2925 +- struct tcf_meta_ops *ops = find_ife_oplist(metaid);
2926 + int ret = 0;
2927 +
2928 +- if (!ops)
2929 +- return -ENOENT;
2930 +-
2931 + mi = kzalloc(sizeof(*mi), atomic ? GFP_ATOMIC : GFP_KERNEL);
2932 +- if (!mi) {
2933 +- /*put back what find_ife_oplist took */
2934 +- module_put(ops->owner);
2935 ++ if (!mi)
2936 + return -ENOMEM;
2937 +- }
2938 +
2939 + mi->metaid = metaid;
2940 + mi->ops = ops;
2941 +@@ -308,17 +295,49 @@ static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,
2942 + ret = ops->alloc(mi, metaval, atomic ? GFP_ATOMIC : GFP_KERNEL);
2943 + if (ret != 0) {
2944 + kfree(mi);
2945 +- module_put(ops->owner);
2946 + return ret;
2947 + }
2948 + }
2949 +
2950 ++ if (exists)
2951 ++ spin_lock_bh(&ife->tcf_lock);
2952 + list_add_tail(&mi->metalist, &ife->metalist);
2953 ++ if (exists)
2954 ++ spin_unlock_bh(&ife->tcf_lock);
2955 ++
2956 ++ return ret;
2957 ++}
2958 ++
2959 ++static int add_metainfo_and_get_ops(const struct tcf_meta_ops *ops,
2960 ++ struct tcf_ife_info *ife, u32 metaid,
2961 ++ bool exists)
2962 ++{
2963 ++ int ret;
2964 ++
2965 ++ if (!try_module_get(ops->owner))
2966 ++ return -ENOENT;
2967 ++ ret = __add_metainfo(ops, ife, metaid, NULL, 0, true, exists);
2968 ++ if (ret)
2969 ++ module_put(ops->owner);
2970 ++ return ret;
2971 ++}
2972 ++
2973 ++static int add_metainfo(struct tcf_ife_info *ife, u32 metaid, void *metaval,
2974 ++ int len, bool exists)
2975 ++{
2976 ++ const struct tcf_meta_ops *ops = find_ife_oplist(metaid);
2977 ++ int ret;
2978 +
2979 ++ if (!ops)
2980 ++ return -ENOENT;
2981 ++ ret = __add_metainfo(ops, ife, metaid, metaval, len, false, exists);
2982 ++ if (ret)
2983 ++ /*put back what find_ife_oplist took */
2984 ++ module_put(ops->owner);
2985 + return ret;
2986 + }
2987 +
2988 +-static int use_all_metadata(struct tcf_ife_info *ife)
2989 ++static int use_all_metadata(struct tcf_ife_info *ife, bool exists)
2990 + {
2991 + struct tcf_meta_ops *o;
2992 + int rc = 0;
2993 +@@ -326,7 +345,7 @@ static int use_all_metadata(struct tcf_ife_info *ife)
2994 +
2995 + read_lock(&ife_mod_lock);
2996 + list_for_each_entry(o, &ifeoplist, list) {
2997 +- rc = add_metainfo(ife, o->metaid, NULL, 0, true);
2998 ++ rc = add_metainfo_and_get_ops(o, ife, o->metaid, exists);
2999 + if (rc == 0)
3000 + installed += 1;
3001 + }
3002 +@@ -377,7 +396,6 @@ static void _tcf_ife_cleanup(struct tc_action *a, int bind)
3003 + struct tcf_meta_info *e, *n;
3004 +
3005 + list_for_each_entry_safe(e, n, &ife->metalist, metalist) {
3006 +- module_put(e->ops->owner);
3007 + list_del(&e->metalist);
3008 + if (e->metaval) {
3009 + if (e->ops->release)
3010 +@@ -385,6 +403,7 @@ static void _tcf_ife_cleanup(struct tc_action *a, int bind)
3011 + else
3012 + kfree(e->metaval);
3013 + }
3014 ++ module_put(e->ops->owner);
3015 + kfree(e);
3016 + }
3017 + }
3018 +@@ -398,7 +417,6 @@ static void tcf_ife_cleanup(struct tc_action *a, int bind)
3019 + spin_unlock_bh(&ife->tcf_lock);
3020 + }
3021 +
3022 +-/* under ife->tcf_lock for existing action */
3023 + static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
3024 + bool exists)
3025 + {
3026 +@@ -412,7 +430,7 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
3027 + val = nla_data(tb[i]);
3028 + len = nla_len(tb[i]);
3029 +
3030 +- rc = load_metaops_and_vet(ife, i, val, len, exists);
3031 ++ rc = load_metaops_and_vet(i, val, len);
3032 + if (rc != 0)
3033 + return rc;
3034 +
3035 +@@ -481,6 +499,8 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
3036 + if (exists)
3037 + spin_lock_bh(&ife->tcf_lock);
3038 + ife->tcf_action = parm->action;
3039 ++ if (exists)
3040 ++ spin_unlock_bh(&ife->tcf_lock);
3041 +
3042 + if (parm->flags & IFE_ENCODE) {
3043 + if (daddr)
3044 +@@ -508,9 +528,6 @@ metadata_parse_err:
3045 + tcf_idr_release(*a, bind);
3046 + if (ret == ACT_P_CREATED)
3047 + _tcf_ife_cleanup(*a, bind);
3048 +-
3049 +- if (exists)
3050 +- spin_unlock_bh(&ife->tcf_lock);
3051 + return err;
3052 + }
3053 +
3054 +@@ -524,20 +541,14 @@ metadata_parse_err:
3055 + * as we can. You better have at least one else we are
3056 + * going to bail out
3057 + */
3058 +- err = use_all_metadata(ife);
3059 ++ err = use_all_metadata(ife, exists);
3060 + if (err) {
3061 + if (ret == ACT_P_CREATED)
3062 + _tcf_ife_cleanup(*a, bind);
3063 +-
3064 +- if (exists)
3065 +- spin_unlock_bh(&ife->tcf_lock);
3066 + return err;
3067 + }
3068 + }
3069 +
3070 +- if (exists)
3071 +- spin_unlock_bh(&ife->tcf_lock);
3072 +-
3073 + if (ret == ACT_P_CREATED)
3074 + tcf_idr_insert(tn, *a);
3075 +
3076 +diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
3077 +index 51ab463d9e16..656b6ada9221 100644
3078 +--- a/net/sched/act_pedit.c
3079 ++++ b/net/sched/act_pedit.c
3080 +@@ -109,16 +109,18 @@ static int tcf_pedit_key_ex_dump(struct sk_buff *skb,
3081 + {
3082 + struct nlattr *keys_start = nla_nest_start(skb, TCA_PEDIT_KEYS_EX);
3083 +
3084 ++ if (!keys_start)
3085 ++ goto nla_failure;
3086 + for (; n > 0; n--) {
3087 + struct nlattr *key_start;
3088 +
3089 + key_start = nla_nest_start(skb, TCA_PEDIT_KEY_EX);
3090 ++ if (!key_start)
3091 ++ goto nla_failure;
3092 +
3093 + if (nla_put_u16(skb, TCA_PEDIT_KEY_EX_HTYPE, keys_ex->htype) ||
3094 +- nla_put_u16(skb, TCA_PEDIT_KEY_EX_CMD, keys_ex->cmd)) {
3095 +- nlmsg_trim(skb, keys_start);
3096 +- return -EINVAL;
3097 +- }
3098 ++ nla_put_u16(skb, TCA_PEDIT_KEY_EX_CMD, keys_ex->cmd))
3099 ++ goto nla_failure;
3100 +
3101 + nla_nest_end(skb, key_start);
3102 +
3103 +@@ -128,6 +130,9 @@ static int tcf_pedit_key_ex_dump(struct sk_buff *skb,
3104 + nla_nest_end(skb, keys_start);
3105 +
3106 + return 0;
3107 ++nla_failure:
3108 ++ nla_nest_cancel(skb, keys_start);
3109 ++ return -EINVAL;
3110 + }
3111 +
3112 + static int tcf_pedit_init(struct net *net, struct nlattr *nla,
3113 +@@ -395,7 +400,10 @@ static int tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,
3114 + opt->bindcnt = p->tcf_bindcnt - bind;
3115 +
3116 + if (p->tcfp_keys_ex) {
3117 +- tcf_pedit_key_ex_dump(skb, p->tcfp_keys_ex, p->tcfp_nkeys);
3118 ++ if (tcf_pedit_key_ex_dump(skb,
3119 ++ p->tcfp_keys_ex,
3120 ++ p->tcfp_nkeys))
3121 ++ goto nla_put_failure;
3122 +
3123 + if (nla_put(skb, TCA_PEDIT_PARMS_EX, s, opt))
3124 + goto nla_put_failure;
3125 +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
3126 +index ba37d8f57e68..0c9bc29dcf97 100644
3127 +--- a/net/sched/cls_u32.c
3128 ++++ b/net/sched/cls_u32.c
3129 +@@ -903,6 +903,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
3130 + struct nlattr *opt = tca[TCA_OPTIONS];
3131 + struct nlattr *tb[TCA_U32_MAX + 1];
3132 + u32 htid, flags = 0;
3133 ++ size_t sel_size;
3134 + int err;
3135 + #ifdef CONFIG_CLS_U32_PERF
3136 + size_t size;
3137 +@@ -1024,8 +1025,11 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
3138 + return -EINVAL;
3139 +
3140 + s = nla_data(tb[TCA_U32_SEL]);
3141 ++ sel_size = sizeof(*s) + sizeof(*s->keys) * s->nkeys;
3142 ++ if (nla_len(tb[TCA_U32_SEL]) < sel_size)
3143 ++ return -EINVAL;
3144 +
3145 +- n = kzalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL);
3146 ++ n = kzalloc(offsetof(typeof(*n), sel) + sel_size, GFP_KERNEL);
3147 + if (n == NULL)
3148 + return -ENOBUFS;
3149 +
3150 +@@ -1038,7 +1042,7 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,
3151 + }
3152 + #endif
3153 +
3154 +- memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
3155 ++ memcpy(&n->sel, s, sel_size);
3156 + RCU_INIT_POINTER(n->ht_up, ht);
3157 + n->handle = handle;
3158 + n->fshift = s->hmask ? ffs(ntohl(s->hmask)) - 1 : 0;
3159 +diff --git a/net/sctp/proc.c b/net/sctp/proc.c
3160 +index 26b4be6b4172..6c82a959fc6e 100644
3161 +--- a/net/sctp/proc.c
3162 ++++ b/net/sctp/proc.c
3163 +@@ -335,8 +335,6 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
3164 + }
3165 +
3166 + transport = (struct sctp_transport *)v;
3167 +- if (!sctp_transport_hold(transport))
3168 +- return 0;
3169 + assoc = transport->asoc;
3170 + epb = &assoc->base;
3171 + sk = epb->sk;
3172 +@@ -426,8 +424,6 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
3173 + }
3174 +
3175 + transport = (struct sctp_transport *)v;
3176 +- if (!sctp_transport_hold(transport))
3177 +- return 0;
3178 + assoc = transport->asoc;
3179 +
3180 + list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list,
3181 +diff --git a/net/sctp/socket.c b/net/sctp/socket.c
3182 +index 2d6f612f32c3..790094311143 100644
3183 +--- a/net/sctp/socket.c
3184 ++++ b/net/sctp/socket.c
3185 +@@ -4660,9 +4660,14 @@ struct sctp_transport *sctp_transport_get_next(struct net *net,
3186 + break;
3187 + }
3188 +
3189 ++ if (!sctp_transport_hold(t))
3190 ++ continue;
3191 ++
3192 + if (net_eq(sock_net(t->asoc->base.sk), net) &&
3193 + t->asoc->peer.primary_path == t)
3194 + break;
3195 ++
3196 ++ sctp_transport_put(t);
3197 + }
3198 +
3199 + return t;
3200 +@@ -4672,13 +4677,18 @@ struct sctp_transport *sctp_transport_get_idx(struct net *net,
3201 + struct rhashtable_iter *iter,
3202 + int pos)
3203 + {
3204 +- void *obj = SEQ_START_TOKEN;
3205 ++ struct sctp_transport *t;
3206 +
3207 +- while (pos && (obj = sctp_transport_get_next(net, iter)) &&
3208 +- !IS_ERR(obj))
3209 +- pos--;
3210 ++ if (!pos)
3211 ++ return SEQ_START_TOKEN;
3212 +
3213 +- return obj;
3214 ++ while ((t = sctp_transport_get_next(net, iter)) && !IS_ERR(t)) {
3215 ++ if (!--pos)
3216 ++ break;
3217 ++ sctp_transport_put(t);
3218 ++ }
3219 ++
3220 ++ return t;
3221 + }
3222 +
3223 + int sctp_for_each_endpoint(int (*cb)(struct sctp_endpoint *, void *),
3224 +@@ -4738,8 +4748,6 @@ again:
3225 +
3226 + tsp = sctp_transport_get_idx(net, &hti, *pos + 1);
3227 + for (; !IS_ERR_OR_NULL(tsp); tsp = sctp_transport_get_next(net, &hti)) {
3228 +- if (!sctp_transport_hold(tsp))
3229 +- continue;
3230 + ret = cb(tsp, p);
3231 + if (ret)
3232 + break;
3233 +diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
3234 +index 8654494b4d0a..834eb2b9e41b 100644
3235 +--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
3236 ++++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
3237 +@@ -169,7 +169,7 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen,
3238 + struct scatterlist sg[1];
3239 + int err = -1;
3240 + u8 *checksumdata;
3241 +- u8 rc4salt[4];
3242 ++ u8 *rc4salt;
3243 + struct crypto_ahash *md5;
3244 + struct crypto_ahash *hmac_md5;
3245 + struct ahash_request *req;
3246 +@@ -183,14 +183,18 @@ make_checksum_hmac_md5(struct krb5_ctx *kctx, char *header, int hdrlen,
3247 + return GSS_S_FAILURE;
3248 + }
3249 +
3250 ++ rc4salt = kmalloc_array(4, sizeof(*rc4salt), GFP_NOFS);
3251 ++ if (!rc4salt)
3252 ++ return GSS_S_FAILURE;
3253 ++
3254 + if (arcfour_hmac_md5_usage_to_salt(usage, rc4salt)) {
3255 + dprintk("%s: invalid usage value %u\n", __func__, usage);
3256 +- return GSS_S_FAILURE;
3257 ++ goto out_free_rc4salt;
3258 + }
3259 +
3260 + checksumdata = kmalloc(GSS_KRB5_MAX_CKSUM_LEN, GFP_NOFS);
3261 + if (!checksumdata)
3262 +- return GSS_S_FAILURE;
3263 ++ goto out_free_rc4salt;
3264 +
3265 + md5 = crypto_alloc_ahash("md5", 0, CRYPTO_ALG_ASYNC);
3266 + if (IS_ERR(md5))
3267 +@@ -258,6 +262,8 @@ out_free_md5:
3268 + crypto_free_ahash(md5);
3269 + out_free_cksum:
3270 + kfree(checksumdata);
3271 ++out_free_rc4salt:
3272 ++ kfree(rc4salt);
3273 + return err ? GSS_S_FAILURE : 0;
3274 + }
3275 +
3276 +diff --git a/net/tipc/socket.c b/net/tipc/socket.c
3277 +index 98a44ecb11e7..0aebf0695ae0 100644
3278 +--- a/net/tipc/socket.c
3279 ++++ b/net/tipc/socket.c
3280 +@@ -2268,6 +2268,8 @@ void tipc_sk_reinit(struct net *net)
3281 + walk_stop:
3282 + rhashtable_walk_stop(&iter);
3283 + } while (tsk == ERR_PTR(-EAGAIN));
3284 ++
3285 ++ rhashtable_walk_exit(&iter);
3286 + }
3287 +
3288 + static struct tipc_sock *tipc_sk_lookup(struct net *net, u32 portid)
3289 +diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
3290 +index ffb1a3a69bdd..055b9992d8c7 100644
3291 +--- a/net/tls/tls_main.c
3292 ++++ b/net/tls/tls_main.c
3293 +@@ -44,6 +44,7 @@
3294 + MODULE_AUTHOR("Mellanox Technologies");
3295 + MODULE_DESCRIPTION("Transport Layer Security Support");
3296 + MODULE_LICENSE("Dual BSD/GPL");
3297 ++MODULE_ALIAS_TCP_ULP("tls");
3298 +
3299 + static struct proto tls_base_prot;
3300 + static struct proto tls_sw_prot;
3301 +diff --git a/scripts/depmod.sh b/scripts/depmod.sh
3302 +index f41b0a4b575c..cf5b2b24b3cf 100755
3303 +--- a/scripts/depmod.sh
3304 ++++ b/scripts/depmod.sh
3305 +@@ -16,9 +16,9 @@ if ! test -r System.map ; then
3306 + fi
3307 +
3308 + if [ -z $(command -v $DEPMOD) ]; then
3309 +- echo "'make modules_install' requires $DEPMOD. Please install it." >&2
3310 ++ echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2
3311 + echo "This is probably in the kmod package." >&2
3312 +- exit 1
3313 ++ exit 0
3314 + fi
3315 +
3316 + # older versions of depmod don't support -P <symbol-prefix>
3317 +diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
3318 +index 54deaa1066cf..957f6041dd79 100644
3319 +--- a/scripts/mod/modpost.c
3320 ++++ b/scripts/mod/modpost.c
3321 +@@ -677,7 +677,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
3322 + if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
3323 + break;
3324 + if (symname[0] == '.') {
3325 +- char *munged = strdup(symname);
3326 ++ char *munged = NOFAIL(strdup(symname));
3327 + munged[0] = '_';
3328 + munged[1] = toupper(munged[1]);
3329 + symname = munged;
3330 +@@ -1329,7 +1329,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
3331 + static char *sec2annotation(const char *s)
3332 + {
3333 + if (match(s, init_exit_sections)) {
3334 +- char *p = malloc(20);
3335 ++ char *p = NOFAIL(malloc(20));
3336 + char *r = p;
3337 +
3338 + *p++ = '_';
3339 +@@ -1349,7 +1349,7 @@ static char *sec2annotation(const char *s)
3340 + strcat(p, " ");
3341 + return r;
3342 + } else {
3343 +- return strdup("");
3344 ++ return NOFAIL(strdup(""));
3345 + }
3346 + }
3347 +
3348 +@@ -2050,7 +2050,7 @@ void buf_write(struct buffer *buf, const char *s, int len)
3349 + {
3350 + if (buf->size - buf->pos < len) {
3351 + buf->size += len + SZ;
3352 +- buf->p = realloc(buf->p, buf->size);
3353 ++ buf->p = NOFAIL(realloc(buf->p, buf->size));
3354 + }
3355 + strncpy(buf->p + buf->pos, s, len);
3356 + buf->pos += len;
3357 +diff --git a/security/keys/dh.c b/security/keys/dh.c
3358 +index d1ea9f325f94..35543f04e759 100644
3359 +--- a/security/keys/dh.c
3360 ++++ b/security/keys/dh.c
3361 +@@ -307,7 +307,7 @@ long __keyctl_dh_compute(struct keyctl_dh_params __user *params,
3362 + }
3363 + dh_inputs.g_size = dlen;
3364 +
3365 +- dlen = dh_data_from_key(pcopy.private, &dh_inputs.key);
3366 ++ dlen = dh_data_from_key(pcopy.dh_private, &dh_inputs.key);
3367 + if (dlen < 0) {
3368 + ret = dlen;
3369 + goto out2;
3370 +diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
3371 +index 0791fec398fb..1cd20b88a3a9 100644
3372 +--- a/sound/soc/codecs/rt5677.c
3373 ++++ b/sound/soc/codecs/rt5677.c
3374 +@@ -5017,7 +5017,7 @@ static const struct i2c_device_id rt5677_i2c_id[] = {
3375 + MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
3376 +
3377 + static const struct of_device_id rt5677_of_match[] = {
3378 +- { .compatible = "realtek,rt5677", RT5677 },
3379 ++ { .compatible = "realtek,rt5677", .data = (const void *)RT5677 },
3380 + { }
3381 + };
3382 + MODULE_DEVICE_TABLE(of, rt5677_of_match);
3383 +diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
3384 +index 3896523b71e9..f289762cd676 100644
3385 +--- a/sound/soc/codecs/wm8994.c
3386 ++++ b/sound/soc/codecs/wm8994.c
3387 +@@ -2431,6 +2431,7 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
3388 + snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_2,
3389 + WM8994_OPCLK_ENA, 0);
3390 + }
3391 ++ break;
3392 +
3393 + default:
3394 + return -EINVAL;
3395 +diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c
3396 +index 53d83d7e6a09..20e7d74d86cd 100644
3397 +--- a/tools/perf/arch/powerpc/util/sym-handling.c
3398 ++++ b/tools/perf/arch/powerpc/util/sym-handling.c
3399 +@@ -141,8 +141,10 @@ void arch__post_process_probe_trace_events(struct perf_probe_event *pev,
3400 + for (i = 0; i < ntevs; i++) {
3401 + tev = &pev->tevs[i];
3402 + map__for_each_symbol(map, sym, tmp) {
3403 +- if (map->unmap_ip(map, sym->start) == tev->point.address)
3404 ++ if (map->unmap_ip(map, sym->start) == tev->point.address) {
3405 + arch__fix_tev_from_maps(pev, tev, map, sym);
3406 ++ break;
3407 ++ }
3408 + }
3409 + }
3410 + }
3411 +diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c
3412 +index a58e91197729..1ef0049860a8 100644
3413 +--- a/tools/perf/util/namespaces.c
3414 ++++ b/tools/perf/util/namespaces.c
3415 +@@ -138,6 +138,9 @@ struct nsinfo *nsinfo__copy(struct nsinfo *nsi)
3416 + {
3417 + struct nsinfo *nnsi;
3418 +
3419 ++ if (nsi == NULL)
3420 ++ return NULL;
3421 ++
3422 + nnsi = calloc(1, sizeof(*nnsi));
3423 + if (nnsi != NULL) {
3424 + nnsi->pid = nsi->pid;
3425 +diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c
3426 +index 66d31de60b9a..9d7166dfad1e 100644
3427 +--- a/tools/testing/selftests/powerpc/harness.c
3428 ++++ b/tools/testing/selftests/powerpc/harness.c
3429 +@@ -85,13 +85,13 @@ wait:
3430 + return status;
3431 + }
3432 +
3433 +-static void alarm_handler(int signum)
3434 ++static void sig_handler(int signum)
3435 + {
3436 +- /* Jut wake us up from waitpid */
3437 ++ /* Just wake us up from waitpid */
3438 + }
3439 +
3440 +-static struct sigaction alarm_action = {
3441 +- .sa_handler = alarm_handler,
3442 ++static struct sigaction sig_action = {
3443 ++ .sa_handler = sig_handler,
3444 + };
3445 +
3446 + void test_harness_set_timeout(uint64_t time)
3447 +@@ -106,8 +106,14 @@ int test_harness(int (test_function)(void), char *name)
3448 + test_start(name);
3449 + test_set_git_version(GIT_VERSION);
3450 +
3451 +- if (sigaction(SIGALRM, &alarm_action, NULL)) {
3452 +- perror("sigaction");
3453 ++ if (sigaction(SIGINT, &sig_action, NULL)) {
3454 ++ perror("sigaction (sigint)");
3455 ++ test_error(name);
3456 ++ return 1;
3457 ++ }
3458 ++
3459 ++ if (sigaction(SIGALRM, &sig_action, NULL)) {
3460 ++ perror("sigaction (sigalrm)");
3461 + test_error(name);
3462 + return 1;
3463 + }