1 |
commit: 783270ff21e13e4527333d3b0118d6745ae4c2de |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 12 14:38:34 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 12 14:38:34 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=783270ff |
7 |
|
8 |
Loinux patch 5.4.145 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1144_linux-5.4.145.patch | 1373 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 1377 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 856bee4..0712ff5 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -619,6 +619,10 @@ Patch: 1143_linux-5.4.144.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.144 |
23 |
|
24 |
+Patch: 1144_linux-5.4.145.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.145 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1144_linux-5.4.145.patch b/1144_linux-5.4.145.patch |
33 |
new file mode 100644 |
34 |
index 0000000..0413ae4 |
35 |
--- /dev/null |
36 |
+++ b/1144_linux-5.4.145.patch |
37 |
@@ -0,0 +1,1373 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 3c3804197b511..c32a36c8ffc90 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 144 |
47 |
++SUBLEVEL = 145 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig |
52 |
+index 8383155c8c824..a9d0b5310165f 100644 |
53 |
+--- a/arch/arc/Kconfig |
54 |
++++ b/arch/arc/Kconfig |
55 |
+@@ -29,6 +29,7 @@ config ARC |
56 |
+ select GENERIC_SMP_IDLE_THREAD |
57 |
+ select HAVE_ARCH_KGDB |
58 |
+ select HAVE_ARCH_TRACEHOOK |
59 |
++ select HAVE_COPY_THREAD_TLS |
60 |
+ select HAVE_DEBUG_STACKOVERFLOW |
61 |
+ select HAVE_FUTEX_CMPXCHG if FUTEX |
62 |
+ select HAVE_IOREMAP_PROT |
63 |
+diff --git a/arch/arc/include/asm/syscalls.h b/arch/arc/include/asm/syscalls.h |
64 |
+index 7ddba13e9b599..c3f4714a4f5cd 100644 |
65 |
+--- a/arch/arc/include/asm/syscalls.h |
66 |
++++ b/arch/arc/include/asm/syscalls.h |
67 |
+@@ -11,6 +11,7 @@ |
68 |
+ #include <linux/types.h> |
69 |
+ |
70 |
+ int sys_clone_wrapper(int, int, int, int, int); |
71 |
++int sys_clone3_wrapper(void *, size_t); |
72 |
+ int sys_cacheflush(uint32_t, uint32_t uint32_t); |
73 |
+ int sys_arc_settls(void *); |
74 |
+ int sys_arc_gettls(void); |
75 |
+diff --git a/arch/arc/include/uapi/asm/unistd.h b/arch/arc/include/uapi/asm/unistd.h |
76 |
+index 5eafa11151623..fa2713ae6bea5 100644 |
77 |
+--- a/arch/arc/include/uapi/asm/unistd.h |
78 |
++++ b/arch/arc/include/uapi/asm/unistd.h |
79 |
+@@ -21,6 +21,7 @@ |
80 |
+ #define __ARCH_WANT_SET_GET_RLIMIT |
81 |
+ #define __ARCH_WANT_SYS_EXECVE |
82 |
+ #define __ARCH_WANT_SYS_CLONE |
83 |
++#define __ARCH_WANT_SYS_CLONE3 |
84 |
+ #define __ARCH_WANT_SYS_VFORK |
85 |
+ #define __ARCH_WANT_SYS_FORK |
86 |
+ #define __ARCH_WANT_TIME32_SYSCALLS |
87 |
+diff --git a/arch/arc/kernel/entry.S b/arch/arc/kernel/entry.S |
88 |
+index b37ca852a9f7e..cef1d3f2656f6 100644 |
89 |
+--- a/arch/arc/kernel/entry.S |
90 |
++++ b/arch/arc/kernel/entry.S |
91 |
+@@ -35,6 +35,18 @@ ENTRY(sys_clone_wrapper) |
92 |
+ b .Lret_from_system_call |
93 |
+ END(sys_clone_wrapper) |
94 |
+ |
95 |
++ENTRY(sys_clone3_wrapper) |
96 |
++ SAVE_CALLEE_SAVED_USER |
97 |
++ bl @sys_clone3 |
98 |
++ DISCARD_CALLEE_SAVED_USER |
99 |
++ |
100 |
++ GET_CURR_THR_INFO_FLAGS r10 |
101 |
++ btst r10, TIF_SYSCALL_TRACE |
102 |
++ bnz tracesys_exit |
103 |
++ |
104 |
++ b .Lret_from_system_call |
105 |
++END(sys_clone3_wrapper) |
106 |
++ |
107 |
+ ENTRY(ret_from_fork) |
108 |
+ ; when the forked child comes here from the __switch_to function |
109 |
+ ; r0 has the last task pointer. |
110 |
+diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c |
111 |
+index e1889ce3faf96..bfd4cbe74aa36 100644 |
112 |
+--- a/arch/arc/kernel/process.c |
113 |
++++ b/arch/arc/kernel/process.c |
114 |
+@@ -171,9 +171,8 @@ asmlinkage void ret_from_fork(void); |
115 |
+ * | user_r25 | |
116 |
+ * ------------------ <===== END of PAGE |
117 |
+ */ |
118 |
+-int copy_thread(unsigned long clone_flags, |
119 |
+- unsigned long usp, unsigned long kthread_arg, |
120 |
+- struct task_struct *p) |
121 |
++int copy_thread_tls(unsigned long clone_flags, unsigned long usp, |
122 |
++ unsigned long kthread_arg, struct task_struct *p, unsigned long tls) |
123 |
+ { |
124 |
+ struct pt_regs *c_regs; /* child's pt_regs */ |
125 |
+ unsigned long *childksp; /* to unwind out of __switch_to() */ |
126 |
+@@ -231,7 +230,7 @@ int copy_thread(unsigned long clone_flags, |
127 |
+ * set task's userland tls data ptr from 4th arg |
128 |
+ * clone C-lib call is difft from clone sys-call |
129 |
+ */ |
130 |
+- task_thread_info(p)->thr_ptr = regs->r3; |
131 |
++ task_thread_info(p)->thr_ptr = tls; |
132 |
+ } else { |
133 |
+ /* Normal fork case: set parent's TLS ptr in child */ |
134 |
+ task_thread_info(p)->thr_ptr = |
135 |
+diff --git a/arch/arc/kernel/sys.c b/arch/arc/kernel/sys.c |
136 |
+index fddecc76efb7c..1069446bdc589 100644 |
137 |
+--- a/arch/arc/kernel/sys.c |
138 |
++++ b/arch/arc/kernel/sys.c |
139 |
+@@ -7,6 +7,7 @@ |
140 |
+ #include <asm/syscalls.h> |
141 |
+ |
142 |
+ #define sys_clone sys_clone_wrapper |
143 |
++#define sys_clone3 sys_clone3_wrapper |
144 |
+ |
145 |
+ #undef __SYSCALL |
146 |
+ #define __SYSCALL(nr, call) [nr] = (call), |
147 |
+diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile |
148 |
+index 8cad59465af39..8b679e2ca3c3d 100644 |
149 |
+--- a/arch/arm/kernel/Makefile |
150 |
++++ b/arch/arm/kernel/Makefile |
151 |
+@@ -17,10 +17,14 @@ CFLAGS_REMOVE_return_address.o = -pg |
152 |
+ # Object file lists. |
153 |
+ |
154 |
+ obj-y := elf.o entry-common.o irq.o opcodes.o \ |
155 |
+- process.o ptrace.o reboot.o return_address.o \ |
156 |
++ process.o ptrace.o reboot.o \ |
157 |
+ setup.o signal.o sigreturn_codes.o \ |
158 |
+ stacktrace.o sys_arm.o time.o traps.o |
159 |
+ |
160 |
++ifneq ($(CONFIG_ARM_UNWIND),y) |
161 |
++obj-$(CONFIG_FRAME_POINTER) += return_address.o |
162 |
++endif |
163 |
++ |
164 |
+ obj-$(CONFIG_ATAGS) += atags_parse.o |
165 |
+ obj-$(CONFIG_ATAGS_PROC) += atags_proc.o |
166 |
+ obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o |
167 |
+diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c |
168 |
+index b0d2f1fe891d1..7b42ac010fdfd 100644 |
169 |
+--- a/arch/arm/kernel/return_address.c |
170 |
++++ b/arch/arm/kernel/return_address.c |
171 |
+@@ -7,8 +7,6 @@ |
172 |
+ */ |
173 |
+ #include <linux/export.h> |
174 |
+ #include <linux/ftrace.h> |
175 |
+- |
176 |
+-#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) |
177 |
+ #include <linux/sched.h> |
178 |
+ |
179 |
+ #include <asm/stacktrace.h> |
180 |
+@@ -53,6 +51,4 @@ void *return_address(unsigned int level) |
181 |
+ return NULL; |
182 |
+ } |
183 |
+ |
184 |
+-#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */ |
185 |
+- |
186 |
+ EXPORT_SYMBOL_GPL(return_address); |
187 |
+diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S |
188 |
+index 92608f34d3123..1d83966f5ef64 100644 |
189 |
+--- a/arch/powerpc/boot/crt0.S |
190 |
++++ b/arch/powerpc/boot/crt0.S |
191 |
+@@ -44,9 +44,6 @@ p_end: .long _end |
192 |
+ p_pstack: .long _platform_stack_top |
193 |
+ #endif |
194 |
+ |
195 |
+- .globl _zimage_start |
196 |
+- /* Clang appears to require the .weak directive to be after the symbol |
197 |
+- * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ |
198 |
+ .weak _zimage_start |
199 |
+ _zimage_start: |
200 |
+ .globl _zimage_start_lib |
201 |
+diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c |
202 |
+index 39169885adfa8..ff07040287c40 100644 |
203 |
+--- a/arch/x86/events/amd/ibs.c |
204 |
++++ b/arch/x86/events/amd/ibs.c |
205 |
+@@ -90,6 +90,7 @@ struct perf_ibs { |
206 |
+ unsigned long offset_mask[1]; |
207 |
+ int offset_max; |
208 |
+ unsigned int fetch_count_reset_broken : 1; |
209 |
++ unsigned int fetch_ignore_if_zero_rip : 1; |
210 |
+ struct cpu_perf_ibs __percpu *pcpu; |
211 |
+ |
212 |
+ struct attribute **format_attrs; |
213 |
+@@ -663,6 +664,10 @@ fail: |
214 |
+ if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) { |
215 |
+ regs.flags &= ~PERF_EFLAGS_EXACT; |
216 |
+ } else { |
217 |
++ /* Workaround for erratum #1197 */ |
218 |
++ if (perf_ibs->fetch_ignore_if_zero_rip && !(ibs_data.regs[1])) |
219 |
++ goto out; |
220 |
++ |
221 |
+ set_linear_ip(®s, ibs_data.regs[1]); |
222 |
+ regs.flags |= PERF_EFLAGS_EXACT; |
223 |
+ } |
224 |
+@@ -756,6 +761,9 @@ static __init void perf_event_ibs_init(void) |
225 |
+ if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) |
226 |
+ perf_ibs_fetch.fetch_count_reset_broken = 1; |
227 |
+ |
228 |
++ if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model < 0x10) |
229 |
++ perf_ibs_fetch.fetch_ignore_if_zero_rip = 1; |
230 |
++ |
231 |
+ perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); |
232 |
+ |
233 |
+ if (ibs_caps & IBS_CAPS_OPCNT) { |
234 |
+diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c |
235 |
+index 6a98a76516214..2da6139b0977f 100644 |
236 |
+--- a/arch/x86/events/amd/iommu.c |
237 |
++++ b/arch/x86/events/amd/iommu.c |
238 |
+@@ -18,8 +18,6 @@ |
239 |
+ #include "../perf_event.h" |
240 |
+ #include "iommu.h" |
241 |
+ |
242 |
+-#define COUNTER_SHIFT 16 |
243 |
+- |
244 |
+ /* iommu pmu conf masks */ |
245 |
+ #define GET_CSOURCE(x) ((x)->conf & 0xFFULL) |
246 |
+ #define GET_DEVID(x) (((x)->conf >> 8) & 0xFFFFULL) |
247 |
+@@ -285,22 +283,31 @@ static void perf_iommu_start(struct perf_event *event, int flags) |
248 |
+ WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); |
249 |
+ hwc->state = 0; |
250 |
+ |
251 |
++ /* |
252 |
++ * To account for power-gating, which prevents write to |
253 |
++ * the counter, we need to enable the counter |
254 |
++ * before setting up counter register. |
255 |
++ */ |
256 |
++ perf_iommu_enable_event(event); |
257 |
++ |
258 |
+ if (flags & PERF_EF_RELOAD) { |
259 |
+- u64 prev_raw_count = local64_read(&hwc->prev_count); |
260 |
++ u64 count = 0; |
261 |
+ struct amd_iommu *iommu = perf_event_2_iommu(event); |
262 |
+ |
263 |
++ /* |
264 |
++ * Since the IOMMU PMU only support counting mode, |
265 |
++ * the counter always start with value zero. |
266 |
++ */ |
267 |
+ amd_iommu_pc_set_reg(iommu, hwc->iommu_bank, hwc->iommu_cntr, |
268 |
+- IOMMU_PC_COUNTER_REG, &prev_raw_count); |
269 |
++ IOMMU_PC_COUNTER_REG, &count); |
270 |
+ } |
271 |
+ |
272 |
+- perf_iommu_enable_event(event); |
273 |
+ perf_event_update_userpage(event); |
274 |
+- |
275 |
+ } |
276 |
+ |
277 |
+ static void perf_iommu_read(struct perf_event *event) |
278 |
+ { |
279 |
+- u64 count, prev, delta; |
280 |
++ u64 count; |
281 |
+ struct hw_perf_event *hwc = &event->hw; |
282 |
+ struct amd_iommu *iommu = perf_event_2_iommu(event); |
283 |
+ |
284 |
+@@ -311,14 +318,11 @@ static void perf_iommu_read(struct perf_event *event) |
285 |
+ /* IOMMU pc counter register is only 48 bits */ |
286 |
+ count &= GENMASK_ULL(47, 0); |
287 |
+ |
288 |
+- prev = local64_read(&hwc->prev_count); |
289 |
+- if (local64_cmpxchg(&hwc->prev_count, prev, count) != prev) |
290 |
+- return; |
291 |
+- |
292 |
+- /* Handle 48-bit counter overflow */ |
293 |
+- delta = (count << COUNTER_SHIFT) - (prev << COUNTER_SHIFT); |
294 |
+- delta >>= COUNTER_SHIFT; |
295 |
+- local64_add(delta, &event->count); |
296 |
++ /* |
297 |
++ * Since the counter always start with value zero, |
298 |
++ * simply just accumulate the count for the event. |
299 |
++ */ |
300 |
++ local64_add(count, &event->count); |
301 |
+ } |
302 |
+ |
303 |
+ static void perf_iommu_stop(struct perf_event *event, int flags) |
304 |
+@@ -328,15 +332,16 @@ static void perf_iommu_stop(struct perf_event *event, int flags) |
305 |
+ if (hwc->state & PERF_HES_UPTODATE) |
306 |
+ return; |
307 |
+ |
308 |
++ /* |
309 |
++ * To account for power-gating, in which reading the counter would |
310 |
++ * return zero, we need to read the register before disabling. |
311 |
++ */ |
312 |
++ perf_iommu_read(event); |
313 |
++ hwc->state |= PERF_HES_UPTODATE; |
314 |
++ |
315 |
+ perf_iommu_disable_event(event); |
316 |
+ WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); |
317 |
+ hwc->state |= PERF_HES_STOPPED; |
318 |
+- |
319 |
+- if (hwc->state & PERF_HES_UPTODATE) |
320 |
+- return; |
321 |
+- |
322 |
+- perf_iommu_read(event); |
323 |
+- hwc->state |= PERF_HES_UPTODATE; |
324 |
+ } |
325 |
+ |
326 |
+ static int perf_iommu_add(struct perf_event *event, int flags) |
327 |
+diff --git a/arch/x86/events/amd/power.c b/arch/x86/events/amd/power.c |
328 |
+index abef51320e3a5..c4892b7d0c36b 100644 |
329 |
+--- a/arch/x86/events/amd/power.c |
330 |
++++ b/arch/x86/events/amd/power.c |
331 |
+@@ -217,6 +217,7 @@ static struct pmu pmu_class = { |
332 |
+ .stop = pmu_event_stop, |
333 |
+ .read = pmu_event_read, |
334 |
+ .capabilities = PERF_PMU_CAP_NO_EXCLUDE, |
335 |
++ .module = THIS_MODULE, |
336 |
+ }; |
337 |
+ |
338 |
+ static int power_cpu_exit(unsigned int cpu) |
339 |
+diff --git a/arch/x86/events/intel/pt.c b/arch/x86/events/intel/pt.c |
340 |
+index 05e43d0f430bc..da289a44d5116 100644 |
341 |
+--- a/arch/x86/events/intel/pt.c |
342 |
++++ b/arch/x86/events/intel/pt.c |
343 |
+@@ -62,7 +62,7 @@ static struct pt_cap_desc { |
344 |
+ PT_CAP(single_range_output, 0, CPUID_ECX, BIT(2)), |
345 |
+ PT_CAP(output_subsys, 0, CPUID_ECX, BIT(3)), |
346 |
+ PT_CAP(payloads_lip, 0, CPUID_ECX, BIT(31)), |
347 |
+- PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x3), |
348 |
++ PT_CAP(num_address_ranges, 1, CPUID_EAX, 0x7), |
349 |
+ PT_CAP(mtc_periods, 1, CPUID_EAX, 0xffff0000), |
350 |
+ PT_CAP(cycle_thresholds, 1, CPUID_EBX, 0xffff), |
351 |
+ PT_CAP(psb_periods, 1, CPUID_EBX, 0xffff0000), |
352 |
+diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
353 |
+index b1b96d461bc76..d65d1afb27161 100644 |
354 |
+--- a/arch/x86/kernel/reboot.c |
355 |
++++ b/arch/x86/kernel/reboot.c |
356 |
+@@ -388,10 +388,11 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = { |
357 |
+ }, |
358 |
+ { /* Handle problems with rebooting on the OptiPlex 990. */ |
359 |
+ .callback = set_pci_reboot, |
360 |
+- .ident = "Dell OptiPlex 990", |
361 |
++ .ident = "Dell OptiPlex 990 BIOS A0x", |
362 |
+ .matches = { |
363 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
364 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), |
365 |
++ DMI_MATCH(DMI_BIOS_VERSION, "A0"), |
366 |
+ }, |
367 |
+ }, |
368 |
+ { /* Handle problems with rebooting on Dell 300's */ |
369 |
+diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig |
370 |
+index 8352037322dfb..499bdd1f0c715 100644 |
371 |
+--- a/arch/xtensa/Kconfig |
372 |
++++ b/arch/xtensa/Kconfig |
373 |
+@@ -27,7 +27,7 @@ config XTENSA |
374 |
+ select HAVE_DMA_CONTIGUOUS |
375 |
+ select HAVE_EXIT_THREAD |
376 |
+ select HAVE_FUNCTION_TRACER |
377 |
+- select HAVE_FUTEX_CMPXCHG if !MMU |
378 |
++ select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX |
379 |
+ select HAVE_HW_BREAKPOINT if PERF_EVENTS |
380 |
+ select HAVE_IRQ_TIME_ACCOUNTING |
381 |
+ select HAVE_OPROFILE |
382 |
+diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig |
383 |
+index 0fc27ac14f29c..9f6782329a237 100644 |
384 |
+--- a/drivers/block/Kconfig |
385 |
++++ b/drivers/block/Kconfig |
386 |
+@@ -230,7 +230,7 @@ config BLK_DEV_LOOP_MIN_COUNT |
387 |
+ dynamically allocated with the /dev/loop-control interface. |
388 |
+ |
389 |
+ config BLK_DEV_CRYPTOLOOP |
390 |
+- tristate "Cryptoloop Support" |
391 |
++ tristate "Cryptoloop Support (DEPRECATED)" |
392 |
+ select CRYPTO |
393 |
+ select CRYPTO_CBC |
394 |
+ depends on BLK_DEV_LOOP |
395 |
+@@ -242,7 +242,7 @@ config BLK_DEV_CRYPTOLOOP |
396 |
+ WARNING: This device is not safe for journaled file systems like |
397 |
+ ext3 or Reiserfs. Please use the Device Mapper crypto module |
398 |
+ instead, which can be configured to be on-disk compatible with the |
399 |
+- cryptoloop device. |
400 |
++ cryptoloop device. cryptoloop support will be removed in Linux 5.16. |
401 |
+ |
402 |
+ source "drivers/block/drbd/Kconfig" |
403 |
+ |
404 |
+diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c |
405 |
+index 3cabc335ae744..f0a91faa43a89 100644 |
406 |
+--- a/drivers/block/cryptoloop.c |
407 |
++++ b/drivers/block/cryptoloop.c |
408 |
+@@ -189,6 +189,8 @@ init_cryptoloop(void) |
409 |
+ |
410 |
+ if (rc) |
411 |
+ printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n"); |
412 |
++ else |
413 |
++ pr_warn("the cryptoloop driver has been deprecated and will be removed in in Linux 5.16\n"); |
414 |
+ return rc; |
415 |
+ } |
416 |
+ |
417 |
+diff --git a/drivers/gpu/ipu-v3/ipu-cpmem.c b/drivers/gpu/ipu-v3/ipu-cpmem.c |
418 |
+index a1c85d1521f5c..82b244cb313e6 100644 |
419 |
+--- a/drivers/gpu/ipu-v3/ipu-cpmem.c |
420 |
++++ b/drivers/gpu/ipu-v3/ipu-cpmem.c |
421 |
+@@ -585,21 +585,21 @@ static const struct ipu_rgb def_bgra_16 = { |
422 |
+ .bits_per_pixel = 16, |
423 |
+ }; |
424 |
+ |
425 |
+-#define Y_OFFSET(pix, x, y) ((x) + pix->width * (y)) |
426 |
+-#define U_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
427 |
+- (pix->width * ((y) / 2) / 2) + (x) / 2) |
428 |
+-#define V_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
429 |
+- (pix->width * pix->height / 4) + \ |
430 |
+- (pix->width * ((y) / 2) / 2) + (x) / 2) |
431 |
+-#define U2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
432 |
+- (pix->width * (y) / 2) + (x) / 2) |
433 |
+-#define V2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
434 |
+- (pix->width * pix->height / 2) + \ |
435 |
+- (pix->width * (y) / 2) + (x) / 2) |
436 |
+-#define UV_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
437 |
+- (pix->width * ((y) / 2)) + (x)) |
438 |
+-#define UV2_OFFSET(pix, x, y) ((pix->width * pix->height) + \ |
439 |
+- (pix->width * y) + (x)) |
440 |
++#define Y_OFFSET(pix, x, y) ((x) + pix->bytesperline * (y)) |
441 |
++#define U_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
442 |
++ (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) |
443 |
++#define V_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
444 |
++ (pix->bytesperline * pix->height / 4) + \ |
445 |
++ (pix->bytesperline * ((y) / 2) / 2) + (x) / 2) |
446 |
++#define U2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
447 |
++ (pix->bytesperline * (y) / 2) + (x) / 2) |
448 |
++#define V2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
449 |
++ (pix->bytesperline * pix->height / 2) + \ |
450 |
++ (pix->bytesperline * (y) / 2) + (x) / 2) |
451 |
++#define UV_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
452 |
++ (pix->bytesperline * ((y) / 2)) + (x)) |
453 |
++#define UV2_OFFSET(pix, x, y) ((pix->bytesperline * pix->height) + \ |
454 |
++ (pix->bytesperline * y) + (x)) |
455 |
+ |
456 |
+ #define NUM_ALPHA_CHANNELS 7 |
457 |
+ |
458 |
+diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c |
459 |
+index 21f90a8874852..7d6a4ff6e1421 100644 |
460 |
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c |
461 |
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c |
462 |
+@@ -1346,7 +1346,7 @@ static int stk_camera_probe(struct usb_interface *interface, |
463 |
+ if (!dev->isoc_ep) { |
464 |
+ pr_err("Could not find isoc-in endpoint\n"); |
465 |
+ err = -ENODEV; |
466 |
+- goto error; |
467 |
++ goto error_put; |
468 |
+ } |
469 |
+ dev->vsettings.palette = V4L2_PIX_FMT_RGB565; |
470 |
+ dev->vsettings.mode = MODE_VGA; |
471 |
+@@ -1359,10 +1359,12 @@ static int stk_camera_probe(struct usb_interface *interface, |
472 |
+ |
473 |
+ err = stk_register_video_device(dev); |
474 |
+ if (err) |
475 |
+- goto error; |
476 |
++ goto error_put; |
477 |
+ |
478 |
+ return 0; |
479 |
+ |
480 |
++error_put: |
481 |
++ usb_put_intf(interface); |
482 |
+ error: |
483 |
+ v4l2_ctrl_handler_free(hdl); |
484 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
485 |
+diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c |
486 |
+index 43a3f0dbf857c..f5aec28c77306 100644 |
487 |
+--- a/drivers/net/ethernet/cadence/macb_ptp.c |
488 |
++++ b/drivers/net/ethernet/cadence/macb_ptp.c |
489 |
+@@ -275,6 +275,12 @@ void gem_ptp_rxstamp(struct macb *bp, struct sk_buff *skb, |
490 |
+ |
491 |
+ if (GEM_BFEXT(DMA_RXVALID, desc->addr)) { |
492 |
+ desc_ptp = macb_ptp_desc(bp, desc); |
493 |
++ /* Unlikely but check */ |
494 |
++ if (!desc_ptp) { |
495 |
++ dev_warn_ratelimited(&bp->pdev->dev, |
496 |
++ "Timestamp not supported in BD\n"); |
497 |
++ return; |
498 |
++ } |
499 |
+ gem_hw_timestamp(bp, desc_ptp->ts_1, desc_ptp->ts_2, &ts); |
500 |
+ memset(shhwtstamps, 0, sizeof(struct skb_shared_hwtstamps)); |
501 |
+ shhwtstamps->hwtstamp = ktime_set(ts.tv_sec, ts.tv_nsec); |
502 |
+@@ -307,8 +313,11 @@ int gem_ptp_txstamp(struct macb_queue *queue, struct sk_buff *skb, |
503 |
+ if (CIRC_SPACE(head, tail, PTP_TS_BUFFER_SIZE) == 0) |
504 |
+ return -ENOMEM; |
505 |
+ |
506 |
+- skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
507 |
+ desc_ptp = macb_ptp_desc(queue->bp, desc); |
508 |
++ /* Unlikely but check */ |
509 |
++ if (!desc_ptp) |
510 |
++ return -EINVAL; |
511 |
++ skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; |
512 |
+ tx_timestamp = &queue->tx_timestamps[head]; |
513 |
+ tx_timestamp->skb = skb; |
514 |
+ /* ensure ts_1/ts_2 is loaded after ctrl (TX_USED check) */ |
515 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
516 |
+index bc1f5b36b5bf2..1db49424aa43c 100644 |
517 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
518 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
519 |
+@@ -559,7 +559,12 @@ static int qed_enable_msix(struct qed_dev *cdev, |
520 |
+ rc = cnt; |
521 |
+ } |
522 |
+ |
523 |
+- if (rc > 0) { |
524 |
++ /* For VFs, we should return with an error in case we didn't get the |
525 |
++ * exact number of msix vectors as we requested. |
526 |
++ * Not doing that will lead to a crash when starting queues for |
527 |
++ * this VF. |
528 |
++ */ |
529 |
++ if ((IS_PF(cdev) && rc > 0) || (IS_VF(cdev) && rc == cnt)) { |
530 |
+ /* MSI-x configuration was achieved */ |
531 |
+ int_params->out.int_mode = QED_INT_MODE_MSIX; |
532 |
+ int_params->out.num_vectors = rc; |
533 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c |
534 |
+index ce3e62e73e4cd..1133f6fe21a0e 100644 |
535 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c |
536 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c |
537 |
+@@ -1773,6 +1773,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev) |
538 |
+ } |
539 |
+ |
540 |
+ edev->int_info.used_cnt = 0; |
541 |
++ edev->int_info.msix_cnt = 0; |
542 |
+ } |
543 |
+ |
544 |
+ static int qede_req_msix_irqs(struct qede_dev *edev) |
545 |
+@@ -2317,7 +2318,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode, |
546 |
+ goto out; |
547 |
+ err4: |
548 |
+ qede_sync_free_irqs(edev); |
549 |
+- memset(&edev->int_info.msix_cnt, 0, sizeof(struct qed_int_info)); |
550 |
+ err3: |
551 |
+ qede_napi_disable_remove(edev); |
552 |
+ err2: |
553 |
+diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c |
554 |
+index fb51548c57e94..623d86e5e970f 100644 |
555 |
+--- a/drivers/net/ethernet/realtek/r8169_main.c |
556 |
++++ b/drivers/net/ethernet/realtek/r8169_main.c |
557 |
+@@ -4713,6 +4713,7 @@ static void rtl_hw_start_8168g(struct rtl8169_private *tp) |
558 |
+ rtl_eri_clear_bits(tp, 0x1b0, ERIAR_MASK_0011, BIT(12)); |
559 |
+ |
560 |
+ rtl_pcie_state_l2l3_disable(tp); |
561 |
++ rtl_hw_aspm_clkreq_enable(tp, true); |
562 |
+ } |
563 |
+ |
564 |
+ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp) |
565 |
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
566 |
+index 9a7af7dda70dc..bddd64e918ce0 100644 |
567 |
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
568 |
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
569 |
+@@ -939,10 +939,8 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
570 |
+ wmb(); |
571 |
+ lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */ |
572 |
+ |
573 |
+- if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { |
574 |
+- netdev_info(ndev, "%s -> netif_stop_queue\n", __func__); |
575 |
++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) |
576 |
+ netif_stop_queue(ndev); |
577 |
+- } |
578 |
+ |
579 |
+ return NETDEV_TX_OK; |
580 |
+ } |
581 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
582 |
+index 0241f0dcc093f..97c343d31f989 100644 |
583 |
+--- a/drivers/pci/quirks.c |
584 |
++++ b/drivers/pci/quirks.c |
585 |
+@@ -3246,12 +3246,12 @@ static void fixup_mpss_256(struct pci_dev *dev) |
586 |
+ { |
587 |
+ dev->pcie_mpss = 1; /* 256 bytes */ |
588 |
+ } |
589 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
590 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256); |
591 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
592 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); |
593 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
594 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); |
595 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
596 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256); |
597 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
598 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); |
599 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
600 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); |
601 |
+ |
602 |
+ /* |
603 |
+ * Intel 5000 and 5100 Memory controllers have an erratum with read completion |
604 |
+diff --git a/drivers/reset/reset-zynqmp.c b/drivers/reset/reset-zynqmp.c |
605 |
+index 99e75d92dadab..8a7473b6ba585 100644 |
606 |
+--- a/drivers/reset/reset-zynqmp.c |
607 |
++++ b/drivers/reset/reset-zynqmp.c |
608 |
+@@ -46,7 +46,8 @@ static int zynqmp_reset_status(struct reset_controller_dev *rcdev, |
609 |
+ unsigned long id) |
610 |
+ { |
611 |
+ struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); |
612 |
+- int val, err; |
613 |
++ int err; |
614 |
++ u32 val; |
615 |
+ |
616 |
+ err = priv->eemi_ops->reset_get_status(ZYNQMP_RESET_ID + id, &val); |
617 |
+ if (err) |
618 |
+diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c |
619 |
+index 448d7b11dec4c..f5c8e4eb62ae6 100644 |
620 |
+--- a/drivers/usb/host/xhci-debugfs.c |
621 |
++++ b/drivers/usb/host/xhci-debugfs.c |
622 |
+@@ -197,12 +197,13 @@ static void xhci_ring_dump_segment(struct seq_file *s, |
623 |
+ int i; |
624 |
+ dma_addr_t dma; |
625 |
+ union xhci_trb *trb; |
626 |
++ char str[XHCI_MSG_MAX]; |
627 |
+ |
628 |
+ for (i = 0; i < TRBS_PER_SEGMENT; i++) { |
629 |
+ trb = &seg->trbs[i]; |
630 |
+ dma = seg->dma + i * sizeof(*trb); |
631 |
+ seq_printf(s, "%pad: %s\n", &dma, |
632 |
+- xhci_decode_trb(le32_to_cpu(trb->generic.field[0]), |
633 |
++ xhci_decode_trb(str, XHCI_MSG_MAX, le32_to_cpu(trb->generic.field[0]), |
634 |
+ le32_to_cpu(trb->generic.field[1]), |
635 |
+ le32_to_cpu(trb->generic.field[2]), |
636 |
+ le32_to_cpu(trb->generic.field[3]))); |
637 |
+@@ -340,9 +341,10 @@ static int xhci_portsc_show(struct seq_file *s, void *unused) |
638 |
+ { |
639 |
+ struct xhci_port *port = s->private; |
640 |
+ u32 portsc; |
641 |
++ char str[XHCI_MSG_MAX]; |
642 |
+ |
643 |
+ portsc = readl(port->addr); |
644 |
+- seq_printf(s, "%s\n", xhci_decode_portsc(portsc)); |
645 |
++ seq_printf(s, "%s\n", xhci_decode_portsc(str, portsc)); |
646 |
+ |
647 |
+ return 0; |
648 |
+ } |
649 |
+diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c |
650 |
+index c1025d321a417..3da75b367f952 100644 |
651 |
+--- a/drivers/usb/host/xhci-rcar.c |
652 |
++++ b/drivers/usb/host/xhci-rcar.c |
653 |
+@@ -134,6 +134,13 @@ static int xhci_rcar_download_firmware(struct usb_hcd *hcd) |
654 |
+ const struct soc_device_attribute *attr; |
655 |
+ const char *firmware_name; |
656 |
+ |
657 |
++ /* |
658 |
++ * According to the datasheet, "Upon the completion of FW Download, |
659 |
++ * there is no need to write or reload FW". |
660 |
++ */ |
661 |
++ if (readl(regs + RCAR_USB3_DL_CTRL) & RCAR_USB3_DL_CTRL_FW_SUCCESS) |
662 |
++ return 0; |
663 |
++ |
664 |
+ attr = soc_device_match(rcar_quirks_match); |
665 |
+ if (attr) |
666 |
+ quirks = (uintptr_t)attr->data; |
667 |
+diff --git a/drivers/usb/host/xhci-trace.h b/drivers/usb/host/xhci-trace.h |
668 |
+index 87da9098fb347..dab2af3f2c4f7 100644 |
669 |
+--- a/drivers/usb/host/xhci-trace.h |
670 |
++++ b/drivers/usb/host/xhci-trace.h |
671 |
+@@ -25,8 +25,6 @@ |
672 |
+ #include "xhci.h" |
673 |
+ #include "xhci-dbgcap.h" |
674 |
+ |
675 |
+-#define XHCI_MSG_MAX 500 |
676 |
+- |
677 |
+ DECLARE_EVENT_CLASS(xhci_log_msg, |
678 |
+ TP_PROTO(struct va_format *vaf), |
679 |
+ TP_ARGS(vaf), |
680 |
+@@ -122,6 +120,7 @@ DECLARE_EVENT_CLASS(xhci_log_trb, |
681 |
+ __field(u32, field1) |
682 |
+ __field(u32, field2) |
683 |
+ __field(u32, field3) |
684 |
++ __dynamic_array(char, str, XHCI_MSG_MAX) |
685 |
+ ), |
686 |
+ TP_fast_assign( |
687 |
+ __entry->type = ring->type; |
688 |
+@@ -131,7 +130,7 @@ DECLARE_EVENT_CLASS(xhci_log_trb, |
689 |
+ __entry->field3 = le32_to_cpu(trb->field[3]); |
690 |
+ ), |
691 |
+ TP_printk("%s: %s", xhci_ring_type_string(__entry->type), |
692 |
+- xhci_decode_trb(__entry->field0, __entry->field1, |
693 |
++ xhci_decode_trb(__get_str(str), XHCI_MSG_MAX, __entry->field0, __entry->field1, |
694 |
+ __entry->field2, __entry->field3) |
695 |
+ ) |
696 |
+ ); |
697 |
+@@ -523,6 +522,7 @@ DECLARE_EVENT_CLASS(xhci_log_portsc, |
698 |
+ TP_STRUCT__entry( |
699 |
+ __field(u32, portnum) |
700 |
+ __field(u32, portsc) |
701 |
++ __dynamic_array(char, str, XHCI_MSG_MAX) |
702 |
+ ), |
703 |
+ TP_fast_assign( |
704 |
+ __entry->portnum = portnum; |
705 |
+@@ -530,7 +530,7 @@ DECLARE_EVENT_CLASS(xhci_log_portsc, |
706 |
+ ), |
707 |
+ TP_printk("port-%d: %s", |
708 |
+ __entry->portnum, |
709 |
+- xhci_decode_portsc(__entry->portsc) |
710 |
++ xhci_decode_portsc(__get_str(str), __entry->portsc) |
711 |
+ ) |
712 |
+ ); |
713 |
+ |
714 |
+diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
715 |
+index 834f32fe99308..02df309e44093 100644 |
716 |
+--- a/drivers/usb/host/xhci.h |
717 |
++++ b/drivers/usb/host/xhci.h |
718 |
+@@ -22,6 +22,9 @@ |
719 |
+ #include "xhci-ext-caps.h" |
720 |
+ #include "pci-quirks.h" |
721 |
+ |
722 |
++/* max buffer size for trace and debug messages */ |
723 |
++#define XHCI_MSG_MAX 500 |
724 |
++ |
725 |
+ /* xHCI PCI Configuration Registers */ |
726 |
+ #define XHCI_SBRN_OFFSET (0x60) |
727 |
+ |
728 |
+@@ -2217,15 +2220,14 @@ static inline char *xhci_slot_state_string(u32 state) |
729 |
+ } |
730 |
+ } |
731 |
+ |
732 |
+-static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
733 |
+- u32 field3) |
734 |
++static inline const char *xhci_decode_trb(char *str, size_t size, |
735 |
++ u32 field0, u32 field1, u32 field2, u32 field3) |
736 |
+ { |
737 |
+- static char str[256]; |
738 |
+ int type = TRB_FIELD_TO_TYPE(field3); |
739 |
+ |
740 |
+ switch (type) { |
741 |
+ case TRB_LINK: |
742 |
+- sprintf(str, |
743 |
++ snprintf(str, size, |
744 |
+ "LINK %08x%08x intr %d type '%s' flags %c:%c:%c:%c", |
745 |
+ field1, field0, GET_INTR_TARGET(field2), |
746 |
+ xhci_trb_type_string(type), |
747 |
+@@ -2242,7 +2244,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
748 |
+ case TRB_HC_EVENT: |
749 |
+ case TRB_DEV_NOTE: |
750 |
+ case TRB_MFINDEX_WRAP: |
751 |
+- sprintf(str, |
752 |
++ snprintf(str, size, |
753 |
+ "TRB %08x%08x status '%s' len %d slot %d ep %d type '%s' flags %c:%c", |
754 |
+ field1, field0, |
755 |
+ xhci_trb_comp_code_string(GET_COMP_CODE(field2)), |
756 |
+@@ -2255,7 +2257,8 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
757 |
+ |
758 |
+ break; |
759 |
+ case TRB_SETUP: |
760 |
+- sprintf(str, "bRequestType %02x bRequest %02x wValue %02x%02x wIndex %02x%02x wLength %d length %d TD size %d intr %d type '%s' flags %c:%c:%c", |
761 |
++ snprintf(str, size, |
762 |
++ "bRequestType %02x bRequest %02x wValue %02x%02x wIndex %02x%02x wLength %d length %d TD size %d intr %d type '%s' flags %c:%c:%c", |
763 |
+ field0 & 0xff, |
764 |
+ (field0 & 0xff00) >> 8, |
765 |
+ (field0 & 0xff000000) >> 24, |
766 |
+@@ -2272,7 +2275,8 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
767 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
768 |
+ break; |
769 |
+ case TRB_DATA: |
770 |
+- sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c", |
771 |
++ snprintf(str, size, |
772 |
++ "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c", |
773 |
+ field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), |
774 |
+ GET_INTR_TARGET(field2), |
775 |
+ xhci_trb_type_string(type), |
776 |
+@@ -2285,7 +2289,8 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
777 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
778 |
+ break; |
779 |
+ case TRB_STATUS: |
780 |
+- sprintf(str, "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c", |
781 |
++ snprintf(str, size, |
782 |
++ "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c", |
783 |
+ field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), |
784 |
+ GET_INTR_TARGET(field2), |
785 |
+ xhci_trb_type_string(type), |
786 |
+@@ -2298,7 +2303,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
787 |
+ case TRB_ISOC: |
788 |
+ case TRB_EVENT_DATA: |
789 |
+ case TRB_TR_NOOP: |
790 |
+- sprintf(str, |
791 |
++ snprintf(str, size, |
792 |
+ "Buffer %08x%08x length %d TD size %d intr %d type '%s' flags %c:%c:%c:%c:%c:%c:%c:%c", |
793 |
+ field1, field0, TRB_LEN(field2), GET_TD_SIZE(field2), |
794 |
+ GET_INTR_TARGET(field2), |
795 |
+@@ -2315,21 +2320,21 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
796 |
+ |
797 |
+ case TRB_CMD_NOOP: |
798 |
+ case TRB_ENABLE_SLOT: |
799 |
+- sprintf(str, |
800 |
++ snprintf(str, size, |
801 |
+ "%s: flags %c", |
802 |
+ xhci_trb_type_string(type), |
803 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
804 |
+ break; |
805 |
+ case TRB_DISABLE_SLOT: |
806 |
+ case TRB_NEG_BANDWIDTH: |
807 |
+- sprintf(str, |
808 |
++ snprintf(str, size, |
809 |
+ "%s: slot %d flags %c", |
810 |
+ xhci_trb_type_string(type), |
811 |
+ TRB_TO_SLOT_ID(field3), |
812 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
813 |
+ break; |
814 |
+ case TRB_ADDR_DEV: |
815 |
+- sprintf(str, |
816 |
++ snprintf(str, size, |
817 |
+ "%s: ctx %08x%08x slot %d flags %c:%c", |
818 |
+ xhci_trb_type_string(type), |
819 |
+ field1, field0, |
820 |
+@@ -2338,7 +2343,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
821 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
822 |
+ break; |
823 |
+ case TRB_CONFIG_EP: |
824 |
+- sprintf(str, |
825 |
++ snprintf(str, size, |
826 |
+ "%s: ctx %08x%08x slot %d flags %c:%c", |
827 |
+ xhci_trb_type_string(type), |
828 |
+ field1, field0, |
829 |
+@@ -2347,7 +2352,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
830 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
831 |
+ break; |
832 |
+ case TRB_EVAL_CONTEXT: |
833 |
+- sprintf(str, |
834 |
++ snprintf(str, size, |
835 |
+ "%s: ctx %08x%08x slot %d flags %c", |
836 |
+ xhci_trb_type_string(type), |
837 |
+ field1, field0, |
838 |
+@@ -2355,7 +2360,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
839 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
840 |
+ break; |
841 |
+ case TRB_RESET_EP: |
842 |
+- sprintf(str, |
843 |
++ snprintf(str, size, |
844 |
+ "%s: ctx %08x%08x slot %d ep %d flags %c:%c", |
845 |
+ xhci_trb_type_string(type), |
846 |
+ field1, field0, |
847 |
+@@ -2376,7 +2381,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
848 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
849 |
+ break; |
850 |
+ case TRB_SET_DEQ: |
851 |
+- sprintf(str, |
852 |
++ snprintf(str, size, |
853 |
+ "%s: deq %08x%08x stream %d slot %d ep %d flags %c", |
854 |
+ xhci_trb_type_string(type), |
855 |
+ field1, field0, |
856 |
+@@ -2387,14 +2392,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
857 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
858 |
+ break; |
859 |
+ case TRB_RESET_DEV: |
860 |
+- sprintf(str, |
861 |
++ snprintf(str, size, |
862 |
+ "%s: slot %d flags %c", |
863 |
+ xhci_trb_type_string(type), |
864 |
+ TRB_TO_SLOT_ID(field3), |
865 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
866 |
+ break; |
867 |
+ case TRB_FORCE_EVENT: |
868 |
+- sprintf(str, |
869 |
++ snprintf(str, size, |
870 |
+ "%s: event %08x%08x vf intr %d vf id %d flags %c", |
871 |
+ xhci_trb_type_string(type), |
872 |
+ field1, field0, |
873 |
+@@ -2403,14 +2408,14 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
874 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
875 |
+ break; |
876 |
+ case TRB_SET_LT: |
877 |
+- sprintf(str, |
878 |
++ snprintf(str, size, |
879 |
+ "%s: belt %d flags %c", |
880 |
+ xhci_trb_type_string(type), |
881 |
+ TRB_TO_BELT(field3), |
882 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
883 |
+ break; |
884 |
+ case TRB_GET_BW: |
885 |
+- sprintf(str, |
886 |
++ snprintf(str, size, |
887 |
+ "%s: ctx %08x%08x slot %d speed %d flags %c", |
888 |
+ xhci_trb_type_string(type), |
889 |
+ field1, field0, |
890 |
+@@ -2419,7 +2424,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
891 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
892 |
+ break; |
893 |
+ case TRB_FORCE_HEADER: |
894 |
+- sprintf(str, |
895 |
++ snprintf(str, size, |
896 |
+ "%s: info %08x%08x%08x pkt type %d roothub port %d flags %c", |
897 |
+ xhci_trb_type_string(type), |
898 |
+ field2, field1, field0 & 0xffffffe0, |
899 |
+@@ -2428,7 +2433,7 @@ static inline const char *xhci_decode_trb(u32 field0, u32 field1, u32 field2, |
900 |
+ field3 & TRB_CYCLE ? 'C' : 'c'); |
901 |
+ break; |
902 |
+ default: |
903 |
+- sprintf(str, |
904 |
++ snprintf(str, size, |
905 |
+ "type '%s' -> raw %08x %08x %08x %08x", |
906 |
+ xhci_trb_type_string(type), |
907 |
+ field0, field1, field2, field3); |
908 |
+@@ -2553,9 +2558,8 @@ static inline const char *xhci_portsc_link_state_string(u32 portsc) |
909 |
+ return "Unknown"; |
910 |
+ } |
911 |
+ |
912 |
+-static inline const char *xhci_decode_portsc(u32 portsc) |
913 |
++static inline const char *xhci_decode_portsc(char *str, u32 portsc) |
914 |
+ { |
915 |
+- static char str[256]; |
916 |
+ int ret; |
917 |
+ |
918 |
+ ret = sprintf(str, "%s %s %s Link:%s PortSpeed:%d ", |
919 |
+diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c |
920 |
+index 08db02f3172df..619c4598e64ea 100644 |
921 |
+--- a/drivers/usb/mtu3/mtu3_gadget.c |
922 |
++++ b/drivers/usb/mtu3/mtu3_gadget.c |
923 |
+@@ -72,14 +72,12 @@ static int mtu3_ep_enable(struct mtu3_ep *mep) |
924 |
+ u32 interval = 0; |
925 |
+ u32 mult = 0; |
926 |
+ u32 burst = 0; |
927 |
+- int max_packet; |
928 |
+ int ret; |
929 |
+ |
930 |
+ desc = mep->desc; |
931 |
+ comp_desc = mep->comp_desc; |
932 |
+ mep->type = usb_endpoint_type(desc); |
933 |
+- max_packet = usb_endpoint_maxp(desc); |
934 |
+- mep->maxp = max_packet & GENMASK(10, 0); |
935 |
++ mep->maxp = usb_endpoint_maxp(desc); |
936 |
+ |
937 |
+ switch (mtu->g.speed) { |
938 |
+ case USB_SPEED_SUPER: |
939 |
+@@ -100,7 +98,7 @@ static int mtu3_ep_enable(struct mtu3_ep *mep) |
940 |
+ usb_endpoint_xfer_int(desc)) { |
941 |
+ interval = desc->bInterval; |
942 |
+ interval = clamp_val(interval, 1, 16) - 1; |
943 |
+- burst = (max_packet & GENMASK(12, 11)) >> 11; |
944 |
++ mult = usb_endpoint_maxp_mult(desc) - 1; |
945 |
+ } |
946 |
+ break; |
947 |
+ default: |
948 |
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
949 |
+index aefc1b58d9563..f5caf38ba2be0 100644 |
950 |
+--- a/drivers/usb/serial/mos7720.c |
951 |
++++ b/drivers/usb/serial/mos7720.c |
952 |
+@@ -226,8 +226,10 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, |
953 |
+ int status; |
954 |
+ |
955 |
+ buf = kmalloc(1, GFP_KERNEL); |
956 |
+- if (!buf) |
957 |
++ if (!buf) { |
958 |
++ *data = 0; |
959 |
+ return -ENOMEM; |
960 |
++ } |
961 |
+ |
962 |
+ status = usb_control_msg(usbdev, pipe, request, requesttype, value, |
963 |
+ index, buf, 1, MOS_WDR_TIMEOUT); |
964 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
965 |
+index 29552d4f6845b..33b8fedab6c67 100644 |
966 |
+--- a/fs/btrfs/inode.c |
967 |
++++ b/fs/btrfs/inode.c |
968 |
+@@ -543,7 +543,7 @@ again: |
969 |
+ * inode has not been flagged as nocompress. This flag can |
970 |
+ * change at any time if we discover bad compression ratios. |
971 |
+ */ |
972 |
+- if (nr_pages > 1 && inode_need_compress(inode, start, end)) { |
973 |
++ if (inode_need_compress(inode, start, end)) { |
974 |
+ WARN_ON(pages); |
975 |
+ pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); |
976 |
+ if (!pages) { |
977 |
+diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c |
978 |
+index a5a40a76b8ed7..82575cfbb04db 100644 |
979 |
+--- a/fs/crypto/hooks.c |
980 |
++++ b/fs/crypto/hooks.c |
981 |
+@@ -305,3 +305,47 @@ err_kfree: |
982 |
+ return ERR_PTR(err); |
983 |
+ } |
984 |
+ EXPORT_SYMBOL_GPL(fscrypt_get_symlink); |
985 |
++ |
986 |
++/** |
987 |
++ * fscrypt_symlink_getattr() - set the correct st_size for encrypted symlinks |
988 |
++ * @path: the path for the encrypted symlink being queried |
989 |
++ * @stat: the struct being filled with the symlink's attributes |
990 |
++ * |
991 |
++ * Override st_size of encrypted symlinks to be the length of the decrypted |
992 |
++ * symlink target (or the no-key encoded symlink target, if the key is |
993 |
++ * unavailable) rather than the length of the encrypted symlink target. This is |
994 |
++ * necessary for st_size to match the symlink target that userspace actually |
995 |
++ * sees. POSIX requires this, and some userspace programs depend on it. |
996 |
++ * |
997 |
++ * This requires reading the symlink target from disk if needed, setting up the |
998 |
++ * inode's encryption key if possible, and then decrypting or encoding the |
999 |
++ * symlink target. This makes lstat() more heavyweight than is normally the |
1000 |
++ * case. However, decrypted symlink targets will be cached in ->i_link, so |
1001 |
++ * usually the symlink won't have to be read and decrypted again later if/when |
1002 |
++ * it is actually followed, readlink() is called, or lstat() is called again. |
1003 |
++ * |
1004 |
++ * Return: 0 on success, -errno on failure |
1005 |
++ */ |
1006 |
++int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat) |
1007 |
++{ |
1008 |
++ struct dentry *dentry = path->dentry; |
1009 |
++ struct inode *inode = d_inode(dentry); |
1010 |
++ const char *link; |
1011 |
++ DEFINE_DELAYED_CALL(done); |
1012 |
++ |
1013 |
++ /* |
1014 |
++ * To get the symlink target that userspace will see (whether it's the |
1015 |
++ * decrypted target or the no-key encoded target), we can just get it in |
1016 |
++ * the same way the VFS does during path resolution and readlink(). |
1017 |
++ */ |
1018 |
++ link = READ_ONCE(inode->i_link); |
1019 |
++ if (!link) { |
1020 |
++ link = inode->i_op->get_link(dentry, inode, &done); |
1021 |
++ if (IS_ERR(link)) |
1022 |
++ return PTR_ERR(link); |
1023 |
++ } |
1024 |
++ stat->size = strlen(link); |
1025 |
++ do_delayed_call(&done); |
1026 |
++ return 0; |
1027 |
++} |
1028 |
++EXPORT_SYMBOL_GPL(fscrypt_symlink_getattr); |
1029 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
1030 |
+index 519378a15bc6b..46151bda62368 100644 |
1031 |
+--- a/fs/ext4/inline.c |
1032 |
++++ b/fs/ext4/inline.c |
1033 |
+@@ -750,6 +750,12 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, |
1034 |
+ ext4_write_lock_xattr(inode, &no_expand); |
1035 |
+ BUG_ON(!ext4_has_inline_data(inode)); |
1036 |
+ |
1037 |
++ /* |
1038 |
++ * ei->i_inline_off may have changed since ext4_write_begin() |
1039 |
++ * called ext4_try_to_write_inline_data() |
1040 |
++ */ |
1041 |
++ (void) ext4_find_inline_data_nolock(inode); |
1042 |
++ |
1043 |
+ kaddr = kmap_atomic(page); |
1044 |
+ ext4_write_inline_data(inode, &iloc, kaddr, pos, len); |
1045 |
+ kunmap_atomic(kaddr); |
1046 |
+diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c |
1047 |
+index dd05af983092d..a9457fed351ed 100644 |
1048 |
+--- a/fs/ext4/symlink.c |
1049 |
++++ b/fs/ext4/symlink.c |
1050 |
+@@ -52,10 +52,19 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry, |
1051 |
+ return paddr; |
1052 |
+ } |
1053 |
+ |
1054 |
++static int ext4_encrypted_symlink_getattr(const struct path *path, |
1055 |
++ struct kstat *stat, u32 request_mask, |
1056 |
++ unsigned int query_flags) |
1057 |
++{ |
1058 |
++ ext4_getattr(path, stat, request_mask, query_flags); |
1059 |
++ |
1060 |
++ return fscrypt_symlink_getattr(path, stat); |
1061 |
++} |
1062 |
++ |
1063 |
+ const struct inode_operations ext4_encrypted_symlink_inode_operations = { |
1064 |
+ .get_link = ext4_encrypted_get_link, |
1065 |
+ .setattr = ext4_setattr, |
1066 |
+- .getattr = ext4_getattr, |
1067 |
++ .getattr = ext4_encrypted_symlink_getattr, |
1068 |
+ .listxattr = ext4_listxattr, |
1069 |
+ }; |
1070 |
+ |
1071 |
+diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c |
1072 |
+index 3a97ac56821ba..81a18ba18e301 100644 |
1073 |
+--- a/fs/f2fs/namei.c |
1074 |
++++ b/fs/f2fs/namei.c |
1075 |
+@@ -1256,9 +1256,18 @@ static const char *f2fs_encrypted_get_link(struct dentry *dentry, |
1076 |
+ return target; |
1077 |
+ } |
1078 |
+ |
1079 |
++static int f2fs_encrypted_symlink_getattr(const struct path *path, |
1080 |
++ struct kstat *stat, u32 request_mask, |
1081 |
++ unsigned int query_flags) |
1082 |
++{ |
1083 |
++ f2fs_getattr(path, stat, request_mask, query_flags); |
1084 |
++ |
1085 |
++ return fscrypt_symlink_getattr(path, stat); |
1086 |
++} |
1087 |
++ |
1088 |
+ const struct inode_operations f2fs_encrypted_symlink_inode_operations = { |
1089 |
+ .get_link = f2fs_encrypted_get_link, |
1090 |
+- .getattr = f2fs_getattr, |
1091 |
++ .getattr = f2fs_encrypted_symlink_getattr, |
1092 |
+ .setattr = f2fs_setattr, |
1093 |
+ #ifdef CONFIG_F2FS_FS_XATTR |
1094 |
+ .listxattr = f2fs_listxattr, |
1095 |
+diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c |
1096 |
+index 8dada89bbe4da..6069c63d833ae 100644 |
1097 |
+--- a/fs/ubifs/file.c |
1098 |
++++ b/fs/ubifs/file.c |
1099 |
+@@ -1629,6 +1629,16 @@ static const char *ubifs_get_link(struct dentry *dentry, |
1100 |
+ return fscrypt_get_symlink(inode, ui->data, ui->data_len, done); |
1101 |
+ } |
1102 |
+ |
1103 |
++static int ubifs_symlink_getattr(const struct path *path, struct kstat *stat, |
1104 |
++ u32 request_mask, unsigned int query_flags) |
1105 |
++{ |
1106 |
++ ubifs_getattr(path, stat, request_mask, query_flags); |
1107 |
++ |
1108 |
++ if (IS_ENCRYPTED(d_inode(path->dentry))) |
1109 |
++ return fscrypt_symlink_getattr(path, stat); |
1110 |
++ return 0; |
1111 |
++} |
1112 |
++ |
1113 |
+ const struct address_space_operations ubifs_file_address_operations = { |
1114 |
+ .readpage = ubifs_readpage, |
1115 |
+ .writepage = ubifs_writepage, |
1116 |
+@@ -1654,7 +1664,7 @@ const struct inode_operations ubifs_file_inode_operations = { |
1117 |
+ const struct inode_operations ubifs_symlink_inode_operations = { |
1118 |
+ .get_link = ubifs_get_link, |
1119 |
+ .setattr = ubifs_setattr, |
1120 |
+- .getattr = ubifs_getattr, |
1121 |
++ .getattr = ubifs_symlink_getattr, |
1122 |
+ #ifdef CONFIG_UBIFS_FS_XATTR |
1123 |
+ .listxattr = ubifs_listxattr, |
1124 |
+ #endif |
1125 |
+diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h |
1126 |
+index 032e5bcf97012..0d1a53d6c52dc 100644 |
1127 |
+--- a/include/linux/fscrypt.h |
1128 |
++++ b/include/linux/fscrypt.h |
1129 |
+@@ -298,6 +298,7 @@ extern int __fscrypt_encrypt_symlink(struct inode *inode, const char *target, |
1130 |
+ extern const char *fscrypt_get_symlink(struct inode *inode, const void *caddr, |
1131 |
+ unsigned int max_size, |
1132 |
+ struct delayed_call *done); |
1133 |
++int fscrypt_symlink_getattr(const struct path *path, struct kstat *stat); |
1134 |
+ static inline void fscrypt_set_ops(struct super_block *sb, |
1135 |
+ const struct fscrypt_operations *s_cop) |
1136 |
+ { |
1137 |
+@@ -585,6 +586,12 @@ static inline const char *fscrypt_get_symlink(struct inode *inode, |
1138 |
+ return ERR_PTR(-EOPNOTSUPP); |
1139 |
+ } |
1140 |
+ |
1141 |
++static inline int fscrypt_symlink_getattr(const struct path *path, |
1142 |
++ struct kstat *stat) |
1143 |
++{ |
1144 |
++ return -EOPNOTSUPP; |
1145 |
++} |
1146 |
++ |
1147 |
+ static inline void fscrypt_set_ops(struct super_block *sb, |
1148 |
+ const struct fscrypt_operations *s_cop) |
1149 |
+ { |
1150 |
+diff --git a/kernel/kthread.c b/kernel/kthread.c |
1151 |
+index b2bac5d929d2b..63f7eb3c2640d 100644 |
1152 |
+--- a/kernel/kthread.c |
1153 |
++++ b/kernel/kthread.c |
1154 |
+@@ -76,6 +76,25 @@ static inline struct kthread *to_kthread(struct task_struct *k) |
1155 |
+ return (__force void *)k->set_child_tid; |
1156 |
+ } |
1157 |
+ |
1158 |
++/* |
1159 |
++ * Variant of to_kthread() that doesn't assume @p is a kthread. |
1160 |
++ * |
1161 |
++ * Per construction; when: |
1162 |
++ * |
1163 |
++ * (p->flags & PF_KTHREAD) && p->set_child_tid |
1164 |
++ * |
1165 |
++ * the task is both a kthread and struct kthread is persistent. However |
1166 |
++ * PF_KTHREAD on it's own is not, kernel_thread() can exec() (See umh.c and |
1167 |
++ * begin_new_exec()). |
1168 |
++ */ |
1169 |
++static inline struct kthread *__to_kthread(struct task_struct *p) |
1170 |
++{ |
1171 |
++ void *kthread = (__force void *)p->set_child_tid; |
1172 |
++ if (kthread && !(p->flags & PF_KTHREAD)) |
1173 |
++ kthread = NULL; |
1174 |
++ return kthread; |
1175 |
++} |
1176 |
++ |
1177 |
+ void free_kthread_struct(struct task_struct *k) |
1178 |
+ { |
1179 |
+ struct kthread *kthread; |
1180 |
+@@ -176,10 +195,11 @@ void *kthread_data(struct task_struct *task) |
1181 |
+ */ |
1182 |
+ void *kthread_probe_data(struct task_struct *task) |
1183 |
+ { |
1184 |
+- struct kthread *kthread = to_kthread(task); |
1185 |
++ struct kthread *kthread = __to_kthread(task); |
1186 |
+ void *data = NULL; |
1187 |
+ |
1188 |
+- probe_kernel_read(&data, &kthread->data, sizeof(data)); |
1189 |
++ if (kthread) |
1190 |
++ probe_kernel_read(&data, &kthread->data, sizeof(data)); |
1191 |
+ return data; |
1192 |
+ } |
1193 |
+ |
1194 |
+@@ -490,9 +510,9 @@ void kthread_set_per_cpu(struct task_struct *k, int cpu) |
1195 |
+ set_bit(KTHREAD_IS_PER_CPU, &kthread->flags); |
1196 |
+ } |
1197 |
+ |
1198 |
+-bool kthread_is_per_cpu(struct task_struct *k) |
1199 |
++bool kthread_is_per_cpu(struct task_struct *p) |
1200 |
+ { |
1201 |
+- struct kthread *kthread = to_kthread(k); |
1202 |
++ struct kthread *kthread = __to_kthread(p); |
1203 |
+ if (!kthread) |
1204 |
+ return false; |
1205 |
+ |
1206 |
+@@ -1272,11 +1292,9 @@ EXPORT_SYMBOL(kthread_destroy_worker); |
1207 |
+ */ |
1208 |
+ void kthread_associate_blkcg(struct cgroup_subsys_state *css) |
1209 |
+ { |
1210 |
+- struct kthread *kthread; |
1211 |
++ struct kthread *kthread = __to_kthread(current); |
1212 |
++ |
1213 |
+ |
1214 |
+- if (!(current->flags & PF_KTHREAD)) |
1215 |
+- return; |
1216 |
+- kthread = to_kthread(current); |
1217 |
+ if (!kthread) |
1218 |
+ return; |
1219 |
+ |
1220 |
+@@ -1298,13 +1316,10 @@ EXPORT_SYMBOL(kthread_associate_blkcg); |
1221 |
+ */ |
1222 |
+ struct cgroup_subsys_state *kthread_blkcg(void) |
1223 |
+ { |
1224 |
+- struct kthread *kthread; |
1225 |
++ struct kthread *kthread = __to_kthread(current); |
1226 |
+ |
1227 |
+- if (current->flags & PF_KTHREAD) { |
1228 |
+- kthread = to_kthread(current); |
1229 |
+- if (kthread) |
1230 |
+- return kthread->blkcg_css; |
1231 |
+- } |
1232 |
++ if (kthread) |
1233 |
++ return kthread->blkcg_css; |
1234 |
+ return NULL; |
1235 |
+ } |
1236 |
+ EXPORT_SYMBOL(kthread_blkcg); |
1237 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
1238 |
+index 74cb20f32f72f..87d9fad9d01d6 100644 |
1239 |
+--- a/kernel/sched/fair.c |
1240 |
++++ b/kernel/sched/fair.c |
1241 |
+@@ -7301,7 +7301,7 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) |
1242 |
+ return 0; |
1243 |
+ |
1244 |
+ /* Disregard pcpu kthreads; they are where they need to be. */ |
1245 |
+- if ((p->flags & PF_KTHREAD) && kthread_is_per_cpu(p)) |
1246 |
++ if (kthread_is_per_cpu(p)) |
1247 |
+ return 0; |
1248 |
+ |
1249 |
+ if (!cpumask_test_cpu(env->dst_cpu, p->cpus_ptr)) { |
1250 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
1251 |
+index 4357f5475a504..283ac9d9f6dd0 100644 |
1252 |
+--- a/mm/page_alloc.c |
1253 |
++++ b/mm/page_alloc.c |
1254 |
+@@ -906,7 +906,7 @@ static inline void __free_one_page(struct page *page, |
1255 |
+ unsigned int max_order; |
1256 |
+ struct capture_control *capc = task_capc(zone); |
1257 |
+ |
1258 |
+- max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); |
1259 |
++ max_order = min_t(unsigned int, MAX_ORDER - 1, pageblock_order); |
1260 |
+ |
1261 |
+ VM_BUG_ON(!zone_is_initialized(zone)); |
1262 |
+ VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page); |
1263 |
+@@ -919,7 +919,7 @@ static inline void __free_one_page(struct page *page, |
1264 |
+ VM_BUG_ON_PAGE(bad_range(zone, page), page); |
1265 |
+ |
1266 |
+ continue_merging: |
1267 |
+- while (order < max_order - 1) { |
1268 |
++ while (order < max_order) { |
1269 |
+ if (compaction_capture(capc, page, order, migratetype)) { |
1270 |
+ __mod_zone_freepage_state(zone, -(1 << order), |
1271 |
+ migratetype); |
1272 |
+@@ -945,7 +945,7 @@ continue_merging: |
1273 |
+ pfn = combined_pfn; |
1274 |
+ order++; |
1275 |
+ } |
1276 |
+- if (max_order < MAX_ORDER) { |
1277 |
++ if (order < MAX_ORDER - 1) { |
1278 |
+ /* If we are here, it means order is >= pageblock_order. |
1279 |
+ * We want to prevent merge between freepages on isolate |
1280 |
+ * pageblock and normal pageblock. Without this, pageblock |
1281 |
+@@ -966,7 +966,7 @@ continue_merging: |
1282 |
+ is_migrate_isolate(buddy_mt))) |
1283 |
+ goto done_merging; |
1284 |
+ } |
1285 |
+- max_order++; |
1286 |
++ max_order = order + 1; |
1287 |
+ goto continue_merging; |
1288 |
+ } |
1289 |
+ |
1290 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
1291 |
+index c88612242c89f..f86f948a4b4c1 100644 |
1292 |
+--- a/net/ipv4/icmp.c |
1293 |
++++ b/net/ipv4/icmp.c |
1294 |
+@@ -460,6 +460,23 @@ out_bh_enable: |
1295 |
+ local_bh_enable(); |
1296 |
+ } |
1297 |
+ |
1298 |
++/* |
1299 |
++ * The device used for looking up which routing table to use for sending an ICMP |
1300 |
++ * error is preferably the source whenever it is set, which should ensure the |
1301 |
++ * icmp error can be sent to the source host, else lookup using the routing |
1302 |
++ * table of the destination device, else use the main routing table (index 0). |
1303 |
++ */ |
1304 |
++static struct net_device *icmp_get_route_lookup_dev(struct sk_buff *skb) |
1305 |
++{ |
1306 |
++ struct net_device *route_lookup_dev = NULL; |
1307 |
++ |
1308 |
++ if (skb->dev) |
1309 |
++ route_lookup_dev = skb->dev; |
1310 |
++ else if (skb_dst(skb)) |
1311 |
++ route_lookup_dev = skb_dst(skb)->dev; |
1312 |
++ return route_lookup_dev; |
1313 |
++} |
1314 |
++ |
1315 |
+ static struct rtable *icmp_route_lookup(struct net *net, |
1316 |
+ struct flowi4 *fl4, |
1317 |
+ struct sk_buff *skb_in, |
1318 |
+@@ -468,6 +485,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
1319 |
+ int type, int code, |
1320 |
+ struct icmp_bxm *param) |
1321 |
+ { |
1322 |
++ struct net_device *route_lookup_dev; |
1323 |
+ struct rtable *rt, *rt2; |
1324 |
+ struct flowi4 fl4_dec; |
1325 |
+ int err; |
1326 |
+@@ -482,7 +500,8 @@ static struct rtable *icmp_route_lookup(struct net *net, |
1327 |
+ fl4->flowi4_proto = IPPROTO_ICMP; |
1328 |
+ fl4->fl4_icmp_type = type; |
1329 |
+ fl4->fl4_icmp_code = code; |
1330 |
+- fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev); |
1331 |
++ route_lookup_dev = icmp_get_route_lookup_dev(skb_in); |
1332 |
++ fl4->flowi4_oif = l3mdev_master_ifindex(route_lookup_dev); |
1333 |
+ |
1334 |
+ security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4)); |
1335 |
+ rt = ip_route_output_key_hash(net, fl4, skb_in); |
1336 |
+@@ -506,7 +525,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
1337 |
+ if (err) |
1338 |
+ goto relookup_failed; |
1339 |
+ |
1340 |
+- if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev, |
1341 |
++ if (inet_addr_type_dev_table(net, route_lookup_dev, |
1342 |
+ fl4_dec.saddr) == RTN_LOCAL) { |
1343 |
+ rt2 = __ip_route_output_key(net, &fl4_dec); |
1344 |
+ if (IS_ERR(rt2)) |
1345 |
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
1346 |
+index d2b1ae83f258d..b1ecc91955172 100644 |
1347 |
+--- a/net/ipv4/igmp.c |
1348 |
++++ b/net/ipv4/igmp.c |
1349 |
+@@ -2730,6 +2730,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u |
1350 |
+ rv = 1; |
1351 |
+ } else if (im) { |
1352 |
+ if (src_addr) { |
1353 |
++ spin_lock_bh(&im->lock); |
1354 |
+ for (psf = im->sources; psf; psf = psf->sf_next) { |
1355 |
+ if (psf->sf_inaddr == src_addr) |
1356 |
+ break; |
1357 |
+@@ -2740,6 +2741,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u |
1358 |
+ im->sfcount[MCAST_EXCLUDE]; |
1359 |
+ else |
1360 |
+ rv = im->sfcount[MCAST_EXCLUDE] != 0; |
1361 |
++ spin_unlock_bh(&im->lock); |
1362 |
+ } else |
1363 |
+ rv = 1; /* unspecified source; tentatively allow */ |
1364 |
+ } |
1365 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
1366 |
+index 1662573a40309..fd300c3adddec 100644 |
1367 |
+--- a/sound/core/pcm_lib.c |
1368 |
++++ b/sound/core/pcm_lib.c |
1369 |
+@@ -1736,7 +1736,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, |
1370 |
+ channels = params_channels(params); |
1371 |
+ frame_size = snd_pcm_format_size(format, channels); |
1372 |
+ if (frame_size > 0) |
1373 |
+- params->fifo_size /= (unsigned)frame_size; |
1374 |
++ params->fifo_size /= frame_size; |
1375 |
+ } |
1376 |
+ return 0; |
1377 |
+ } |
1378 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
1379 |
+index f486e680aed1d..abe371c01fba2 100644 |
1380 |
+--- a/sound/pci/hda/patch_realtek.c |
1381 |
++++ b/sound/pci/hda/patch_realtek.c |
1382 |
+@@ -9160,6 +9160,16 @@ static int patch_alc269(struct hda_codec *codec) |
1383 |
+ |
1384 |
+ snd_hda_pick_fixup(codec, alc269_fixup_models, |
1385 |
+ alc269_fixup_tbl, alc269_fixups); |
1386 |
++ /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and |
1387 |
++ * the quirk breaks the latter (bko#214101). |
1388 |
++ * Clear the wrong entry. |
1389 |
++ */ |
1390 |
++ if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && |
1391 |
++ codec->core.vendor_id == 0x10ec0294) { |
1392 |
++ codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); |
1393 |
++ codec->fixup_id = HDA_FIXUP_ID_NOT_SET; |
1394 |
++ } |
1395 |
++ |
1396 |
+ snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); |
1397 |
+ snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); |
1398 |
+ snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, |
1399 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
1400 |
+index 4d20f3f45f7e2..d5d828817c5e8 100644 |
1401 |
+--- a/sound/usb/quirks.c |
1402 |
++++ b/sound/usb/quirks.c |
1403 |
+@@ -1841,6 +1841,7 @@ static const struct registration_quirk registration_quirks[] = { |
1404 |
+ REG_QUIRK_ENTRY(0x0951, 0x16ed, 2), /* Kingston HyperX Cloud Alpha S */ |
1405 |
+ REG_QUIRK_ENTRY(0x0951, 0x16ea, 2), /* Kingston HyperX Cloud Flight S */ |
1406 |
+ REG_QUIRK_ENTRY(0x0ecb, 0x1f46, 2), /* JBL Quantum 600 */ |
1407 |
++ REG_QUIRK_ENTRY(0x0ecb, 0x1f47, 2), /* JBL Quantum 800 */ |
1408 |
+ REG_QUIRK_ENTRY(0x0ecb, 0x2039, 2), /* JBL Quantum 400 */ |
1409 |
+ REG_QUIRK_ENTRY(0x0ecb, 0x203c, 2), /* JBL Quantum 600 */ |
1410 |
+ REG_QUIRK_ENTRY(0x0ecb, 0x203e, 2), /* JBL Quantum 800 */ |