Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Thu, 23 Apr 2020 11:44:13
Message-Id: 1587642235.4904bc11bea920e7d4562f916355fd44ed6fa1b3.mpagano@gentoo
1 commit: 4904bc11bea920e7d4562f916355fd44ed6fa1b3
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 23 11:43:55 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 23 11:43:55 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4904bc11
7
8 Linux patch 4.19.118
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1117_linux-4.19.118.patch | 2272 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2276 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 8db7823..5c6dcb8 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -507,6 +507,10 @@ Patch: 1116_linux-4.19.117.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.117
23
24 +Patch: 1117_linux-4.19.118.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.118
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/1117_linux-4.19.118.patch b/1117_linux-4.19.118.patch
33 new file mode 100644
34 index 0000000..53446f1
35 --- /dev/null
36 +++ b/1117_linux-4.19.118.patch
37 @@ -0,0 +1,2272 @@
38 +diff --git a/Makefile b/Makefile
39 +index 555dbaab7bad..72ae7e879077 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 117
47 ++SUBLEVEL = 118
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
52 +index 00d44a60972f..e64ff80c83c5 100644
53 +--- a/arch/arm/boot/dts/imx6qdl.dtsi
54 ++++ b/arch/arm/boot/dts/imx6qdl.dtsi
55 +@@ -1013,9 +1013,8 @@
56 + compatible = "fsl,imx6q-fec";
57 + reg = <0x02188000 0x4000>;
58 + interrupt-names = "int0", "pps";
59 +- interrupts-extended =
60 +- <&intc 0 118 IRQ_TYPE_LEVEL_HIGH>,
61 +- <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
62 ++ interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
63 ++ <0 119 IRQ_TYPE_LEVEL_HIGH>;
64 + clocks = <&clks IMX6QDL_CLK_ENET>,
65 + <&clks IMX6QDL_CLK_ENET>,
66 + <&clks IMX6QDL_CLK_ENET_REF>;
67 +diff --git a/arch/arm/boot/dts/imx6qp.dtsi b/arch/arm/boot/dts/imx6qp.dtsi
68 +index 5f51f8e5c1fa..d91f92f944c5 100644
69 +--- a/arch/arm/boot/dts/imx6qp.dtsi
70 ++++ b/arch/arm/boot/dts/imx6qp.dtsi
71 +@@ -77,7 +77,6 @@
72 + };
73 +
74 + &fec {
75 +- /delete-property/interrupts-extended;
76 + interrupts = <0 118 IRQ_TYPE_LEVEL_HIGH>,
77 + <0 119 IRQ_TYPE_LEVEL_HIGH>;
78 + };
79 +diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c
80 +index 25b3ee85066e..328ced7bfaf2 100644
81 +--- a/arch/arm/net/bpf_jit_32.c
82 ++++ b/arch/arm/net/bpf_jit_32.c
83 +@@ -930,7 +930,11 @@ static inline void emit_a32_rsh_i64(const s8 dst[],
84 + rd = arm_bpf_get_reg64(dst, tmp, ctx);
85 +
86 + /* Do LSR operation */
87 +- if (val < 32) {
88 ++ if (val == 0) {
89 ++ /* An immediate value of 0 encodes a shift amount of 32
90 ++ * for LSR. To shift by 0, don't do anything.
91 ++ */
92 ++ } else if (val < 32) {
93 + emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx);
94 + emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx);
95 + emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_LSR, val), ctx);
96 +@@ -956,7 +960,11 @@ static inline void emit_a32_arsh_i64(const s8 dst[],
97 + rd = arm_bpf_get_reg64(dst, tmp, ctx);
98 +
99 + /* Do ARSH operation */
100 +- if (val < 32) {
101 ++ if (val == 0) {
102 ++ /* An immediate value of 0 encodes a shift amount of 32
103 ++ * for ASR. To shift by 0, don't do anything.
104 ++ */
105 ++ } else if (val < 32) {
106 + emit(ARM_MOV_SI(tmp2[1], rd[1], SRTYPE_LSR, val), ctx);
107 + emit(ARM_ORR_SI(rd[1], tmp2[1], rd[0], SRTYPE_ASL, 32 - val), ctx);
108 + emit(ARM_MOV_SI(rd[0], rd[0], SRTYPE_ASR, val), ctx);
109 +@@ -993,21 +1001,35 @@ static inline void emit_a32_mul_r64(const s8 dst[], const s8 src[],
110 + arm_bpf_put_reg32(dst_hi, rd[0], ctx);
111 + }
112 +
113 ++static bool is_ldst_imm(s16 off, const u8 size)
114 ++{
115 ++ s16 off_max = 0;
116 ++
117 ++ switch (size) {
118 ++ case BPF_B:
119 ++ case BPF_W:
120 ++ off_max = 0xfff;
121 ++ break;
122 ++ case BPF_H:
123 ++ off_max = 0xff;
124 ++ break;
125 ++ case BPF_DW:
126 ++ /* Need to make sure off+4 does not overflow. */
127 ++ off_max = 0xfff - 4;
128 ++ break;
129 ++ }
130 ++ return -off_max <= off && off <= off_max;
131 ++}
132 ++
133 + /* *(size *)(dst + off) = src */
134 + static inline void emit_str_r(const s8 dst, const s8 src[],
135 +- s32 off, struct jit_ctx *ctx, const u8 sz){
136 ++ s16 off, struct jit_ctx *ctx, const u8 sz){
137 + const s8 *tmp = bpf2a32[TMP_REG_1];
138 +- s32 off_max;
139 + s8 rd;
140 +
141 + rd = arm_bpf_get_reg32(dst, tmp[1], ctx);
142 +
143 +- if (sz == BPF_H)
144 +- off_max = 0xff;
145 +- else
146 +- off_max = 0xfff;
147 +-
148 +- if (off < 0 || off > off_max) {
149 ++ if (!is_ldst_imm(off, sz)) {
150 + emit_a32_mov_i(tmp[0], off, ctx);
151 + emit(ARM_ADD_R(tmp[0], tmp[0], rd), ctx);
152 + rd = tmp[0];
153 +@@ -1036,18 +1058,12 @@ static inline void emit_str_r(const s8 dst, const s8 src[],
154 +
155 + /* dst = *(size*)(src + off) */
156 + static inline void emit_ldx_r(const s8 dst[], const s8 src,
157 +- s32 off, struct jit_ctx *ctx, const u8 sz){
158 ++ s16 off, struct jit_ctx *ctx, const u8 sz){
159 + const s8 *tmp = bpf2a32[TMP_REG_1];
160 + const s8 *rd = is_stacked(dst_lo) ? tmp : dst;
161 + s8 rm = src;
162 +- s32 off_max;
163 +-
164 +- if (sz == BPF_H)
165 +- off_max = 0xff;
166 +- else
167 +- off_max = 0xfff;
168 +
169 +- if (off < 0 || off > off_max) {
170 ++ if (!is_ldst_imm(off, sz)) {
171 + emit_a32_mov_i(tmp[0], off, ctx);
172 + emit(ARM_ADD_R(tmp[0], tmp[0], src), ctx);
173 + rm = tmp[0];
174 +diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
175 +index b7f937563827..d1fee2d35b49 100644
176 +--- a/arch/powerpc/platforms/maple/setup.c
177 ++++ b/arch/powerpc/platforms/maple/setup.c
178 +@@ -299,23 +299,6 @@ static int __init maple_probe(void)
179 + return 1;
180 + }
181 +
182 +-define_machine(maple) {
183 +- .name = "Maple",
184 +- .probe = maple_probe,
185 +- .setup_arch = maple_setup_arch,
186 +- .init_IRQ = maple_init_IRQ,
187 +- .pci_irq_fixup = maple_pci_irq_fixup,
188 +- .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
189 +- .restart = maple_restart,
190 +- .halt = maple_halt,
191 +- .get_boot_time = maple_get_boot_time,
192 +- .set_rtc_time = maple_set_rtc_time,
193 +- .get_rtc_time = maple_get_rtc_time,
194 +- .calibrate_decr = generic_calibrate_decr,
195 +- .progress = maple_progress,
196 +- .power_save = power4_idle,
197 +-};
198 +-
199 + #ifdef CONFIG_EDAC
200 + /*
201 + * Register a platform device for CPC925 memory controller on
202 +@@ -372,3 +355,20 @@ static int __init maple_cpc925_edac_setup(void)
203 + }
204 + machine_device_initcall(maple, maple_cpc925_edac_setup);
205 + #endif
206 ++
207 ++define_machine(maple) {
208 ++ .name = "Maple",
209 ++ .probe = maple_probe,
210 ++ .setup_arch = maple_setup_arch,
211 ++ .init_IRQ = maple_init_IRQ,
212 ++ .pci_irq_fixup = maple_pci_irq_fixup,
213 ++ .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
214 ++ .restart = maple_restart,
215 ++ .halt = maple_halt,
216 ++ .get_boot_time = maple_get_boot_time,
217 ++ .set_rtc_time = maple_set_rtc_time,
218 ++ .get_rtc_time = maple_get_rtc_time,
219 ++ .calibrate_decr = generic_calibrate_decr,
220 ++ .progress = maple_progress,
221 ++ .power_save = power4_idle,
222 ++};
223 +diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c
224 +index 5bfb1ce129f4..74a296cea21c 100644
225 +--- a/arch/s390/kernel/perf_cpum_sf.c
226 ++++ b/arch/s390/kernel/perf_cpum_sf.c
227 +@@ -1537,6 +1537,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw)
228 + perf_aux_output_end(handle, size);
229 + num_sdb = aux->sfb.num_sdb;
230 +
231 ++ num_sdb = aux->sfb.num_sdb;
232 + while (!done) {
233 + /* Get an output handle */
234 + aux = perf_aux_output_begin(handle, cpuhw->event);
235 +diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
236 +index 6fe2e1875058..675d4be0c2b7 100644
237 +--- a/arch/s390/kernel/processor.c
238 ++++ b/arch/s390/kernel/processor.c
239 +@@ -157,8 +157,9 @@ static void show_cpu_mhz(struct seq_file *m, unsigned long n)
240 + static int show_cpuinfo(struct seq_file *m, void *v)
241 + {
242 + unsigned long n = (unsigned long) v - 1;
243 ++ unsigned long first = cpumask_first(cpu_online_mask);
244 +
245 +- if (!n)
246 ++ if (n == first)
247 + show_cpu_summary(m, v);
248 + if (!machine_has_cpu_mhz)
249 + return 0;
250 +@@ -171,6 +172,8 @@ static inline void *c_update(loff_t *pos)
251 + {
252 + if (*pos)
253 + *pos = cpumask_next(*pos - 1, cpu_online_mask);
254 ++ else
255 ++ *pos = cpumask_first(cpu_online_mask);
256 + return *pos < nr_cpu_ids ? (void *)*pos + 1 : NULL;
257 + }
258 +
259 +diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
260 +index b56c4fdb1517..7cde0f2f52e1 100644
261 +--- a/arch/s390/mm/gmap.c
262 ++++ b/arch/s390/mm/gmap.c
263 +@@ -1838,6 +1838,7 @@ int gmap_shadow_r3t(struct gmap *sg, unsigned long saddr, unsigned long r3t,
264 + goto out_free;
265 + } else if (*table & _REGION_ENTRY_ORIGIN) {
266 + rc = -EAGAIN; /* Race with shadow */
267 ++ goto out_free;
268 + }
269 + crst_table_init(s_r3t, _REGION3_ENTRY_EMPTY);
270 + /* mark as invalid as long as the parent table is not protected */
271 +diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
272 +index 83c470364dfb..748bd0921dff 100644
273 +--- a/arch/um/drivers/ubd_kern.c
274 ++++ b/arch/um/drivers/ubd_kern.c
275 +@@ -1574,7 +1574,9 @@ int io_thread(void *arg)
276 + written = 0;
277 +
278 + do {
279 +- res = os_write_file(kernel_fd, ((char *) io_req_buffer) + written, n);
280 ++ res = os_write_file(kernel_fd,
281 ++ ((char *) io_req_buffer) + written,
282 ++ n - written);
283 + if (res >= 0) {
284 + written += res;
285 + } else {
286 +diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
287 +index 8a9cff1f129d..1663ad84778b 100644
288 +--- a/arch/x86/hyperv/hv_init.c
289 ++++ b/arch/x86/hyperv/hv_init.c
290 +@@ -30,6 +30,7 @@
291 + #include <linux/clockchips.h>
292 + #include <linux/hyperv.h>
293 + #include <linux/slab.h>
294 ++#include <linux/kernel.h>
295 + #include <linux/cpuhotplug.h>
296 +
297 + #ifdef CONFIG_HYPERV_TSCPAGE
298 +@@ -427,11 +428,14 @@ void hyperv_cleanup(void)
299 + }
300 + EXPORT_SYMBOL_GPL(hyperv_cleanup);
301 +
302 +-void hyperv_report_panic(struct pt_regs *regs, long err)
303 ++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die)
304 + {
305 + static bool panic_reported;
306 + u64 guest_id;
307 +
308 ++ if (in_die && !panic_on_oops)
309 ++ return;
310 ++
311 + /*
312 + * We prefer to report panic on 'die' chain as we have proper
313 + * registers to report, but if we miss it (e.g. on BUG()) we need
314 +diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
315 +index f37704497d8f..5b58a6cf487f 100644
316 +--- a/arch/x86/include/asm/mshyperv.h
317 ++++ b/arch/x86/include/asm/mshyperv.h
318 +@@ -338,7 +338,7 @@ static inline int cpumask_to_vpset(struct hv_vpset *vpset,
319 +
320 + void __init hyperv_init(void);
321 + void hyperv_setup_mmu_ops(void);
322 +-void hyperv_report_panic(struct pt_regs *regs, long err);
323 ++void hyperv_report_panic(struct pt_regs *regs, long err, bool in_die);
324 + void hyperv_report_panic_msg(phys_addr_t pa, size_t size);
325 + bool hv_is_hyperv_initialized(void);
326 + void hyperv_cleanup(void);
327 +diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
328 +index 158ad1483c43..92539a1c3e31 100644
329 +--- a/arch/x86/kernel/acpi/cstate.c
330 ++++ b/arch/x86/kernel/acpi/cstate.c
331 +@@ -133,7 +133,8 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
332 +
333 + /* Make sure we are running on right CPU */
334 +
335 +- retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx);
336 ++ retval = call_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx,
337 ++ false);
338 + if (retval == 0) {
339 + /* Use the hint in CST */
340 + percpu_entry->states[cx->index].eax = cx->address;
341 +diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
342 +index 852e74e48890..fc93ae325515 100644
343 +--- a/arch/x86/kernel/cpu/mshyperv.c
344 ++++ b/arch/x86/kernel/cpu/mshyperv.c
345 +@@ -250,6 +250,16 @@ static void __init ms_hyperv_init_platform(void)
346 + cpuid_eax(HYPERV_CPUID_NESTED_FEATURES);
347 + }
348 +
349 ++ /*
350 ++ * Hyper-V expects to get crash register data or kmsg when
351 ++ * crash enlightment is available and system crashes. Set
352 ++ * crash_kexec_post_notifiers to be true to make sure that
353 ++ * calling crash enlightment interface before running kdump
354 ++ * kernel.
355 ++ */
356 ++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE)
357 ++ crash_kexec_post_notifiers = true;
358 ++
359 + #ifdef CONFIG_X86_LOCAL_APIC
360 + if (ms_hyperv.features & HV_X64_ACCESS_FREQUENCY_MSRS &&
361 + ms_hyperv.misc_features & HV_FEATURE_FREQUENCY_MSRS_AVAILABLE) {
362 +diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
363 +index fbc936cf2025..62c0fe9ef412 100644
364 +--- a/drivers/acpi/processor_throttling.c
365 ++++ b/drivers/acpi/processor_throttling.c
366 +@@ -910,13 +910,6 @@ static long __acpi_processor_get_throttling(void *data)
367 + return pr->throttling.acpi_processor_get_throttling(pr);
368 + }
369 +
370 +-static int call_on_cpu(int cpu, long (*fn)(void *), void *arg, bool direct)
371 +-{
372 +- if (direct || (is_percpu_thread() && cpu == smp_processor_id()))
373 +- return fn(arg);
374 +- return work_on_cpu(cpu, fn, arg);
375 +-}
376 +-
377 + static int acpi_processor_get_throttling(struct acpi_processor *pr)
378 + {
379 + if (!pr)
380 +diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
381 +index d3ad1b8c133e..110129097169 100644
382 +--- a/drivers/block/rbd.c
383 ++++ b/drivers/block/rbd.c
384 +@@ -3427,6 +3427,10 @@ static void cancel_tasks_sync(struct rbd_device *rbd_dev)
385 + cancel_work_sync(&rbd_dev->unlock_work);
386 + }
387 +
388 ++/*
389 ++ * header_rwsem must not be held to avoid a deadlock with
390 ++ * rbd_dev_refresh() when flushing notifies.
391 ++ */
392 + static void rbd_unregister_watch(struct rbd_device *rbd_dev)
393 + {
394 + WARN_ON(waitqueue_active(&rbd_dev->lock_waitq));
395 +@@ -5719,9 +5723,10 @@ static int rbd_dev_header_name(struct rbd_device *rbd_dev)
396 +
397 + static void rbd_dev_image_release(struct rbd_device *rbd_dev)
398 + {
399 +- rbd_dev_unprobe(rbd_dev);
400 + if (rbd_dev->opts)
401 + rbd_unregister_watch(rbd_dev);
402 ++
403 ++ rbd_dev_unprobe(rbd_dev);
404 + rbd_dev->image_format = 0;
405 + kfree(rbd_dev->spec->image_id);
406 + rbd_dev->spec->image_id = NULL;
407 +@@ -5732,6 +5737,9 @@ static void rbd_dev_image_release(struct rbd_device *rbd_dev)
408 + * device. If this image is the one being mapped (i.e., not a
409 + * parent), initiate a watch on its header object before using that
410 + * object to get detailed information about the rbd image.
411 ++ *
412 ++ * On success, returns with header_rwsem held for write if called
413 ++ * with @depth == 0.
414 + */
415 + static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
416 + {
417 +@@ -5764,9 +5772,12 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
418 + }
419 + }
420 +
421 ++ if (!depth)
422 ++ down_write(&rbd_dev->header_rwsem);
423 ++
424 + ret = rbd_dev_header_info(rbd_dev);
425 + if (ret)
426 +- goto err_out_watch;
427 ++ goto err_out_probe;
428 +
429 + /*
430 + * If this image is the one being mapped, we have pool name and
431 +@@ -5812,10 +5823,11 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)
432 + return 0;
433 +
434 + err_out_probe:
435 +- rbd_dev_unprobe(rbd_dev);
436 +-err_out_watch:
437 ++ if (!depth)
438 ++ up_write(&rbd_dev->header_rwsem);
439 + if (!depth)
440 + rbd_unregister_watch(rbd_dev);
441 ++ rbd_dev_unprobe(rbd_dev);
442 + err_out_format:
443 + rbd_dev->image_format = 0;
444 + kfree(rbd_dev->spec->image_id);
445 +@@ -5872,12 +5884,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
446 + goto err_out_rbd_dev;
447 + }
448 +
449 +- down_write(&rbd_dev->header_rwsem);
450 + rc = rbd_dev_image_probe(rbd_dev, 0);
451 +- if (rc < 0) {
452 +- up_write(&rbd_dev->header_rwsem);
453 ++ if (rc < 0)
454 + goto err_out_rbd_dev;
455 +- }
456 +
457 + /* If we are mapping a snapshot it must be marked read-only */
458 + if (rbd_dev->spec->snap_id != CEPH_NOSNAP)
459 +diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
460 +index 791770a563fc..6fac6383d024 100644
461 +--- a/drivers/clk/at91/clk-usb.c
462 ++++ b/drivers/clk/at91/clk-usb.c
463 +@@ -78,6 +78,9 @@ static int at91sam9x5_clk_usb_determine_rate(struct clk_hw *hw,
464 + tmp_parent_rate = req->rate * div;
465 + tmp_parent_rate = clk_hw_round_rate(parent,
466 + tmp_parent_rate);
467 ++ if (!tmp_parent_rate)
468 ++ continue;
469 ++
470 + tmp_rate = DIV_ROUND_CLOSEST(tmp_parent_rate, div);
471 + if (tmp_rate < req->rate)
472 + tmp_diff = req->rate - tmp_rate;
473 +diff --git a/drivers/clk/tegra/clk-tegra-pmc.c b/drivers/clk/tegra/clk-tegra-pmc.c
474 +index a35579a3f884..476dab494c44 100644
475 +--- a/drivers/clk/tegra/clk-tegra-pmc.c
476 ++++ b/drivers/clk/tegra/clk-tegra-pmc.c
477 +@@ -60,16 +60,16 @@ struct pmc_clk_init_data {
478 +
479 + static DEFINE_SPINLOCK(clk_out_lock);
480 +
481 +-static const char *clk_out1_parents[] = { "clk_m", "clk_m_div2",
482 +- "clk_m_div4", "extern1",
483 ++static const char *clk_out1_parents[] = { "osc", "osc_div2",
484 ++ "osc_div4", "extern1",
485 + };
486 +
487 +-static const char *clk_out2_parents[] = { "clk_m", "clk_m_div2",
488 +- "clk_m_div4", "extern2",
489 ++static const char *clk_out2_parents[] = { "osc", "osc_div2",
490 ++ "osc_div4", "extern2",
491 + };
492 +
493 +-static const char *clk_out3_parents[] = { "clk_m", "clk_m_div2",
494 +- "clk_m_div4", "extern3",
495 ++static const char *clk_out3_parents[] = { "osc", "osc_div2",
496 ++ "osc_div4", "extern3",
497 + };
498 +
499 + static struct pmc_clk_init_data pmc_clks[] = {
500 +diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
501 +index 938d0053a820..28022d1cb0f0 100644
502 +--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
503 ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
504 +@@ -921,9 +921,9 @@ kfd_gtt_out:
505 + return 0;
506 +
507 + kfd_gtt_no_free_chunk:
508 +- pr_debug("Allocation failed with mem_obj = %p\n", mem_obj);
509 ++ pr_debug("Allocation failed with mem_obj = %p\n", *mem_obj);
510 + mutex_unlock(&kfd->gtt_sa_lock);
511 +- kfree(mem_obj);
512 ++ kfree(*mem_obj);
513 + return -ENOMEM;
514 + }
515 +
516 +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
517 +index fd5522fd179e..86b98856756d 100644
518 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
519 ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
520 +@@ -698,11 +698,23 @@ static enum drm_mode_status
521 + vc4_hdmi_encoder_mode_valid(struct drm_encoder *crtc,
522 + const struct drm_display_mode *mode)
523 + {
524 +- /* HSM clock must be 108% of the pixel clock. Additionally,
525 +- * the AXI clock needs to be at least 25% of pixel clock, but
526 +- * HSM ends up being the limiting factor.
527 ++ /*
528 ++ * As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must
529 ++ * be faster than pixel clock, infinitesimally faster, tested in
530 ++ * simulation. Otherwise, exact value is unimportant for HDMI
531 ++ * operation." This conflicts with bcm2835's vc4 documentation, which
532 ++ * states HSM's clock has to be at least 108% of the pixel clock.
533 ++ *
534 ++ * Real life tests reveal that vc4's firmware statement holds up, and
535 ++ * users are able to use pixel clocks closer to HSM's, namely for
536 ++ * 1920x1200@60Hz. So it was decided to have leave a 1% margin between
537 ++ * both clocks. Which, for RPi0-3 implies a maximum pixel clock of
538 ++ * 162MHz.
539 ++ *
540 ++ * Additionally, the AXI clock needs to be at least 25% of
541 ++ * pixel clock, but HSM ends up being the limiting factor.
542 + */
543 +- if (mode->clock > HSM_CLOCK_FREQ / (1000 * 108 / 100))
544 ++ if (mode->clock > HSM_CLOCK_FREQ / (1000 * 101 / 100))
545 + return MODE_CLOCK_HIGH;
546 +
547 + return MODE_OK;
548 +diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
549 +index 16eb9b3f1cb1..3bf1f9ef8ea2 100644
550 +--- a/drivers/hv/channel_mgmt.c
551 ++++ b/drivers/hv/channel_mgmt.c
552 +@@ -849,6 +849,9 @@ void vmbus_initiate_unload(bool crash)
553 + {
554 + struct vmbus_channel_message_header hdr;
555 +
556 ++ if (xchg(&vmbus_connection.conn_state, DISCONNECTED) == DISCONNECTED)
557 ++ return;
558 ++
559 + /* Pre-Win2012R2 hosts don't support reconnect */
560 + if (vmbus_proto_version < VERSION_WIN8_1)
561 + return;
562 +diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
563 +index 9aa18f387a34..fb22b72fd535 100644
564 +--- a/drivers/hv/vmbus_drv.c
565 ++++ b/drivers/hv/vmbus_drv.c
566 +@@ -43,6 +43,7 @@
567 + #include <linux/kdebug.h>
568 + #include <linux/efi.h>
569 + #include <linux/random.h>
570 ++#include <linux/kernel.h>
571 + #include "hyperv_vmbus.h"
572 +
573 + struct vmbus_dynid {
574 +@@ -58,14 +59,35 @@ static int hyperv_cpuhp_online;
575 +
576 + static void *hv_panic_page;
577 +
578 ++/*
579 ++ * Boolean to control whether to report panic messages over Hyper-V.
580 ++ *
581 ++ * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
582 ++ */
583 ++static int sysctl_record_panic_msg = 1;
584 ++
585 ++static int hyperv_report_reg(void)
586 ++{
587 ++ return !sysctl_record_panic_msg || !hv_panic_page;
588 ++}
589 ++
590 + static int hyperv_panic_event(struct notifier_block *nb, unsigned long val,
591 + void *args)
592 + {
593 + struct pt_regs *regs;
594 +
595 +- regs = current_pt_regs();
596 ++ vmbus_initiate_unload(true);
597 +
598 +- hyperv_report_panic(regs, val);
599 ++ /*
600 ++ * Hyper-V should be notified only once about a panic. If we will be
601 ++ * doing hyperv_report_panic_msg() later with kmsg data, don't do
602 ++ * the notification here.
603 ++ */
604 ++ if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE
605 ++ && hyperv_report_reg()) {
606 ++ regs = current_pt_regs();
607 ++ hyperv_report_panic(regs, val, false);
608 ++ }
609 + return NOTIFY_DONE;
610 + }
611 +
612 +@@ -75,7 +97,13 @@ static int hyperv_die_event(struct notifier_block *nb, unsigned long val,
613 + struct die_args *die = (struct die_args *)args;
614 + struct pt_regs *regs = die->regs;
615 +
616 +- hyperv_report_panic(regs, val);
617 ++ /*
618 ++ * Hyper-V should be notified only once about a panic. If we will be
619 ++ * doing hyperv_report_panic_msg() later with kmsg data, don't do
620 ++ * the notification here.
621 ++ */
622 ++ if (hyperv_report_reg())
623 ++ hyperv_report_panic(regs, val, true);
624 + return NOTIFY_DONE;
625 + }
626 +
627 +@@ -1088,13 +1116,6 @@ static void vmbus_isr(void)
628 + add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR, 0);
629 + }
630 +
631 +-/*
632 +- * Boolean to control whether to report panic messages over Hyper-V.
633 +- *
634 +- * It can be set via /proc/sys/kernel/hyperv/record_panic_msg
635 +- */
636 +-static int sysctl_record_panic_msg = 1;
637 +-
638 + /*
639 + * Callback from kmsg_dump. Grab as much as possible from the end of the kmsg
640 + * buffer and call into Hyper-V to transfer the data.
641 +@@ -1219,19 +1240,29 @@ static int vmbus_bus_init(void)
642 + hv_panic_page = (void *)get_zeroed_page(GFP_KERNEL);
643 + if (hv_panic_page) {
644 + ret = kmsg_dump_register(&hv_kmsg_dumper);
645 +- if (ret)
646 ++ if (ret) {
647 + pr_err("Hyper-V: kmsg dump register "
648 + "error 0x%x\n", ret);
649 ++ free_page(
650 ++ (unsigned long)hv_panic_page);
651 ++ hv_panic_page = NULL;
652 ++ }
653 + } else
654 + pr_err("Hyper-V: panic message page memory "
655 + "allocation failed");
656 + }
657 +
658 + register_die_notifier(&hyperv_die_block);
659 +- atomic_notifier_chain_register(&panic_notifier_list,
660 +- &hyperv_panic_block);
661 + }
662 +
663 ++ /*
664 ++ * Always register the panic notifier because we need to unload
665 ++ * the VMbus channel connection to prevent any VMbus
666 ++ * activity after the VM panics.
667 ++ */
668 ++ atomic_notifier_chain_register(&panic_notifier_list,
669 ++ &hyperv_panic_block);
670 ++
671 + vmbus_request_offers();
672 +
673 + return 0;
674 +@@ -1243,7 +1274,6 @@ err_alloc:
675 + hv_remove_vmbus_irq();
676 +
677 + bus_unregister(&hv_bus);
678 +- free_page((unsigned long)hv_panic_page);
679 + unregister_sysctl_table(hv_ctl_table_hdr);
680 + hv_ctl_table_hdr = NULL;
681 + return ret;
682 +@@ -1875,7 +1905,6 @@ static void hv_kexec_handler(void)
683 + {
684 + hv_synic_clockevents_cleanup();
685 + vmbus_initiate_unload(false);
686 +- vmbus_connection.conn_state = DISCONNECTED;
687 + /* Make sure conn_state is set as hv_synic_cleanup checks for it */
688 + mb();
689 + cpuhp_remove_state(hyperv_cpuhp_online);
690 +@@ -1890,7 +1919,6 @@ static void hv_crash_handler(struct pt_regs *regs)
691 + * doing the cleanup for current CPU only. This should be sufficient
692 + * for kdump.
693 + */
694 +- vmbus_connection.conn_state = DISCONNECTED;
695 + hv_synic_cleanup(smp_processor_id());
696 + hyperv_cleanup();
697 + };
698 +diff --git a/drivers/iio/light/si1133.c b/drivers/iio/light/si1133.c
699 +index 015a21f0c2ef..9174ab928880 100644
700 +--- a/drivers/iio/light/si1133.c
701 ++++ b/drivers/iio/light/si1133.c
702 +@@ -102,6 +102,9 @@
703 + #define SI1133_INPUT_FRACTION_LOW 15
704 + #define SI1133_LUX_OUTPUT_FRACTION 12
705 + #define SI1133_LUX_BUFFER_SIZE 9
706 ++#define SI1133_MEASURE_BUFFER_SIZE 3
707 ++
708 ++#define SI1133_SIGN_BIT_INDEX 23
709 +
710 + static const int si1133_scale_available[] = {
711 + 1, 2, 4, 8, 16, 32, 64, 128};
712 +@@ -234,13 +237,13 @@ static const struct si1133_lux_coeff lux_coeff = {
713 + }
714 + };
715 +
716 +-static int si1133_calculate_polynomial_inner(u32 input, u8 fraction, u16 mag,
717 ++static int si1133_calculate_polynomial_inner(s32 input, u8 fraction, u16 mag,
718 + s8 shift)
719 + {
720 + return ((input << fraction) / mag) << shift;
721 + }
722 +
723 +-static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order,
724 ++static int si1133_calculate_output(s32 x, s32 y, u8 x_order, u8 y_order,
725 + u8 input_fraction, s8 sign,
726 + const struct si1133_coeff *coeffs)
727 + {
728 +@@ -276,7 +279,7 @@ static int si1133_calculate_output(u32 x, u32 y, u8 x_order, u8 y_order,
729 + * The algorithm is from:
730 + * https://siliconlabs.github.io/Gecko_SDK_Doc/efm32zg/html/si1133_8c_source.html#l00716
731 + */
732 +-static int si1133_calc_polynomial(u32 x, u32 y, u8 input_fraction, u8 num_coeff,
733 ++static int si1133_calc_polynomial(s32 x, s32 y, u8 input_fraction, u8 num_coeff,
734 + const struct si1133_coeff *coeffs)
735 + {
736 + u8 x_order, y_order;
737 +@@ -614,7 +617,7 @@ static int si1133_measure(struct si1133_data *data,
738 + {
739 + int err;
740 +
741 +- __be16 resp;
742 ++ u8 buffer[SI1133_MEASURE_BUFFER_SIZE];
743 +
744 + err = si1133_set_adcmux(data, 0, chan->channel);
745 + if (err)
746 +@@ -625,12 +628,13 @@ static int si1133_measure(struct si1133_data *data,
747 + if (err)
748 + return err;
749 +
750 +- err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(resp),
751 +- (u8 *)&resp);
752 ++ err = si1133_bulk_read(data, SI1133_REG_HOSTOUT(0), sizeof(buffer),
753 ++ buffer);
754 + if (err)
755 + return err;
756 +
757 +- *val = be16_to_cpu(resp);
758 ++ *val = sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2],
759 ++ SI1133_SIGN_BIT_INDEX);
760 +
761 + return err;
762 + }
763 +@@ -704,9 +708,9 @@ static int si1133_get_lux(struct si1133_data *data, int *val)
764 + {
765 + int err;
766 + int lux;
767 +- u32 high_vis;
768 +- u32 low_vis;
769 +- u32 ir;
770 ++ s32 high_vis;
771 ++ s32 low_vis;
772 ++ s32 ir;
773 + u8 buffer[SI1133_LUX_BUFFER_SIZE];
774 +
775 + /* Activate lux channels */
776 +@@ -719,9 +723,16 @@ static int si1133_get_lux(struct si1133_data *data, int *val)
777 + if (err)
778 + return err;
779 +
780 +- high_vis = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
781 +- low_vis = (buffer[3] << 16) | (buffer[4] << 8) | buffer[5];
782 +- ir = (buffer[6] << 16) | (buffer[7] << 8) | buffer[8];
783 ++ high_vis =
784 ++ sign_extend32((buffer[0] << 16) | (buffer[1] << 8) | buffer[2],
785 ++ SI1133_SIGN_BIT_INDEX);
786 ++
787 ++ low_vis =
788 ++ sign_extend32((buffer[3] << 16) | (buffer[4] << 8) | buffer[5],
789 ++ SI1133_SIGN_BIT_INDEX);
790 ++
791 ++ ir = sign_extend32((buffer[6] << 16) | (buffer[7] << 8) | buffer[8],
792 ++ SI1133_SIGN_BIT_INDEX);
793 +
794 + if (high_vis > SI1133_ADC_THRESHOLD || ir > SI1133_ADC_THRESHOLD)
795 + lux = si1133_calc_polynomial(high_vis, ir,
796 +diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
797 +index 69f3d4c95b53..859b06424e5c 100644
798 +--- a/drivers/iommu/amd_iommu_types.h
799 ++++ b/drivers/iommu/amd_iommu_types.h
800 +@@ -352,7 +352,7 @@
801 +
802 + #define DTE_GCR3_VAL_A(x) (((x) >> 12) & 0x00007ULL)
803 + #define DTE_GCR3_VAL_B(x) (((x) >> 15) & 0x0ffffULL)
804 +-#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0xfffffULL)
805 ++#define DTE_GCR3_VAL_C(x) (((x) >> 31) & 0x1fffffULL)
806 +
807 + #define DTE_GCR3_INDEX_A 0
808 + #define DTE_GCR3_INDEX_B 1
809 +diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
810 +index 5944d3b4dca3..ef3aadec980e 100644
811 +--- a/drivers/iommu/intel-svm.c
812 ++++ b/drivers/iommu/intel-svm.c
813 +@@ -620,14 +620,15 @@ static irqreturn_t prq_event_thread(int irq, void *d)
814 + * any faults on kernel addresses. */
815 + if (!svm->mm)
816 + goto bad_req;
817 +- /* If the mm is already defunct, don't handle faults. */
818 +- if (!mmget_not_zero(svm->mm))
819 +- goto bad_req;
820 +
821 + /* If address is not canonical, return invalid response */
822 + if (!is_canonical_address(address))
823 + goto bad_req;
824 +
825 ++ /* If the mm is already defunct, don't handle faults. */
826 ++ if (!mmget_not_zero(svm->mm))
827 ++ goto bad_req;
828 ++
829 + down_read(&svm->mm->mmap_sem);
830 + vma = find_extend_vma(svm->mm, address);
831 + if (!vma || address < vma->vm_start)
832 +diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
833 +index f7fdbf5d183b..c98358be0bc8 100644
834 +--- a/drivers/irqchip/irq-mbigen.c
835 ++++ b/drivers/irqchip/irq-mbigen.c
836 +@@ -231,10 +231,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
837 + return 0;
838 + }
839 +
840 ++static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
841 ++ unsigned int nr_irqs)
842 ++{
843 ++ platform_msi_domain_free(domain, virq, nr_irqs);
844 ++}
845 ++
846 + static const struct irq_domain_ops mbigen_domain_ops = {
847 + .translate = mbigen_domain_translate,
848 + .alloc = mbigen_irq_domain_alloc,
849 +- .free = irq_domain_free_irqs_common,
850 ++ .free = mbigen_irq_domain_free,
851 + };
852 +
853 + static int mbigen_of_create_domain(struct platform_device *pdev,
854 +diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
855 +index 9ee04b5f9311..5a04ff638688 100644
856 +--- a/drivers/mtd/devices/phram.c
857 ++++ b/drivers/mtd/devices/phram.c
858 +@@ -240,22 +240,25 @@ static int phram_setup(const char *val)
859 +
860 + ret = parse_num64(&start, token[1]);
861 + if (ret) {
862 +- kfree(name);
863 + parse_err("illegal start address\n");
864 ++ goto error;
865 + }
866 +
867 + ret = parse_num64(&len, token[2]);
868 + if (ret) {
869 +- kfree(name);
870 + parse_err("illegal device length\n");
871 ++ goto error;
872 + }
873 +
874 + ret = register_device(name, start, len);
875 +- if (!ret)
876 +- pr_info("%s device: %#llx at %#llx\n", name, len, start);
877 +- else
878 +- kfree(name);
879 ++ if (ret)
880 ++ goto error;
881 ++
882 ++ pr_info("%s device: %#llx at %#llx\n", name, len, start);
883 ++ return 0;
884 +
885 ++error:
886 ++ kfree(name);
887 + return ret;
888 + }
889 +
890 +diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
891 +index b13557fe52bd..947bb710bf16 100644
892 +--- a/drivers/mtd/lpddr/lpddr_cmds.c
893 ++++ b/drivers/mtd/lpddr/lpddr_cmds.c
894 +@@ -81,7 +81,6 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
895 + shared = kmalloc_array(lpddr->numchips, sizeof(struct flchip_shared),
896 + GFP_KERNEL);
897 + if (!shared) {
898 +- kfree(lpddr);
899 + kfree(mtd);
900 + return NULL;
901 + }
902 +diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
903 +index ee0c74b02220..a2f38b3b9776 100644
904 +--- a/drivers/mtd/nand/spi/core.c
905 ++++ b/drivers/mtd/nand/spi/core.c
906 +@@ -670,6 +670,7 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos)
907 + .ooboffs = 0,
908 + .ooblen = sizeof(marker),
909 + .oobbuf.out = marker,
910 ++ .mode = MTD_OPS_RAW,
911 + };
912 + int ret;
913 +
914 +diff --git a/drivers/net/dsa/bcm_sf2_cfp.c b/drivers/net/dsa/bcm_sf2_cfp.c
915 +index 21db1804e85d..12156ab186a1 100644
916 +--- a/drivers/net/dsa/bcm_sf2_cfp.c
917 ++++ b/drivers/net/dsa/bcm_sf2_cfp.c
918 +@@ -742,17 +742,14 @@ static int bcm_sf2_cfp_rule_set(struct dsa_switch *ds, int port,
919 + fs->m_ext.data[1]))
920 + return -EINVAL;
921 +
922 +- if (fs->location != RX_CLS_LOC_ANY && fs->location >= CFP_NUM_RULES)
923 ++ if (fs->location != RX_CLS_LOC_ANY &&
924 ++ fs->location > bcm_sf2_cfp_rule_size(priv))
925 + return -EINVAL;
926 +
927 + if (fs->location != RX_CLS_LOC_ANY &&
928 + test_bit(fs->location, priv->cfp.used))
929 + return -EBUSY;
930 +
931 +- if (fs->location != RX_CLS_LOC_ANY &&
932 +- fs->location > bcm_sf2_cfp_rule_size(priv))
933 +- return -EINVAL;
934 +-
935 + /* This rule is a Wake-on-LAN filter and we must specifically
936 + * target the CPU port in order for it to be working.
937 + */
938 +@@ -839,7 +836,7 @@ static int bcm_sf2_cfp_rule_del(struct bcm_sf2_priv *priv, int port,
939 + u32 next_loc = 0;
940 + int ret;
941 +
942 +- if (loc >= CFP_NUM_RULES)
943 ++ if (loc > bcm_sf2_cfp_rule_size(priv))
944 + return -EINVAL;
945 +
946 + /* Refuse deleting unused rules, and those that are not unique since
947 +diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c
948 +index 54a633e8cb5d..48a070a37ea9 100644
949 +--- a/drivers/nvdimm/bus.c
950 ++++ b/drivers/nvdimm/bus.c
951 +@@ -984,8 +984,10 @@ static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
952 + return -EFAULT;
953 + }
954 +
955 +- if (!desc || (desc->out_num + desc->in_num == 0) ||
956 +- !test_bit(cmd, &cmd_mask))
957 ++ if (!desc ||
958 ++ (desc->out_num + desc->in_num == 0) ||
959 ++ cmd > ND_CMD_CALL ||
960 ++ !test_bit(cmd, &cmd_mask))
961 + return -ENOTTY;
962 +
963 + /* fail write commands (when read-only) */
964 +diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
965 +index 514528b3566f..a77bfeac867d 100644
966 +--- a/drivers/of/overlay.c
967 ++++ b/drivers/of/overlay.c
968 +@@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop(
969 +
970 + of_property_set_flag(new_prop, OF_DYNAMIC);
971 +
972 ++ kfree(target_path);
973 ++
974 + return new_prop;
975 +
976 + err_free_new_prop:
977 +diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
978 +index 808571f7f6ef..29f17c3449aa 100644
979 +--- a/drivers/of/unittest.c
980 ++++ b/drivers/of/unittest.c
981 +@@ -772,6 +772,10 @@ static void __init of_unittest_changeset(void)
982 + unittest(!of_changeset_revert(&chgset), "revert failed\n");
983 +
984 + of_changeset_destroy(&chgset);
985 ++
986 ++ of_node_put(n1);
987 ++ of_node_put(n2);
988 ++ of_node_put(n21);
989 + #endif
990 + }
991 +
992 +@@ -1055,10 +1059,13 @@ static void __init of_unittest_platform_populate(void)
993 +
994 + of_platform_populate(np, match, NULL, &test_bus->dev);
995 + for_each_child_of_node(np, child) {
996 +- for_each_child_of_node(child, grandchild)
997 +- unittest(of_find_device_by_node(grandchild),
998 ++ for_each_child_of_node(child, grandchild) {
999 ++ pdev = of_find_device_by_node(grandchild);
1000 ++ unittest(pdev,
1001 + "Could not create device for node '%pOFn'\n",
1002 + grandchild);
1003 ++ of_dev_put(pdev);
1004 ++ }
1005 + }
1006 +
1007 + of_platform_depopulate(&test_bus->dev);
1008 +@@ -2441,8 +2448,11 @@ static __init void of_unittest_overlay_high_level(void)
1009 + goto err_unlock;
1010 + }
1011 + if (__of_add_property(of_symbols, new_prop)) {
1012 ++ kfree(new_prop->name);
1013 ++ kfree(new_prop->value);
1014 ++ kfree(new_prop);
1015 + /* "name" auto-generated by unflatten */
1016 +- if (!strcmp(new_prop->name, "name"))
1017 ++ if (!strcmp(prop->name, "name"))
1018 + continue;
1019 + unittest(0, "duplicate property '%s' in overlay_base node __symbols__",
1020 + prop->name);
1021 +diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
1022 +index ab0b6e78ca02..157cf5ec6b02 100644
1023 +--- a/drivers/power/supply/axp288_fuel_gauge.c
1024 ++++ b/drivers/power/supply/axp288_fuel_gauge.c
1025 +@@ -718,14 +718,14 @@ static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
1026 + {
1027 + /* Intel Cherry Trail Compute Stick, Windows version */
1028 + .matches = {
1029 +- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
1030 ++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
1031 + DMI_MATCH(DMI_PRODUCT_NAME, "STK1AW32SC"),
1032 + },
1033 + },
1034 + {
1035 + /* Intel Cherry Trail Compute Stick, version without an OS */
1036 + .matches = {
1037 +- DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
1038 ++ DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
1039 + DMI_MATCH(DMI_PRODUCT_NAME, "STK1A32SC"),
1040 + },
1041 + },
1042 +diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
1043 +index f022e1b550df..ff02a917556a 100644
1044 +--- a/drivers/power/supply/bq27xxx_battery.c
1045 ++++ b/drivers/power/supply/bq27xxx_battery.c
1046 +@@ -1887,7 +1887,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
1047 +
1048 + di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
1049 + if (IS_ERR(di->bat)) {
1050 +- dev_err(di->dev, "failed to register battery\n");
1051 ++ if (PTR_ERR(di->bat) == -EPROBE_DEFER)
1052 ++ dev_dbg(di->dev, "failed to register battery, deferring probe\n");
1053 ++ else
1054 ++ dev_err(di->dev, "failed to register battery\n");
1055 + return PTR_ERR(di->bat);
1056 + }
1057 +
1058 +diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c
1059 +index 73697e4b18a9..9d4a59aa29a1 100644
1060 +--- a/drivers/rtc/rtc-88pm860x.c
1061 ++++ b/drivers/rtc/rtc-88pm860x.c
1062 +@@ -341,6 +341,10 @@ static int pm860x_rtc_probe(struct platform_device *pdev)
1063 + info->dev = &pdev->dev;
1064 + dev_set_drvdata(&pdev->dev, info);
1065 +
1066 ++ info->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
1067 ++ if (IS_ERR(info->rtc_dev))
1068 ++ return PTR_ERR(info->rtc_dev);
1069 ++
1070 + ret = devm_request_threaded_irq(&pdev->dev, info->irq, NULL,
1071 + rtc_update_handler, IRQF_ONESHOT, "rtc",
1072 + info);
1073 +@@ -382,13 +386,11 @@ static int pm860x_rtc_probe(struct platform_device *pdev)
1074 + }
1075 + }
1076 +
1077 +- info->rtc_dev = devm_rtc_device_register(&pdev->dev, "88pm860x-rtc",
1078 +- &pm860x_rtc_ops, THIS_MODULE);
1079 +- ret = PTR_ERR(info->rtc_dev);
1080 +- if (IS_ERR(info->rtc_dev)) {
1081 +- dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
1082 ++ info->rtc_dev->ops = &pm860x_rtc_ops;
1083 ++
1084 ++ ret = rtc_register_device(info->rtc_dev);
1085 ++ if (ret)
1086 + return ret;
1087 +- }
1088 +
1089 + /*
1090 + * enable internal XO instead of internal 3.25MHz clock since it can
1091 +diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
1092 +index 8a254bb46a9b..ac8535d2b41a 100644
1093 +--- a/drivers/scsi/sg.c
1094 ++++ b/drivers/scsi/sg.c
1095 +@@ -808,8 +808,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
1096 + "sg_common_write: scsi opcode=0x%02x, cmd_size=%d\n",
1097 + (int) cmnd[0], (int) hp->cmd_len));
1098 +
1099 +- if (hp->dxfer_len >= SZ_256M)
1100 ++ if (hp->dxfer_len >= SZ_256M) {
1101 ++ sg_remove_request(sfp, srp);
1102 + return -EINVAL;
1103 ++ }
1104 +
1105 + k = sg_start_req(srp, cmnd);
1106 + if (k) {
1107 +diff --git a/drivers/soc/imx/gpc.c b/drivers/soc/imx/gpc.c
1108 +index d160fc2a7b7a..56c019ec7f14 100644
1109 +--- a/drivers/soc/imx/gpc.c
1110 ++++ b/drivers/soc/imx/gpc.c
1111 +@@ -93,8 +93,8 @@ static int imx6_pm_domain_power_off(struct generic_pm_domain *genpd)
1112 + static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd)
1113 + {
1114 + struct imx_pm_domain *pd = to_imx_pm_domain(genpd);
1115 +- int i, ret, sw, sw2iso;
1116 +- u32 val;
1117 ++ int i, ret;
1118 ++ u32 val, req;
1119 +
1120 + if (pd->supply) {
1121 + ret = regulator_enable(pd->supply);
1122 +@@ -113,17 +113,18 @@ static int imx6_pm_domain_power_on(struct generic_pm_domain *genpd)
1123 + regmap_update_bits(pd->regmap, pd->reg_offs + GPC_PGC_CTRL_OFFS,
1124 + 0x1, 0x1);
1125 +
1126 +- /* Read ISO and ISO2SW power up delays */
1127 +- regmap_read(pd->regmap, pd->reg_offs + GPC_PGC_PUPSCR_OFFS, &val);
1128 +- sw = val & 0x3f;
1129 +- sw2iso = (val >> 8) & 0x3f;
1130 +-
1131 + /* Request GPC to power up domain */
1132 +- val = BIT(pd->cntr_pdn_bit + 1);
1133 +- regmap_update_bits(pd->regmap, GPC_CNTR, val, val);
1134 ++ req = BIT(pd->cntr_pdn_bit + 1);
1135 ++ regmap_update_bits(pd->regmap, GPC_CNTR, req, req);
1136 +
1137 +- /* Wait ISO + ISO2SW IPG clock cycles */
1138 +- udelay(DIV_ROUND_UP(sw + sw2iso, pd->ipg_rate_mhz));
1139 ++ /* Wait for the PGC to handle the request */
1140 ++ ret = regmap_read_poll_timeout(pd->regmap, GPC_CNTR, val, !(val & req),
1141 ++ 1, 50);
1142 ++ if (ret)
1143 ++ pr_err("powerup request on domain %s timed out\n", genpd->name);
1144 ++
1145 ++ /* Wait for reset to propagate through peripherals */
1146 ++ usleep_range(5, 10);
1147 +
1148 + /* Disable reset clocks for all devices in the domain */
1149 + for (i = 0; i < pd->num_clks; i++)
1150 +@@ -345,6 +346,7 @@ static const struct regmap_config imx_gpc_regmap_config = {
1151 + .rd_table = &access_table,
1152 + .wr_table = &access_table,
1153 + .max_register = 0x2ac,
1154 ++ .fast_io = true,
1155 + };
1156 +
1157 + static struct generic_pm_domain *imx_gpc_onecell_domains[] = {
1158 +diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
1159 +index eea4049b5dcc..ca5004ae3024 100644
1160 +--- a/drivers/tty/ehv_bytechan.c
1161 ++++ b/drivers/tty/ehv_bytechan.c
1162 +@@ -136,6 +136,21 @@ static int find_console_handle(void)
1163 + return 1;
1164 + }
1165 +
1166 ++static unsigned int local_ev_byte_channel_send(unsigned int handle,
1167 ++ unsigned int *count,
1168 ++ const char *p)
1169 ++{
1170 ++ char buffer[EV_BYTE_CHANNEL_MAX_BYTES];
1171 ++ unsigned int c = *count;
1172 ++
1173 ++ if (c < sizeof(buffer)) {
1174 ++ memcpy(buffer, p, c);
1175 ++ memset(&buffer[c], 0, sizeof(buffer) - c);
1176 ++ p = buffer;
1177 ++ }
1178 ++ return ev_byte_channel_send(handle, count, p);
1179 ++}
1180 ++
1181 + /*************************** EARLY CONSOLE DRIVER ***************************/
1182 +
1183 + #ifdef CONFIG_PPC_EARLY_DEBUG_EHV_BC
1184 +@@ -154,7 +169,7 @@ static void byte_channel_spin_send(const char data)
1185 +
1186 + do {
1187 + count = 1;
1188 +- ret = ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE,
1189 ++ ret = local_ev_byte_channel_send(CONFIG_PPC_EARLY_DEBUG_EHV_BC_HANDLE,
1190 + &count, &data);
1191 + } while (ret == EV_EAGAIN);
1192 + }
1193 +@@ -221,7 +236,7 @@ static int ehv_bc_console_byte_channel_send(unsigned int handle, const char *s,
1194 + while (count) {
1195 + len = min_t(unsigned int, count, EV_BYTE_CHANNEL_MAX_BYTES);
1196 + do {
1197 +- ret = ev_byte_channel_send(handle, &len, s);
1198 ++ ret = local_ev_byte_channel_send(handle, &len, s);
1199 + } while (ret == EV_EAGAIN);
1200 + count -= len;
1201 + s += len;
1202 +@@ -401,7 +416,7 @@ static void ehv_bc_tx_dequeue(struct ehv_bc_data *bc)
1203 + CIRC_CNT_TO_END(bc->head, bc->tail, BUF_SIZE),
1204 + EV_BYTE_CHANNEL_MAX_BYTES);
1205 +
1206 +- ret = ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail);
1207 ++ ret = local_ev_byte_channel_send(bc->handle, &len, bc->buf + bc->tail);
1208 +
1209 + /* 'len' is valid only if the return code is 0 or EV_EAGAIN */
1210 + if (!ret || (ret == EV_EAGAIN))
1211 +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
1212 +index c48f083d522a..84845275dbef 100644
1213 +--- a/drivers/video/fbdev/core/fbmem.c
1214 ++++ b/drivers/video/fbdev/core/fbmem.c
1215 +@@ -1122,7 +1122,7 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
1216 + case FBIOGET_FSCREENINFO:
1217 + if (!lock_fb_info(info))
1218 + return -ENODEV;
1219 +- fix = info->fix;
1220 ++ memcpy(&fix, &info->fix, sizeof(fix));
1221 + unlock_fb_info(info);
1222 +
1223 + ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0;
1224 +diff --git a/drivers/video/fbdev/sis/init301.c b/drivers/video/fbdev/sis/init301.c
1225 +index 27a2b72e50e8..a8fb41f1a258 100644
1226 +--- a/drivers/video/fbdev/sis/init301.c
1227 ++++ b/drivers/video/fbdev/sis/init301.c
1228 +@@ -848,9 +848,7 @@ SiS_PanelDelay(struct SiS_Private *SiS_Pr, unsigned short DelayTime)
1229 + SiS_DDC2Delay(SiS_Pr, 0x4000);
1230 + }
1231 +
1232 +- } else if((SiS_Pr->SiS_IF_DEF_LVDS == 1) /* ||
1233 +- (SiS_Pr->SiS_CustomT == CUT_COMPAQ1280) ||
1234 +- (SiS_Pr->SiS_CustomT == CUT_CLEVO1400) */ ) { /* 315 series, LVDS; Special */
1235 ++ } else if (SiS_Pr->SiS_IF_DEF_LVDS == 1) { /* 315 series, LVDS; Special */
1236 +
1237 + if(SiS_Pr->SiS_IF_DEF_CH70xx == 0) {
1238 + PanelID = SiS_GetReg(SiS_Pr->SiS_P3d4,0x36);
1239 +diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
1240 +index 072986d461b7..d8876fba686d 100644
1241 +--- a/drivers/watchdog/sp805_wdt.c
1242 ++++ b/drivers/watchdog/sp805_wdt.c
1243 +@@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd)
1244 + {
1245 + struct sp805_wdt *wdt = watchdog_get_drvdata(wdd);
1246 +
1247 ++ writel_relaxed(UNLOCK, wdt->base + WDTLOCK);
1248 + writel_relaxed(0, wdt->base + WDTCONTROL);
1249 + writel_relaxed(0, wdt->base + WDTLOAD);
1250 + writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL);
1251 +
1252 ++ /* Flush posted writes. */
1253 ++ readl_relaxed(wdt->base + WDTLOCK);
1254 ++
1255 + return 0;
1256 + }
1257 +
1258 +diff --git a/fs/buffer.c b/fs/buffer.c
1259 +index a550e0d8e965..c49fdab5cb36 100644
1260 +--- a/fs/buffer.c
1261 ++++ b/fs/buffer.c
1262 +@@ -1336,6 +1336,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
1263 + }
1264 + EXPORT_SYMBOL(__breadahead);
1265 +
1266 ++void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size,
1267 ++ gfp_t gfp)
1268 ++{
1269 ++ struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
1270 ++ if (likely(bh)) {
1271 ++ ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh);
1272 ++ brelse(bh);
1273 ++ }
1274 ++}
1275 ++EXPORT_SYMBOL(__breadahead_gfp);
1276 ++
1277 + /**
1278 + * __bread_gfp() - reads a specified block and returns the bh
1279 + * @bdev: the block_device to read from
1280 +diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
1281 +index 0c4df56c825a..70412944b267 100644
1282 +--- a/fs/cifs/transport.c
1283 ++++ b/fs/cifs/transport.c
1284 +@@ -392,7 +392,7 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
1285 + struct smb_rqst *rqst, int flags)
1286 + {
1287 + struct kvec iov;
1288 +- struct smb2_transform_hdr tr_hdr;
1289 ++ struct smb2_transform_hdr *tr_hdr;
1290 + struct smb_rqst cur_rqst[MAX_COMPOUND];
1291 + int rc;
1292 +
1293 +@@ -402,28 +402,34 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
1294 + if (num_rqst > MAX_COMPOUND - 1)
1295 + return -ENOMEM;
1296 +
1297 +- memset(&cur_rqst[0], 0, sizeof(cur_rqst));
1298 +- memset(&iov, 0, sizeof(iov));
1299 +- memset(&tr_hdr, 0, sizeof(tr_hdr));
1300 +-
1301 +- iov.iov_base = &tr_hdr;
1302 +- iov.iov_len = sizeof(tr_hdr);
1303 +- cur_rqst[0].rq_iov = &iov;
1304 +- cur_rqst[0].rq_nvec = 1;
1305 +-
1306 + if (!server->ops->init_transform_rq) {
1307 + cifs_dbg(VFS, "Encryption requested but transform callback "
1308 + "is missing\n");
1309 + return -EIO;
1310 + }
1311 +
1312 ++ tr_hdr = kmalloc(sizeof(*tr_hdr), GFP_NOFS);
1313 ++ if (!tr_hdr)
1314 ++ return -ENOMEM;
1315 ++
1316 ++ memset(&cur_rqst[0], 0, sizeof(cur_rqst));
1317 ++ memset(&iov, 0, sizeof(iov));
1318 ++ memset(tr_hdr, 0, sizeof(*tr_hdr));
1319 ++
1320 ++ iov.iov_base = tr_hdr;
1321 ++ iov.iov_len = sizeof(*tr_hdr);
1322 ++ cur_rqst[0].rq_iov = &iov;
1323 ++ cur_rqst[0].rq_nvec = 1;
1324 ++
1325 + rc = server->ops->init_transform_rq(server, num_rqst + 1,
1326 + &cur_rqst[0], rqst);
1327 + if (rc)
1328 +- return rc;
1329 ++ goto out;
1330 +
1331 + rc = __smb_send_rqst(server, num_rqst + 1, &cur_rqst[0]);
1332 + smb3_free_compound_rqst(num_rqst, &cur_rqst[1]);
1333 ++out:
1334 ++ kfree(tr_hdr);
1335 + return rc;
1336 + }
1337 +
1338 +diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
1339 +index dd8f10db82e9..bd1d68ff3a9f 100644
1340 +--- a/fs/ext2/xattr.c
1341 ++++ b/fs/ext2/xattr.c
1342 +@@ -56,6 +56,7 @@
1343 +
1344 + #include <linux/buffer_head.h>
1345 + #include <linux/init.h>
1346 ++#include <linux/printk.h>
1347 + #include <linux/slab.h>
1348 + #include <linux/mbcache.h>
1349 + #include <linux/quotaops.h>
1350 +@@ -84,8 +85,8 @@
1351 + printk("\n"); \
1352 + } while (0)
1353 + #else
1354 +-# define ea_idebug(f...)
1355 +-# define ea_bdebug(f...)
1356 ++# define ea_idebug(inode, f...) no_printk(f)
1357 ++# define ea_bdebug(bh, f...) no_printk(f)
1358 + #endif
1359 +
1360 + static int ext2_xattr_set2(struct inode *, struct buffer_head *,
1361 +@@ -838,8 +839,7 @@ ext2_xattr_cache_insert(struct mb_cache *cache, struct buffer_head *bh)
1362 + error = mb_cache_entry_create(cache, GFP_NOFS, hash, bh->b_blocknr, 1);
1363 + if (error) {
1364 + if (error == -EBUSY) {
1365 +- ea_bdebug(bh, "already in cache (%d cache entries)",
1366 +- atomic_read(&ext2_xattr_cache->c_entry_count));
1367 ++ ea_bdebug(bh, "already in cache");
1368 + error = 0;
1369 + }
1370 + } else
1371 +diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1372 +index 56218c79a856..000fa0e39278 100644
1373 +--- a/fs/ext4/inode.c
1374 ++++ b/fs/ext4/inode.c
1375 +@@ -4690,7 +4690,7 @@ make_io:
1376 + if (end > table)
1377 + end = table;
1378 + while (b <= end)
1379 +- sb_breadahead(sb, b++);
1380 ++ sb_breadahead_unmovable(sb, b++);
1381 + }
1382 +
1383 + /*
1384 +diff --git a/fs/ext4/super.c b/fs/ext4/super.c
1385 +index c76962eba5dd..bf949fcc970a 100644
1386 +--- a/fs/ext4/super.c
1387 ++++ b/fs/ext4/super.c
1388 +@@ -388,7 +388,8 @@ static void save_error_info(struct super_block *sb, const char *func,
1389 + unsigned int line)
1390 + {
1391 + __save_error_info(sb, func, line);
1392 +- ext4_commit_super(sb, 1);
1393 ++ if (!bdev_read_only(sb->s_bdev))
1394 ++ ext4_commit_super(sb, 1);
1395 + }
1396 +
1397 + /*
1398 +@@ -4207,7 +4208,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
1399 + /* Pre-read the descriptors into the buffer cache */
1400 + for (i = 0; i < db_count; i++) {
1401 + block = descriptor_loc(sb, logical_sb_block, i);
1402 +- sb_breadahead(sb, block);
1403 ++ sb_breadahead_unmovable(sb, block);
1404 + }
1405 +
1406 + for (i = 0; i < db_count; i++) {
1407 +diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
1408 +index e5d474681471..f0714c1258c7 100644
1409 +--- a/fs/f2fs/node.c
1410 ++++ b/fs/f2fs/node.c
1411 +@@ -1559,15 +1559,16 @@ static int __write_node_page(struct page *page, bool atomic, bool *submitted,
1412 + if (atomic && !test_opt(sbi, NOBARRIER))
1413 + fio.op_flags |= REQ_PREFLUSH | REQ_FUA;
1414 +
1415 +- set_page_writeback(page);
1416 +- ClearPageError(page);
1417 +-
1418 ++ /* should add to global list before clearing PAGECACHE status */
1419 + if (f2fs_in_warm_node_list(sbi, page)) {
1420 + seq = f2fs_add_fsync_node_entry(sbi, page);
1421 + if (seq_id)
1422 + *seq_id = seq;
1423 + }
1424 +
1425 ++ set_page_writeback(page);
1426 ++ ClearPageError(page);
1427 ++
1428 + fio.old_blkaddr = ni.blk_addr;
1429 + f2fs_do_write_node_page(nid, &fio);
1430 + set_node_addr(sbi, &ni, fio.new_blkaddr, is_fsync_dnode(page));
1431 +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
1432 +index da348cf4ff56..45f8f6ec22a5 100644
1433 +--- a/fs/f2fs/super.c
1434 ++++ b/fs/f2fs/super.c
1435 +@@ -1648,6 +1648,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
1436 + int offset = off & (sb->s_blocksize - 1);
1437 + size_t towrite = len;
1438 + struct page *page;
1439 ++ void *fsdata = NULL;
1440 + char *kaddr;
1441 + int err = 0;
1442 + int tocopy;
1443 +@@ -1657,7 +1658,7 @@ static ssize_t f2fs_quota_write(struct super_block *sb, int type,
1444 + towrite);
1445 + retry:
1446 + err = a_ops->write_begin(NULL, mapping, off, tocopy, 0,
1447 +- &page, NULL);
1448 ++ &page, &fsdata);
1449 + if (unlikely(err)) {
1450 + if (err == -ENOMEM) {
1451 + congestion_wait(BLK_RW_ASYNC, HZ/50);
1452 +@@ -1672,7 +1673,7 @@ retry:
1453 + flush_dcache_page(page);
1454 +
1455 + a_ops->write_end(NULL, mapping, off, tocopy, tocopy,
1456 +- page, NULL);
1457 ++ page, fsdata);
1458 + offset = 0;
1459 + towrite -= tocopy;
1460 + off += tocopy;
1461 +diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
1462 +index 315967354954..bcc51f131a49 100644
1463 +--- a/fs/nfs/callback_proc.c
1464 ++++ b/fs/nfs/callback_proc.c
1465 +@@ -130,6 +130,8 @@ static struct inode *nfs_layout_find_inode_by_stateid(struct nfs_client *clp,
1466 +
1467 + list_for_each_entry_rcu(server, &clp->cl_superblocks, client_link) {
1468 + list_for_each_entry(lo, &server->layouts, plh_layouts) {
1469 ++ if (!pnfs_layout_is_valid(lo))
1470 ++ continue;
1471 + if (stateid != NULL &&
1472 + !nfs4_stateid_match_other(stateid, &lo->plh_stateid))
1473 + continue;
1474 +diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
1475 +index c61bd3fc723e..e5da9d7fb69e 100644
1476 +--- a/fs/nfs/direct.c
1477 ++++ b/fs/nfs/direct.c
1478 +@@ -600,6 +600,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter)
1479 + l_ctx = nfs_get_lock_context(dreq->ctx);
1480 + if (IS_ERR(l_ctx)) {
1481 + result = PTR_ERR(l_ctx);
1482 ++ nfs_direct_req_release(dreq);
1483 + goto out_release;
1484 + }
1485 + dreq->l_ctx = l_ctx;
1486 +@@ -1023,6 +1024,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter)
1487 + l_ctx = nfs_get_lock_context(dreq->ctx);
1488 + if (IS_ERR(l_ctx)) {
1489 + result = PTR_ERR(l_ctx);
1490 ++ nfs_direct_req_release(dreq);
1491 + goto out_release;
1492 + }
1493 + dreq->l_ctx = l_ctx;
1494 +diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
1495 +index 9cf59e2622f8..5dae7c85d9b6 100644
1496 +--- a/fs/nfs/pagelist.c
1497 ++++ b/fs/nfs/pagelist.c
1498 +@@ -865,15 +865,6 @@ static void nfs_pageio_setup_mirroring(struct nfs_pageio_descriptor *pgio,
1499 + pgio->pg_mirror_count = mirror_count;
1500 + }
1501 +
1502 +-/*
1503 +- * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1)
1504 +- */
1505 +-void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio)
1506 +-{
1507 +- pgio->pg_mirror_count = 1;
1508 +- pgio->pg_mirror_idx = 0;
1509 +-}
1510 +-
1511 + static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio)
1512 + {
1513 + pgio->pg_mirror_count = 1;
1514 +@@ -1302,6 +1293,14 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
1515 + }
1516 + }
1517 +
1518 ++/*
1519 ++ * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1)
1520 ++ */
1521 ++void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio)
1522 ++{
1523 ++ nfs_pageio_complete(pgio);
1524 ++}
1525 ++
1526 + int __init nfs_init_nfspagecache(void)
1527 + {
1528 + nfs_page_cachep = kmem_cache_create("nfs_page",
1529 +diff --git a/include/acpi/processor.h b/include/acpi/processor.h
1530 +index 1194a4c78d55..5b9eab15a1e6 100644
1531 +--- a/include/acpi/processor.h
1532 ++++ b/include/acpi/processor.h
1533 +@@ -293,6 +293,14 @@ static inline void acpi_processor_ffh_cstate_enter(struct acpi_processor_cx
1534 + }
1535 + #endif
1536 +
1537 ++static inline int call_on_cpu(int cpu, long (*fn)(void *), void *arg,
1538 ++ bool direct)
1539 ++{
1540 ++ if (direct || (is_percpu_thread() && cpu == smp_processor_id()))
1541 ++ return fn(arg);
1542 ++ return work_on_cpu(cpu, fn, arg);
1543 ++}
1544 ++
1545 + /* in processor_perflib.c */
1546 +
1547 + #ifdef CONFIG_CPU_FREQ
1548 +diff --git a/include/keys/big_key-type.h b/include/keys/big_key-type.h
1549 +index e0970a578188..a7207a965466 100644
1550 +--- a/include/keys/big_key-type.h
1551 ++++ b/include/keys/big_key-type.h
1552 +@@ -21,6 +21,6 @@ extern void big_key_free_preparse(struct key_preparsed_payload *prep);
1553 + extern void big_key_revoke(struct key *key);
1554 + extern void big_key_destroy(struct key *key);
1555 + extern void big_key_describe(const struct key *big_key, struct seq_file *m);
1556 +-extern long big_key_read(const struct key *key, char __user *buffer, size_t buflen);
1557 ++extern long big_key_read(const struct key *key, char *buffer, size_t buflen);
1558 +
1559 + #endif /* _KEYS_BIG_KEY_TYPE_H */
1560 +diff --git a/include/keys/user-type.h b/include/keys/user-type.h
1561 +index 12babe991594..0d8f3cd3056f 100644
1562 +--- a/include/keys/user-type.h
1563 ++++ b/include/keys/user-type.h
1564 +@@ -45,8 +45,7 @@ extern int user_update(struct key *key, struct key_preparsed_payload *prep);
1565 + extern void user_revoke(struct key *key);
1566 + extern void user_destroy(struct key *key);
1567 + extern void user_describe(const struct key *user, struct seq_file *m);
1568 +-extern long user_read(const struct key *key,
1569 +- char __user *buffer, size_t buflen);
1570 ++extern long user_read(const struct key *key, char *buffer, size_t buflen);
1571 +
1572 + static inline const struct user_key_payload *user_key_payload_rcu(const struct key *key)
1573 + {
1574 +diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
1575 +index 96225a77c112..9168fc33a4f7 100644
1576 +--- a/include/linux/buffer_head.h
1577 ++++ b/include/linux/buffer_head.h
1578 +@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
1579 + void __brelse(struct buffer_head *);
1580 + void __bforget(struct buffer_head *);
1581 + void __breadahead(struct block_device *, sector_t block, unsigned int size);
1582 ++void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size,
1583 ++ gfp_t gfp);
1584 + struct buffer_head *__bread_gfp(struct block_device *,
1585 + sector_t block, unsigned size, gfp_t gfp);
1586 + void invalidate_bh_lrus(void);
1587 +@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block)
1588 + __breadahead(sb->s_bdev, block, sb->s_blocksize);
1589 + }
1590 +
1591 ++static inline void
1592 ++sb_breadahead_unmovable(struct super_block *sb, sector_t block)
1593 ++{
1594 ++ __breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
1595 ++}
1596 ++
1597 + static inline struct buffer_head *
1598 + sb_getblk(struct super_block *sb, sector_t block)
1599 + {
1600 +diff --git a/include/linux/compiler.h b/include/linux/compiler.h
1601 +index bb22908c79e8..75112aa8064e 100644
1602 +--- a/include/linux/compiler.h
1603 ++++ b/include/linux/compiler.h
1604 +@@ -345,7 +345,7 @@ static inline void *offset_to_ptr(const int *off)
1605 + * compiler has support to do so.
1606 + */
1607 + #define compiletime_assert(condition, msg) \
1608 +- _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
1609 ++ _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
1610 +
1611 + #define compiletime_assert_atomic_type(t) \
1612 + compiletime_assert(__native_word(t), \
1613 +diff --git a/include/linux/key-type.h b/include/linux/key-type.h
1614 +index d3c5ae8ad498..3341ddac2348 100644
1615 +--- a/include/linux/key-type.h
1616 ++++ b/include/linux/key-type.h
1617 +@@ -125,7 +125,7 @@ struct key_type {
1618 + * much is copied into the buffer
1619 + * - shouldn't do the copy if the buffer is NULL
1620 + */
1621 +- long (*read)(const struct key *key, char __user *buffer, size_t buflen);
1622 ++ long (*read)(const struct key *key, char *buffer, size_t buflen);
1623 +
1624 + /* handle request_key() for this type instead of invoking
1625 + * /sbin/request-key (optional)
1626 +diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h
1627 +index 4f052496cdfd..0a4f54dd4737 100644
1628 +--- a/include/linux/percpu_counter.h
1629 ++++ b/include/linux/percpu_counter.h
1630 +@@ -78,9 +78,9 @@ static inline s64 percpu_counter_read(struct percpu_counter *fbc)
1631 + */
1632 + static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc)
1633 + {
1634 +- s64 ret = fbc->count;
1635 ++ /* Prevent reloads of fbc->count */
1636 ++ s64 ret = READ_ONCE(fbc->count);
1637 +
1638 +- barrier(); /* Prevent reloads of fbc->count */
1639 + if (ret >= 0)
1640 + return ret;
1641 + return 0;
1642 +diff --git a/include/linux/swapops.h b/include/linux/swapops.h
1643 +index 22af9d8a84ae..28d572b7ea73 100644
1644 +--- a/include/linux/swapops.h
1645 ++++ b/include/linux/swapops.h
1646 +@@ -368,7 +368,8 @@ static inline void num_poisoned_pages_inc(void)
1647 + }
1648 + #endif
1649 +
1650 +-#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
1651 ++#if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION) || \
1652 ++ defined(CONFIG_DEVICE_PRIVATE)
1653 + static inline int non_swap_entry(swp_entry_t entry)
1654 + {
1655 + return swp_type(entry) >= MAX_SWAPFILES;
1656 +diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
1657 +index e85636fb81b9..daf0a9637d73 100644
1658 +--- a/kernel/bpf/verifier.c
1659 ++++ b/kernel/bpf/verifier.c
1660 +@@ -188,8 +188,7 @@ struct bpf_call_arg_meta {
1661 + bool pkt_access;
1662 + int regno;
1663 + int access_size;
1664 +- s64 msize_smax_value;
1665 +- u64 msize_umax_value;
1666 ++ u64 msize_max_value;
1667 + };
1668 +
1669 + static DEFINE_MUTEX(bpf_verifier_lock);
1670 +@@ -2076,8 +2075,7 @@ static int check_func_arg(struct bpf_verifier_env *env, u32 regno,
1671 + /* remember the mem_size which may be used later
1672 + * to refine return values.
1673 + */
1674 +- meta->msize_smax_value = reg->smax_value;
1675 +- meta->msize_umax_value = reg->umax_value;
1676 ++ meta->msize_max_value = reg->umax_value;
1677 +
1678 + /* The register is SCALAR_VALUE; the access check
1679 + * happens using its boundaries.
1680 +@@ -2448,21 +2446,44 @@ static int prepare_func_exit(struct bpf_verifier_env *env, int *insn_idx)
1681 + return 0;
1682 + }
1683 +
1684 +-static void do_refine_retval_range(struct bpf_reg_state *regs, int ret_type,
1685 +- int func_id,
1686 +- struct bpf_call_arg_meta *meta)
1687 ++static int do_refine_retval_range(struct bpf_verifier_env *env,
1688 ++ struct bpf_reg_state *regs, int ret_type,
1689 ++ int func_id, struct bpf_call_arg_meta *meta)
1690 + {
1691 + struct bpf_reg_state *ret_reg = &regs[BPF_REG_0];
1692 ++ struct bpf_reg_state tmp_reg = *ret_reg;
1693 ++ bool ret;
1694 +
1695 + if (ret_type != RET_INTEGER ||
1696 + (func_id != BPF_FUNC_get_stack &&
1697 + func_id != BPF_FUNC_probe_read_str))
1698 +- return;
1699 ++ return 0;
1700 ++
1701 ++ /* Error case where ret is in interval [S32MIN, -1]. */
1702 ++ ret_reg->smin_value = S32_MIN;
1703 ++ ret_reg->smax_value = -1;
1704 ++
1705 ++ __reg_deduce_bounds(ret_reg);
1706 ++ __reg_bound_offset(ret_reg);
1707 ++ __update_reg_bounds(ret_reg);
1708 ++
1709 ++ ret = push_stack(env, env->insn_idx + 1, env->insn_idx, false);
1710 ++ if (!ret)
1711 ++ return -EFAULT;
1712 ++
1713 ++ *ret_reg = tmp_reg;
1714 ++
1715 ++ /* Success case where ret is in range [0, msize_max_value]. */
1716 ++ ret_reg->smin_value = 0;
1717 ++ ret_reg->smax_value = meta->msize_max_value;
1718 ++ ret_reg->umin_value = ret_reg->smin_value;
1719 ++ ret_reg->umax_value = ret_reg->smax_value;
1720 +
1721 +- ret_reg->smax_value = meta->msize_smax_value;
1722 +- ret_reg->umax_value = meta->msize_umax_value;
1723 + __reg_deduce_bounds(ret_reg);
1724 + __reg_bound_offset(ret_reg);
1725 ++ __update_reg_bounds(ret_reg);
1726 ++
1727 ++ return 0;
1728 + }
1729 +
1730 + static int
1731 +@@ -2617,7 +2638,9 @@ static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn
1732 + return -EINVAL;
1733 + }
1734 +
1735 +- do_refine_retval_range(regs, fn->ret_type, func_id, &meta);
1736 ++ err = do_refine_retval_range(env, regs, fn->ret_type, func_id, &meta);
1737 ++ if (err)
1738 ++ return err;
1739 +
1740 + err = check_map_func_compatibility(env, meta.map_ptr, func_id);
1741 + if (err)
1742 +diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
1743 +index 7d0b0ed74404..95395ef5922a 100644
1744 +--- a/kernel/locking/locktorture.c
1745 ++++ b/kernel/locking/locktorture.c
1746 +@@ -710,10 +710,10 @@ static void __torture_print_stats(char *page,
1747 + if (statp[i].n_lock_fail)
1748 + fail = true;
1749 + sum += statp[i].n_lock_acquired;
1750 +- if (max < statp[i].n_lock_fail)
1751 +- max = statp[i].n_lock_fail;
1752 +- if (min > statp[i].n_lock_fail)
1753 +- min = statp[i].n_lock_fail;
1754 ++ if (max < statp[i].n_lock_acquired)
1755 ++ max = statp[i].n_lock_acquired;
1756 ++ if (min > statp[i].n_lock_acquired)
1757 ++ min = statp[i].n_lock_acquired;
1758 + }
1759 + page += sprintf(page,
1760 + "%s: Total: %lld Max/Min: %ld/%ld %s Fail: %d %s\n",
1761 +diff --git a/lib/raid6/neon.uc b/lib/raid6/neon.uc
1762 +index d5242f544551..b7c68030da4f 100644
1763 +--- a/lib/raid6/neon.uc
1764 ++++ b/lib/raid6/neon.uc
1765 +@@ -28,7 +28,6 @@
1766 +
1767 + typedef uint8x16_t unative_t;
1768 +
1769 +-#define NBYTES(x) ((unative_t){x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x})
1770 + #define NSIZE sizeof(unative_t)
1771 +
1772 + /*
1773 +@@ -61,7 +60,7 @@ void raid6_neon$#_gen_syndrome_real(int disks, unsigned long bytes, void **ptrs)
1774 + int d, z, z0;
1775 +
1776 + register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
1777 +- const unative_t x1d = NBYTES(0x1d);
1778 ++ const unative_t x1d = vdupq_n_u8(0x1d);
1779 +
1780 + z0 = disks - 3; /* Highest data disk */
1781 + p = dptr[z0+1]; /* XOR parity */
1782 +@@ -92,7 +91,7 @@ void raid6_neon$#_xor_syndrome_real(int disks, int start, int stop,
1783 + int d, z, z0;
1784 +
1785 + register unative_t wd$$, wq$$, wp$$, w1$$, w2$$;
1786 +- const unative_t x1d = NBYTES(0x1d);
1787 ++ const unative_t x1d = vdupq_n_u8(0x1d);
1788 +
1789 + z0 = stop; /* P/Q right side optimization */
1790 + p = dptr[disks-2]; /* XOR parity */
1791 +diff --git a/lib/raid6/recov_neon_inner.c b/lib/raid6/recov_neon_inner.c
1792 +index 8cd20c9f834a..7d00c31a6547 100644
1793 +--- a/lib/raid6/recov_neon_inner.c
1794 ++++ b/lib/raid6/recov_neon_inner.c
1795 +@@ -10,11 +10,6 @@
1796 +
1797 + #include <arm_neon.h>
1798 +
1799 +-static const uint8x16_t x0f = {
1800 +- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
1801 +- 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
1802 +-};
1803 +-
1804 + #ifdef CONFIG_ARM
1805 + /*
1806 + * AArch32 does not provide this intrinsic natively because it does not
1807 +@@ -41,6 +36,7 @@ void __raid6_2data_recov_neon(int bytes, uint8_t *p, uint8_t *q, uint8_t *dp,
1808 + uint8x16_t pm1 = vld1q_u8(pbmul + 16);
1809 + uint8x16_t qm0 = vld1q_u8(qmul);
1810 + uint8x16_t qm1 = vld1q_u8(qmul + 16);
1811 ++ uint8x16_t x0f = vdupq_n_u8(0x0f);
1812 +
1813 + /*
1814 + * while ( bytes-- ) {
1815 +@@ -87,6 +83,7 @@ void __raid6_datap_recov_neon(int bytes, uint8_t *p, uint8_t *q, uint8_t *dq,
1816 + {
1817 + uint8x16_t qm0 = vld1q_u8(qmul);
1818 + uint8x16_t qm1 = vld1q_u8(qmul + 16);
1819 ++ uint8x16_t x0f = vdupq_n_u8(0x0f);
1820 +
1821 + /*
1822 + * while (bytes--) {
1823 +diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c
1824 +index 7f4534828f6c..a0494206cfda 100644
1825 +--- a/net/dns_resolver/dns_key.c
1826 ++++ b/net/dns_resolver/dns_key.c
1827 +@@ -241,7 +241,7 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m)
1828 + * - the key's semaphore is read-locked
1829 + */
1830 + static long dns_resolver_read(const struct key *key,
1831 +- char __user *buffer, size_t buflen)
1832 ++ char *buffer, size_t buflen)
1833 + {
1834 + int err = PTR_ERR(key->payload.data[dns_key_error]);
1835 +
1836 +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
1837 +index 5881f6668817..1b8a53081632 100644
1838 +--- a/net/netfilter/nf_tables_api.c
1839 ++++ b/net/netfilter/nf_tables_api.c
1840 +@@ -3450,7 +3450,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
1841 + NFT_SET_INTERVAL | NFT_SET_TIMEOUT |
1842 + NFT_SET_MAP | NFT_SET_EVAL |
1843 + NFT_SET_OBJECT))
1844 +- return -EINVAL;
1845 ++ return -EOPNOTSUPP;
1846 + /* Only one of these operations is supported */
1847 + if ((flags & (NFT_SET_MAP | NFT_SET_OBJECT)) ==
1848 + (NFT_SET_MAP | NFT_SET_OBJECT))
1849 +@@ -3488,7 +3488,7 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
1850 + objtype = ntohl(nla_get_be32(nla[NFTA_SET_OBJ_TYPE]));
1851 + if (objtype == NFT_OBJECT_UNSPEC ||
1852 + objtype > NFT_OBJECT_MAX)
1853 +- return -EINVAL;
1854 ++ return -EOPNOTSUPP;
1855 + } else if (flags & NFT_SET_OBJECT)
1856 + return -EINVAL;
1857 + else
1858 +diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c
1859 +index e7f6b8823eb6..ad9d1b21cb0b 100644
1860 +--- a/net/rxrpc/key.c
1861 ++++ b/net/rxrpc/key.c
1862 +@@ -35,7 +35,7 @@ static void rxrpc_free_preparse_s(struct key_preparsed_payload *);
1863 + static void rxrpc_destroy(struct key *);
1864 + static void rxrpc_destroy_s(struct key *);
1865 + static void rxrpc_describe(const struct key *, struct seq_file *);
1866 +-static long rxrpc_read(const struct key *, char __user *, size_t);
1867 ++static long rxrpc_read(const struct key *, char *, size_t);
1868 +
1869 + /*
1870 + * rxrpc defined keys take an arbitrary string as the description and an
1871 +@@ -1044,12 +1044,12 @@ EXPORT_SYMBOL(rxrpc_get_null_key);
1872 + * - this returns the result in XDR form
1873 + */
1874 + static long rxrpc_read(const struct key *key,
1875 +- char __user *buffer, size_t buflen)
1876 ++ char *buffer, size_t buflen)
1877 + {
1878 + const struct rxrpc_key_token *token;
1879 + const struct krb5_principal *princ;
1880 + size_t size;
1881 +- __be32 __user *xdr, *oldxdr;
1882 ++ __be32 *xdr, *oldxdr;
1883 + u32 cnlen, toksize, ntoks, tok, zero;
1884 + u16 toksizes[AFSTOKEN_MAX];
1885 + int loop;
1886 +@@ -1126,30 +1126,25 @@ static long rxrpc_read(const struct key *key,
1887 + if (!buffer || buflen < size)
1888 + return size;
1889 +
1890 +- xdr = (__be32 __user *) buffer;
1891 ++ xdr = (__be32 *)buffer;
1892 + zero = 0;
1893 + #define ENCODE(x) \
1894 + do { \
1895 +- __be32 y = htonl(x); \
1896 +- if (put_user(y, xdr++) < 0) \
1897 +- goto fault; \
1898 ++ *xdr++ = htonl(x); \
1899 + } while(0)
1900 + #define ENCODE_DATA(l, s) \
1901 + do { \
1902 + u32 _l = (l); \
1903 + ENCODE(l); \
1904 +- if (copy_to_user(xdr, (s), _l) != 0) \
1905 +- goto fault; \
1906 +- if (_l & 3 && \
1907 +- copy_to_user((u8 __user *)xdr + _l, &zero, 4 - (_l & 3)) != 0) \
1908 +- goto fault; \
1909 ++ memcpy(xdr, (s), _l); \
1910 ++ if (_l & 3) \
1911 ++ memcpy((u8 *)xdr + _l, &zero, 4 - (_l & 3)); \
1912 + xdr += (_l + 3) >> 2; \
1913 + } while(0)
1914 + #define ENCODE64(x) \
1915 + do { \
1916 + __be64 y = cpu_to_be64(x); \
1917 +- if (copy_to_user(xdr, &y, 8) != 0) \
1918 +- goto fault; \
1919 ++ memcpy(xdr, &y, 8); \
1920 + xdr += 8 >> 2; \
1921 + } while(0)
1922 + #define ENCODE_STR(s) \
1923 +@@ -1240,8 +1235,4 @@ static long rxrpc_read(const struct key *key,
1924 + ASSERTCMP((char __user *) xdr - buffer, ==, size);
1925 + _leave(" = %zu", size);
1926 + return size;
1927 +-
1928 +-fault:
1929 +- _leave(" = -EFAULT");
1930 +- return -EFAULT;
1931 + }
1932 +diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
1933 +index 556a649512b6..706fad12f22c 100644
1934 +--- a/net/xdp/xdp_umem.c
1935 ++++ b/net/xdp/xdp_umem.c
1936 +@@ -260,7 +260,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
1937 + u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
1938 + unsigned int chunks, chunks_per_page;
1939 + u64 addr = mr->addr, size = mr->len;
1940 +- int size_chk, err, i;
1941 ++ int err, i;
1942 +
1943 + if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
1944 + /* Strictly speaking we could support this, if:
1945 +@@ -295,8 +295,7 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
1946 +
1947 + headroom = ALIGN(headroom, 64);
1948 +
1949 +- size_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;
1950 +- if (size_chk < 0)
1951 ++ if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
1952 + return -EINVAL;
1953 +
1954 + umem->address = (unsigned long)addr;
1955 +diff --git a/security/keys/big_key.c b/security/keys/big_key.c
1956 +index 2806e70d7f8f..630594a5b46e 100644
1957 +--- a/security/keys/big_key.c
1958 ++++ b/security/keys/big_key.c
1959 +@@ -356,7 +356,7 @@ void big_key_describe(const struct key *key, struct seq_file *m)
1960 + * read the key data
1961 + * - the key's semaphore is read-locked
1962 + */
1963 +-long big_key_read(const struct key *key, char __user *buffer, size_t buflen)
1964 ++long big_key_read(const struct key *key, char *buffer, size_t buflen)
1965 + {
1966 + size_t datalen = (size_t)key->payload.data[big_key_len];
1967 + long ret;
1968 +@@ -395,9 +395,8 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen)
1969 +
1970 + ret = datalen;
1971 +
1972 +- /* copy decrypted data to user */
1973 +- if (copy_to_user(buffer, buf->virt, datalen) != 0)
1974 +- ret = -EFAULT;
1975 ++ /* copy out decrypted data */
1976 ++ memcpy(buffer, buf->virt, datalen);
1977 +
1978 + err_fput:
1979 + fput(file);
1980 +@@ -405,9 +404,7 @@ error:
1981 + big_key_free_buffer(buf);
1982 + } else {
1983 + ret = datalen;
1984 +- if (copy_to_user(buffer, key->payload.data[big_key_data],
1985 +- datalen) != 0)
1986 +- ret = -EFAULT;
1987 ++ memcpy(buffer, key->payload.data[big_key_data], datalen);
1988 + }
1989 +
1990 + return ret;
1991 +diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c
1992 +index d92cbf9687c3..571f6d486838 100644
1993 +--- a/security/keys/encrypted-keys/encrypted.c
1994 ++++ b/security/keys/encrypted-keys/encrypted.c
1995 +@@ -895,14 +895,14 @@ out:
1996 + }
1997 +
1998 + /*
1999 +- * encrypted_read - format and copy the encrypted data to userspace
2000 ++ * encrypted_read - format and copy out the encrypted data
2001 + *
2002 + * The resulting datablob format is:
2003 + * <master-key name> <decrypted data length> <encrypted iv> <encrypted data>
2004 + *
2005 + * On success, return to userspace the encrypted key datablob size.
2006 + */
2007 +-static long encrypted_read(const struct key *key, char __user *buffer,
2008 ++static long encrypted_read(const struct key *key, char *buffer,
2009 + size_t buflen)
2010 + {
2011 + struct encrypted_key_payload *epayload;
2012 +@@ -950,8 +950,7 @@ static long encrypted_read(const struct key *key, char __user *buffer,
2013 + key_put(mkey);
2014 + memzero_explicit(derived_key, sizeof(derived_key));
2015 +
2016 +- if (copy_to_user(buffer, ascii_buf, asciiblob_len) != 0)
2017 +- ret = -EFAULT;
2018 ++ memcpy(buffer, ascii_buf, asciiblob_len);
2019 + kzfree(ascii_buf);
2020 +
2021 + return asciiblob_len;
2022 +diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
2023 +index e00e20204de0..4b6a084e323b 100644
2024 +--- a/security/keys/keyctl.c
2025 ++++ b/security/keys/keyctl.c
2026 +@@ -742,6 +742,21 @@ error:
2027 + return ret;
2028 + }
2029 +
2030 ++/*
2031 ++ * Call the read method
2032 ++ */
2033 ++static long __keyctl_read_key(struct key *key, char *buffer, size_t buflen)
2034 ++{
2035 ++ long ret;
2036 ++
2037 ++ down_read(&key->sem);
2038 ++ ret = key_validate(key);
2039 ++ if (ret == 0)
2040 ++ ret = key->type->read(key, buffer, buflen);
2041 ++ up_read(&key->sem);
2042 ++ return ret;
2043 ++}
2044 ++
2045 + /*
2046 + * Read a key's payload.
2047 + *
2048 +@@ -757,26 +772,27 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
2049 + struct key *key;
2050 + key_ref_t key_ref;
2051 + long ret;
2052 ++ char *key_data;
2053 +
2054 + /* find the key first */
2055 + key_ref = lookup_user_key(keyid, 0, 0);
2056 + if (IS_ERR(key_ref)) {
2057 + ret = -ENOKEY;
2058 +- goto error;
2059 ++ goto out;
2060 + }
2061 +
2062 + key = key_ref_to_ptr(key_ref);
2063 +
2064 + ret = key_read_state(key);
2065 + if (ret < 0)
2066 +- goto error2; /* Negatively instantiated */
2067 ++ goto key_put_out; /* Negatively instantiated */
2068 +
2069 + /* see if we can read it directly */
2070 + ret = key_permission(key_ref, KEY_NEED_READ);
2071 + if (ret == 0)
2072 + goto can_read_key;
2073 + if (ret != -EACCES)
2074 +- goto error2;
2075 ++ goto key_put_out;
2076 +
2077 + /* we can't; see if it's searchable from this process's keyrings
2078 + * - we automatically take account of the fact that it may be
2079 +@@ -784,26 +800,51 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
2080 + */
2081 + if (!is_key_possessed(key_ref)) {
2082 + ret = -EACCES;
2083 +- goto error2;
2084 ++ goto key_put_out;
2085 + }
2086 +
2087 + /* the key is probably readable - now try to read it */
2088 + can_read_key:
2089 +- ret = -EOPNOTSUPP;
2090 +- if (key->type->read) {
2091 +- /* Read the data with the semaphore held (since we might sleep)
2092 +- * to protect against the key being updated or revoked.
2093 +- */
2094 +- down_read(&key->sem);
2095 +- ret = key_validate(key);
2096 +- if (ret == 0)
2097 +- ret = key->type->read(key, buffer, buflen);
2098 +- up_read(&key->sem);
2099 ++ if (!key->type->read) {
2100 ++ ret = -EOPNOTSUPP;
2101 ++ goto key_put_out;
2102 + }
2103 +
2104 +-error2:
2105 ++ if (!buffer || !buflen) {
2106 ++ /* Get the key length from the read method */
2107 ++ ret = __keyctl_read_key(key, NULL, 0);
2108 ++ goto key_put_out;
2109 ++ }
2110 ++
2111 ++ /*
2112 ++ * Read the data with the semaphore held (since we might sleep)
2113 ++ * to protect against the key being updated or revoked.
2114 ++ *
2115 ++ * Allocating a temporary buffer to hold the keys before
2116 ++ * transferring them to user buffer to avoid potential
2117 ++ * deadlock involving page fault and mmap_sem.
2118 ++ */
2119 ++ key_data = kmalloc(buflen, GFP_KERNEL);
2120 ++
2121 ++ if (!key_data) {
2122 ++ ret = -ENOMEM;
2123 ++ goto key_put_out;
2124 ++ }
2125 ++ ret = __keyctl_read_key(key, key_data, buflen);
2126 ++
2127 ++ /*
2128 ++ * Read methods will just return the required length without
2129 ++ * any copying if the provided length isn't large enough.
2130 ++ */
2131 ++ if (ret > 0 && ret <= buflen) {
2132 ++ if (copy_to_user(buffer, key_data, ret))
2133 ++ ret = -EFAULT;
2134 ++ }
2135 ++ kzfree(key_data);
2136 ++
2137 ++key_put_out:
2138 + key_put(key);
2139 +-error:
2140 ++out:
2141 + return ret;
2142 + }
2143 +
2144 +diff --git a/security/keys/keyring.c b/security/keys/keyring.c
2145 +index 99a55145ddcd..e8f2366021ea 100644
2146 +--- a/security/keys/keyring.c
2147 ++++ b/security/keys/keyring.c
2148 +@@ -432,7 +432,6 @@ static int keyring_read_iterator(const void *object, void *data)
2149 + {
2150 + struct keyring_read_iterator_context *ctx = data;
2151 + const struct key *key = keyring_ptr_to_key(object);
2152 +- int ret;
2153 +
2154 + kenter("{%s,%d},,{%zu/%zu}",
2155 + key->type->name, key->serial, ctx->count, ctx->buflen);
2156 +@@ -440,10 +439,7 @@ static int keyring_read_iterator(const void *object, void *data)
2157 + if (ctx->count >= ctx->buflen)
2158 + return 1;
2159 +
2160 +- ret = put_user(key->serial, ctx->buffer);
2161 +- if (ret < 0)
2162 +- return ret;
2163 +- ctx->buffer++;
2164 ++ *ctx->buffer++ = key->serial;
2165 + ctx->count += sizeof(key->serial);
2166 + return 0;
2167 + }
2168 +diff --git a/security/keys/request_key_auth.c b/security/keys/request_key_auth.c
2169 +index 1d34b2a5f485..13ac3b1e57da 100644
2170 +--- a/security/keys/request_key_auth.c
2171 ++++ b/security/keys/request_key_auth.c
2172 +@@ -27,7 +27,7 @@ static int request_key_auth_instantiate(struct key *,
2173 + static void request_key_auth_describe(const struct key *, struct seq_file *);
2174 + static void request_key_auth_revoke(struct key *);
2175 + static void request_key_auth_destroy(struct key *);
2176 +-static long request_key_auth_read(const struct key *, char __user *, size_t);
2177 ++static long request_key_auth_read(const struct key *, char *, size_t);
2178 +
2179 + /*
2180 + * The request-key authorisation key type definition.
2181 +@@ -85,7 +85,7 @@ static void request_key_auth_describe(const struct key *key,
2182 + * - the key's semaphore is read-locked
2183 + */
2184 + static long request_key_auth_read(const struct key *key,
2185 +- char __user *buffer, size_t buflen)
2186 ++ char *buffer, size_t buflen)
2187 + {
2188 + struct request_key_auth *rka = get_request_key_auth(key);
2189 + size_t datalen;
2190 +@@ -102,8 +102,7 @@ static long request_key_auth_read(const struct key *key,
2191 + if (buflen > datalen)
2192 + buflen = datalen;
2193 +
2194 +- if (copy_to_user(buffer, rka->callout_info, buflen) != 0)
2195 +- ret = -EFAULT;
2196 ++ memcpy(buffer, rka->callout_info, buflen);
2197 + }
2198 +
2199 + return ret;
2200 +diff --git a/security/keys/trusted.c b/security/keys/trusted.c
2201 +index b69d3b1777c2..09545c42977e 100644
2202 +--- a/security/keys/trusted.c
2203 ++++ b/security/keys/trusted.c
2204 +@@ -1135,11 +1135,10 @@ out:
2205 + * trusted_read - copy the sealed blob data to userspace in hex.
2206 + * On success, return to userspace the trusted key datablob size.
2207 + */
2208 +-static long trusted_read(const struct key *key, char __user *buffer,
2209 ++static long trusted_read(const struct key *key, char *buffer,
2210 + size_t buflen)
2211 + {
2212 + const struct trusted_key_payload *p;
2213 +- char *ascii_buf;
2214 + char *bufp;
2215 + int i;
2216 +
2217 +@@ -1148,18 +1147,9 @@ static long trusted_read(const struct key *key, char __user *buffer,
2218 + return -EINVAL;
2219 +
2220 + if (buffer && buflen >= 2 * p->blob_len) {
2221 +- ascii_buf = kmalloc_array(2, p->blob_len, GFP_KERNEL);
2222 +- if (!ascii_buf)
2223 +- return -ENOMEM;
2224 +-
2225 +- bufp = ascii_buf;
2226 ++ bufp = buffer;
2227 + for (i = 0; i < p->blob_len; i++)
2228 + bufp = hex_byte_pack(bufp, p->blob[i]);
2229 +- if (copy_to_user(buffer, ascii_buf, 2 * p->blob_len) != 0) {
2230 +- kzfree(ascii_buf);
2231 +- return -EFAULT;
2232 +- }
2233 +- kzfree(ascii_buf);
2234 + }
2235 + return 2 * p->blob_len;
2236 + }
2237 +diff --git a/security/keys/user_defined.c b/security/keys/user_defined.c
2238 +index 9f558bedba23..0e723b676aef 100644
2239 +--- a/security/keys/user_defined.c
2240 ++++ b/security/keys/user_defined.c
2241 +@@ -172,7 +172,7 @@ EXPORT_SYMBOL_GPL(user_describe);
2242 + * read the key data
2243 + * - the key's semaphore is read-locked
2244 + */
2245 +-long user_read(const struct key *key, char __user *buffer, size_t buflen)
2246 ++long user_read(const struct key *key, char *buffer, size_t buflen)
2247 + {
2248 + const struct user_key_payload *upayload;
2249 + long ret;
2250 +@@ -185,8 +185,7 @@ long user_read(const struct key *key, char __user *buffer, size_t buflen)
2251 + if (buflen > upayload->datalen)
2252 + buflen = upayload->datalen;
2253 +
2254 +- if (copy_to_user(buffer, upayload->data, buflen) != 0)
2255 +- ret = -EFAULT;
2256 ++ memcpy(buffer, upayload->data, buflen);
2257 + }
2258 +
2259 + return ret;
2260 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2261 +index a2eeb08fa61d..54a9b391ecce 100644
2262 +--- a/sound/pci/hda/hda_intel.c
2263 ++++ b/sound/pci/hda/hda_intel.c
2264 +@@ -2076,24 +2076,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
2265 + {
2266 + struct snd_card *card = context;
2267 + struct azx *chip = card->private_data;
2268 +- struct pci_dev *pci = chip->pci;
2269 +-
2270 +- if (!fw) {
2271 +- dev_err(card->dev, "Cannot load firmware, aborting\n");
2272 +- goto error;
2273 +- }
2274 +
2275 +- chip->fw = fw;
2276 ++ if (fw)
2277 ++ chip->fw = fw;
2278 ++ else
2279 ++ dev_err(card->dev, "Cannot load firmware, continue without patching\n");
2280 + if (!chip->disabled) {
2281 + /* continue probing */
2282 +- if (azx_probe_continue(chip))
2283 +- goto error;
2284 ++ azx_probe_continue(chip);
2285 + }
2286 +- return; /* OK */
2287 +-
2288 +- error:
2289 +- snd_card_free(card);
2290 +- pci_set_drvdata(pci, NULL);
2291 + }
2292 + #endif
2293 +
2294 +diff --git a/tools/objtool/check.c b/tools/objtool/check.c
2295 +index ecf5fc77f50b..9479c74af9ba 100644
2296 +--- a/tools/objtool/check.c
2297 ++++ b/tools/objtool/check.c
2298 +@@ -938,10 +938,7 @@ static struct rela *find_switch_table(struct objtool_file *file,
2299 + * it.
2300 + */
2301 + for (;
2302 +- &insn->list != &file->insn_list &&
2303 +- insn->sec == func->sec &&
2304 +- insn->offset >= func->offset;
2305 +-
2306 ++ &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func;
2307 + insn = insn->first_jump_src ?: list_prev_entry(insn, list)) {
2308 +
2309 + if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)