Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.9 commit in: /
Date: Wed, 28 Mar 2018 17:42:12
Message-Id: 1522258918.99512109f7de893b8c20fa7adbe2c1d83499b4b6.mpagano@gentoo
1 commit: 99512109f7de893b8c20fa7adbe2c1d83499b4b6
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Mar 28 17:41:58 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Mar 28 17:41:58 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=99512109
7
8 Linux patch 4.9.91
9
10 0000_README | 4 +
11 1090_linux-4.9.91.patch | 2198 +++++++++++++++++++++++++++++++++++++++++++++++
12 2 files changed, 2202 insertions(+)
13
14 diff --git a/0000_README b/0000_README
15 index d488776..9dbda35 100644
16 --- a/0000_README
17 +++ b/0000_README
18 @@ -403,6 +403,10 @@ Patch: 1089_linux-4.9.90.patch
19 From: http://www.kernel.org
20 Desc: Linux 4.9.90
21
22 +Patch: 1090_linux-4.9.91.patch
23 +From: http://www.kernel.org
24 +Desc: Linux 4.9.91
25 +
26 Patch: 1500_XATTR_USER_PREFIX.patch
27 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
28 Desc: Support for namespace user.pax.* on tmpfs.
29
30 diff --git a/1090_linux-4.9.91.patch b/1090_linux-4.9.91.patch
31 new file mode 100644
32 index 0000000..66f0175
33 --- /dev/null
34 +++ b/1090_linux-4.9.91.patch
35 @@ -0,0 +1,2198 @@
36 +diff --git a/Documentation/ABI/testing/sysfs-bus-iio b/Documentation/ABI/testing/sysfs-bus-iio
37 +index fee35c00cc4e..0406076e4405 100644
38 +--- a/Documentation/ABI/testing/sysfs-bus-iio
39 ++++ b/Documentation/ABI/testing/sysfs-bus-iio
40 +@@ -32,7 +32,7 @@ Description:
41 + Description of the physical chip / device for device X.
42 + Typically a part number.
43 +
44 +-What: /sys/bus/iio/devices/iio:deviceX/timestamp_clock
45 ++What: /sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
46 + KernelVersion: 4.5
47 + Contact: linux-iio@×××××××××××.org
48 + Description:
49 +diff --git a/Makefile b/Makefile
50 +index df3b20af0fdb..db3d37e18723 100644
51 +--- a/Makefile
52 ++++ b/Makefile
53 +@@ -1,6 +1,6 @@
54 + VERSION = 4
55 + PATCHLEVEL = 9
56 +-SUBLEVEL = 90
57 ++SUBLEVEL = 91
58 + EXTRAVERSION =
59 + NAME = Roaring Lionus
60 +
61 +@@ -790,6 +790,15 @@ KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign)
62 + # disable invalid "can't wrap" optimizations for signed / pointers
63 + KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
64 +
65 ++# clang sets -fmerge-all-constants by default as optimization, but this
66 ++# is non-conforming behavior for C and in fact breaks the kernel, so we
67 ++# need to disable it here generally.
68 ++KBUILD_CFLAGS += $(call cc-option,-fno-merge-all-constants)
69 ++
70 ++# for gcc -fno-merge-all-constants disables everything, but it is fine
71 ++# to have actual conforming behavior enabled.
72 ++KBUILD_CFLAGS += $(call cc-option,-fmerge-constants)
73 ++
74 + # Make sure -fstack-check isn't enabled (like gentoo apparently did)
75 + KBUILD_CFLAGS += $(call cc-option,-fno-stack-check,)
76 +
77 +diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
78 +index d5cc6d73c2c4..638f7f2bd79c 100644
79 +--- a/arch/arm64/mm/mmu.c
80 ++++ b/arch/arm64/mm/mmu.c
81 +@@ -772,3 +772,13 @@ int pmd_clear_huge(pmd_t *pmd)
82 + pmd_clear(pmd);
83 + return 1;
84 + }
85 ++
86 ++int pud_free_pmd_page(pud_t *pud)
87 ++{
88 ++ return pud_none(*pud);
89 ++}
90 ++
91 ++int pmd_free_pte_page(pmd_t *pmd)
92 ++{
93 ++ return pmd_none(*pmd);
94 ++}
95 +diff --git a/arch/mips/ralink/reset.c b/arch/mips/ralink/reset.c
96 +index 64543d66e76b..e9531fea23a2 100644
97 +--- a/arch/mips/ralink/reset.c
98 ++++ b/arch/mips/ralink/reset.c
99 +@@ -96,16 +96,9 @@ static void ralink_restart(char *command)
100 + unreachable();
101 + }
102 +
103 +-static void ralink_halt(void)
104 +-{
105 +- local_irq_disable();
106 +- unreachable();
107 +-}
108 +-
109 + static int __init mips_reboot_setup(void)
110 + {
111 + _machine_restart = ralink_restart;
112 +- _machine_halt = ralink_halt;
113 +
114 + return 0;
115 + }
116 +diff --git a/arch/x86/Makefile b/arch/x86/Makefile
117 +index b60996184fa4..f408babdf746 100644
118 +--- a/arch/x86/Makefile
119 ++++ b/arch/x86/Makefile
120 +@@ -172,6 +172,15 @@ KBUILD_CFLAGS += $(cfi) $(cfi-sigframe) $(cfi-sections) $(asinstr) $(avx_instr)
121 +
122 + LDFLAGS := -m elf_$(UTS_MACHINE)
123 +
124 ++#
125 ++# The 64-bit kernel must be aligned to 2MB. Pass -z max-page-size=0x200000 to
126 ++# the linker to force 2MB page size regardless of the default page size used
127 ++# by the linker.
128 ++#
129 ++ifdef CONFIG_X86_64
130 ++LDFLAGS += $(call ld-option, -z max-page-size=0x200000)
131 ++endif
132 ++
133 + # Speed up the build
134 + KBUILD_CFLAGS += -pipe
135 + # Workaround for a gcc prelease that unfortunately was shipped in a suse release
136 +diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
137 +index c945acd8fa33..d86e68d3c794 100644
138 +--- a/arch/x86/boot/compressed/misc.c
139 ++++ b/arch/x86/boot/compressed/misc.c
140 +@@ -299,6 +299,10 @@ static void parse_elf(void *output)
141 +
142 + switch (phdr->p_type) {
143 + case PT_LOAD:
144 ++#ifdef CONFIG_X86_64
145 ++ if ((phdr->p_align % 0x200000) != 0)
146 ++ error("Alignment of LOAD segment isn't multiple of 2MB");
147 ++#endif
148 + #ifdef CONFIG_RELOCATABLE
149 + dest = output;
150 + dest += (phdr->p_paddr - LOAD_PHYSICAL_ADDR);
151 +diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
152 +index 58610fe93f5d..d58d8dcb8245 100644
153 +--- a/arch/x86/entry/entry_64.S
154 ++++ b/arch/x86/entry/entry_64.S
155 +@@ -943,7 +943,7 @@ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
156 + #endif /* CONFIG_HYPERV */
157 +
158 + idtentry debug do_debug has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
159 +-idtentry int3 do_int3 has_error_code=0 paranoid=1 shift_ist=DEBUG_STACK
160 ++idtentry int3 do_int3 has_error_code=0
161 + idtentry stack_segment do_stack_segment has_error_code=1
162 +
163 + #ifdef CONFIG_XEN
164 +diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
165 +index 0bd0c1cc3228..6f353a874178 100644
166 +--- a/arch/x86/events/intel/core.c
167 ++++ b/arch/x86/events/intel/core.c
168 +@@ -3025,7 +3025,7 @@ static unsigned bdw_limit_period(struct perf_event *event, unsigned left)
169 + X86_CONFIG(.event=0xc0, .umask=0x01)) {
170 + if (left < 128)
171 + left = 128;
172 +- left &= ~0x3fu;
173 ++ left &= ~0x3fULL;
174 + }
175 + return left;
176 + }
177 +diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
178 +index afe8024e9e95..6bc36944a8c1 100644
179 +--- a/arch/x86/events/intel/uncore_snbep.c
180 ++++ b/arch/x86/events/intel/uncore_snbep.c
181 +@@ -3522,24 +3522,27 @@ static struct intel_uncore_type *skx_msr_uncores[] = {
182 + NULL,
183 + };
184 +
185 ++/*
186 ++ * To determine the number of CHAs, it should read bits 27:0 in the CAPID6
187 ++ * register which located at Device 30, Function 3, Offset 0x9C. PCI ID 0x2083.
188 ++ */
189 ++#define SKX_CAPID6 0x9c
190 ++#define SKX_CHA_BIT_MASK GENMASK(27, 0)
191 ++
192 + static int skx_count_chabox(void)
193 + {
194 +- struct pci_dev *chabox_dev = NULL;
195 +- int bus, count = 0;
196 ++ struct pci_dev *dev = NULL;
197 ++ u32 val = 0;
198 +
199 +- while (1) {
200 +- chabox_dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x208d, chabox_dev);
201 +- if (!chabox_dev)
202 +- break;
203 +- if (count == 0)
204 +- bus = chabox_dev->bus->number;
205 +- if (bus != chabox_dev->bus->number)
206 +- break;
207 +- count++;
208 +- }
209 ++ dev = pci_get_device(PCI_VENDOR_ID_INTEL, 0x2083, dev);
210 ++ if (!dev)
211 ++ goto out;
212 +
213 +- pci_dev_put(chabox_dev);
214 +- return count;
215 ++ pci_read_config_dword(dev, SKX_CAPID6, &val);
216 ++ val &= SKX_CHA_BIT_MASK;
217 ++out:
218 ++ pci_dev_put(dev);
219 ++ return hweight32(val);
220 + }
221 +
222 + void skx_uncore_cpu_init(void)
223 +@@ -3566,7 +3569,7 @@ static struct intel_uncore_type skx_uncore_imc = {
224 + };
225 +
226 + static struct attribute *skx_upi_uncore_formats_attr[] = {
227 +- &format_attr_event_ext.attr,
228 ++ &format_attr_event.attr,
229 + &format_attr_umask_ext.attr,
230 + &format_attr_edge.attr,
231 + &format_attr_inv.attr,
232 +diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
233 +index 6899cf187ba2..9cbfbef6a115 100644
234 +--- a/arch/x86/include/asm/vmx.h
235 ++++ b/arch/x86/include/asm/vmx.h
236 +@@ -309,6 +309,7 @@ enum vmcs_field {
237 + #define INTR_TYPE_NMI_INTR (2 << 8) /* NMI */
238 + #define INTR_TYPE_HARD_EXCEPTION (3 << 8) /* processor exception */
239 + #define INTR_TYPE_SOFT_INTR (4 << 8) /* software interrupt */
240 ++#define INTR_TYPE_PRIV_SW_EXCEPTION (5 << 8) /* ICE breakpoint - undocumented */
241 + #define INTR_TYPE_SOFT_EXCEPTION (6 << 8) /* software exception */
242 +
243 + /* GUEST_INTERRUPTIBILITY_INFO flags. */
244 +diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
245 +index 322f433fbc76..f2142932ff0b 100644
246 +--- a/arch/x86/kernel/traps.c
247 ++++ b/arch/x86/kernel/traps.c
248 +@@ -526,7 +526,6 @@ do_general_protection(struct pt_regs *regs, long error_code)
249 + }
250 + NOKPROBE_SYMBOL(do_general_protection);
251 +
252 +-/* May run on IST stack. */
253 + dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
254 + {
255 + #ifdef CONFIG_DYNAMIC_FTRACE
256 +@@ -541,7 +540,15 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
257 + if (poke_int3_handler(regs))
258 + return;
259 +
260 ++ /*
261 ++ * Use ist_enter despite the fact that we don't use an IST stack.
262 ++ * We can be called from a kprobe in non-CONTEXT_KERNEL kernel
263 ++ * mode or even during context tracking state changes.
264 ++ *
265 ++ * This means that we can't schedule. That's okay.
266 ++ */
267 + ist_enter(regs);
268 ++
269 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
270 + #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
271 + if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
272 +@@ -558,17 +565,11 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
273 + SIGTRAP) == NOTIFY_STOP)
274 + goto exit;
275 +
276 +- /*
277 +- * Let others (NMI) know that the debug stack is in use
278 +- * as we may switch to the interrupt stack.
279 +- */
280 +- debug_stack_usage_inc();
281 + preempt_disable();
282 + cond_local_irq_enable(regs);
283 + do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
284 + cond_local_irq_disable(regs);
285 + preempt_enable_no_resched();
286 +- debug_stack_usage_dec();
287 + exit:
288 + ist_exit(regs);
289 + }
290 +@@ -989,19 +990,16 @@ void __init trap_init(void)
291 + cpu_init();
292 +
293 + /*
294 +- * X86_TRAP_DB and X86_TRAP_BP have been set
295 +- * in early_trap_init(). However, ITS works only after
296 +- * cpu_init() loads TSS. See comments in early_trap_init().
297 ++ * X86_TRAP_DB was installed in early_trap_init(). However,
298 ++ * IST works only after cpu_init() loads TSS. See comments
299 ++ * in early_trap_init().
300 + */
301 + set_intr_gate_ist(X86_TRAP_DB, &debug, DEBUG_STACK);
302 +- /* int3 can be called from all */
303 +- set_system_intr_gate_ist(X86_TRAP_BP, &int3, DEBUG_STACK);
304 +
305 + x86_init.irqs.trap_init();
306 +
307 + #ifdef CONFIG_X86_64
308 + memcpy(&debug_idt_table, &idt_table, IDT_ENTRIES * 16);
309 + set_nmi_gate(X86_TRAP_DB, &debug);
310 +- set_nmi_gate(X86_TRAP_BP, &int3);
311 + #endif
312 + }
313 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
314 +index 0f3bb4632310..7ed422e2641b 100644
315 +--- a/arch/x86/kvm/vmx.c
316 ++++ b/arch/x86/kvm/vmx.c
317 +@@ -1053,6 +1053,13 @@ static inline bool is_machine_check(u32 intr_info)
318 + (INTR_TYPE_HARD_EXCEPTION | MC_VECTOR | INTR_INFO_VALID_MASK);
319 + }
320 +
321 ++/* Undocumented: icebp/int1 */
322 ++static inline bool is_icebp(u32 intr_info)
323 ++{
324 ++ return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK))
325 ++ == (INTR_TYPE_PRIV_SW_EXCEPTION | INTR_INFO_VALID_MASK);
326 ++}
327 ++
328 + static inline bool cpu_has_vmx_msr_bitmap(void)
329 + {
330 + return vmcs_config.cpu_based_exec_ctrl & CPU_BASED_USE_MSR_BITMAPS;
331 +@@ -5733,7 +5740,7 @@ static int handle_exception(struct kvm_vcpu *vcpu)
332 + (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) {
333 + vcpu->arch.dr6 &= ~15;
334 + vcpu->arch.dr6 |= dr6 | DR6_RTM;
335 +- if (!(dr6 & ~DR6_RESERVED)) /* icebp */
336 ++ if (is_icebp(intr_info))
337 + skip_emulated_instruction(vcpu);
338 +
339 + kvm_queue_exception(vcpu, DB_VECTOR);
340 +diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
341 +index 209b9465e97a..b97ef29c940f 100644
342 +--- a/arch/x86/mm/pgtable.c
343 ++++ b/arch/x86/mm/pgtable.c
344 +@@ -643,4 +643,52 @@ int pmd_clear_huge(pmd_t *pmd)
345 +
346 + return 0;
347 + }
348 ++
349 ++/**
350 ++ * pud_free_pmd_page - Clear pud entry and free pmd page.
351 ++ * @pud: Pointer to a PUD.
352 ++ *
353 ++ * Context: The pud range has been unmaped and TLB purged.
354 ++ * Return: 1 if clearing the entry succeeded. 0 otherwise.
355 ++ */
356 ++int pud_free_pmd_page(pud_t *pud)
357 ++{
358 ++ pmd_t *pmd;
359 ++ int i;
360 ++
361 ++ if (pud_none(*pud))
362 ++ return 1;
363 ++
364 ++ pmd = (pmd_t *)pud_page_vaddr(*pud);
365 ++
366 ++ for (i = 0; i < PTRS_PER_PMD; i++)
367 ++ if (!pmd_free_pte_page(&pmd[i]))
368 ++ return 0;
369 ++
370 ++ pud_clear(pud);
371 ++ free_page((unsigned long)pmd);
372 ++
373 ++ return 1;
374 ++}
375 ++
376 ++/**
377 ++ * pmd_free_pte_page - Clear pmd entry and free pte page.
378 ++ * @pmd: Pointer to a PMD.
379 ++ *
380 ++ * Context: The pmd range has been unmaped and TLB purged.
381 ++ * Return: 1 if clearing the entry succeeded. 0 otherwise.
382 ++ */
383 ++int pmd_free_pte_page(pmd_t *pmd)
384 ++{
385 ++ pte_t *pte;
386 ++
387 ++ if (pmd_none(*pmd))
388 ++ return 1;
389 ++
390 ++ pte = (pte_t *)pmd_page_vaddr(*pmd);
391 ++ pmd_clear(pmd);
392 ++ free_page((unsigned long)pte);
393 ++
394 ++ return 1;
395 ++}
396 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
397 +diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
398 +index 1f7ed2ed6ff7..cd9764520851 100644
399 +--- a/arch/x86/net/bpf_jit_comp.c
400 ++++ b/arch/x86/net/bpf_jit_comp.c
401 +@@ -1135,7 +1135,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
402 + * may converge on the last pass. In such case do one more
403 + * pass to emit the final image
404 + */
405 +- for (pass = 0; pass < 10 || image; pass++) {
406 ++ for (pass = 0; pass < 20 || image; pass++) {
407 + proglen = do_jit(prog, addrs, image, oldproglen, &ctx);
408 + if (proglen <= 0) {
409 + image = NULL;
410 +@@ -1162,6 +1162,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
411 + }
412 + }
413 + oldproglen = proglen;
414 ++ cond_resched();
415 + }
416 +
417 + if (bpf_jit_enable > 1)
418 +diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
419 +index 13caebd679f5..ce8fc680785b 100644
420 +--- a/drivers/acpi/acpi_watchdog.c
421 ++++ b/drivers/acpi/acpi_watchdog.c
422 +@@ -74,10 +74,10 @@ void __init acpi_watchdog_init(void)
423 + res.start = gas->address;
424 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
425 + res.flags = IORESOURCE_MEM;
426 +- res.end = res.start + ALIGN(gas->access_width, 4);
427 ++ res.end = res.start + ALIGN(gas->access_width, 4) - 1;
428 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
429 + res.flags = IORESOURCE_IO;
430 +- res.end = res.start + gas->access_width;
431 ++ res.end = res.start + gas->access_width - 1;
432 + } else {
433 + pr_warn("Unsupported address space: %u\n",
434 + gas->space_id);
435 +diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
436 +index ce3a7a16f03f..17b518cb787c 100644
437 +--- a/drivers/acpi/numa.c
438 ++++ b/drivers/acpi/numa.c
439 +@@ -103,25 +103,27 @@ int acpi_map_pxm_to_node(int pxm)
440 + */
441 + int acpi_map_pxm_to_online_node(int pxm)
442 + {
443 +- int node, n, dist, min_dist;
444 ++ int node, min_node;
445 +
446 + node = acpi_map_pxm_to_node(pxm);
447 +
448 + if (node == NUMA_NO_NODE)
449 + node = 0;
450 +
451 ++ min_node = node;
452 + if (!node_online(node)) {
453 +- min_dist = INT_MAX;
454 ++ int min_dist = INT_MAX, dist, n;
455 ++
456 + for_each_online_node(n) {
457 + dist = node_distance(node, n);
458 + if (dist < min_dist) {
459 + min_dist = dist;
460 +- node = n;
461 ++ min_node = n;
462 + }
463 + }
464 + }
465 +
466 +- return node;
467 ++ return min_node;
468 + }
469 + EXPORT_SYMBOL(acpi_map_pxm_to_online_node);
470 +
471 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
472 +index 9b46ef4c851e..4d4b5f607b81 100644
473 +--- a/drivers/ata/ahci.c
474 ++++ b/drivers/ata/ahci.c
475 +@@ -539,7 +539,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
476 + .driver_data = board_ahci_yes_fbs },
477 + { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
478 + .driver_data = board_ahci_yes_fbs },
479 +- { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642),
480 ++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642), /* highpoint rocketraid 642L */
481 ++ .driver_data = board_ahci_yes_fbs },
482 ++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0645), /* highpoint rocketraid 644L */
483 + .driver_data = board_ahci_yes_fbs },
484 +
485 + /* Promise */
486 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
487 +index aee39524375c..e08c09fa5da0 100644
488 +--- a/drivers/ata/libata-core.c
489 ++++ b/drivers/ata/libata-core.c
490 +@@ -4403,6 +4403,25 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
491 + { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER },
492 + { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER },
493 +
494 ++ /* Crucial BX100 SSD 500GB has broken LPM support */
495 ++ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM },
496 ++
497 ++ /* 512GB MX100 with MU01 firmware has both queued TRIM and LPM issues */
498 ++ { "Crucial_CT512MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
499 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
500 ++ ATA_HORKAGE_NOLPM, },
501 ++ /* 512GB MX100 with newer firmware has only LPM issues */
502 ++ { "Crucial_CT512MX100*", NULL, ATA_HORKAGE_ZERO_AFTER_TRIM |
503 ++ ATA_HORKAGE_NOLPM, },
504 ++
505 ++ /* 480GB+ M500 SSDs have both queued TRIM and LPM issues */
506 ++ { "Crucial_CT480M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
507 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
508 ++ ATA_HORKAGE_NOLPM, },
509 ++ { "Crucial_CT960M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
510 ++ ATA_HORKAGE_ZERO_AFTER_TRIM |
511 ++ ATA_HORKAGE_NOLPM, },
512 ++
513 + /* devices that don't properly handle queued TRIM commands */
514 + { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
515 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
516 +@@ -4414,7 +4433,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
517 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
518 + { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM |
519 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
520 +- { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
521 ++ { "Samsung SSD 840*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
522 ++ ATA_HORKAGE_ZERO_AFTER_TRIM, },
523 ++ { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
524 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
525 + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
526 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
527 +@@ -5265,8 +5286,7 @@ void ata_qc_issue(struct ata_queued_cmd *qc)
528 + * We guarantee to LLDs that they will have at least one
529 + * non-zero sg if the command is a data command.
530 + */
531 +- if (WARN_ON_ONCE(ata_is_data(prot) &&
532 +- (!qc->sg || !qc->n_elem || !qc->nbytes)))
533 ++ if (ata_is_data(prot) && (!qc->sg || !qc->n_elem || !qc->nbytes))
534 + goto sys_err;
535 +
536 + if (ata_is_dma(prot) || (ata_is_pio(prot) &&
537 +diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
538 +index e3e10e8f6f6a..9babbc845750 100644
539 +--- a/drivers/ata/libata-scsi.c
540 ++++ b/drivers/ata/libata-scsi.c
541 +@@ -3226,6 +3226,12 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
542 + goto invalid_fld;
543 + }
544 +
545 ++ /* We may not issue NCQ commands to devices not supporting NCQ */
546 ++ if (ata_is_ncq(tf->protocol) && !ata_ncq_enabled(dev)) {
547 ++ fp = 1;
548 ++ goto invalid_fld;
549 ++ }
550 ++
551 + /* sanity check for pio multi commands */
552 + if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) {
553 + fp = 1;
554 +@@ -4177,7 +4183,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
555 + if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
556 + /* relay SCSI command to ATAPI device */
557 + int len = COMMAND_SIZE(scsi_op);
558 +- if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
559 ++ if (unlikely(len > scmd->cmd_len ||
560 ++ len > dev->cdb_len ||
561 ++ scmd->cmd_len > ATAPI_CDB_LEN))
562 + goto bad_cdb_len;
563 +
564 + xlat_func = atapi_xlat;
565 +diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
566 +index 3257647d4f74..f8ba5c714df5 100644
567 +--- a/drivers/bluetooth/btusb.c
568 ++++ b/drivers/bluetooth/btusb.c
569 +@@ -217,7 +217,6 @@ static const struct usb_device_id blacklist_table[] = {
570 + { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 },
571 + { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 },
572 + { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 },
573 +- { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 },
574 + { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 },
575 + { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 },
576 + { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 },
577 +@@ -250,6 +249,7 @@ static const struct usb_device_id blacklist_table[] = {
578 + { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
579 +
580 + /* QCA ROME chipset */
581 ++ { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_QCA_ROME },
582 + { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
583 + { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME },
584 + { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
585 +diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
586 +index 2acaa77ad482..abdc149941e2 100644
587 +--- a/drivers/clk/bcm/clk-bcm2835.c
588 ++++ b/drivers/clk/bcm/clk-bcm2835.c
589 +@@ -401,17 +401,17 @@ struct bcm2835_pll_ana_bits {
590 + static const struct bcm2835_pll_ana_bits bcm2835_ana_default = {
591 + .mask0 = 0,
592 + .set0 = 0,
593 +- .mask1 = (u32)~(A2W_PLL_KI_MASK | A2W_PLL_KP_MASK),
594 ++ .mask1 = A2W_PLL_KI_MASK | A2W_PLL_KP_MASK,
595 + .set1 = (2 << A2W_PLL_KI_SHIFT) | (8 << A2W_PLL_KP_SHIFT),
596 +- .mask3 = (u32)~A2W_PLL_KA_MASK,
597 ++ .mask3 = A2W_PLL_KA_MASK,
598 + .set3 = (2 << A2W_PLL_KA_SHIFT),
599 + .fb_prediv_mask = BIT(14),
600 + };
601 +
602 + static const struct bcm2835_pll_ana_bits bcm2835_ana_pllh = {
603 +- .mask0 = (u32)~(A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK),
604 ++ .mask0 = A2W_PLLH_KA_MASK | A2W_PLLH_KI_LOW_MASK,
605 + .set0 = (2 << A2W_PLLH_KA_SHIFT) | (2 << A2W_PLLH_KI_LOW_SHIFT),
606 +- .mask1 = (u32)~(A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK),
607 ++ .mask1 = A2W_PLLH_KI_HIGH_MASK | A2W_PLLH_KP_MASK,
608 + .set1 = (6 << A2W_PLLH_KP_SHIFT),
609 + .mask3 = 0,
610 + .set3 = 0,
611 +@@ -566,8 +566,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
612 + ~A2W_PLL_CTRL_PWRDN);
613 +
614 + /* Take the PLL out of reset. */
615 ++ spin_lock(&cprman->regs_lock);
616 + cprman_write(cprman, data->cm_ctrl_reg,
617 + cprman_read(cprman, data->cm_ctrl_reg) & ~CM_PLL_ANARST);
618 ++ spin_unlock(&cprman->regs_lock);
619 +
620 + /* Wait for the PLL to lock. */
621 + timeout = ktime_add_ns(ktime_get(), LOCK_TIMEOUT_NS);
622 +@@ -644,9 +646,11 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
623 + }
624 +
625 + /* Unmask the reference clock from the oscillator. */
626 ++ spin_lock(&cprman->regs_lock);
627 + cprman_write(cprman, A2W_XOSC_CTRL,
628 + cprman_read(cprman, A2W_XOSC_CTRL) |
629 + data->reference_enable_mask);
630 ++ spin_unlock(&cprman->regs_lock);
631 +
632 + if (do_ana_setup_first)
633 + bcm2835_pll_write_ana(cprman, data->ana_reg_base, ana);
634 +diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
635 +index 9fe0939c1273..6ea5401e6881 100644
636 +--- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
637 ++++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
638 +@@ -750,7 +750,7 @@ static struct ccu_mp out_a_clk = {
639 + .features = CCU_FEATURE_FIXED_PREDIV,
640 + .hw.init = CLK_HW_INIT_PARENTS("out-a",
641 + clk_out_parents,
642 +- &ccu_div_ops,
643 ++ &ccu_mp_ops,
644 + 0),
645 + },
646 + };
647 +@@ -771,7 +771,7 @@ static struct ccu_mp out_b_clk = {
648 + .features = CCU_FEATURE_FIXED_PREDIV,
649 + .hw.init = CLK_HW_INIT_PARENTS("out-b",
650 + clk_out_parents,
651 +- &ccu_div_ops,
652 ++ &ccu_mp_ops,
653 + 0),
654 + },
655 + };
656 +@@ -792,7 +792,7 @@ static struct ccu_mp out_c_clk = {
657 + .features = CCU_FEATURE_FIXED_PREDIV,
658 + .hw.init = CLK_HW_INIT_PARENTS("out-c",
659 + clk_out_parents,
660 +- &ccu_div_ops,
661 ++ &ccu_mp_ops,
662 + 0),
663 + },
664 + };
665 +diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
666 +index af0d7fd5706b..f416f5c2e8e9 100644
667 +--- a/drivers/gpu/drm/radeon/radeon_connectors.c
668 ++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
669 +@@ -90,25 +90,18 @@ void radeon_connector_hotplug(struct drm_connector *connector)
670 + /* don't do anything if sink is not display port, i.e.,
671 + * passive dp->(dvi|hdmi) adaptor
672 + */
673 +- if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
674 +- int saved_dpms = connector->dpms;
675 +- /* Only turn off the display if it's physically disconnected */
676 +- if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
677 +- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
678 +- } else if (radeon_dp_needs_link_train(radeon_connector)) {
679 +- /* Don't try to start link training before we
680 +- * have the dpcd */
681 +- if (!radeon_dp_getdpcd(radeon_connector))
682 +- return;
683 +-
684 +- /* set it to OFF so that drm_helper_connector_dpms()
685 +- * won't return immediately since the current state
686 +- * is ON at this point.
687 +- */
688 +- connector->dpms = DRM_MODE_DPMS_OFF;
689 +- drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
690 +- }
691 +- connector->dpms = saved_dpms;
692 ++ if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT &&
693 ++ radeon_hpd_sense(rdev, radeon_connector->hpd.hpd) &&
694 ++ radeon_dp_needs_link_train(radeon_connector)) {
695 ++ /* Don't start link training before we have the DPCD */
696 ++ if (!radeon_dp_getdpcd(radeon_connector))
697 ++ return;
698 ++
699 ++ /* Turn the connector off and back on immediately, which
700 ++ * will trigger link training
701 ++ */
702 ++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
703 ++ drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
704 + }
705 + }
706 + }
707 +diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
708 +index 611b6b9bb3cb..67ea2ce03a23 100644
709 +--- a/drivers/gpu/drm/udl/udl_fb.c
710 ++++ b/drivers/gpu/drm/udl/udl_fb.c
711 +@@ -158,10 +158,15 @@ static int udl_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
712 + {
713 + unsigned long start = vma->vm_start;
714 + unsigned long size = vma->vm_end - vma->vm_start;
715 +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
716 ++ unsigned long offset;
717 + unsigned long page, pos;
718 +
719 +- if (offset + size > info->fix.smem_len)
720 ++ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
721 ++ return -EINVAL;
722 ++
723 ++ offset = vma->vm_pgoff << PAGE_SHIFT;
724 ++
725 ++ if (offset > info->fix.smem_len || size > info->fix.smem_len - offset)
726 + return -EINVAL;
727 +
728 + pos = (unsigned long)info->fix.smem_start + offset;
729 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
730 +index bf28ccc150df..87086af42114 100644
731 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
732 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
733 +@@ -27,7 +27,6 @@
734 +
735 + #include "vmwgfx_kms.h"
736 +
737 +-
738 + /* Might need a hrtimer here? */
739 + #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1)
740 +
741 +@@ -1933,9 +1932,12 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
742 + * Helper to be used if an error forces the caller to undo the actions of
743 + * vmw_kms_helper_resource_prepare.
744 + */
745 +-void vmw_kms_helper_resource_revert(struct vmw_resource *res)
746 ++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx)
747 + {
748 +- vmw_kms_helper_buffer_revert(res->backup);
749 ++ struct vmw_resource *res = ctx->res;
750 ++
751 ++ vmw_kms_helper_buffer_revert(ctx->buf);
752 ++ vmw_dmabuf_unreference(&ctx->buf);
753 + vmw_resource_unreserve(res, false, NULL, 0);
754 + mutex_unlock(&res->dev_priv->cmdbuf_mutex);
755 + }
756 +@@ -1952,10 +1954,14 @@ void vmw_kms_helper_resource_revert(struct vmw_resource *res)
757 + * interrupted by a signal.
758 + */
759 + int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
760 +- bool interruptible)
761 ++ bool interruptible,
762 ++ struct vmw_validation_ctx *ctx)
763 + {
764 + int ret = 0;
765 +
766 ++ ctx->buf = NULL;
767 ++ ctx->res = res;
768 ++
769 + if (interruptible)
770 + ret = mutex_lock_interruptible(&res->dev_priv->cmdbuf_mutex);
771 + else
772 +@@ -1974,6 +1980,8 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
773 + res->dev_priv->has_mob);
774 + if (ret)
775 + goto out_unreserve;
776 ++
777 ++ ctx->buf = vmw_dmabuf_reference(res->backup);
778 + }
779 + ret = vmw_resource_validate(res);
780 + if (ret)
781 +@@ -1981,7 +1989,7 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
782 + return 0;
783 +
784 + out_revert:
785 +- vmw_kms_helper_buffer_revert(res->backup);
786 ++ vmw_kms_helper_buffer_revert(ctx->buf);
787 + out_unreserve:
788 + vmw_resource_unreserve(res, false, NULL, 0);
789 + out_unlock:
790 +@@ -1997,11 +2005,13 @@ int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
791 + * @out_fence: Optional pointer to a fence pointer. If non-NULL, a
792 + * ref-counted fence pointer is returned here.
793 + */
794 +-void vmw_kms_helper_resource_finish(struct vmw_resource *res,
795 +- struct vmw_fence_obj **out_fence)
796 ++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
797 ++ struct vmw_fence_obj **out_fence)
798 + {
799 +- if (res->backup || out_fence)
800 +- vmw_kms_helper_buffer_finish(res->dev_priv, NULL, res->backup,
801 ++ struct vmw_resource *res = ctx->res;
802 ++
803 ++ if (ctx->buf || out_fence)
804 ++ vmw_kms_helper_buffer_finish(res->dev_priv, NULL, ctx->buf,
805 + out_fence, NULL);
806 +
807 + vmw_resource_unreserve(res, false, NULL, 0);
808 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
809 +index ff4803c107bc..2dd05395e98b 100644
810 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
811 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
812 +@@ -183,6 +183,11 @@ struct vmw_display_unit {
813 + int set_gui_y;
814 + };
815 +
816 ++struct vmw_validation_ctx {
817 ++ struct vmw_resource *res;
818 ++ struct vmw_dma_buffer *buf;
819 ++};
820 ++
821 + #define vmw_crtc_to_du(x) \
822 + container_of(x, struct vmw_display_unit, crtc)
823 + #define vmw_connector_to_du(x) \
824 +@@ -233,9 +238,10 @@ void vmw_kms_helper_buffer_finish(struct vmw_private *dev_priv,
825 + struct drm_vmw_fence_rep __user *
826 + user_fence_rep);
827 + int vmw_kms_helper_resource_prepare(struct vmw_resource *res,
828 +- bool interruptible);
829 +-void vmw_kms_helper_resource_revert(struct vmw_resource *res);
830 +-void vmw_kms_helper_resource_finish(struct vmw_resource *res,
831 ++ bool interruptible,
832 ++ struct vmw_validation_ctx *ctx);
833 ++void vmw_kms_helper_resource_revert(struct vmw_validation_ctx *ctx);
834 ++void vmw_kms_helper_resource_finish(struct vmw_validation_ctx *ctx,
835 + struct vmw_fence_obj **out_fence);
836 + int vmw_kms_readback(struct vmw_private *dev_priv,
837 + struct drm_file *file_priv,
838 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
839 +index f42359084adc..a6ca2185f5b0 100644
840 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
841 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
842 +@@ -753,12 +753,13 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
843 + struct vmw_framebuffer_surface *vfbs =
844 + container_of(framebuffer, typeof(*vfbs), base);
845 + struct vmw_kms_sou_surface_dirty sdirty;
846 ++ struct vmw_validation_ctx ctx;
847 + int ret;
848 +
849 + if (!srf)
850 + srf = &vfbs->surface->res;
851 +
852 +- ret = vmw_kms_helper_resource_prepare(srf, true);
853 ++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx);
854 + if (ret)
855 + return ret;
856 +
857 +@@ -777,7 +778,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv,
858 + ret = vmw_kms_helper_dirty(dev_priv, framebuffer, clips, vclips,
859 + dest_x, dest_y, num_clips, inc,
860 + &sdirty.base);
861 +- vmw_kms_helper_resource_finish(srf, out_fence);
862 ++ vmw_kms_helper_resource_finish(&ctx, out_fence);
863 +
864 + return ret;
865 + }
866 +diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
867 +index 94ad8d2acf9a..8b914504b857 100644
868 +--- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
869 ++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
870 +@@ -977,12 +977,13 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
871 + struct vmw_framebuffer_surface *vfbs =
872 + container_of(framebuffer, typeof(*vfbs), base);
873 + struct vmw_stdu_dirty sdirty;
874 ++ struct vmw_validation_ctx ctx;
875 + int ret;
876 +
877 + if (!srf)
878 + srf = &vfbs->surface->res;
879 +
880 +- ret = vmw_kms_helper_resource_prepare(srf, true);
881 ++ ret = vmw_kms_helper_resource_prepare(srf, true, &ctx);
882 + if (ret)
883 + return ret;
884 +
885 +@@ -1005,7 +1006,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv,
886 + dest_x, dest_y, num_clips, inc,
887 + &sdirty.base);
888 + out_finish:
889 +- vmw_kms_helper_resource_finish(srf, out_fence);
890 ++ vmw_kms_helper_resource_finish(&ctx, out_fence);
891 +
892 + return ret;
893 + }
894 +diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
895 +index fe94415a0bc7..32cd64c2ee06 100644
896 +--- a/drivers/iio/accel/st_accel_core.c
897 ++++ b/drivers/iio/accel/st_accel_core.c
898 +@@ -858,7 +858,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
899 + if (!pdata)
900 + pdata = (struct st_sensors_platform_data *)&default_accel_pdata;
901 +
902 +- err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data);
903 ++ err = st_sensors_init_sensor(indio_dev, pdata);
904 + if (err < 0)
905 + goto st_accel_power_off;
906 +
907 +diff --git a/drivers/iio/pressure/st_pressure_core.c b/drivers/iio/pressure/st_pressure_core.c
908 +index bec60299b6ec..3458418d88bc 100644
909 +--- a/drivers/iio/pressure/st_pressure_core.c
910 ++++ b/drivers/iio/pressure/st_pressure_core.c
911 +@@ -678,7 +678,7 @@ int st_press_common_probe(struct iio_dev *indio_dev)
912 + if (!pdata && press_data->sensor_settings->drdy_irq.addr)
913 + pdata = (struct st_sensors_platform_data *)&default_press_pdata;
914 +
915 +- err = st_sensors_init_sensor(indio_dev, press_data->dev->platform_data);
916 ++ err = st_sensors_init_sensor(indio_dev, pdata);
917 + if (err < 0)
918 + goto st_press_power_off;
919 +
920 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
921 +index f81f4175f49a..d382dbd44635 100644
922 +--- a/drivers/mmc/host/dw_mmc.c
923 ++++ b/drivers/mmc/host/dw_mmc.c
924 +@@ -490,6 +490,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
925 + (sizeof(struct idmac_desc_64addr) *
926 + (i + 1))) >> 32;
927 + /* Initialize reserved and buffer size fields to "0" */
928 ++ p->des0 = 0;
929 + p->des1 = 0;
930 + p->des2 = 0;
931 + p->des3 = 0;
932 +@@ -512,6 +513,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
933 + i++, p++) {
934 + p->des3 = cpu_to_le32(host->sg_dma +
935 + (sizeof(struct idmac_desc) * (i + 1)));
936 ++ p->des0 = 0;
937 + p->des1 = 0;
938 + }
939 +
940 +@@ -2878,8 +2880,8 @@ static bool dw_mci_reset(struct dw_mci *host)
941 + }
942 +
943 + if (host->use_dma == TRANS_MODE_IDMAC)
944 +- /* It is also recommended that we reset and reprogram idmac */
945 +- dw_mci_idmac_reset(host);
946 ++ /* It is also required that we reinit idmac */
947 ++ dw_mci_idmac_init(host);
948 +
949 + ret = true;
950 +
951 +diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
952 +index 2a47a3f0e730..b4092eab53ac 100644
953 +--- a/drivers/mtd/mtdchar.c
954 ++++ b/drivers/mtd/mtdchar.c
955 +@@ -487,7 +487,7 @@ static int shrink_ecclayout(struct mtd_info *mtd,
956 + for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES;) {
957 + u32 eccpos;
958 +
959 +- ret = mtd_ooblayout_ecc(mtd, section, &oobregion);
960 ++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion);
961 + if (ret < 0) {
962 + if (ret != -ERANGE)
963 + return ret;
964 +@@ -534,7 +534,7 @@ static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to)
965 + for (i = 0; i < ARRAY_SIZE(to->eccpos);) {
966 + u32 eccpos;
967 +
968 +- ret = mtd_ooblayout_ecc(mtd, section, &oobregion);
969 ++ ret = mtd_ooblayout_ecc(mtd, section++, &oobregion);
970 + if (ret < 0) {
971 + if (ret != -ERANGE)
972 + return ret;
973 +diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
974 +index f8f12ccc6471..2f6b55229d5b 100644
975 +--- a/drivers/mtd/nand/fsl_ifc_nand.c
976 ++++ b/drivers/mtd/nand/fsl_ifc_nand.c
977 +@@ -201,14 +201,9 @@ static int is_blank(struct mtd_info *mtd, unsigned int bufnum)
978 +
979 + /* returns nonzero if entire page is blank */
980 + static int check_read_ecc(struct mtd_info *mtd, struct fsl_ifc_ctrl *ctrl,
981 +- u32 *eccstat, unsigned int bufnum)
982 ++ u32 eccstat, unsigned int bufnum)
983 + {
984 +- u32 reg = eccstat[bufnum / 4];
985 +- int errors;
986 +-
987 +- errors = (reg >> ((3 - bufnum % 4) * 8)) & 15;
988 +-
989 +- return errors;
990 ++ return (eccstat >> ((3 - bufnum % 4) * 8)) & 15;
991 + }
992 +
993 + /*
994 +@@ -221,7 +216,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
995 + struct fsl_ifc_ctrl *ctrl = priv->ctrl;
996 + struct fsl_ifc_nand_ctrl *nctrl = ifc_nand_ctrl;
997 + struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
998 +- u32 eccstat[4];
999 ++ u32 eccstat;
1000 + int i;
1001 +
1002 + /* set the chip select for NAND Transaction */
1003 +@@ -256,19 +251,17 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
1004 + if (nctrl->eccread) {
1005 + int errors;
1006 + int bufnum = nctrl->page & priv->bufnum_mask;
1007 +- int sector = bufnum * chip->ecc.steps;
1008 +- int sector_end = sector + chip->ecc.steps - 1;
1009 ++ int sector_start = bufnum * chip->ecc.steps;
1010 ++ int sector_end = sector_start + chip->ecc.steps - 1;
1011 + __be32 *eccstat_regs;
1012 +
1013 +- if (ctrl->version >= FSL_IFC_VERSION_2_0_0)
1014 +- eccstat_regs = ifc->ifc_nand.v2_nand_eccstat;
1015 +- else
1016 +- eccstat_regs = ifc->ifc_nand.v1_nand_eccstat;
1017 ++ eccstat_regs = ifc->ifc_nand.nand_eccstat;
1018 ++ eccstat = ifc_in32(&eccstat_regs[sector_start / 4]);
1019 +
1020 +- for (i = sector / 4; i <= sector_end / 4; i++)
1021 +- eccstat[i] = ifc_in32(&eccstat_regs[i]);
1022 ++ for (i = sector_start; i <= sector_end; i++) {
1023 ++ if (i != sector_start && !(i % 4))
1024 ++ eccstat = ifc_in32(&eccstat_regs[i / 4]);
1025 +
1026 +- for (i = sector; i <= sector_end; i++) {
1027 + errors = check_read_ecc(mtd, ctrl, eccstat, i);
1028 +
1029 + if (errors == 15) {
1030 +@@ -656,6 +649,7 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
1031 + struct fsl_ifc_ctrl *ctrl = priv->ctrl;
1032 + struct fsl_ifc_runtime __iomem *ifc = ctrl->rregs;
1033 + u32 nand_fsr;
1034 ++ int status;
1035 +
1036 + /* Use READ_STATUS command, but wait for the device to be ready */
1037 + ifc_out32((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
1038 +@@ -670,12 +664,12 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
1039 + fsl_ifc_run_command(mtd);
1040 +
1041 + nand_fsr = ifc_in32(&ifc->ifc_nand.nand_fsr);
1042 +-
1043 ++ status = nand_fsr >> 24;
1044 + /*
1045 + * The chip always seems to report that it is
1046 + * write-protected, even when it is not.
1047 + */
1048 +- return nand_fsr | NAND_STATUS_WP;
1049 ++ return status | NAND_STATUS_WP;
1050 + }
1051 +
1052 + static int fsl_ifc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
1053 +diff --git a/drivers/net/can/cc770/cc770.c b/drivers/net/can/cc770/cc770.c
1054 +index 1e37313054f3..6da69af103e6 100644
1055 +--- a/drivers/net/can/cc770/cc770.c
1056 ++++ b/drivers/net/can/cc770/cc770.c
1057 +@@ -390,37 +390,23 @@ static int cc770_get_berr_counter(const struct net_device *dev,
1058 + return 0;
1059 + }
1060 +
1061 +-static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1062 ++static void cc770_tx(struct net_device *dev, int mo)
1063 + {
1064 + struct cc770_priv *priv = netdev_priv(dev);
1065 +- struct net_device_stats *stats = &dev->stats;
1066 +- struct can_frame *cf = (struct can_frame *)skb->data;
1067 +- unsigned int mo = obj2msgobj(CC770_OBJ_TX);
1068 ++ struct can_frame *cf = (struct can_frame *)priv->tx_skb->data;
1069 + u8 dlc, rtr;
1070 + u32 id;
1071 + int i;
1072 +
1073 +- if (can_dropped_invalid_skb(dev, skb))
1074 +- return NETDEV_TX_OK;
1075 +-
1076 +- if ((cc770_read_reg(priv,
1077 +- msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) {
1078 +- netdev_err(dev, "TX register is still occupied!\n");
1079 +- return NETDEV_TX_BUSY;
1080 +- }
1081 +-
1082 +- netif_stop_queue(dev);
1083 +-
1084 + dlc = cf->can_dlc;
1085 + id = cf->can_id;
1086 +- if (cf->can_id & CAN_RTR_FLAG)
1087 +- rtr = 0;
1088 +- else
1089 +- rtr = MSGCFG_DIR;
1090 ++ rtr = cf->can_id & CAN_RTR_FLAG ? 0 : MSGCFG_DIR;
1091 ++
1092 ++ cc770_write_reg(priv, msgobj[mo].ctrl0,
1093 ++ MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES);
1094 + cc770_write_reg(priv, msgobj[mo].ctrl1,
1095 + RMTPND_RES | TXRQST_RES | CPUUPD_SET | NEWDAT_RES);
1096 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1097 +- MSGVAL_SET | TXIE_SET | RXIE_RES | INTPND_RES);
1098 ++
1099 + if (id & CAN_EFF_FLAG) {
1100 + id &= CAN_EFF_MASK;
1101 + cc770_write_reg(priv, msgobj[mo].config,
1102 +@@ -439,22 +425,30 @@ static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1103 + for (i = 0; i < dlc; i++)
1104 + cc770_write_reg(priv, msgobj[mo].data[i], cf->data[i]);
1105 +
1106 +- /* Store echo skb before starting the transfer */
1107 +- can_put_echo_skb(skb, dev, 0);
1108 +-
1109 + cc770_write_reg(priv, msgobj[mo].ctrl1,
1110 +- RMTPND_RES | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC);
1111 ++ RMTPND_UNC | TXRQST_SET | CPUUPD_RES | NEWDAT_UNC);
1112 ++ cc770_write_reg(priv, msgobj[mo].ctrl0,
1113 ++ MSGVAL_SET | TXIE_SET | RXIE_SET | INTPND_UNC);
1114 ++}
1115 +
1116 +- stats->tx_bytes += dlc;
1117 ++static netdev_tx_t cc770_start_xmit(struct sk_buff *skb, struct net_device *dev)
1118 ++{
1119 ++ struct cc770_priv *priv = netdev_priv(dev);
1120 ++ unsigned int mo = obj2msgobj(CC770_OBJ_TX);
1121 +
1122 ++ if (can_dropped_invalid_skb(dev, skb))
1123 ++ return NETDEV_TX_OK;
1124 +
1125 +- /*
1126 +- * HM: We had some cases of repeated IRQs so make sure the
1127 +- * INT is acknowledged I know it's already further up, but
1128 +- * doing again fixed the issue
1129 +- */
1130 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1131 +- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES);
1132 ++ netif_stop_queue(dev);
1133 ++
1134 ++ if ((cc770_read_reg(priv,
1135 ++ msgobj[mo].ctrl1) & TXRQST_UNC) == TXRQST_SET) {
1136 ++ netdev_err(dev, "TX register is still occupied!\n");
1137 ++ return NETDEV_TX_BUSY;
1138 ++ }
1139 ++
1140 ++ priv->tx_skb = skb;
1141 ++ cc770_tx(dev, mo);
1142 +
1143 + return NETDEV_TX_OK;
1144 + }
1145 +@@ -680,19 +674,46 @@ static void cc770_tx_interrupt(struct net_device *dev, unsigned int o)
1146 + struct cc770_priv *priv = netdev_priv(dev);
1147 + struct net_device_stats *stats = &dev->stats;
1148 + unsigned int mo = obj2msgobj(o);
1149 ++ struct can_frame *cf;
1150 ++ u8 ctrl1;
1151 ++
1152 ++ ctrl1 = cc770_read_reg(priv, msgobj[mo].ctrl1);
1153 +
1154 +- /* Nothing more to send, switch off interrupts */
1155 + cc770_write_reg(priv, msgobj[mo].ctrl0,
1156 + MSGVAL_RES | TXIE_RES | RXIE_RES | INTPND_RES);
1157 +- /*
1158 +- * We had some cases of repeated IRQ so make sure the
1159 +- * INT is acknowledged
1160 ++ cc770_write_reg(priv, msgobj[mo].ctrl1,
1161 ++ RMTPND_RES | TXRQST_RES | MSGLST_RES | NEWDAT_RES);
1162 ++
1163 ++ if (unlikely(!priv->tx_skb)) {
1164 ++ netdev_err(dev, "missing tx skb in tx interrupt\n");
1165 ++ return;
1166 ++ }
1167 ++
1168 ++ if (unlikely(ctrl1 & MSGLST_SET)) {
1169 ++ stats->rx_over_errors++;
1170 ++ stats->rx_errors++;
1171 ++ }
1172 ++
1173 ++ /* When the CC770 is sending an RTR message and it receives a regular
1174 ++ * message that matches the id of the RTR message, it will overwrite the
1175 ++ * outgoing message in the TX register. When this happens we must
1176 ++ * process the received message and try to transmit the outgoing skb
1177 ++ * again.
1178 + */
1179 +- cc770_write_reg(priv, msgobj[mo].ctrl0,
1180 +- MSGVAL_UNC | TXIE_UNC | RXIE_UNC | INTPND_RES);
1181 ++ if (unlikely(ctrl1 & NEWDAT_SET)) {
1182 ++ cc770_rx(dev, mo, ctrl1);
1183 ++ cc770_tx(dev, mo);
1184 ++ return;
1185 ++ }
1186 +
1187 ++ cf = (struct can_frame *)priv->tx_skb->data;
1188 ++ stats->tx_bytes += cf->can_dlc;
1189 + stats->tx_packets++;
1190 ++
1191 ++ can_put_echo_skb(priv->tx_skb, dev, 0);
1192 + can_get_echo_skb(dev, 0);
1193 ++ priv->tx_skb = NULL;
1194 ++
1195 + netif_wake_queue(dev);
1196 + }
1197 +
1198 +@@ -804,6 +825,7 @@ struct net_device *alloc_cc770dev(int sizeof_priv)
1199 + priv->can.do_set_bittiming = cc770_set_bittiming;
1200 + priv->can.do_set_mode = cc770_set_mode;
1201 + priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
1202 ++ priv->tx_skb = NULL;
1203 +
1204 + memcpy(priv->obj_flags, cc770_obj_flags, sizeof(cc770_obj_flags));
1205 +
1206 +diff --git a/drivers/net/can/cc770/cc770.h b/drivers/net/can/cc770/cc770.h
1207 +index a1739db98d91..95752e1d1283 100644
1208 +--- a/drivers/net/can/cc770/cc770.h
1209 ++++ b/drivers/net/can/cc770/cc770.h
1210 +@@ -193,6 +193,8 @@ struct cc770_priv {
1211 + u8 cpu_interface; /* CPU interface register */
1212 + u8 clkout; /* Clock out register */
1213 + u8 bus_config; /* Bus conffiguration register */
1214 ++
1215 ++ struct sk_buff *tx_skb;
1216 + };
1217 +
1218 + struct net_device *alloc_cc770dev(int sizeof_priv);
1219 +diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c
1220 +index c06ef438f23f..6c676403f823 100644
1221 +--- a/drivers/net/can/ifi_canfd/ifi_canfd.c
1222 ++++ b/drivers/net/can/ifi_canfd/ifi_canfd.c
1223 +@@ -30,6 +30,7 @@
1224 + #define IFI_CANFD_STCMD_ERROR_ACTIVE BIT(2)
1225 + #define IFI_CANFD_STCMD_ERROR_PASSIVE BIT(3)
1226 + #define IFI_CANFD_STCMD_BUSOFF BIT(4)
1227 ++#define IFI_CANFD_STCMD_ERROR_WARNING BIT(5)
1228 + #define IFI_CANFD_STCMD_BUSMONITOR BIT(16)
1229 + #define IFI_CANFD_STCMD_LOOPBACK BIT(18)
1230 + #define IFI_CANFD_STCMD_DISABLE_CANFD BIT(24)
1231 +@@ -52,7 +53,10 @@
1232 + #define IFI_CANFD_TXSTCMD_OVERFLOW BIT(13)
1233 +
1234 + #define IFI_CANFD_INTERRUPT 0xc
1235 ++#define IFI_CANFD_INTERRUPT_ERROR_BUSOFF BIT(0)
1236 + #define IFI_CANFD_INTERRUPT_ERROR_WARNING BIT(1)
1237 ++#define IFI_CANFD_INTERRUPT_ERROR_STATE_CHG BIT(2)
1238 ++#define IFI_CANFD_INTERRUPT_ERROR_REC_TEC_INC BIT(3)
1239 + #define IFI_CANFD_INTERRUPT_ERROR_COUNTER BIT(10)
1240 + #define IFI_CANFD_INTERRUPT_TXFIFO_EMPTY BIT(16)
1241 + #define IFI_CANFD_INTERRUPT_TXFIFO_REMOVE BIT(22)
1242 +@@ -61,6 +65,10 @@
1243 + #define IFI_CANFD_INTERRUPT_SET_IRQ ((u32)BIT(31))
1244 +
1245 + #define IFI_CANFD_IRQMASK 0x10
1246 ++#define IFI_CANFD_IRQMASK_ERROR_BUSOFF BIT(0)
1247 ++#define IFI_CANFD_IRQMASK_ERROR_WARNING BIT(1)
1248 ++#define IFI_CANFD_IRQMASK_ERROR_STATE_CHG BIT(2)
1249 ++#define IFI_CANFD_IRQMASK_ERROR_REC_TEC_INC BIT(3)
1250 + #define IFI_CANFD_IRQMASK_SET_ERR BIT(7)
1251 + #define IFI_CANFD_IRQMASK_SET_TS BIT(15)
1252 + #define IFI_CANFD_IRQMASK_TXFIFO_EMPTY BIT(16)
1253 +@@ -136,6 +144,8 @@
1254 + #define IFI_CANFD_SYSCLOCK 0x50
1255 +
1256 + #define IFI_CANFD_VER 0x54
1257 ++#define IFI_CANFD_VER_REV_MASK 0xff
1258 ++#define IFI_CANFD_VER_REV_MIN_SUPPORTED 0x15
1259 +
1260 + #define IFI_CANFD_IP_ID 0x58
1261 + #define IFI_CANFD_IP_ID_VALUE 0xD073CAFD
1262 +@@ -220,7 +230,10 @@ static void ifi_canfd_irq_enable(struct net_device *ndev, bool enable)
1263 +
1264 + if (enable) {
1265 + enirq = IFI_CANFD_IRQMASK_TXFIFO_EMPTY |
1266 +- IFI_CANFD_IRQMASK_RXFIFO_NEMPTY;
1267 ++ IFI_CANFD_IRQMASK_RXFIFO_NEMPTY |
1268 ++ IFI_CANFD_IRQMASK_ERROR_STATE_CHG |
1269 ++ IFI_CANFD_IRQMASK_ERROR_WARNING |
1270 ++ IFI_CANFD_IRQMASK_ERROR_BUSOFF;
1271 + if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
1272 + enirq |= IFI_CANFD_INTERRUPT_ERROR_COUNTER;
1273 + }
1274 +@@ -361,12 +374,13 @@ static int ifi_canfd_handle_lost_msg(struct net_device *ndev)
1275 + return 1;
1276 + }
1277 +
1278 +-static int ifi_canfd_handle_lec_err(struct net_device *ndev, const u32 errctr)
1279 ++static int ifi_canfd_handle_lec_err(struct net_device *ndev)
1280 + {
1281 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
1282 + struct net_device_stats *stats = &ndev->stats;
1283 + struct can_frame *cf;
1284 + struct sk_buff *skb;
1285 ++ u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR);
1286 + const u32 errmask = IFI_CANFD_ERROR_CTR_OVERLOAD_FIRST |
1287 + IFI_CANFD_ERROR_CTR_ACK_ERROR_FIRST |
1288 + IFI_CANFD_ERROR_CTR_BIT0_ERROR_FIRST |
1289 +@@ -449,6 +463,11 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
1290 +
1291 + switch (new_state) {
1292 + case CAN_STATE_ERROR_ACTIVE:
1293 ++ /* error active state */
1294 ++ priv->can.can_stats.error_warning++;
1295 ++ priv->can.state = CAN_STATE_ERROR_ACTIVE;
1296 ++ break;
1297 ++ case CAN_STATE_ERROR_WARNING:
1298 + /* error warning state */
1299 + priv->can.can_stats.error_warning++;
1300 + priv->can.state = CAN_STATE_ERROR_WARNING;
1301 +@@ -477,7 +496,7 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
1302 + ifi_canfd_get_berr_counter(ndev, &bec);
1303 +
1304 + switch (new_state) {
1305 +- case CAN_STATE_ERROR_ACTIVE:
1306 ++ case CAN_STATE_ERROR_WARNING:
1307 + /* error warning state */
1308 + cf->can_id |= CAN_ERR_CRTL;
1309 + cf->data[1] = (bec.txerr > bec.rxerr) ?
1310 +@@ -510,22 +529,21 @@ static int ifi_canfd_handle_state_change(struct net_device *ndev,
1311 + return 1;
1312 + }
1313 +
1314 +-static int ifi_canfd_handle_state_errors(struct net_device *ndev, u32 stcmd)
1315 ++static int ifi_canfd_handle_state_errors(struct net_device *ndev)
1316 + {
1317 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
1318 ++ u32 stcmd = readl(priv->base + IFI_CANFD_STCMD);
1319 + int work_done = 0;
1320 +- u32 isr;
1321 +
1322 +- /*
1323 +- * The ErrWarn condition is a little special, since the bit is
1324 +- * located in the INTERRUPT register instead of STCMD register.
1325 +- */
1326 +- isr = readl(priv->base + IFI_CANFD_INTERRUPT);
1327 +- if ((isr & IFI_CANFD_INTERRUPT_ERROR_WARNING) &&
1328 ++ if ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) &&
1329 ++ (priv->can.state != CAN_STATE_ERROR_ACTIVE)) {
1330 ++ netdev_dbg(ndev, "Error, entered active state\n");
1331 ++ work_done += ifi_canfd_handle_state_change(ndev,
1332 ++ CAN_STATE_ERROR_ACTIVE);
1333 ++ }
1334 ++
1335 ++ if ((stcmd & IFI_CANFD_STCMD_ERROR_WARNING) &&
1336 + (priv->can.state != CAN_STATE_ERROR_WARNING)) {
1337 +- /* Clear the interrupt */
1338 +- writel(IFI_CANFD_INTERRUPT_ERROR_WARNING,
1339 +- priv->base + IFI_CANFD_INTERRUPT);
1340 + netdev_dbg(ndev, "Error, entered warning state\n");
1341 + work_done += ifi_canfd_handle_state_change(ndev,
1342 + CAN_STATE_ERROR_WARNING);
1343 +@@ -552,18 +570,11 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota)
1344 + {
1345 + struct net_device *ndev = napi->dev;
1346 + struct ifi_canfd_priv *priv = netdev_priv(ndev);
1347 +- const u32 stcmd_state_mask = IFI_CANFD_STCMD_ERROR_PASSIVE |
1348 +- IFI_CANFD_STCMD_BUSOFF;
1349 +- int work_done = 0;
1350 +-
1351 +- u32 stcmd = readl(priv->base + IFI_CANFD_STCMD);
1352 + u32 rxstcmd = readl(priv->base + IFI_CANFD_RXSTCMD);
1353 +- u32 errctr = readl(priv->base + IFI_CANFD_ERROR_CTR);
1354 ++ int work_done = 0;
1355 +
1356 + /* Handle bus state changes */
1357 +- if ((stcmd & stcmd_state_mask) ||
1358 +- ((stcmd & IFI_CANFD_STCMD_ERROR_ACTIVE) == 0))
1359 +- work_done += ifi_canfd_handle_state_errors(ndev, stcmd);
1360 ++ work_done += ifi_canfd_handle_state_errors(ndev);
1361 +
1362 + /* Handle lost messages on RX */
1363 + if (rxstcmd & IFI_CANFD_RXSTCMD_OVERFLOW)
1364 +@@ -571,7 +582,7 @@ static int ifi_canfd_poll(struct napi_struct *napi, int quota)
1365 +
1366 + /* Handle lec errors on the bus */
1367 + if (priv->can.ctrlmode & CAN_CTRLMODE_BERR_REPORTING)
1368 +- work_done += ifi_canfd_handle_lec_err(ndev, errctr);
1369 ++ work_done += ifi_canfd_handle_lec_err(ndev);
1370 +
1371 + /* Handle normal messages on RX */
1372 + if (!(rxstcmd & IFI_CANFD_RXSTCMD_EMPTY))
1373 +@@ -592,12 +603,13 @@ static irqreturn_t ifi_canfd_isr(int irq, void *dev_id)
1374 + struct net_device_stats *stats = &ndev->stats;
1375 + const u32 rx_irq_mask = IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY |
1376 + IFI_CANFD_INTERRUPT_RXFIFO_NEMPTY_PER |
1377 ++ IFI_CANFD_INTERRUPT_ERROR_COUNTER |
1378 ++ IFI_CANFD_INTERRUPT_ERROR_STATE_CHG |
1379 + IFI_CANFD_INTERRUPT_ERROR_WARNING |
1380 +- IFI_CANFD_INTERRUPT_ERROR_COUNTER;
1381 ++ IFI_CANFD_INTERRUPT_ERROR_BUSOFF;
1382 + const u32 tx_irq_mask = IFI_CANFD_INTERRUPT_TXFIFO_EMPTY |
1383 + IFI_CANFD_INTERRUPT_TXFIFO_REMOVE;
1384 +- const u32 clr_irq_mask = ~((u32)(IFI_CANFD_INTERRUPT_SET_IRQ |
1385 +- IFI_CANFD_INTERRUPT_ERROR_WARNING));
1386 ++ const u32 clr_irq_mask = ~((u32)IFI_CANFD_INTERRUPT_SET_IRQ);
1387 + u32 isr;
1388 +
1389 + isr = readl(priv->base + IFI_CANFD_INTERRUPT);
1390 +@@ -933,7 +945,7 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
1391 + struct resource *res;
1392 + void __iomem *addr;
1393 + int irq, ret;
1394 +- u32 id;
1395 ++ u32 id, rev;
1396 +
1397 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1398 + addr = devm_ioremap_resource(dev, res);
1399 +@@ -947,6 +959,13 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev)
1400 + return -EINVAL;
1401 + }
1402 +
1403 ++ rev = readl(addr + IFI_CANFD_VER) & IFI_CANFD_VER_REV_MASK;
1404 ++ if (rev < IFI_CANFD_VER_REV_MIN_SUPPORTED) {
1405 ++ dev_err(dev, "This block is too old (rev %i), minimum supported is rev %i\n",
1406 ++ rev, IFI_CANFD_VER_REV_MIN_SUPPORTED);
1407 ++ return -EINVAL;
1408 ++ }
1409 ++
1410 + ndev = alloc_candev(sizeof(*priv), 1);
1411 + if (!ndev)
1412 + return -ENOMEM;
1413 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
1414 +index 85d949e03f79..f78d91b69287 100644
1415 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
1416 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
1417 +@@ -462,25 +462,23 @@ static int brcmf_p2p_set_firmware(struct brcmf_if *ifp, u8 *p2p_mac)
1418 + * @dev_addr: optional device address.
1419 + *
1420 + * P2P needs mac addresses for P2P device and interface. If no device
1421 +- * address it specified, these are derived from the primary net device, ie.
1422 +- * the permanent ethernet address of the device.
1423 ++ * address it specified, these are derived from a random ethernet
1424 ++ * address.
1425 + */
1426 + static void brcmf_p2p_generate_bss_mac(struct brcmf_p2p_info *p2p, u8 *dev_addr)
1427 + {
1428 +- struct brcmf_if *pri_ifp = p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif->ifp;
1429 +- bool local_admin = false;
1430 ++ bool random_addr = false;
1431 +
1432 +- if (!dev_addr || is_zero_ether_addr(dev_addr)) {
1433 +- dev_addr = pri_ifp->mac_addr;
1434 +- local_admin = true;
1435 +- }
1436 ++ if (!dev_addr || is_zero_ether_addr(dev_addr))
1437 ++ random_addr = true;
1438 +
1439 +- /* Generate the P2P Device Address. This consists of the device's
1440 +- * primary MAC address with the locally administered bit set.
1441 ++ /* Generate the P2P Device Address obtaining a random ethernet
1442 ++ * address with the locally administered bit set.
1443 + */
1444 +- memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
1445 +- if (local_admin)
1446 +- p2p->dev_addr[0] |= 0x02;
1447 ++ if (random_addr)
1448 ++ eth_random_addr(p2p->dev_addr);
1449 ++ else
1450 ++ memcpy(p2p->dev_addr, dev_addr, ETH_ALEN);
1451 +
1452 + /* Generate the P2P Interface Address. If the discovery and connection
1453 + * BSSCFGs need to simultaneously co-exist, then this address must be
1454 +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1455 +index aba60c3145c5..618e509e75d6 100644
1456 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1457 ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/hw.c
1458 +@@ -1125,7 +1125,8 @@ static void _rtl8723be_enable_aspm_back_door(struct ieee80211_hw *hw)
1459 +
1460 + /* Configuration Space offset 0x70f BIT7 is used to control L0S */
1461 + tmp8 = _rtl8723be_dbi_read(rtlpriv, 0x70f);
1462 +- _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7));
1463 ++ _rtl8723be_dbi_write(rtlpriv, 0x70f, tmp8 | BIT(7) |
1464 ++ ASPM_L1_LATENCY << 3);
1465 +
1466 + /* Configuration Space offset 0x719 Bit3 is for L1
1467 + * BIT4 is for clock request
1468 +diff --git a/drivers/nvdimm/blk.c b/drivers/nvdimm/blk.c
1469 +index 9faaa9694d87..77db9795510f 100644
1470 +--- a/drivers/nvdimm/blk.c
1471 ++++ b/drivers/nvdimm/blk.c
1472 +@@ -286,8 +286,6 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
1473 + disk->queue = q;
1474 + disk->flags = GENHD_FL_EXT_DEVT;
1475 + nvdimm_namespace_disk_name(&nsblk->common, disk->disk_name);
1476 +- set_capacity(disk, 0);
1477 +- device_add_disk(dev, disk);
1478 +
1479 + if (devm_add_action_or_reset(dev, nd_blk_release_disk, disk))
1480 + return -ENOMEM;
1481 +@@ -300,6 +298,7 @@ static int nsblk_attach_disk(struct nd_namespace_blk *nsblk)
1482 + }
1483 +
1484 + set_capacity(disk, available_disk_size >> SECTOR_SHIFT);
1485 ++ device_add_disk(dev, disk);
1486 + revalidate_disk(disk);
1487 + return 0;
1488 + }
1489 +diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
1490 +index 7121453ec047..0c46ada027cf 100644
1491 +--- a/drivers/nvdimm/btt.c
1492 ++++ b/drivers/nvdimm/btt.c
1493 +@@ -1392,8 +1392,6 @@ static int btt_blk_init(struct btt *btt)
1494 + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, btt->btt_queue);
1495 + btt->btt_queue->queuedata = btt;
1496 +
1497 +- set_capacity(btt->btt_disk, 0);
1498 +- device_add_disk(&btt->nd_btt->dev, btt->btt_disk);
1499 + if (btt_meta_size(btt)) {
1500 + int rc = nd_integrity_init(btt->btt_disk, btt_meta_size(btt));
1501 +
1502 +@@ -1405,6 +1403,7 @@ static int btt_blk_init(struct btt *btt)
1503 + }
1504 + }
1505 + set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9);
1506 ++ device_add_disk(&btt->nd_btt->dev, btt->btt_disk);
1507 + btt->nd_btt->size = btt->nlba * (u64)btt->sector_size;
1508 + revalidate_disk(btt->btt_disk);
1509 +
1510 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1511 +index 4c9fb8b323e8..fb177dc576d6 100644
1512 +--- a/drivers/pci/quirks.c
1513 ++++ b/drivers/pci/quirks.c
1514 +@@ -3877,6 +3877,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9230,
1515 + quirk_dma_func1_alias);
1516 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0642,
1517 + quirk_dma_func1_alias);
1518 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TTI, 0x0645,
1519 ++ quirk_dma_func1_alias);
1520 + /* https://bugs.gentoo.org/show_bug.cgi?id=497630 */
1521 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
1522 + PCI_DEVICE_ID_JMICRON_JMB388_ESD,
1523 +diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c
1524 +index a7416cd9ac71..7b0587d8b176 100644
1525 +--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
1526 ++++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
1527 +@@ -838,7 +838,7 @@ void sptlrpc_request_out_callback(struct ptlrpc_request *req)
1528 + if (req->rq_pool || !req->rq_reqbuf)
1529 + return;
1530 +
1531 +- kfree(req->rq_reqbuf);
1532 ++ kvfree(req->rq_reqbuf);
1533 + req->rq_reqbuf = NULL;
1534 + req->rq_reqbuf_len = 0;
1535 + }
1536 +diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
1537 +index ce2c3c6349d4..68c7bb0b7991 100644
1538 +--- a/drivers/tty/vt/vt.c
1539 ++++ b/drivers/tty/vt/vt.c
1540 +@@ -1727,7 +1727,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
1541 + default_attr(vc);
1542 + update_attr(vc);
1543 +
1544 +- vc->vc_tab_stop[0] = 0x01010100;
1545 ++ vc->vc_tab_stop[0] =
1546 + vc->vc_tab_stop[1] =
1547 + vc->vc_tab_stop[2] =
1548 + vc->vc_tab_stop[3] =
1549 +@@ -1771,7 +1771,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1550 + vc->vc_pos -= (vc->vc_x << 1);
1551 + while (vc->vc_x < vc->vc_cols - 1) {
1552 + vc->vc_x++;
1553 +- if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31)))
1554 ++ if (vc->vc_tab_stop[7 & (vc->vc_x >> 5)] & (1 << (vc->vc_x & 31)))
1555 + break;
1556 + }
1557 + vc->vc_pos += (vc->vc_x << 1);
1558 +@@ -1831,7 +1831,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1559 + lf(vc);
1560 + return;
1561 + case 'H':
1562 +- vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31));
1563 ++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] |= (1 << (vc->vc_x & 31));
1564 + return;
1565 + case 'Z':
1566 + respond_ID(tty);
1567 +@@ -2024,7 +2024,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1568 + return;
1569 + case 'g':
1570 + if (!vc->vc_par[0])
1571 +- vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31));
1572 ++ vc->vc_tab_stop[7 & (vc->vc_x >> 5)] &= ~(1 << (vc->vc_x & 31));
1573 + else if (vc->vc_par[0] == 3) {
1574 + vc->vc_tab_stop[0] =
1575 + vc->vc_tab_stop[1] =
1576 +diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
1577 +index 6d1fbda0f461..0da9943d405f 100644
1578 +--- a/drivers/watchdog/wdat_wdt.c
1579 ++++ b/drivers/watchdog/wdat_wdt.c
1580 +@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
1581 +
1582 + memset(&r, 0, sizeof(r));
1583 + r.start = gas->address;
1584 +- r.end = r.start + gas->access_width;
1585 ++ r.end = r.start + gas->access_width - 1;
1586 + if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
1587 + r.flags = IORESOURCE_MEM;
1588 + } else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
1589 +diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
1590 +index 88dbbc9fcf4d..f571570a2e72 100644
1591 +--- a/fs/ncpfs/ncplib_kernel.c
1592 ++++ b/fs/ncpfs/ncplib_kernel.c
1593 +@@ -980,6 +980,10 @@ ncp_read_kernel(struct ncp_server *server, const char *file_id,
1594 + goto out;
1595 + }
1596 + *bytes_read = ncp_reply_be16(server, 0);
1597 ++ if (*bytes_read > to_read) {
1598 ++ result = -EINVAL;
1599 ++ goto out;
1600 ++ }
1601 + source = ncp_reply_data(server, 2 + (offset & 1));
1602 +
1603 + memcpy(target, source, *bytes_read);
1604 +diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1605 +index f463c4e0b2ea..12d780718b48 100644
1606 +--- a/fs/nfsd/nfs4state.c
1607 ++++ b/fs/nfsd/nfs4state.c
1608 +@@ -263,6 +263,35 @@ free_blocked_lock(struct nfsd4_blocked_lock *nbl)
1609 + kfree(nbl);
1610 + }
1611 +
1612 ++static void
1613 ++remove_blocked_locks(struct nfs4_lockowner *lo)
1614 ++{
1615 ++ struct nfs4_client *clp = lo->lo_owner.so_client;
1616 ++ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
1617 ++ struct nfsd4_blocked_lock *nbl;
1618 ++ LIST_HEAD(reaplist);
1619 ++
1620 ++ /* Dequeue all blocked locks */
1621 ++ spin_lock(&nn->blocked_locks_lock);
1622 ++ while (!list_empty(&lo->lo_blocked)) {
1623 ++ nbl = list_first_entry(&lo->lo_blocked,
1624 ++ struct nfsd4_blocked_lock,
1625 ++ nbl_list);
1626 ++ list_del_init(&nbl->nbl_list);
1627 ++ list_move(&nbl->nbl_lru, &reaplist);
1628 ++ }
1629 ++ spin_unlock(&nn->blocked_locks_lock);
1630 ++
1631 ++ /* Now free them */
1632 ++ while (!list_empty(&reaplist)) {
1633 ++ nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock,
1634 ++ nbl_lru);
1635 ++ list_del_init(&nbl->nbl_lru);
1636 ++ posix_unblock_lock(&nbl->nbl_lock);
1637 ++ free_blocked_lock(nbl);
1638 ++ }
1639 ++}
1640 ++
1641 + static int
1642 + nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task)
1643 + {
1644 +@@ -1854,6 +1883,7 @@ static __be32 mark_client_expired_locked(struct nfs4_client *clp)
1645 + static void
1646 + __destroy_client(struct nfs4_client *clp)
1647 + {
1648 ++ int i;
1649 + struct nfs4_openowner *oo;
1650 + struct nfs4_delegation *dp;
1651 + struct list_head reaplist;
1652 +@@ -1883,6 +1913,16 @@ __destroy_client(struct nfs4_client *clp)
1653 + nfs4_get_stateowner(&oo->oo_owner);
1654 + release_openowner(oo);
1655 + }
1656 ++ for (i = 0; i < OWNER_HASH_SIZE; i++) {
1657 ++ struct nfs4_stateowner *so, *tmp;
1658 ++
1659 ++ list_for_each_entry_safe(so, tmp, &clp->cl_ownerstr_hashtbl[i],
1660 ++ so_strhash) {
1661 ++ /* Should be no openowners at this point */
1662 ++ WARN_ON_ONCE(so->so_is_open_owner);
1663 ++ remove_blocked_locks(lockowner(so));
1664 ++ }
1665 ++ }
1666 + nfsd4_return_all_client_layouts(clp);
1667 + nfsd4_shutdown_callback(clp);
1668 + if (clp->cl_cb_conn.cb_xprt)
1669 +@@ -6266,6 +6306,7 @@ nfsd4_release_lockowner(struct svc_rqst *rqstp,
1670 + }
1671 + spin_unlock(&clp->cl_lock);
1672 + free_ol_stateid_reaplist(&reaplist);
1673 ++ remove_blocked_locks(lo);
1674 + nfs4_put_stateowner(&lo->lo_owner);
1675 +
1676 + return status;
1677 +@@ -7051,6 +7092,8 @@ nfs4_state_destroy_net(struct net *net)
1678 + }
1679 + }
1680 +
1681 ++ WARN_ON(!list_empty(&nn->blocked_locks_lru));
1682 ++
1683 + for (i = 0; i < CLIENT_HASH_SIZE; i++) {
1684 + while (!list_empty(&nn->unconf_id_hashtbl[i])) {
1685 + clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash);
1686 +@@ -7117,7 +7160,6 @@ nfs4_state_shutdown_net(struct net *net)
1687 + struct nfs4_delegation *dp = NULL;
1688 + struct list_head *pos, *next, reaplist;
1689 + struct nfsd_net *nn = net_generic(net, nfsd_net_id);
1690 +- struct nfsd4_blocked_lock *nbl;
1691 +
1692 + cancel_delayed_work_sync(&nn->laundromat_work);
1693 + locks_end_grace(&nn->nfsd4_manager);
1694 +@@ -7138,24 +7180,6 @@ nfs4_state_shutdown_net(struct net *net)
1695 + nfs4_put_stid(&dp->dl_stid);
1696 + }
1697 +
1698 +- BUG_ON(!list_empty(&reaplist));
1699 +- spin_lock(&nn->blocked_locks_lock);
1700 +- while (!list_empty(&nn->blocked_locks_lru)) {
1701 +- nbl = list_first_entry(&nn->blocked_locks_lru,
1702 +- struct nfsd4_blocked_lock, nbl_lru);
1703 +- list_move(&nbl->nbl_lru, &reaplist);
1704 +- list_del_init(&nbl->nbl_list);
1705 +- }
1706 +- spin_unlock(&nn->blocked_locks_lock);
1707 +-
1708 +- while (!list_empty(&reaplist)) {
1709 +- nbl = list_first_entry(&reaplist,
1710 +- struct nfsd4_blocked_lock, nbl_lru);
1711 +- list_del_init(&nbl->nbl_lru);
1712 +- posix_unblock_lock(&nbl->nbl_lock);
1713 +- free_blocked_lock(nbl);
1714 +- }
1715 +-
1716 + nfsd4_client_tracking_exit(net);
1717 + nfs4_state_destroy_net(net);
1718 + }
1719 +diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
1720 +index c4f8fd2fd384..f6ea0f3c03f8 100644
1721 +--- a/include/asm-generic/pgtable.h
1722 ++++ b/include/asm-generic/pgtable.h
1723 +@@ -764,6 +764,8 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot);
1724 + int pmd_set_huge(pmd_t *pmd, phys_addr_t addr, pgprot_t prot);
1725 + int pud_clear_huge(pud_t *pud);
1726 + int pmd_clear_huge(pmd_t *pmd);
1727 ++int pud_free_pmd_page(pud_t *pud);
1728 ++int pmd_free_pte_page(pmd_t *pmd);
1729 + #else /* !CONFIG_HAVE_ARCH_HUGE_VMAP */
1730 + static inline int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot)
1731 + {
1732 +@@ -781,6 +783,14 @@ static inline int pmd_clear_huge(pmd_t *pmd)
1733 + {
1734 + return 0;
1735 + }
1736 ++static inline int pud_free_pmd_page(pud_t *pud)
1737 ++{
1738 ++ return 0;
1739 ++}
1740 ++static inline int pmd_free_pte_page(pmd_t *pmd)
1741 ++{
1742 ++ return 0;
1743 ++}
1744 + #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */
1745 +
1746 + #ifndef __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
1747 +diff --git a/include/linux/fsl_ifc.h b/include/linux/fsl_ifc.h
1748 +index c332f0a45607..3fdfede2f0f3 100644
1749 +--- a/include/linux/fsl_ifc.h
1750 ++++ b/include/linux/fsl_ifc.h
1751 +@@ -734,11 +734,7 @@ struct fsl_ifc_nand {
1752 + u32 res19[0x10];
1753 + __be32 nand_fsr;
1754 + u32 res20;
1755 +- /* The V1 nand_eccstat is actually 4 words that overlaps the
1756 +- * V2 nand_eccstat.
1757 +- */
1758 +- __be32 v1_nand_eccstat[2];
1759 +- __be32 v2_nand_eccstat[6];
1760 ++ __be32 nand_eccstat[8];
1761 + u32 res21[0x1c];
1762 + __be32 nanndcr;
1763 + u32 res22[0x2];
1764 +diff --git a/include/uapi/linux/usb/audio.h b/include/uapi/linux/usb/audio.h
1765 +index d2314be4f0c0..19f9dc2c06f6 100644
1766 +--- a/include/uapi/linux/usb/audio.h
1767 ++++ b/include/uapi/linux/usb/audio.h
1768 +@@ -369,7 +369,7 @@ static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_d
1769 + {
1770 + return (protocol == UAC_VERSION_1) ?
1771 + desc->baSourceID[desc->bNrInPins + 4] :
1772 +- desc->baSourceID[desc->bNrInPins + 6];
1773 ++ 2; /* in UAC2, this value is constant */
1774 + }
1775 +
1776 + static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
1777 +@@ -377,7 +377,7 @@ static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_de
1778 + {
1779 + return (protocol == UAC_VERSION_1) ?
1780 + &desc->baSourceID[desc->bNrInPins + 5] :
1781 +- &desc->baSourceID[desc->bNrInPins + 7];
1782 ++ &desc->baSourceID[desc->bNrInPins + 6];
1783 + }
1784 +
1785 + static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
1786 +diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
1787 +index 91a2d3752007..f8b4e3e16cef 100644
1788 +--- a/kernel/bpf/syscall.c
1789 ++++ b/kernel/bpf/syscall.c
1790 +@@ -801,7 +801,7 @@ SYSCALL_DEFINE3(bpf, int, cmd, union bpf_attr __user *, uattr, unsigned int, siz
1791 + union bpf_attr attr = {};
1792 + int err;
1793 +
1794 +- if (!capable(CAP_SYS_ADMIN) && sysctl_unprivileged_bpf_disabled)
1795 ++ if (sysctl_unprivileged_bpf_disabled && !capable(CAP_SYS_ADMIN))
1796 + return -EPERM;
1797 +
1798 + if (!access_ok(VERIFY_READ, uattr, 1))
1799 +diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
1800 +index 5ff45cae4ac4..ea3ed03fed7e 100644
1801 +--- a/kernel/trace/trace_kprobe.c
1802 ++++ b/kernel/trace/trace_kprobe.c
1803 +@@ -607,7 +607,7 @@ static int create_trace_kprobe(int argc, char **argv)
1804 + bool is_return = false, is_delete = false;
1805 + char *symbol = NULL, *event = NULL, *group = NULL;
1806 + char *arg;
1807 +- unsigned long offset = 0;
1808 ++ long offset = 0;
1809 + void *addr = NULL;
1810 + char buf[MAX_EVENT_NAME_LEN];
1811 +
1812 +@@ -675,7 +675,7 @@ static int create_trace_kprobe(int argc, char **argv)
1813 + symbol = argv[1];
1814 + /* TODO: support .init module functions */
1815 + ret = traceprobe_split_symbol_offset(symbol, &offset);
1816 +- if (ret) {
1817 ++ if (ret || offset < 0 || offset > UINT_MAX) {
1818 + pr_info("Failed to parse either an address or a symbol.\n");
1819 + return ret;
1820 + }
1821 +diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
1822 +index 8c0553d9afd3..5ea191b917e9 100644
1823 +--- a/kernel/trace/trace_probe.c
1824 ++++ b/kernel/trace/trace_probe.c
1825 +@@ -319,7 +319,7 @@ static fetch_func_t get_fetch_size_function(const struct fetch_type *type,
1826 + }
1827 +
1828 + /* Split symbol and offset. */
1829 +-int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset)
1830 ++int traceprobe_split_symbol_offset(char *symbol, long *offset)
1831 + {
1832 + char *tmp;
1833 + int ret;
1834 +@@ -327,13 +327,11 @@ int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset)
1835 + if (!offset)
1836 + return -EINVAL;
1837 +
1838 +- tmp = strchr(symbol, '+');
1839 ++ tmp = strpbrk(symbol, "+-");
1840 + if (tmp) {
1841 +- /* skip sign because kstrtoul doesn't accept '+' */
1842 +- ret = kstrtoul(tmp + 1, 0, offset);
1843 ++ ret = kstrtol(tmp, 0, offset);
1844 + if (ret)
1845 + return ret;
1846 +-
1847 + *tmp = '\0';
1848 + } else
1849 + *offset = 0;
1850 +diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
1851 +index 0c0ae54d44c6..2b84c0de92c7 100644
1852 +--- a/kernel/trace/trace_probe.h
1853 ++++ b/kernel/trace/trace_probe.h
1854 +@@ -354,7 +354,7 @@ extern int traceprobe_conflict_field_name(const char *name,
1855 + extern void traceprobe_update_arg(struct probe_arg *arg);
1856 + extern void traceprobe_free_probe_arg(struct probe_arg *arg);
1857 +
1858 +-extern int traceprobe_split_symbol_offset(char *symbol, unsigned long *offset);
1859 ++extern int traceprobe_split_symbol_offset(char *symbol, long *offset);
1860 +
1861 + extern ssize_t traceprobe_probes_write(struct file *file,
1862 + const char __user *buffer, size_t count, loff_t *ppos,
1863 +diff --git a/lib/ioremap.c b/lib/ioremap.c
1864 +index 86c8911b0e3a..5323b59ca393 100644
1865 +--- a/lib/ioremap.c
1866 ++++ b/lib/ioremap.c
1867 +@@ -83,7 +83,8 @@ static inline int ioremap_pmd_range(pud_t *pud, unsigned long addr,
1868 +
1869 + if (ioremap_pmd_enabled() &&
1870 + ((next - addr) == PMD_SIZE) &&
1871 +- IS_ALIGNED(phys_addr + addr, PMD_SIZE)) {
1872 ++ IS_ALIGNED(phys_addr + addr, PMD_SIZE) &&
1873 ++ pmd_free_pte_page(pmd)) {
1874 + if (pmd_set_huge(pmd, phys_addr + addr, prot))
1875 + continue;
1876 + }
1877 +@@ -109,7 +110,8 @@ static inline int ioremap_pud_range(pgd_t *pgd, unsigned long addr,
1878 +
1879 + if (ioremap_pud_enabled() &&
1880 + ((next - addr) == PUD_SIZE) &&
1881 +- IS_ALIGNED(phys_addr + addr, PUD_SIZE)) {
1882 ++ IS_ALIGNED(phys_addr + addr, PUD_SIZE) &&
1883 ++ pud_free_pmd_page(pud)) {
1884 + if (pud_set_huge(pud, phys_addr + addr, prot))
1885 + continue;
1886 + }
1887 +diff --git a/mm/huge_memory.c b/mm/huge_memory.c
1888 +index c234c078693c..e2982ea26090 100644
1889 +--- a/mm/huge_memory.c
1890 ++++ b/mm/huge_memory.c
1891 +@@ -2279,11 +2279,13 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
1892 +
1893 + list_for_each_safe(pos, next, &list) {
1894 + page = list_entry((void *)pos, struct page, mapping);
1895 +- lock_page(page);
1896 ++ if (!trylock_page(page))
1897 ++ goto next;
1898 + /* split_huge_page() removes page from list on success */
1899 + if (!split_huge_page(page))
1900 + split++;
1901 + unlock_page(page);
1902 ++next:
1903 + put_page(page);
1904 + }
1905 +
1906 +diff --git a/mm/khugepaged.c b/mm/khugepaged.c
1907 +index 5d7c006373d3..898eb26f5dc8 100644
1908 +--- a/mm/khugepaged.c
1909 ++++ b/mm/khugepaged.c
1910 +@@ -528,7 +528,12 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
1911 + goto out;
1912 + }
1913 +
1914 +- VM_BUG_ON_PAGE(PageCompound(page), page);
1915 ++ /* TODO: teach khugepaged to collapse THP mapped with pte */
1916 ++ if (PageCompound(page)) {
1917 ++ result = SCAN_PAGE_COMPOUND;
1918 ++ goto out;
1919 ++ }
1920 ++
1921 + VM_BUG_ON_PAGE(!PageAnon(page), page);
1922 + VM_BUG_ON_PAGE(!PageSwapBacked(page), page);
1923 +
1924 +diff --git a/mm/shmem.c b/mm/shmem.c
1925 +index 2123bfc39ef2..42ca5df2c0e3 100644
1926 +--- a/mm/shmem.c
1927 ++++ b/mm/shmem.c
1928 +@@ -466,36 +466,45 @@ static unsigned long shmem_unused_huge_shrink(struct shmem_sb_info *sbinfo,
1929 + info = list_entry(pos, struct shmem_inode_info, shrinklist);
1930 + inode = &info->vfs_inode;
1931 +
1932 +- if (nr_to_split && split >= nr_to_split) {
1933 +- iput(inode);
1934 +- continue;
1935 +- }
1936 ++ if (nr_to_split && split >= nr_to_split)
1937 ++ goto leave;
1938 +
1939 +- page = find_lock_page(inode->i_mapping,
1940 ++ page = find_get_page(inode->i_mapping,
1941 + (inode->i_size & HPAGE_PMD_MASK) >> PAGE_SHIFT);
1942 + if (!page)
1943 + goto drop;
1944 +
1945 ++ /* No huge page at the end of the file: nothing to split */
1946 + if (!PageTransHuge(page)) {
1947 +- unlock_page(page);
1948 + put_page(page);
1949 + goto drop;
1950 + }
1951 +
1952 ++ /*
1953 ++ * Leave the inode on the list if we failed to lock
1954 ++ * the page at this time.
1955 ++ *
1956 ++ * Waiting for the lock may lead to deadlock in the
1957 ++ * reclaim path.
1958 ++ */
1959 ++ if (!trylock_page(page)) {
1960 ++ put_page(page);
1961 ++ goto leave;
1962 ++ }
1963 ++
1964 + ret = split_huge_page(page);
1965 + unlock_page(page);
1966 + put_page(page);
1967 +
1968 +- if (ret) {
1969 +- /* split failed: leave it on the list */
1970 +- iput(inode);
1971 +- continue;
1972 +- }
1973 ++ /* If split failed leave the inode on the list */
1974 ++ if (ret)
1975 ++ goto leave;
1976 +
1977 + split++;
1978 + drop:
1979 + list_del_init(&info->shrinklist);
1980 + removed++;
1981 ++leave:
1982 + iput(inode);
1983 + }
1984 +
1985 +diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
1986 +index cbd20cb8ca11..dc91002d1e0d 100644
1987 +--- a/sound/drivers/aloop.c
1988 ++++ b/sound/drivers/aloop.c
1989 +@@ -192,6 +192,11 @@ static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
1990 + dpcm->timer.expires = 0;
1991 + }
1992 +
1993 ++static inline void loopback_timer_stop_sync(struct loopback_pcm *dpcm)
1994 ++{
1995 ++ del_timer_sync(&dpcm->timer);
1996 ++}
1997 ++
1998 + #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
1999 + #define CABLE_VALID_CAPTURE (1 << SNDRV_PCM_STREAM_CAPTURE)
2000 + #define CABLE_VALID_BOTH (CABLE_VALID_PLAYBACK|CABLE_VALID_CAPTURE)
2001 +@@ -326,6 +331,8 @@ static int loopback_prepare(struct snd_pcm_substream *substream)
2002 + struct loopback_cable *cable = dpcm->cable;
2003 + int bps, salign;
2004 +
2005 ++ loopback_timer_stop_sync(dpcm);
2006 ++
2007 + salign = (snd_pcm_format_width(runtime->format) *
2008 + runtime->channels) / 8;
2009 + bps = salign * runtime->rate;
2010 +@@ -659,7 +666,9 @@ static void free_cable(struct snd_pcm_substream *substream)
2011 + return;
2012 + if (cable->streams[!substream->stream]) {
2013 + /* other stream is still alive */
2014 ++ spin_lock_irq(&cable->lock);
2015 + cable->streams[substream->stream] = NULL;
2016 ++ spin_unlock_irq(&cable->lock);
2017 + } else {
2018 + /* free the cable */
2019 + loopback->cables[substream->number][dev] = NULL;
2020 +@@ -699,7 +708,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
2021 + loopback->cables[substream->number][dev] = cable;
2022 + }
2023 + dpcm->cable = cable;
2024 +- cable->streams[substream->stream] = dpcm;
2025 +
2026 + snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
2027 +
2028 +@@ -731,6 +739,11 @@ static int loopback_open(struct snd_pcm_substream *substream)
2029 + runtime->hw = loopback_pcm_hardware;
2030 + else
2031 + runtime->hw = cable->hw;
2032 ++
2033 ++ spin_lock_irq(&cable->lock);
2034 ++ cable->streams[substream->stream] = dpcm;
2035 ++ spin_unlock_irq(&cable->lock);
2036 ++
2037 + unlock:
2038 + if (err < 0) {
2039 + free_cable(substream);
2040 +@@ -745,7 +758,7 @@ static int loopback_close(struct snd_pcm_substream *substream)
2041 + struct loopback *loopback = substream->private_data;
2042 + struct loopback_pcm *dpcm = substream->runtime->private_data;
2043 +
2044 +- loopback_timer_stop(dpcm);
2045 ++ loopback_timer_stop_sync(dpcm);
2046 + mutex_lock(&loopback->cable_lock);
2047 + free_cable(substream);
2048 + mutex_unlock(&loopback->cable_lock);
2049 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2050 +index dae0021f39c3..e2230bed7409 100644
2051 +--- a/sound/pci/hda/patch_realtek.c
2052 ++++ b/sound/pci/hda/patch_realtek.c
2053 +@@ -3261,8 +3261,12 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
2054 + pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
2055 + pinval &= ~AC_PINCTL_VREFEN;
2056 + pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
2057 +- if (spec->mute_led_nid)
2058 ++ if (spec->mute_led_nid) {
2059 ++ /* temporarily power up/down for setting VREF */
2060 ++ snd_hda_power_up_pm(codec);
2061 + snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
2062 ++ snd_hda_power_down_pm(codec);
2063 ++ }
2064 + }
2065 +
2066 + /* Make sure the led works even in runtime suspend */
2067 +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
2068 +index 5b60ec669e73..68861e81f06c 100644
2069 +--- a/tools/perf/builtin-stat.c
2070 ++++ b/tools/perf/builtin-stat.c
2071 +@@ -876,7 +876,7 @@ static void print_metric_csv(void *ctx,
2072 + char buf[64], *vals, *ends;
2073 +
2074 + if (unit == NULL || fmt == NULL) {
2075 +- fprintf(out, "%s%s%s%s", csv_sep, csv_sep, csv_sep, csv_sep);
2076 ++ fprintf(out, "%s%s", csv_sep, csv_sep);
2077 + return;
2078 + }
2079 + snprintf(buf, sizeof(buf), fmt, val);
2080 +diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile
2081 +index 6eb50152baf0..e5b459a09cff 100644
2082 +--- a/tools/testing/selftests/x86/Makefile
2083 ++++ b/tools/testing/selftests/x86/Makefile
2084 +@@ -17,7 +17,7 @@ TARGETS_C_64BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_64BIT_ONLY)
2085 + BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
2086 + BINARIES_64 := $(TARGETS_C_64BIT_ALL:%=%_64)
2087 +
2088 +-CFLAGS := -O2 -g -std=gnu99 -pthread -Wall
2089 ++CFLAGS := -O2 -g -std=gnu99 -pthread -Wall -no-pie
2090 +
2091 + UNAME_M := $(shell uname -m)
2092 + CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32)
2093 +diff --git a/tools/testing/selftests/x86/mpx-mini-test.c b/tools/testing/selftests/x86/mpx-mini-test.c
2094 +index 79e1d13d1cda..58384189370c 100644
2095 +--- a/tools/testing/selftests/x86/mpx-mini-test.c
2096 ++++ b/tools/testing/selftests/x86/mpx-mini-test.c
2097 +@@ -419,8 +419,7 @@ void handler(int signum, siginfo_t *si, void *vucontext)
2098 + br_count++;
2099 + dprintf1("#BR 0x%jx (total seen: %d)\n", status, br_count);
2100 +
2101 +-#define __SI_FAULT (3 << 16)
2102 +-#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */
2103 ++#define SEGV_BNDERR 3 /* failed address bound checks */
2104 +
2105 + dprintf2("Saw a #BR! status 0x%jx at %016lx br_reason: %jx\n",
2106 + status, ip, br_reason);
2107 +diff --git a/tools/testing/selftests/x86/protection_keys.c b/tools/testing/selftests/x86/protection_keys.c
2108 +index 2842a5fa22b3..85a78eba0a93 100644
2109 +--- a/tools/testing/selftests/x86/protection_keys.c
2110 ++++ b/tools/testing/selftests/x86/protection_keys.c
2111 +@@ -188,17 +188,29 @@ void lots_o_noops_around_write(int *write_to_me)
2112 + #define u64 uint64_t
2113 +
2114 + #ifdef __i386__
2115 +-#define SYS_mprotect_key 380
2116 +-#define SYS_pkey_alloc 381
2117 +-#define SYS_pkey_free 382
2118 ++
2119 ++#ifndef SYS_mprotect_key
2120 ++# define SYS_mprotect_key 380
2121 ++#endif
2122 ++#ifndef SYS_pkey_alloc
2123 ++# define SYS_pkey_alloc 381
2124 ++# define SYS_pkey_free 382
2125 ++#endif
2126 + #define REG_IP_IDX REG_EIP
2127 +-#define si_pkey_offset 0x18
2128 ++#define si_pkey_offset 0x14
2129 ++
2130 + #else
2131 +-#define SYS_mprotect_key 329
2132 +-#define SYS_pkey_alloc 330
2133 +-#define SYS_pkey_free 331
2134 ++
2135 ++#ifndef SYS_mprotect_key
2136 ++# define SYS_mprotect_key 329
2137 ++#endif
2138 ++#ifndef SYS_pkey_alloc
2139 ++# define SYS_pkey_alloc 330
2140 ++# define SYS_pkey_free 331
2141 ++#endif
2142 + #define REG_IP_IDX REG_RIP
2143 + #define si_pkey_offset 0x20
2144 ++
2145 + #endif
2146 +
2147 + void dump_mem(void *dumpme, int len_bytes)
2148 +@@ -212,19 +224,18 @@ void dump_mem(void *dumpme, int len_bytes)
2149 + }
2150 + }
2151 +
2152 +-#define __SI_FAULT (3 << 16)
2153 +-#define SEGV_BNDERR (__SI_FAULT|3) /* failed address bound checks */
2154 +-#define SEGV_PKUERR (__SI_FAULT|4)
2155 ++#define SEGV_BNDERR 3 /* failed address bound checks */
2156 ++#define SEGV_PKUERR 4
2157 +
2158 + static char *si_code_str(int si_code)
2159 + {
2160 +- if (si_code & SEGV_MAPERR)
2161 ++ if (si_code == SEGV_MAPERR)
2162 + return "SEGV_MAPERR";
2163 +- if (si_code & SEGV_ACCERR)
2164 ++ if (si_code == SEGV_ACCERR)
2165 + return "SEGV_ACCERR";
2166 +- if (si_code & SEGV_BNDERR)
2167 ++ if (si_code == SEGV_BNDERR)
2168 + return "SEGV_BNDERR";
2169 +- if (si_code & SEGV_PKUERR)
2170 ++ if (si_code == SEGV_PKUERR)
2171 + return "SEGV_PKUERR";
2172 + return "UNKNOWN";
2173 + }
2174 +@@ -238,7 +249,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
2175 + unsigned long ip;
2176 + char *fpregs;
2177 + u32 *pkru_ptr;
2178 +- u64 si_pkey;
2179 ++ u64 siginfo_pkey;
2180 + u32 *si_pkey_ptr;
2181 + int pkru_offset;
2182 + fpregset_t fpregset;
2183 +@@ -280,9 +291,9 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
2184 + si_pkey_ptr = (u32 *)(((u8 *)si) + si_pkey_offset);
2185 + dprintf1("si_pkey_ptr: %p\n", si_pkey_ptr);
2186 + dump_mem(si_pkey_ptr - 8, 24);
2187 +- si_pkey = *si_pkey_ptr;
2188 +- pkey_assert(si_pkey < NR_PKEYS);
2189 +- last_si_pkey = si_pkey;
2190 ++ siginfo_pkey = *si_pkey_ptr;
2191 ++ pkey_assert(siginfo_pkey < NR_PKEYS);
2192 ++ last_si_pkey = siginfo_pkey;
2193 +
2194 + if ((si->si_code == SEGV_MAPERR) ||
2195 + (si->si_code == SEGV_ACCERR) ||
2196 +@@ -294,7 +305,7 @@ void signal_handler(int signum, siginfo_t *si, void *vucontext)
2197 + dprintf1("signal pkru from xsave: %08x\n", *pkru_ptr);
2198 + /* need __rdpkru() version so we do not do shadow_pkru checking */
2199 + dprintf1("signal pkru from pkru: %08x\n", __rdpkru());
2200 +- dprintf1("si_pkey from siginfo: %jx\n", si_pkey);
2201 ++ dprintf1("pkey from siginfo: %jx\n", siginfo_pkey);
2202 + *(u64 *)pkru_ptr = 0x00000000;
2203 + dprintf1("WARNING: set PRKU=0 to allow faulting instruction to continue\n");
2204 + pkru_faults++;
2205 +diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c
2206 +index eaea92439708..1e3da137a8bb 100644
2207 +--- a/tools/testing/selftests/x86/ptrace_syscall.c
2208 ++++ b/tools/testing/selftests/x86/ptrace_syscall.c
2209 +@@ -182,8 +182,10 @@ static void test_ptrace_syscall_restart(void)
2210 + if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
2211 + err(1, "PTRACE_TRACEME");
2212 +
2213 ++ pid_t pid = getpid(), tid = syscall(SYS_gettid);
2214 ++
2215 + printf("\tChild will make one syscall\n");
2216 +- raise(SIGSTOP);
2217 ++ syscall(SYS_tgkill, pid, tid, SIGSTOP);
2218 +
2219 + syscall(SYS_gettid, 10, 11, 12, 13, 14, 15);
2220 + _exit(0);
2221 +@@ -300,9 +302,11 @@ static void test_restart_under_ptrace(void)
2222 + if (ptrace(PTRACE_TRACEME, 0, 0, 0) != 0)
2223 + err(1, "PTRACE_TRACEME");
2224 +
2225 ++ pid_t pid = getpid(), tid = syscall(SYS_gettid);
2226 ++
2227 + printf("\tChild will take a nap until signaled\n");
2228 + setsigign(SIGUSR1, SA_RESTART);
2229 +- raise(SIGSTOP);
2230 ++ syscall(SYS_tgkill, pid, tid, SIGSTOP);
2231 +
2232 + syscall(SYS_pause, 0, 0, 0, 0, 0, 0);
2233 + _exit(0);