Gentoo Archives: gentoo-commits

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