Magellan Linux

Contents of /trunk/kernel-alx/patches-5.4/0207-5.4.108-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3637 - (show annotations) (download)
Mon Oct 24 12:40:44 2022 UTC (18 months, 1 week ago) by niro
File size: 63528 byte(s)
-add missing
1 diff --git a/Makefile b/Makefile
2 index 43159b21a83f4..b0abe257221a7 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6 # SPDX-License-Identifier: GPL-2.0
7 VERSION = 5
8 PATCHLEVEL = 4
9 -SUBLEVEL = 107
10 +SUBLEVEL = 108
11 EXTRAVERSION =
12 NAME = Kleptomaniac Octopus
13
14 @@ -1177,15 +1177,17 @@ endef
15 define filechk_version.h
16 if [ $(SUBLEVEL) -gt 255 ]; then \
17 echo \#define LINUX_VERSION_CODE $(shell \
18 - expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255); \
19 + expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + 255); \
20 else \
21 echo \#define LINUX_VERSION_CODE $(shell \
22 - expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
23 + expr $(VERSION) \* 65536 + $(PATCHLEVEL) \* 256 + $(SUBLEVEL)); \
24 fi; \
25 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + \
26 ((c) > 255 ? 255 : (c)))'
27 endef
28
29 +$(version_h): PATCHLEVEL := $(if $(PATCHLEVEL), $(PATCHLEVEL), 0)
30 +$(version_h): SUBLEVEL := $(if $(SUBLEVEL), $(SUBLEVEL), 0)
31 $(version_h): FORCE
32 $(call filechk,version.h)
33 $(Q)rm -f $(old_version_h)
34 diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
35 index a874b753397ec..b62d74a2c73a5 100644
36 --- a/arch/arm/kernel/entry-armv.S
37 +++ b/arch/arm/kernel/entry-armv.S
38 @@ -252,31 +252,10 @@ __und_svc:
39 #else
40 svc_entry
41 #endif
42 - @
43 - @ call emulation code, which returns using r9 if it has emulated
44 - @ the instruction, or the more conventional lr if we are to treat
45 - @ this as a real undefined instruction
46 - @
47 - @ r0 - instruction
48 - @
49 -#ifndef CONFIG_THUMB2_KERNEL
50 - ldr r0, [r4, #-4]
51 -#else
52 - mov r1, #2
53 - ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2
54 - cmp r0, #0xe800 @ 32-bit instruction if xx >= 0
55 - blo __und_svc_fault
56 - ldrh r9, [r4] @ bottom 16 bits
57 - add r4, r4, #2
58 - str r4, [sp, #S_PC]
59 - orr r0, r9, r0, lsl #16
60 -#endif
61 - badr r9, __und_svc_finish
62 - mov r2, r4
63 - bl call_fpe
64
65 mov r1, #4 @ PC correction to apply
66 -__und_svc_fault:
67 + THUMB( tst r5, #PSR_T_BIT ) @ exception taken in Thumb mode?
68 + THUMB( movne r1, #2 ) @ if so, fix up PC correction
69 mov r0, sp @ struct pt_regs *regs
70 bl __und_fault
71
72 diff --git a/arch/arm/vfp/entry.S b/arch/arm/vfp/entry.S
73 index 0186cf9da890b..27b0a1f27fbdf 100644
74 --- a/arch/arm/vfp/entry.S
75 +++ b/arch/arm/vfp/entry.S
76 @@ -37,20 +37,3 @@ ENDPROC(vfp_null_entry)
77 .align 2
78 .LCvfp:
79 .word vfp_vector
80 -
81 -@ This code is called if the VFP does not exist. It needs to flag the
82 -@ failure to the VFP initialisation code.
83 -
84 - __INIT
85 -ENTRY(vfp_testing_entry)
86 - dec_preempt_count_ti r10, r4
87 - ldr r0, VFP_arch_address
88 - str r0, [r0] @ set to non-zero value
89 - ret r9 @ we have handled the fault
90 -ENDPROC(vfp_testing_entry)
91 -
92 - .align 2
93 -VFP_arch_address:
94 - .word VFP_arch
95 -
96 - __FINIT
97 diff --git a/arch/arm/vfp/vfphw.S b/arch/arm/vfp/vfphw.S
98 index b2e560290860e..b530db8f2c6c8 100644
99 --- a/arch/arm/vfp/vfphw.S
100 +++ b/arch/arm/vfp/vfphw.S
101 @@ -78,11 +78,6 @@
102 ENTRY(vfp_support_entry)
103 DBGSTR3 "instr %08x pc %08x state %p", r0, r2, r10
104
105 - ldr r3, [sp, #S_PSR] @ Neither lazy restore nor FP exceptions
106 - and r3, r3, #MODE_MASK @ are supported in kernel mode
107 - teq r3, #USR_MODE
108 - bne vfp_kmode_exception @ Returns through lr
109 -
110 VFPFMRX r1, FPEXC @ Is the VFP enabled?
111 DBGSTR1 "fpexc %08x", r1
112 tst r1, #FPEXC_EN
113 diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
114 index 8c9e7f9f0277d..2cb355c1b5b71 100644
115 --- a/arch/arm/vfp/vfpmodule.c
116 +++ b/arch/arm/vfp/vfpmodule.c
117 @@ -23,6 +23,7 @@
118 #include <asm/cputype.h>
119 #include <asm/system_info.h>
120 #include <asm/thread_notify.h>
121 +#include <asm/traps.h>
122 #include <asm/vfp.h>
123
124 #include "vfpinstr.h"
125 @@ -31,7 +32,6 @@
126 /*
127 * Our undef handlers (in entry.S)
128 */
129 -asmlinkage void vfp_testing_entry(void);
130 asmlinkage void vfp_support_entry(void);
131 asmlinkage void vfp_null_entry(void);
132
133 @@ -42,7 +42,7 @@ asmlinkage void (*vfp_vector)(void) = vfp_null_entry;
134 * Used in startup: set to non-zero if VFP checks fail
135 * After startup, holds VFP architecture
136 */
137 -unsigned int VFP_arch;
138 +static unsigned int __initdata VFP_arch;
139
140 /*
141 * The pointer to the vfpstate structure of the thread which currently
142 @@ -436,7 +436,7 @@ static void vfp_enable(void *unused)
143 * present on all CPUs within a SMP complex. Needs to be called prior to
144 * vfp_init().
145 */
146 -void vfp_disable(void)
147 +void __init vfp_disable(void)
148 {
149 if (VFP_arch) {
150 pr_debug("%s: should be called prior to vfp_init\n", __func__);
151 @@ -642,7 +642,9 @@ static int vfp_starting_cpu(unsigned int unused)
152 return 0;
153 }
154
155 -void vfp_kmode_exception(void)
156 +#ifdef CONFIG_KERNEL_MODE_NEON
157 +
158 +static int vfp_kmode_exception(struct pt_regs *regs, unsigned int instr)
159 {
160 /*
161 * If we reach this point, a floating point exception has been raised
162 @@ -660,9 +662,51 @@ void vfp_kmode_exception(void)
163 pr_crit("BUG: unsupported FP instruction in kernel mode\n");
164 else
165 pr_crit("BUG: FP instruction issued in kernel mode with FP unit disabled\n");
166 + pr_crit("FPEXC == 0x%08x\n", fmrx(FPEXC));
167 + return 1;
168 }
169
170 -#ifdef CONFIG_KERNEL_MODE_NEON
171 +static struct undef_hook vfp_kmode_exception_hook[] = {{
172 + .instr_mask = 0xfe000000,
173 + .instr_val = 0xf2000000,
174 + .cpsr_mask = MODE_MASK | PSR_T_BIT,
175 + .cpsr_val = SVC_MODE,
176 + .fn = vfp_kmode_exception,
177 +}, {
178 + .instr_mask = 0xff100000,
179 + .instr_val = 0xf4000000,
180 + .cpsr_mask = MODE_MASK | PSR_T_BIT,
181 + .cpsr_val = SVC_MODE,
182 + .fn = vfp_kmode_exception,
183 +}, {
184 + .instr_mask = 0xef000000,
185 + .instr_val = 0xef000000,
186 + .cpsr_mask = MODE_MASK | PSR_T_BIT,
187 + .cpsr_val = SVC_MODE | PSR_T_BIT,
188 + .fn = vfp_kmode_exception,
189 +}, {
190 + .instr_mask = 0xff100000,
191 + .instr_val = 0xf9000000,
192 + .cpsr_mask = MODE_MASK | PSR_T_BIT,
193 + .cpsr_val = SVC_MODE | PSR_T_BIT,
194 + .fn = vfp_kmode_exception,
195 +}, {
196 + .instr_mask = 0x0c000e00,
197 + .instr_val = 0x0c000a00,
198 + .cpsr_mask = MODE_MASK,
199 + .cpsr_val = SVC_MODE,
200 + .fn = vfp_kmode_exception,
201 +}};
202 +
203 +static int __init vfp_kmode_exception_hook_init(void)
204 +{
205 + int i;
206 +
207 + for (i = 0; i < ARRAY_SIZE(vfp_kmode_exception_hook); i++)
208 + register_undef_hook(&vfp_kmode_exception_hook[i]);
209 + return 0;
210 +}
211 +subsys_initcall(vfp_kmode_exception_hook_init);
212
213 /*
214 * Kernel-side NEON support functions
215 @@ -708,6 +752,21 @@ EXPORT_SYMBOL(kernel_neon_end);
216
217 #endif /* CONFIG_KERNEL_MODE_NEON */
218
219 +static int __init vfp_detect(struct pt_regs *regs, unsigned int instr)
220 +{
221 + VFP_arch = UINT_MAX; /* mark as not present */
222 + regs->ARM_pc += 4;
223 + return 0;
224 +}
225 +
226 +static struct undef_hook vfp_detect_hook __initdata = {
227 + .instr_mask = 0x0c000e00,
228 + .instr_val = 0x0c000a00,
229 + .cpsr_mask = MODE_MASK,
230 + .cpsr_val = SVC_MODE,
231 + .fn = vfp_detect,
232 +};
233 +
234 /*
235 * VFP support code initialisation.
236 */
237 @@ -728,10 +787,11 @@ static int __init vfp_init(void)
238 * The handler is already setup to just log calls, so
239 * we just need to read the VFPSID register.
240 */
241 - vfp_vector = vfp_testing_entry;
242 + register_undef_hook(&vfp_detect_hook);
243 barrier();
244 vfpsid = fmrx(FPSID);
245 barrier();
246 + unregister_undef_hook(&vfp_detect_hook);
247 vfp_vector = vfp_null_entry;
248
249 pr_info("VFP support v0.3: ");
250 diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
251 index a0fa4be94a68e..6b23a0cb2b353 100644
252 --- a/arch/riscv/Kconfig
253 +++ b/arch/riscv/Kconfig
254 @@ -58,7 +58,6 @@ config RISCV
255 select EDAC_SUPPORT
256 select ARCH_HAS_GIGANTIC_PAGE
257 select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
258 - select SPARSEMEM_STATIC if 32BIT
259 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU
260 select HAVE_ARCH_MMAP_RND_BITS
261 select HAVE_COPY_THREAD_TLS
262 @@ -102,7 +101,8 @@ config ARCH_FLATMEM_ENABLE
263 config ARCH_SPARSEMEM_ENABLE
264 def_bool y
265 depends on MMU
266 - select SPARSEMEM_VMEMMAP_ENABLE
267 + select SPARSEMEM_STATIC if 32BIT && SPARSMEM
268 + select SPARSEMEM_VMEMMAP_ENABLE if 64BIT
269
270 config ARCH_SELECT_MEMORY_MODEL
271 def_bool ARCH_SPARSEMEM_ENABLE
272 diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
273 index 3e72f955bff7f..6e60cc2443b2e 100644
274 --- a/arch/s390/kernel/vtime.c
275 +++ b/arch/s390/kernel/vtime.c
276 @@ -217,7 +217,7 @@ void vtime_flush(struct task_struct *tsk)
277 avg_steal = S390_lowcore.avg_steal_timer / 2;
278 if ((s64) steal > 0) {
279 S390_lowcore.steal_timer = 0;
280 - account_steal_time(steal);
281 + account_steal_time(cputime_to_nsecs(steal));
282 avg_steal += steal;
283 }
284 S390_lowcore.avg_steal_timer = avg_steal;
285 diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
286 index eb8bd0eeace7d..5965d341350ca 100644
287 --- a/arch/x86/events/intel/ds.c
288 +++ b/arch/x86/events/intel/ds.c
289 @@ -1890,7 +1890,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
290 */
291 if (!pebs_status && cpuc->pebs_enabled &&
292 !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
293 - pebs_status = cpuc->pebs_enabled;
294 + pebs_status = p->status = cpuc->pebs_enabled;
295
296 bit = find_first_bit((unsigned long *)&pebs_status,
297 x86_pmu.max_pebs_events);
298 diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
299 index a07dfdf7759ec..537c0dd4c3d4a 100644
300 --- a/arch/x86/include/asm/processor.h
301 +++ b/arch/x86/include/asm/processor.h
302 @@ -506,15 +506,6 @@ static inline void arch_thread_struct_whitelist(unsigned long *offset,
303 *size = fpu_kernel_xstate_size;
304 }
305
306 -/*
307 - * Thread-synchronous status.
308 - *
309 - * This is different from the flags in that nobody else
310 - * ever touches our thread-synchronous status, so we don't
311 - * have to worry about atomic accesses.
312 - */
313 -#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/
314 -
315 /*
316 * Set IOPL bits in EFLAGS from given mask
317 */
318 diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
319 index f9453536f9bbc..a4de7aa7500fb 100644
320 --- a/arch/x86/include/asm/thread_info.h
321 +++ b/arch/x86/include/asm/thread_info.h
322 @@ -221,10 +221,31 @@ static inline int arch_within_stack_frames(const void * const stack,
323
324 #endif
325
326 +/*
327 + * Thread-synchronous status.
328 + *
329 + * This is different from the flags in that nobody else
330 + * ever touches our thread-synchronous status, so we don't
331 + * have to worry about atomic accesses.
332 + */
333 +#define TS_COMPAT 0x0002 /* 32bit syscall active (64BIT)*/
334 +
335 +#ifndef __ASSEMBLY__
336 #ifdef CONFIG_COMPAT
337 #define TS_I386_REGS_POKED 0x0004 /* regs poked by 32-bit ptracer */
338 +#define TS_COMPAT_RESTART 0x0008
339 +
340 +#define arch_set_restart_data arch_set_restart_data
341 +
342 +static inline void arch_set_restart_data(struct restart_block *restart)
343 +{
344 + struct thread_info *ti = current_thread_info();
345 + if (ti->status & TS_COMPAT)
346 + ti->status |= TS_COMPAT_RESTART;
347 + else
348 + ti->status &= ~TS_COMPAT_RESTART;
349 +}
350 #endif
351 -#ifndef __ASSEMBLY__
352
353 #ifdef CONFIG_X86_32
354 #define in_ia32_syscall() true
355 diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
356 index 3dca7b8642e9c..7fafa859e9f25 100644
357 --- a/arch/x86/kernel/apic/apic.c
358 +++ b/arch/x86/kernel/apic/apic.c
359 @@ -2354,6 +2354,11 @@ static int cpuid_to_apicid[] = {
360 [0 ... NR_CPUS - 1] = -1,
361 };
362
363 +bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
364 +{
365 + return phys_id == cpuid_to_apicid[cpu];
366 +}
367 +
368 #ifdef CONFIG_SMP
369 /**
370 * apic_id_is_primary_thread - Check whether APIC ID belongs to a primary thread
371 diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
372 index 4b6301946f455..0edcf69659eee 100644
373 --- a/arch/x86/kernel/apic/io_apic.c
374 +++ b/arch/x86/kernel/apic/io_apic.c
375 @@ -1046,6 +1046,16 @@ static int mp_map_pin_to_irq(u32 gsi, int idx, int ioapic, int pin,
376 if (idx >= 0 && test_bit(mp_irqs[idx].srcbus, mp_bus_not_pci)) {
377 irq = mp_irqs[idx].srcbusirq;
378 legacy = mp_is_legacy_irq(irq);
379 + /*
380 + * IRQ2 is unusable for historical reasons on systems which
381 + * have a legacy PIC. See the comment vs. IRQ2 further down.
382 + *
383 + * If this gets removed at some point then the related code
384 + * in lapic_assign_system_vectors() needs to be adjusted as
385 + * well.
386 + */
387 + if (legacy && irq == PIC_CASCADE_IR)
388 + return -EINVAL;
389 }
390
391 mutex_lock(&ioapic_mutex);
392 diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
393 index 8eb7193e158dd..2fdbf5ef8c39c 100644
394 --- a/arch/x86/kernel/signal.c
395 +++ b/arch/x86/kernel/signal.c
396 @@ -770,30 +770,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
397
398 static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
399 {
400 - /*
401 - * This function is fundamentally broken as currently
402 - * implemented.
403 - *
404 - * The idea is that we want to trigger a call to the
405 - * restart_block() syscall and that we want in_ia32_syscall(),
406 - * in_x32_syscall(), etc. to match whatever they were in the
407 - * syscall being restarted. We assume that the syscall
408 - * instruction at (regs->ip - 2) matches whatever syscall
409 - * instruction we used to enter in the first place.
410 - *
411 - * The problem is that we can get here when ptrace pokes
412 - * syscall-like values into regs even if we're not in a syscall
413 - * at all.
414 - *
415 - * For now, we maintain historical behavior and guess based on
416 - * stored state. We could do better by saving the actual
417 - * syscall arch in restart_block or (with caveats on x32) by
418 - * checking if regs->ip points to 'int $0x80'. The current
419 - * behavior is incorrect if a tracer has a different bitness
420 - * than the tracee.
421 - */
422 #ifdef CONFIG_IA32_EMULATION
423 - if (current_thread_info()->status & (TS_COMPAT|TS_I386_REGS_POKED))
424 + if (current_thread_info()->status & TS_COMPAT_RESTART)
425 return __NR_ia32_restart_syscall;
426 #endif
427 #ifdef CONFIG_X86_X32_ABI
428 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
429 index 8e3d0228b05bb..137a7ba053d78 100644
430 --- a/drivers/base/power/runtime.c
431 +++ b/drivers/base/power/runtime.c
432 @@ -325,22 +325,22 @@ static void rpm_put_suppliers(struct device *dev)
433 static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
434 __releases(&dev->power.lock) __acquires(&dev->power.lock)
435 {
436 - bool use_links = dev->power.links_count > 0;
437 - bool get = false;
438 int retval, idx;
439 - bool put;
440 + bool use_links = dev->power.links_count > 0;
441
442 if (dev->power.irq_safe) {
443 spin_unlock(&dev->power.lock);
444 - } else if (!use_links) {
445 - spin_unlock_irq(&dev->power.lock);
446 } else {
447 - get = dev->power.runtime_status == RPM_RESUMING;
448 -
449 spin_unlock_irq(&dev->power.lock);
450
451 - /* Resume suppliers if necessary. */
452 - if (get) {
453 + /*
454 + * Resume suppliers if necessary.
455 + *
456 + * The device's runtime PM status cannot change until this
457 + * routine returns, so it is safe to read the status outside of
458 + * the lock.
459 + */
460 + if (use_links && dev->power.runtime_status == RPM_RESUMING) {
461 idx = device_links_read_lock();
462
463 retval = rpm_get_suppliers(dev);
464 @@ -355,36 +355,24 @@ static int __rpm_callback(int (*cb)(struct device *), struct device *dev)
465
466 if (dev->power.irq_safe) {
467 spin_lock(&dev->power.lock);
468 - return retval;
469 - }
470 -
471 - spin_lock_irq(&dev->power.lock);
472 -
473 - if (!use_links)
474 - return retval;
475 -
476 - /*
477 - * If the device is suspending and the callback has returned success,
478 - * drop the usage counters of the suppliers that have been reference
479 - * counted on its resume.
480 - *
481 - * Do that if the resume fails too.
482 - */
483 - put = dev->power.runtime_status == RPM_SUSPENDING && !retval;
484 - if (put)
485 - __update_runtime_status(dev, RPM_SUSPENDED);
486 - else
487 - put = get && retval;
488 -
489 - if (put) {
490 - spin_unlock_irq(&dev->power.lock);
491 -
492 - idx = device_links_read_lock();
493 + } else {
494 + /*
495 + * If the device is suspending and the callback has returned
496 + * success, drop the usage counters of the suppliers that have
497 + * been reference counted on its resume.
498 + *
499 + * Do that if resume fails too.
500 + */
501 + if (use_links
502 + && ((dev->power.runtime_status == RPM_SUSPENDING && !retval)
503 + || (dev->power.runtime_status == RPM_RESUMING && retval))) {
504 + idx = device_links_read_lock();
505
506 -fail:
507 - rpm_put_suppliers(dev);
508 + fail:
509 + rpm_put_suppliers(dev);
510
511 - device_links_read_unlock(idx);
512 + device_links_read_unlock(idx);
513 + }
514
515 spin_lock_irq(&dev->power.lock);
516 }
517 diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
518 index 644ba18a72ad5..75e08a98d09be 100644
519 --- a/drivers/counter/stm32-timer-cnt.c
520 +++ b/drivers/counter/stm32-timer-cnt.c
521 @@ -25,6 +25,7 @@ struct stm32_timer_cnt {
522 struct regmap *regmap;
523 struct clk *clk;
524 u32 ceiling;
525 + u32 max_arr;
526 };
527
528 /**
529 @@ -35,13 +36,14 @@ struct stm32_timer_cnt {
530 * @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges
531 */
532 enum stm32_count_function {
533 - STM32_COUNT_SLAVE_MODE_DISABLED = -1,
534 + STM32_COUNT_SLAVE_MODE_DISABLED,
535 STM32_COUNT_ENCODER_MODE_1,
536 STM32_COUNT_ENCODER_MODE_2,
537 STM32_COUNT_ENCODER_MODE_3,
538 };
539
540 static enum counter_count_function stm32_count_functions[] = {
541 + [STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE,
542 [STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
543 [STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
544 [STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
545 @@ -88,6 +90,9 @@ static int stm32_count_function_get(struct counter_device *counter,
546 regmap_read(priv->regmap, TIM_SMCR, &smcr);
547
548 switch (smcr & TIM_SMCR_SMS) {
549 + case 0:
550 + *function = STM32_COUNT_SLAVE_MODE_DISABLED;
551 + return 0;
552 case 1:
553 *function = STM32_COUNT_ENCODER_MODE_1;
554 return 0;
555 @@ -97,9 +102,9 @@ static int stm32_count_function_get(struct counter_device *counter,
556 case 3:
557 *function = STM32_COUNT_ENCODER_MODE_3;
558 return 0;
559 + default:
560 + return -EINVAL;
561 }
562 -
563 - return -EINVAL;
564 }
565
566 static int stm32_count_function_set(struct counter_device *counter,
567 @@ -110,6 +115,9 @@ static int stm32_count_function_set(struct counter_device *counter,
568 u32 cr1, sms;
569
570 switch (function) {
571 + case STM32_COUNT_SLAVE_MODE_DISABLED:
572 + sms = 0;
573 + break;
574 case STM32_COUNT_ENCODER_MODE_1:
575 sms = 1;
576 break;
577 @@ -120,8 +128,7 @@ static int stm32_count_function_set(struct counter_device *counter,
578 sms = 3;
579 break;
580 default:
581 - sms = 0;
582 - break;
583 + return -EINVAL;
584 }
585
586 /* Store enable status */
587 @@ -183,6 +190,9 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
588 if (ret)
589 return ret;
590
591 + if (ceiling > priv->max_arr)
592 + return -ERANGE;
593 +
594 /* TIMx_ARR register shouldn't be buffered (ARPE=0) */
595 regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
596 regmap_write(priv->regmap, TIM_ARR, ceiling);
597 @@ -269,31 +279,36 @@ static int stm32_action_get(struct counter_device *counter,
598 size_t function;
599 int err;
600
601 - /* Default action mode (e.g. STM32_COUNT_SLAVE_MODE_DISABLED) */
602 - *action = STM32_SYNAPSE_ACTION_NONE;
603 -
604 err = stm32_count_function_get(counter, count, &function);
605 if (err)
606 - return 0;
607 + return err;
608
609 switch (function) {
610 + case STM32_COUNT_SLAVE_MODE_DISABLED:
611 + /* counts on internal clock when CEN=1 */
612 + *action = STM32_SYNAPSE_ACTION_NONE;
613 + return 0;
614 case STM32_COUNT_ENCODER_MODE_1:
615 /* counts up/down on TI1FP1 edge depending on TI2FP2 level */
616 if (synapse->signal->id == count->synapses[0].signal->id)
617 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
618 - break;
619 + else
620 + *action = STM32_SYNAPSE_ACTION_NONE;
621 + return 0;
622 case STM32_COUNT_ENCODER_MODE_2:
623 /* counts up/down on TI2FP2 edge depending on TI1FP1 level */
624 if (synapse->signal->id == count->synapses[1].signal->id)
625 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
626 - break;
627 + else
628 + *action = STM32_SYNAPSE_ACTION_NONE;
629 + return 0;
630 case STM32_COUNT_ENCODER_MODE_3:
631 /* counts up/down on both TI1FP1 and TI2FP2 edges */
632 *action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
633 - break;
634 + return 0;
635 + default:
636 + return -EINVAL;
637 }
638 -
639 - return 0;
640 }
641
642 static const struct counter_ops stm32_timer_cnt_ops = {
643 @@ -355,6 +370,7 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev)
644 priv->regmap = ddata->regmap;
645 priv->clk = ddata->clk;
646 priv->ceiling = ddata->max_arr;
647 + priv->max_arr = ddata->max_arr;
648
649 priv->counter.name = dev_name(dev);
650 priv->counter.parent = dev;
651 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
652 index b299e22b7532a..3a2b607369151 100644
653 --- a/drivers/firmware/efi/efi.c
654 +++ b/drivers/firmware/efi/efi.c
655 @@ -1006,7 +1006,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
656 }
657
658 /* first try to find a slot in an existing linked list entry */
659 - for (prsv = efi_memreserve_root->next; prsv; prsv = rsv->next) {
660 + for (prsv = efi_memreserve_root->next; prsv; ) {
661 rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
662 index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
663 if (index < rsv->size) {
664 @@ -1016,6 +1016,7 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
665 memunmap(rsv);
666 return efi_mem_reserve_iomem(addr, size);
667 }
668 + prsv = rsv->next;
669 memunmap(rsv);
670 }
671
672 diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
673 index f0af3a42f53cf..cb57880842991 100644
674 --- a/drivers/iio/adc/Kconfig
675 +++ b/drivers/iio/adc/Kconfig
676 @@ -784,6 +784,7 @@ config STM32_ADC_CORE
677 depends on ARCH_STM32 || COMPILE_TEST
678 depends on OF
679 depends on REGULATOR
680 + depends on HAS_IOMEM
681 select IIO_BUFFER
682 select MFD_STM32_TIMERS
683 select IIO_STM32_TIMER_TRIGGER
684 diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c
685 index 6b51bfcad0d04..325cd7d18b918 100644
686 --- a/drivers/iio/adc/ad7949.c
687 +++ b/drivers/iio/adc/ad7949.c
688 @@ -91,7 +91,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
689 int ret;
690 int i;
691 int bits_per_word = ad7949_adc->resolution;
692 - int mask = GENMASK(ad7949_adc->resolution, 0);
693 + int mask = GENMASK(ad7949_adc->resolution - 1, 0);
694 struct spi_message msg;
695 struct spi_transfer tx[] = {
696 {
697 diff --git a/drivers/iio/adc/qcom-spmi-vadc.c b/drivers/iio/adc/qcom-spmi-vadc.c
698 index 203ad59da3364..71c455a27097b 100644
699 --- a/drivers/iio/adc/qcom-spmi-vadc.c
700 +++ b/drivers/iio/adc/qcom-spmi-vadc.c
701 @@ -598,7 +598,7 @@ static const struct vadc_channels vadc_chans[] = {
702 VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)
703
704 VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
705 - VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
706 + VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
707 VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
708 VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
709 VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
710 diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
711 index 80154bca18b61..7046bca1d7eba 100644
712 --- a/drivers/iio/gyro/mpu3050-core.c
713 +++ b/drivers/iio/gyro/mpu3050-core.c
714 @@ -550,6 +550,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
715 MPU3050_FIFO_R,
716 &fifo_values[offset],
717 toread);
718 + if (ret)
719 + goto out_trigger_unlock;
720
721 dev_dbg(mpu3050->dev,
722 "%04x %04x %04x %04x %04x\n",
723 diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c
724 index c99b54b0568df..969e16f5eeb64 100644
725 --- a/drivers/iio/humidity/hid-sensor-humidity.c
726 +++ b/drivers/iio/humidity/hid-sensor-humidity.c
727 @@ -17,7 +17,10 @@
728 struct hid_humidity_state {
729 struct hid_sensor_common common_attributes;
730 struct hid_sensor_hub_attribute_info humidity_attr;
731 - s32 humidity_data;
732 + struct {
733 + s32 humidity_data;
734 + u64 timestamp __aligned(8);
735 + } scan;
736 int scale_pre_decml;
737 int scale_post_decml;
738 int scale_precision;
739 @@ -127,9 +130,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
740 struct hid_humidity_state *humid_st = iio_priv(indio_dev);
741
742 if (atomic_read(&humid_st->common_attributes.data_ready))
743 - iio_push_to_buffers_with_timestamp(indio_dev,
744 - &humid_st->humidity_data,
745 - iio_get_time_ns(indio_dev));
746 + iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
747 + iio_get_time_ns(indio_dev));
748
749 return 0;
750 }
751 @@ -144,7 +146,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,
752
753 switch (usage_id) {
754 case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
755 - humid_st->humidity_data = *(s32 *)raw_data;
756 + humid_st->scan.humidity_data = *(s32 *)raw_data;
757
758 return 0;
759 default:
760 diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
761 index 0575ff706bd43..59e33302042c5 100644
762 --- a/drivers/iio/imu/adis16400.c
763 +++ b/drivers/iio/imu/adis16400.c
764 @@ -464,8 +464,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
765 if (ret)
766 goto err_ret;
767
768 - ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
769 - if (ret != 1) {
770 + if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
771 ret = -EINVAL;
772 goto err_ret;
773 }
774 diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
775 index 7e1030af9ba31..70da928e0d168 100644
776 --- a/drivers/iio/light/hid-sensor-prox.c
777 +++ b/drivers/iio/light/hid-sensor-prox.c
778 @@ -25,6 +25,9 @@ struct prox_state {
779 struct hid_sensor_common common_attributes;
780 struct hid_sensor_hub_attribute_info prox_attr;
781 u32 human_presence;
782 + int scale_pre_decml;
783 + int scale_post_decml;
784 + int scale_precision;
785 };
786
787 /* Channel definitions */
788 @@ -95,8 +98,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
789 ret_type = IIO_VAL_INT;
790 break;
791 case IIO_CHAN_INFO_SCALE:
792 - *val = prox_state->prox_attr.units;
793 - ret_type = IIO_VAL_INT;
794 + *val = prox_state->scale_pre_decml;
795 + *val2 = prox_state->scale_post_decml;
796 + ret_type = prox_state->scale_precision;
797 break;
798 case IIO_CHAN_INFO_OFFSET:
799 *val = hid_sensor_convert_exponent(
800 @@ -236,6 +240,11 @@ static int prox_parse_report(struct platform_device *pdev,
801 HID_USAGE_SENSOR_HUMAN_PRESENCE,
802 &st->common_attributes.sensitivity);
803
804 + st->scale_precision = hid_sensor_format_scale(
805 + hsdev->usage,
806 + &st->prox_attr,
807 + &st->scale_pre_decml, &st->scale_post_decml);
808 +
809 return ret;
810 }
811
812 diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c
813 index eda55b9c1e9b1..500b5cc4351a2 100644
814 --- a/drivers/iio/temperature/hid-sensor-temperature.c
815 +++ b/drivers/iio/temperature/hid-sensor-temperature.c
816 @@ -17,7 +17,10 @@
817 struct temperature_state {
818 struct hid_sensor_common common_attributes;
819 struct hid_sensor_hub_attribute_info temperature_attr;
820 - s32 temperature_data;
821 + struct {
822 + s32 temperature_data;
823 + u64 timestamp __aligned(8);
824 + } scan;
825 int scale_pre_decml;
826 int scale_post_decml;
827 int scale_precision;
828 @@ -34,7 +37,7 @@ static const struct iio_chan_spec temperature_channels[] = {
829 BIT(IIO_CHAN_INFO_SAMP_FREQ) |
830 BIT(IIO_CHAN_INFO_HYSTERESIS),
831 },
832 - IIO_CHAN_SOFT_TIMESTAMP(3),
833 + IIO_CHAN_SOFT_TIMESTAMP(1),
834 };
835
836 /* Adjust channel real bits based on report descriptor */
837 @@ -125,9 +128,8 @@ static int temperature_proc_event(struct hid_sensor_hub_device *hsdev,
838 struct temperature_state *temp_st = iio_priv(indio_dev);
839
840 if (atomic_read(&temp_st->common_attributes.data_ready))
841 - iio_push_to_buffers_with_timestamp(indio_dev,
842 - &temp_st->temperature_data,
843 - iio_get_time_ns(indio_dev));
844 + iio_push_to_buffers_with_timestamp(indio_dev, &temp_st->scan,
845 + iio_get_time_ns(indio_dev));
846
847 return 0;
848 }
849 @@ -142,7 +144,7 @@ static int temperature_capture_sample(struct hid_sensor_hub_device *hsdev,
850
851 switch (usage_id) {
852 case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE:
853 - temp_st->temperature_data = *(s32 *)raw_data;
854 + temp_st->scan.temperature_data = *(s32 *)raw_data;
855 return 0;
856 default:
857 return -EINVAL;
858 diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
859 index e4e24e7bf4628..308f3a28e12a2 100644
860 --- a/drivers/nvme/host/core.c
861 +++ b/drivers/nvme/host/core.c
862 @@ -1743,30 +1743,18 @@ static void nvme_config_discard(struct gendisk *disk, struct nvme_ns *ns)
863 blk_queue_max_write_zeroes_sectors(queue, UINT_MAX);
864 }
865
866 -static void nvme_config_write_zeroes(struct gendisk *disk, struct nvme_ns *ns)
867 +/*
868 + * Even though NVMe spec explicitly states that MDTS is not applicable to the
869 + * write-zeroes, we are cautious and limit the size to the controllers
870 + * max_hw_sectors value, which is based on the MDTS field and possibly other
871 + * limiting factors.
872 + */
873 +static void nvme_config_write_zeroes(struct request_queue *q,
874 + struct nvme_ctrl *ctrl)
875 {
876 - u64 max_blocks;
877 -
878 - if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) ||
879 - (ns->ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
880 - return;
881 - /*
882 - * Even though NVMe spec explicitly states that MDTS is not
883 - * applicable to the write-zeroes:- "The restriction does not apply to
884 - * commands that do not transfer data between the host and the
885 - * controller (e.g., Write Uncorrectable ro Write Zeroes command).".
886 - * In order to be more cautious use controller's max_hw_sectors value
887 - * to configure the maximum sectors for the write-zeroes which is
888 - * configured based on the controller's MDTS field in the
889 - * nvme_init_identify() if available.
890 - */
891 - if (ns->ctrl->max_hw_sectors == UINT_MAX)
892 - max_blocks = (u64)USHRT_MAX + 1;
893 - else
894 - max_blocks = ns->ctrl->max_hw_sectors + 1;
895 -
896 - blk_queue_max_write_zeroes_sectors(disk->queue,
897 - nvme_lba_to_sect(ns, max_blocks));
898 + if ((ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) &&
899 + !(ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
900 + blk_queue_max_write_zeroes_sectors(q, ctrl->max_hw_sectors);
901 }
902
903 static int nvme_report_ns_ids(struct nvme_ctrl *ctrl, unsigned int nsid,
904 @@ -1853,7 +1841,7 @@ static void nvme_update_disk_info(struct gendisk *disk,
905 set_capacity(disk, capacity);
906
907 nvme_config_discard(disk, ns);
908 - nvme_config_write_zeroes(disk, ns);
909 + nvme_config_write_zeroes(disk->queue, ns->ctrl);
910
911 if (id->nsattr & (1 << 0))
912 set_disk_ro(disk, true);
913 diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
914 index da60300104322..b8c0f75bfb7ba 100644
915 --- a/drivers/nvme/host/rdma.c
916 +++ b/drivers/nvme/host/rdma.c
917 @@ -666,8 +666,11 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl)
918 return ret;
919
920 ctrl->ctrl.queue_count = nr_io_queues + 1;
921 - if (ctrl->ctrl.queue_count < 2)
922 - return 0;
923 + if (ctrl->ctrl.queue_count < 2) {
924 + dev_err(ctrl->ctrl.device,
925 + "unable to set any I/O queues\n");
926 + return -ENOMEM;
927 + }
928
929 dev_info(ctrl->ctrl.device,
930 "creating %d I/O queues.\n", nr_io_queues);
931 diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
932 index 77a3c488ec120..ac3503ea54c46 100644
933 --- a/drivers/nvme/host/tcp.c
934 +++ b/drivers/nvme/host/tcp.c
935 @@ -512,6 +512,13 @@ static int nvme_tcp_setup_h2c_data_pdu(struct nvme_tcp_request *req,
936 req->pdu_len = le32_to_cpu(pdu->r2t_length);
937 req->pdu_sent = 0;
938
939 + if (unlikely(!req->pdu_len)) {
940 + dev_err(queue->ctrl->ctrl.device,
941 + "req %d r2t len is %u, probably a bug...\n",
942 + rq->tag, req->pdu_len);
943 + return -EPROTO;
944 + }
945 +
946 if (unlikely(req->data_sent + req->pdu_len > req->data_len)) {
947 dev_err(queue->ctrl->ctrl.device,
948 "req %d r2t len %u exceeded data len %u (%zu sent)\n",
949 @@ -1643,8 +1650,11 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl)
950 return ret;
951
952 ctrl->queue_count = nr_io_queues + 1;
953 - if (ctrl->queue_count < 2)
954 - return 0;
955 + if (ctrl->queue_count < 2) {
956 + dev_err(ctrl->device,
957 + "unable to set any I/O queues\n");
958 + return -ENOMEM;
959 + }
960
961 dev_info(ctrl->device,
962 "creating %d I/O queues.\n", nr_io_queues);
963 diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
964 index cca5a00c098a8..ee81d94fe810c 100644
965 --- a/drivers/nvme/target/core.c
966 +++ b/drivers/nvme/target/core.c
967 @@ -1031,9 +1031,20 @@ static void nvmet_start_ctrl(struct nvmet_ctrl *ctrl)
968 {
969 lockdep_assert_held(&ctrl->lock);
970
971 - if (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
972 - nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES ||
973 - nvmet_cc_mps(ctrl->cc) != 0 ||
974 + /*
975 + * Only I/O controllers should verify iosqes,iocqes.
976 + * Strictly speaking, the spec says a discovery controller
977 + * should verify iosqes,iocqes are zeroed, however that
978 + * would break backwards compatibility, so don't enforce it.
979 + */
980 + if (ctrl->subsys->type != NVME_NQN_DISC &&
981 + (nvmet_cc_iosqes(ctrl->cc) != NVME_NVM_IOSQES ||
982 + nvmet_cc_iocqes(ctrl->cc) != NVME_NVM_IOCQES)) {
983 + ctrl->csts = NVME_CSTS_CFS;
984 + return;
985 + }
986 +
987 + if (nvmet_cc_mps(ctrl->cc) != 0 ||
988 nvmet_cc_ams(ctrl->cc) != 0 ||
989 nvmet_cc_css(ctrl->cc) != 0) {
990 ctrl->csts = NVME_CSTS_CFS;
991 diff --git a/drivers/pci/hotplug/rpadlpar_sysfs.c b/drivers/pci/hotplug/rpadlpar_sysfs.c
992 index cdbfa5df3a51f..dbfa0b55d31a5 100644
993 --- a/drivers/pci/hotplug/rpadlpar_sysfs.c
994 +++ b/drivers/pci/hotplug/rpadlpar_sysfs.c
995 @@ -34,12 +34,11 @@ static ssize_t add_slot_store(struct kobject *kobj, struct kobj_attribute *attr,
996 if (nbytes >= MAX_DRC_NAME_LEN)
997 return 0;
998
999 - memcpy(drc_name, buf, nbytes);
1000 + strscpy(drc_name, buf, nbytes + 1);
1001
1002 end = strchr(drc_name, '\n');
1003 - if (!end)
1004 - end = &drc_name[nbytes];
1005 - *end = '\0';
1006 + if (end)
1007 + *end = '\0';
1008
1009 rc = dlpar_add_slot(drc_name);
1010 if (rc)
1011 @@ -65,12 +64,11 @@ static ssize_t remove_slot_store(struct kobject *kobj,
1012 if (nbytes >= MAX_DRC_NAME_LEN)
1013 return 0;
1014
1015 - memcpy(drc_name, buf, nbytes);
1016 + strscpy(drc_name, buf, nbytes + 1);
1017
1018 end = strchr(drc_name, '\n');
1019 - if (!end)
1020 - end = &drc_name[nbytes];
1021 - *end = '\0';
1022 + if (end)
1023 + *end = '\0';
1024
1025 rc = dlpar_remove_slot(drc_name);
1026 if (rc)
1027 diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
1028 index 8d34be60d3798..3c9248d2435e1 100644
1029 --- a/drivers/scsi/lpfc/lpfc_debugfs.c
1030 +++ b/drivers/scsi/lpfc/lpfc_debugfs.c
1031 @@ -2217,7 +2217,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1032 memset(dstbuf, 0, 33);
1033 size = (nbytes < 32) ? nbytes : 32;
1034 if (copy_from_user(dstbuf, buf, size))
1035 - return 0;
1036 + return -EFAULT;
1037
1038 if (dent == phba->debug_InjErrLBA) {
1039 if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
1040 @@ -2225,7 +2225,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1041 }
1042
1043 if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
1044 - return 0;
1045 + return -EINVAL;
1046
1047 if (dent == phba->debug_writeGuard)
1048 phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp;
1049 diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
1050 index eb0dd566330ab..cfc3f8b4174ab 100644
1051 --- a/drivers/scsi/myrs.c
1052 +++ b/drivers/scsi/myrs.c
1053 @@ -2274,12 +2274,12 @@ static void myrs_cleanup(struct myrs_hba *cs)
1054 if (cs->mmio_base) {
1055 cs->disable_intr(cs);
1056 iounmap(cs->mmio_base);
1057 + cs->mmio_base = NULL;
1058 }
1059 if (cs->irq)
1060 free_irq(cs->irq, cs);
1061 if (cs->io_addr)
1062 release_region(cs->io_addr, 0x80);
1063 - iounmap(cs->mmio_base);
1064 pci_set_drvdata(pdev, NULL);
1065 pci_disable_device(pdev);
1066 scsi_host_put(cs->host);
1067 diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
1068 index ed46fd74a292a..24dad1d78d1ea 100644
1069 --- a/drivers/usb/gadget/composite.c
1070 +++ b/drivers/usb/gadget/composite.c
1071 @@ -1091,7 +1091,7 @@ static void collect_langs(struct usb_gadget_strings **sp, __le16 *buf)
1072 while (*sp) {
1073 s = *sp;
1074 language = cpu_to_le16(s->language);
1075 - for (tmp = buf; *tmp && tmp < &buf[126]; tmp++) {
1076 + for (tmp = buf; *tmp && tmp < &buf[USB_MAX_STRING_LEN]; tmp++) {
1077 if (*tmp == language)
1078 goto repeat;
1079 }
1080 @@ -1166,7 +1166,7 @@ static int get_string(struct usb_composite_dev *cdev,
1081 collect_langs(sp, s->wData);
1082 }
1083
1084 - for (len = 0; len <= 126 && s->wData[len]; len++)
1085 + for (len = 0; len <= USB_MAX_STRING_LEN && s->wData[len]; len++)
1086 continue;
1087 if (!len)
1088 return -EINVAL;
1089 diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
1090 index 5b8b2ca4376cb..3d4710cc34bc1 100644
1091 --- a/drivers/usb/gadget/configfs.c
1092 +++ b/drivers/usb/gadget/configfs.c
1093 @@ -109,21 +109,27 @@ struct gadget_config_name {
1094 struct list_head list;
1095 };
1096
1097 +#define USB_MAX_STRING_WITH_NULL_LEN (USB_MAX_STRING_LEN+1)
1098 +
1099 static int usb_string_copy(const char *s, char **s_copy)
1100 {
1101 int ret;
1102 char *str;
1103 char *copy = *s_copy;
1104 ret = strlen(s);
1105 - if (ret > 126)
1106 + if (ret > USB_MAX_STRING_LEN)
1107 return -EOVERFLOW;
1108
1109 - str = kstrdup(s, GFP_KERNEL);
1110 - if (!str)
1111 - return -ENOMEM;
1112 + if (copy) {
1113 + str = copy;
1114 + } else {
1115 + str = kmalloc(USB_MAX_STRING_WITH_NULL_LEN, GFP_KERNEL);
1116 + if (!str)
1117 + return -ENOMEM;
1118 + }
1119 + strcpy(str, s);
1120 if (str[ret - 1] == '\n')
1121 str[ret - 1] = '\0';
1122 - kfree(copy);
1123 *s_copy = str;
1124 return 0;
1125 }
1126 diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
1127 index 7c24d1ce10889..33f77e59aa6fb 100644
1128 --- a/drivers/usb/gadget/usbstring.c
1129 +++ b/drivers/usb/gadget/usbstring.c
1130 @@ -55,9 +55,9 @@ usb_gadget_get_string (const struct usb_gadget_strings *table, int id, u8 *buf)
1131 return -EINVAL;
1132
1133 /* string descriptors have length, tag, then UTF16-LE text */
1134 - len = min ((size_t) 126, strlen (s->s));
1135 + len = min((size_t)USB_MAX_STRING_LEN, strlen(s->s));
1136 len = utf8s_to_utf16s(s->s, len, UTF16_LITTLE_ENDIAN,
1137 - (wchar_t *) &buf[2], 126);
1138 + (wchar_t *) &buf[2], USB_MAX_STRING_LEN);
1139 if (len < 0)
1140 return -EINVAL;
1141 buf [0] = (len + 1) * 2;
1142 diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
1143 index 96cb0409dd893..737b765d0f6ea 100644
1144 --- a/drivers/usb/storage/transport.c
1145 +++ b/drivers/usb/storage/transport.c
1146 @@ -651,6 +651,13 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
1147 need_auto_sense = 1;
1148 }
1149
1150 + /* Some devices (Kindle) require another command after SYNC CACHE */
1151 + if ((us->fflags & US_FL_SENSE_AFTER_SYNC) &&
1152 + srb->cmnd[0] == SYNCHRONIZE_CACHE) {
1153 + usb_stor_dbg(us, "-- sense after SYNC CACHE\n");
1154 + need_auto_sense = 1;
1155 + }
1156 +
1157 /*
1158 * If we have a failure, we're going to do a REQUEST_SENSE
1159 * automatically. Note that we differentiate between a command
1160 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1161 index 88275842219ef..861153d294b67 100644
1162 --- a/drivers/usb/storage/unusual_devs.h
1163 +++ b/drivers/usb/storage/unusual_devs.h
1164 @@ -2211,6 +2211,18 @@ UNUSUAL_DEV( 0x1908, 0x3335, 0x0200, 0x0200,
1165 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1166 US_FL_NO_READ_DISC_INFO ),
1167
1168 +/*
1169 + * Reported by Matthias Schwarzott <zzam@gentoo.org>
1170 + * The Amazon Kindle treats SYNCHRONIZE CACHE as an indication that
1171 + * the host may be finished with it, and automatically ejects its
1172 + * emulated media unless it receives another command within one second.
1173 + */
1174 +UNUSUAL_DEV( 0x1949, 0x0004, 0x0000, 0x9999,
1175 + "Amazon",
1176 + "Kindle",
1177 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1178 + US_FL_SENSE_AFTER_SYNC ),
1179 +
1180 /*
1181 * Reported by Oliver Neukum <oneukum@suse.com>
1182 * This device morphes spontaneously into another device if the access
1183 diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
1184 index 5bb84cb4876a9..c595da1761247 100644
1185 --- a/drivers/usb/typec/tcpm/tcpm.c
1186 +++ b/drivers/usb/typec/tcpm/tcpm.c
1187 @@ -739,6 +739,7 @@ static int tcpm_set_current_limit(struct tcpm_port *port, u32 max_ma, u32 mv)
1188
1189 port->supply_voltage = mv;
1190 port->current_limit = max_ma;
1191 + power_supply_changed(port->psy);
1192
1193 if (port->tcpc->set_current_limit)
1194 ret = port->tcpc->set_current_limit(port->tcpc, max_ma, mv);
1195 @@ -2138,6 +2139,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo,
1196
1197 port->pps_data.supported = false;
1198 port->usb_type = POWER_SUPPLY_USB_TYPE_PD;
1199 + power_supply_changed(port->psy);
1200
1201 /*
1202 * Select the source PDO providing the most power which has a
1203 @@ -2162,6 +2164,7 @@ static int tcpm_pd_select_pdo(struct tcpm_port *port, int *sink_pdo,
1204 port->pps_data.supported = true;
1205 port->usb_type =
1206 POWER_SUPPLY_USB_TYPE_PD_PPS;
1207 + power_supply_changed(port->psy);
1208 }
1209 continue;
1210 default:
1211 @@ -2319,6 +2322,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
1212 port->pps_data.out_volt));
1213 port->pps_data.op_curr = min(port->pps_data.max_curr,
1214 port->pps_data.op_curr);
1215 + power_supply_changed(port->psy);
1216 }
1217
1218 return src_pdo;
1219 @@ -2554,6 +2558,7 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge)
1220 return ret;
1221 }
1222 port->vbus_charge = charge;
1223 + power_supply_changed(port->psy);
1224 return 0;
1225 }
1226
1227 @@ -4665,7 +4670,7 @@ static int tcpm_psy_set_prop(struct power_supply *psy,
1228 ret = -EINVAL;
1229 break;
1230 }
1231 -
1232 + power_supply_changed(port->psy);
1233 return ret;
1234 }
1235
1236 @@ -4816,6 +4821,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
1237 err = devm_tcpm_psy_register(port);
1238 if (err)
1239 goto out_role_sw_put;
1240 + power_supply_changed(port->psy);
1241
1242 port->typec_port = typec_register_port(port->dev, &port->typec_caps);
1243 if (IS_ERR(port->typec_port)) {
1244 diff --git a/drivers/usb/usbip/vudc_sysfs.c b/drivers/usb/usbip/vudc_sysfs.c
1245 index a3ec39fc61778..7383a543c6d12 100644
1246 --- a/drivers/usb/usbip/vudc_sysfs.c
1247 +++ b/drivers/usb/usbip/vudc_sysfs.c
1248 @@ -174,7 +174,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
1249
1250 udc->ud.tcp_socket = socket;
1251 udc->ud.tcp_rx = tcp_rx;
1252 - udc->ud.tcp_rx = tcp_tx;
1253 + udc->ud.tcp_tx = tcp_tx;
1254 udc->ud.status = SDEV_ST_USED;
1255
1256 spin_unlock_irq(&udc->ud.lock);
1257 diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig
1258 index fd17db9b432f4..9dc95024afaeb 100644
1259 --- a/drivers/vfio/Kconfig
1260 +++ b/drivers/vfio/Kconfig
1261 @@ -21,7 +21,7 @@ config VFIO_VIRQFD
1262
1263 menuconfig VFIO
1264 tristate "VFIO Non-Privileged userspace driver framework"
1265 - depends on IOMMU_API
1266 + select IOMMU_API
1267 select VFIO_IOMMU_TYPE1 if (X86 || S390 || ARM || ARM64)
1268 help
1269 VFIO provides a framework for secure userspace device drivers.
1270 diff --git a/fs/afs/dir.c b/fs/afs/dir.c
1271 index 3c486340b2208..e7494cd49ce7b 100644
1272 --- a/fs/afs/dir.c
1273 +++ b/fs/afs/dir.c
1274 @@ -69,7 +69,6 @@ const struct inode_operations afs_dir_inode_operations = {
1275 .permission = afs_permission,
1276 .getattr = afs_getattr,
1277 .setattr = afs_setattr,
1278 - .listxattr = afs_listxattr,
1279 };
1280
1281 const struct address_space_operations afs_dir_aops = {
1282 diff --git a/fs/afs/file.c b/fs/afs/file.c
1283 index dd3c55c9101c4..5d0b472e984ba 100644
1284 --- a/fs/afs/file.c
1285 +++ b/fs/afs/file.c
1286 @@ -42,7 +42,6 @@ const struct inode_operations afs_file_inode_operations = {
1287 .getattr = afs_getattr,
1288 .setattr = afs_setattr,
1289 .permission = afs_permission,
1290 - .listxattr = afs_listxattr,
1291 };
1292
1293 const struct address_space_operations afs_fs_aops = {
1294 diff --git a/fs/afs/inode.c b/fs/afs/inode.c
1295 index a74e8e209454b..4f58b28a1edd2 100644
1296 --- a/fs/afs/inode.c
1297 +++ b/fs/afs/inode.c
1298 @@ -27,7 +27,6 @@
1299
1300 static const struct inode_operations afs_symlink_inode_operations = {
1301 .get_link = page_get_link,
1302 - .listxattr = afs_listxattr,
1303 };
1304
1305 static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)
1306 diff --git a/fs/afs/internal.h b/fs/afs/internal.h
1307 index 7fe88d918b238..c3ad582f9fd0e 100644
1308 --- a/fs/afs/internal.h
1309 +++ b/fs/afs/internal.h
1310 @@ -1354,7 +1354,6 @@ extern int afs_launder_page(struct page *);
1311 * xattr.c
1312 */
1313 extern const struct xattr_handler *afs_xattr_handlers[];
1314 -extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
1315
1316 /*
1317 * yfsclient.c
1318 diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c
1319 index 79bc5f1338edf..f105f061e89bb 100644
1320 --- a/fs/afs/mntpt.c
1321 +++ b/fs/afs/mntpt.c
1322 @@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
1323 .lookup = afs_mntpt_lookup,
1324 .readlink = page_readlink,
1325 .getattr = afs_getattr,
1326 - .listxattr = afs_listxattr,
1327 };
1328
1329 const struct inode_operations afs_autocell_inode_operations = {
1330 diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c
1331 index 5552d034090af..13292d4ca860c 100644
1332 --- a/fs/afs/xattr.c
1333 +++ b/fs/afs/xattr.c
1334 @@ -11,29 +11,6 @@
1335 #include <linux/xattr.h>
1336 #include "internal.h"
1337
1338 -static const char afs_xattr_list[] =
1339 - "afs.acl\0"
1340 - "afs.cell\0"
1341 - "afs.fid\0"
1342 - "afs.volume\0"
1343 - "afs.yfs.acl\0"
1344 - "afs.yfs.acl_inherited\0"
1345 - "afs.yfs.acl_num_cleaned\0"
1346 - "afs.yfs.vol_acl";
1347 -
1348 -/*
1349 - * Retrieve a list of the supported xattrs.
1350 - */
1351 -ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
1352 -{
1353 - if (size == 0)
1354 - return sizeof(afs_xattr_list);
1355 - if (size < sizeof(afs_xattr_list))
1356 - return -ERANGE;
1357 - memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
1358 - return sizeof(afs_xattr_list);
1359 -}
1360 -
1361 /*
1362 * Get a file's ACL.
1363 */
1364 diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
1365 index 1af73367087df..35741901f4e0b 100644
1366 --- a/fs/btrfs/ctree.c
1367 +++ b/fs/btrfs/ctree.c
1368 @@ -1406,7 +1406,9 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
1369 "failed to read tree block %llu from get_old_root",
1370 logical);
1371 } else {
1372 + btrfs_tree_read_lock(old);
1373 eb = btrfs_clone_extent_buffer(old);
1374 + btrfs_tree_read_unlock(old);
1375 free_extent_buffer(old);
1376 }
1377 } else if (old_root) {
1378 diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
1379 index 67b49b94c9cd6..b36a4d144bec0 100644
1380 --- a/fs/btrfs/inode.c
1381 +++ b/fs/btrfs/inode.c
1382 @@ -9628,7 +9628,7 @@ int __init btrfs_init_cachep(void)
1383
1384 btrfs_free_space_bitmap_cachep = kmem_cache_create("btrfs_free_space_bitmap",
1385 PAGE_SIZE, PAGE_SIZE,
1386 - SLAB_RED_ZONE, NULL);
1387 + SLAB_MEM_SPREAD, NULL);
1388 if (!btrfs_free_space_bitmap_cachep)
1389 goto fail;
1390
1391 diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
1392 index eab7940bfebef..e99ecfafffac3 100644
1393 --- a/fs/cifs/transport.c
1394 +++ b/fs/cifs/transport.c
1395 @@ -1134,9 +1134,12 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
1396 /*
1397 * Compounding is never used during session establish.
1398 */
1399 - if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP))
1400 + if ((ses->status == CifsNew) || (optype & CIFS_NEG_OP)) {
1401 + mutex_lock(&server->srv_mutex);
1402 smb311_update_preauth_hash(ses, rqst[0].rq_iov,
1403 rqst[0].rq_nvec);
1404 + mutex_unlock(&server->srv_mutex);
1405 + }
1406
1407 for (i = 0; i < num_rqst; i++) {
1408 rc = wait_for_response(server, midQ[i]);
1409 @@ -1204,7 +1207,9 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
1410 .iov_base = resp_iov[0].iov_base,
1411 .iov_len = resp_iov[0].iov_len
1412 };
1413 + mutex_lock(&server->srv_mutex);
1414 smb311_update_preauth_hash(ses, &iov, 1);
1415 + mutex_unlock(&server->srv_mutex);
1416 }
1417
1418 out:
1419 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1420 index 539d95bd364d4..efce97b938b7a 100644
1421 --- a/fs/ext4/inode.c
1422 +++ b/fs/ext4/inode.c
1423 @@ -5267,7 +5267,7 @@ static int ext4_do_update_inode(handle_t *handle,
1424 struct ext4_inode_info *ei = EXT4_I(inode);
1425 struct buffer_head *bh = iloc->bh;
1426 struct super_block *sb = inode->i_sb;
1427 - int err = 0, rc, block;
1428 + int err = 0, block;
1429 int need_datasync = 0, set_large_file = 0;
1430 uid_t i_uid;
1431 gid_t i_gid;
1432 @@ -5379,9 +5379,9 @@ static int ext4_do_update_inode(handle_t *handle,
1433 bh->b_data);
1434
1435 BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
1436 - rc = ext4_handle_dirty_metadata(handle, NULL, bh);
1437 - if (!err)
1438 - err = rc;
1439 + err = ext4_handle_dirty_metadata(handle, NULL, bh);
1440 + if (err)
1441 + goto out_brelse;
1442 ext4_clear_inode_state(inode, EXT4_STATE_NEW);
1443 if (set_large_file) {
1444 BUFFER_TRACE(EXT4_SB(sb)->s_sbh, "get write access");
1445 diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
1446 index 7f22487d502b5..e992a9f156714 100644
1447 --- a/fs/ext4/namei.c
1448 +++ b/fs/ext4/namei.c
1449 @@ -3547,6 +3547,31 @@ static int ext4_setent(handle_t *handle, struct ext4_renament *ent,
1450 return 0;
1451 }
1452
1453 +static void ext4_resetent(handle_t *handle, struct ext4_renament *ent,
1454 + unsigned ino, unsigned file_type)
1455 +{
1456 + struct ext4_renament old = *ent;
1457 + int retval = 0;
1458 +
1459 + /*
1460 + * old->de could have moved from under us during make indexed dir,
1461 + * so the old->de may no longer valid and need to find it again
1462 + * before reset old inode info.
1463 + */
1464 + old.bh = ext4_find_entry(old.dir, &old.dentry->d_name, &old.de, NULL);
1465 + if (IS_ERR(old.bh))
1466 + retval = PTR_ERR(old.bh);
1467 + if (!old.bh)
1468 + retval = -ENOENT;
1469 + if (retval) {
1470 + ext4_std_error(old.dir->i_sb, retval);
1471 + return;
1472 + }
1473 +
1474 + ext4_setent(handle, &old, ino, file_type);
1475 + brelse(old.bh);
1476 +}
1477 +
1478 static int ext4_find_delete_entry(handle_t *handle, struct inode *dir,
1479 const struct qstr *d_name)
1480 {
1481 @@ -3843,8 +3868,8 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
1482 end_rename:
1483 if (whiteout) {
1484 if (retval) {
1485 - ext4_setent(handle, &old,
1486 - old.inode->i_ino, old_file_type);
1487 + ext4_resetent(handle, &old,
1488 + old.inode->i_ino, old_file_type);
1489 drop_nlink(whiteout);
1490 }
1491 unlock_new_inode(whiteout);
1492 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
1493 index 894a61010ae99..5451f10800065 100644
1494 --- a/fs/ext4/xattr.c
1495 +++ b/fs/ext4/xattr.c
1496 @@ -2415,7 +2415,7 @@ retry_inode:
1497 * external inode if possible.
1498 */
1499 if (ext4_has_feature_ea_inode(inode->i_sb) &&
1500 - !i.in_inode) {
1501 + i.value_len && !i.in_inode) {
1502 i.in_inode = 1;
1503 goto retry_inode;
1504 }
1505 diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
1506 index 51c08ae79063c..662937472e9bd 100644
1507 --- a/fs/nfsd/filecache.c
1508 +++ b/fs/nfsd/filecache.c
1509 @@ -751,6 +751,8 @@ nfsd_file_find_locked(struct inode *inode, unsigned int may_flags,
1510 continue;
1511 if (!nfsd_match_cred(nf->nf_cred, current_cred()))
1512 continue;
1513 + if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags))
1514 + continue;
1515 if (nfsd_file_get(nf) != NULL)
1516 return nf;
1517 }
1518 diff --git a/fs/select.c b/fs/select.c
1519 index 53a0c149f5283..e51796063cb6e 100644
1520 --- a/fs/select.c
1521 +++ b/fs/select.c
1522 @@ -1037,10 +1037,9 @@ static long do_restart_poll(struct restart_block *restart_block)
1523
1524 ret = do_sys_poll(ufds, nfds, to);
1525
1526 - if (ret == -ERESTARTNOHAND) {
1527 - restart_block->fn = do_restart_poll;
1528 - ret = -ERESTART_RESTARTBLOCK;
1529 - }
1530 + if (ret == -ERESTARTNOHAND)
1531 + ret = set_restart_fn(restart_block, do_restart_poll);
1532 +
1533 return ret;
1534 }
1535
1536 @@ -1062,7 +1061,6 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
1537 struct restart_block *restart_block;
1538
1539 restart_block = &current->restart_block;
1540 - restart_block->fn = do_restart_poll;
1541 restart_block->poll.ufds = ufds;
1542 restart_block->poll.nfds = nfds;
1543
1544 @@ -1073,7 +1071,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
1545 } else
1546 restart_block->poll.has_timeout = 0;
1547
1548 - ret = -ERESTART_RESTARTBLOCK;
1549 + ret = set_restart_fn(restart_block, do_restart_poll);
1550 }
1551 return ret;
1552 }
1553 diff --git a/include/linux/efi.h b/include/linux/efi.h
1554 index 13ed2c6b13f8b..c82ef0eba4f84 100644
1555 --- a/include/linux/efi.h
1556 +++ b/include/linux/efi.h
1557 @@ -63,8 +63,10 @@ typedef void *efi_handle_t;
1558 */
1559 typedef guid_t efi_guid_t __aligned(__alignof__(u32));
1560
1561 -#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
1562 - GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)
1563 +#define EFI_GUID(a, b, c, d...) (efi_guid_t){ { \
1564 + (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
1565 + (b) & 0xff, ((b) >> 8) & 0xff, \
1566 + (c) & 0xff, ((c) >> 8) & 0xff, d } }
1567
1568 /*
1569 * Generic EFI table header
1570 diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
1571 index e93e249a4e9bf..f3040b0b4b235 100644
1572 --- a/include/linux/thread_info.h
1573 +++ b/include/linux/thread_info.h
1574 @@ -11,6 +11,7 @@
1575 #include <linux/types.h>
1576 #include <linux/bug.h>
1577 #include <linux/restart_block.h>
1578 +#include <linux/errno.h>
1579
1580 #ifdef CONFIG_THREAD_INFO_IN_TASK
1581 /*
1582 @@ -39,6 +40,18 @@ enum {
1583
1584 #ifdef __KERNEL__
1585
1586 +#ifndef arch_set_restart_data
1587 +#define arch_set_restart_data(restart) do { } while (0)
1588 +#endif
1589 +
1590 +static inline long set_restart_fn(struct restart_block *restart,
1591 + long (*fn)(struct restart_block *))
1592 +{
1593 + restart->fn = fn;
1594 + arch_set_restart_data(restart);
1595 + return -ERESTART_RESTARTBLOCK;
1596 +}
1597 +
1598 #ifndef THREAD_ALIGN
1599 #define THREAD_ALIGN THREAD_SIZE
1600 #endif
1601 diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
1602 index a7f7ebdd3069e..0a958c7948324 100644
1603 --- a/include/linux/usb_usual.h
1604 +++ b/include/linux/usb_usual.h
1605 @@ -86,6 +86,8 @@
1606 /* lies about caching, so always sync */ \
1607 US_FLAG(NO_SAME, 0x40000000) \
1608 /* Cannot handle WRITE_SAME */ \
1609 + US_FLAG(SENSE_AFTER_SYNC, 0x80000000) \
1610 + /* Do REQUEST_SENSE after SYNCHRONIZE_CACHE */ \
1611
1612 #define US_FLAG(name, value) US_FL_##name = value ,
1613 enum { US_DO_ALL_FLAGS };
1614 diff --git a/include/uapi/linux/usb/ch9.h b/include/uapi/linux/usb/ch9.h
1615 index 2b623f36af6bc..5633c804683e2 100644
1616 --- a/include/uapi/linux/usb/ch9.h
1617 +++ b/include/uapi/linux/usb/ch9.h
1618 @@ -364,6 +364,9 @@ struct usb_config_descriptor {
1619
1620 /*-------------------------------------------------------------------------*/
1621
1622 +/* USB String descriptors can contain at most 126 characters. */
1623 +#define USB_MAX_STRING_LEN 126
1624 +
1625 /* USB_DT_STRING: String descriptor */
1626 struct usb_string_descriptor {
1627 __u8 bLength;
1628 diff --git a/kernel/futex.c b/kernel/futex.c
1629 index 042c2707e9131..36a2a923f7ccf 100644
1630 --- a/kernel/futex.c
1631 +++ b/kernel/futex.c
1632 @@ -2865,14 +2865,13 @@ retry:
1633 goto out;
1634
1635 restart = &current->restart_block;
1636 - restart->fn = futex_wait_restart;
1637 restart->futex.uaddr = uaddr;
1638 restart->futex.val = val;
1639 restart->futex.time = *abs_time;
1640 restart->futex.bitset = bitset;
1641 restart->futex.flags = flags | FLAGS_HAS_TIMEOUT;
1642
1643 - ret = -ERESTART_RESTARTBLOCK;
1644 + ret = set_restart_fn(restart, futex_wait_restart);
1645
1646 out:
1647 if (to) {
1648 diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
1649 index 3b1d0a4725a49..918fe05933862 100644
1650 --- a/kernel/irq/manage.c
1651 +++ b/kernel/irq/manage.c
1652 @@ -1026,11 +1026,15 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action)
1653 irqreturn_t ret;
1654
1655 local_bh_disable();
1656 + if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1657 + local_irq_disable();
1658 ret = action->thread_fn(action->irq, action->dev_id);
1659 if (ret == IRQ_HANDLED)
1660 atomic_inc(&desc->threads_handled);
1661
1662 irq_finalize_oneshot(desc, action);
1663 + if (!IS_ENABLED(CONFIG_PREEMPT_RT))
1664 + local_irq_enable();
1665 local_bh_enable();
1666 return ret;
1667 }
1668 diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
1669 index b97401f6bc232..0e96c38204a84 100644
1670 --- a/kernel/time/alarmtimer.c
1671 +++ b/kernel/time/alarmtimer.c
1672 @@ -838,9 +838,9 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
1673 if (flags == TIMER_ABSTIME)
1674 return -ERESTARTNOHAND;
1675
1676 - restart->fn = alarm_timer_nsleep_restart;
1677 restart->nanosleep.clockid = type;
1678 restart->nanosleep.expires = exp;
1679 + set_restart_fn(restart, alarm_timer_nsleep_restart);
1680 return ret;
1681 }
1682
1683 diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
1684 index 299a4c5b6cf8d..1f3e3a17f67e0 100644
1685 --- a/kernel/time/hrtimer.c
1686 +++ b/kernel/time/hrtimer.c
1687 @@ -1953,9 +1953,9 @@ long hrtimer_nanosleep(const struct timespec64 *rqtp,
1688 }
1689
1690 restart = &current->restart_block;
1691 - restart->fn = hrtimer_nanosleep_restart;
1692 restart->nanosleep.clockid = t.timer.base->clockid;
1693 restart->nanosleep.expires = hrtimer_get_expires_tv64(&t.timer);
1694 + set_restart_fn(restart, hrtimer_nanosleep_restart);
1695 out:
1696 destroy_hrtimer_on_stack(&t.timer);
1697 return ret;
1698 diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
1699 index 42d512fcfda2e..eacb0ca301932 100644
1700 --- a/kernel/time/posix-cpu-timers.c
1701 +++ b/kernel/time/posix-cpu-timers.c
1702 @@ -1335,8 +1335,8 @@ static int posix_cpu_nsleep(const clockid_t which_clock, int flags,
1703 if (flags & TIMER_ABSTIME)
1704 return -ERESTARTNOHAND;
1705
1706 - restart_block->fn = posix_cpu_nsleep_restart;
1707 restart_block->nanosleep.clockid = which_clock;
1708 + set_restart_fn(restart_block, posix_cpu_nsleep_restart);
1709 }
1710 return error;
1711 }
1712 diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
1713 index 6e023e93d3186..0d4f12dbd2443 100644
1714 --- a/net/qrtr/qrtr.c
1715 +++ b/net/qrtr/qrtr.c
1716 @@ -264,7 +264,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len)
1717 if (len == 0 || len & 3)
1718 return -EINVAL;
1719
1720 - skb = netdev_alloc_skb(NULL, len);
1721 + skb = __netdev_alloc_skb(NULL, len, GFP_ATOMIC | __GFP_NOWARN);
1722 if (!skb)
1723 return -ENOMEM;
1724
1725 diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
1726 index f0dcb6d14bbb1..1741f114e8ff7 100644
1727 --- a/net/sunrpc/svc.c
1728 +++ b/net/sunrpc/svc.c
1729 @@ -1417,7 +1417,7 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
1730
1731 sendit:
1732 if (svc_authorise(rqstp))
1733 - goto close;
1734 + goto close_xprt;
1735 return 1; /* Caller can now send it */
1736
1737 release_dropit:
1738 @@ -1429,6 +1429,8 @@ release_dropit:
1739 return 0;
1740
1741 close:
1742 + svc_authorise(rqstp);
1743 +close_xprt:
1744 if (rqstp->rq_xprt && test_bit(XPT_TEMP, &rqstp->rq_xprt->xpt_flags))
1745 svc_close_xprt(rqstp->rq_xprt);
1746 dprintk("svc: svc_process close\n");
1747 @@ -1437,7 +1439,7 @@ release_dropit:
1748 err_short_len:
1749 svc_printk(rqstp, "short len %zd, dropping request\n",
1750 argv->iov_len);
1751 - goto close;
1752 + goto close_xprt;
1753
1754 err_bad_rpc:
1755 serv->sv_stats->rpcbadfmt++;
1756 diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
1757 index fe4cd0b4c4127..f911153339a96 100644
1758 --- a/net/sunrpc/svc_xprt.c
1759 +++ b/net/sunrpc/svc_xprt.c
1760 @@ -1072,7 +1072,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st
1761 struct svc_xprt *xprt;
1762 int ret = 0;
1763
1764 - spin_lock(&serv->sv_lock);
1765 + spin_lock_bh(&serv->sv_lock);
1766 list_for_each_entry(xprt, xprt_list, xpt_list) {
1767 if (xprt->xpt_net != net)
1768 continue;
1769 @@ -1080,7 +1080,7 @@ static int svc_close_list(struct svc_serv *serv, struct list_head *xprt_list, st
1770 set_bit(XPT_CLOSE, &xprt->xpt_flags);
1771 svc_xprt_enqueue(xprt);
1772 }
1773 - spin_unlock(&serv->sv_lock);
1774 + spin_unlock_bh(&serv->sv_lock);
1775 return ret;
1776 }
1777
1778 diff --git a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1779 index 68d2dcf0a1be1..0ff5c5971dddc 100644
1780 --- a/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1781 +++ b/net/sunrpc/xprtrdma/svc_rdma_backchannel.c
1782 @@ -285,9 +285,9 @@ xprt_setup_rdma_bc(struct xprt_create *args)
1783 xprt->timeout = &xprt_rdma_bc_timeout;
1784 xprt_set_bound(xprt);
1785 xprt_set_connected(xprt);
1786 - xprt->bind_timeout = RPCRDMA_BIND_TO;
1787 - xprt->reestablish_timeout = RPCRDMA_INIT_REEST_TO;
1788 - xprt->idle_timeout = RPCRDMA_IDLE_DISC_TO;
1789 + xprt->bind_timeout = 0;
1790 + xprt->reestablish_timeout = 0;
1791 + xprt->idle_timeout = 0;
1792
1793 xprt->prot = XPRT_TRANSPORT_BC_RDMA;
1794 xprt->ops = &xprt_rdma_bc_procs;
1795 diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
1796 index f6a8627ae5a2b..0aa3c56cf3907 100644
1797 --- a/sound/firewire/dice/dice-stream.c
1798 +++ b/sound/firewire/dice/dice-stream.c
1799 @@ -489,11 +489,10 @@ void snd_dice_stream_stop_duplex(struct snd_dice *dice)
1800 struct reg_params tx_params, rx_params;
1801
1802 if (dice->substreams_counter == 0) {
1803 - if (get_register_params(dice, &tx_params, &rx_params) >= 0) {
1804 - amdtp_domain_stop(&dice->domain);
1805 + if (get_register_params(dice, &tx_params, &rx_params) >= 0)
1806 finish_session(dice, &tx_params, &rx_params);
1807 - }
1808
1809 + amdtp_domain_stop(&dice->domain);
1810 release_resources(dice);
1811 }
1812 }
1813 diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
1814 index 3caea6d58c9aa..efceeae09045f 100644
1815 --- a/sound/pci/hda/hda_generic.c
1816 +++ b/sound/pci/hda/hda_generic.c
1817 @@ -4017,7 +4017,7 @@ int snd_hda_gen_add_micmute_led(struct hda_codec *codec,
1818
1819 spec->micmute_led.led_mode = MICMUTE_LED_FOLLOW_MUTE;
1820 spec->micmute_led.capture = 0;
1821 - spec->micmute_led.led_value = 0;
1822 + spec->micmute_led.led_value = -1;
1823 spec->micmute_led.old_hook = spec->cap_sync_hook;
1824 spec->micmute_led.update = hook;
1825 spec->cap_sync_hook = update_micmute_led;
1826 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1827 index 1283796316b62..73580e8208ed1 100644
1828 --- a/sound/pci/hda/patch_realtek.c
1829 +++ b/sound/pci/hda/patch_realtek.c
1830 @@ -8102,7 +8102,9 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
1831 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
1832 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
1833 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
1834 + SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
1835 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
1836 + SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
1837 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
1838 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
1839 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
1840 diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c
1841 index 217e8ce9a4ba4..eca5fc559d694 100644
1842 --- a/sound/soc/codecs/ak4458.c
1843 +++ b/sound/soc/codecs/ak4458.c
1844 @@ -707,6 +707,7 @@ static const struct of_device_id ak4458_of_match[] = {
1845 { .compatible = "asahi-kasei,ak4497", .data = &ak4497_drvdata},
1846 { },
1847 };
1848 +MODULE_DEVICE_TABLE(of, ak4458_of_match);
1849
1850 static struct i2c_driver ak4458_i2c_driver = {
1851 .driver = {
1852 diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c
1853 index 8179512129d35..5eb4168bb9d93 100644
1854 --- a/sound/soc/codecs/ak5558.c
1855 +++ b/sound/soc/codecs/ak5558.c
1856 @@ -389,6 +389,7 @@ static const struct of_device_id ak5558_i2c_dt_ids[] = {
1857 { .compatible = "asahi-kasei,ak5558"},
1858 { }
1859 };
1860 +MODULE_DEVICE_TABLE(of, ak5558_i2c_dt_ids);
1861
1862 static struct i2c_driver ak5558_i2c_driver = {
1863 .driver = {
1864 diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
1865 index a4ebd6ddaba10..ed18bc69e0954 100644
1866 --- a/sound/soc/fsl/fsl_ssi.c
1867 +++ b/sound/soc/fsl/fsl_ssi.c
1868 @@ -873,6 +873,7 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
1869 static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
1870 {
1871 u32 strcr = 0, scr = 0, stcr, srcr, mask;
1872 + unsigned int slots;
1873
1874 ssi->dai_fmt = fmt;
1875
1876 @@ -904,10 +905,11 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
1877 return -EINVAL;
1878 }
1879
1880 + slots = ssi->slots ? : 2;
1881 regmap_update_bits(ssi->regs, REG_SSI_STCCR,
1882 - SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2));
1883 + SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots));
1884 regmap_update_bits(ssi->regs, REG_SSI_SRCCR,
1885 - SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(2));
1886 + SSI_SxCCR_DC_MASK, SSI_SxCCR_DC(slots));
1887
1888 /* Data on rising edge of bclk, frame low, 1clk before data */
1889 strcr |= SSI_STCR_TFSI | SSI_STCR_TSCKP | SSI_STCR_TEFS;
1890 diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
1891 index edad6721251f4..9b794775df537 100644
1892 --- a/sound/soc/generic/simple-card-utils.c
1893 +++ b/sound/soc/generic/simple-card-utils.c
1894 @@ -172,15 +172,16 @@ int asoc_simple_parse_clk(struct device *dev,
1895 * or device's module clock.
1896 */
1897 clk = devm_get_clk_from_child(dev, node, NULL);
1898 - if (IS_ERR(clk))
1899 - clk = devm_get_clk_from_child(dev, dlc->of_node, NULL);
1900 -
1901 if (!IS_ERR(clk)) {
1902 - simple_dai->clk = clk;
1903 simple_dai->sysclk = clk_get_rate(clk);
1904 - } else if (!of_property_read_u32(node, "system-clock-frequency",
1905 - &val)) {
1906 +
1907 + simple_dai->clk = clk;
1908 + } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) {
1909 simple_dai->sysclk = val;
1910 + } else {
1911 + clk = devm_get_clk_from_child(dev, dlc->of_node, NULL);
1912 + if (!IS_ERR(clk))
1913 + simple_dai->sysclk = clk_get_rate(clk);
1914 }
1915
1916 if (of_property_read_bool(node, "system-clock-direction-out"))
1917 diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
1918 index fb55a3c5afd0d..94b093b370e2f 100644
1919 --- a/sound/soc/sof/intel/hda-dsp.c
1920 +++ b/sound/soc/sof/intel/hda-dsp.c
1921 @@ -179,7 +179,7 @@ int hda_dsp_core_power_down(struct snd_sof_dev *sdev, unsigned int core_mask)
1922
1923 return snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
1924 HDA_DSP_REG_ADSPCS, adspcs,
1925 - !(adspcs & HDA_DSP_ADSPCS_SPA_MASK(core_mask)),
1926 + !(adspcs & HDA_DSP_ADSPCS_CPA_MASK(core_mask)),
1927 HDA_DSP_REG_POLL_INTERVAL_US,
1928 HDA_DSP_PD_TIMEOUT * USEC_PER_MSEC);
1929 }
1930 diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
1931 index 3c4b604412f0e..a10166741865c 100644
1932 --- a/sound/soc/sof/intel/hda.c
1933 +++ b/sound/soc/sof/intel/hda.c
1934 @@ -672,6 +672,7 @@ free_streams:
1935 /* dsp_unmap: not currently used */
1936 iounmap(sdev->bar[HDA_DSP_BAR]);
1937 hdac_bus_unmap:
1938 + platform_device_unregister(hdev->dmic_dev);
1939 iounmap(bus->remap_addr);
1940 err:
1941 return ret;