1 |
commit: 52ea92c5b1054000b9633c25305d864bd15c610c |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 2 13:06:23 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 2 13:06:23 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=52ea92c5 |
7 |
|
8 |
Linux patch 5.10.103 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1102_linux-5.10.103.patch | 2970 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 2974 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 3438f96a..7f478841 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -451,6 +451,10 @@ Patch: 1101_linux-5.10.102.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.102 |
23 |
|
24 |
+Patch: 1102_linux-5.10.103.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.103 |
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/1102_linux-5.10.103.patch b/1102_linux-5.10.103.patch |
33 |
new file mode 100644 |
34 |
index 00000000..713f7c90 |
35 |
--- /dev/null |
36 |
+++ b/1102_linux-5.10.103.patch |
37 |
@@ -0,0 +1,2970 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index f71684d435e5a..829a66a36807e 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 10 |
46 |
+-SUBLEVEL = 102 |
47 |
++SUBLEVEL = 103 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Dare mighty things |
50 |
+ |
51 |
+diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c |
52 |
+index 237d20dd5622d..286cec4d86d7b 100644 |
53 |
+--- a/arch/parisc/kernel/unaligned.c |
54 |
++++ b/arch/parisc/kernel/unaligned.c |
55 |
+@@ -340,7 +340,7 @@ static int emulate_stw(struct pt_regs *regs, int frreg, int flop) |
56 |
+ : "r" (val), "r" (regs->ior), "r" (regs->isr) |
57 |
+ : "r19", "r20", "r21", "r22", "r1", FIXUP_BRANCH_CLOBBER ); |
58 |
+ |
59 |
+- return 0; |
60 |
++ return ret; |
61 |
+ } |
62 |
+ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
63 |
+ { |
64 |
+@@ -397,7 +397,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
65 |
+ __asm__ __volatile__ ( |
66 |
+ " mtsp %4, %%sr1\n" |
67 |
+ " zdep %2, 29, 2, %%r19\n" |
68 |
+-" dep %%r0, 31, 2, %2\n" |
69 |
++" dep %%r0, 31, 2, %3\n" |
70 |
+ " mtsar %%r19\n" |
71 |
+ " zvdepi -2, 32, %%r19\n" |
72 |
+ "1: ldw 0(%%sr1,%3),%%r20\n" |
73 |
+@@ -409,7 +409,7 @@ static int emulate_std(struct pt_regs *regs, int frreg, int flop) |
74 |
+ " andcm %%r21, %%r19, %%r21\n" |
75 |
+ " or %1, %%r20, %1\n" |
76 |
+ " or %2, %%r21, %2\n" |
77 |
+-"3: stw %1,0(%%sr1,%1)\n" |
78 |
++"3: stw %1,0(%%sr1,%3)\n" |
79 |
+ "4: stw %%r1,4(%%sr1,%3)\n" |
80 |
+ "5: stw %2,8(%%sr1,%3)\n" |
81 |
+ " copy %%r0, %0\n" |
82 |
+@@ -596,7 +596,6 @@ void handle_unaligned(struct pt_regs *regs) |
83 |
+ ret = ERR_NOTHANDLED; /* "undefined", but lets kill them. */ |
84 |
+ break; |
85 |
+ } |
86 |
+-#ifdef CONFIG_PA20 |
87 |
+ switch (regs->iir & OPCODE2_MASK) |
88 |
+ { |
89 |
+ case OPCODE_FLDD_L: |
90 |
+@@ -607,22 +606,23 @@ void handle_unaligned(struct pt_regs *regs) |
91 |
+ flop=1; |
92 |
+ ret = emulate_std(regs, R2(regs->iir),1); |
93 |
+ break; |
94 |
++#ifdef CONFIG_PA20 |
95 |
+ case OPCODE_LDD_L: |
96 |
+ ret = emulate_ldd(regs, R2(regs->iir),0); |
97 |
+ break; |
98 |
+ case OPCODE_STD_L: |
99 |
+ ret = emulate_std(regs, R2(regs->iir),0); |
100 |
+ break; |
101 |
+- } |
102 |
+ #endif |
103 |
++ } |
104 |
+ switch (regs->iir & OPCODE3_MASK) |
105 |
+ { |
106 |
+ case OPCODE_FLDW_L: |
107 |
+ flop=1; |
108 |
+- ret = emulate_ldw(regs, R2(regs->iir),0); |
109 |
++ ret = emulate_ldw(regs, R2(regs->iir), 1); |
110 |
+ break; |
111 |
+ case OPCODE_LDW_M: |
112 |
+- ret = emulate_ldw(regs, R2(regs->iir),1); |
113 |
++ ret = emulate_ldw(regs, R2(regs->iir), 0); |
114 |
+ break; |
115 |
+ |
116 |
+ case OPCODE_FSTW_L: |
117 |
+diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile |
118 |
+index 62de075fc60c0..bc49d5f2302b6 100644 |
119 |
+--- a/arch/riscv/kernel/Makefile |
120 |
++++ b/arch/riscv/kernel/Makefile |
121 |
+@@ -44,6 +44,8 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o |
122 |
+ obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o |
123 |
+ obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o |
124 |
+ |
125 |
++obj-$(CONFIG_TRACE_IRQFLAGS) += trace_irq.o |
126 |
++ |
127 |
+ obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o |
128 |
+ obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o |
129 |
+ obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o |
130 |
+diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S |
131 |
+index 76274a4a1d8e6..5214c578a6023 100644 |
132 |
+--- a/arch/riscv/kernel/entry.S |
133 |
++++ b/arch/riscv/kernel/entry.S |
134 |
+@@ -98,7 +98,7 @@ _save_context: |
135 |
+ .option pop |
136 |
+ |
137 |
+ #ifdef CONFIG_TRACE_IRQFLAGS |
138 |
+- call trace_hardirqs_off |
139 |
++ call __trace_hardirqs_off |
140 |
+ #endif |
141 |
+ |
142 |
+ #ifdef CONFIG_CONTEXT_TRACKING |
143 |
+@@ -131,7 +131,7 @@ skip_context_tracking: |
144 |
+ andi t0, s1, SR_PIE |
145 |
+ beqz t0, 1f |
146 |
+ #ifdef CONFIG_TRACE_IRQFLAGS |
147 |
+- call trace_hardirqs_on |
148 |
++ call __trace_hardirqs_on |
149 |
+ #endif |
150 |
+ csrs CSR_STATUS, SR_IE |
151 |
+ |
152 |
+@@ -222,7 +222,7 @@ ret_from_exception: |
153 |
+ REG_L s0, PT_STATUS(sp) |
154 |
+ csrc CSR_STATUS, SR_IE |
155 |
+ #ifdef CONFIG_TRACE_IRQFLAGS |
156 |
+- call trace_hardirqs_off |
157 |
++ call __trace_hardirqs_off |
158 |
+ #endif |
159 |
+ #ifdef CONFIG_RISCV_M_MODE |
160 |
+ /* the MPP value is too large to be used as an immediate arg for addi */ |
161 |
+@@ -258,10 +258,10 @@ restore_all: |
162 |
+ REG_L s1, PT_STATUS(sp) |
163 |
+ andi t0, s1, SR_PIE |
164 |
+ beqz t0, 1f |
165 |
+- call trace_hardirqs_on |
166 |
++ call __trace_hardirqs_on |
167 |
+ j 2f |
168 |
+ 1: |
169 |
+- call trace_hardirqs_off |
170 |
++ call __trace_hardirqs_off |
171 |
+ 2: |
172 |
+ #endif |
173 |
+ REG_L a0, PT_STATUS(sp) |
174 |
+diff --git a/arch/riscv/kernel/trace_irq.c b/arch/riscv/kernel/trace_irq.c |
175 |
+new file mode 100644 |
176 |
+index 0000000000000..095ac976d7da1 |
177 |
+--- /dev/null |
178 |
++++ b/arch/riscv/kernel/trace_irq.c |
179 |
+@@ -0,0 +1,27 @@ |
180 |
++// SPDX-License-Identifier: GPL-2.0 |
181 |
++/* |
182 |
++ * Copyright (C) 2022 Changbin Du <changbin.du@×××××.com> |
183 |
++ */ |
184 |
++ |
185 |
++#include <linux/irqflags.h> |
186 |
++#include <linux/kprobes.h> |
187 |
++#include "trace_irq.h" |
188 |
++ |
189 |
++/* |
190 |
++ * trace_hardirqs_on/off require the caller to setup frame pointer properly. |
191 |
++ * Otherwise, CALLER_ADDR1 might trigger an pagging exception in kernel. |
192 |
++ * Here we add one extra level so they can be safely called by low |
193 |
++ * level entry code which $fp is used for other purpose. |
194 |
++ */ |
195 |
++ |
196 |
++void __trace_hardirqs_on(void) |
197 |
++{ |
198 |
++ trace_hardirqs_on(); |
199 |
++} |
200 |
++NOKPROBE_SYMBOL(__trace_hardirqs_on); |
201 |
++ |
202 |
++void __trace_hardirqs_off(void) |
203 |
++{ |
204 |
++ trace_hardirqs_off(); |
205 |
++} |
206 |
++NOKPROBE_SYMBOL(__trace_hardirqs_off); |
207 |
+diff --git a/arch/riscv/kernel/trace_irq.h b/arch/riscv/kernel/trace_irq.h |
208 |
+new file mode 100644 |
209 |
+index 0000000000000..99fe67377e5ed |
210 |
+--- /dev/null |
211 |
++++ b/arch/riscv/kernel/trace_irq.h |
212 |
+@@ -0,0 +1,11 @@ |
213 |
++/* SPDX-License-Identifier: GPL-2.0 */ |
214 |
++/* |
215 |
++ * Copyright (C) 2022 Changbin Du <changbin.du@×××××.com> |
216 |
++ */ |
217 |
++#ifndef __TRACE_IRQ_H |
218 |
++#define __TRACE_IRQ_H |
219 |
++ |
220 |
++void __trace_hardirqs_on(void); |
221 |
++void __trace_hardirqs_off(void); |
222 |
++ |
223 |
++#endif /* __TRACE_IRQ_H */ |
224 |
+diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h |
225 |
+index 4e5af2b00d89b..70b9bc5403c5e 100644 |
226 |
+--- a/arch/x86/include/asm/fpu/internal.h |
227 |
++++ b/arch/x86/include/asm/fpu/internal.h |
228 |
+@@ -531,9 +531,11 @@ static inline void __fpregs_load_activate(void) |
229 |
+ * The FPU context is only stored/restored for a user task and |
230 |
+ * PF_KTHREAD is used to distinguish between kernel and user threads. |
231 |
+ */ |
232 |
+-static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu) |
233 |
++static inline void switch_fpu_prepare(struct task_struct *prev, int cpu) |
234 |
+ { |
235 |
+- if (static_cpu_has(X86_FEATURE_FPU) && !(current->flags & PF_KTHREAD)) { |
236 |
++ struct fpu *old_fpu = &prev->thread.fpu; |
237 |
++ |
238 |
++ if (static_cpu_has(X86_FEATURE_FPU) && !(prev->flags & PF_KTHREAD)) { |
239 |
+ if (!copy_fpregs_to_fpstate(old_fpu)) |
240 |
+ old_fpu->last_cpu = -1; |
241 |
+ else |
242 |
+@@ -552,10 +554,11 @@ static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu) |
243 |
+ * Load PKRU from the FPU context if available. Delay loading of the |
244 |
+ * complete FPU state until the return to userland. |
245 |
+ */ |
246 |
+-static inline void switch_fpu_finish(struct fpu *new_fpu) |
247 |
++static inline void switch_fpu_finish(struct task_struct *next) |
248 |
+ { |
249 |
+ u32 pkru_val = init_pkru_value; |
250 |
+ struct pkru_state *pk; |
251 |
++ struct fpu *next_fpu = &next->thread.fpu; |
252 |
+ |
253 |
+ if (!static_cpu_has(X86_FEATURE_FPU)) |
254 |
+ return; |
255 |
+@@ -569,7 +572,7 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) |
256 |
+ * PKRU state is switched eagerly because it needs to be valid before we |
257 |
+ * return to userland e.g. for a copy_to_user() operation. |
258 |
+ */ |
259 |
+- if (!(current->flags & PF_KTHREAD)) { |
260 |
++ if (!(next->flags & PF_KTHREAD)) { |
261 |
+ /* |
262 |
+ * If the PKRU bit in xsave.header.xfeatures is not set, |
263 |
+ * then the PKRU component was in init state, which means |
264 |
+@@ -578,7 +581,7 @@ static inline void switch_fpu_finish(struct fpu *new_fpu) |
265 |
+ * in memory is not valid. This means pkru_val has to be |
266 |
+ * set to 0 and not to init_pkru_value. |
267 |
+ */ |
268 |
+- pk = get_xsave_addr(&new_fpu->state.xsave, XFEATURE_PKRU); |
269 |
++ pk = get_xsave_addr(&next_fpu->state.xsave, XFEATURE_PKRU); |
270 |
+ pkru_val = pk ? pk->pkru : 0; |
271 |
+ } |
272 |
+ __write_pkru(pkru_val); |
273 |
+diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c |
274 |
+index 4f2f54e1281c3..98bf8fd189025 100644 |
275 |
+--- a/arch/x86/kernel/process_32.c |
276 |
++++ b/arch/x86/kernel/process_32.c |
277 |
+@@ -159,14 +159,12 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) |
278 |
+ { |
279 |
+ struct thread_struct *prev = &prev_p->thread, |
280 |
+ *next = &next_p->thread; |
281 |
+- struct fpu *prev_fpu = &prev->fpu; |
282 |
+- struct fpu *next_fpu = &next->fpu; |
283 |
+ int cpu = smp_processor_id(); |
284 |
+ |
285 |
+ /* never put a printk in __switch_to... printk() calls wake_up*() indirectly */ |
286 |
+ |
287 |
+ if (!test_thread_flag(TIF_NEED_FPU_LOAD)) |
288 |
+- switch_fpu_prepare(prev_fpu, cpu); |
289 |
++ switch_fpu_prepare(prev_p, cpu); |
290 |
+ |
291 |
+ /* |
292 |
+ * Save away %gs. No need to save %fs, as it was saved on the |
293 |
+@@ -213,7 +211,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) |
294 |
+ |
295 |
+ this_cpu_write(current_task, next_p); |
296 |
+ |
297 |
+- switch_fpu_finish(next_fpu); |
298 |
++ switch_fpu_finish(next_p); |
299 |
+ |
300 |
+ /* Load the Intel cache allocation PQR MSR. */ |
301 |
+ resctrl_sched_in(); |
302 |
+diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c |
303 |
+index df342bedea88a..ad3f82a18de9d 100644 |
304 |
+--- a/arch/x86/kernel/process_64.c |
305 |
++++ b/arch/x86/kernel/process_64.c |
306 |
+@@ -535,15 +535,13 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) |
307 |
+ { |
308 |
+ struct thread_struct *prev = &prev_p->thread; |
309 |
+ struct thread_struct *next = &next_p->thread; |
310 |
+- struct fpu *prev_fpu = &prev->fpu; |
311 |
+- struct fpu *next_fpu = &next->fpu; |
312 |
+ int cpu = smp_processor_id(); |
313 |
+ |
314 |
+ WARN_ON_ONCE(IS_ENABLED(CONFIG_DEBUG_ENTRY) && |
315 |
+ this_cpu_read(irq_count) != -1); |
316 |
+ |
317 |
+ if (!test_thread_flag(TIF_NEED_FPU_LOAD)) |
318 |
+- switch_fpu_prepare(prev_fpu, cpu); |
319 |
++ switch_fpu_prepare(prev_p, cpu); |
320 |
+ |
321 |
+ /* We must save %fs and %gs before load_TLS() because |
322 |
+ * %fs and %gs may be cleared by load_TLS(). |
323 |
+@@ -595,7 +593,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p) |
324 |
+ this_cpu_write(current_task, next_p); |
325 |
+ this_cpu_write(cpu_current_top_of_stack, task_top_of_stack(next_p)); |
326 |
+ |
327 |
+- switch_fpu_finish(next_fpu); |
328 |
++ switch_fpu_finish(next_p); |
329 |
+ |
330 |
+ /* Reload sp0. */ |
331 |
+ update_task_stack(next_p); |
332 |
+diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c |
333 |
+index c2516ddc3cbec..20d29ae8ed702 100644 |
334 |
+--- a/arch/x86/kvm/mmu/mmu.c |
335 |
++++ b/arch/x86/kvm/mmu/mmu.c |
336 |
+@@ -3631,12 +3631,23 @@ static void shadow_page_table_clear_flood(struct kvm_vcpu *vcpu, gva_t addr) |
337 |
+ walk_shadow_page_lockless_end(vcpu); |
338 |
+ } |
339 |
+ |
340 |
++static u32 alloc_apf_token(struct kvm_vcpu *vcpu) |
341 |
++{ |
342 |
++ /* make sure the token value is not 0 */ |
343 |
++ u32 id = vcpu->arch.apf.id; |
344 |
++ |
345 |
++ if (id << 12 == 0) |
346 |
++ vcpu->arch.apf.id = 1; |
347 |
++ |
348 |
++ return (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; |
349 |
++} |
350 |
++ |
351 |
+ static bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, |
352 |
+ gfn_t gfn) |
353 |
+ { |
354 |
+ struct kvm_arch_async_pf arch; |
355 |
+ |
356 |
+- arch.token = (vcpu->arch.apf.id++ << 12) | vcpu->vcpu_id; |
357 |
++ arch.token = alloc_apf_token(vcpu); |
358 |
+ arch.gfn = gfn; |
359 |
+ arch.direct_map = vcpu->arch.mmu->direct_map; |
360 |
+ arch.cr3 = vcpu->arch.mmu->get_guest_pgd(vcpu); |
361 |
+diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c |
362 |
+index fad6c6a873130..499a947d56ddb 100644 |
363 |
+--- a/drivers/ata/pata_hpt37x.c |
364 |
++++ b/drivers/ata/pata_hpt37x.c |
365 |
+@@ -917,6 +917,20 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) |
366 |
+ irqmask &= ~0x10; |
367 |
+ pci_write_config_byte(dev, 0x5a, irqmask); |
368 |
+ |
369 |
++ /* |
370 |
++ * HPT371 chips physically have only one channel, the secondary one, |
371 |
++ * but the primary channel registers do exist! Go figure... |
372 |
++ * So, we manually disable the non-existing channel here |
373 |
++ * (if the BIOS hasn't done this already). |
374 |
++ */ |
375 |
++ if (dev->device == PCI_DEVICE_ID_TTI_HPT371) { |
376 |
++ u8 mcr1; |
377 |
++ |
378 |
++ pci_read_config_byte(dev, 0x50, &mcr1); |
379 |
++ mcr1 &= ~0x04; |
380 |
++ pci_write_config_byte(dev, 0x50, mcr1); |
381 |
++ } |
382 |
++ |
383 |
+ /* |
384 |
+ * default to pci clock. make sure MA15/16 are set to output |
385 |
+ * to prevent drives having problems with 40-pin cables. Needed |
386 |
+diff --git a/drivers/base/dd.c b/drivers/base/dd.c |
387 |
+index 81ad4f867f02d..64ff137408b8c 100644 |
388 |
+--- a/drivers/base/dd.c |
389 |
++++ b/drivers/base/dd.c |
390 |
+@@ -592,6 +592,9 @@ re_probe: |
391 |
+ drv->remove(dev); |
392 |
+ |
393 |
+ devres_release_all(dev); |
394 |
++ arch_teardown_dma_ops(dev); |
395 |
++ kfree(dev->dma_range_map); |
396 |
++ dev->dma_range_map = NULL; |
397 |
+ driver_sysfs_remove(dev); |
398 |
+ dev->driver = NULL; |
399 |
+ dev_set_drvdata(dev, NULL); |
400 |
+@@ -1168,6 +1171,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) |
401 |
+ |
402 |
+ devres_release_all(dev); |
403 |
+ arch_teardown_dma_ops(dev); |
404 |
++ kfree(dev->dma_range_map); |
405 |
++ dev->dma_range_map = NULL; |
406 |
+ dev->driver = NULL; |
407 |
+ dev_set_drvdata(dev, NULL); |
408 |
+ if (dev->pm_domain && dev->pm_domain->dismiss) |
409 |
+diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c |
410 |
+index ad5c2de395d1f..87c5c421e0f46 100644 |
411 |
+--- a/drivers/base/regmap/regmap-irq.c |
412 |
++++ b/drivers/base/regmap/regmap-irq.c |
413 |
+@@ -170,11 +170,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data) |
414 |
+ ret = regmap_write(map, reg, d->mask_buf[i]); |
415 |
+ if (d->chip->clear_ack) { |
416 |
+ if (d->chip->ack_invert && !ret) |
417 |
+- ret = regmap_write(map, reg, |
418 |
+- d->mask_buf[i]); |
419 |
++ ret = regmap_write(map, reg, UINT_MAX); |
420 |
+ else if (!ret) |
421 |
+- ret = regmap_write(map, reg, |
422 |
+- ~d->mask_buf[i]); |
423 |
++ ret = regmap_write(map, reg, 0); |
424 |
+ } |
425 |
+ if (ret != 0) |
426 |
+ dev_err(d->map->dev, "Failed to ack 0x%x: %d\n", |
427 |
+@@ -509,11 +507,9 @@ static irqreturn_t regmap_irq_thread(int irq, void *d) |
428 |
+ data->status_buf[i]); |
429 |
+ if (chip->clear_ack) { |
430 |
+ if (chip->ack_invert && !ret) |
431 |
+- ret = regmap_write(map, reg, |
432 |
+- data->status_buf[i]); |
433 |
++ ret = regmap_write(map, reg, UINT_MAX); |
434 |
+ else if (!ret) |
435 |
+- ret = regmap_write(map, reg, |
436 |
+- ~data->status_buf[i]); |
437 |
++ ret = regmap_write(map, reg, 0); |
438 |
+ } |
439 |
+ if (ret != 0) |
440 |
+ dev_err(map->dev, "Failed to ack 0x%x: %d\n", |
441 |
+@@ -745,13 +741,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode, |
442 |
+ d->status_buf[i] & d->mask_buf[i]); |
443 |
+ if (chip->clear_ack) { |
444 |
+ if (chip->ack_invert && !ret) |
445 |
+- ret = regmap_write(map, reg, |
446 |
+- (d->status_buf[i] & |
447 |
+- d->mask_buf[i])); |
448 |
++ ret = regmap_write(map, reg, UINT_MAX); |
449 |
+ else if (!ret) |
450 |
+- ret = regmap_write(map, reg, |
451 |
+- ~(d->status_buf[i] & |
452 |
+- d->mask_buf[i])); |
453 |
++ ret = regmap_write(map, reg, 0); |
454 |
+ } |
455 |
+ if (ret != 0) { |
456 |
+ dev_err(map->dev, "Failed to ack 0x%x: %d\n", |
457 |
+diff --git a/drivers/clk/ingenic/jz4725b-cgu.c b/drivers/clk/ingenic/jz4725b-cgu.c |
458 |
+index 8c38e72d14a79..786e361a4a6a4 100644 |
459 |
+--- a/drivers/clk/ingenic/jz4725b-cgu.c |
460 |
++++ b/drivers/clk/ingenic/jz4725b-cgu.c |
461 |
+@@ -139,11 +139,10 @@ static const struct ingenic_cgu_clk_info jz4725b_cgu_clocks[] = { |
462 |
+ }, |
463 |
+ |
464 |
+ [JZ4725B_CLK_I2S] = { |
465 |
+- "i2s", CGU_CLK_MUX | CGU_CLK_DIV | CGU_CLK_GATE, |
466 |
++ "i2s", CGU_CLK_MUX | CGU_CLK_DIV, |
467 |
+ .parents = { JZ4725B_CLK_EXT, JZ4725B_CLK_PLL_HALF, -1, -1 }, |
468 |
+ .mux = { CGU_REG_CPCCR, 31, 1 }, |
469 |
+ .div = { CGU_REG_I2SCDR, 0, 1, 9, -1, -1, -1 }, |
470 |
+- .gate = { CGU_REG_CLKGR, 6 }, |
471 |
+ }, |
472 |
+ |
473 |
+ [JZ4725B_CLK_SPI] = { |
474 |
+diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c |
475 |
+index 9500074b1f1b5..7fbe5f0681b95 100644 |
476 |
+--- a/drivers/gpio/gpio-tegra186.c |
477 |
++++ b/drivers/gpio/gpio-tegra186.c |
478 |
+@@ -337,9 +337,12 @@ static int tegra186_gpio_of_xlate(struct gpio_chip *chip, |
479 |
+ return offset + pin; |
480 |
+ } |
481 |
+ |
482 |
++#define to_tegra_gpio(x) container_of((x), struct tegra_gpio, gpio) |
483 |
++ |
484 |
+ static void tegra186_irq_ack(struct irq_data *data) |
485 |
+ { |
486 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
487 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
488 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
489 |
+ void __iomem *base; |
490 |
+ |
491 |
+ base = tegra186_gpio_get_base(gpio, data->hwirq); |
492 |
+@@ -351,7 +354,8 @@ static void tegra186_irq_ack(struct irq_data *data) |
493 |
+ |
494 |
+ static void tegra186_irq_mask(struct irq_data *data) |
495 |
+ { |
496 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
497 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
498 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
499 |
+ void __iomem *base; |
500 |
+ u32 value; |
501 |
+ |
502 |
+@@ -366,7 +370,8 @@ static void tegra186_irq_mask(struct irq_data *data) |
503 |
+ |
504 |
+ static void tegra186_irq_unmask(struct irq_data *data) |
505 |
+ { |
506 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
507 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
508 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
509 |
+ void __iomem *base; |
510 |
+ u32 value; |
511 |
+ |
512 |
+@@ -381,7 +386,8 @@ static void tegra186_irq_unmask(struct irq_data *data) |
513 |
+ |
514 |
+ static int tegra186_irq_set_type(struct irq_data *data, unsigned int type) |
515 |
+ { |
516 |
+- struct tegra_gpio *gpio = irq_data_get_irq_chip_data(data); |
517 |
++ struct gpio_chip *gc = irq_data_get_irq_chip_data(data); |
518 |
++ struct tegra_gpio *gpio = to_tegra_gpio(gc); |
519 |
+ void __iomem *base; |
520 |
+ u32 value; |
521 |
+ |
522 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c |
523 |
+index 37226cbbbd11a..7212b9900e0ab 100644 |
524 |
+--- a/drivers/gpu/drm/amd/amdgpu/soc15.c |
525 |
++++ b/drivers/gpu/drm/amd/amdgpu/soc15.c |
526 |
+@@ -1194,8 +1194,11 @@ static int soc15_common_early_init(void *handle) |
527 |
+ AMD_CG_SUPPORT_SDMA_MGCG | |
528 |
+ AMD_CG_SUPPORT_SDMA_LS; |
529 |
+ |
530 |
++ /* |
531 |
++ * MMHUB PG needs to be disabled for Picasso for |
532 |
++ * stability reasons. |
533 |
++ */ |
534 |
+ adev->pg_flags = AMD_PG_SUPPORT_SDMA | |
535 |
+- AMD_PG_SUPPORT_MMHUB | |
536 |
+ AMD_PG_SUPPORT_VCN; |
537 |
+ } else { |
538 |
+ adev->cg_flags = AMD_CG_SUPPORT_GFX_MGCG | |
539 |
+diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c |
540 |
+index add317bd8d55c..3d7593ea79f14 100644 |
541 |
+--- a/drivers/gpu/drm/drm_edid.c |
542 |
++++ b/drivers/gpu/drm/drm_edid.c |
543 |
+@@ -5132,6 +5132,7 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi |
544 |
+ if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) |
545 |
+ return quirks; |
546 |
+ |
547 |
++ info->color_formats |= DRM_COLOR_FORMAT_RGB444; |
548 |
+ drm_parse_cea_ext(connector, edid); |
549 |
+ |
550 |
+ /* |
551 |
+@@ -5180,7 +5181,6 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi |
552 |
+ DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", |
553 |
+ connector->name, info->bpc); |
554 |
+ |
555 |
+- info->color_formats |= DRM_COLOR_FORMAT_RGB444; |
556 |
+ if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) |
557 |
+ info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; |
558 |
+ if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) |
559 |
+diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c |
560 |
+index e51ca7ca0a2a7..472aaea75ef84 100644 |
561 |
+--- a/drivers/gpu/drm/i915/intel_pm.c |
562 |
++++ b/drivers/gpu/drm/i915/intel_pm.c |
563 |
+@@ -3996,6 +3996,17 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) |
564 |
+ return ret; |
565 |
+ } |
566 |
+ |
567 |
++ if (intel_can_enable_sagv(dev_priv, new_bw_state) != |
568 |
++ intel_can_enable_sagv(dev_priv, old_bw_state)) { |
569 |
++ ret = intel_atomic_serialize_global_state(&new_bw_state->base); |
570 |
++ if (ret) |
571 |
++ return ret; |
572 |
++ } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) { |
573 |
++ ret = intel_atomic_lock_global_state(&new_bw_state->base); |
574 |
++ if (ret) |
575 |
++ return ret; |
576 |
++ } |
577 |
++ |
578 |
+ for_each_new_intel_crtc_in_state(state, crtc, |
579 |
+ new_crtc_state, i) { |
580 |
+ struct skl_pipe_wm *pipe_wm = &new_crtc_state->wm.skl.optimal; |
581 |
+@@ -4010,17 +4021,6 @@ static int intel_compute_sagv_mask(struct intel_atomic_state *state) |
582 |
+ intel_can_enable_sagv(dev_priv, new_bw_state); |
583 |
+ } |
584 |
+ |
585 |
+- if (intel_can_enable_sagv(dev_priv, new_bw_state) != |
586 |
+- intel_can_enable_sagv(dev_priv, old_bw_state)) { |
587 |
+- ret = intel_atomic_serialize_global_state(&new_bw_state->base); |
588 |
+- if (ret) |
589 |
+- return ret; |
590 |
+- } else if (new_bw_state->pipe_sagv_reject != old_bw_state->pipe_sagv_reject) { |
591 |
+- ret = intel_atomic_lock_global_state(&new_bw_state->base); |
592 |
+- if (ret) |
593 |
+- return ret; |
594 |
+- } |
595 |
+- |
596 |
+ return 0; |
597 |
+ } |
598 |
+ |
599 |
+diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c |
600 |
+index e5a83f7492677..d649fea829994 100644 |
601 |
+--- a/drivers/hwmon/hwmon.c |
602 |
++++ b/drivers/hwmon/hwmon.c |
603 |
+@@ -178,12 +178,14 @@ static int hwmon_thermal_add_sensor(struct device *dev, int index) |
604 |
+ |
605 |
+ tzd = devm_thermal_zone_of_sensor_register(dev, index, tdata, |
606 |
+ &hwmon_thermal_ops); |
607 |
+- /* |
608 |
+- * If CONFIG_THERMAL_OF is disabled, this returns -ENODEV, |
609 |
+- * so ignore that error but forward any other error. |
610 |
+- */ |
611 |
+- if (IS_ERR(tzd) && (PTR_ERR(tzd) != -ENODEV)) |
612 |
+- return PTR_ERR(tzd); |
613 |
++ if (IS_ERR(tzd)) { |
614 |
++ if (PTR_ERR(tzd) != -ENODEV) |
615 |
++ return PTR_ERR(tzd); |
616 |
++ dev_info(dev, "temp%d_input not attached to any thermal zone\n", |
617 |
++ index + 1); |
618 |
++ devm_kfree(dev, tdata); |
619 |
++ return 0; |
620 |
++ } |
621 |
+ |
622 |
+ err = devm_add_action(dev, hwmon_thermal_remove_sensor, &tdata->node); |
623 |
+ if (err) |
624 |
+diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c |
625 |
+index 48435865fdaf3..792526462f1c9 100644 |
626 |
+--- a/drivers/iio/accel/bmc150-accel-core.c |
627 |
++++ b/drivers/iio/accel/bmc150-accel-core.c |
628 |
+@@ -1648,11 +1648,14 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, |
629 |
+ ret = iio_device_register(indio_dev); |
630 |
+ if (ret < 0) { |
631 |
+ dev_err(dev, "Unable to register iio device\n"); |
632 |
+- goto err_trigger_unregister; |
633 |
++ goto err_pm_cleanup; |
634 |
+ } |
635 |
+ |
636 |
+ return 0; |
637 |
+ |
638 |
++err_pm_cleanup: |
639 |
++ pm_runtime_dont_use_autosuspend(dev); |
640 |
++ pm_runtime_disable(dev); |
641 |
+ err_trigger_unregister: |
642 |
+ bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1); |
643 |
+ err_buffer_cleanup: |
644 |
+diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c |
645 |
+index 2eaf85b6e39f4..89e0a89d95d6b 100644 |
646 |
+--- a/drivers/iio/accel/kxcjk-1013.c |
647 |
++++ b/drivers/iio/accel/kxcjk-1013.c |
648 |
+@@ -1429,11 +1429,14 @@ static int kxcjk1013_probe(struct i2c_client *client, |
649 |
+ ret = iio_device_register(indio_dev); |
650 |
+ if (ret < 0) { |
651 |
+ dev_err(&client->dev, "unable to register iio device\n"); |
652 |
+- goto err_buffer_cleanup; |
653 |
++ goto err_pm_cleanup; |
654 |
+ } |
655 |
+ |
656 |
+ return 0; |
657 |
+ |
658 |
++err_pm_cleanup: |
659 |
++ pm_runtime_dont_use_autosuspend(&client->dev); |
660 |
++ pm_runtime_disable(&client->dev); |
661 |
+ err_buffer_cleanup: |
662 |
+ iio_triggered_buffer_cleanup(indio_dev); |
663 |
+ err_trigger_unregister: |
664 |
+diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c |
665 |
+index 08a2303cc9df3..26421e8e82639 100644 |
666 |
+--- a/drivers/iio/accel/mma9551.c |
667 |
++++ b/drivers/iio/accel/mma9551.c |
668 |
+@@ -495,11 +495,14 @@ static int mma9551_probe(struct i2c_client *client, |
669 |
+ ret = iio_device_register(indio_dev); |
670 |
+ if (ret < 0) { |
671 |
+ dev_err(&client->dev, "unable to register iio device\n"); |
672 |
+- goto out_poweroff; |
673 |
++ goto err_pm_cleanup; |
674 |
+ } |
675 |
+ |
676 |
+ return 0; |
677 |
+ |
678 |
++err_pm_cleanup: |
679 |
++ pm_runtime_dont_use_autosuspend(&client->dev); |
680 |
++ pm_runtime_disable(&client->dev); |
681 |
+ out_poweroff: |
682 |
+ mma9551_set_device_state(client, false); |
683 |
+ |
684 |
+diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c |
685 |
+index c15908faa3816..a23a7685d1f93 100644 |
686 |
+--- a/drivers/iio/accel/mma9553.c |
687 |
++++ b/drivers/iio/accel/mma9553.c |
688 |
+@@ -1134,12 +1134,15 @@ static int mma9553_probe(struct i2c_client *client, |
689 |
+ ret = iio_device_register(indio_dev); |
690 |
+ if (ret < 0) { |
691 |
+ dev_err(&client->dev, "unable to register iio device\n"); |
692 |
+- goto out_poweroff; |
693 |
++ goto err_pm_cleanup; |
694 |
+ } |
695 |
+ |
696 |
+ dev_dbg(&indio_dev->dev, "Registered device %s\n", name); |
697 |
+ return 0; |
698 |
+ |
699 |
++err_pm_cleanup: |
700 |
++ pm_runtime_dont_use_autosuspend(&client->dev); |
701 |
++ pm_runtime_disable(&client->dev); |
702 |
+ out_poweroff: |
703 |
+ mma9551_set_device_state(client, false); |
704 |
+ return ret; |
705 |
+diff --git a/drivers/iio/adc/ad7124.c b/drivers/iio/adc/ad7124.c |
706 |
+index 9c2401c5848ec..bd35009950376 100644 |
707 |
+--- a/drivers/iio/adc/ad7124.c |
708 |
++++ b/drivers/iio/adc/ad7124.c |
709 |
+@@ -74,7 +74,7 @@ |
710 |
+ #define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x) |
711 |
+ #define AD7124_CONFIG_PGA_MSK GENMASK(2, 0) |
712 |
+ #define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x) |
713 |
+-#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6) |
714 |
++#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(6, 5) |
715 |
+ #define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x) |
716 |
+ |
717 |
+ /* AD7124_FILTER_X */ |
718 |
+diff --git a/drivers/iio/adc/men_z188_adc.c b/drivers/iio/adc/men_z188_adc.c |
719 |
+index 42ea8bc7e7805..adc5ceaef8c93 100644 |
720 |
+--- a/drivers/iio/adc/men_z188_adc.c |
721 |
++++ b/drivers/iio/adc/men_z188_adc.c |
722 |
+@@ -103,6 +103,7 @@ static int men_z188_probe(struct mcb_device *dev, |
723 |
+ struct z188_adc *adc; |
724 |
+ struct iio_dev *indio_dev; |
725 |
+ struct resource *mem; |
726 |
++ int ret; |
727 |
+ |
728 |
+ indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc)); |
729 |
+ if (!indio_dev) |
730 |
+@@ -128,8 +129,14 @@ static int men_z188_probe(struct mcb_device *dev, |
731 |
+ adc->mem = mem; |
732 |
+ mcb_set_drvdata(dev, indio_dev); |
733 |
+ |
734 |
+- return iio_device_register(indio_dev); |
735 |
++ ret = iio_device_register(indio_dev); |
736 |
++ if (ret) |
737 |
++ goto err_unmap; |
738 |
++ |
739 |
++ return 0; |
740 |
+ |
741 |
++err_unmap: |
742 |
++ iounmap(adc->base); |
743 |
+ err: |
744 |
+ mcb_release_mem(mem); |
745 |
+ return -ENXIO; |
746 |
+diff --git a/drivers/iio/gyro/bmg160_core.c b/drivers/iio/gyro/bmg160_core.c |
747 |
+index 39fe0b1785920..b6b90eebec0b9 100644 |
748 |
+--- a/drivers/iio/gyro/bmg160_core.c |
749 |
++++ b/drivers/iio/gyro/bmg160_core.c |
750 |
+@@ -1170,11 +1170,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq, |
751 |
+ ret = iio_device_register(indio_dev); |
752 |
+ if (ret < 0) { |
753 |
+ dev_err(dev, "unable to register iio device\n"); |
754 |
+- goto err_buffer_cleanup; |
755 |
++ goto err_pm_cleanup; |
756 |
+ } |
757 |
+ |
758 |
+ return 0; |
759 |
+ |
760 |
++err_pm_cleanup: |
761 |
++ pm_runtime_dont_use_autosuspend(dev); |
762 |
++ pm_runtime_disable(dev); |
763 |
+ err_buffer_cleanup: |
764 |
+ iio_triggered_buffer_cleanup(indio_dev); |
765 |
+ err_trigger_unregister: |
766 |
+diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c |
767 |
+index 61885e99d3fc1..89133315e6aaf 100644 |
768 |
+--- a/drivers/iio/imu/kmx61.c |
769 |
++++ b/drivers/iio/imu/kmx61.c |
770 |
+@@ -1392,7 +1392,7 @@ static int kmx61_probe(struct i2c_client *client, |
771 |
+ ret = iio_device_register(data->acc_indio_dev); |
772 |
+ if (ret < 0) { |
773 |
+ dev_err(&client->dev, "Failed to register acc iio device\n"); |
774 |
+- goto err_buffer_cleanup_mag; |
775 |
++ goto err_pm_cleanup; |
776 |
+ } |
777 |
+ |
778 |
+ ret = iio_device_register(data->mag_indio_dev); |
779 |
+@@ -1405,6 +1405,9 @@ static int kmx61_probe(struct i2c_client *client, |
780 |
+ |
781 |
+ err_iio_unregister_acc: |
782 |
+ iio_device_unregister(data->acc_indio_dev); |
783 |
++err_pm_cleanup: |
784 |
++ pm_runtime_dont_use_autosuspend(&client->dev); |
785 |
++ pm_runtime_disable(&client->dev); |
786 |
+ err_buffer_cleanup_mag: |
787 |
+ if (client->irq > 0) |
788 |
+ iio_triggered_buffer_cleanup(data->mag_indio_dev); |
789 |
+diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
790 |
+index 558ca3843bb95..2c528425b03b4 100644 |
791 |
+--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
792 |
++++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c |
793 |
+@@ -1558,8 +1558,12 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, |
794 |
+ if (err < 0) |
795 |
+ return err; |
796 |
+ |
797 |
++ /* |
798 |
++ * we need to wait for sensor settling time before |
799 |
++ * reading data in order to avoid corrupted samples |
800 |
++ */ |
801 |
+ delay = 1000000000 / sensor->odr; |
802 |
+- usleep_range(delay, 2 * delay); |
803 |
++ usleep_range(3 * delay, 4 * delay); |
804 |
+ |
805 |
+ err = st_lsm6dsx_read_locked(hw, addr, &data, sizeof(data)); |
806 |
+ if (err < 0) |
807 |
+diff --git a/drivers/iio/magnetometer/bmc150_magn.c b/drivers/iio/magnetometer/bmc150_magn.c |
808 |
+index 8eacfaf584cfd..620537d0104d4 100644 |
809 |
+--- a/drivers/iio/magnetometer/bmc150_magn.c |
810 |
++++ b/drivers/iio/magnetometer/bmc150_magn.c |
811 |
+@@ -941,13 +941,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap, |
812 |
+ ret = iio_device_register(indio_dev); |
813 |
+ if (ret < 0) { |
814 |
+ dev_err(dev, "unable to register iio device\n"); |
815 |
+- goto err_disable_runtime_pm; |
816 |
++ goto err_pm_cleanup; |
817 |
+ } |
818 |
+ |
819 |
+ dev_dbg(dev, "Registered device %s\n", name); |
820 |
+ return 0; |
821 |
+ |
822 |
+-err_disable_runtime_pm: |
823 |
++err_pm_cleanup: |
824 |
++ pm_runtime_dont_use_autosuspend(dev); |
825 |
+ pm_runtime_disable(dev); |
826 |
+ err_buffer_cleanup: |
827 |
+ iio_triggered_buffer_cleanup(indio_dev); |
828 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
829 |
+index ce492134c1e5c..fbb0efbe25f84 100644 |
830 |
+--- a/drivers/infiniband/core/cma.c |
831 |
++++ b/drivers/infiniband/core/cma.c |
832 |
+@@ -3321,22 +3321,30 @@ err: |
833 |
+ static int cma_bind_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, |
834 |
+ const struct sockaddr *dst_addr) |
835 |
+ { |
836 |
+- if (!src_addr || !src_addr->sa_family) { |
837 |
+- src_addr = (struct sockaddr *) &id->route.addr.src_addr; |
838 |
+- src_addr->sa_family = dst_addr->sa_family; |
839 |
+- if (IS_ENABLED(CONFIG_IPV6) && |
840 |
+- dst_addr->sa_family == AF_INET6) { |
841 |
+- struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *) src_addr; |
842 |
+- struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *) dst_addr; |
843 |
+- src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; |
844 |
+- if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
845 |
+- id->route.addr.dev_addr.bound_dev_if = dst_addr6->sin6_scope_id; |
846 |
+- } else if (dst_addr->sa_family == AF_IB) { |
847 |
+- ((struct sockaddr_ib *) src_addr)->sib_pkey = |
848 |
+- ((struct sockaddr_ib *) dst_addr)->sib_pkey; |
849 |
+- } |
850 |
+- } |
851 |
+- return rdma_bind_addr(id, src_addr); |
852 |
++ struct sockaddr_storage zero_sock = {}; |
853 |
++ |
854 |
++ if (src_addr && src_addr->sa_family) |
855 |
++ return rdma_bind_addr(id, src_addr); |
856 |
++ |
857 |
++ /* |
858 |
++ * When the src_addr is not specified, automatically supply an any addr |
859 |
++ */ |
860 |
++ zero_sock.ss_family = dst_addr->sa_family; |
861 |
++ if (IS_ENABLED(CONFIG_IPV6) && dst_addr->sa_family == AF_INET6) { |
862 |
++ struct sockaddr_in6 *src_addr6 = |
863 |
++ (struct sockaddr_in6 *)&zero_sock; |
864 |
++ struct sockaddr_in6 *dst_addr6 = |
865 |
++ (struct sockaddr_in6 *)dst_addr; |
866 |
++ |
867 |
++ src_addr6->sin6_scope_id = dst_addr6->sin6_scope_id; |
868 |
++ if (ipv6_addr_type(&dst_addr6->sin6_addr) & IPV6_ADDR_LINKLOCAL) |
869 |
++ id->route.addr.dev_addr.bound_dev_if = |
870 |
++ dst_addr6->sin6_scope_id; |
871 |
++ } else if (dst_addr->sa_family == AF_IB) { |
872 |
++ ((struct sockaddr_ib *)&zero_sock)->sib_pkey = |
873 |
++ ((struct sockaddr_ib *)dst_addr)->sib_pkey; |
874 |
++ } |
875 |
++ return rdma_bind_addr(id, (struct sockaddr *)&zero_sock); |
876 |
+ } |
877 |
+ |
878 |
+ /* |
879 |
+diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
880 |
+index 46fad202a380e..13634eda833de 100644 |
881 |
+--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
882 |
++++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c |
883 |
+@@ -1328,6 +1328,12 @@ out_err: |
884 |
+ |
885 |
+ static void free_permits(struct rtrs_clt *clt) |
886 |
+ { |
887 |
++ if (clt->permits_map) { |
888 |
++ size_t sz = clt->queue_depth; |
889 |
++ |
890 |
++ wait_event(clt->permits_wait, |
891 |
++ find_first_bit(clt->permits_map, sz) >= sz); |
892 |
++ } |
893 |
+ kfree(clt->permits_map); |
894 |
+ clt->permits_map = NULL; |
895 |
+ kfree(clt->permits); |
896 |
+@@ -2540,6 +2546,8 @@ static void rtrs_clt_dev_release(struct device *dev) |
897 |
+ { |
898 |
+ struct rtrs_clt *clt = container_of(dev, struct rtrs_clt, dev); |
899 |
+ |
900 |
++ mutex_destroy(&clt->paths_ev_mutex); |
901 |
++ mutex_destroy(&clt->paths_mutex); |
902 |
+ kfree(clt); |
903 |
+ } |
904 |
+ |
905 |
+@@ -2571,6 +2579,8 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num, |
906 |
+ return ERR_PTR(-ENOMEM); |
907 |
+ } |
908 |
+ |
909 |
++ clt->dev.class = rtrs_clt_dev_class; |
910 |
++ clt->dev.release = rtrs_clt_dev_release; |
911 |
+ uuid_gen(&clt->paths_uuid); |
912 |
+ INIT_LIST_HEAD_RCU(&clt->paths_list); |
913 |
+ clt->paths_num = paths_num; |
914 |
+@@ -2588,64 +2598,51 @@ static struct rtrs_clt *alloc_clt(const char *sessname, size_t paths_num, |
915 |
+ init_waitqueue_head(&clt->permits_wait); |
916 |
+ mutex_init(&clt->paths_ev_mutex); |
917 |
+ mutex_init(&clt->paths_mutex); |
918 |
++ device_initialize(&clt->dev); |
919 |
+ |
920 |
+- clt->dev.class = rtrs_clt_dev_class; |
921 |
+- clt->dev.release = rtrs_clt_dev_release; |
922 |
+ err = dev_set_name(&clt->dev, "%s", sessname); |
923 |
+ if (err) |
924 |
+- goto err; |
925 |
++ goto err_put; |
926 |
++ |
927 |
+ /* |
928 |
+ * Suppress user space notification until |
929 |
+ * sysfs files are created |
930 |
+ */ |
931 |
+ dev_set_uevent_suppress(&clt->dev, true); |
932 |
+- err = device_register(&clt->dev); |
933 |
+- if (err) { |
934 |
+- put_device(&clt->dev); |
935 |
+- goto err; |
936 |
+- } |
937 |
++ err = device_add(&clt->dev); |
938 |
++ if (err) |
939 |
++ goto err_put; |
940 |
+ |
941 |
+ clt->kobj_paths = kobject_create_and_add("paths", &clt->dev.kobj); |
942 |
+ if (!clt->kobj_paths) { |
943 |
+ err = -ENOMEM; |
944 |
+- goto err_dev; |
945 |
++ goto err_del; |
946 |
+ } |
947 |
+ err = rtrs_clt_create_sysfs_root_files(clt); |
948 |
+ if (err) { |
949 |
+ kobject_del(clt->kobj_paths); |
950 |
+ kobject_put(clt->kobj_paths); |
951 |
+- goto err_dev; |
952 |
++ goto err_del; |
953 |
+ } |
954 |
+ dev_set_uevent_suppress(&clt->dev, false); |
955 |
+ kobject_uevent(&clt->dev.kobj, KOBJ_ADD); |
956 |
+ |
957 |
+ return clt; |
958 |
+-err_dev: |
959 |
+- device_unregister(&clt->dev); |
960 |
+-err: |
961 |
++err_del: |
962 |
++ device_del(&clt->dev); |
963 |
++err_put: |
964 |
+ free_percpu(clt->pcpu_path); |
965 |
+- kfree(clt); |
966 |
++ put_device(&clt->dev); |
967 |
+ return ERR_PTR(err); |
968 |
+ } |
969 |
+ |
970 |
+-static void wait_for_inflight_permits(struct rtrs_clt *clt) |
971 |
+-{ |
972 |
+- if (clt->permits_map) { |
973 |
+- size_t sz = clt->queue_depth; |
974 |
+- |
975 |
+- wait_event(clt->permits_wait, |
976 |
+- find_first_bit(clt->permits_map, sz) >= sz); |
977 |
+- } |
978 |
+-} |
979 |
+- |
980 |
+ static void free_clt(struct rtrs_clt *clt) |
981 |
+ { |
982 |
+- wait_for_inflight_permits(clt); |
983 |
+- free_permits(clt); |
984 |
+ free_percpu(clt->pcpu_path); |
985 |
+- mutex_destroy(&clt->paths_ev_mutex); |
986 |
+- mutex_destroy(&clt->paths_mutex); |
987 |
+- /* release callback will free clt in last put */ |
988 |
++ |
989 |
++ /* |
990 |
++ * release callback will free clt and destroy mutexes in last put |
991 |
++ */ |
992 |
+ device_unregister(&clt->dev); |
993 |
+ } |
994 |
+ |
995 |
+@@ -2761,6 +2758,7 @@ void rtrs_clt_close(struct rtrs_clt *clt) |
996 |
+ rtrs_clt_destroy_sess_files(sess, NULL); |
997 |
+ kobject_put(&sess->kobj); |
998 |
+ } |
999 |
++ free_permits(clt); |
1000 |
+ free_clt(clt); |
1001 |
+ } |
1002 |
+ EXPORT_SYMBOL(rtrs_clt_close); |
1003 |
+diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c |
1004 |
+index 86d5c4c92b363..b4ccb333a8342 100644 |
1005 |
+--- a/drivers/infiniband/ulp/srp/ib_srp.c |
1006 |
++++ b/drivers/infiniband/ulp/srp/ib_srp.c |
1007 |
+@@ -4045,9 +4045,11 @@ static void srp_remove_one(struct ib_device *device, void *client_data) |
1008 |
+ spin_unlock(&host->target_lock); |
1009 |
+ |
1010 |
+ /* |
1011 |
+- * Wait for tl_err and target port removal tasks. |
1012 |
++ * srp_queue_remove_work() queues a call to |
1013 |
++ * srp_remove_target(). The latter function cancels |
1014 |
++ * target->tl_err_work so waiting for the remove works to |
1015 |
++ * finish is sufficient. |
1016 |
+ */ |
1017 |
+- flush_workqueue(system_long_wq); |
1018 |
+ flush_workqueue(srp_remove_wq); |
1019 |
+ |
1020 |
+ kfree(host); |
1021 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1022 |
+index 9a86367a26369..7fa271db41b07 100644 |
1023 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1024 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1025 |
+@@ -100,6 +100,9 @@ MODULE_LICENSE("GPL"); |
1026 |
+ MODULE_FIRMWARE(FW_FILE_NAME_E1); |
1027 |
+ MODULE_FIRMWARE(FW_FILE_NAME_E1H); |
1028 |
+ MODULE_FIRMWARE(FW_FILE_NAME_E2); |
1029 |
++MODULE_FIRMWARE(FW_FILE_NAME_E1_V15); |
1030 |
++MODULE_FIRMWARE(FW_FILE_NAME_E1H_V15); |
1031 |
++MODULE_FIRMWARE(FW_FILE_NAME_E2_V15); |
1032 |
+ |
1033 |
+ int bnx2x_num_queues; |
1034 |
+ module_param_named(num_queues, bnx2x_num_queues, int, 0444); |
1035 |
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
1036 |
+index 6f9196ff2ac4f..98087b278d1f4 100644 |
1037 |
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
1038 |
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |
1039 |
+@@ -1926,6 +1926,9 @@ static int bnxt_get_fecparam(struct net_device *dev, |
1040 |
+ case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_RS272_IEEE_ACTIVE: |
1041 |
+ fec->active_fec |= ETHTOOL_FEC_LLRS; |
1042 |
+ break; |
1043 |
++ case PORT_PHY_QCFG_RESP_ACTIVE_FEC_FEC_NONE_ACTIVE: |
1044 |
++ fec->active_fec |= ETHTOOL_FEC_OFF; |
1045 |
++ break; |
1046 |
+ } |
1047 |
+ return 0; |
1048 |
+ } |
1049 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1050 |
+index bc7c1962f9e66..6a1b1363ac16a 100644 |
1051 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1052 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
1053 |
+@@ -1746,7 +1746,7 @@ static int mlx5e_get_module_eeprom(struct net_device *netdev, |
1054 |
+ if (size_read < 0) { |
1055 |
+ netdev_err(priv->netdev, "%s: mlx5_query_eeprom failed:0x%x\n", |
1056 |
+ __func__, size_read); |
1057 |
+- return 0; |
1058 |
++ return size_read; |
1059 |
+ } |
1060 |
+ |
1061 |
+ i += size_read; |
1062 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1063 |
+index d384403d73f69..b8637547800f9 100644 |
1064 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1065 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c |
1066 |
+@@ -985,7 +985,8 @@ static inline void mlx5e_handle_csum(struct net_device *netdev, |
1067 |
+ } |
1068 |
+ |
1069 |
+ /* True when explicitly set via priv flag, or XDP prog is loaded */ |
1070 |
+- if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state)) |
1071 |
++ if (test_bit(MLX5E_RQ_STATE_NO_CSUM_COMPLETE, &rq->state) || |
1072 |
++ get_cqe_tls_offload(cqe)) |
1073 |
+ goto csum_unnecessary; |
1074 |
+ |
1075 |
+ /* CQE csum doesn't cover padding octets in short ethernet |
1076 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
1077 |
+index e06b1ba7d2349..ccc7dd3e738a4 100644 |
1078 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
1079 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c |
1080 |
+@@ -2037,10 +2037,6 @@ esw_check_vport_match_metadata_supported(const struct mlx5_eswitch *esw) |
1081 |
+ if (!MLX5_CAP_ESW_FLOWTABLE(esw->dev, flow_source)) |
1082 |
+ return false; |
1083 |
+ |
1084 |
+- if (mlx5_core_is_ecpf_esw_manager(esw->dev) || |
1085 |
+- mlx5_ecpf_vport_exists(esw->dev)) |
1086 |
+- return false; |
1087 |
+- |
1088 |
+ return true; |
1089 |
+ } |
1090 |
+ |
1091 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
1092 |
+index 0ff034b0866e2..55772f0cbbf8f 100644 |
1093 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
1094 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c |
1095 |
+@@ -2034,6 +2034,8 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle) |
1096 |
+ fte->node.del_hw_func = NULL; |
1097 |
+ up_write_ref_node(&fte->node, false); |
1098 |
+ tree_put_node(&fte->node, false); |
1099 |
++ } else { |
1100 |
++ up_write_ref_node(&fte->node, false); |
1101 |
+ } |
1102 |
+ kfree(handle); |
1103 |
+ } |
1104 |
+diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1105 |
+index d3d5b663a4a3c..088ceac07b805 100644 |
1106 |
+--- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1107 |
++++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c |
1108 |
+@@ -922,8 +922,8 @@ nfp_tunnel_add_shared_mac(struct nfp_app *app, struct net_device *netdev, |
1109 |
+ int port, bool mod) |
1110 |
+ { |
1111 |
+ struct nfp_flower_priv *priv = app->priv; |
1112 |
+- int ida_idx = NFP_MAX_MAC_INDEX, err; |
1113 |
+ struct nfp_tun_offloaded_mac *entry; |
1114 |
++ int ida_idx = -1, err; |
1115 |
+ u16 nfp_mac_idx = 0; |
1116 |
+ |
1117 |
+ entry = nfp_tunnel_lookup_offloaded_macs(app, netdev->dev_addr); |
1118 |
+@@ -997,7 +997,7 @@ err_remove_hash: |
1119 |
+ err_free_entry: |
1120 |
+ kfree(entry); |
1121 |
+ err_free_ida: |
1122 |
+- if (ida_idx != NFP_MAX_MAC_INDEX) |
1123 |
++ if (ida_idx != -1) |
1124 |
+ ida_simple_remove(&priv->tun.mac_off_ids, ida_idx); |
1125 |
+ |
1126 |
+ return err; |
1127 |
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1128 |
+index 650ffb93796f1..130f4b707bdc4 100644 |
1129 |
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
1130 |
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1131 |
+@@ -1421,6 +1421,8 @@ static int temac_probe(struct platform_device *pdev) |
1132 |
+ lp->indirect_lock = devm_kmalloc(&pdev->dev, |
1133 |
+ sizeof(*lp->indirect_lock), |
1134 |
+ GFP_KERNEL); |
1135 |
++ if (!lp->indirect_lock) |
1136 |
++ return -ENOMEM; |
1137 |
+ spin_lock_init(lp->indirect_lock); |
1138 |
+ } |
1139 |
+ |
1140 |
+diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c |
1141 |
+index 6aaa0675c28a3..43ddbe61dc58e 100644 |
1142 |
+--- a/drivers/net/usb/cdc_ether.c |
1143 |
++++ b/drivers/net/usb/cdc_ether.c |
1144 |
+@@ -570,6 +570,11 @@ static const struct usb_device_id products[] = { |
1145 |
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
1146 |
+ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
1147 |
+ |
1148 |
++#define ZAURUS_FAKE_INTERFACE \ |
1149 |
++ .bInterfaceClass = USB_CLASS_COMM, \ |
1150 |
++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ |
1151 |
++ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
1152 |
++ |
1153 |
+ /* SA-1100 based Sharp Zaurus ("collie"), or compatible; |
1154 |
+ * wire-incompatible with true CDC Ethernet implementations. |
1155 |
+ * (And, it seems, needlessly so...) |
1156 |
+@@ -623,6 +628,13 @@ static const struct usb_device_id products[] = { |
1157 |
+ .idProduct = 0x9032, /* SL-6000 */ |
1158 |
+ ZAURUS_MASTER_INTERFACE, |
1159 |
+ .driver_info = 0, |
1160 |
++}, { |
1161 |
++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1162 |
++ | USB_DEVICE_ID_MATCH_DEVICE, |
1163 |
++ .idVendor = 0x04DD, |
1164 |
++ .idProduct = 0x9032, /* SL-6000 */ |
1165 |
++ ZAURUS_FAKE_INTERFACE, |
1166 |
++ .driver_info = 0, |
1167 |
+ }, { |
1168 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1169 |
+ | USB_DEVICE_ID_MATCH_DEVICE, |
1170 |
+diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c |
1171 |
+index eaaa5aee58251..ab91fa5b0194d 100644 |
1172 |
+--- a/drivers/net/usb/cdc_ncm.c |
1173 |
++++ b/drivers/net/usb/cdc_ncm.c |
1174 |
+@@ -1702,10 +1702,10 @@ int cdc_ncm_rx_fixup(struct usbnet *dev, struct sk_buff *skb_in) |
1175 |
+ { |
1176 |
+ struct sk_buff *skb; |
1177 |
+ struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; |
1178 |
+- int len; |
1179 |
++ unsigned int len; |
1180 |
+ int nframes; |
1181 |
+ int x; |
1182 |
+- int offset; |
1183 |
++ unsigned int offset; |
1184 |
+ union { |
1185 |
+ struct usb_cdc_ncm_ndp16 *ndp16; |
1186 |
+ struct usb_cdc_ncm_ndp32 *ndp32; |
1187 |
+@@ -1777,8 +1777,8 @@ next_ndp: |
1188 |
+ break; |
1189 |
+ } |
1190 |
+ |
1191 |
+- /* sanity checking */ |
1192 |
+- if (((offset + len) > skb_in->len) || |
1193 |
++ /* sanity checking - watch out for integer wrap*/ |
1194 |
++ if ((offset > skb_in->len) || (len > skb_in->len - offset) || |
1195 |
+ (len > ctx->rx_max) || (len < ETH_HLEN)) { |
1196 |
+ netif_dbg(dev, rx_err, dev->net, |
1197 |
+ "invalid frame detected (ignored) offset[%u]=%u, length=%u, skb=%p\n", |
1198 |
+diff --git a/drivers/net/usb/sr9700.c b/drivers/net/usb/sr9700.c |
1199 |
+index e04c8054c2cf3..fce6713e970ba 100644 |
1200 |
+--- a/drivers/net/usb/sr9700.c |
1201 |
++++ b/drivers/net/usb/sr9700.c |
1202 |
+@@ -410,7 +410,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) |
1203 |
+ /* ignore the CRC length */ |
1204 |
+ len = (skb->data[1] | (skb->data[2] << 8)) - 4; |
1205 |
+ |
1206 |
+- if (len > ETH_FRAME_LEN) |
1207 |
++ if (len > ETH_FRAME_LEN || len > skb->len) |
1208 |
+ return 0; |
1209 |
+ |
1210 |
+ /* the last packet of current skb */ |
1211 |
+diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c |
1212 |
+index 8e717a0b559b3..7984f2157d222 100644 |
1213 |
+--- a/drivers/net/usb/zaurus.c |
1214 |
++++ b/drivers/net/usb/zaurus.c |
1215 |
+@@ -256,6 +256,11 @@ static const struct usb_device_id products [] = { |
1216 |
+ .bInterfaceSubClass = USB_CDC_SUBCLASS_ETHERNET, \ |
1217 |
+ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
1218 |
+ |
1219 |
++#define ZAURUS_FAKE_INTERFACE \ |
1220 |
++ .bInterfaceClass = USB_CLASS_COMM, \ |
1221 |
++ .bInterfaceSubClass = USB_CDC_SUBCLASS_MDLM, \ |
1222 |
++ .bInterfaceProtocol = USB_CDC_PROTO_NONE |
1223 |
++ |
1224 |
+ /* SA-1100 based Sharp Zaurus ("collie"), or compatible. */ |
1225 |
+ { |
1226 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1227 |
+@@ -313,6 +318,13 @@ static const struct usb_device_id products [] = { |
1228 |
+ .idProduct = 0x9032, /* SL-6000 */ |
1229 |
+ ZAURUS_MASTER_INTERFACE, |
1230 |
+ .driver_info = ZAURUS_PXA_INFO, |
1231 |
++}, { |
1232 |
++ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1233 |
++ | USB_DEVICE_ID_MATCH_DEVICE, |
1234 |
++ .idVendor = 0x04DD, |
1235 |
++ .idProduct = 0x9032, /* SL-6000 */ |
1236 |
++ ZAURUS_FAKE_INTERFACE, |
1237 |
++ .driver_info = (unsigned long)&bogus_mdlm_info, |
1238 |
+ }, { |
1239 |
+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO |
1240 |
+ | USB_DEVICE_ID_MATCH_DEVICE, |
1241 |
+diff --git a/drivers/platform/x86/surface3_power.c b/drivers/platform/x86/surface3_power.c |
1242 |
+index cc4f9cba68563..01aacf1bee074 100644 |
1243 |
+--- a/drivers/platform/x86/surface3_power.c |
1244 |
++++ b/drivers/platform/x86/surface3_power.c |
1245 |
+@@ -233,14 +233,21 @@ static int mshw0011_bix(struct mshw0011_data *cdata, struct bix *bix) |
1246 |
+ } |
1247 |
+ bix->last_full_charg_capacity = ret; |
1248 |
+ |
1249 |
+- /* get serial number */ |
1250 |
++ /* |
1251 |
++ * Get serial number, on some devices (with unofficial replacement |
1252 |
++ * battery?) reading any of the serial number range addresses gets |
1253 |
++ * nacked in this case just leave the serial number empty. |
1254 |
++ */ |
1255 |
+ ret = i2c_smbus_read_i2c_block_data(client, MSHW0011_BAT0_REG_SERIAL_NO, |
1256 |
+ sizeof(buf), buf); |
1257 |
+- if (ret != sizeof(buf)) { |
1258 |
++ if (ret == -EREMOTEIO) { |
1259 |
++ /* no serial number available */ |
1260 |
++ } else if (ret != sizeof(buf)) { |
1261 |
+ dev_err(&client->dev, "Error reading serial no: %d\n", ret); |
1262 |
+ return ret; |
1263 |
++ } else { |
1264 |
++ snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf); |
1265 |
+ } |
1266 |
+- snprintf(bix->serial, ARRAY_SIZE(bix->serial), "%3pE%6pE", buf + 7, buf); |
1267 |
+ |
1268 |
+ /* get cycle count */ |
1269 |
+ ret = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_CYCLE_CNT); |
1270 |
+diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c |
1271 |
+index b635835729d66..13c0b15fe1764 100644 |
1272 |
+--- a/drivers/spi/spi-zynq-qspi.c |
1273 |
++++ b/drivers/spi/spi-zynq-qspi.c |
1274 |
+@@ -570,6 +570,9 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, |
1275 |
+ |
1276 |
+ if (op->dummy.nbytes) { |
1277 |
+ tmpbuf = kzalloc(op->dummy.nbytes, GFP_KERNEL); |
1278 |
++ if (!tmpbuf) |
1279 |
++ return -ENOMEM; |
1280 |
++ |
1281 |
+ memset(tmpbuf, 0xff, op->dummy.nbytes); |
1282 |
+ reinit_completion(&xqspi->data_completion); |
1283 |
+ xqspi->txbuf = tmpbuf; |
1284 |
+diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c |
1285 |
+index f255a96ae5a48..6ea80add7378f 100644 |
1286 |
+--- a/drivers/tee/optee/core.c |
1287 |
++++ b/drivers/tee/optee/core.c |
1288 |
+@@ -588,6 +588,7 @@ static int optee_remove(struct platform_device *pdev) |
1289 |
+ /* Unregister OP-TEE specific client devices on TEE bus */ |
1290 |
+ optee_unregister_devices(); |
1291 |
+ |
1292 |
++ teedev_close_context(optee->ctx); |
1293 |
+ /* |
1294 |
+ * Ask OP-TEE to free all cached shared memory objects to decrease |
1295 |
+ * reference counters and also avoid wild pointers in secure world |
1296 |
+@@ -633,6 +634,7 @@ static int optee_probe(struct platform_device *pdev) |
1297 |
+ struct optee *optee = NULL; |
1298 |
+ void *memremaped_shm = NULL; |
1299 |
+ struct tee_device *teedev; |
1300 |
++ struct tee_context *ctx; |
1301 |
+ u32 sec_caps; |
1302 |
+ int rc; |
1303 |
+ |
1304 |
+@@ -719,6 +721,12 @@ static int optee_probe(struct platform_device *pdev) |
1305 |
+ optee_supp_init(&optee->supp); |
1306 |
+ optee->memremaped_shm = memremaped_shm; |
1307 |
+ optee->pool = pool; |
1308 |
++ ctx = teedev_open(optee->teedev); |
1309 |
++ if (IS_ERR(ctx)) { |
1310 |
++ rc = PTR_ERR(ctx); |
1311 |
++ goto err; |
1312 |
++ } |
1313 |
++ optee->ctx = ctx; |
1314 |
+ |
1315 |
+ /* |
1316 |
+ * Ensure that there are no pre-existing shm objects before enabling |
1317 |
+diff --git a/drivers/tee/optee/optee_private.h b/drivers/tee/optee/optee_private.h |
1318 |
+index f6bb4a763ba94..ea09533e30cde 100644 |
1319 |
+--- a/drivers/tee/optee/optee_private.h |
1320 |
++++ b/drivers/tee/optee/optee_private.h |
1321 |
+@@ -70,6 +70,7 @@ struct optee_supp { |
1322 |
+ * struct optee - main service struct |
1323 |
+ * @supp_teedev: supplicant device |
1324 |
+ * @teedev: client device |
1325 |
++ * @ctx: driver internal TEE context |
1326 |
+ * @invoke_fn: function to issue smc or hvc |
1327 |
+ * @call_queue: queue of threads waiting to call @invoke_fn |
1328 |
+ * @wait_queue: queue of threads from secure world waiting for a |
1329 |
+@@ -87,6 +88,7 @@ struct optee { |
1330 |
+ struct tee_device *supp_teedev; |
1331 |
+ struct tee_device *teedev; |
1332 |
+ optee_invoke_fn *invoke_fn; |
1333 |
++ struct tee_context *ctx; |
1334 |
+ struct optee_call_queue call_queue; |
1335 |
+ struct optee_wait_queue wait_queue; |
1336 |
+ struct optee_supp supp; |
1337 |
+diff --git a/drivers/tee/optee/rpc.c b/drivers/tee/optee/rpc.c |
1338 |
+index 9dbdd783d6f2d..f1e0332b0f6e8 100644 |
1339 |
+--- a/drivers/tee/optee/rpc.c |
1340 |
++++ b/drivers/tee/optee/rpc.c |
1341 |
+@@ -284,6 +284,7 @@ static struct tee_shm *cmd_alloc_suppl(struct tee_context *ctx, size_t sz) |
1342 |
+ } |
1343 |
+ |
1344 |
+ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, |
1345 |
++ struct optee *optee, |
1346 |
+ struct optee_msg_arg *arg, |
1347 |
+ struct optee_call_ctx *call_ctx) |
1348 |
+ { |
1349 |
+@@ -313,7 +314,8 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, |
1350 |
+ shm = cmd_alloc_suppl(ctx, sz); |
1351 |
+ break; |
1352 |
+ case OPTEE_MSG_RPC_SHM_TYPE_KERNEL: |
1353 |
+- shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV); |
1354 |
++ shm = tee_shm_alloc(optee->ctx, sz, |
1355 |
++ TEE_SHM_MAPPED | TEE_SHM_PRIV); |
1356 |
+ break; |
1357 |
+ default: |
1358 |
+ arg->ret = TEEC_ERROR_BAD_PARAMETERS; |
1359 |
+@@ -470,7 +472,7 @@ static void handle_rpc_func_cmd(struct tee_context *ctx, struct optee *optee, |
1360 |
+ break; |
1361 |
+ case OPTEE_MSG_RPC_CMD_SHM_ALLOC: |
1362 |
+ free_pages_list(call_ctx); |
1363 |
+- handle_rpc_func_cmd_shm_alloc(ctx, arg, call_ctx); |
1364 |
++ handle_rpc_func_cmd_shm_alloc(ctx, optee, arg, call_ctx); |
1365 |
+ break; |
1366 |
+ case OPTEE_MSG_RPC_CMD_SHM_FREE: |
1367 |
+ handle_rpc_func_cmd_shm_free(ctx, arg); |
1368 |
+@@ -501,7 +503,7 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param, |
1369 |
+ |
1370 |
+ switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { |
1371 |
+ case OPTEE_SMC_RPC_FUNC_ALLOC: |
1372 |
+- shm = tee_shm_alloc(ctx, param->a1, |
1373 |
++ shm = tee_shm_alloc(optee->ctx, param->a1, |
1374 |
+ TEE_SHM_MAPPED | TEE_SHM_PRIV); |
1375 |
+ if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { |
1376 |
+ reg_pair_from_64(¶m->a1, ¶m->a2, pa); |
1377 |
+diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c |
1378 |
+index dfc239c64ce3c..e07f997cf8dd3 100644 |
1379 |
+--- a/drivers/tee/tee_core.c |
1380 |
++++ b/drivers/tee/tee_core.c |
1381 |
+@@ -43,7 +43,7 @@ static DEFINE_SPINLOCK(driver_lock); |
1382 |
+ static struct class *tee_class; |
1383 |
+ static dev_t tee_devt; |
1384 |
+ |
1385 |
+-static struct tee_context *teedev_open(struct tee_device *teedev) |
1386 |
++struct tee_context *teedev_open(struct tee_device *teedev) |
1387 |
+ { |
1388 |
+ int rc; |
1389 |
+ struct tee_context *ctx; |
1390 |
+@@ -70,6 +70,7 @@ err: |
1391 |
+ return ERR_PTR(rc); |
1392 |
+ |
1393 |
+ } |
1394 |
++EXPORT_SYMBOL_GPL(teedev_open); |
1395 |
+ |
1396 |
+ void teedev_ctx_get(struct tee_context *ctx) |
1397 |
+ { |
1398 |
+@@ -96,13 +97,14 @@ void teedev_ctx_put(struct tee_context *ctx) |
1399 |
+ kref_put(&ctx->refcount, teedev_ctx_release); |
1400 |
+ } |
1401 |
+ |
1402 |
+-static void teedev_close_context(struct tee_context *ctx) |
1403 |
++void teedev_close_context(struct tee_context *ctx) |
1404 |
+ { |
1405 |
+ struct tee_device *teedev = ctx->teedev; |
1406 |
+ |
1407 |
+ teedev_ctx_put(ctx); |
1408 |
+ tee_device_put(teedev); |
1409 |
+ } |
1410 |
++EXPORT_SYMBOL_GPL(teedev_close_context); |
1411 |
+ |
1412 |
+ static int tee_open(struct inode *inode, struct file *filp) |
1413 |
+ { |
1414 |
+diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
1415 |
+index 0966551cbaaa0..793d7b58fc650 100644 |
1416 |
+--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
1417 |
++++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c |
1418 |
+@@ -402,6 +402,10 @@ static void int3400_notify(acpi_handle handle, |
1419 |
+ thermal_prop[3] = kasprintf(GFP_KERNEL, "EVENT=%d", therm_event); |
1420 |
+ thermal_prop[4] = NULL; |
1421 |
+ kobject_uevent_env(&priv->thermal->device.kobj, KOBJ_CHANGE, thermal_prop); |
1422 |
++ kfree(thermal_prop[0]); |
1423 |
++ kfree(thermal_prop[1]); |
1424 |
++ kfree(thermal_prop[2]); |
1425 |
++ kfree(thermal_prop[3]); |
1426 |
+ } |
1427 |
+ |
1428 |
+ static int int3400_thermal_get_temp(struct thermal_zone_device *thermal, |
1429 |
+diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c |
1430 |
+index b8f8621537720..05562b3cca451 100644 |
1431 |
+--- a/drivers/tty/n_gsm.c |
1432 |
++++ b/drivers/tty/n_gsm.c |
1433 |
+@@ -434,7 +434,7 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) |
1434 |
+ modembits |= MDM_RTR; |
1435 |
+ if (dlci->modem_tx & TIOCM_RI) |
1436 |
+ modembits |= MDM_IC; |
1437 |
+- if (dlci->modem_tx & TIOCM_CD) |
1438 |
++ if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator) |
1439 |
+ modembits |= MDM_DV; |
1440 |
+ return modembits; |
1441 |
+ } |
1442 |
+@@ -1426,6 +1426,9 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) |
1443 |
+ if (dlci->addr != 0) { |
1444 |
+ tty_port_tty_hangup(&dlci->port, false); |
1445 |
+ kfifo_reset(&dlci->fifo); |
1446 |
++ /* Ensure that gsmtty_open() can return. */ |
1447 |
++ tty_port_set_initialized(&dlci->port, 0); |
1448 |
++ wake_up_interruptible(&dlci->port.open_wait); |
1449 |
+ } else |
1450 |
+ dlci->gsm->dead = true; |
1451 |
+ wake_up(&dlci->gsm->event); |
1452 |
+@@ -1485,7 +1488,7 @@ static void gsm_dlci_t1(struct timer_list *t) |
1453 |
+ dlci->mode = DLCI_MODE_ADM; |
1454 |
+ gsm_dlci_open(dlci); |
1455 |
+ } else { |
1456 |
+- gsm_dlci_close(dlci); |
1457 |
++ gsm_dlci_begin_close(dlci); /* prevent half open link */ |
1458 |
+ } |
1459 |
+ |
1460 |
+ break; |
1461 |
+@@ -1719,7 +1722,12 @@ static void gsm_dlci_release(struct gsm_dlci *dlci) |
1462 |
+ gsm_destroy_network(dlci); |
1463 |
+ mutex_unlock(&dlci->mutex); |
1464 |
+ |
1465 |
+- tty_hangup(tty); |
1466 |
++ /* We cannot use tty_hangup() because in tty_kref_put() the tty |
1467 |
++ * driver assumes that the hangup queue is free and reuses it to |
1468 |
++ * queue release_one_tty() -> NULL pointer panic in |
1469 |
++ * process_one_work(). |
1470 |
++ */ |
1471 |
++ tty_vhangup(tty); |
1472 |
+ |
1473 |
+ tty_port_tty_set(&dlci->port, NULL); |
1474 |
+ tty_kref_put(tty); |
1475 |
+@@ -3173,9 +3181,9 @@ static void gsmtty_throttle(struct tty_struct *tty) |
1476 |
+ if (dlci->state == DLCI_CLOSED) |
1477 |
+ return; |
1478 |
+ if (C_CRTSCTS(tty)) |
1479 |
+- dlci->modem_tx &= ~TIOCM_DTR; |
1480 |
++ dlci->modem_tx &= ~TIOCM_RTS; |
1481 |
+ dlci->throttled = true; |
1482 |
+- /* Send an MSC with DTR cleared */ |
1483 |
++ /* Send an MSC with RTS cleared */ |
1484 |
+ gsmtty_modem_update(dlci, 0); |
1485 |
+ } |
1486 |
+ |
1487 |
+@@ -3185,9 +3193,9 @@ static void gsmtty_unthrottle(struct tty_struct *tty) |
1488 |
+ if (dlci->state == DLCI_CLOSED) |
1489 |
+ return; |
1490 |
+ if (C_CRTSCTS(tty)) |
1491 |
+- dlci->modem_tx |= TIOCM_DTR; |
1492 |
++ dlci->modem_tx |= TIOCM_RTS; |
1493 |
+ dlci->throttled = false; |
1494 |
+- /* Send an MSC with DTR set */ |
1495 |
++ /* Send an MSC with RTS set */ |
1496 |
+ gsmtty_modem_update(dlci, 0); |
1497 |
+ } |
1498 |
+ |
1499 |
+diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c |
1500 |
+index 9adb8362578c5..04b4ed5d06341 100644 |
1501 |
+--- a/drivers/tty/serial/sc16is7xx.c |
1502 |
++++ b/drivers/tty/serial/sc16is7xx.c |
1503 |
+@@ -734,12 +734,15 @@ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) |
1504 |
+ static void sc16is7xx_tx_proc(struct kthread_work *ws) |
1505 |
+ { |
1506 |
+ struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port); |
1507 |
++ struct sc16is7xx_port *s = dev_get_drvdata(port->dev); |
1508 |
+ |
1509 |
+ if ((port->rs485.flags & SER_RS485_ENABLED) && |
1510 |
+ (port->rs485.delay_rts_before_send > 0)) |
1511 |
+ msleep(port->rs485.delay_rts_before_send); |
1512 |
+ |
1513 |
++ mutex_lock(&s->efr_lock); |
1514 |
+ sc16is7xx_handle_tx(port); |
1515 |
++ mutex_unlock(&s->efr_lock); |
1516 |
+ } |
1517 |
+ |
1518 |
+ static void sc16is7xx_reconf_rs485(struct uart_port *port) |
1519 |
+diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h |
1520 |
+index 641e4251cb7f1..03d16a08261d8 100644 |
1521 |
+--- a/drivers/usb/dwc2/core.h |
1522 |
++++ b/drivers/usb/dwc2/core.h |
1523 |
+@@ -1406,6 +1406,7 @@ void dwc2_hsotg_core_connect(struct dwc2_hsotg *hsotg); |
1524 |
+ void dwc2_hsotg_disconnect(struct dwc2_hsotg *dwc2); |
1525 |
+ int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode); |
1526 |
+ #define dwc2_is_device_connected(hsotg) (hsotg->connected) |
1527 |
++#define dwc2_is_device_enabled(hsotg) (hsotg->enabled) |
1528 |
+ int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg); |
1529 |
+ int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, int remote_wakeup); |
1530 |
+ int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg); |
1531 |
+@@ -1434,6 +1435,7 @@ static inline int dwc2_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, |
1532 |
+ int testmode) |
1533 |
+ { return 0; } |
1534 |
+ #define dwc2_is_device_connected(hsotg) (0) |
1535 |
++#define dwc2_is_device_enabled(hsotg) (0) |
1536 |
+ static inline int dwc2_backup_device_registers(struct dwc2_hsotg *hsotg) |
1537 |
+ { return 0; } |
1538 |
+ static inline int dwc2_restore_device_registers(struct dwc2_hsotg *hsotg, |
1539 |
+diff --git a/drivers/usb/dwc2/drd.c b/drivers/usb/dwc2/drd.c |
1540 |
+index aa6eb76f64ddc..36f2c38416e5e 100644 |
1541 |
+--- a/drivers/usb/dwc2/drd.c |
1542 |
++++ b/drivers/usb/dwc2/drd.c |
1543 |
+@@ -109,8 +109,10 @@ static int dwc2_drd_role_sw_set(struct usb_role_switch *sw, enum usb_role role) |
1544 |
+ already = dwc2_ovr_avalid(hsotg, true); |
1545 |
+ } else if (role == USB_ROLE_DEVICE) { |
1546 |
+ already = dwc2_ovr_bvalid(hsotg, true); |
1547 |
+- /* This clear DCTL.SFTDISCON bit */ |
1548 |
+- dwc2_hsotg_core_connect(hsotg); |
1549 |
++ if (dwc2_is_device_enabled(hsotg)) { |
1550 |
++ /* This clear DCTL.SFTDISCON bit */ |
1551 |
++ dwc2_hsotg_core_connect(hsotg); |
1552 |
++ } |
1553 |
+ } else { |
1554 |
+ if (dwc2_is_device_mode(hsotg)) { |
1555 |
+ if (!dwc2_ovr_bvalid(hsotg, false)) |
1556 |
+diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c |
1557 |
+index 17117870f6cea..98df8d52c765c 100644 |
1558 |
+--- a/drivers/usb/dwc3/dwc3-pci.c |
1559 |
++++ b/drivers/usb/dwc3/dwc3-pci.c |
1560 |
+@@ -81,8 +81,8 @@ static const struct acpi_gpio_mapping acpi_dwc3_byt_gpios[] = { |
1561 |
+ static struct gpiod_lookup_table platform_bytcr_gpios = { |
1562 |
+ .dev_id = "0000:00:16.0", |
1563 |
+ .table = { |
1564 |
+- GPIO_LOOKUP("INT33FC:00", 54, "reset", GPIO_ACTIVE_HIGH), |
1565 |
+- GPIO_LOOKUP("INT33FC:02", 14, "cs", GPIO_ACTIVE_HIGH), |
1566 |
++ GPIO_LOOKUP("INT33FC:00", 54, "cs", GPIO_ACTIVE_HIGH), |
1567 |
++ GPIO_LOOKUP("INT33FC:02", 14, "reset", GPIO_ACTIVE_HIGH), |
1568 |
+ {} |
1569 |
+ }, |
1570 |
+ }; |
1571 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
1572 |
+index 9095ce52c28c6..b68fe48ac5792 100644 |
1573 |
+--- a/drivers/usb/dwc3/gadget.c |
1574 |
++++ b/drivers/usb/dwc3/gadget.c |
1575 |
+@@ -3775,9 +3775,11 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) |
1576 |
+ unsigned long flags; |
1577 |
+ irqreturn_t ret = IRQ_NONE; |
1578 |
+ |
1579 |
++ local_bh_disable(); |
1580 |
+ spin_lock_irqsave(&dwc->lock, flags); |
1581 |
+ ret = dwc3_process_event_buf(evt); |
1582 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
1583 |
++ local_bh_enable(); |
1584 |
+ |
1585 |
+ return ret; |
1586 |
+ } |
1587 |
+diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c |
1588 |
+index d9ed651f06ac3..0f14c5291af07 100644 |
1589 |
+--- a/drivers/usb/gadget/function/rndis.c |
1590 |
++++ b/drivers/usb/gadget/function/rndis.c |
1591 |
+@@ -922,6 +922,7 @@ struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) |
1592 |
+ params->resp_avail = resp_avail; |
1593 |
+ params->v = v; |
1594 |
+ INIT_LIST_HEAD(¶ms->resp_queue); |
1595 |
++ spin_lock_init(¶ms->resp_lock); |
1596 |
+ pr_debug("%s: configNr = %d\n", __func__, i); |
1597 |
+ |
1598 |
+ return params; |
1599 |
+@@ -1015,12 +1016,14 @@ void rndis_free_response(struct rndis_params *params, u8 *buf) |
1600 |
+ { |
1601 |
+ rndis_resp_t *r, *n; |
1602 |
+ |
1603 |
++ spin_lock(¶ms->resp_lock); |
1604 |
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
1605 |
+ if (r->buf == buf) { |
1606 |
+ list_del(&r->list); |
1607 |
+ kfree(r); |
1608 |
+ } |
1609 |
+ } |
1610 |
++ spin_unlock(¶ms->resp_lock); |
1611 |
+ } |
1612 |
+ EXPORT_SYMBOL_GPL(rndis_free_response); |
1613 |
+ |
1614 |
+@@ -1030,14 +1033,17 @@ u8 *rndis_get_next_response(struct rndis_params *params, u32 *length) |
1615 |
+ |
1616 |
+ if (!length) return NULL; |
1617 |
+ |
1618 |
++ spin_lock(¶ms->resp_lock); |
1619 |
+ list_for_each_entry_safe(r, n, ¶ms->resp_queue, list) { |
1620 |
+ if (!r->send) { |
1621 |
+ r->send = 1; |
1622 |
+ *length = r->length; |
1623 |
++ spin_unlock(¶ms->resp_lock); |
1624 |
+ return r->buf; |
1625 |
+ } |
1626 |
+ } |
1627 |
+ |
1628 |
++ spin_unlock(¶ms->resp_lock); |
1629 |
+ return NULL; |
1630 |
+ } |
1631 |
+ EXPORT_SYMBOL_GPL(rndis_get_next_response); |
1632 |
+@@ -1054,7 +1060,9 @@ static rndis_resp_t *rndis_add_response(struct rndis_params *params, u32 length) |
1633 |
+ r->length = length; |
1634 |
+ r->send = 0; |
1635 |
+ |
1636 |
++ spin_lock(¶ms->resp_lock); |
1637 |
+ list_add_tail(&r->list, ¶ms->resp_queue); |
1638 |
++ spin_unlock(¶ms->resp_lock); |
1639 |
+ return r; |
1640 |
+ } |
1641 |
+ |
1642 |
+diff --git a/drivers/usb/gadget/function/rndis.h b/drivers/usb/gadget/function/rndis.h |
1643 |
+index f6167f7fea82b..6206b8b7490f6 100644 |
1644 |
+--- a/drivers/usb/gadget/function/rndis.h |
1645 |
++++ b/drivers/usb/gadget/function/rndis.h |
1646 |
+@@ -174,6 +174,7 @@ typedef struct rndis_params { |
1647 |
+ void (*resp_avail)(void *v); |
1648 |
+ void *v; |
1649 |
+ struct list_head resp_queue; |
1650 |
++ spinlock_t resp_lock; |
1651 |
+ } rndis_params; |
1652 |
+ |
1653 |
+ /* RNDIS Message parser and other useless functions */ |
1654 |
+diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c |
1655 |
+index d5e9d20c097d2..096f56a09e6a2 100644 |
1656 |
+--- a/drivers/usb/gadget/udc/udc-xilinx.c |
1657 |
++++ b/drivers/usb/gadget/udc/udc-xilinx.c |
1658 |
+@@ -1612,6 +1612,8 @@ static void xudc_getstatus(struct xusb_udc *udc) |
1659 |
+ break; |
1660 |
+ case USB_RECIP_ENDPOINT: |
1661 |
+ epnum = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
1662 |
++ if (epnum >= XUSB_MAX_ENDPOINTS) |
1663 |
++ goto stall; |
1664 |
+ target_ep = &udc->ep[epnum]; |
1665 |
+ epcfgreg = udc->read_fn(udc->addr + target_ep->offset); |
1666 |
+ halt = epcfgreg & XUSB_EP_CFG_STALL_MASK; |
1667 |
+@@ -1679,6 +1681,10 @@ static void xudc_set_clear_feature(struct xusb_udc *udc) |
1668 |
+ case USB_RECIP_ENDPOINT: |
1669 |
+ if (!udc->setup.wValue) { |
1670 |
+ endpoint = udc->setup.wIndex & USB_ENDPOINT_NUMBER_MASK; |
1671 |
++ if (endpoint >= XUSB_MAX_ENDPOINTS) { |
1672 |
++ xudc_ep0_stall(udc); |
1673 |
++ return; |
1674 |
++ } |
1675 |
+ target_ep = &udc->ep[endpoint]; |
1676 |
+ outinbit = udc->setup.wIndex & USB_ENDPOINT_DIR_MASK; |
1677 |
+ outinbit = outinbit >> 7; |
1678 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
1679 |
+index 325eb1609f8c5..49f74299d3f57 100644 |
1680 |
+--- a/drivers/usb/host/xhci.c |
1681 |
++++ b/drivers/usb/host/xhci.c |
1682 |
+@@ -1091,6 +1091,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1683 |
+ int retval = 0; |
1684 |
+ bool comp_timer_running = false; |
1685 |
+ bool pending_portevent = false; |
1686 |
++ bool reinit_xhc = false; |
1687 |
+ |
1688 |
+ if (!hcd->state) |
1689 |
+ return 0; |
1690 |
+@@ -1107,10 +1108,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1691 |
+ set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); |
1692 |
+ |
1693 |
+ spin_lock_irq(&xhci->lock); |
1694 |
+- if ((xhci->quirks & XHCI_RESET_ON_RESUME) || xhci->broken_suspend) |
1695 |
+- hibernated = true; |
1696 |
+ |
1697 |
+- if (!hibernated) { |
1698 |
++ if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend) |
1699 |
++ reinit_xhc = true; |
1700 |
++ |
1701 |
++ if (!reinit_xhc) { |
1702 |
+ /* |
1703 |
+ * Some controllers might lose power during suspend, so wait |
1704 |
+ * for controller not ready bit to clear, just as in xHC init. |
1705 |
+@@ -1143,12 +1145,17 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) |
1706 |
+ spin_unlock_irq(&xhci->lock); |
1707 |
+ return -ETIMEDOUT; |
1708 |
+ } |
1709 |
+- temp = readl(&xhci->op_regs->status); |
1710 |
+ } |
1711 |
+ |
1712 |
+- /* If restore operation fails, re-initialize the HC during resume */ |
1713 |
+- if ((temp & STS_SRE) || hibernated) { |
1714 |
++ temp = readl(&xhci->op_regs->status); |
1715 |
+ |
1716 |
++ /* re-initialize the HC on Restore Error, or Host Controller Error */ |
1717 |
++ if (temp & (STS_SRE | STS_HCE)) { |
1718 |
++ reinit_xhc = true; |
1719 |
++ xhci_warn(xhci, "xHC error in resume, USBSTS 0x%x, Reinit\n", temp); |
1720 |
++ } |
1721 |
++ |
1722 |
++ if (reinit_xhc) { |
1723 |
+ if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && |
1724 |
+ !(xhci_all_ports_seen_u0(xhci))) { |
1725 |
+ del_timer_sync(&xhci->comp_mode_recovery_timer); |
1726 |
+@@ -1480,9 +1487,12 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag |
1727 |
+ struct urb_priv *urb_priv; |
1728 |
+ int num_tds; |
1729 |
+ |
1730 |
+- if (!urb || xhci_check_args(hcd, urb->dev, urb->ep, |
1731 |
+- true, true, __func__) <= 0) |
1732 |
++ if (!urb) |
1733 |
+ return -EINVAL; |
1734 |
++ ret = xhci_check_args(hcd, urb->dev, urb->ep, |
1735 |
++ true, true, __func__); |
1736 |
++ if (ret <= 0) |
1737 |
++ return ret ? ret : -EINVAL; |
1738 |
+ |
1739 |
+ slot_id = urb->dev->slot_id; |
1740 |
+ ep_index = xhci_get_endpoint_index(&urb->ep->desc); |
1741 |
+@@ -3282,7 +3292,7 @@ static int xhci_check_streams_endpoint(struct xhci_hcd *xhci, |
1742 |
+ return -EINVAL; |
1743 |
+ ret = xhci_check_args(xhci_to_hcd(xhci), udev, ep, 1, true, __func__); |
1744 |
+ if (ret <= 0) |
1745 |
+- return -EINVAL; |
1746 |
++ return ret ? ret : -EINVAL; |
1747 |
+ if (usb_ss_max_streams(&ep->ss_ep_comp) == 0) { |
1748 |
+ xhci_warn(xhci, "WARN: SuperSpeed Endpoint Companion" |
1749 |
+ " descriptor for ep 0x%x does not support streams\n", |
1750 |
+diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c |
1751 |
+index 8716ada0b1387..a2a38fc76ca53 100644 |
1752 |
+--- a/drivers/usb/serial/ch341.c |
1753 |
++++ b/drivers/usb/serial/ch341.c |
1754 |
+@@ -81,7 +81,6 @@ |
1755 |
+ #define CH341_QUIRK_SIMULATE_BREAK BIT(1) |
1756 |
+ |
1757 |
+ static const struct usb_device_id id_table[] = { |
1758 |
+- { USB_DEVICE(0x1a86, 0x5512) }, |
1759 |
+ { USB_DEVICE(0x1a86, 0x5523) }, |
1760 |
+ { USB_DEVICE(0x1a86, 0x7522) }, |
1761 |
+ { USB_DEVICE(0x1a86, 0x7523) }, |
1762 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
1763 |
+index c39c505b081b1..b878f4c87fee8 100644 |
1764 |
+--- a/drivers/usb/serial/option.c |
1765 |
++++ b/drivers/usb/serial/option.c |
1766 |
+@@ -198,6 +198,8 @@ static void option_instat_callback(struct urb *urb); |
1767 |
+ |
1768 |
+ #define DELL_PRODUCT_5821E 0x81d7 |
1769 |
+ #define DELL_PRODUCT_5821E_ESIM 0x81e0 |
1770 |
++#define DELL_PRODUCT_5829E_ESIM 0x81e4 |
1771 |
++#define DELL_PRODUCT_5829E 0x81e6 |
1772 |
+ |
1773 |
+ #define KYOCERA_VENDOR_ID 0x0c88 |
1774 |
+ #define KYOCERA_PRODUCT_KPC650 0x17da |
1775 |
+@@ -1063,6 +1065,10 @@ static const struct usb_device_id option_ids[] = { |
1776 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
1777 |
+ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5821E_ESIM), |
1778 |
+ .driver_info = RSVD(0) | RSVD(1) | RSVD(6) }, |
1779 |
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E), |
1780 |
++ .driver_info = RSVD(0) | RSVD(6) }, |
1781 |
++ { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5829E_ESIM), |
1782 |
++ .driver_info = RSVD(0) | RSVD(6) }, |
1783 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */ |
1784 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, |
1785 |
+ { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, |
1786 |
+@@ -1273,10 +1279,16 @@ static const struct usb_device_id option_ids[] = { |
1787 |
+ .driver_info = NCTRL(2) }, |
1788 |
+ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x7011, 0xff), /* Telit LE910-S1 (ECM) */ |
1789 |
+ .driver_info = NCTRL(2) }, |
1790 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701a, 0xff), /* Telit LE910R1 (RNDIS) */ |
1791 |
++ .driver_info = NCTRL(2) }, |
1792 |
++ { USB_DEVICE_INTERFACE_CLASS(TELIT_VENDOR_ID, 0x701b, 0xff), /* Telit LE910R1 (ECM) */ |
1793 |
++ .driver_info = NCTRL(2) }, |
1794 |
+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9010), /* Telit SBL FN980 flashing device */ |
1795 |
+ .driver_info = NCTRL(0) | ZLP }, |
1796 |
+ { USB_DEVICE(TELIT_VENDOR_ID, 0x9200), /* Telit LE910S1 flashing device */ |
1797 |
+ .driver_info = NCTRL(0) | ZLP }, |
1798 |
++ { USB_DEVICE(TELIT_VENDOR_ID, 0x9201), /* Telit LE910R1 flashing device */ |
1799 |
++ .driver_info = NCTRL(0) | ZLP }, |
1800 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
1801 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
1802 |
+ .driver_info = RSVD(1) }, |
1803 |
+diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c |
1804 |
+index 5cd1ee66d2326..c282fc0d04bd1 100644 |
1805 |
+--- a/drivers/vhost/vsock.c |
1806 |
++++ b/drivers/vhost/vsock.c |
1807 |
+@@ -573,16 +573,18 @@ err: |
1808 |
+ return ret; |
1809 |
+ } |
1810 |
+ |
1811 |
+-static int vhost_vsock_stop(struct vhost_vsock *vsock) |
1812 |
++static int vhost_vsock_stop(struct vhost_vsock *vsock, bool check_owner) |
1813 |
+ { |
1814 |
+ size_t i; |
1815 |
+- int ret; |
1816 |
++ int ret = 0; |
1817 |
+ |
1818 |
+ mutex_lock(&vsock->dev.mutex); |
1819 |
+ |
1820 |
+- ret = vhost_dev_check_owner(&vsock->dev); |
1821 |
+- if (ret) |
1822 |
+- goto err; |
1823 |
++ if (check_owner) { |
1824 |
++ ret = vhost_dev_check_owner(&vsock->dev); |
1825 |
++ if (ret) |
1826 |
++ goto err; |
1827 |
++ } |
1828 |
+ |
1829 |
+ for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) { |
1830 |
+ struct vhost_virtqueue *vq = &vsock->vqs[i]; |
1831 |
+@@ -697,7 +699,12 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file) |
1832 |
+ * inefficient. Room for improvement here. */ |
1833 |
+ vsock_for_each_connected_socket(vhost_vsock_reset_orphans); |
1834 |
+ |
1835 |
+- vhost_vsock_stop(vsock); |
1836 |
++ /* Don't check the owner, because we are in the release path, so we |
1837 |
++ * need to stop the vsock device in any case. |
1838 |
++ * vhost_vsock_stop() can not fail in this case, so we don't need to |
1839 |
++ * check the return code. |
1840 |
++ */ |
1841 |
++ vhost_vsock_stop(vsock, false); |
1842 |
+ vhost_vsock_flush(vsock); |
1843 |
+ vhost_dev_stop(&vsock->dev); |
1844 |
+ |
1845 |
+@@ -801,7 +808,7 @@ static long vhost_vsock_dev_ioctl(struct file *f, unsigned int ioctl, |
1846 |
+ if (start) |
1847 |
+ return vhost_vsock_start(vsock); |
1848 |
+ else |
1849 |
+- return vhost_vsock_stop(vsock); |
1850 |
++ return vhost_vsock_stop(vsock, true); |
1851 |
+ case VHOST_GET_FEATURES: |
1852 |
+ features = VHOST_VSOCK_FEATURES; |
1853 |
+ if (copy_to_user(argp, &features, sizeof(features))) |
1854 |
+diff --git a/fs/btrfs/tree-checker.c b/fs/btrfs/tree-checker.c |
1855 |
+index d4a3a56726aa8..32f1b15b25dcc 100644 |
1856 |
+--- a/fs/btrfs/tree-checker.c |
1857 |
++++ b/fs/btrfs/tree-checker.c |
1858 |
+@@ -947,6 +947,7 @@ static int check_dev_item(struct extent_buffer *leaf, |
1859 |
+ struct btrfs_key *key, int slot) |
1860 |
+ { |
1861 |
+ struct btrfs_dev_item *ditem; |
1862 |
++ const u32 item_size = btrfs_item_size_nr(leaf, slot); |
1863 |
+ |
1864 |
+ if (key->objectid != BTRFS_DEV_ITEMS_OBJECTID) { |
1865 |
+ dev_item_err(leaf, slot, |
1866 |
+@@ -954,6 +955,13 @@ static int check_dev_item(struct extent_buffer *leaf, |
1867 |
+ key->objectid, BTRFS_DEV_ITEMS_OBJECTID); |
1868 |
+ return -EUCLEAN; |
1869 |
+ } |
1870 |
++ |
1871 |
++ if (unlikely(item_size != sizeof(*ditem))) { |
1872 |
++ dev_item_err(leaf, slot, "invalid item size: has %u expect %zu", |
1873 |
++ item_size, sizeof(*ditem)); |
1874 |
++ return -EUCLEAN; |
1875 |
++ } |
1876 |
++ |
1877 |
+ ditem = btrfs_item_ptr(leaf, slot, struct btrfs_dev_item); |
1878 |
+ if (btrfs_device_id(leaf, ditem) != key->offset) { |
1879 |
+ dev_item_err(leaf, slot, |
1880 |
+@@ -989,6 +997,7 @@ static int check_inode_item(struct extent_buffer *leaf, |
1881 |
+ struct btrfs_inode_item *iitem; |
1882 |
+ u64 super_gen = btrfs_super_generation(fs_info->super_copy); |
1883 |
+ u32 valid_mask = (S_IFMT | S_ISUID | S_ISGID | S_ISVTX | 0777); |
1884 |
++ const u32 item_size = btrfs_item_size_nr(leaf, slot); |
1885 |
+ u32 mode; |
1886 |
+ int ret; |
1887 |
+ |
1888 |
+@@ -996,6 +1005,12 @@ static int check_inode_item(struct extent_buffer *leaf, |
1889 |
+ if (ret < 0) |
1890 |
+ return ret; |
1891 |
+ |
1892 |
++ if (unlikely(item_size != sizeof(*iitem))) { |
1893 |
++ generic_err(leaf, slot, "invalid item size: has %u expect %zu", |
1894 |
++ item_size, sizeof(*iitem)); |
1895 |
++ return -EUCLEAN; |
1896 |
++ } |
1897 |
++ |
1898 |
+ iitem = btrfs_item_ptr(leaf, slot, struct btrfs_inode_item); |
1899 |
+ |
1900 |
+ /* Here we use super block generation + 1 to handle log tree */ |
1901 |
+diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c |
1902 |
+index 32ddad3ec5d53..5ad27e484014f 100644 |
1903 |
+--- a/fs/configfs/dir.c |
1904 |
++++ b/fs/configfs/dir.c |
1905 |
+@@ -36,6 +36,14 @@ |
1906 |
+ */ |
1907 |
+ DEFINE_SPINLOCK(configfs_dirent_lock); |
1908 |
+ |
1909 |
++/* |
1910 |
++ * All of link_obj/unlink_obj/link_group/unlink_group require that |
1911 |
++ * subsys->su_mutex is held. |
1912 |
++ * But parent configfs_subsystem is NULL when config_item is root. |
1913 |
++ * Use this mutex when config_item is root. |
1914 |
++ */ |
1915 |
++static DEFINE_MUTEX(configfs_subsystem_mutex); |
1916 |
++ |
1917 |
+ static void configfs_d_iput(struct dentry * dentry, |
1918 |
+ struct inode * inode) |
1919 |
+ { |
1920 |
+@@ -1884,7 +1892,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) |
1921 |
+ group->cg_item.ci_name = group->cg_item.ci_namebuf; |
1922 |
+ |
1923 |
+ sd = root->d_fsdata; |
1924 |
++ mutex_lock(&configfs_subsystem_mutex); |
1925 |
+ link_group(to_config_group(sd->s_element), group); |
1926 |
++ mutex_unlock(&configfs_subsystem_mutex); |
1927 |
+ |
1928 |
+ inode_lock_nested(d_inode(root), I_MUTEX_PARENT); |
1929 |
+ |
1930 |
+@@ -1909,7 +1919,9 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) |
1931 |
+ inode_unlock(d_inode(root)); |
1932 |
+ |
1933 |
+ if (err) { |
1934 |
++ mutex_lock(&configfs_subsystem_mutex); |
1935 |
+ unlink_group(group); |
1936 |
++ mutex_unlock(&configfs_subsystem_mutex); |
1937 |
+ configfs_release_fs(); |
1938 |
+ } |
1939 |
+ put_fragment(frag); |
1940 |
+@@ -1956,7 +1968,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) |
1941 |
+ |
1942 |
+ dput(dentry); |
1943 |
+ |
1944 |
++ mutex_lock(&configfs_subsystem_mutex); |
1945 |
+ unlink_group(group); |
1946 |
++ mutex_unlock(&configfs_subsystem_mutex); |
1947 |
+ configfs_release_fs(); |
1948 |
+ } |
1949 |
+ |
1950 |
+diff --git a/fs/io_uring.c b/fs/io_uring.c |
1951 |
+index 104dff9c71314..019cbde8c3d67 100644 |
1952 |
+--- a/fs/io_uring.c |
1953 |
++++ b/fs/io_uring.c |
1954 |
+@@ -4058,6 +4058,7 @@ static int io_add_buffers(struct io_provide_buf *pbuf, struct io_buffer **head) |
1955 |
+ } else { |
1956 |
+ list_add_tail(&buf->list, &(*head)->list); |
1957 |
+ } |
1958 |
++ cond_resched(); |
1959 |
+ } |
1960 |
+ |
1961 |
+ return i ? i : -ENOMEM; |
1962 |
+diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c |
1963 |
+index ade05887070dd..8b7315c22f0d1 100644 |
1964 |
+--- a/fs/tracefs/inode.c |
1965 |
++++ b/fs/tracefs/inode.c |
1966 |
+@@ -262,7 +262,6 @@ static int tracefs_parse_options(char *data, struct tracefs_mount_opts *opts) |
1967 |
+ if (!gid_valid(gid)) |
1968 |
+ return -EINVAL; |
1969 |
+ opts->gid = gid; |
1970 |
+- set_gid(tracefs_mount->mnt_root, gid); |
1971 |
+ break; |
1972 |
+ case Opt_mode: |
1973 |
+ if (match_octal(&args[0], &option)) |
1974 |
+@@ -289,7 +288,9 @@ static int tracefs_apply_options(struct super_block *sb) |
1975 |
+ inode->i_mode |= opts->mode; |
1976 |
+ |
1977 |
+ inode->i_uid = opts->uid; |
1978 |
+- inode->i_gid = opts->gid; |
1979 |
++ |
1980 |
++ /* Set all the group ids to the mount option */ |
1981 |
++ set_gid(sb->s_root, opts->gid); |
1982 |
+ |
1983 |
+ return 0; |
1984 |
+ } |
1985 |
+diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h |
1986 |
+index 0c6c1de6f3b77..18a9949bba187 100644 |
1987 |
+--- a/include/linux/tee_drv.h |
1988 |
++++ b/include/linux/tee_drv.h |
1989 |
+@@ -582,4 +582,18 @@ struct tee_client_driver { |
1990 |
+ #define to_tee_client_driver(d) \ |
1991 |
+ container_of(d, struct tee_client_driver, driver) |
1992 |
+ |
1993 |
++/** |
1994 |
++ * teedev_open() - Open a struct tee_device |
1995 |
++ * @teedev: Device to open |
1996 |
++ * |
1997 |
++ * @return a pointer to struct tee_context on success or an ERR_PTR on failure. |
1998 |
++ */ |
1999 |
++struct tee_context *teedev_open(struct tee_device *teedev); |
2000 |
++ |
2001 |
++/** |
2002 |
++ * teedev_close_context() - closes a struct tee_context |
2003 |
++ * @ctx: The struct tee_context to close |
2004 |
++ */ |
2005 |
++void teedev_close_context(struct tee_context *ctx); |
2006 |
++ |
2007 |
+ #endif /*__TEE_DRV_H*/ |
2008 |
+diff --git a/include/net/checksum.h b/include/net/checksum.h |
2009 |
+index 0d05b9e8690b8..8b7d0c31598f5 100644 |
2010 |
+--- a/include/net/checksum.h |
2011 |
++++ b/include/net/checksum.h |
2012 |
+@@ -22,7 +22,7 @@ |
2013 |
+ #include <asm/checksum.h> |
2014 |
+ |
2015 |
+ #ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER |
2016 |
+-static inline |
2017 |
++static __always_inline |
2018 |
+ __wsum csum_and_copy_from_user (const void __user *src, void *dst, |
2019 |
+ int len) |
2020 |
+ { |
2021 |
+@@ -33,7 +33,7 @@ __wsum csum_and_copy_from_user (const void __user *src, void *dst, |
2022 |
+ #endif |
2023 |
+ |
2024 |
+ #ifndef HAVE_CSUM_COPY_USER |
2025 |
+-static __inline__ __wsum csum_and_copy_to_user |
2026 |
++static __always_inline __wsum csum_and_copy_to_user |
2027 |
+ (const void *src, void __user *dst, int len) |
2028 |
+ { |
2029 |
+ __wsum sum = csum_partial(src, len, ~0U); |
2030 |
+@@ -45,7 +45,7 @@ static __inline__ __wsum csum_and_copy_to_user |
2031 |
+ #endif |
2032 |
+ |
2033 |
+ #ifndef _HAVE_ARCH_CSUM_AND_COPY |
2034 |
+-static inline __wsum |
2035 |
++static __always_inline __wsum |
2036 |
+ csum_partial_copy_nocheck(const void *src, void *dst, int len) |
2037 |
+ { |
2038 |
+ memcpy(dst, src, len); |
2039 |
+@@ -54,7 +54,7 @@ csum_partial_copy_nocheck(const void *src, void *dst, int len) |
2040 |
+ #endif |
2041 |
+ |
2042 |
+ #ifndef HAVE_ARCH_CSUM_ADD |
2043 |
+-static inline __wsum csum_add(__wsum csum, __wsum addend) |
2044 |
++static __always_inline __wsum csum_add(__wsum csum, __wsum addend) |
2045 |
+ { |
2046 |
+ u32 res = (__force u32)csum; |
2047 |
+ res += (__force u32)addend; |
2048 |
+@@ -62,12 +62,12 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) |
2049 |
+ } |
2050 |
+ #endif |
2051 |
+ |
2052 |
+-static inline __wsum csum_sub(__wsum csum, __wsum addend) |
2053 |
++static __always_inline __wsum csum_sub(__wsum csum, __wsum addend) |
2054 |
+ { |
2055 |
+ return csum_add(csum, ~addend); |
2056 |
+ } |
2057 |
+ |
2058 |
+-static inline __sum16 csum16_add(__sum16 csum, __be16 addend) |
2059 |
++static __always_inline __sum16 csum16_add(__sum16 csum, __be16 addend) |
2060 |
+ { |
2061 |
+ u16 res = (__force u16)csum; |
2062 |
+ |
2063 |
+@@ -75,12 +75,12 @@ static inline __sum16 csum16_add(__sum16 csum, __be16 addend) |
2064 |
+ return (__force __sum16)(res + (res < (__force u16)addend)); |
2065 |
+ } |
2066 |
+ |
2067 |
+-static inline __sum16 csum16_sub(__sum16 csum, __be16 addend) |
2068 |
++static __always_inline __sum16 csum16_sub(__sum16 csum, __be16 addend) |
2069 |
+ { |
2070 |
+ return csum16_add(csum, ~addend); |
2071 |
+ } |
2072 |
+ |
2073 |
+-static inline __wsum |
2074 |
++static __always_inline __wsum |
2075 |
+ csum_block_add(__wsum csum, __wsum csum2, int offset) |
2076 |
+ { |
2077 |
+ u32 sum = (__force u32)csum2; |
2078 |
+@@ -92,36 +92,37 @@ csum_block_add(__wsum csum, __wsum csum2, int offset) |
2079 |
+ return csum_add(csum, (__force __wsum)sum); |
2080 |
+ } |
2081 |
+ |
2082 |
+-static inline __wsum |
2083 |
++static __always_inline __wsum |
2084 |
+ csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len) |
2085 |
+ { |
2086 |
+ return csum_block_add(csum, csum2, offset); |
2087 |
+ } |
2088 |
+ |
2089 |
+-static inline __wsum |
2090 |
++static __always_inline __wsum |
2091 |
+ csum_block_sub(__wsum csum, __wsum csum2, int offset) |
2092 |
+ { |
2093 |
+ return csum_block_add(csum, ~csum2, offset); |
2094 |
+ } |
2095 |
+ |
2096 |
+-static inline __wsum csum_unfold(__sum16 n) |
2097 |
++static __always_inline __wsum csum_unfold(__sum16 n) |
2098 |
+ { |
2099 |
+ return (__force __wsum)n; |
2100 |
+ } |
2101 |
+ |
2102 |
+-static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum) |
2103 |
++static __always_inline |
2104 |
++__wsum csum_partial_ext(const void *buff, int len, __wsum sum) |
2105 |
+ { |
2106 |
+ return csum_partial(buff, len, sum); |
2107 |
+ } |
2108 |
+ |
2109 |
+ #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
2110 |
+ |
2111 |
+-static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff) |
2112 |
++static __always_inline void csum_replace_by_diff(__sum16 *sum, __wsum diff) |
2113 |
+ { |
2114 |
+ *sum = csum_fold(csum_add(diff, ~csum_unfold(*sum))); |
2115 |
+ } |
2116 |
+ |
2117 |
+-static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
2118 |
++static __always_inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
2119 |
+ { |
2120 |
+ __wsum tmp = csum_sub(~csum_unfold(*sum), (__force __wsum)from); |
2121 |
+ |
2122 |
+@@ -134,11 +135,16 @@ static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
2123 |
+ * m : old value of a 16bit field |
2124 |
+ * m' : new value of a 16bit field |
2125 |
+ */ |
2126 |
+-static inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new) |
2127 |
++static __always_inline void csum_replace2(__sum16 *sum, __be16 old, __be16 new) |
2128 |
+ { |
2129 |
+ *sum = ~csum16_add(csum16_sub(~(*sum), old), new); |
2130 |
+ } |
2131 |
+ |
2132 |
++static inline void csum_replace(__wsum *csum, __wsum old, __wsum new) |
2133 |
++{ |
2134 |
++ *csum = csum_add(csum_sub(*csum, old), new); |
2135 |
++} |
2136 |
++ |
2137 |
+ struct sk_buff; |
2138 |
+ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, |
2139 |
+ __be32 from, __be32 to, bool pseudohdr); |
2140 |
+@@ -148,16 +154,16 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb, |
2141 |
+ void inet_proto_csum_replace_by_diff(__sum16 *sum, struct sk_buff *skb, |
2142 |
+ __wsum diff, bool pseudohdr); |
2143 |
+ |
2144 |
+-static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, |
2145 |
+- __be16 from, __be16 to, |
2146 |
+- bool pseudohdr) |
2147 |
++static __always_inline |
2148 |
++void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, |
2149 |
++ __be16 from, __be16 to, bool pseudohdr) |
2150 |
+ { |
2151 |
+ inet_proto_csum_replace4(sum, skb, (__force __be32)from, |
2152 |
+ (__force __be32)to, pseudohdr); |
2153 |
+ } |
2154 |
+ |
2155 |
+-static inline __wsum remcsum_adjust(void *ptr, __wsum csum, |
2156 |
+- int start, int offset) |
2157 |
++static __always_inline __wsum remcsum_adjust(void *ptr, __wsum csum, |
2158 |
++ int start, int offset) |
2159 |
+ { |
2160 |
+ __sum16 *psum = (__sum16 *)(ptr + offset); |
2161 |
+ __wsum delta; |
2162 |
+@@ -173,7 +179,7 @@ static inline __wsum remcsum_adjust(void *ptr, __wsum csum, |
2163 |
+ return delta; |
2164 |
+ } |
2165 |
+ |
2166 |
+-static inline void remcsum_unadjust(__sum16 *psum, __wsum delta) |
2167 |
++static __always_inline void remcsum_unadjust(__sum16 *psum, __wsum delta) |
2168 |
+ { |
2169 |
+ *psum = csum_fold(csum_sub(delta, (__force __wsum)*psum)); |
2170 |
+ } |
2171 |
+diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h |
2172 |
+index ed4a9d098164f..76bfb6cd5815d 100644 |
2173 |
+--- a/include/net/netfilter/nf_tables.h |
2174 |
++++ b/include/net/netfilter/nf_tables.h |
2175 |
+@@ -825,7 +825,7 @@ struct nft_expr_ops { |
2176 |
+ int (*offload)(struct nft_offload_ctx *ctx, |
2177 |
+ struct nft_flow_rule *flow, |
2178 |
+ const struct nft_expr *expr); |
2179 |
+- u32 offload_flags; |
2180 |
++ bool (*offload_action)(const struct nft_expr *expr); |
2181 |
+ const struct nft_expr_type *type; |
2182 |
+ void *data; |
2183 |
+ }; |
2184 |
+diff --git a/include/net/netfilter/nf_tables_offload.h b/include/net/netfilter/nf_tables_offload.h |
2185 |
+index 434a6158852f3..7a453a35a41dd 100644 |
2186 |
+--- a/include/net/netfilter/nf_tables_offload.h |
2187 |
++++ b/include/net/netfilter/nf_tables_offload.h |
2188 |
+@@ -67,8 +67,6 @@ struct nft_flow_rule { |
2189 |
+ struct flow_rule *rule; |
2190 |
+ }; |
2191 |
+ |
2192 |
+-#define NFT_OFFLOAD_F_ACTION (1 << 0) |
2193 |
+- |
2194 |
+ void nft_flow_rule_set_addr_type(struct nft_flow_rule *flow, |
2195 |
+ enum flow_dissector_key_id addr_type); |
2196 |
+ |
2197 |
+diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c |
2198 |
+index 209e6567cdab0..419dbc3d060ee 100644 |
2199 |
+--- a/kernel/bpf/syscall.c |
2200 |
++++ b/kernel/bpf/syscall.c |
2201 |
+@@ -1308,6 +1308,7 @@ int generic_map_delete_batch(struct bpf_map *map, |
2202 |
+ maybe_wait_bpf_programs(map); |
2203 |
+ if (err) |
2204 |
+ break; |
2205 |
++ cond_resched(); |
2206 |
+ } |
2207 |
+ if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp))) |
2208 |
+ err = -EFAULT; |
2209 |
+@@ -1365,6 +1366,7 @@ int generic_map_update_batch(struct bpf_map *map, |
2210 |
+ |
2211 |
+ if (err) |
2212 |
+ break; |
2213 |
++ cond_resched(); |
2214 |
+ } |
2215 |
+ |
2216 |
+ if (copy_to_user(&uattr->batch.count, &cp, sizeof(cp))) |
2217 |
+@@ -1462,6 +1464,7 @@ int generic_map_lookup_batch(struct bpf_map *map, |
2218 |
+ swap(prev_key, key); |
2219 |
+ retry = MAP_LOOKUP_RETRIES; |
2220 |
+ cp++; |
2221 |
++ cond_resched(); |
2222 |
+ } |
2223 |
+ |
2224 |
+ if (err == -EFAULT) |
2225 |
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
2226 |
+index ef6b3a7f31c17..0aa224c31f10a 100644 |
2227 |
+--- a/kernel/cgroup/cpuset.c |
2228 |
++++ b/kernel/cgroup/cpuset.c |
2229 |
+@@ -2212,6 +2212,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
2230 |
+ cgroup_taskset_first(tset, &css); |
2231 |
+ cs = css_cs(css); |
2232 |
+ |
2233 |
++ cpus_read_lock(); |
2234 |
+ percpu_down_write(&cpuset_rwsem); |
2235 |
+ |
2236 |
+ /* prepare for attach */ |
2237 |
+@@ -2267,6 +2268,7 @@ static void cpuset_attach(struct cgroup_taskset *tset) |
2238 |
+ wake_up(&cpuset_attach_wq); |
2239 |
+ |
2240 |
+ percpu_up_write(&cpuset_rwsem); |
2241 |
++ cpus_read_unlock(); |
2242 |
+ } |
2243 |
+ |
2244 |
+ /* The various types of files and directories in a cpuset file system */ |
2245 |
+diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c |
2246 |
+index f725802160c0b..d0309de2f84fe 100644 |
2247 |
+--- a/kernel/trace/trace_events_trigger.c |
2248 |
++++ b/kernel/trace/trace_events_trigger.c |
2249 |
+@@ -940,6 +940,16 @@ static void |
2250 |
+ traceon_trigger(struct event_trigger_data *data, void *rec, |
2251 |
+ struct ring_buffer_event *event) |
2252 |
+ { |
2253 |
++ struct trace_event_file *file = data->private_data; |
2254 |
++ |
2255 |
++ if (file) { |
2256 |
++ if (tracer_tracing_is_on(file->tr)) |
2257 |
++ return; |
2258 |
++ |
2259 |
++ tracer_tracing_on(file->tr); |
2260 |
++ return; |
2261 |
++ } |
2262 |
++ |
2263 |
+ if (tracing_is_on()) |
2264 |
+ return; |
2265 |
+ |
2266 |
+@@ -950,8 +960,15 @@ static void |
2267 |
+ traceon_count_trigger(struct event_trigger_data *data, void *rec, |
2268 |
+ struct ring_buffer_event *event) |
2269 |
+ { |
2270 |
+- if (tracing_is_on()) |
2271 |
+- return; |
2272 |
++ struct trace_event_file *file = data->private_data; |
2273 |
++ |
2274 |
++ if (file) { |
2275 |
++ if (tracer_tracing_is_on(file->tr)) |
2276 |
++ return; |
2277 |
++ } else { |
2278 |
++ if (tracing_is_on()) |
2279 |
++ return; |
2280 |
++ } |
2281 |
+ |
2282 |
+ if (!data->count) |
2283 |
+ return; |
2284 |
+@@ -959,13 +976,26 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec, |
2285 |
+ if (data->count != -1) |
2286 |
+ (data->count)--; |
2287 |
+ |
2288 |
+- tracing_on(); |
2289 |
++ if (file) |
2290 |
++ tracer_tracing_on(file->tr); |
2291 |
++ else |
2292 |
++ tracing_on(); |
2293 |
+ } |
2294 |
+ |
2295 |
+ static void |
2296 |
+ traceoff_trigger(struct event_trigger_data *data, void *rec, |
2297 |
+ struct ring_buffer_event *event) |
2298 |
+ { |
2299 |
++ struct trace_event_file *file = data->private_data; |
2300 |
++ |
2301 |
++ if (file) { |
2302 |
++ if (!tracer_tracing_is_on(file->tr)) |
2303 |
++ return; |
2304 |
++ |
2305 |
++ tracer_tracing_off(file->tr); |
2306 |
++ return; |
2307 |
++ } |
2308 |
++ |
2309 |
+ if (!tracing_is_on()) |
2310 |
+ return; |
2311 |
+ |
2312 |
+@@ -976,8 +1006,15 @@ static void |
2313 |
+ traceoff_count_trigger(struct event_trigger_data *data, void *rec, |
2314 |
+ struct ring_buffer_event *event) |
2315 |
+ { |
2316 |
+- if (!tracing_is_on()) |
2317 |
+- return; |
2318 |
++ struct trace_event_file *file = data->private_data; |
2319 |
++ |
2320 |
++ if (file) { |
2321 |
++ if (!tracer_tracing_is_on(file->tr)) |
2322 |
++ return; |
2323 |
++ } else { |
2324 |
++ if (!tracing_is_on()) |
2325 |
++ return; |
2326 |
++ } |
2327 |
+ |
2328 |
+ if (!data->count) |
2329 |
+ return; |
2330 |
+@@ -985,7 +1022,10 @@ traceoff_count_trigger(struct event_trigger_data *data, void *rec, |
2331 |
+ if (data->count != -1) |
2332 |
+ (data->count)--; |
2333 |
+ |
2334 |
+- tracing_off(); |
2335 |
++ if (file) |
2336 |
++ tracer_tracing_off(file->tr); |
2337 |
++ else |
2338 |
++ tracing_off(); |
2339 |
+ } |
2340 |
+ |
2341 |
+ static int |
2342 |
+diff --git a/mm/memblock.c b/mm/memblock.c |
2343 |
+index faa4de579b3db..f72d539570339 100644 |
2344 |
+--- a/mm/memblock.c |
2345 |
++++ b/mm/memblock.c |
2346 |
+@@ -366,14 +366,20 @@ void __init memblock_discard(void) |
2347 |
+ addr = __pa(memblock.reserved.regions); |
2348 |
+ size = PAGE_ALIGN(sizeof(struct memblock_region) * |
2349 |
+ memblock.reserved.max); |
2350 |
+- __memblock_free_late(addr, size); |
2351 |
++ if (memblock_reserved_in_slab) |
2352 |
++ kfree(memblock.reserved.regions); |
2353 |
++ else |
2354 |
++ __memblock_free_late(addr, size); |
2355 |
+ } |
2356 |
+ |
2357 |
+ if (memblock.memory.regions != memblock_memory_init_regions) { |
2358 |
+ addr = __pa(memblock.memory.regions); |
2359 |
+ size = PAGE_ALIGN(sizeof(struct memblock_region) * |
2360 |
+ memblock.memory.max); |
2361 |
+- __memblock_free_late(addr, size); |
2362 |
++ if (memblock_memory_in_slab) |
2363 |
++ kfree(memblock.memory.regions); |
2364 |
++ else |
2365 |
++ __memblock_free_late(addr, size); |
2366 |
+ } |
2367 |
+ |
2368 |
+ memblock_memory = NULL; |
2369 |
+diff --git a/net/core/filter.c b/net/core/filter.c |
2370 |
+index 7fa4283f2a8c0..659a328024713 100644 |
2371 |
+--- a/net/core/filter.c |
2372 |
++++ b/net/core/filter.c |
2373 |
+@@ -2730,6 +2730,9 @@ BPF_CALL_4(bpf_msg_push_data, struct sk_msg *, msg, u32, start, |
2374 |
+ if (unlikely(flags)) |
2375 |
+ return -EINVAL; |
2376 |
+ |
2377 |
++ if (unlikely(len == 0)) |
2378 |
++ return 0; |
2379 |
++ |
2380 |
+ /* First find the starting scatterlist element */ |
2381 |
+ i = msg->sg.start; |
2382 |
+ do { |
2383 |
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c |
2384 |
+index 0215ae898e836..fccc42c8ca0c7 100644 |
2385 |
+--- a/net/core/skbuff.c |
2386 |
++++ b/net/core/skbuff.c |
2387 |
+@@ -2139,7 +2139,7 @@ void *__pskb_pull_tail(struct sk_buff *skb, int delta) |
2388 |
+ /* Free pulled out fragments. */ |
2389 |
+ while ((list = skb_shinfo(skb)->frag_list) != insp) { |
2390 |
+ skb_shinfo(skb)->frag_list = list->next; |
2391 |
+- kfree_skb(list); |
2392 |
++ consume_skb(list); |
2393 |
+ } |
2394 |
+ /* And insert new clone at head. */ |
2395 |
+ if (clone) { |
2396 |
+@@ -6044,7 +6044,7 @@ static int pskb_carve_frag_list(struct sk_buff *skb, |
2397 |
+ /* Free pulled out fragments. */ |
2398 |
+ while ((list = shinfo->frag_list) != insp) { |
2399 |
+ shinfo->frag_list = list->next; |
2400 |
+- kfree_skb(list); |
2401 |
++ consume_skb(list); |
2402 |
+ } |
2403 |
+ /* And insert new clone at head. */ |
2404 |
+ if (clone) { |
2405 |
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c |
2406 |
+index e2f85a16fad9b..742218594741a 100644 |
2407 |
+--- a/net/ipv4/af_inet.c |
2408 |
++++ b/net/ipv4/af_inet.c |
2409 |
+@@ -1374,8 +1374,11 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb, |
2410 |
+ } |
2411 |
+ |
2412 |
+ ops = rcu_dereference(inet_offloads[proto]); |
2413 |
+- if (likely(ops && ops->callbacks.gso_segment)) |
2414 |
++ if (likely(ops && ops->callbacks.gso_segment)) { |
2415 |
+ segs = ops->callbacks.gso_segment(skb, features); |
2416 |
++ if (!segs) |
2417 |
++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head; |
2418 |
++ } |
2419 |
+ |
2420 |
+ if (IS_ERR_OR_NULL(segs)) |
2421 |
+ goto out; |
2422 |
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c |
2423 |
+index 323cb231cb580..e60ca03543a53 100644 |
2424 |
+--- a/net/ipv4/ping.c |
2425 |
++++ b/net/ipv4/ping.c |
2426 |
+@@ -187,7 +187,6 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) |
2427 |
+ (int)ident, &ipv6_hdr(skb)->daddr, dif); |
2428 |
+ #endif |
2429 |
+ } else { |
2430 |
+- pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol)); |
2431 |
+ return NULL; |
2432 |
+ } |
2433 |
+ |
2434 |
+diff --git a/net/ipv4/udp_tunnel_nic.c b/net/ipv4/udp_tunnel_nic.c |
2435 |
+index b91003538d87a..bc3a043a5d5c7 100644 |
2436 |
+--- a/net/ipv4/udp_tunnel_nic.c |
2437 |
++++ b/net/ipv4/udp_tunnel_nic.c |
2438 |
+@@ -846,7 +846,7 @@ udp_tunnel_nic_unregister(struct net_device *dev, struct udp_tunnel_nic *utn) |
2439 |
+ list_for_each_entry(node, &info->shared->devices, list) |
2440 |
+ if (node->dev == dev) |
2441 |
+ break; |
2442 |
+- if (node->dev != dev) |
2443 |
++ if (list_entry_is_head(node, &info->shared->devices, list)) |
2444 |
+ return; |
2445 |
+ |
2446 |
+ list_del(&node->list); |
2447 |
+diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c |
2448 |
+index a80f90bf3ae7d..15c8eef1ef443 100644 |
2449 |
+--- a/net/ipv6/ip6_offload.c |
2450 |
++++ b/net/ipv6/ip6_offload.c |
2451 |
+@@ -113,6 +113,8 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, |
2452 |
+ if (likely(ops && ops->callbacks.gso_segment)) { |
2453 |
+ skb_reset_transport_header(skb); |
2454 |
+ segs = ops->callbacks.gso_segment(skb, features); |
2455 |
++ if (!segs) |
2456 |
++ skb->network_header = skb_mac_header(skb) + nhoff - skb->head; |
2457 |
+ } |
2458 |
+ |
2459 |
+ if (IS_ERR_OR_NULL(segs)) |
2460 |
+diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c |
2461 |
+index b781ba97c474e..fdd1da9ecea9e 100644 |
2462 |
+--- a/net/netfilter/nf_tables_api.c |
2463 |
++++ b/net/netfilter/nf_tables_api.c |
2464 |
+@@ -5924,12 +5924,15 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, |
2465 |
+ { |
2466 |
+ struct nft_object *newobj; |
2467 |
+ struct nft_trans *trans; |
2468 |
+- int err; |
2469 |
++ int err = -ENOMEM; |
2470 |
++ |
2471 |
++ if (!try_module_get(type->owner)) |
2472 |
++ return -ENOENT; |
2473 |
+ |
2474 |
+ trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ, |
2475 |
+ sizeof(struct nft_trans_obj)); |
2476 |
+ if (!trans) |
2477 |
+- return -ENOMEM; |
2478 |
++ goto err_trans; |
2479 |
+ |
2480 |
+ newobj = nft_obj_init(ctx, type, attr); |
2481 |
+ if (IS_ERR(newobj)) { |
2482 |
+@@ -5946,6 +5949,8 @@ static int nf_tables_updobj(const struct nft_ctx *ctx, |
2483 |
+ |
2484 |
+ err_free_trans: |
2485 |
+ kfree(trans); |
2486 |
++err_trans: |
2487 |
++ module_put(type->owner); |
2488 |
+ return err; |
2489 |
+ } |
2490 |
+ |
2491 |
+@@ -7555,7 +7560,7 @@ static void nft_obj_commit_update(struct nft_trans *trans) |
2492 |
+ if (obj->ops->update) |
2493 |
+ obj->ops->update(obj, newobj); |
2494 |
+ |
2495 |
+- kfree(newobj); |
2496 |
++ nft_obj_destroy(&trans->ctx, newobj); |
2497 |
+ } |
2498 |
+ |
2499 |
+ static void nft_commit_release(struct nft_trans *trans) |
2500 |
+@@ -8202,7 +8207,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) |
2501 |
+ break; |
2502 |
+ case NFT_MSG_NEWOBJ: |
2503 |
+ if (nft_trans_obj_update(trans)) { |
2504 |
+- kfree(nft_trans_obj_newobj(trans)); |
2505 |
++ nft_obj_destroy(&trans->ctx, nft_trans_obj_newobj(trans)); |
2506 |
+ nft_trans_destroy(trans); |
2507 |
+ } else { |
2508 |
+ trans->ctx.table->use--; |
2509 |
+diff --git a/net/netfilter/nf_tables_offload.c b/net/netfilter/nf_tables_offload.c |
2510 |
+index e5fcbb0e4b8e5..839fd09f1bb4a 100644 |
2511 |
+--- a/net/netfilter/nf_tables_offload.c |
2512 |
++++ b/net/netfilter/nf_tables_offload.c |
2513 |
+@@ -94,7 +94,8 @@ struct nft_flow_rule *nft_flow_rule_create(struct net *net, |
2514 |
+ |
2515 |
+ expr = nft_expr_first(rule); |
2516 |
+ while (nft_expr_more(rule, expr)) { |
2517 |
+- if (expr->ops->offload_flags & NFT_OFFLOAD_F_ACTION) |
2518 |
++ if (expr->ops->offload_action && |
2519 |
++ expr->ops->offload_action(expr)) |
2520 |
+ num_actions++; |
2521 |
+ |
2522 |
+ expr = nft_expr_next(expr); |
2523 |
+diff --git a/net/netfilter/nft_dup_netdev.c b/net/netfilter/nft_dup_netdev.c |
2524 |
+index 40788b3f1071a..70c457476b874 100644 |
2525 |
+--- a/net/netfilter/nft_dup_netdev.c |
2526 |
++++ b/net/netfilter/nft_dup_netdev.c |
2527 |
+@@ -67,6 +67,11 @@ static int nft_dup_netdev_offload(struct nft_offload_ctx *ctx, |
2528 |
+ return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_MIRRED, oif); |
2529 |
+ } |
2530 |
+ |
2531 |
++static bool nft_dup_netdev_offload_action(const struct nft_expr *expr) |
2532 |
++{ |
2533 |
++ return true; |
2534 |
++} |
2535 |
++ |
2536 |
+ static struct nft_expr_type nft_dup_netdev_type; |
2537 |
+ static const struct nft_expr_ops nft_dup_netdev_ops = { |
2538 |
+ .type = &nft_dup_netdev_type, |
2539 |
+@@ -75,6 +80,7 @@ static const struct nft_expr_ops nft_dup_netdev_ops = { |
2540 |
+ .init = nft_dup_netdev_init, |
2541 |
+ .dump = nft_dup_netdev_dump, |
2542 |
+ .offload = nft_dup_netdev_offload, |
2543 |
++ .offload_action = nft_dup_netdev_offload_action, |
2544 |
+ }; |
2545 |
+ |
2546 |
+ static struct nft_expr_type nft_dup_netdev_type __read_mostly = { |
2547 |
+diff --git a/net/netfilter/nft_fwd_netdev.c b/net/netfilter/nft_fwd_netdev.c |
2548 |
+index b77985986b24e..3b0dcd170551b 100644 |
2549 |
+--- a/net/netfilter/nft_fwd_netdev.c |
2550 |
++++ b/net/netfilter/nft_fwd_netdev.c |
2551 |
+@@ -77,6 +77,11 @@ static int nft_fwd_netdev_offload(struct nft_offload_ctx *ctx, |
2552 |
+ return nft_fwd_dup_netdev_offload(ctx, flow, FLOW_ACTION_REDIRECT, oif); |
2553 |
+ } |
2554 |
+ |
2555 |
++static bool nft_fwd_netdev_offload_action(const struct nft_expr *expr) |
2556 |
++{ |
2557 |
++ return true; |
2558 |
++} |
2559 |
++ |
2560 |
+ struct nft_fwd_neigh { |
2561 |
+ enum nft_registers sreg_dev:8; |
2562 |
+ enum nft_registers sreg_addr:8; |
2563 |
+@@ -219,6 +224,7 @@ static const struct nft_expr_ops nft_fwd_netdev_ops = { |
2564 |
+ .dump = nft_fwd_netdev_dump, |
2565 |
+ .validate = nft_fwd_validate, |
2566 |
+ .offload = nft_fwd_netdev_offload, |
2567 |
++ .offload_action = nft_fwd_netdev_offload_action, |
2568 |
+ }; |
2569 |
+ |
2570 |
+ static const struct nft_expr_ops * |
2571 |
+diff --git a/net/netfilter/nft_immediate.c b/net/netfilter/nft_immediate.c |
2572 |
+index c63eb3b171784..5c9d88560a474 100644 |
2573 |
+--- a/net/netfilter/nft_immediate.c |
2574 |
++++ b/net/netfilter/nft_immediate.c |
2575 |
+@@ -213,6 +213,16 @@ static int nft_immediate_offload(struct nft_offload_ctx *ctx, |
2576 |
+ return 0; |
2577 |
+ } |
2578 |
+ |
2579 |
++static bool nft_immediate_offload_action(const struct nft_expr *expr) |
2580 |
++{ |
2581 |
++ const struct nft_immediate_expr *priv = nft_expr_priv(expr); |
2582 |
++ |
2583 |
++ if (priv->dreg == NFT_REG_VERDICT) |
2584 |
++ return true; |
2585 |
++ |
2586 |
++ return false; |
2587 |
++} |
2588 |
++ |
2589 |
+ static const struct nft_expr_ops nft_imm_ops = { |
2590 |
+ .type = &nft_imm_type, |
2591 |
+ .size = NFT_EXPR_SIZE(sizeof(struct nft_immediate_expr)), |
2592 |
+@@ -224,7 +234,7 @@ static const struct nft_expr_ops nft_imm_ops = { |
2593 |
+ .dump = nft_immediate_dump, |
2594 |
+ .validate = nft_immediate_validate, |
2595 |
+ .offload = nft_immediate_offload, |
2596 |
+- .offload_flags = NFT_OFFLOAD_F_ACTION, |
2597 |
++ .offload_action = nft_immediate_offload_action, |
2598 |
+ }; |
2599 |
+ |
2600 |
+ struct nft_expr_type nft_imm_type __read_mostly = { |
2601 |
+diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c |
2602 |
+index fc487f9812fc5..525c1540f10e6 100644 |
2603 |
+--- a/net/openvswitch/actions.c |
2604 |
++++ b/net/openvswitch/actions.c |
2605 |
+@@ -422,12 +422,43 @@ static void set_ipv6_addr(struct sk_buff *skb, u8 l4_proto, |
2606 |
+ memcpy(addr, new_addr, sizeof(__be32[4])); |
2607 |
+ } |
2608 |
+ |
2609 |
+-static void set_ipv6_fl(struct ipv6hdr *nh, u32 fl, u32 mask) |
2610 |
++static void set_ipv6_dsfield(struct sk_buff *skb, struct ipv6hdr *nh, u8 ipv6_tclass, u8 mask) |
2611 |
+ { |
2612 |
++ u8 old_ipv6_tclass = ipv6_get_dsfield(nh); |
2613 |
++ |
2614 |
++ ipv6_tclass = OVS_MASKED(old_ipv6_tclass, ipv6_tclass, mask); |
2615 |
++ |
2616 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
2617 |
++ csum_replace(&skb->csum, (__force __wsum)(old_ipv6_tclass << 12), |
2618 |
++ (__force __wsum)(ipv6_tclass << 12)); |
2619 |
++ |
2620 |
++ ipv6_change_dsfield(nh, ~mask, ipv6_tclass); |
2621 |
++} |
2622 |
++ |
2623 |
++static void set_ipv6_fl(struct sk_buff *skb, struct ipv6hdr *nh, u32 fl, u32 mask) |
2624 |
++{ |
2625 |
++ u32 ofl; |
2626 |
++ |
2627 |
++ ofl = nh->flow_lbl[0] << 16 | nh->flow_lbl[1] << 8 | nh->flow_lbl[2]; |
2628 |
++ fl = OVS_MASKED(ofl, fl, mask); |
2629 |
++ |
2630 |
+ /* Bits 21-24 are always unmasked, so this retains their values. */ |
2631 |
+- OVS_SET_MASKED(nh->flow_lbl[0], (u8)(fl >> 16), (u8)(mask >> 16)); |
2632 |
+- OVS_SET_MASKED(nh->flow_lbl[1], (u8)(fl >> 8), (u8)(mask >> 8)); |
2633 |
+- OVS_SET_MASKED(nh->flow_lbl[2], (u8)fl, (u8)mask); |
2634 |
++ nh->flow_lbl[0] = (u8)(fl >> 16); |
2635 |
++ nh->flow_lbl[1] = (u8)(fl >> 8); |
2636 |
++ nh->flow_lbl[2] = (u8)fl; |
2637 |
++ |
2638 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
2639 |
++ csum_replace(&skb->csum, (__force __wsum)htonl(ofl), (__force __wsum)htonl(fl)); |
2640 |
++} |
2641 |
++ |
2642 |
++static void set_ipv6_ttl(struct sk_buff *skb, struct ipv6hdr *nh, u8 new_ttl, u8 mask) |
2643 |
++{ |
2644 |
++ new_ttl = OVS_MASKED(nh->hop_limit, new_ttl, mask); |
2645 |
++ |
2646 |
++ if (skb->ip_summed == CHECKSUM_COMPLETE) |
2647 |
++ csum_replace(&skb->csum, (__force __wsum)(nh->hop_limit << 8), |
2648 |
++ (__force __wsum)(new_ttl << 8)); |
2649 |
++ nh->hop_limit = new_ttl; |
2650 |
+ } |
2651 |
+ |
2652 |
+ static void set_ip_ttl(struct sk_buff *skb, struct iphdr *nh, u8 new_ttl, |
2653 |
+@@ -545,18 +576,17 @@ static int set_ipv6(struct sk_buff *skb, struct sw_flow_key *flow_key, |
2654 |
+ } |
2655 |
+ } |
2656 |
+ if (mask->ipv6_tclass) { |
2657 |
+- ipv6_change_dsfield(nh, ~mask->ipv6_tclass, key->ipv6_tclass); |
2658 |
++ set_ipv6_dsfield(skb, nh, key->ipv6_tclass, mask->ipv6_tclass); |
2659 |
+ flow_key->ip.tos = ipv6_get_dsfield(nh); |
2660 |
+ } |
2661 |
+ if (mask->ipv6_label) { |
2662 |
+- set_ipv6_fl(nh, ntohl(key->ipv6_label), |
2663 |
++ set_ipv6_fl(skb, nh, ntohl(key->ipv6_label), |
2664 |
+ ntohl(mask->ipv6_label)); |
2665 |
+ flow_key->ipv6.label = |
2666 |
+ *(__be32 *)nh & htonl(IPV6_FLOWINFO_FLOWLABEL); |
2667 |
+ } |
2668 |
+ if (mask->ipv6_hlimit) { |
2669 |
+- OVS_SET_MASKED(nh->hop_limit, key->ipv6_hlimit, |
2670 |
+- mask->ipv6_hlimit); |
2671 |
++ set_ipv6_ttl(skb, nh, key->ipv6_hlimit, mask->ipv6_hlimit); |
2672 |
+ flow_key->ip.ttl = nh->hop_limit; |
2673 |
+ } |
2674 |
+ return 0; |
2675 |
+diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c |
2676 |
+index 812c3c70a53a0..825b3e9b55f7e 100644 |
2677 |
+--- a/net/sched/act_ct.c |
2678 |
++++ b/net/sched/act_ct.c |
2679 |
+@@ -514,11 +514,6 @@ static bool tcf_ct_flow_table_lookup(struct tcf_ct_params *p, |
2680 |
+ struct nf_conn *ct; |
2681 |
+ u8 dir; |
2682 |
+ |
2683 |
+- /* Previously seen or loopback */ |
2684 |
+- ct = nf_ct_get(skb, &ctinfo); |
2685 |
+- if ((ct && !nf_ct_is_template(ct)) || ctinfo == IP_CT_UNTRACKED) |
2686 |
+- return false; |
2687 |
+- |
2688 |
+ switch (family) { |
2689 |
+ case NFPROTO_IPV4: |
2690 |
+ if (!tcf_ct_flow_table_fill_tuple_ipv4(skb, &tuple, &tcph)) |
2691 |
+diff --git a/net/smc/smc_pnet.c b/net/smc/smc_pnet.c |
2692 |
+index f3c18b991d35c..9007c7e3bae4e 100644 |
2693 |
+--- a/net/smc/smc_pnet.c |
2694 |
++++ b/net/smc/smc_pnet.c |
2695 |
+@@ -112,7 +112,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) |
2696 |
+ pnettable = &sn->pnettable; |
2697 |
+ |
2698 |
+ /* remove table entry */ |
2699 |
+- write_lock(&pnettable->lock); |
2700 |
++ mutex_lock(&pnettable->lock); |
2701 |
+ list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, |
2702 |
+ list) { |
2703 |
+ if (!pnet_name || |
2704 |
+@@ -130,7 +130,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name) |
2705 |
+ rc = 0; |
2706 |
+ } |
2707 |
+ } |
2708 |
+- write_unlock(&pnettable->lock); |
2709 |
++ mutex_unlock(&pnettable->lock); |
2710 |
+ |
2711 |
+ /* if this is not the initial namespace, stop here */ |
2712 |
+ if (net != &init_net) |
2713 |
+@@ -191,7 +191,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) |
2714 |
+ sn = net_generic(net, smc_net_id); |
2715 |
+ pnettable = &sn->pnettable; |
2716 |
+ |
2717 |
+- write_lock(&pnettable->lock); |
2718 |
++ mutex_lock(&pnettable->lock); |
2719 |
+ list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) { |
2720 |
+ if (pnetelem->type == SMC_PNET_ETH && !pnetelem->ndev && |
2721 |
+ !strncmp(pnetelem->eth_name, ndev->name, IFNAMSIZ)) { |
2722 |
+@@ -205,7 +205,7 @@ static int smc_pnet_add_by_ndev(struct net_device *ndev) |
2723 |
+ break; |
2724 |
+ } |
2725 |
+ } |
2726 |
+- write_unlock(&pnettable->lock); |
2727 |
++ mutex_unlock(&pnettable->lock); |
2728 |
+ return rc; |
2729 |
+ } |
2730 |
+ |
2731 |
+@@ -223,7 +223,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) |
2732 |
+ sn = net_generic(net, smc_net_id); |
2733 |
+ pnettable = &sn->pnettable; |
2734 |
+ |
2735 |
+- write_lock(&pnettable->lock); |
2736 |
++ mutex_lock(&pnettable->lock); |
2737 |
+ list_for_each_entry_safe(pnetelem, tmp_pe, &pnettable->pnetlist, list) { |
2738 |
+ if (pnetelem->type == SMC_PNET_ETH && pnetelem->ndev == ndev) { |
2739 |
+ dev_put(pnetelem->ndev); |
2740 |
+@@ -236,7 +236,7 @@ static int smc_pnet_remove_by_ndev(struct net_device *ndev) |
2741 |
+ break; |
2742 |
+ } |
2743 |
+ } |
2744 |
+- write_unlock(&pnettable->lock); |
2745 |
++ mutex_unlock(&pnettable->lock); |
2746 |
+ return rc; |
2747 |
+ } |
2748 |
+ |
2749 |
+@@ -371,7 +371,7 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, |
2750 |
+ |
2751 |
+ rc = -EEXIST; |
2752 |
+ new_netdev = true; |
2753 |
+- write_lock(&pnettable->lock); |
2754 |
++ mutex_lock(&pnettable->lock); |
2755 |
+ list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
2756 |
+ if (tmp_pe->type == SMC_PNET_ETH && |
2757 |
+ !strncmp(tmp_pe->eth_name, eth_name, IFNAMSIZ)) { |
2758 |
+@@ -381,9 +381,9 @@ static int smc_pnet_add_eth(struct smc_pnettable *pnettable, struct net *net, |
2759 |
+ } |
2760 |
+ if (new_netdev) { |
2761 |
+ list_add_tail(&new_pe->list, &pnettable->pnetlist); |
2762 |
+- write_unlock(&pnettable->lock); |
2763 |
++ mutex_unlock(&pnettable->lock); |
2764 |
+ } else { |
2765 |
+- write_unlock(&pnettable->lock); |
2766 |
++ mutex_unlock(&pnettable->lock); |
2767 |
+ kfree(new_pe); |
2768 |
+ goto out_put; |
2769 |
+ } |
2770 |
+@@ -445,7 +445,7 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, |
2771 |
+ new_pe->ib_port = ib_port; |
2772 |
+ |
2773 |
+ new_ibdev = true; |
2774 |
+- write_lock(&pnettable->lock); |
2775 |
++ mutex_lock(&pnettable->lock); |
2776 |
+ list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
2777 |
+ if (tmp_pe->type == SMC_PNET_IB && |
2778 |
+ !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) { |
2779 |
+@@ -455,9 +455,9 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name, |
2780 |
+ } |
2781 |
+ if (new_ibdev) { |
2782 |
+ list_add_tail(&new_pe->list, &pnettable->pnetlist); |
2783 |
+- write_unlock(&pnettable->lock); |
2784 |
++ mutex_unlock(&pnettable->lock); |
2785 |
+ } else { |
2786 |
+- write_unlock(&pnettable->lock); |
2787 |
++ mutex_unlock(&pnettable->lock); |
2788 |
+ kfree(new_pe); |
2789 |
+ } |
2790 |
+ return (new_ibdev) ? 0 : -EEXIST; |
2791 |
+@@ -602,7 +602,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, |
2792 |
+ pnettable = &sn->pnettable; |
2793 |
+ |
2794 |
+ /* dump pnettable entries */ |
2795 |
+- read_lock(&pnettable->lock); |
2796 |
++ mutex_lock(&pnettable->lock); |
2797 |
+ list_for_each_entry(pnetelem, &pnettable->pnetlist, list) { |
2798 |
+ if (pnetid && !smc_pnet_match(pnetelem->pnet_name, pnetid)) |
2799 |
+ continue; |
2800 |
+@@ -617,7 +617,7 @@ static int _smc_pnet_dump(struct net *net, struct sk_buff *skb, u32 portid, |
2801 |
+ break; |
2802 |
+ } |
2803 |
+ } |
2804 |
+- read_unlock(&pnettable->lock); |
2805 |
++ mutex_unlock(&pnettable->lock); |
2806 |
+ return idx; |
2807 |
+ } |
2808 |
+ |
2809 |
+@@ -859,7 +859,7 @@ int smc_pnet_net_init(struct net *net) |
2810 |
+ struct smc_pnetids_ndev *pnetids_ndev = &sn->pnetids_ndev; |
2811 |
+ |
2812 |
+ INIT_LIST_HEAD(&pnettable->pnetlist); |
2813 |
+- rwlock_init(&pnettable->lock); |
2814 |
++ mutex_init(&pnettable->lock); |
2815 |
+ INIT_LIST_HEAD(&pnetids_ndev->list); |
2816 |
+ rwlock_init(&pnetids_ndev->lock); |
2817 |
+ |
2818 |
+@@ -939,7 +939,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, |
2819 |
+ sn = net_generic(net, smc_net_id); |
2820 |
+ pnettable = &sn->pnettable; |
2821 |
+ |
2822 |
+- read_lock(&pnettable->lock); |
2823 |
++ mutex_lock(&pnettable->lock); |
2824 |
+ list_for_each_entry(pnetelem, &pnettable->pnetlist, list) { |
2825 |
+ if (pnetelem->type == SMC_PNET_ETH && ndev == pnetelem->ndev) { |
2826 |
+ /* get pnetid of netdev device */ |
2827 |
+@@ -948,7 +948,7 @@ static int smc_pnet_find_ndev_pnetid_by_table(struct net_device *ndev, |
2828 |
+ break; |
2829 |
+ } |
2830 |
+ } |
2831 |
+- read_unlock(&pnettable->lock); |
2832 |
++ mutex_unlock(&pnettable->lock); |
2833 |
+ return rc; |
2834 |
+ } |
2835 |
+ |
2836 |
+@@ -1129,7 +1129,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) |
2837 |
+ sn = net_generic(&init_net, smc_net_id); |
2838 |
+ pnettable = &sn->pnettable; |
2839 |
+ |
2840 |
+- read_lock(&pnettable->lock); |
2841 |
++ mutex_lock(&pnettable->lock); |
2842 |
+ list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
2843 |
+ if (tmp_pe->type == SMC_PNET_IB && |
2844 |
+ !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX) && |
2845 |
+@@ -1139,7 +1139,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port) |
2846 |
+ break; |
2847 |
+ } |
2848 |
+ } |
2849 |
+- read_unlock(&pnettable->lock); |
2850 |
++ mutex_unlock(&pnettable->lock); |
2851 |
+ |
2852 |
+ return rc; |
2853 |
+ } |
2854 |
+@@ -1158,7 +1158,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) |
2855 |
+ sn = net_generic(&init_net, smc_net_id); |
2856 |
+ pnettable = &sn->pnettable; |
2857 |
+ |
2858 |
+- read_lock(&pnettable->lock); |
2859 |
++ mutex_lock(&pnettable->lock); |
2860 |
+ list_for_each_entry(tmp_pe, &pnettable->pnetlist, list) { |
2861 |
+ if (tmp_pe->type == SMC_PNET_IB && |
2862 |
+ !strncmp(tmp_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX)) { |
2863 |
+@@ -1167,7 +1167,7 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev) |
2864 |
+ break; |
2865 |
+ } |
2866 |
+ } |
2867 |
+- read_unlock(&pnettable->lock); |
2868 |
++ mutex_unlock(&pnettable->lock); |
2869 |
+ |
2870 |
+ return rc; |
2871 |
+ } |
2872 |
+diff --git a/net/smc/smc_pnet.h b/net/smc/smc_pnet.h |
2873 |
+index 14039272f7e42..80a88eea49491 100644 |
2874 |
+--- a/net/smc/smc_pnet.h |
2875 |
++++ b/net/smc/smc_pnet.h |
2876 |
+@@ -29,7 +29,7 @@ struct smc_link_group; |
2877 |
+ * @pnetlist: List of PNETIDs |
2878 |
+ */ |
2879 |
+ struct smc_pnettable { |
2880 |
+- rwlock_t lock; |
2881 |
++ struct mutex lock; |
2882 |
+ struct list_head pnetlist; |
2883 |
+ }; |
2884 |
+ |
2885 |
+diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c |
2886 |
+index f6a6acef42235..54c5328f492d2 100644 |
2887 |
+--- a/net/tipc/name_table.c |
2888 |
++++ b/net/tipc/name_table.c |
2889 |
+@@ -931,7 +931,7 @@ static int __tipc_nl_add_nametable_publ(struct tipc_nl_msg *msg, |
2890 |
+ list_for_each_entry(p, &sr->all_publ, all_publ) |
2891 |
+ if (p->key == *last_key) |
2892 |
+ break; |
2893 |
+- if (p->key != *last_key) |
2894 |
++ if (list_entry_is_head(p, &sr->all_publ, all_publ)) |
2895 |
+ return -EPIPE; |
2896 |
+ } else { |
2897 |
+ p = list_first_entry(&sr->all_publ, |
2898 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
2899 |
+index ce957ee5383c4..8d2c98531af45 100644 |
2900 |
+--- a/net/tipc/socket.c |
2901 |
++++ b/net/tipc/socket.c |
2902 |
+@@ -3743,7 +3743,7 @@ static int __tipc_nl_list_sk_publ(struct sk_buff *skb, |
2903 |
+ if (p->key == *last_publ) |
2904 |
+ break; |
2905 |
+ } |
2906 |
+- if (p->key != *last_publ) { |
2907 |
++ if (list_entry_is_head(p, &tsk->publications, binding_sock)) { |
2908 |
+ /* We never set seq or call nl_dump_check_consistent() |
2909 |
+ * this means that setting prev_seq here will cause the |
2910 |
+ * consistence check to fail in the netlink callback |
2911 |
+diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c |
2912 |
+index bcb494dc816a0..48754083791d8 100644 |
2913 |
+--- a/tools/perf/util/data.c |
2914 |
++++ b/tools/perf/util/data.c |
2915 |
+@@ -44,10 +44,6 @@ int perf_data__create_dir(struct perf_data *data, int nr) |
2916 |
+ if (!files) |
2917 |
+ return -ENOMEM; |
2918 |
+ |
2919 |
+- data->dir.version = PERF_DIR_VERSION; |
2920 |
+- data->dir.files = files; |
2921 |
+- data->dir.nr = nr; |
2922 |
+- |
2923 |
+ for (i = 0; i < nr; i++) { |
2924 |
+ struct perf_data_file *file = &files[i]; |
2925 |
+ |
2926 |
+@@ -62,6 +58,9 @@ int perf_data__create_dir(struct perf_data *data, int nr) |
2927 |
+ file->fd = ret; |
2928 |
+ } |
2929 |
+ |
2930 |
++ data->dir.version = PERF_DIR_VERSION; |
2931 |
++ data->dir.files = files; |
2932 |
++ data->dir.nr = nr; |
2933 |
+ return 0; |
2934 |
+ |
2935 |
+ out_err: |
2936 |
+diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h |
2937 |
+index 1858435de7aaf..5cb90ca292186 100644 |
2938 |
+--- a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h |
2939 |
++++ b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h |
2940 |
+@@ -235,7 +235,7 @@ SEC("sk_msg1") |
2941 |
+ int bpf_prog4(struct sk_msg_md *msg) |
2942 |
+ { |
2943 |
+ int *bytes, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5; |
2944 |
+- int *start, *end, *start_push, *end_push, *start_pop, *pop; |
2945 |
++ int *start, *end, *start_push, *end_push, *start_pop, *pop, err = 0; |
2946 |
+ |
2947 |
+ bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
2948 |
+ if (bytes) |
2949 |
+@@ -249,8 +249,11 @@ int bpf_prog4(struct sk_msg_md *msg) |
2950 |
+ bpf_msg_pull_data(msg, *start, *end, 0); |
2951 |
+ start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
2952 |
+ end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
2953 |
+- if (start_push && end_push) |
2954 |
+- bpf_msg_push_data(msg, *start_push, *end_push, 0); |
2955 |
++ if (start_push && end_push) { |
2956 |
++ err = bpf_msg_push_data(msg, *start_push, *end_push, 0); |
2957 |
++ if (err) |
2958 |
++ return SK_DROP; |
2959 |
++ } |
2960 |
+ start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
2961 |
+ pop = bpf_map_lookup_elem(&sock_bytes, &five); |
2962 |
+ if (start_pop && pop) |
2963 |
+@@ -263,6 +266,7 @@ int bpf_prog6(struct sk_msg_md *msg) |
2964 |
+ { |
2965 |
+ int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, key = 0; |
2966 |
+ int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop, *f; |
2967 |
++ int err = 0; |
2968 |
+ __u64 flags = 0; |
2969 |
+ |
2970 |
+ bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
2971 |
+@@ -279,8 +283,11 @@ int bpf_prog6(struct sk_msg_md *msg) |
2972 |
+ |
2973 |
+ start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
2974 |
+ end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
2975 |
+- if (start_push && end_push) |
2976 |
+- bpf_msg_push_data(msg, *start_push, *end_push, 0); |
2977 |
++ if (start_push && end_push) { |
2978 |
++ err = bpf_msg_push_data(msg, *start_push, *end_push, 0); |
2979 |
++ if (err) |
2980 |
++ return SK_DROP; |
2981 |
++ } |
2982 |
+ |
2983 |
+ start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
2984 |
+ pop = bpf_map_lookup_elem(&sock_bytes, &five); |
2985 |
+@@ -338,7 +345,7 @@ SEC("sk_msg5") |
2986 |
+ int bpf_prog10(struct sk_msg_md *msg) |
2987 |
+ { |
2988 |
+ int *bytes, *start, *end, *start_push, *end_push, *start_pop, *pop; |
2989 |
+- int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5; |
2990 |
++ int zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, err = 0; |
2991 |
+ |
2992 |
+ bytes = bpf_map_lookup_elem(&sock_apply_bytes, &zero); |
2993 |
+ if (bytes) |
2994 |
+@@ -352,8 +359,11 @@ int bpf_prog10(struct sk_msg_md *msg) |
2995 |
+ bpf_msg_pull_data(msg, *start, *end, 0); |
2996 |
+ start_push = bpf_map_lookup_elem(&sock_bytes, &two); |
2997 |
+ end_push = bpf_map_lookup_elem(&sock_bytes, &three); |
2998 |
+- if (start_push && end_push) |
2999 |
+- bpf_msg_push_data(msg, *start_push, *end_push, 0); |
3000 |
++ if (start_push && end_push) { |
3001 |
++ err = bpf_msg_push_data(msg, *start_push, *end_push, 0); |
3002 |
++ if (err) |
3003 |
++ return SK_PASS; |
3004 |
++ } |
3005 |
+ start_pop = bpf_map_lookup_elem(&sock_bytes, &four); |
3006 |
+ pop = bpf_map_lookup_elem(&sock_bytes, &five); |
3007 |
+ if (start_pop && pop) |