1 |
commit: bb34eaadc95f27973636b3035add7cb29eacddfc |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 29 11:18:33 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 29 11:18:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=bb34eaad |
7 |
|
8 |
Linux patch 4.19.153 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1152_linux-4.19.153.patch | 4259 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4263 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index ddccc76..f3a1010 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -647,6 +647,10 @@ Patch: 1151_linux-4.19.152.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.152 |
23 |
|
24 |
+Patch: 1152_linux-4.19.153.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.153 |
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/1152_linux-4.19.153.patch b/1152_linux-4.19.153.patch |
33 |
new file mode 100644 |
34 |
index 0000000..f5fa716 |
35 |
--- /dev/null |
36 |
+++ b/1152_linux-4.19.153.patch |
37 |
@@ -0,0 +1,4259 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index 30752db575870..fb129272240c9 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -558,7 +558,7 @@ |
43 |
+ loops can be debugged more effectively on production |
44 |
+ systems. |
45 |
+ |
46 |
+- clearcpuid=BITNUM [X86] |
47 |
++ clearcpuid=BITNUM[,BITNUM...] [X86] |
48 |
+ Disable CPUID feature X for the kernel. See |
49 |
+ arch/x86/include/asm/cpufeatures.h for the valid bit |
50 |
+ numbers. Note the Linux specific bits are not necessarily |
51 |
+diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt |
52 |
+index 7eb9366422f54..3c617d620b6f8 100644 |
53 |
+--- a/Documentation/networking/ip-sysctl.txt |
54 |
++++ b/Documentation/networking/ip-sysctl.txt |
55 |
+@@ -934,12 +934,14 @@ icmp_ratelimit - INTEGER |
56 |
+ icmp_msgs_per_sec - INTEGER |
57 |
+ Limit maximal number of ICMP packets sent per second from this host. |
58 |
+ Only messages whose type matches icmp_ratemask (see below) are |
59 |
+- controlled by this limit. |
60 |
++ controlled by this limit. For security reasons, the precise count |
61 |
++ of messages per second is randomized. |
62 |
+ Default: 1000 |
63 |
+ |
64 |
+ icmp_msgs_burst - INTEGER |
65 |
+ icmp_msgs_per_sec controls number of ICMP packets sent per second, |
66 |
+ while icmp_msgs_burst controls the burst size of these packets. |
67 |
++ For security reasons, the precise burst size is randomized. |
68 |
+ Default: 50 |
69 |
+ |
70 |
+ icmp_ratemask - INTEGER |
71 |
+diff --git a/Makefile b/Makefile |
72 |
+index aa79ce7bfdc73..d5e93bf207998 100644 |
73 |
+--- a/Makefile |
74 |
++++ b/Makefile |
75 |
+@@ -1,7 +1,7 @@ |
76 |
+ # SPDX-License-Identifier: GPL-2.0 |
77 |
+ VERSION = 4 |
78 |
+ PATCHLEVEL = 19 |
79 |
+-SUBLEVEL = 152 |
80 |
++SUBLEVEL = 153 |
81 |
+ EXTRAVERSION = |
82 |
+ NAME = "People's Front" |
83 |
+ |
84 |
+diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig |
85 |
+index c285a83cbf08f..df35ea1912e8b 100644 |
86 |
+--- a/arch/arc/plat-hsdk/Kconfig |
87 |
++++ b/arch/arc/plat-hsdk/Kconfig |
88 |
+@@ -11,5 +11,6 @@ menuconfig ARC_SOC_HSDK |
89 |
+ select ARC_HAS_ACCL_REGS |
90 |
+ select ARC_IRQ_NO_AUTOSAVE |
91 |
+ select CLK_HSDK |
92 |
++ select RESET_CONTROLLER |
93 |
+ select RESET_HSDK |
94 |
+ select MIGHT_HAVE_PCI |
95 |
+diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c |
96 |
+index 808efbb89b88c..02f613def40dc 100644 |
97 |
+--- a/arch/arm/mm/cache-l2x0.c |
98 |
++++ b/arch/arm/mm/cache-l2x0.c |
99 |
+@@ -1261,20 +1261,28 @@ static void __init l2c310_of_parse(const struct device_node *np, |
100 |
+ |
101 |
+ ret = of_property_read_u32(np, "prefetch-data", &val); |
102 |
+ if (ret == 0) { |
103 |
+- if (val) |
104 |
++ if (val) { |
105 |
+ prefetch |= L310_PREFETCH_CTRL_DATA_PREFETCH; |
106 |
+- else |
107 |
++ *aux_val |= L310_PREFETCH_CTRL_DATA_PREFETCH; |
108 |
++ } else { |
109 |
+ prefetch &= ~L310_PREFETCH_CTRL_DATA_PREFETCH; |
110 |
++ *aux_val &= ~L310_PREFETCH_CTRL_DATA_PREFETCH; |
111 |
++ } |
112 |
++ *aux_mask &= ~L310_PREFETCH_CTRL_DATA_PREFETCH; |
113 |
+ } else if (ret != -EINVAL) { |
114 |
+ pr_err("L2C-310 OF prefetch-data property value is missing\n"); |
115 |
+ } |
116 |
+ |
117 |
+ ret = of_property_read_u32(np, "prefetch-instr", &val); |
118 |
+ if (ret == 0) { |
119 |
+- if (val) |
120 |
++ if (val) { |
121 |
+ prefetch |= L310_PREFETCH_CTRL_INSTR_PREFETCH; |
122 |
+- else |
123 |
++ *aux_val |= L310_PREFETCH_CTRL_INSTR_PREFETCH; |
124 |
++ } else { |
125 |
+ prefetch &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH; |
126 |
++ *aux_val &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH; |
127 |
++ } |
128 |
++ *aux_mask &= ~L310_PREFETCH_CTRL_INSTR_PREFETCH; |
129 |
+ } else if (ret != -EINVAL) { |
130 |
+ pr_err("L2C-310 OF prefetch-instr property value is missing\n"); |
131 |
+ } |
132 |
+diff --git a/arch/powerpc/include/asm/drmem.h b/arch/powerpc/include/asm/drmem.h |
133 |
+index 9e516fe3daaba..668d8a121f1a0 100644 |
134 |
+--- a/arch/powerpc/include/asm/drmem.h |
135 |
++++ b/arch/powerpc/include/asm/drmem.h |
136 |
+@@ -12,6 +12,8 @@ |
137 |
+ #ifndef _ASM_POWERPC_LMB_H |
138 |
+ #define _ASM_POWERPC_LMB_H |
139 |
+ |
140 |
++#include <linux/sched.h> |
141 |
++ |
142 |
+ struct drmem_lmb { |
143 |
+ u64 base_addr; |
144 |
+ u32 drc_index; |
145 |
+@@ -27,8 +29,22 @@ struct drmem_lmb_info { |
146 |
+ |
147 |
+ extern struct drmem_lmb_info *drmem_info; |
148 |
+ |
149 |
++static inline struct drmem_lmb *drmem_lmb_next(struct drmem_lmb *lmb, |
150 |
++ const struct drmem_lmb *start) |
151 |
++{ |
152 |
++ /* |
153 |
++ * DLPAR code paths can take several milliseconds per element |
154 |
++ * when interacting with firmware. Ensure that we don't |
155 |
++ * unfairly monopolize the CPU. |
156 |
++ */ |
157 |
++ if (((++lmb - start) % 16) == 0) |
158 |
++ cond_resched(); |
159 |
++ |
160 |
++ return lmb; |
161 |
++} |
162 |
++ |
163 |
+ #define for_each_drmem_lmb_in_range(lmb, start, end) \ |
164 |
+- for ((lmb) = (start); (lmb) < (end); (lmb)++) |
165 |
++ for ((lmb) = (start); (lmb) < (end); lmb = drmem_lmb_next(lmb, start)) |
166 |
+ |
167 |
+ #define for_each_drmem_lmb(lmb) \ |
168 |
+ for_each_drmem_lmb_in_range((lmb), \ |
169 |
+diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h |
170 |
+index af99716615122..494b0283f2129 100644 |
171 |
+--- a/arch/powerpc/include/asm/reg.h |
172 |
++++ b/arch/powerpc/include/asm/reg.h |
173 |
+@@ -788,7 +788,7 @@ |
174 |
+ #define THRM1_TIN (1 << 31) |
175 |
+ #define THRM1_TIV (1 << 30) |
176 |
+ #define THRM1_THRES(x) ((x&0x7f)<<23) |
177 |
+-#define THRM3_SITV(x) ((x&0x3fff)<<1) |
178 |
++#define THRM3_SITV(x) ((x & 0x1fff) << 1) |
179 |
+ #define THRM1_TID (1<<2) |
180 |
+ #define THRM1_TIE (1<<1) |
181 |
+ #define THRM1_V (1<<0) |
182 |
+diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c |
183 |
+index e2ab8a111b693..a130473f16e5b 100644 |
184 |
+--- a/arch/powerpc/kernel/tau_6xx.c |
185 |
++++ b/arch/powerpc/kernel/tau_6xx.c |
186 |
+@@ -13,13 +13,14 @@ |
187 |
+ */ |
188 |
+ |
189 |
+ #include <linux/errno.h> |
190 |
+-#include <linux/jiffies.h> |
191 |
+ #include <linux/kernel.h> |
192 |
+ #include <linux/param.h> |
193 |
+ #include <linux/string.h> |
194 |
+ #include <linux/mm.h> |
195 |
+ #include <linux/interrupt.h> |
196 |
+ #include <linux/init.h> |
197 |
++#include <linux/delay.h> |
198 |
++#include <linux/workqueue.h> |
199 |
+ |
200 |
+ #include <asm/io.h> |
201 |
+ #include <asm/reg.h> |
202 |
+@@ -39,8 +40,6 @@ static struct tau_temp |
203 |
+ unsigned char grew; |
204 |
+ } tau[NR_CPUS]; |
205 |
+ |
206 |
+-struct timer_list tau_timer; |
207 |
+- |
208 |
+ #undef DEBUG |
209 |
+ |
210 |
+ /* TODO: put these in a /proc interface, with some sanity checks, and maybe |
211 |
+@@ -50,7 +49,7 @@ struct timer_list tau_timer; |
212 |
+ #define step_size 2 /* step size when temp goes out of range */ |
213 |
+ #define window_expand 1 /* expand the window by this much */ |
214 |
+ /* configurable values for shrinking the window */ |
215 |
+-#define shrink_timer 2*HZ /* period between shrinking the window */ |
216 |
++#define shrink_timer 2000 /* period between shrinking the window */ |
217 |
+ #define min_window 2 /* minimum window size, degrees C */ |
218 |
+ |
219 |
+ static void set_thresholds(unsigned long cpu) |
220 |
+@@ -111,11 +110,6 @@ static void TAUupdate(int cpu) |
221 |
+ #ifdef DEBUG |
222 |
+ printk("grew = %d\n", tau[cpu].grew); |
223 |
+ #endif |
224 |
+- |
225 |
+-#ifndef CONFIG_TAU_INT /* tau_timeout will do this if not using interrupts */ |
226 |
+- set_thresholds(cpu); |
227 |
+-#endif |
228 |
+- |
229 |
+ } |
230 |
+ |
231 |
+ #ifdef CONFIG_TAU_INT |
232 |
+@@ -178,27 +172,27 @@ static void tau_timeout(void * info) |
233 |
+ * complex sleep code needs to be added. One mtspr every time |
234 |
+ * tau_timeout is called is probably not a big deal. |
235 |
+ * |
236 |
+- * Enable thermal sensor and set up sample interval timer |
237 |
+- * need 20 us to do the compare.. until a nice 'cpu_speed' function |
238 |
+- * call is implemented, just assume a 500 mhz clock. It doesn't really |
239 |
+- * matter if we take too long for a compare since it's all interrupt |
240 |
+- * driven anyway. |
241 |
+- * |
242 |
+- * use a extra long time.. (60 us @ 500 mhz) |
243 |
++ * The "PowerPC 740 and PowerPC 750 Microprocessor Datasheet" |
244 |
++ * recommends that "the maximum value be set in THRM3 under all |
245 |
++ * conditions." |
246 |
+ */ |
247 |
+- mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E); |
248 |
++ mtspr(SPRN_THRM3, THRM3_SITV(0x1fff) | THRM3_E); |
249 |
+ |
250 |
+ local_irq_restore(flags); |
251 |
+ } |
252 |
+ |
253 |
+-static void tau_timeout_smp(struct timer_list *unused) |
254 |
+-{ |
255 |
++static struct workqueue_struct *tau_workq; |
256 |
+ |
257 |
+- /* schedule ourselves to be run again */ |
258 |
+- mod_timer(&tau_timer, jiffies + shrink_timer) ; |
259 |
++static void tau_work_func(struct work_struct *work) |
260 |
++{ |
261 |
++ msleep(shrink_timer); |
262 |
+ on_each_cpu(tau_timeout, NULL, 0); |
263 |
++ /* schedule ourselves to be run again */ |
264 |
++ queue_work(tau_workq, work); |
265 |
+ } |
266 |
+ |
267 |
++DECLARE_WORK(tau_work, tau_work_func); |
268 |
++ |
269 |
+ /* |
270 |
+ * setup the TAU |
271 |
+ * |
272 |
+@@ -231,21 +225,16 @@ static int __init TAU_init(void) |
273 |
+ return 1; |
274 |
+ } |
275 |
+ |
276 |
+- |
277 |
+- /* first, set up the window shrinking timer */ |
278 |
+- timer_setup(&tau_timer, tau_timeout_smp, 0); |
279 |
+- tau_timer.expires = jiffies + shrink_timer; |
280 |
+- add_timer(&tau_timer); |
281 |
++ tau_workq = alloc_workqueue("tau", WQ_UNBOUND, 1); |
282 |
++ if (!tau_workq) |
283 |
++ return -ENOMEM; |
284 |
+ |
285 |
+ on_each_cpu(TAU_init_smp, NULL, 0); |
286 |
+ |
287 |
+- printk("Thermal assist unit "); |
288 |
+-#ifdef CONFIG_TAU_INT |
289 |
+- printk("using interrupts, "); |
290 |
+-#else |
291 |
+- printk("using timers, "); |
292 |
+-#endif |
293 |
+- printk("shrink_timer: %d jiffies\n", shrink_timer); |
294 |
++ queue_work(tau_workq, &tau_work); |
295 |
++ |
296 |
++ pr_info("Thermal assist unit using %s, shrink_timer: %d ms\n", |
297 |
++ IS_ENABLED(CONFIG_TAU_INT) ? "interrupts" : "workqueue", shrink_timer); |
298 |
+ tau_initialized = 1; |
299 |
+ |
300 |
+ return 0; |
301 |
+diff --git a/arch/powerpc/platforms/pseries/rng.c b/arch/powerpc/platforms/pseries/rng.c |
302 |
+index 31ca557af60bc..262b8c5e1b9d0 100644 |
303 |
+--- a/arch/powerpc/platforms/pseries/rng.c |
304 |
++++ b/arch/powerpc/platforms/pseries/rng.c |
305 |
+@@ -40,6 +40,7 @@ static __init int rng_init(void) |
306 |
+ |
307 |
+ ppc_md.get_random_seed = pseries_get_random_long; |
308 |
+ |
309 |
++ of_node_put(dn); |
310 |
+ return 0; |
311 |
+ } |
312 |
+ machine_subsys_initcall(pseries, rng_init); |
313 |
+diff --git a/arch/powerpc/sysdev/xics/icp-hv.c b/arch/powerpc/sysdev/xics/icp-hv.c |
314 |
+index bbc839a98c414..003deaabb5680 100644 |
315 |
+--- a/arch/powerpc/sysdev/xics/icp-hv.c |
316 |
++++ b/arch/powerpc/sysdev/xics/icp-hv.c |
317 |
+@@ -179,6 +179,7 @@ int icp_hv_init(void) |
318 |
+ |
319 |
+ icp_ops = &icp_hv_ops; |
320 |
+ |
321 |
++ of_node_put(np); |
322 |
+ return 0; |
323 |
+ } |
324 |
+ |
325 |
+diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c |
326 |
+index 3210fee27e7f9..0014d26391fa6 100644 |
327 |
+--- a/arch/x86/events/amd/iommu.c |
328 |
++++ b/arch/x86/events/amd/iommu.c |
329 |
+@@ -387,7 +387,7 @@ static __init int _init_events_attrs(void) |
330 |
+ while (amd_iommu_v2_event_descs[i].attr.attr.name) |
331 |
+ i++; |
332 |
+ |
333 |
+- attrs = kcalloc(i + 1, sizeof(struct attribute **), GFP_KERNEL); |
334 |
++ attrs = kcalloc(i + 1, sizeof(*attrs), GFP_KERNEL); |
335 |
+ if (!attrs) |
336 |
+ return -ENOMEM; |
337 |
+ |
338 |
+diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c |
339 |
+index 6abd83572b016..9692ccc583bb3 100644 |
340 |
+--- a/arch/x86/kernel/fpu/init.c |
341 |
++++ b/arch/x86/kernel/fpu/init.c |
342 |
+@@ -249,9 +249,9 @@ static void __init fpu__init_system_ctx_switch(void) |
343 |
+ */ |
344 |
+ static void __init fpu__init_parse_early_param(void) |
345 |
+ { |
346 |
+- char arg[32]; |
347 |
++ char arg[128]; |
348 |
+ char *argptr = arg; |
349 |
+- int bit; |
350 |
++ int arglen, res, bit; |
351 |
+ |
352 |
+ if (cmdline_find_option_bool(boot_command_line, "no387")) |
353 |
+ setup_clear_cpu_cap(X86_FEATURE_FPU); |
354 |
+@@ -271,12 +271,26 @@ static void __init fpu__init_parse_early_param(void) |
355 |
+ if (cmdline_find_option_bool(boot_command_line, "noxsaves")) |
356 |
+ setup_clear_cpu_cap(X86_FEATURE_XSAVES); |
357 |
+ |
358 |
+- if (cmdline_find_option(boot_command_line, "clearcpuid", arg, |
359 |
+- sizeof(arg)) && |
360 |
+- get_option(&argptr, &bit) && |
361 |
+- bit >= 0 && |
362 |
+- bit < NCAPINTS * 32) |
363 |
+- setup_clear_cpu_cap(bit); |
364 |
++ arglen = cmdline_find_option(boot_command_line, "clearcpuid", arg, sizeof(arg)); |
365 |
++ if (arglen <= 0) |
366 |
++ return; |
367 |
++ |
368 |
++ pr_info("Clearing CPUID bits:"); |
369 |
++ do { |
370 |
++ res = get_option(&argptr, &bit); |
371 |
++ if (res == 0 || res == 3) |
372 |
++ break; |
373 |
++ |
374 |
++ /* If the argument was too long, the last bit may be cut off */ |
375 |
++ if (res == 1 && arglen >= sizeof(arg)) |
376 |
++ break; |
377 |
++ |
378 |
++ if (bit >= 0 && bit < NCAPINTS * 32) { |
379 |
++ pr_cont(" " X86_CAP_FMT, x86_cap_flag(bit)); |
380 |
++ setup_clear_cpu_cap(bit); |
381 |
++ } |
382 |
++ } while (res == 2); |
383 |
++ pr_cont("\n"); |
384 |
+ } |
385 |
+ |
386 |
+ /* |
387 |
+diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c |
388 |
+index 0f8b9b900b0e7..996eb53f8eb75 100644 |
389 |
+--- a/arch/x86/kernel/nmi.c |
390 |
++++ b/arch/x86/kernel/nmi.c |
391 |
+@@ -104,7 +104,6 @@ fs_initcall(nmi_warning_debugfs); |
392 |
+ |
393 |
+ static void nmi_check_duration(struct nmiaction *action, u64 duration) |
394 |
+ { |
395 |
+- u64 whole_msecs = READ_ONCE(action->max_duration); |
396 |
+ int remainder_ns, decimal_msecs; |
397 |
+ |
398 |
+ if (duration < nmi_longest_ns || duration < action->max_duration) |
399 |
+@@ -112,12 +111,12 @@ static void nmi_check_duration(struct nmiaction *action, u64 duration) |
400 |
+ |
401 |
+ action->max_duration = duration; |
402 |
+ |
403 |
+- remainder_ns = do_div(whole_msecs, (1000 * 1000)); |
404 |
++ remainder_ns = do_div(duration, (1000 * 1000)); |
405 |
+ decimal_msecs = remainder_ns / 1000; |
406 |
+ |
407 |
+ printk_ratelimited(KERN_INFO |
408 |
+ "INFO: NMI handler (%ps) took too long to run: %lld.%03d msecs\n", |
409 |
+- action->handler, whole_msecs, decimal_msecs); |
410 |
++ action->handler, duration, decimal_msecs); |
411 |
+ } |
412 |
+ |
413 |
+ static int nmi_handle(unsigned int type, struct pt_regs *regs) |
414 |
+diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c |
415 |
+index a2ff5c214738a..5faa49a95ac97 100644 |
416 |
+--- a/arch/x86/kvm/mmu.c |
417 |
++++ b/arch/x86/kvm/mmu.c |
418 |
+@@ -6225,6 +6225,7 @@ static void kvm_recover_nx_lpages(struct kvm *kvm) |
419 |
+ cond_resched_lock(&kvm->mmu_lock); |
420 |
+ } |
421 |
+ } |
422 |
++ kvm_mmu_commit_zap_page(kvm, &invalid_list); |
423 |
+ |
424 |
+ spin_unlock(&kvm->mmu_lock); |
425 |
+ srcu_read_unlock(&kvm->srcu, rcu_idx); |
426 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
427 |
+index cb09a0ec87500..a0c3d1b4b295b 100644 |
428 |
+--- a/arch/x86/kvm/svm.c |
429 |
++++ b/arch/x86/kvm/svm.c |
430 |
+@@ -5380,6 +5380,7 @@ static int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq, |
431 |
+ * - Tell IOMMU to use legacy mode for this interrupt. |
432 |
+ * - Retrieve ga_tag of prior interrupt remapping data. |
433 |
+ */ |
434 |
++ pi.prev_ga_tag = 0; |
435 |
+ pi.is_guest_mode = false; |
436 |
+ ret = irq_set_vcpu_affinity(host_irq, &pi); |
437 |
+ |
438 |
+diff --git a/crypto/algif_aead.c b/crypto/algif_aead.c |
439 |
+index b4f16202ab7af..182783801ffa6 100644 |
440 |
+--- a/crypto/algif_aead.c |
441 |
++++ b/crypto/algif_aead.c |
442 |
+@@ -82,7 +82,7 @@ static int crypto_aead_copy_sgl(struct crypto_skcipher *null_tfm, |
443 |
+ SKCIPHER_REQUEST_ON_STACK(skreq, null_tfm); |
444 |
+ |
445 |
+ skcipher_request_set_tfm(skreq, null_tfm); |
446 |
+- skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_BACKLOG, |
447 |
++ skcipher_request_set_callback(skreq, CRYPTO_TFM_REQ_MAY_SLEEP, |
448 |
+ NULL, NULL); |
449 |
+ skcipher_request_set_crypt(skreq, src, dst, len, NULL); |
450 |
+ |
451 |
+@@ -295,19 +295,20 @@ static int _aead_recvmsg(struct socket *sock, struct msghdr *msg, |
452 |
+ areq->outlen = outlen; |
453 |
+ |
454 |
+ aead_request_set_callback(&areq->cra_u.aead_req, |
455 |
+- CRYPTO_TFM_REQ_MAY_BACKLOG, |
456 |
++ CRYPTO_TFM_REQ_MAY_SLEEP, |
457 |
+ af_alg_async_cb, areq); |
458 |
+ err = ctx->enc ? crypto_aead_encrypt(&areq->cra_u.aead_req) : |
459 |
+ crypto_aead_decrypt(&areq->cra_u.aead_req); |
460 |
+ |
461 |
+ /* AIO operation in progress */ |
462 |
+- if (err == -EINPROGRESS || err == -EBUSY) |
463 |
++ if (err == -EINPROGRESS) |
464 |
+ return -EIOCBQUEUED; |
465 |
+ |
466 |
+ sock_put(sk); |
467 |
+ } else { |
468 |
+ /* Synchronous operation */ |
469 |
+ aead_request_set_callback(&areq->cra_u.aead_req, |
470 |
++ CRYPTO_TFM_REQ_MAY_SLEEP | |
471 |
+ CRYPTO_TFM_REQ_MAY_BACKLOG, |
472 |
+ crypto_req_done, &ctx->wait); |
473 |
+ err = crypto_wait_req(ctx->enc ? |
474 |
+diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c |
475 |
+index 1cb106c46043d..9d2e9783c0d4e 100644 |
476 |
+--- a/crypto/algif_skcipher.c |
477 |
++++ b/crypto/algif_skcipher.c |
478 |
+@@ -127,7 +127,7 @@ static int _skcipher_recvmsg(struct socket *sock, struct msghdr *msg, |
479 |
+ crypto_skcipher_decrypt(&areq->cra_u.skcipher_req); |
480 |
+ |
481 |
+ /* AIO operation in progress */ |
482 |
+- if (err == -EINPROGRESS || err == -EBUSY) |
483 |
++ if (err == -EINPROGRESS) |
484 |
+ return -EIOCBQUEUED; |
485 |
+ |
486 |
+ sock_put(sk); |
487 |
+diff --git a/drivers/android/binder.c b/drivers/android/binder.c |
488 |
+index 112b5b50ad3c4..cda4f7eb58ead 100644 |
489 |
+--- a/drivers/android/binder.c |
490 |
++++ b/drivers/android/binder.c |
491 |
+@@ -285,7 +285,7 @@ struct binder_device { |
492 |
+ struct binder_work { |
493 |
+ struct list_head entry; |
494 |
+ |
495 |
+- enum { |
496 |
++ enum binder_work_type { |
497 |
+ BINDER_WORK_TRANSACTION = 1, |
498 |
+ BINDER_WORK_TRANSACTION_COMPLETE, |
499 |
+ BINDER_WORK_RETURN_ERROR, |
500 |
+@@ -895,27 +895,6 @@ static struct binder_work *binder_dequeue_work_head_ilocked( |
501 |
+ return w; |
502 |
+ } |
503 |
+ |
504 |
+-/** |
505 |
+- * binder_dequeue_work_head() - Dequeues the item at head of list |
506 |
+- * @proc: binder_proc associated with list |
507 |
+- * @list: list to dequeue head |
508 |
+- * |
509 |
+- * Removes the head of the list if there are items on the list |
510 |
+- * |
511 |
+- * Return: pointer dequeued binder_work, NULL if list was empty |
512 |
+- */ |
513 |
+-static struct binder_work *binder_dequeue_work_head( |
514 |
+- struct binder_proc *proc, |
515 |
+- struct list_head *list) |
516 |
+-{ |
517 |
+- struct binder_work *w; |
518 |
+- |
519 |
+- binder_inner_proc_lock(proc); |
520 |
+- w = binder_dequeue_work_head_ilocked(list); |
521 |
+- binder_inner_proc_unlock(proc); |
522 |
+- return w; |
523 |
+-} |
524 |
+- |
525 |
+ static void |
526 |
+ binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer); |
527 |
+ static void binder_free_thread(struct binder_thread *thread); |
528 |
+@@ -4242,13 +4221,17 @@ static void binder_release_work(struct binder_proc *proc, |
529 |
+ struct list_head *list) |
530 |
+ { |
531 |
+ struct binder_work *w; |
532 |
++ enum binder_work_type wtype; |
533 |
+ |
534 |
+ while (1) { |
535 |
+- w = binder_dequeue_work_head(proc, list); |
536 |
++ binder_inner_proc_lock(proc); |
537 |
++ w = binder_dequeue_work_head_ilocked(list); |
538 |
++ wtype = w ? w->type : 0; |
539 |
++ binder_inner_proc_unlock(proc); |
540 |
+ if (!w) |
541 |
+ return; |
542 |
+ |
543 |
+- switch (w->type) { |
544 |
++ switch (wtype) { |
545 |
+ case BINDER_WORK_TRANSACTION: { |
546 |
+ struct binder_transaction *t; |
547 |
+ |
548 |
+@@ -4282,9 +4265,11 @@ static void binder_release_work(struct binder_proc *proc, |
549 |
+ kfree(death); |
550 |
+ binder_stats_deleted(BINDER_STAT_DEATH); |
551 |
+ } break; |
552 |
++ case BINDER_WORK_NODE: |
553 |
++ break; |
554 |
+ default: |
555 |
+ pr_err("unexpected work type, %d, not freed\n", |
556 |
+- w->type); |
557 |
++ wtype); |
558 |
+ break; |
559 |
+ } |
560 |
+ } |
561 |
+diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c |
562 |
+index efeb8137ec67f..48560e646e53e 100644 |
563 |
+--- a/drivers/bluetooth/hci_ldisc.c |
564 |
++++ b/drivers/bluetooth/hci_ldisc.c |
565 |
+@@ -545,6 +545,7 @@ static void hci_uart_tty_close(struct tty_struct *tty) |
566 |
+ clear_bit(HCI_UART_PROTO_READY, &hu->flags); |
567 |
+ percpu_up_write(&hu->proto_lock); |
568 |
+ |
569 |
++ cancel_work_sync(&hu->init_ready); |
570 |
+ cancel_work_sync(&hu->write_work); |
571 |
+ |
572 |
+ if (hdev) { |
573 |
+diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c |
574 |
+index d3fb0d657fa52..7b3aade431e5e 100644 |
575 |
+--- a/drivers/bluetooth/hci_serdev.c |
576 |
++++ b/drivers/bluetooth/hci_serdev.c |
577 |
+@@ -369,6 +369,8 @@ void hci_uart_unregister_device(struct hci_uart *hu) |
578 |
+ struct hci_dev *hdev = hu->hdev; |
579 |
+ |
580 |
+ clear_bit(HCI_UART_PROTO_READY, &hu->flags); |
581 |
++ |
582 |
++ cancel_work_sync(&hu->init_ready); |
583 |
+ if (test_bit(HCI_UART_REGISTERED, &hu->flags)) |
584 |
+ hci_unregister_dev(hdev); |
585 |
+ hci_free_dev(hdev); |
586 |
+diff --git a/drivers/cpufreq/armada-37xx-cpufreq.c b/drivers/cpufreq/armada-37xx-cpufreq.c |
587 |
+index c5f98cafc25c9..9b0b490d70ff4 100644 |
588 |
+--- a/drivers/cpufreq/armada-37xx-cpufreq.c |
589 |
++++ b/drivers/cpufreq/armada-37xx-cpufreq.c |
590 |
+@@ -486,6 +486,12 @@ remove_opp: |
591 |
+ /* late_initcall, to guarantee the driver is loaded after A37xx clock driver */ |
592 |
+ late_initcall(armada37xx_cpufreq_driver_init); |
593 |
+ |
594 |
++static const struct of_device_id __maybe_unused armada37xx_cpufreq_of_match[] = { |
595 |
++ { .compatible = "marvell,armada-3700-nb-pm" }, |
596 |
++ { }, |
597 |
++}; |
598 |
++MODULE_DEVICE_TABLE(of, armada37xx_cpufreq_of_match); |
599 |
++ |
600 |
+ MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@××××××××××××××.com>"); |
601 |
+ MODULE_DESCRIPTION("Armada 37xx cpufreq driver"); |
602 |
+ MODULE_LICENSE("GPL"); |
603 |
+diff --git a/drivers/crypto/chelsio/chtls/chtls_cm.c b/drivers/crypto/chelsio/chtls/chtls_cm.c |
604 |
+index 28d24118c6450..f1ca66147c287 100644 |
605 |
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c |
606 |
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c |
607 |
+@@ -1057,6 +1057,9 @@ static struct sock *chtls_recv_sock(struct sock *lsk, |
608 |
+ ndev = n->dev; |
609 |
+ if (!ndev) |
610 |
+ goto free_dst; |
611 |
++ if (is_vlan_dev(ndev)) |
612 |
++ ndev = vlan_dev_real_dev(ndev); |
613 |
++ |
614 |
+ port_id = cxgb4_port_idx(ndev); |
615 |
+ |
616 |
+ csk = chtls_sock_create(cdev); |
617 |
+diff --git a/drivers/crypto/chelsio/chtls/chtls_io.c b/drivers/crypto/chelsio/chtls/chtls_io.c |
618 |
+index 2c1f3ddb0cc79..e9573e7f9e803 100644 |
619 |
+--- a/drivers/crypto/chelsio/chtls/chtls_io.c |
620 |
++++ b/drivers/crypto/chelsio/chtls/chtls_io.c |
621 |
+@@ -914,9 +914,9 @@ static int tls_header_read(struct tls_hdr *thdr, struct iov_iter *from) |
622 |
+ return (__force int)cpu_to_be16(thdr->length); |
623 |
+ } |
624 |
+ |
625 |
+-static int csk_mem_free(struct chtls_dev *cdev, struct sock *sk) |
626 |
++static bool csk_mem_free(struct chtls_dev *cdev, struct sock *sk) |
627 |
+ { |
628 |
+- return (cdev->max_host_sndbuf - sk->sk_wmem_queued); |
629 |
++ return (cdev->max_host_sndbuf - sk->sk_wmem_queued > 0); |
630 |
+ } |
631 |
+ |
632 |
+ static int csk_wait_memory(struct chtls_dev *cdev, |
633 |
+@@ -1217,6 +1217,7 @@ int chtls_sendpage(struct sock *sk, struct page *page, |
634 |
+ copied = 0; |
635 |
+ csk = rcu_dereference_sk_user_data(sk); |
636 |
+ cdev = csk->cdev; |
637 |
++ lock_sock(sk); |
638 |
+ timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); |
639 |
+ |
640 |
+ err = sk_stream_wait_connect(sk, &timeo); |
641 |
+diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c |
642 |
+index 27f7dad2d45d9..9b7b8558db31d 100644 |
643 |
+--- a/drivers/crypto/ixp4xx_crypto.c |
644 |
++++ b/drivers/crypto/ixp4xx_crypto.c |
645 |
+@@ -530,7 +530,7 @@ static void release_ixp_crypto(struct device *dev) |
646 |
+ |
647 |
+ if (crypt_virt) { |
648 |
+ dma_free_coherent(dev, |
649 |
+- NPE_QLEN_TOTAL * sizeof( struct crypt_ctl), |
650 |
++ NPE_QLEN * sizeof(struct crypt_ctl), |
651 |
+ crypt_virt, crypt_phys); |
652 |
+ } |
653 |
+ } |
654 |
+diff --git a/drivers/crypto/mediatek/mtk-platform.c b/drivers/crypto/mediatek/mtk-platform.c |
655 |
+index ee0404e27a0f2..e4d7ef3bfb61d 100644 |
656 |
+--- a/drivers/crypto/mediatek/mtk-platform.c |
657 |
++++ b/drivers/crypto/mediatek/mtk-platform.c |
658 |
+@@ -446,7 +446,7 @@ static void mtk_desc_dma_free(struct mtk_cryp *cryp) |
659 |
+ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp) |
660 |
+ { |
661 |
+ struct mtk_ring **ring = cryp->ring; |
662 |
+- int i, err = ENOMEM; |
663 |
++ int i; |
664 |
+ |
665 |
+ for (i = 0; i < MTK_RING_MAX; i++) { |
666 |
+ ring[i] = kzalloc(sizeof(**ring), GFP_KERNEL); |
667 |
+@@ -473,14 +473,14 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp) |
668 |
+ return 0; |
669 |
+ |
670 |
+ err_cleanup: |
671 |
+- for (; i--; ) { |
672 |
++ do { |
673 |
+ dma_free_coherent(cryp->dev, MTK_DESC_RING_SZ, |
674 |
+ ring[i]->res_base, ring[i]->res_dma); |
675 |
+ dma_free_coherent(cryp->dev, MTK_DESC_RING_SZ, |
676 |
+ ring[i]->cmd_base, ring[i]->cmd_dma); |
677 |
+ kfree(ring[i]); |
678 |
+- } |
679 |
+- return err; |
680 |
++ } while (i--); |
681 |
++ return -ENOMEM; |
682 |
+ } |
683 |
+ |
684 |
+ static int mtk_crypto_probe(struct platform_device *pdev) |
685 |
+diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
686 |
+index 2faaa4069cdd8..4d31ef4724366 100644 |
687 |
+--- a/drivers/crypto/omap-sham.c |
688 |
++++ b/drivers/crypto/omap-sham.c |
689 |
+@@ -456,6 +456,9 @@ static void omap_sham_write_ctrl_omap4(struct omap_sham_dev *dd, size_t length, |
690 |
+ struct omap_sham_reqctx *ctx = ahash_request_ctx(dd->req); |
691 |
+ u32 val, mask; |
692 |
+ |
693 |
++ if (likely(ctx->digcnt)) |
694 |
++ omap_sham_write(dd, SHA_REG_DIGCNT(dd), ctx->digcnt); |
695 |
++ |
696 |
+ /* |
697 |
+ * Setting ALGO_CONST only for the first iteration and |
698 |
+ * CLOSE_HASH only for the last one. Note that flags mode bits |
699 |
+diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c |
700 |
+index e2491754c468f..1ef47f7208b92 100644 |
701 |
+--- a/drivers/crypto/picoxcell_crypto.c |
702 |
++++ b/drivers/crypto/picoxcell_crypto.c |
703 |
+@@ -1701,11 +1701,6 @@ static int spacc_probe(struct platform_device *pdev) |
704 |
+ goto err_clk_put; |
705 |
+ } |
706 |
+ |
707 |
+- ret = device_create_file(&pdev->dev, &dev_attr_stat_irq_thresh); |
708 |
+- if (ret) |
709 |
+- goto err_clk_disable; |
710 |
+- |
711 |
+- |
712 |
+ /* |
713 |
+ * Use an IRQ threshold of 50% as a default. This seems to be a |
714 |
+ * reasonable trade off of latency against throughput but can be |
715 |
+@@ -1713,6 +1708,10 @@ static int spacc_probe(struct platform_device *pdev) |
716 |
+ */ |
717 |
+ engine->stat_irq_thresh = (engine->fifo_sz / 2); |
718 |
+ |
719 |
++ ret = device_create_file(&pdev->dev, &dev_attr_stat_irq_thresh); |
720 |
++ if (ret) |
721 |
++ goto err_clk_disable; |
722 |
++ |
723 |
+ /* |
724 |
+ * Configure the interrupts. We only use the STAT_CNT interrupt as we |
725 |
+ * only submit a new packet for processing when we complete another in |
726 |
+diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c |
727 |
+index b506eef6b146d..858ef4e15180b 100644 |
728 |
+--- a/drivers/edac/i5100_edac.c |
729 |
++++ b/drivers/edac/i5100_edac.c |
730 |
+@@ -1072,16 +1072,15 @@ static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
731 |
+ PCI_DEVICE_ID_INTEL_5100_19, 0); |
732 |
+ if (!einj) { |
733 |
+ ret = -ENODEV; |
734 |
+- goto bail_einj; |
735 |
++ goto bail_mc_free; |
736 |
+ } |
737 |
+ |
738 |
+ rc = pci_enable_device(einj); |
739 |
+ if (rc < 0) { |
740 |
+ ret = rc; |
741 |
+- goto bail_disable_einj; |
742 |
++ goto bail_einj; |
743 |
+ } |
744 |
+ |
745 |
+- |
746 |
+ mci->pdev = &pdev->dev; |
747 |
+ |
748 |
+ priv = mci->pvt_info; |
749 |
+@@ -1147,14 +1146,14 @@ static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id) |
750 |
+ bail_scrub: |
751 |
+ priv->scrub_enable = 0; |
752 |
+ cancel_delayed_work_sync(&(priv->i5100_scrubbing)); |
753 |
+- edac_mc_free(mci); |
754 |
+- |
755 |
+-bail_disable_einj: |
756 |
+ pci_disable_device(einj); |
757 |
+ |
758 |
+ bail_einj: |
759 |
+ pci_dev_put(einj); |
760 |
+ |
761 |
++bail_mc_free: |
762 |
++ edac_mc_free(mci); |
763 |
++ |
764 |
+ bail_disable_ch1: |
765 |
+ pci_disable_device(ch1mm); |
766 |
+ |
767 |
+diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c |
768 |
+index 6ac26d1b929f0..3247689467435 100644 |
769 |
+--- a/drivers/edac/ti_edac.c |
770 |
++++ b/drivers/edac/ti_edac.c |
771 |
+@@ -278,7 +278,8 @@ static int ti_edac_probe(struct platform_device *pdev) |
772 |
+ |
773 |
+ /* add EMIF ECC error handler */ |
774 |
+ error_irq = platform_get_irq(pdev, 0); |
775 |
+- if (!error_irq) { |
776 |
++ if (error_irq < 0) { |
777 |
++ ret = error_irq; |
778 |
+ edac_printk(KERN_ERR, EDAC_MOD_NAME, |
779 |
+ "EMIF irq number not defined.\n"); |
780 |
+ goto err; |
781 |
+diff --git a/drivers/gpu/drm/gma500/cdv_intel_dp.c b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
782 |
+index 90ed20083009f..05eba6dec5ebf 100644 |
783 |
+--- a/drivers/gpu/drm/gma500/cdv_intel_dp.c |
784 |
++++ b/drivers/gpu/drm/gma500/cdv_intel_dp.c |
785 |
+@@ -2119,7 +2119,7 @@ cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev |
786 |
+ intel_dp->dpcd, |
787 |
+ sizeof(intel_dp->dpcd)); |
788 |
+ cdv_intel_edp_panel_vdd_off(gma_encoder); |
789 |
+- if (ret == 0) { |
790 |
++ if (ret <= 0) { |
791 |
+ /* if this fails, presume the device is a ghost */ |
792 |
+ DRM_INFO("failed to retrieve link info, disabling eDP\n"); |
793 |
+ cdv_intel_dp_encoder_destroy(encoder); |
794 |
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c |
795 |
+index a9da1526c40ae..11bd2ca22a2e6 100644 |
796 |
+--- a/drivers/hid/hid-input.c |
797 |
++++ b/drivers/hid/hid-input.c |
798 |
+@@ -796,7 +796,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel |
799 |
+ case 0x3b: /* Battery Strength */ |
800 |
+ hidinput_setup_battery(device, HID_INPUT_REPORT, field); |
801 |
+ usage->type = EV_PWR; |
802 |
+- goto ignore; |
803 |
++ return; |
804 |
+ |
805 |
+ case 0x3c: /* Invert */ |
806 |
+ map_key_clear(BTN_TOOL_RUBBER); |
807 |
+@@ -1052,7 +1052,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel |
808 |
+ case HID_DC_BATTERYSTRENGTH: |
809 |
+ hidinput_setup_battery(device, HID_INPUT_REPORT, field); |
810 |
+ usage->type = EV_PWR; |
811 |
+- goto ignore; |
812 |
++ return; |
813 |
+ } |
814 |
+ goto unknown; |
815 |
+ |
816 |
+diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c |
817 |
+index bf4675a273965..9be8c31f613fd 100644 |
818 |
+--- a/drivers/hid/hid-roccat-kone.c |
819 |
++++ b/drivers/hid/hid-roccat-kone.c |
820 |
+@@ -297,31 +297,40 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, |
821 |
+ struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
822 |
+ struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
823 |
+ int retval = 0, difference, old_profile; |
824 |
++ struct kone_settings *settings = (struct kone_settings *)buf; |
825 |
+ |
826 |
+ /* I need to get my data in one piece */ |
827 |
+ if (off != 0 || count != sizeof(struct kone_settings)) |
828 |
+ return -EINVAL; |
829 |
+ |
830 |
+ mutex_lock(&kone->kone_lock); |
831 |
+- difference = memcmp(buf, &kone->settings, sizeof(struct kone_settings)); |
832 |
++ difference = memcmp(settings, &kone->settings, |
833 |
++ sizeof(struct kone_settings)); |
834 |
+ if (difference) { |
835 |
+- retval = kone_set_settings(usb_dev, |
836 |
+- (struct kone_settings const *)buf); |
837 |
+- if (retval) { |
838 |
+- mutex_unlock(&kone->kone_lock); |
839 |
+- return retval; |
840 |
++ if (settings->startup_profile < 1 || |
841 |
++ settings->startup_profile > 5) { |
842 |
++ retval = -EINVAL; |
843 |
++ goto unlock; |
844 |
+ } |
845 |
+ |
846 |
++ retval = kone_set_settings(usb_dev, settings); |
847 |
++ if (retval) |
848 |
++ goto unlock; |
849 |
++ |
850 |
+ old_profile = kone->settings.startup_profile; |
851 |
+- memcpy(&kone->settings, buf, sizeof(struct kone_settings)); |
852 |
++ memcpy(&kone->settings, settings, sizeof(struct kone_settings)); |
853 |
+ |
854 |
+ kone_profile_activated(kone, kone->settings.startup_profile); |
855 |
+ |
856 |
+ if (kone->settings.startup_profile != old_profile) |
857 |
+ kone_profile_report(kone, kone->settings.startup_profile); |
858 |
+ } |
859 |
++unlock: |
860 |
+ mutex_unlock(&kone->kone_lock); |
861 |
+ |
862 |
++ if (retval) |
863 |
++ return retval; |
864 |
++ |
865 |
+ return sizeof(struct kone_settings); |
866 |
+ } |
867 |
+ static BIN_ATTR(settings, 0660, kone_sysfs_read_settings, |
868 |
+diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c |
869 |
+index 47576c4600105..9af5ab52ca31c 100644 |
870 |
+--- a/drivers/hwmon/pmbus/max34440.c |
871 |
++++ b/drivers/hwmon/pmbus/max34440.c |
872 |
+@@ -400,7 +400,6 @@ static struct pmbus_driver_info max34440_info[] = { |
873 |
+ .func[18] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
874 |
+ .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
875 |
+ .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
876 |
+- .read_byte_data = max34440_read_byte_data, |
877 |
+ .read_word_data = max34440_read_word_data, |
878 |
+ .write_word_data = max34440_write_word_data, |
879 |
+ }, |
880 |
+@@ -431,7 +430,6 @@ static struct pmbus_driver_info max34440_info[] = { |
881 |
+ .func[15] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
882 |
+ .func[16] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
883 |
+ .func[17] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
884 |
+- .read_byte_data = max34440_read_byte_data, |
885 |
+ .read_word_data = max34440_read_word_data, |
886 |
+ .write_word_data = max34440_write_word_data, |
887 |
+ }, |
888 |
+@@ -467,7 +465,6 @@ static struct pmbus_driver_info max34440_info[] = { |
889 |
+ .func[19] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
890 |
+ .func[20] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
891 |
+ .func[21] = PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP, |
892 |
+- .read_byte_data = max34440_read_byte_data, |
893 |
+ .read_word_data = max34440_read_word_data, |
894 |
+ .write_word_data = max34440_write_word_data, |
895 |
+ }, |
896 |
+diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c |
897 |
+index 2acc30c3d5b2d..01052de6bedbf 100644 |
898 |
+--- a/drivers/infiniband/core/ucma.c |
899 |
++++ b/drivers/infiniband/core/ucma.c |
900 |
+@@ -588,6 +588,7 @@ static int ucma_free_ctx(struct ucma_context *ctx) |
901 |
+ list_move_tail(&uevent->list, &list); |
902 |
+ } |
903 |
+ list_del(&ctx->list); |
904 |
++ events_reported = ctx->events_reported; |
905 |
+ mutex_unlock(&ctx->file->mut); |
906 |
+ |
907 |
+ list_for_each_entry_safe(uevent, tmp, &list, list) { |
908 |
+@@ -597,7 +598,6 @@ static int ucma_free_ctx(struct ucma_context *ctx) |
909 |
+ kfree(uevent); |
910 |
+ } |
911 |
+ |
912 |
+- events_reported = ctx->events_reported; |
913 |
+ mutex_destroy(&ctx->mutex); |
914 |
+ kfree(ctx); |
915 |
+ return events_reported; |
916 |
+@@ -1476,7 +1476,9 @@ static ssize_t ucma_process_join(struct ucma_file *file, |
917 |
+ return 0; |
918 |
+ |
919 |
+ err3: |
920 |
++ mutex_lock(&ctx->mutex); |
921 |
+ rdma_leave_multicast(ctx->cm_id, (struct sockaddr *) &mc->addr); |
922 |
++ mutex_unlock(&ctx->mutex); |
923 |
+ ucma_cleanup_mc_events(mc); |
924 |
+ err2: |
925 |
+ mutex_lock(&mut); |
926 |
+@@ -1644,7 +1646,9 @@ static ssize_t ucma_migrate_id(struct ucma_file *new_file, |
927 |
+ |
928 |
+ cur_file = ctx->file; |
929 |
+ if (cur_file == new_file) { |
930 |
++ mutex_lock(&cur_file->mut); |
931 |
+ resp.events_reported = ctx->events_reported; |
932 |
++ mutex_unlock(&cur_file->mut); |
933 |
+ goto response; |
934 |
+ } |
935 |
+ |
936 |
+diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c |
937 |
+index 8c79a480f2b76..d3e11503e67ca 100644 |
938 |
+--- a/drivers/infiniband/hw/mlx4/cm.c |
939 |
++++ b/drivers/infiniband/hw/mlx4/cm.c |
940 |
+@@ -307,6 +307,9 @@ static void schedule_delayed(struct ib_device *ibdev, struct id_map_entry *id) |
941 |
+ if (!sriov->is_going_down) { |
942 |
+ id->scheduled_delete = 1; |
943 |
+ schedule_delayed_work(&id->timeout, CM_CLEANUP_CACHE_TIMEOUT); |
944 |
++ } else if (id->scheduled_delete) { |
945 |
++ /* Adjust timeout if already scheduled */ |
946 |
++ mod_delayed_work(system_wq, &id->timeout, CM_CLEANUP_CACHE_TIMEOUT); |
947 |
+ } |
948 |
+ spin_unlock_irqrestore(&sriov->going_down_lock, flags); |
949 |
+ spin_unlock(&sriov->id_map_lock); |
950 |
+diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c |
951 |
+index 5aaa2a6c431b6..418b9312fb2d7 100644 |
952 |
+--- a/drivers/infiniband/hw/mlx4/mad.c |
953 |
++++ b/drivers/infiniband/hw/mlx4/mad.c |
954 |
+@@ -1305,6 +1305,18 @@ static void mlx4_ib_tunnel_comp_handler(struct ib_cq *cq, void *arg) |
955 |
+ spin_unlock_irqrestore(&dev->sriov.going_down_lock, flags); |
956 |
+ } |
957 |
+ |
958 |
++static void mlx4_ib_wire_comp_handler(struct ib_cq *cq, void *arg) |
959 |
++{ |
960 |
++ unsigned long flags; |
961 |
++ struct mlx4_ib_demux_pv_ctx *ctx = cq->cq_context; |
962 |
++ struct mlx4_ib_dev *dev = to_mdev(ctx->ib_dev); |
963 |
++ |
964 |
++ spin_lock_irqsave(&dev->sriov.going_down_lock, flags); |
965 |
++ if (!dev->sriov.is_going_down && ctx->state == DEMUX_PV_STATE_ACTIVE) |
966 |
++ queue_work(ctx->wi_wq, &ctx->work); |
967 |
++ spin_unlock_irqrestore(&dev->sriov.going_down_lock, flags); |
968 |
++} |
969 |
++ |
970 |
+ static int mlx4_ib_post_pv_qp_buf(struct mlx4_ib_demux_pv_ctx *ctx, |
971 |
+ struct mlx4_ib_demux_pv_qp *tun_qp, |
972 |
+ int index) |
973 |
+@@ -2000,7 +2012,8 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port, |
974 |
+ cq_size *= 2; |
975 |
+ |
976 |
+ cq_attr.cqe = cq_size; |
977 |
+- ctx->cq = ib_create_cq(ctx->ib_dev, mlx4_ib_tunnel_comp_handler, |
978 |
++ ctx->cq = ib_create_cq(ctx->ib_dev, |
979 |
++ create_tun ? mlx4_ib_tunnel_comp_handler : mlx4_ib_wire_comp_handler, |
980 |
+ NULL, ctx, &cq_attr); |
981 |
+ if (IS_ERR(ctx->cq)) { |
982 |
+ ret = PTR_ERR(ctx->cq); |
983 |
+@@ -2037,6 +2050,7 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port, |
984 |
+ INIT_WORK(&ctx->work, mlx4_ib_sqp_comp_worker); |
985 |
+ |
986 |
+ ctx->wq = to_mdev(ibdev)->sriov.demux[port - 1].wq; |
987 |
++ ctx->wi_wq = to_mdev(ibdev)->sriov.demux[port - 1].wi_wq; |
988 |
+ |
989 |
+ ret = ib_req_notify_cq(ctx->cq, IB_CQ_NEXT_COMP); |
990 |
+ if (ret) { |
991 |
+@@ -2180,7 +2194,7 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, |
992 |
+ goto err_mcg; |
993 |
+ } |
994 |
+ |
995 |
+- snprintf(name, sizeof name, "mlx4_ibt%d", port); |
996 |
++ snprintf(name, sizeof(name), "mlx4_ibt%d", port); |
997 |
+ ctx->wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); |
998 |
+ if (!ctx->wq) { |
999 |
+ pr_err("Failed to create tunnelling WQ for port %d\n", port); |
1000 |
+@@ -2188,7 +2202,15 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, |
1001 |
+ goto err_wq; |
1002 |
+ } |
1003 |
+ |
1004 |
+- snprintf(name, sizeof name, "mlx4_ibud%d", port); |
1005 |
++ snprintf(name, sizeof(name), "mlx4_ibwi%d", port); |
1006 |
++ ctx->wi_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); |
1007 |
++ if (!ctx->wi_wq) { |
1008 |
++ pr_err("Failed to create wire WQ for port %d\n", port); |
1009 |
++ ret = -ENOMEM; |
1010 |
++ goto err_wiwq; |
1011 |
++ } |
1012 |
++ |
1013 |
++ snprintf(name, sizeof(name), "mlx4_ibud%d", port); |
1014 |
+ ctx->ud_wq = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); |
1015 |
+ if (!ctx->ud_wq) { |
1016 |
+ pr_err("Failed to create up/down WQ for port %d\n", port); |
1017 |
+@@ -2199,6 +2221,10 @@ static int mlx4_ib_alloc_demux_ctx(struct mlx4_ib_dev *dev, |
1018 |
+ return 0; |
1019 |
+ |
1020 |
+ err_udwq: |
1021 |
++ destroy_workqueue(ctx->wi_wq); |
1022 |
++ ctx->wi_wq = NULL; |
1023 |
++ |
1024 |
++err_wiwq: |
1025 |
+ destroy_workqueue(ctx->wq); |
1026 |
+ ctx->wq = NULL; |
1027 |
+ |
1028 |
+@@ -2246,12 +2272,14 @@ static void mlx4_ib_free_demux_ctx(struct mlx4_ib_demux_ctx *ctx) |
1029 |
+ ctx->tun[i]->state = DEMUX_PV_STATE_DOWNING; |
1030 |
+ } |
1031 |
+ flush_workqueue(ctx->wq); |
1032 |
++ flush_workqueue(ctx->wi_wq); |
1033 |
+ for (i = 0; i < dev->dev->caps.sqp_demux; i++) { |
1034 |
+ destroy_pv_resources(dev, i, ctx->port, ctx->tun[i], 0); |
1035 |
+ free_pv_object(dev, i, ctx->port); |
1036 |
+ } |
1037 |
+ kfree(ctx->tun); |
1038 |
+ destroy_workqueue(ctx->ud_wq); |
1039 |
++ destroy_workqueue(ctx->wi_wq); |
1040 |
+ destroy_workqueue(ctx->wq); |
1041 |
+ } |
1042 |
+ } |
1043 |
+diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h |
1044 |
+index e10dccc7958f1..76ca67aa40158 100644 |
1045 |
+--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h |
1046 |
++++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h |
1047 |
+@@ -464,6 +464,7 @@ struct mlx4_ib_demux_pv_ctx { |
1048 |
+ struct ib_pd *pd; |
1049 |
+ struct work_struct work; |
1050 |
+ struct workqueue_struct *wq; |
1051 |
++ struct workqueue_struct *wi_wq; |
1052 |
+ struct mlx4_ib_demux_pv_qp qp[2]; |
1053 |
+ }; |
1054 |
+ |
1055 |
+@@ -471,6 +472,7 @@ struct mlx4_ib_demux_ctx { |
1056 |
+ struct ib_device *ib_dev; |
1057 |
+ int port; |
1058 |
+ struct workqueue_struct *wq; |
1059 |
++ struct workqueue_struct *wi_wq; |
1060 |
+ struct workqueue_struct *ud_wq; |
1061 |
+ spinlock_t ud_lock; |
1062 |
+ atomic64_t subnet_prefix; |
1063 |
+diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c |
1064 |
+index d1680d3b58250..2a82661620fe7 100644 |
1065 |
+--- a/drivers/infiniband/hw/qedr/main.c |
1066 |
++++ b/drivers/infiniband/hw/qedr/main.c |
1067 |
+@@ -604,7 +604,7 @@ static int qedr_set_device_attr(struct qedr_dev *dev) |
1068 |
+ qed_attr = dev->ops->rdma_query_device(dev->rdma_ctx); |
1069 |
+ |
1070 |
+ /* Part 2 - check capabilities */ |
1071 |
+- page_size = ~dev->attr.page_size_caps + 1; |
1072 |
++ page_size = ~qed_attr->page_size_caps + 1; |
1073 |
+ if (page_size > PAGE_SIZE) { |
1074 |
+ DP_ERR(dev, |
1075 |
+ "Kernel PAGE_SIZE is %ld which is smaller than minimum page size (%d) required by qedr\n", |
1076 |
+diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c |
1077 |
+index 7b26afc7fef35..f847f0a9f204d 100644 |
1078 |
+--- a/drivers/infiniband/hw/qedr/verbs.c |
1079 |
++++ b/drivers/infiniband/hw/qedr/verbs.c |
1080 |
+@@ -2522,7 +2522,7 @@ int qedr_query_qp(struct ib_qp *ibqp, |
1081 |
+ qp_attr->cap.max_recv_wr = qp->rq.max_wr; |
1082 |
+ qp_attr->cap.max_send_sge = qp->sq.max_sges; |
1083 |
+ qp_attr->cap.max_recv_sge = qp->rq.max_sges; |
1084 |
+- qp_attr->cap.max_inline_data = ROCE_REQ_MAX_INLINE_DATA_SIZE; |
1085 |
++ qp_attr->cap.max_inline_data = dev->attr.max_inline; |
1086 |
+ qp_init_attr->cap = qp_attr->cap; |
1087 |
+ |
1088 |
+ qp_attr->ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE; |
1089 |
+diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c |
1090 |
+index 12e79f9e32d53..d9a9644306096 100644 |
1091 |
+--- a/drivers/media/i2c/m5mols/m5mols_core.c |
1092 |
++++ b/drivers/media/i2c/m5mols/m5mols_core.c |
1093 |
+@@ -768,7 +768,8 @@ static int m5mols_sensor_power(struct m5mols_info *info, bool enable) |
1094 |
+ |
1095 |
+ ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies); |
1096 |
+ if (ret) { |
1097 |
+- info->set_power(&client->dev, 0); |
1098 |
++ if (info->set_power) |
1099 |
++ info->set_power(&client->dev, 0); |
1100 |
+ return ret; |
1101 |
+ } |
1102 |
+ |
1103 |
+diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c |
1104 |
+index e4c0a27b636aa..d9bc3851bf63b 100644 |
1105 |
+--- a/drivers/media/i2c/tc358743.c |
1106 |
++++ b/drivers/media/i2c/tc358743.c |
1107 |
+@@ -919,8 +919,8 @@ static const struct cec_adap_ops tc358743_cec_adap_ops = { |
1108 |
+ .adap_monitor_all_enable = tc358743_cec_adap_monitor_all_enable, |
1109 |
+ }; |
1110 |
+ |
1111 |
+-static void tc358743_cec_isr(struct v4l2_subdev *sd, u16 intstatus, |
1112 |
+- bool *handled) |
1113 |
++static void tc358743_cec_handler(struct v4l2_subdev *sd, u16 intstatus, |
1114 |
++ bool *handled) |
1115 |
+ { |
1116 |
+ struct tc358743_state *state = to_state(sd); |
1117 |
+ unsigned int cec_rxint, cec_txint; |
1118 |
+@@ -953,7 +953,8 @@ static void tc358743_cec_isr(struct v4l2_subdev *sd, u16 intstatus, |
1119 |
+ cec_transmit_attempt_done(state->cec_adap, |
1120 |
+ CEC_TX_STATUS_ERROR); |
1121 |
+ } |
1122 |
+- *handled = true; |
1123 |
++ if (handled) |
1124 |
++ *handled = true; |
1125 |
+ } |
1126 |
+ if ((intstatus & MASK_CEC_RINT) && |
1127 |
+ (cec_rxint & MASK_CECRIEND)) { |
1128 |
+@@ -968,7 +969,8 @@ static void tc358743_cec_isr(struct v4l2_subdev *sd, u16 intstatus, |
1129 |
+ msg.msg[i] = v & 0xff; |
1130 |
+ } |
1131 |
+ cec_received_msg(state->cec_adap, &msg); |
1132 |
+- *handled = true; |
1133 |
++ if (handled) |
1134 |
++ *handled = true; |
1135 |
+ } |
1136 |
+ i2c_wr16(sd, INTSTATUS, |
1137 |
+ intstatus & (MASK_CEC_RINT | MASK_CEC_TINT)); |
1138 |
+@@ -1432,7 +1434,7 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled) |
1139 |
+ |
1140 |
+ #ifdef CONFIG_VIDEO_TC358743_CEC |
1141 |
+ if (intstatus & (MASK_CEC_RINT | MASK_CEC_TINT)) { |
1142 |
+- tc358743_cec_isr(sd, intstatus, handled); |
1143 |
++ tc358743_cec_handler(sd, intstatus, handled); |
1144 |
+ i2c_wr16(sd, INTSTATUS, |
1145 |
+ intstatus & (MASK_CEC_RINT | MASK_CEC_TINT)); |
1146 |
+ intstatus &= ~(MASK_CEC_RINT | MASK_CEC_TINT); |
1147 |
+@@ -1461,7 +1463,7 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled) |
1148 |
+ static irqreturn_t tc358743_irq_handler(int irq, void *dev_id) |
1149 |
+ { |
1150 |
+ struct tc358743_state *state = dev_id; |
1151 |
+- bool handled; |
1152 |
++ bool handled = false; |
1153 |
+ |
1154 |
+ tc358743_isr(&state->sd, 0, &handled); |
1155 |
+ |
1156 |
+diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c |
1157 |
+index 2d25a197dc657..f5fca01f3248e 100644 |
1158 |
+--- a/drivers/media/platform/exynos4-is/media-dev.c |
1159 |
++++ b/drivers/media/platform/exynos4-is/media-dev.c |
1160 |
+@@ -1257,11 +1257,9 @@ static int fimc_md_get_pinctrl(struct fimc_md *fmd) |
1161 |
+ if (IS_ERR(pctl->state_default)) |
1162 |
+ return PTR_ERR(pctl->state_default); |
1163 |
+ |
1164 |
++ /* PINCTRL_STATE_IDLE is optional */ |
1165 |
+ pctl->state_idle = pinctrl_lookup_state(pctl->pinctrl, |
1166 |
+ PINCTRL_STATE_IDLE); |
1167 |
+- if (IS_ERR(pctl->state_idle)) |
1168 |
+- return PTR_ERR(pctl->state_idle); |
1169 |
+- |
1170 |
+ return 0; |
1171 |
+ } |
1172 |
+ |
1173 |
+diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c |
1174 |
+index 419e1cb10dc66..f4be4c672d40e 100644 |
1175 |
+--- a/drivers/media/platform/mx2_emmaprp.c |
1176 |
++++ b/drivers/media/platform/mx2_emmaprp.c |
1177 |
+@@ -929,8 +929,11 @@ static int emmaprp_probe(struct platform_device *pdev) |
1178 |
+ platform_set_drvdata(pdev, pcdev); |
1179 |
+ |
1180 |
+ irq = platform_get_irq(pdev, 0); |
1181 |
+- if (irq < 0) |
1182 |
+- return irq; |
1183 |
++ if (irq < 0) { |
1184 |
++ ret = irq; |
1185 |
++ goto rel_vdev; |
1186 |
++ } |
1187 |
++ |
1188 |
+ ret = devm_request_irq(&pdev->dev, irq, emmaprp_irq, 0, |
1189 |
+ dev_name(&pdev->dev), pcdev); |
1190 |
+ if (ret) |
1191 |
+diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c |
1192 |
+index addd03b517481..00e52f0b8251b 100644 |
1193 |
+--- a/drivers/media/platform/omap3isp/isp.c |
1194 |
++++ b/drivers/media/platform/omap3isp/isp.c |
1195 |
+@@ -2265,8 +2265,10 @@ static int isp_probe(struct platform_device *pdev) |
1196 |
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, i); |
1197 |
+ isp->mmio_base[map_idx] = |
1198 |
+ devm_ioremap_resource(isp->dev, mem); |
1199 |
+- if (IS_ERR(isp->mmio_base[map_idx])) |
1200 |
+- return PTR_ERR(isp->mmio_base[map_idx]); |
1201 |
++ if (IS_ERR(isp->mmio_base[map_idx])) { |
1202 |
++ ret = PTR_ERR(isp->mmio_base[map_idx]); |
1203 |
++ goto error; |
1204 |
++ } |
1205 |
+ } |
1206 |
+ |
1207 |
+ ret = isp_get_clocks(isp); |
1208 |
+diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c |
1209 |
+index 008afb85023be..3c5b9082ad723 100644 |
1210 |
+--- a/drivers/media/platform/qcom/camss/camss-csiphy.c |
1211 |
++++ b/drivers/media/platform/qcom/camss/camss-csiphy.c |
1212 |
+@@ -176,8 +176,10 @@ static int csiphy_set_power(struct v4l2_subdev *sd, int on) |
1213 |
+ int ret; |
1214 |
+ |
1215 |
+ ret = pm_runtime_get_sync(dev); |
1216 |
+- if (ret < 0) |
1217 |
++ if (ret < 0) { |
1218 |
++ pm_runtime_put_sync(dev); |
1219 |
+ return ret; |
1220 |
++ } |
1221 |
+ |
1222 |
+ ret = csiphy_set_clock_rates(csiphy); |
1223 |
+ if (ret < 0) { |
1224 |
+diff --git a/drivers/media/platform/rcar-fcp.c b/drivers/media/platform/rcar-fcp.c |
1225 |
+index 5c6b00737fe75..05c712e00a2a7 100644 |
1226 |
+--- a/drivers/media/platform/rcar-fcp.c |
1227 |
++++ b/drivers/media/platform/rcar-fcp.c |
1228 |
+@@ -103,8 +103,10 @@ int rcar_fcp_enable(struct rcar_fcp_device *fcp) |
1229 |
+ return 0; |
1230 |
+ |
1231 |
+ ret = pm_runtime_get_sync(fcp->dev); |
1232 |
+- if (ret < 0) |
1233 |
++ if (ret < 0) { |
1234 |
++ pm_runtime_put_noidle(fcp->dev); |
1235 |
+ return ret; |
1236 |
++ } |
1237 |
+ |
1238 |
+ return 0; |
1239 |
+ } |
1240 |
+diff --git a/drivers/media/platform/rcar-vin/rcar-dma.c b/drivers/media/platform/rcar-vin/rcar-dma.c |
1241 |
+index 92323310f7352..70a8cc433a03f 100644 |
1242 |
+--- a/drivers/media/platform/rcar-vin/rcar-dma.c |
1243 |
++++ b/drivers/media/platform/rcar-vin/rcar-dma.c |
1244 |
+@@ -1323,8 +1323,10 @@ int rvin_set_channel_routing(struct rvin_dev *vin, u8 chsel) |
1245 |
+ int ret; |
1246 |
+ |
1247 |
+ ret = pm_runtime_get_sync(vin->dev); |
1248 |
+- if (ret < 0) |
1249 |
++ if (ret < 0) { |
1250 |
++ pm_runtime_put_noidle(vin->dev); |
1251 |
+ return ret; |
1252 |
++ } |
1253 |
+ |
1254 |
+ /* Make register writes take effect immediately. */ |
1255 |
+ vnmc = rvin_read(vin, VNMC_REG); |
1256 |
+diff --git a/drivers/media/platform/rockchip/rga/rga-buf.c b/drivers/media/platform/rockchip/rga/rga-buf.c |
1257 |
+index 356821c2dacf0..0932f1445deab 100644 |
1258 |
+--- a/drivers/media/platform/rockchip/rga/rga-buf.c |
1259 |
++++ b/drivers/media/platform/rockchip/rga/rga-buf.c |
1260 |
+@@ -89,6 +89,7 @@ static int rga_buf_start_streaming(struct vb2_queue *q, unsigned int count) |
1261 |
+ |
1262 |
+ ret = pm_runtime_get_sync(rga->dev); |
1263 |
+ if (ret < 0) { |
1264 |
++ pm_runtime_put_noidle(rga->dev); |
1265 |
+ rga_buf_return_buffers(q, VB2_BUF_STATE_QUEUED); |
1266 |
+ return ret; |
1267 |
+ } |
1268 |
+diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |
1269 |
+index 5e080f32b0e82..95abf2bd7ebae 100644 |
1270 |
+--- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |
1271 |
++++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |
1272 |
+@@ -83,8 +83,10 @@ int s5p_mfc_power_on(void) |
1273 |
+ int i, ret = 0; |
1274 |
+ |
1275 |
+ ret = pm_runtime_get_sync(pm->device); |
1276 |
+- if (ret < 0) |
1277 |
++ if (ret < 0) { |
1278 |
++ pm_runtime_put_noidle(pm->device); |
1279 |
+ return ret; |
1280 |
++ } |
1281 |
+ |
1282 |
+ /* clock control */ |
1283 |
+ for (i = 0; i < pm->num_clocks; i++) { |
1284 |
+diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c |
1285 |
+index 18d0b56417894..ee1a211797673 100644 |
1286 |
+--- a/drivers/media/platform/stm32/stm32-dcmi.c |
1287 |
++++ b/drivers/media/platform/stm32/stm32-dcmi.c |
1288 |
+@@ -587,7 +587,7 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) |
1289 |
+ if (ret < 0) { |
1290 |
+ dev_err(dcmi->dev, "%s: Failed to start streaming, cannot get sync (%d)\n", |
1291 |
+ __func__, ret); |
1292 |
+- goto err_release_buffers; |
1293 |
++ goto err_pm_put; |
1294 |
+ } |
1295 |
+ |
1296 |
+ /* Enable stream on the sub device */ |
1297 |
+@@ -682,8 +682,6 @@ err_subdev_streamoff: |
1298 |
+ |
1299 |
+ err_pm_put: |
1300 |
+ pm_runtime_put(dcmi->dev); |
1301 |
+- |
1302 |
+-err_release_buffers: |
1303 |
+ spin_lock_irq(&dcmi->irqlock); |
1304 |
+ /* |
1305 |
+ * Return all buffers to vb2 in QUEUED state. |
1306 |
+diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c |
1307 |
+index a285b9db7ee86..70a8371b7e9a1 100644 |
1308 |
+--- a/drivers/media/platform/ti-vpe/vpe.c |
1309 |
++++ b/drivers/media/platform/ti-vpe/vpe.c |
1310 |
+@@ -2451,6 +2451,8 @@ static int vpe_runtime_get(struct platform_device *pdev) |
1311 |
+ |
1312 |
+ r = pm_runtime_get_sync(&pdev->dev); |
1313 |
+ WARN_ON(r < 0); |
1314 |
++ if (r) |
1315 |
++ pm_runtime_put_noidle(&pdev->dev); |
1316 |
+ return r < 0 ? r : 0; |
1317 |
+ } |
1318 |
+ |
1319 |
+diff --git a/drivers/media/tuners/tuner-simple.c b/drivers/media/tuners/tuner-simple.c |
1320 |
+index 29c1473f2e9f6..81e24cf0c8b80 100644 |
1321 |
+--- a/drivers/media/tuners/tuner-simple.c |
1322 |
++++ b/drivers/media/tuners/tuner-simple.c |
1323 |
+@@ -499,7 +499,7 @@ static int simple_radio_bandswitch(struct dvb_frontend *fe, u8 *buffer) |
1324 |
+ case TUNER_TENA_9533_DI: |
1325 |
+ case TUNER_YMEC_TVF_5533MF: |
1326 |
+ tuner_dbg("This tuner doesn't have FM. Most cards have a TEA5767 for FM\n"); |
1327 |
+- return 0; |
1328 |
++ return -EINVAL; |
1329 |
+ case TUNER_PHILIPS_FM1216ME_MK3: |
1330 |
+ case TUNER_PHILIPS_FM1236_MK3: |
1331 |
+ case TUNER_PHILIPS_FMD1216ME_MK3: |
1332 |
+@@ -701,7 +701,8 @@ static int simple_set_radio_freq(struct dvb_frontend *fe, |
1333 |
+ TUNER_RATIO_SELECT_50; /* 50 kHz step */ |
1334 |
+ |
1335 |
+ /* Bandswitch byte */ |
1336 |
+- simple_radio_bandswitch(fe, &buffer[0]); |
1337 |
++ if (simple_radio_bandswitch(fe, &buffer[0])) |
1338 |
++ return 0; |
1339 |
+ |
1340 |
+ /* Convert from 1/16 kHz V4L steps to 1/20 MHz (=50 kHz) PLL steps |
1341 |
+ freq * (1 Mhz / 16000 V4L steps) * (20 PLL steps / 1 MHz) = |
1342 |
+diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c |
1343 |
+index f2854337cdcac..abfc49901222e 100644 |
1344 |
+--- a/drivers/media/usb/uvc/uvc_ctrl.c |
1345 |
++++ b/drivers/media/usb/uvc/uvc_ctrl.c |
1346 |
+@@ -778,12 +778,16 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping, |
1347 |
+ offset &= 7; |
1348 |
+ mask = ((1LL << bits) - 1) << offset; |
1349 |
+ |
1350 |
+- for (; bits > 0; data++) { |
1351 |
++ while (1) { |
1352 |
+ u8 byte = *data & mask; |
1353 |
+ value |= offset > 0 ? (byte >> offset) : (byte << (-offset)); |
1354 |
+ bits -= 8 - (offset > 0 ? offset : 0); |
1355 |
++ if (bits <= 0) |
1356 |
++ break; |
1357 |
++ |
1358 |
+ offset -= 8; |
1359 |
+ mask = (1 << bits) - 1; |
1360 |
++ data++; |
1361 |
+ } |
1362 |
+ |
1363 |
+ /* Sign-extend the value if needed. */ |
1364 |
+diff --git a/drivers/media/usb/uvc/uvc_entity.c b/drivers/media/usb/uvc/uvc_entity.c |
1365 |
+index 554063c07d7a2..f2457953f27c6 100644 |
1366 |
+--- a/drivers/media/usb/uvc/uvc_entity.c |
1367 |
++++ b/drivers/media/usb/uvc/uvc_entity.c |
1368 |
+@@ -78,10 +78,45 @@ static int uvc_mc_init_entity(struct uvc_video_chain *chain, |
1369 |
+ int ret; |
1370 |
+ |
1371 |
+ if (UVC_ENTITY_TYPE(entity) != UVC_TT_STREAMING) { |
1372 |
++ u32 function; |
1373 |
++ |
1374 |
+ v4l2_subdev_init(&entity->subdev, &uvc_subdev_ops); |
1375 |
+ strlcpy(entity->subdev.name, entity->name, |
1376 |
+ sizeof(entity->subdev.name)); |
1377 |
+ |
1378 |
++ switch (UVC_ENTITY_TYPE(entity)) { |
1379 |
++ case UVC_VC_SELECTOR_UNIT: |
1380 |
++ function = MEDIA_ENT_F_VID_MUX; |
1381 |
++ break; |
1382 |
++ case UVC_VC_PROCESSING_UNIT: |
1383 |
++ case UVC_VC_EXTENSION_UNIT: |
1384 |
++ /* For lack of a better option. */ |
1385 |
++ function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER; |
1386 |
++ break; |
1387 |
++ case UVC_COMPOSITE_CONNECTOR: |
1388 |
++ case UVC_COMPONENT_CONNECTOR: |
1389 |
++ function = MEDIA_ENT_F_CONN_COMPOSITE; |
1390 |
++ break; |
1391 |
++ case UVC_SVIDEO_CONNECTOR: |
1392 |
++ function = MEDIA_ENT_F_CONN_SVIDEO; |
1393 |
++ break; |
1394 |
++ case UVC_ITT_CAMERA: |
1395 |
++ function = MEDIA_ENT_F_CAM_SENSOR; |
1396 |
++ break; |
1397 |
++ case UVC_TT_VENDOR_SPECIFIC: |
1398 |
++ case UVC_ITT_VENDOR_SPECIFIC: |
1399 |
++ case UVC_ITT_MEDIA_TRANSPORT_INPUT: |
1400 |
++ case UVC_OTT_VENDOR_SPECIFIC: |
1401 |
++ case UVC_OTT_DISPLAY: |
1402 |
++ case UVC_OTT_MEDIA_TRANSPORT_OUTPUT: |
1403 |
++ case UVC_EXTERNAL_VENDOR_SPECIFIC: |
1404 |
++ default: |
1405 |
++ function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; |
1406 |
++ break; |
1407 |
++ } |
1408 |
++ |
1409 |
++ entity->subdev.entity.function = function; |
1410 |
++ |
1411 |
+ ret = media_entity_pads_init(&entity->subdev.entity, |
1412 |
+ entity->num_pads, entity->pads); |
1413 |
+ |
1414 |
+diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c |
1415 |
+index e0173bf4b0dc7..ec1ac61a21ed1 100644 |
1416 |
+--- a/drivers/mfd/sm501.c |
1417 |
++++ b/drivers/mfd/sm501.c |
1418 |
+@@ -1429,8 +1429,14 @@ static int sm501_plat_probe(struct platform_device *dev) |
1419 |
+ goto err_claim; |
1420 |
+ } |
1421 |
+ |
1422 |
+- return sm501_init_dev(sm); |
1423 |
++ ret = sm501_init_dev(sm); |
1424 |
++ if (ret) |
1425 |
++ goto err_unmap; |
1426 |
++ |
1427 |
++ return 0; |
1428 |
+ |
1429 |
++ err_unmap: |
1430 |
++ iounmap(sm->regs); |
1431 |
+ err_claim: |
1432 |
+ release_resource(sm->regs_claim); |
1433 |
+ kfree(sm->regs_claim); |
1434 |
+diff --git a/drivers/misc/mic/scif/scif_rma.c b/drivers/misc/mic/scif/scif_rma.c |
1435 |
+index 0e4193cb08cf1..e1f59b17715d5 100644 |
1436 |
+--- a/drivers/misc/mic/scif/scif_rma.c |
1437 |
++++ b/drivers/misc/mic/scif/scif_rma.c |
1438 |
+@@ -1403,6 +1403,8 @@ retry: |
1439 |
+ NULL); |
1440 |
+ up_write(&mm->mmap_sem); |
1441 |
+ if (nr_pages != pinned_pages->nr_pages) { |
1442 |
++ if (pinned_pages->nr_pages < 0) |
1443 |
++ pinned_pages->nr_pages = 0; |
1444 |
+ if (try_upgrade) { |
1445 |
+ if (ulimit) |
1446 |
+ __scif_dec_pinned_vm_lock(mm, |
1447 |
+@@ -1423,7 +1425,6 @@ retry: |
1448 |
+ |
1449 |
+ if (pinned_pages->nr_pages < nr_pages) { |
1450 |
+ err = -EFAULT; |
1451 |
+- pinned_pages->nr_pages = nr_pages; |
1452 |
+ goto dec_pinned; |
1453 |
+ } |
1454 |
+ |
1455 |
+@@ -1436,7 +1437,6 @@ dec_pinned: |
1456 |
+ __scif_dec_pinned_vm_lock(mm, nr_pages, 0); |
1457 |
+ /* Something went wrong! Rollback */ |
1458 |
+ error_unmap: |
1459 |
+- pinned_pages->nr_pages = nr_pages; |
1460 |
+ scif_destroy_pinned_pages(pinned_pages); |
1461 |
+ *pages = NULL; |
1462 |
+ dev_dbg(scif_info.mdev.this_device, |
1463 |
+diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1464 |
+index bd52f29b4a4e2..5e0d1ac67f73f 100644 |
1465 |
+--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1466 |
++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1467 |
+@@ -671,8 +671,9 @@ static int qp_host_get_user_memory(u64 produce_uva, |
1468 |
+ if (retval < (int)produce_q->kernel_if->num_pages) { |
1469 |
+ pr_debug("get_user_pages_fast(produce) failed (retval=%d)", |
1470 |
+ retval); |
1471 |
+- qp_release_pages(produce_q->kernel_if->u.h.header_page, |
1472 |
+- retval, false); |
1473 |
++ if (retval > 0) |
1474 |
++ qp_release_pages(produce_q->kernel_if->u.h.header_page, |
1475 |
++ retval, false); |
1476 |
+ err = VMCI_ERROR_NO_MEM; |
1477 |
+ goto out; |
1478 |
+ } |
1479 |
+@@ -683,8 +684,9 @@ static int qp_host_get_user_memory(u64 produce_uva, |
1480 |
+ if (retval < (int)consume_q->kernel_if->num_pages) { |
1481 |
+ pr_debug("get_user_pages_fast(consume) failed (retval=%d)", |
1482 |
+ retval); |
1483 |
+- qp_release_pages(consume_q->kernel_if->u.h.header_page, |
1484 |
+- retval, false); |
1485 |
++ if (retval > 0) |
1486 |
++ qp_release_pages(consume_q->kernel_if->u.h.header_page, |
1487 |
++ retval, false); |
1488 |
+ qp_release_pages(produce_q->kernel_if->u.h.header_page, |
1489 |
+ produce_q->kernel_if->num_pages, false); |
1490 |
+ err = VMCI_ERROR_NO_MEM; |
1491 |
+diff --git a/drivers/mtd/lpddr/lpddr2_nvm.c b/drivers/mtd/lpddr/lpddr2_nvm.c |
1492 |
+index c950c880ad590..90e6cb64db69c 100644 |
1493 |
+--- a/drivers/mtd/lpddr/lpddr2_nvm.c |
1494 |
++++ b/drivers/mtd/lpddr/lpddr2_nvm.c |
1495 |
+@@ -402,6 +402,17 @@ static int lpddr2_nvm_lock(struct mtd_info *mtd, loff_t start_add, |
1496 |
+ return lpddr2_nvm_do_block_op(mtd, start_add, len, LPDDR2_NVM_LOCK); |
1497 |
+ } |
1498 |
+ |
1499 |
++static const struct mtd_info lpddr2_nvm_mtd_info = { |
1500 |
++ .type = MTD_RAM, |
1501 |
++ .writesize = 1, |
1502 |
++ .flags = (MTD_CAP_NVRAM | MTD_POWERUP_LOCK), |
1503 |
++ ._read = lpddr2_nvm_read, |
1504 |
++ ._write = lpddr2_nvm_write, |
1505 |
++ ._erase = lpddr2_nvm_erase, |
1506 |
++ ._unlock = lpddr2_nvm_unlock, |
1507 |
++ ._lock = lpddr2_nvm_lock, |
1508 |
++}; |
1509 |
++ |
1510 |
+ /* |
1511 |
+ * lpddr2_nvm driver probe method |
1512 |
+ */ |
1513 |
+@@ -442,6 +453,7 @@ static int lpddr2_nvm_probe(struct platform_device *pdev) |
1514 |
+ .pfow_base = OW_BASE_ADDRESS, |
1515 |
+ .fldrv_priv = pcm_data, |
1516 |
+ }; |
1517 |
++ |
1518 |
+ if (IS_ERR(map->virt)) |
1519 |
+ return PTR_ERR(map->virt); |
1520 |
+ |
1521 |
+@@ -453,22 +465,13 @@ static int lpddr2_nvm_probe(struct platform_device *pdev) |
1522 |
+ return PTR_ERR(pcm_data->ctl_regs); |
1523 |
+ |
1524 |
+ /* Populate mtd_info data structure */ |
1525 |
+- *mtd = (struct mtd_info) { |
1526 |
+- .dev = { .parent = &pdev->dev }, |
1527 |
+- .name = pdev->dev.init_name, |
1528 |
+- .type = MTD_RAM, |
1529 |
+- .priv = map, |
1530 |
+- .size = resource_size(add_range), |
1531 |
+- .erasesize = ERASE_BLOCKSIZE * pcm_data->bus_width, |
1532 |
+- .writesize = 1, |
1533 |
+- .writebufsize = WRITE_BUFFSIZE * pcm_data->bus_width, |
1534 |
+- .flags = (MTD_CAP_NVRAM | MTD_POWERUP_LOCK), |
1535 |
+- ._read = lpddr2_nvm_read, |
1536 |
+- ._write = lpddr2_nvm_write, |
1537 |
+- ._erase = lpddr2_nvm_erase, |
1538 |
+- ._unlock = lpddr2_nvm_unlock, |
1539 |
+- ._lock = lpddr2_nvm_lock, |
1540 |
+- }; |
1541 |
++ *mtd = lpddr2_nvm_mtd_info; |
1542 |
++ mtd->dev.parent = &pdev->dev; |
1543 |
++ mtd->name = pdev->dev.init_name; |
1544 |
++ mtd->priv = map; |
1545 |
++ mtd->size = resource_size(add_range); |
1546 |
++ mtd->erasesize = ERASE_BLOCKSIZE * pcm_data->bus_width; |
1547 |
++ mtd->writebufsize = WRITE_BUFFSIZE * pcm_data->bus_width; |
1548 |
+ |
1549 |
+ /* Verify the presence of the device looking for PFOW string */ |
1550 |
+ if (!lpddr2_nvm_pfow_present(map)) { |
1551 |
+diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c |
1552 |
+index e078fc41aa612..feeffde2d4fa9 100644 |
1553 |
+--- a/drivers/mtd/mtdoops.c |
1554 |
++++ b/drivers/mtd/mtdoops.c |
1555 |
+@@ -293,12 +293,13 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper, |
1556 |
+ kmsg_dump_get_buffer(dumper, true, cxt->oops_buf + MTDOOPS_HEADER_SIZE, |
1557 |
+ record_size - MTDOOPS_HEADER_SIZE, NULL); |
1558 |
+ |
1559 |
+- /* Panics must be written immediately */ |
1560 |
+- if (reason != KMSG_DUMP_OOPS) |
1561 |
++ if (reason != KMSG_DUMP_OOPS) { |
1562 |
++ /* Panics must be written immediately */ |
1563 |
+ mtdoops_write(cxt, 1); |
1564 |
+- |
1565 |
+- /* For other cases, schedule work to write it "nicely" */ |
1566 |
+- schedule_work(&cxt->work_write); |
1567 |
++ } else { |
1568 |
++ /* For other cases, schedule work to write it "nicely" */ |
1569 |
++ schedule_work(&cxt->work_write); |
1570 |
++ } |
1571 |
+ } |
1572 |
+ |
1573 |
+ static void mtdoops_notify_add(struct mtd_info *mtd) |
1574 |
+diff --git a/drivers/net/dsa/realtek-smi.h b/drivers/net/dsa/realtek-smi.h |
1575 |
+index 9a63b51e1d82f..6f2dab7e33d65 100644 |
1576 |
+--- a/drivers/net/dsa/realtek-smi.h |
1577 |
++++ b/drivers/net/dsa/realtek-smi.h |
1578 |
+@@ -25,6 +25,9 @@ struct rtl8366_mib_counter { |
1579 |
+ const char *name; |
1580 |
+ }; |
1581 |
+ |
1582 |
++/** |
1583 |
++ * struct rtl8366_vlan_mc - Virtual LAN member configuration |
1584 |
++ */ |
1585 |
+ struct rtl8366_vlan_mc { |
1586 |
+ u16 vid; |
1587 |
+ u16 untag; |
1588 |
+@@ -119,7 +122,6 @@ int realtek_smi_setup_mdio(struct realtek_smi *smi); |
1589 |
+ int rtl8366_mc_is_used(struct realtek_smi *smi, int mc_index, int *used); |
1590 |
+ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
1591 |
+ u32 untag, u32 fid); |
1592 |
+-int rtl8366_get_pvid(struct realtek_smi *smi, int port, int *val); |
1593 |
+ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port, |
1594 |
+ unsigned int vid); |
1595 |
+ int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable); |
1596 |
+diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c |
1597 |
+index 430988f797225..dddbc86429bd9 100644 |
1598 |
+--- a/drivers/net/dsa/rtl8366.c |
1599 |
++++ b/drivers/net/dsa/rtl8366.c |
1600 |
+@@ -36,12 +36,113 @@ int rtl8366_mc_is_used(struct realtek_smi *smi, int mc_index, int *used) |
1601 |
+ } |
1602 |
+ EXPORT_SYMBOL_GPL(rtl8366_mc_is_used); |
1603 |
+ |
1604 |
++/** |
1605 |
++ * rtl8366_obtain_mc() - retrieve or allocate a VLAN member configuration |
1606 |
++ * @smi: the Realtek SMI device instance |
1607 |
++ * @vid: the VLAN ID to look up or allocate |
1608 |
++ * @vlanmc: the pointer will be assigned to a pointer to a valid member config |
1609 |
++ * if successful |
1610 |
++ * @return: index of a new member config or negative error number |
1611 |
++ */ |
1612 |
++static int rtl8366_obtain_mc(struct realtek_smi *smi, int vid, |
1613 |
++ struct rtl8366_vlan_mc *vlanmc) |
1614 |
++{ |
1615 |
++ struct rtl8366_vlan_4k vlan4k; |
1616 |
++ int ret; |
1617 |
++ int i; |
1618 |
++ |
1619 |
++ /* Try to find an existing member config entry for this VID */ |
1620 |
++ for (i = 0; i < smi->num_vlan_mc; i++) { |
1621 |
++ ret = smi->ops->get_vlan_mc(smi, i, vlanmc); |
1622 |
++ if (ret) { |
1623 |
++ dev_err(smi->dev, "error searching for VLAN MC %d for VID %d\n", |
1624 |
++ i, vid); |
1625 |
++ return ret; |
1626 |
++ } |
1627 |
++ |
1628 |
++ if (vid == vlanmc->vid) |
1629 |
++ return i; |
1630 |
++ } |
1631 |
++ |
1632 |
++ /* We have no MC entry for this VID, try to find an empty one */ |
1633 |
++ for (i = 0; i < smi->num_vlan_mc; i++) { |
1634 |
++ ret = smi->ops->get_vlan_mc(smi, i, vlanmc); |
1635 |
++ if (ret) { |
1636 |
++ dev_err(smi->dev, "error searching for VLAN MC %d for VID %d\n", |
1637 |
++ i, vid); |
1638 |
++ return ret; |
1639 |
++ } |
1640 |
++ |
1641 |
++ if (vlanmc->vid == 0 && vlanmc->member == 0) { |
1642 |
++ /* Update the entry from the 4K table */ |
1643 |
++ ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
1644 |
++ if (ret) { |
1645 |
++ dev_err(smi->dev, "error looking for 4K VLAN MC %d for VID %d\n", |
1646 |
++ i, vid); |
1647 |
++ return ret; |
1648 |
++ } |
1649 |
++ |
1650 |
++ vlanmc->vid = vid; |
1651 |
++ vlanmc->member = vlan4k.member; |
1652 |
++ vlanmc->untag = vlan4k.untag; |
1653 |
++ vlanmc->fid = vlan4k.fid; |
1654 |
++ ret = smi->ops->set_vlan_mc(smi, i, vlanmc); |
1655 |
++ if (ret) { |
1656 |
++ dev_err(smi->dev, "unable to set/update VLAN MC %d for VID %d\n", |
1657 |
++ i, vid); |
1658 |
++ return ret; |
1659 |
++ } |
1660 |
++ |
1661 |
++ dev_dbg(smi->dev, "created new MC at index %d for VID %d\n", |
1662 |
++ i, vid); |
1663 |
++ return i; |
1664 |
++ } |
1665 |
++ } |
1666 |
++ |
1667 |
++ /* MC table is full, try to find an unused entry and replace it */ |
1668 |
++ for (i = 0; i < smi->num_vlan_mc; i++) { |
1669 |
++ int used; |
1670 |
++ |
1671 |
++ ret = rtl8366_mc_is_used(smi, i, &used); |
1672 |
++ if (ret) |
1673 |
++ return ret; |
1674 |
++ |
1675 |
++ if (!used) { |
1676 |
++ /* Update the entry from the 4K table */ |
1677 |
++ ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
1678 |
++ if (ret) |
1679 |
++ return ret; |
1680 |
++ |
1681 |
++ vlanmc->vid = vid; |
1682 |
++ vlanmc->member = vlan4k.member; |
1683 |
++ vlanmc->untag = vlan4k.untag; |
1684 |
++ vlanmc->fid = vlan4k.fid; |
1685 |
++ ret = smi->ops->set_vlan_mc(smi, i, vlanmc); |
1686 |
++ if (ret) { |
1687 |
++ dev_err(smi->dev, "unable to set/update VLAN MC %d for VID %d\n", |
1688 |
++ i, vid); |
1689 |
++ return ret; |
1690 |
++ } |
1691 |
++ dev_dbg(smi->dev, "recycled MC at index %i for VID %d\n", |
1692 |
++ i, vid); |
1693 |
++ return i; |
1694 |
++ } |
1695 |
++ } |
1696 |
++ |
1697 |
++ dev_err(smi->dev, "all VLAN member configurations are in use\n"); |
1698 |
++ return -ENOSPC; |
1699 |
++} |
1700 |
++ |
1701 |
+ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
1702 |
+ u32 untag, u32 fid) |
1703 |
+ { |
1704 |
++ struct rtl8366_vlan_mc vlanmc; |
1705 |
+ struct rtl8366_vlan_4k vlan4k; |
1706 |
++ int mc; |
1707 |
+ int ret; |
1708 |
+- int i; |
1709 |
++ |
1710 |
++ if (!smi->ops->is_vlan_valid(smi, vid)) |
1711 |
++ return -EINVAL; |
1712 |
+ |
1713 |
+ dev_dbg(smi->dev, |
1714 |
+ "setting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
1715 |
+@@ -63,133 +164,58 @@ int rtl8366_set_vlan(struct realtek_smi *smi, int vid, u32 member, |
1716 |
+ "resulting VLAN%d 4k members: 0x%02x, untagged: 0x%02x\n", |
1717 |
+ vid, vlan4k.member, vlan4k.untag); |
1718 |
+ |
1719 |
+- /* Try to find an existing MC entry for this VID */ |
1720 |
+- for (i = 0; i < smi->num_vlan_mc; i++) { |
1721 |
+- struct rtl8366_vlan_mc vlanmc; |
1722 |
+- |
1723 |
+- ret = smi->ops->get_vlan_mc(smi, i, &vlanmc); |
1724 |
+- if (ret) |
1725 |
+- return ret; |
1726 |
+- |
1727 |
+- if (vid == vlanmc.vid) { |
1728 |
+- /* update the MC entry */ |
1729 |
+- vlanmc.member |= member; |
1730 |
+- vlanmc.untag |= untag; |
1731 |
+- vlanmc.fid = fid; |
1732 |
+- |
1733 |
+- ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
1734 |
++ /* Find or allocate a member config for this VID */ |
1735 |
++ ret = rtl8366_obtain_mc(smi, vid, &vlanmc); |
1736 |
++ if (ret < 0) |
1737 |
++ return ret; |
1738 |
++ mc = ret; |
1739 |
+ |
1740 |
+- dev_dbg(smi->dev, |
1741 |
+- "resulting VLAN%d MC members: 0x%02x, untagged: 0x%02x\n", |
1742 |
+- vid, vlanmc.member, vlanmc.untag); |
1743 |
++ /* Update the MC entry */ |
1744 |
++ vlanmc.member |= member; |
1745 |
++ vlanmc.untag |= untag; |
1746 |
++ vlanmc.fid = fid; |
1747 |
+ |
1748 |
+- break; |
1749 |
+- } |
1750 |
+- } |
1751 |
++ /* Commit updates to the MC entry */ |
1752 |
++ ret = smi->ops->set_vlan_mc(smi, mc, &vlanmc); |
1753 |
++ if (ret) |
1754 |
++ dev_err(smi->dev, "failed to commit changes to VLAN MC index %d for VID %d\n", |
1755 |
++ mc, vid); |
1756 |
++ else |
1757 |
++ dev_dbg(smi->dev, |
1758 |
++ "resulting VLAN%d MC members: 0x%02x, untagged: 0x%02x\n", |
1759 |
++ vid, vlanmc.member, vlanmc.untag); |
1760 |
+ |
1761 |
+ return ret; |
1762 |
+ } |
1763 |
+ EXPORT_SYMBOL_GPL(rtl8366_set_vlan); |
1764 |
+ |
1765 |
+-int rtl8366_get_pvid(struct realtek_smi *smi, int port, int *val) |
1766 |
+-{ |
1767 |
+- struct rtl8366_vlan_mc vlanmc; |
1768 |
+- int ret; |
1769 |
+- int index; |
1770 |
+- |
1771 |
+- ret = smi->ops->get_mc_index(smi, port, &index); |
1772 |
+- if (ret) |
1773 |
+- return ret; |
1774 |
+- |
1775 |
+- ret = smi->ops->get_vlan_mc(smi, index, &vlanmc); |
1776 |
+- if (ret) |
1777 |
+- return ret; |
1778 |
+- |
1779 |
+- *val = vlanmc.vid; |
1780 |
+- return 0; |
1781 |
+-} |
1782 |
+-EXPORT_SYMBOL_GPL(rtl8366_get_pvid); |
1783 |
+- |
1784 |
+ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port, |
1785 |
+ unsigned int vid) |
1786 |
+ { |
1787 |
+ struct rtl8366_vlan_mc vlanmc; |
1788 |
+- struct rtl8366_vlan_4k vlan4k; |
1789 |
++ int mc; |
1790 |
+ int ret; |
1791 |
+- int i; |
1792 |
+- |
1793 |
+- /* Try to find an existing MC entry for this VID */ |
1794 |
+- for (i = 0; i < smi->num_vlan_mc; i++) { |
1795 |
+- ret = smi->ops->get_vlan_mc(smi, i, &vlanmc); |
1796 |
+- if (ret) |
1797 |
+- return ret; |
1798 |
+- |
1799 |
+- if (vid == vlanmc.vid) { |
1800 |
+- ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
1801 |
+- if (ret) |
1802 |
+- return ret; |
1803 |
+- |
1804 |
+- ret = smi->ops->set_mc_index(smi, port, i); |
1805 |
+- return ret; |
1806 |
+- } |
1807 |
+- } |
1808 |
+- |
1809 |
+- /* We have no MC entry for this VID, try to find an empty one */ |
1810 |
+- for (i = 0; i < smi->num_vlan_mc; i++) { |
1811 |
+- ret = smi->ops->get_vlan_mc(smi, i, &vlanmc); |
1812 |
+- if (ret) |
1813 |
+- return ret; |
1814 |
+- |
1815 |
+- if (vlanmc.vid == 0 && vlanmc.member == 0) { |
1816 |
+- /* Update the entry from the 4K table */ |
1817 |
+- ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
1818 |
+- if (ret) |
1819 |
+- return ret; |
1820 |
+ |
1821 |
+- vlanmc.vid = vid; |
1822 |
+- vlanmc.member = vlan4k.member; |
1823 |
+- vlanmc.untag = vlan4k.untag; |
1824 |
+- vlanmc.fid = vlan4k.fid; |
1825 |
+- ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
1826 |
+- if (ret) |
1827 |
+- return ret; |
1828 |
+- |
1829 |
+- ret = smi->ops->set_mc_index(smi, port, i); |
1830 |
+- return ret; |
1831 |
+- } |
1832 |
+- } |
1833 |
+- |
1834 |
+- /* MC table is full, try to find an unused entry and replace it */ |
1835 |
+- for (i = 0; i < smi->num_vlan_mc; i++) { |
1836 |
+- int used; |
1837 |
+- |
1838 |
+- ret = rtl8366_mc_is_used(smi, i, &used); |
1839 |
+- if (ret) |
1840 |
+- return ret; |
1841 |
+- |
1842 |
+- if (!used) { |
1843 |
+- /* Update the entry from the 4K table */ |
1844 |
+- ret = smi->ops->get_vlan_4k(smi, vid, &vlan4k); |
1845 |
+- if (ret) |
1846 |
+- return ret; |
1847 |
++ if (!smi->ops->is_vlan_valid(smi, vid)) |
1848 |
++ return -EINVAL; |
1849 |
+ |
1850 |
+- vlanmc.vid = vid; |
1851 |
+- vlanmc.member = vlan4k.member; |
1852 |
+- vlanmc.untag = vlan4k.untag; |
1853 |
+- vlanmc.fid = vlan4k.fid; |
1854 |
+- ret = smi->ops->set_vlan_mc(smi, i, &vlanmc); |
1855 |
+- if (ret) |
1856 |
+- return ret; |
1857 |
++ /* Find or allocate a member config for this VID */ |
1858 |
++ ret = rtl8366_obtain_mc(smi, vid, &vlanmc); |
1859 |
++ if (ret < 0) |
1860 |
++ return ret; |
1861 |
++ mc = ret; |
1862 |
+ |
1863 |
+- ret = smi->ops->set_mc_index(smi, port, i); |
1864 |
+- return ret; |
1865 |
+- } |
1866 |
++ ret = smi->ops->set_mc_index(smi, port, mc); |
1867 |
++ if (ret) { |
1868 |
++ dev_err(smi->dev, "set PVID: failed to set MC index %d for port %d\n", |
1869 |
++ mc, port); |
1870 |
++ return ret; |
1871 |
+ } |
1872 |
+ |
1873 |
+- dev_err(smi->dev, |
1874 |
+- "all VLAN member configurations are in use\n"); |
1875 |
++ dev_dbg(smi->dev, "set PVID: the PVID for port %d set to %d using existing MC index %d\n", |
1876 |
++ port, vid, mc); |
1877 |
+ |
1878 |
+- return -ENOSPC; |
1879 |
++ return 0; |
1880 |
+ } |
1881 |
+ EXPORT_SYMBOL_GPL(rtl8366_set_pvid); |
1882 |
+ |
1883 |
+@@ -389,7 +415,8 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
1884 |
+ if (!smi->ops->is_vlan_valid(smi, vid)) |
1885 |
+ return; |
1886 |
+ |
1887 |
+- dev_info(smi->dev, "add VLAN on port %d, %s, %s\n", |
1888 |
++ dev_info(smi->dev, "add VLAN %d on port %d, %s, %s\n", |
1889 |
++ vlan->vid_begin, |
1890 |
+ port, |
1891 |
+ untagged ? "untagged" : "tagged", |
1892 |
+ pvid ? " PVID" : "no PVID"); |
1893 |
+@@ -398,34 +425,29 @@ void rtl8366_vlan_add(struct dsa_switch *ds, int port, |
1894 |
+ dev_err(smi->dev, "port is DSA or CPU port\n"); |
1895 |
+ |
1896 |
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) { |
1897 |
+- int pvid_val = 0; |
1898 |
+- |
1899 |
+- dev_info(smi->dev, "add VLAN %04x\n", vid); |
1900 |
+ member |= BIT(port); |
1901 |
+ |
1902 |
+ if (untagged) |
1903 |
+ untag |= BIT(port); |
1904 |
+ |
1905 |
+- /* To ensure that we have a valid MC entry for this VLAN, |
1906 |
+- * initialize the port VLAN ID here. |
1907 |
+- */ |
1908 |
+- ret = rtl8366_get_pvid(smi, port, &pvid_val); |
1909 |
+- if (ret < 0) { |
1910 |
+- dev_err(smi->dev, "could not lookup PVID for port %d\n", |
1911 |
+- port); |
1912 |
+- return; |
1913 |
+- } |
1914 |
+- if (pvid_val == 0) { |
1915 |
+- ret = rtl8366_set_pvid(smi, port, vid); |
1916 |
+- if (ret < 0) |
1917 |
+- return; |
1918 |
+- } |
1919 |
+- |
1920 |
+ ret = rtl8366_set_vlan(smi, vid, member, untag, 0); |
1921 |
+ if (ret) |
1922 |
+ dev_err(smi->dev, |
1923 |
+ "failed to set up VLAN %04x", |
1924 |
+ vid); |
1925 |
++ |
1926 |
++ if (!pvid) |
1927 |
++ continue; |
1928 |
++ |
1929 |
++ ret = rtl8366_set_pvid(smi, port, vid); |
1930 |
++ if (ret) |
1931 |
++ dev_err(smi->dev, |
1932 |
++ "failed to set PVID on port %d to VLAN %04x", |
1933 |
++ port, vid); |
1934 |
++ |
1935 |
++ if (!ret) |
1936 |
++ dev_dbg(smi->dev, "VLAN add: added VLAN %d with PVID on port %d\n", |
1937 |
++ vid, port); |
1938 |
+ } |
1939 |
+ } |
1940 |
+ EXPORT_SYMBOL_GPL(rtl8366_vlan_add); |
1941 |
+diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c |
1942 |
+index f4b14b6acd22d..5aefd7a4696a5 100644 |
1943 |
+--- a/drivers/net/dsa/rtl8366rb.c |
1944 |
++++ b/drivers/net/dsa/rtl8366rb.c |
1945 |
+@@ -1270,7 +1270,7 @@ static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) |
1946 |
+ if (smi->vlan4k_enabled) |
1947 |
+ max = RTL8366RB_NUM_VIDS - 1; |
1948 |
+ |
1949 |
+- if (vlan == 0 || vlan >= max) |
1950 |
++ if (vlan == 0 || vlan > max) |
1951 |
+ return false; |
1952 |
+ |
1953 |
+ return true; |
1954 |
+diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h |
1955 |
+index 0dd64acd2a3fb..08cac1bfacafb 100644 |
1956 |
+--- a/drivers/net/ethernet/cisco/enic/enic.h |
1957 |
++++ b/drivers/net/ethernet/cisco/enic/enic.h |
1958 |
+@@ -171,6 +171,7 @@ struct enic { |
1959 |
+ u16 num_vfs; |
1960 |
+ #endif |
1961 |
+ spinlock_t enic_api_lock; |
1962 |
++ bool enic_api_busy; |
1963 |
+ struct enic_port_profile *pp; |
1964 |
+ |
1965 |
+ /* work queue cache line section */ |
1966 |
+diff --git a/drivers/net/ethernet/cisco/enic/enic_api.c b/drivers/net/ethernet/cisco/enic/enic_api.c |
1967 |
+index b161f24522b87..b028ea2dec2b9 100644 |
1968 |
+--- a/drivers/net/ethernet/cisco/enic/enic_api.c |
1969 |
++++ b/drivers/net/ethernet/cisco/enic/enic_api.c |
1970 |
+@@ -34,6 +34,12 @@ int enic_api_devcmd_proxy_by_index(struct net_device *netdev, int vf, |
1971 |
+ struct vnic_dev *vdev = enic->vdev; |
1972 |
+ |
1973 |
+ spin_lock(&enic->enic_api_lock); |
1974 |
++ while (enic->enic_api_busy) { |
1975 |
++ spin_unlock(&enic->enic_api_lock); |
1976 |
++ cpu_relax(); |
1977 |
++ spin_lock(&enic->enic_api_lock); |
1978 |
++ } |
1979 |
++ |
1980 |
+ spin_lock_bh(&enic->devcmd_lock); |
1981 |
+ |
1982 |
+ vnic_dev_cmd_proxy_by_index_start(vdev, vf); |
1983 |
+diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c |
1984 |
+index 026a3bd71204f..810cbe2210463 100644 |
1985 |
+--- a/drivers/net/ethernet/cisco/enic/enic_main.c |
1986 |
++++ b/drivers/net/ethernet/cisco/enic/enic_main.c |
1987 |
+@@ -2142,8 +2142,6 @@ static int enic_dev_wait(struct vnic_dev *vdev, |
1988 |
+ int done; |
1989 |
+ int err; |
1990 |
+ |
1991 |
+- BUG_ON(in_interrupt()); |
1992 |
+- |
1993 |
+ err = start(vdev, arg); |
1994 |
+ if (err) |
1995 |
+ return err; |
1996 |
+@@ -2331,6 +2329,13 @@ static int enic_set_rss_nic_cfg(struct enic *enic) |
1997 |
+ rss_hash_bits, rss_base_cpu, rss_enable); |
1998 |
+ } |
1999 |
+ |
2000 |
++static void enic_set_api_busy(struct enic *enic, bool busy) |
2001 |
++{ |
2002 |
++ spin_lock(&enic->enic_api_lock); |
2003 |
++ enic->enic_api_busy = busy; |
2004 |
++ spin_unlock(&enic->enic_api_lock); |
2005 |
++} |
2006 |
++ |
2007 |
+ static void enic_reset(struct work_struct *work) |
2008 |
+ { |
2009 |
+ struct enic *enic = container_of(work, struct enic, reset); |
2010 |
+@@ -2340,7 +2345,9 @@ static void enic_reset(struct work_struct *work) |
2011 |
+ |
2012 |
+ rtnl_lock(); |
2013 |
+ |
2014 |
+- spin_lock(&enic->enic_api_lock); |
2015 |
++ /* Stop any activity from infiniband */ |
2016 |
++ enic_set_api_busy(enic, true); |
2017 |
++ |
2018 |
+ enic_stop(enic->netdev); |
2019 |
+ enic_dev_soft_reset(enic); |
2020 |
+ enic_reset_addr_lists(enic); |
2021 |
+@@ -2348,7 +2355,10 @@ static void enic_reset(struct work_struct *work) |
2022 |
+ enic_set_rss_nic_cfg(enic); |
2023 |
+ enic_dev_set_ig_vlan_rewrite_mode(enic); |
2024 |
+ enic_open(enic->netdev); |
2025 |
+- spin_unlock(&enic->enic_api_lock); |
2026 |
++ |
2027 |
++ /* Allow infiniband to fiddle with the device again */ |
2028 |
++ enic_set_api_busy(enic, false); |
2029 |
++ |
2030 |
+ call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev); |
2031 |
+ |
2032 |
+ rtnl_unlock(); |
2033 |
+@@ -2360,7 +2370,9 @@ static void enic_tx_hang_reset(struct work_struct *work) |
2034 |
+ |
2035 |
+ rtnl_lock(); |
2036 |
+ |
2037 |
+- spin_lock(&enic->enic_api_lock); |
2038 |
++ /* Stop any activity from infiniband */ |
2039 |
++ enic_set_api_busy(enic, true); |
2040 |
++ |
2041 |
+ enic_dev_hang_notify(enic); |
2042 |
+ enic_stop(enic->netdev); |
2043 |
+ enic_dev_hang_reset(enic); |
2044 |
+@@ -2369,7 +2381,10 @@ static void enic_tx_hang_reset(struct work_struct *work) |
2045 |
+ enic_set_rss_nic_cfg(enic); |
2046 |
+ enic_dev_set_ig_vlan_rewrite_mode(enic); |
2047 |
+ enic_open(enic->netdev); |
2048 |
+- spin_unlock(&enic->enic_api_lock); |
2049 |
++ |
2050 |
++ /* Allow infiniband to fiddle with the device again */ |
2051 |
++ enic_set_api_busy(enic, false); |
2052 |
++ |
2053 |
+ call_netdevice_notifiers(NETDEV_REBOOT, enic->netdev); |
2054 |
+ |
2055 |
+ rtnl_unlock(); |
2056 |
+diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c |
2057 |
+index 3b6da228140e3..7d1a669416f20 100644 |
2058 |
+--- a/drivers/net/ethernet/freescale/fec_main.c |
2059 |
++++ b/drivers/net/ethernet/freescale/fec_main.c |
2060 |
+@@ -1897,6 +1897,27 @@ static int fec_enet_mdio_write(struct mii_bus *bus, int mii_id, int regnum, |
2061 |
+ return ret; |
2062 |
+ } |
2063 |
+ |
2064 |
++static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev) |
2065 |
++{ |
2066 |
++ struct fec_enet_private *fep = netdev_priv(ndev); |
2067 |
++ struct phy_device *phy_dev = ndev->phydev; |
2068 |
++ |
2069 |
++ if (phy_dev) { |
2070 |
++ phy_reset_after_clk_enable(phy_dev); |
2071 |
++ } else if (fep->phy_node) { |
2072 |
++ /* |
2073 |
++ * If the PHY still is not bound to the MAC, but there is |
2074 |
++ * OF PHY node and a matching PHY device instance already, |
2075 |
++ * use the OF PHY node to obtain the PHY device instance, |
2076 |
++ * and then use that PHY device instance when triggering |
2077 |
++ * the PHY reset. |
2078 |
++ */ |
2079 |
++ phy_dev = of_phy_find_device(fep->phy_node); |
2080 |
++ phy_reset_after_clk_enable(phy_dev); |
2081 |
++ put_device(&phy_dev->mdio.dev); |
2082 |
++ } |
2083 |
++} |
2084 |
++ |
2085 |
+ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) |
2086 |
+ { |
2087 |
+ struct fec_enet_private *fep = netdev_priv(ndev); |
2088 |
+@@ -1923,7 +1944,7 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable) |
2089 |
+ if (ret) |
2090 |
+ goto failed_clk_ref; |
2091 |
+ |
2092 |
+- phy_reset_after_clk_enable(ndev->phydev); |
2093 |
++ fec_enet_phy_reset_after_clk_enable(ndev); |
2094 |
+ } else { |
2095 |
+ clk_disable_unprepare(fep->clk_enet_out); |
2096 |
+ if (fep->clk_ptp) { |
2097 |
+@@ -2929,16 +2950,16 @@ fec_enet_open(struct net_device *ndev) |
2098 |
+ /* Init MAC prior to mii bus probe */ |
2099 |
+ fec_restart(ndev); |
2100 |
+ |
2101 |
+- /* Probe and connect to PHY when open the interface */ |
2102 |
+- ret = fec_enet_mii_probe(ndev); |
2103 |
+- if (ret) |
2104 |
+- goto err_enet_mii_probe; |
2105 |
+- |
2106 |
+ /* Call phy_reset_after_clk_enable() again if it failed during |
2107 |
+ * phy_reset_after_clk_enable() before because the PHY wasn't probed. |
2108 |
+ */ |
2109 |
+ if (reset_again) |
2110 |
+- phy_reset_after_clk_enable(ndev->phydev); |
2111 |
++ fec_enet_phy_reset_after_clk_enable(ndev); |
2112 |
++ |
2113 |
++ /* Probe and connect to PHY when open the interface */ |
2114 |
++ ret = fec_enet_mii_probe(ndev); |
2115 |
++ if (ret) |
2116 |
++ goto err_enet_mii_probe; |
2117 |
+ |
2118 |
+ if (fep->quirks & FEC_QUIRK_ERR006687) |
2119 |
+ imx6q_cpuidle_fec_irqs_used(); |
2120 |
+diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c |
2121 |
+index e2f6670d6eaf0..75a1915d95aa8 100644 |
2122 |
+--- a/drivers/net/ethernet/ibm/ibmveth.c |
2123 |
++++ b/drivers/net/ethernet/ibm/ibmveth.c |
2124 |
+@@ -1330,6 +1330,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) |
2125 |
+ int offset = ibmveth_rxq_frame_offset(adapter); |
2126 |
+ int csum_good = ibmveth_rxq_csum_good(adapter); |
2127 |
+ int lrg_pkt = ibmveth_rxq_large_packet(adapter); |
2128 |
++ __sum16 iph_check = 0; |
2129 |
+ |
2130 |
+ skb = ibmveth_rxq_get_buffer(adapter); |
2131 |
+ |
2132 |
+@@ -1366,16 +1367,26 @@ static int ibmveth_poll(struct napi_struct *napi, int budget) |
2133 |
+ skb_put(skb, length); |
2134 |
+ skb->protocol = eth_type_trans(skb, netdev); |
2135 |
+ |
2136 |
+- if (csum_good) { |
2137 |
+- skb->ip_summed = CHECKSUM_UNNECESSARY; |
2138 |
+- ibmveth_rx_csum_helper(skb, adapter); |
2139 |
++ /* PHYP without PLSO support places a -1 in the ip |
2140 |
++ * checksum for large send frames. |
2141 |
++ */ |
2142 |
++ if (skb->protocol == cpu_to_be16(ETH_P_IP)) { |
2143 |
++ struct iphdr *iph = (struct iphdr *)skb->data; |
2144 |
++ |
2145 |
++ iph_check = iph->check; |
2146 |
+ } |
2147 |
+ |
2148 |
+- if (length > netdev->mtu + ETH_HLEN) { |
2149 |
++ if ((length > netdev->mtu + ETH_HLEN) || |
2150 |
++ lrg_pkt || iph_check == 0xffff) { |
2151 |
+ ibmveth_rx_mss_helper(skb, mss, lrg_pkt); |
2152 |
+ adapter->rx_large_packets++; |
2153 |
+ } |
2154 |
+ |
2155 |
++ if (csum_good) { |
2156 |
++ skb->ip_summed = CHECKSUM_UNNECESSARY; |
2157 |
++ ibmveth_rx_csum_helper(skb, adapter); |
2158 |
++ } |
2159 |
++ |
2160 |
+ napi_gro_receive(napi, skb); /* send it up */ |
2161 |
+ |
2162 |
+ netdev->stats.rx_packets++; |
2163 |
+diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c |
2164 |
+index ae195f8adff58..5bdff77c0ad10 100644 |
2165 |
+--- a/drivers/net/ethernet/korina.c |
2166 |
++++ b/drivers/net/ethernet/korina.c |
2167 |
+@@ -1113,7 +1113,7 @@ out: |
2168 |
+ return rc; |
2169 |
+ |
2170 |
+ probe_err_register: |
2171 |
+- kfree(lp->td_ring); |
2172 |
++ kfree(KSEG0ADDR(lp->td_ring)); |
2173 |
+ probe_err_td_ring: |
2174 |
+ iounmap(lp->tx_dma_regs); |
2175 |
+ probe_err_dma_tx: |
2176 |
+@@ -1133,6 +1133,7 @@ static int korina_remove(struct platform_device *pdev) |
2177 |
+ iounmap(lp->eth_regs); |
2178 |
+ iounmap(lp->rx_dma_regs); |
2179 |
+ iounmap(lp->tx_dma_regs); |
2180 |
++ kfree(KSEG0ADDR(lp->td_ring)); |
2181 |
+ |
2182 |
+ unregister_netdev(bif->dev); |
2183 |
+ free_netdev(bif->dev); |
2184 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_rx.c b/drivers/net/ethernet/mellanox/mlx4/en_rx.c |
2185 |
+index 45d9a5f8fa1bc..f509a6ce31db7 100644 |
2186 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_rx.c |
2187 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_rx.c |
2188 |
+@@ -945,6 +945,9 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget) |
2189 |
+ bool clean_complete = true; |
2190 |
+ int done; |
2191 |
+ |
2192 |
++ if (!budget) |
2193 |
++ return 0; |
2194 |
++ |
2195 |
+ if (priv->tx_ring_num[TX_XDP]) { |
2196 |
+ xdp_tx_cq = priv->tx_cq[TX_XDP][cq->ring]; |
2197 |
+ if (xdp_tx_cq->xdp_busy) { |
2198 |
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
2199 |
+index 1857ee0f0871d..e58052d07e399 100644 |
2200 |
+--- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
2201 |
++++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c |
2202 |
+@@ -343,7 +343,7 @@ u32 mlx4_en_recycle_tx_desc(struct mlx4_en_priv *priv, |
2203 |
+ .dma = tx_info->map0_dma, |
2204 |
+ }; |
2205 |
+ |
2206 |
+- if (!mlx4_en_rx_recycle(ring->recycle_ring, &frame)) { |
2207 |
++ if (!napi_mode || !mlx4_en_rx_recycle(ring->recycle_ring, &frame)) { |
2208 |
+ dma_unmap_page(priv->ddev, tx_info->map0_dma, |
2209 |
+ PAGE_SIZE, priv->dma_dir); |
2210 |
+ put_page(tx_info->page); |
2211 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
2212 |
+index d359e850dbf07..0fd62510fb277 100644 |
2213 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
2214 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c |
2215 |
+@@ -475,8 +475,9 @@ void mlx5_pps_event(struct mlx5_core_dev *mdev, |
2216 |
+ switch (clock->ptp_info.pin_config[pin].func) { |
2217 |
+ case PTP_PF_EXTTS: |
2218 |
+ ptp_event.index = pin; |
2219 |
+- ptp_event.timestamp = timecounter_cyc2time(&clock->tc, |
2220 |
+- be64_to_cpu(eqe->data.pps.time_stamp)); |
2221 |
++ ptp_event.timestamp = |
2222 |
++ mlx5_timecounter_cyc2time(clock, |
2223 |
++ be64_to_cpu(eqe->data.pps.time_stamp)); |
2224 |
+ if (clock->pps_info.enabled) { |
2225 |
+ ptp_event.type = PTP_CLOCK_PPSUSR; |
2226 |
+ ptp_event.pps_times.ts_real = |
2227 |
+diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c |
2228 |
+index 6df404e3dd271..58dc4fe139fbe 100644 |
2229 |
+--- a/drivers/net/ethernet/realtek/r8169.c |
2230 |
++++ b/drivers/net/ethernet/realtek/r8169.c |
2231 |
+@@ -4111,6 +4111,27 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr) |
2232 |
+ rtl_unlock_work(tp); |
2233 |
+ } |
2234 |
+ |
2235 |
++static void rtl_init_rxcfg(struct rtl8169_private *tp) |
2236 |
++{ |
2237 |
++ switch (tp->mac_version) { |
2238 |
++ case RTL_GIGA_MAC_VER_01 ... RTL_GIGA_MAC_VER_06: |
2239 |
++ case RTL_GIGA_MAC_VER_10 ... RTL_GIGA_MAC_VER_17: |
2240 |
++ RTL_W32(tp, RxConfig, RX_FIFO_THRESH | RX_DMA_BURST); |
2241 |
++ break; |
2242 |
++ case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24: |
2243 |
++ case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_36: |
2244 |
++ case RTL_GIGA_MAC_VER_38: |
2245 |
++ RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
2246 |
++ break; |
2247 |
++ case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_51: |
2248 |
++ RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); |
2249 |
++ break; |
2250 |
++ default: |
2251 |
++ RTL_W32(tp, RxConfig, RX128_INT_EN | RX_DMA_BURST); |
2252 |
++ break; |
2253 |
++ } |
2254 |
++} |
2255 |
++ |
2256 |
+ static int rtl_set_mac_address(struct net_device *dev, void *p) |
2257 |
+ { |
2258 |
+ struct rtl8169_private *tp = netdev_priv(dev); |
2259 |
+@@ -4128,6 +4149,10 @@ static int rtl_set_mac_address(struct net_device *dev, void *p) |
2260 |
+ |
2261 |
+ pm_runtime_put_noidle(d); |
2262 |
+ |
2263 |
++ /* Reportedly at least Asus X453MA truncates packets otherwise */ |
2264 |
++ if (tp->mac_version == RTL_GIGA_MAC_VER_37) |
2265 |
++ rtl_init_rxcfg(tp); |
2266 |
++ |
2267 |
+ return 0; |
2268 |
+ } |
2269 |
+ |
2270 |
+@@ -4289,27 +4314,6 @@ static void rtl_pll_power_up(struct rtl8169_private *tp) |
2271 |
+ } |
2272 |
+ } |
2273 |
+ |
2274 |
+-static void rtl_init_rxcfg(struct rtl8169_private *tp) |
2275 |
+-{ |
2276 |
+- switch (tp->mac_version) { |
2277 |
+- case RTL_GIGA_MAC_VER_01 ... RTL_GIGA_MAC_VER_06: |
2278 |
+- case RTL_GIGA_MAC_VER_10 ... RTL_GIGA_MAC_VER_17: |
2279 |
+- RTL_W32(tp, RxConfig, RX_FIFO_THRESH | RX_DMA_BURST); |
2280 |
+- break; |
2281 |
+- case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24: |
2282 |
+- case RTL_GIGA_MAC_VER_34 ... RTL_GIGA_MAC_VER_36: |
2283 |
+- case RTL_GIGA_MAC_VER_38: |
2284 |
+- RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST); |
2285 |
+- break; |
2286 |
+- case RTL_GIGA_MAC_VER_40 ... RTL_GIGA_MAC_VER_51: |
2287 |
+- RTL_W32(tp, RxConfig, RX128_INT_EN | RX_MULTI_EN | RX_DMA_BURST | RX_EARLY_OFF); |
2288 |
+- break; |
2289 |
+- default: |
2290 |
+- RTL_W32(tp, RxConfig, RX128_INT_EN | RX_DMA_BURST); |
2291 |
+- break; |
2292 |
+- } |
2293 |
+-} |
2294 |
+- |
2295 |
+ static void rtl8169_init_ring_indexes(struct rtl8169_private *tp) |
2296 |
+ { |
2297 |
+ tp->dirty_tx = tp->cur_tx = tp->cur_rx = 0; |
2298 |
+@@ -6826,7 +6830,7 @@ static int rtl8169_close(struct net_device *dev) |
2299 |
+ |
2300 |
+ phy_disconnect(dev->phydev); |
2301 |
+ |
2302 |
+- pci_free_irq(pdev, 0, tp); |
2303 |
++ free_irq(pci_irq_vector(pdev, 0), tp); |
2304 |
+ |
2305 |
+ dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
2306 |
+ tp->RxPhyAddr); |
2307 |
+@@ -6881,8 +6885,8 @@ static int rtl_open(struct net_device *dev) |
2308 |
+ |
2309 |
+ rtl_request_firmware(tp); |
2310 |
+ |
2311 |
+- retval = pci_request_irq(pdev, 0, rtl8169_interrupt, NULL, tp, |
2312 |
+- dev->name); |
2313 |
++ retval = request_irq(pci_irq_vector(pdev, 0), rtl8169_interrupt, |
2314 |
++ IRQF_NO_THREAD | IRQF_SHARED, dev->name, tp); |
2315 |
+ if (retval < 0) |
2316 |
+ goto err_release_fw_2; |
2317 |
+ |
2318 |
+@@ -6915,7 +6919,7 @@ out: |
2319 |
+ return retval; |
2320 |
+ |
2321 |
+ err_free_irq: |
2322 |
+- pci_free_irq(pdev, 0, tp); |
2323 |
++ free_irq(pci_irq_vector(pdev, 0), tp); |
2324 |
+ err_release_fw_2: |
2325 |
+ rtl_release_firmware(tp); |
2326 |
+ rtl8169_rx_clear(tp); |
2327 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2328 |
+index c41879a955b57..2872684906e14 100644 |
2329 |
+--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2330 |
++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |
2331 |
+@@ -177,32 +177,6 @@ static void stmmac_enable_all_queues(struct stmmac_priv *priv) |
2332 |
+ } |
2333 |
+ } |
2334 |
+ |
2335 |
+-/** |
2336 |
+- * stmmac_stop_all_queues - Stop all queues |
2337 |
+- * @priv: driver private structure |
2338 |
+- */ |
2339 |
+-static void stmmac_stop_all_queues(struct stmmac_priv *priv) |
2340 |
+-{ |
2341 |
+- u32 tx_queues_cnt = priv->plat->tx_queues_to_use; |
2342 |
+- u32 queue; |
2343 |
+- |
2344 |
+- for (queue = 0; queue < tx_queues_cnt; queue++) |
2345 |
+- netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, queue)); |
2346 |
+-} |
2347 |
+- |
2348 |
+-/** |
2349 |
+- * stmmac_start_all_queues - Start all queues |
2350 |
+- * @priv: driver private structure |
2351 |
+- */ |
2352 |
+-static void stmmac_start_all_queues(struct stmmac_priv *priv) |
2353 |
+-{ |
2354 |
+- u32 tx_queues_cnt = priv->plat->tx_queues_to_use; |
2355 |
+- u32 queue; |
2356 |
+- |
2357 |
+- for (queue = 0; queue < tx_queues_cnt; queue++) |
2358 |
+- netif_tx_start_queue(netdev_get_tx_queue(priv->dev, queue)); |
2359 |
+-} |
2360 |
+- |
2361 |
+ static void stmmac_service_event_schedule(struct stmmac_priv *priv) |
2362 |
+ { |
2363 |
+ if (!test_bit(STMMAC_DOWN, &priv->state) && |
2364 |
+@@ -2678,7 +2652,7 @@ static int stmmac_open(struct net_device *dev) |
2365 |
+ } |
2366 |
+ |
2367 |
+ stmmac_enable_all_queues(priv); |
2368 |
+- stmmac_start_all_queues(priv); |
2369 |
++ netif_tx_start_all_queues(priv->dev); |
2370 |
+ |
2371 |
+ return 0; |
2372 |
+ |
2373 |
+@@ -2724,8 +2698,6 @@ static int stmmac_release(struct net_device *dev) |
2374 |
+ phy_disconnect(dev->phydev); |
2375 |
+ } |
2376 |
+ |
2377 |
+- stmmac_stop_all_queues(priv); |
2378 |
+- |
2379 |
+ stmmac_disable_all_queues(priv); |
2380 |
+ |
2381 |
+ for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) |
2382 |
+@@ -4519,7 +4491,6 @@ int stmmac_suspend(struct device *dev) |
2383 |
+ mutex_lock(&priv->lock); |
2384 |
+ |
2385 |
+ netif_device_detach(ndev); |
2386 |
+- stmmac_stop_all_queues(priv); |
2387 |
+ |
2388 |
+ stmmac_disable_all_queues(priv); |
2389 |
+ |
2390 |
+@@ -4628,8 +4599,6 @@ int stmmac_resume(struct device *dev) |
2391 |
+ |
2392 |
+ stmmac_enable_all_queues(priv); |
2393 |
+ |
2394 |
+- stmmac_start_all_queues(priv); |
2395 |
+- |
2396 |
+ mutex_unlock(&priv->lock); |
2397 |
+ |
2398 |
+ if (ndev->phydev) |
2399 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
2400 |
+index af58bf54aa9b6..d2612b69257ea 100644 |
2401 |
+--- a/drivers/net/usb/qmi_wwan.c |
2402 |
++++ b/drivers/net/usb/qmi_wwan.c |
2403 |
+@@ -1312,6 +1312,7 @@ static const struct usb_device_id products[] = { |
2404 |
+ {QMI_QUIRK_SET_DTR(0x2cb7, 0x0104, 4)}, /* Fibocom NL678 series */ |
2405 |
+ {QMI_FIXED_INTF(0x0489, 0xe0b4, 0)}, /* Foxconn T77W968 LTE */ |
2406 |
+ {QMI_FIXED_INTF(0x0489, 0xe0b5, 0)}, /* Foxconn T77W968 LTE with eSIM support*/ |
2407 |
++ {QMI_FIXED_INTF(0x2692, 0x9025, 4)}, /* Cellient MPL200 (rebranded Qualcomm 05c6:9025) */ |
2408 |
+ |
2409 |
+ /* 4. Gobi 1000 devices */ |
2410 |
+ {QMI_GOBI1K_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
2411 |
+diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c |
2412 |
+index 7221a53b8b144..500463044b1ab 100644 |
2413 |
+--- a/drivers/net/wan/hdlc.c |
2414 |
++++ b/drivers/net/wan/hdlc.c |
2415 |
+@@ -49,7 +49,15 @@ static struct hdlc_proto *first_proto; |
2416 |
+ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, |
2417 |
+ struct packet_type *p, struct net_device *orig_dev) |
2418 |
+ { |
2419 |
+- struct hdlc_device *hdlc = dev_to_hdlc(dev); |
2420 |
++ struct hdlc_device *hdlc; |
2421 |
++ |
2422 |
++ /* First make sure "dev" is an HDLC device */ |
2423 |
++ if (!(dev->priv_flags & IFF_WAN_HDLC)) { |
2424 |
++ kfree_skb(skb); |
2425 |
++ return NET_RX_SUCCESS; |
2426 |
++ } |
2427 |
++ |
2428 |
++ hdlc = dev_to_hdlc(dev); |
2429 |
+ |
2430 |
+ if (!net_eq(dev_net(dev), &init_net)) { |
2431 |
+ kfree_skb(skb); |
2432 |
+diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c |
2433 |
+index 8bd3ed9058132..676dea2918bf3 100644 |
2434 |
+--- a/drivers/net/wan/hdlc_raw_eth.c |
2435 |
++++ b/drivers/net/wan/hdlc_raw_eth.c |
2436 |
+@@ -102,6 +102,7 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr) |
2437 |
+ old_qlen = dev->tx_queue_len; |
2438 |
+ ether_setup(dev); |
2439 |
+ dev->tx_queue_len = old_qlen; |
2440 |
++ dev->priv_flags &= ~IFF_TX_SKB_SHARING; |
2441 |
+ eth_hw_addr_random(dev); |
2442 |
+ call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); |
2443 |
+ netif_dormant_off(dev); |
2444 |
+diff --git a/drivers/net/wireless/ath/ath10k/ce.c b/drivers/net/wireless/ath/ath10k/ce.c |
2445 |
+index f761d651c16e7..2276d608bca35 100644 |
2446 |
+--- a/drivers/net/wireless/ath/ath10k/ce.c |
2447 |
++++ b/drivers/net/wireless/ath/ath10k/ce.c |
2448 |
+@@ -1453,7 +1453,7 @@ ath10k_ce_alloc_src_ring(struct ath10k *ar, unsigned int ce_id, |
2449 |
+ ret = ath10k_ce_alloc_shadow_base(ar, src_ring, nentries); |
2450 |
+ if (ret) { |
2451 |
+ dma_free_coherent(ar->dev, |
2452 |
+- (nentries * sizeof(struct ce_desc_64) + |
2453 |
++ (nentries * sizeof(struct ce_desc) + |
2454 |
+ CE_DESC_RING_ALIGN), |
2455 |
+ src_ring->base_addr_owner_space_unaligned, |
2456 |
+ base_addr); |
2457 |
+diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c |
2458 |
+index 81af403c19c2a..faaca7fe9ad1e 100644 |
2459 |
+--- a/drivers/net/wireless/ath/ath10k/mac.c |
2460 |
++++ b/drivers/net/wireless/ath/ath10k/mac.c |
2461 |
+@@ -6862,7 +6862,7 @@ ath10k_mac_update_bss_chan_survey(struct ath10k *ar, |
2462 |
+ struct ieee80211_channel *channel) |
2463 |
+ { |
2464 |
+ int ret; |
2465 |
+- enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ_CLEAR; |
2466 |
++ enum wmi_bss_survey_req_type type = WMI_BSS_SURVEY_REQ_TYPE_READ; |
2467 |
+ |
2468 |
+ lockdep_assert_held(&ar->conf_mutex); |
2469 |
+ |
2470 |
+diff --git a/drivers/net/wireless/ath/ath6kl/main.c b/drivers/net/wireless/ath/ath6kl/main.c |
2471 |
+index 0c61dbaa62a41..702c4761006ca 100644 |
2472 |
+--- a/drivers/net/wireless/ath/ath6kl/main.c |
2473 |
++++ b/drivers/net/wireless/ath/ath6kl/main.c |
2474 |
+@@ -429,6 +429,9 @@ void ath6kl_connect_ap_mode_sta(struct ath6kl_vif *vif, u16 aid, u8 *mac_addr, |
2475 |
+ |
2476 |
+ ath6kl_dbg(ATH6KL_DBG_TRC, "new station %pM aid=%d\n", mac_addr, aid); |
2477 |
+ |
2478 |
++ if (aid < 1 || aid > AP_MAX_NUM_STA) |
2479 |
++ return; |
2480 |
++ |
2481 |
+ if (assoc_req_len > sizeof(struct ieee80211_hdr_3addr)) { |
2482 |
+ struct ieee80211_mgmt *mgmt = |
2483 |
+ (struct ieee80211_mgmt *) assoc_info; |
2484 |
+diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c |
2485 |
+index bc7916f2add09..987ebae8ea0e1 100644 |
2486 |
+--- a/drivers/net/wireless/ath/ath6kl/wmi.c |
2487 |
++++ b/drivers/net/wireless/ath/ath6kl/wmi.c |
2488 |
+@@ -2648,6 +2648,11 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, |
2489 |
+ return -EINVAL; |
2490 |
+ } |
2491 |
+ |
2492 |
++ if (tsid >= 16) { |
2493 |
++ ath6kl_err("invalid tsid: %d\n", tsid); |
2494 |
++ return -EINVAL; |
2495 |
++ } |
2496 |
++ |
2497 |
+ skb = ath6kl_wmi_get_new_buf(sizeof(*cmd)); |
2498 |
+ if (!skb) |
2499 |
+ return -ENOMEM; |
2500 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c |
2501 |
+index f705f0e1cb5be..05fca38b38ed4 100644 |
2502 |
+--- a/drivers/net/wireless/ath/ath9k/htc_hst.c |
2503 |
++++ b/drivers/net/wireless/ath/ath9k/htc_hst.c |
2504 |
+@@ -342,6 +342,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, |
2505 |
+ |
2506 |
+ if (skb) { |
2507 |
+ htc_hdr = (struct htc_frame_hdr *) skb->data; |
2508 |
++ if (htc_hdr->endpoint_id >= ARRAY_SIZE(htc_handle->endpoint)) |
2509 |
++ goto ret; |
2510 |
+ endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id]; |
2511 |
+ skb_pull(skb, sizeof(struct htc_frame_hdr)); |
2512 |
+ |
2513 |
+diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c |
2514 |
+index ad051f34e65b2..46ae4ec4ad47d 100644 |
2515 |
+--- a/drivers/net/wireless/ath/wcn36xx/main.c |
2516 |
++++ b/drivers/net/wireless/ath/wcn36xx/main.c |
2517 |
+@@ -163,7 +163,7 @@ static struct ieee80211_supported_band wcn_band_5ghz = { |
2518 |
+ .ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
2519 |
+ .mcs = { |
2520 |
+ .rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
2521 |
+- .rx_highest = cpu_to_le16(72), |
2522 |
++ .rx_highest = cpu_to_le16(150), |
2523 |
+ .tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
2524 |
+ } |
2525 |
+ } |
2526 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2527 |
+index 9d7b8834b8545..db4c541f58ae0 100644 |
2528 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2529 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
2530 |
+@@ -438,7 +438,7 @@ static int brcmf_rx_hdrpull(struct brcmf_pub *drvr, struct sk_buff *skb, |
2531 |
+ ret = brcmf_proto_hdrpull(drvr, true, skb, ifp); |
2532 |
+ |
2533 |
+ if (ret || !(*ifp) || !(*ifp)->ndev) { |
2534 |
+- if (ret != -ENODATA && *ifp) |
2535 |
++ if (ret != -ENODATA && *ifp && (*ifp)->ndev) |
2536 |
+ (*ifp)->ndev->stats.rx_errors++; |
2537 |
+ brcmu_pkt_buf_free_skb(skb); |
2538 |
+ return -ENODATA; |
2539 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2540 |
+index 58653598db146..525b26e0f65ee 100644 |
2541 |
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2542 |
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |
2543 |
+@@ -3424,9 +3424,12 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, |
2544 |
+ aux_roc_req.apply_time_max_delay = cpu_to_le32(delay); |
2545 |
+ |
2546 |
+ IWL_DEBUG_TE(mvm, |
2547 |
+- "ROC: Requesting to remain on channel %u for %ums (requested = %ums, max_delay = %ums, dtim_interval = %ums)\n", |
2548 |
+- channel->hw_value, req_dur, duration, delay, |
2549 |
+- dtim_interval); |
2550 |
++ "ROC: Requesting to remain on channel %u for %ums\n", |
2551 |
++ channel->hw_value, req_dur); |
2552 |
++ IWL_DEBUG_TE(mvm, |
2553 |
++ "\t(requested = %ums, max_delay = %ums, dtim_interval = %ums)\n", |
2554 |
++ duration, delay, dtim_interval); |
2555 |
++ |
2556 |
+ /* Set the node address */ |
2557 |
+ memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); |
2558 |
+ |
2559 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/scan.c b/drivers/net/wireless/marvell/mwifiex/scan.c |
2560 |
+index 85d6d5f3dce5b..c9f6cd2919699 100644 |
2561 |
+--- a/drivers/net/wireless/marvell/mwifiex/scan.c |
2562 |
++++ b/drivers/net/wireless/marvell/mwifiex/scan.c |
2563 |
+@@ -1895,7 +1895,7 @@ mwifiex_parse_single_response_buf(struct mwifiex_private *priv, u8 **bss_info, |
2564 |
+ chan, CFG80211_BSS_FTYPE_UNKNOWN, |
2565 |
+ bssid, timestamp, |
2566 |
+ cap_info_bitmap, beacon_period, |
2567 |
+- ie_buf, ie_len, rssi, GFP_KERNEL); |
2568 |
++ ie_buf, ie_len, rssi, GFP_ATOMIC); |
2569 |
+ if (bss) { |
2570 |
+ bss_priv = (struct mwifiex_bss_priv *)bss->priv; |
2571 |
+ bss_priv->band = band; |
2572 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.c b/drivers/net/wireless/marvell/mwifiex/sdio.c |
2573 |
+index bfbe3aa058d93..0773d81072aa1 100644 |
2574 |
+--- a/drivers/net/wireless/marvell/mwifiex/sdio.c |
2575 |
++++ b/drivers/net/wireless/marvell/mwifiex/sdio.c |
2576 |
+@@ -1985,6 +1985,8 @@ error: |
2577 |
+ kfree(card->mpa_rx.buf); |
2578 |
+ card->mpa_tx.buf_size = 0; |
2579 |
+ card->mpa_rx.buf_size = 0; |
2580 |
++ card->mpa_tx.buf = NULL; |
2581 |
++ card->mpa_rx.buf = NULL; |
2582 |
+ } |
2583 |
+ |
2584 |
+ return ret; |
2585 |
+diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2586 |
+index 734844b34c266..dd473b206f123 100644 |
2587 |
+--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2588 |
++++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c |
2589 |
+@@ -894,6 +894,7 @@ int qtnf_cmd_send_del_intf(struct qtnf_vif *vif) |
2590 |
+ default: |
2591 |
+ pr_warn("VIF%u.%u: unsupported iftype %d\n", vif->mac->macid, |
2592 |
+ vif->vifid, vif->wdev.iftype); |
2593 |
++ dev_kfree_skb(cmd_skb); |
2594 |
+ ret = -EINVAL; |
2595 |
+ goto out; |
2596 |
+ } |
2597 |
+@@ -2212,6 +2213,7 @@ int qtnf_cmd_send_change_sta(struct qtnf_vif *vif, const u8 *mac, |
2598 |
+ break; |
2599 |
+ default: |
2600 |
+ pr_err("unsupported iftype %d\n", vif->wdev.iftype); |
2601 |
++ dev_kfree_skb(cmd_skb); |
2602 |
+ ret = -EINVAL; |
2603 |
+ goto out; |
2604 |
+ } |
2605 |
+diff --git a/drivers/perf/xgene_pmu.c b/drivers/perf/xgene_pmu.c |
2606 |
+index 0e31f1392a53c..949b07e29c06b 100644 |
2607 |
+--- a/drivers/perf/xgene_pmu.c |
2608 |
++++ b/drivers/perf/xgene_pmu.c |
2609 |
+@@ -1474,17 +1474,6 @@ static char *xgene_pmu_dev_name(struct device *dev, u32 type, int id) |
2610 |
+ } |
2611 |
+ |
2612 |
+ #if defined(CONFIG_ACPI) |
2613 |
+-static int acpi_pmu_dev_add_resource(struct acpi_resource *ares, void *data) |
2614 |
+-{ |
2615 |
+- struct resource *res = data; |
2616 |
+- |
2617 |
+- if (ares->type == ACPI_RESOURCE_TYPE_FIXED_MEMORY32) |
2618 |
+- acpi_dev_resource_memory(ares, res); |
2619 |
+- |
2620 |
+- /* Always tell the ACPI core to skip this resource */ |
2621 |
+- return 1; |
2622 |
+-} |
2623 |
+- |
2624 |
+ static struct |
2625 |
+ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, |
2626 |
+ struct acpi_device *adev, u32 type) |
2627 |
+@@ -1496,6 +1485,7 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, |
2628 |
+ struct hw_pmu_info *inf; |
2629 |
+ void __iomem *dev_csr; |
2630 |
+ struct resource res; |
2631 |
++ struct resource_entry *rentry; |
2632 |
+ int enable_bit; |
2633 |
+ int rc; |
2634 |
+ |
2635 |
+@@ -1504,11 +1494,23 @@ xgene_pmu_dev_ctx *acpi_get_pmu_hw_inf(struct xgene_pmu *xgene_pmu, |
2636 |
+ return NULL; |
2637 |
+ |
2638 |
+ INIT_LIST_HEAD(&resource_list); |
2639 |
+- rc = acpi_dev_get_resources(adev, &resource_list, |
2640 |
+- acpi_pmu_dev_add_resource, &res); |
2641 |
++ rc = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); |
2642 |
++ if (rc <= 0) { |
2643 |
++ dev_err(dev, "PMU type %d: No resources found\n", type); |
2644 |
++ return NULL; |
2645 |
++ } |
2646 |
++ |
2647 |
++ list_for_each_entry(rentry, &resource_list, node) { |
2648 |
++ if (resource_type(rentry->res) == IORESOURCE_MEM) { |
2649 |
++ res = *rentry->res; |
2650 |
++ rentry = NULL; |
2651 |
++ break; |
2652 |
++ } |
2653 |
++ } |
2654 |
+ acpi_dev_free_resource_list(&resource_list); |
2655 |
+- if (rc < 0) { |
2656 |
+- dev_err(dev, "PMU type %d: No resource address found\n", type); |
2657 |
++ |
2658 |
++ if (rentry) { |
2659 |
++ dev_err(dev, "PMU type %d: No memory resource found\n", type); |
2660 |
+ return NULL; |
2661 |
+ } |
2662 |
+ |
2663 |
+diff --git a/drivers/pinctrl/bcm/Kconfig b/drivers/pinctrl/bcm/Kconfig |
2664 |
+index 0f38d51f47c64..e6cd314919de1 100644 |
2665 |
+--- a/drivers/pinctrl/bcm/Kconfig |
2666 |
++++ b/drivers/pinctrl/bcm/Kconfig |
2667 |
+@@ -21,6 +21,7 @@ config PINCTRL_BCM2835 |
2668 |
+ select PINMUX |
2669 |
+ select PINCONF |
2670 |
+ select GENERIC_PINCONF |
2671 |
++ select GPIOLIB |
2672 |
+ select GPIOLIB_IRQCHIP |
2673 |
+ |
2674 |
+ config PINCTRL_IPROC_GPIO |
2675 |
+diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c |
2676 |
+index 33c3eca0ece97..5b5a4323ae63d 100644 |
2677 |
+--- a/drivers/pinctrl/pinctrl-mcp23s08.c |
2678 |
++++ b/drivers/pinctrl/pinctrl-mcp23s08.c |
2679 |
+@@ -120,7 +120,7 @@ static const struct regmap_config mcp23x08_regmap = { |
2680 |
+ .max_register = MCP_OLAT, |
2681 |
+ }; |
2682 |
+ |
2683 |
+-static const struct reg_default mcp23x16_defaults[] = { |
2684 |
++static const struct reg_default mcp23x17_defaults[] = { |
2685 |
+ {.reg = MCP_IODIR << 1, .def = 0xffff}, |
2686 |
+ {.reg = MCP_IPOL << 1, .def = 0x0000}, |
2687 |
+ {.reg = MCP_GPINTEN << 1, .def = 0x0000}, |
2688 |
+@@ -131,23 +131,23 @@ static const struct reg_default mcp23x16_defaults[] = { |
2689 |
+ {.reg = MCP_OLAT << 1, .def = 0x0000}, |
2690 |
+ }; |
2691 |
+ |
2692 |
+-static const struct regmap_range mcp23x16_volatile_range = { |
2693 |
++static const struct regmap_range mcp23x17_volatile_range = { |
2694 |
+ .range_min = MCP_INTF << 1, |
2695 |
+ .range_max = MCP_GPIO << 1, |
2696 |
+ }; |
2697 |
+ |
2698 |
+-static const struct regmap_access_table mcp23x16_volatile_table = { |
2699 |
+- .yes_ranges = &mcp23x16_volatile_range, |
2700 |
++static const struct regmap_access_table mcp23x17_volatile_table = { |
2701 |
++ .yes_ranges = &mcp23x17_volatile_range, |
2702 |
+ .n_yes_ranges = 1, |
2703 |
+ }; |
2704 |
+ |
2705 |
+-static const struct regmap_range mcp23x16_precious_range = { |
2706 |
+- .range_min = MCP_GPIO << 1, |
2707 |
++static const struct regmap_range mcp23x17_precious_range = { |
2708 |
++ .range_min = MCP_INTCAP << 1, |
2709 |
+ .range_max = MCP_GPIO << 1, |
2710 |
+ }; |
2711 |
+ |
2712 |
+-static const struct regmap_access_table mcp23x16_precious_table = { |
2713 |
+- .yes_ranges = &mcp23x16_precious_range, |
2714 |
++static const struct regmap_access_table mcp23x17_precious_table = { |
2715 |
++ .yes_ranges = &mcp23x17_precious_range, |
2716 |
+ .n_yes_ranges = 1, |
2717 |
+ }; |
2718 |
+ |
2719 |
+@@ -157,10 +157,10 @@ static const struct regmap_config mcp23x17_regmap = { |
2720 |
+ |
2721 |
+ .reg_stride = 2, |
2722 |
+ .max_register = MCP_OLAT << 1, |
2723 |
+- .volatile_table = &mcp23x16_volatile_table, |
2724 |
+- .precious_table = &mcp23x16_precious_table, |
2725 |
+- .reg_defaults = mcp23x16_defaults, |
2726 |
+- .num_reg_defaults = ARRAY_SIZE(mcp23x16_defaults), |
2727 |
++ .volatile_table = &mcp23x17_volatile_table, |
2728 |
++ .precious_table = &mcp23x17_precious_table, |
2729 |
++ .reg_defaults = mcp23x17_defaults, |
2730 |
++ .num_reg_defaults = ARRAY_SIZE(mcp23x17_defaults), |
2731 |
+ .cache_type = REGCACHE_FLAT, |
2732 |
+ .val_format_endian = REGMAP_ENDIAN_LITTLE, |
2733 |
+ }; |
2734 |
+diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-platform.c |
2735 |
+index 69e28c12d5915..0c72de95b5ccd 100644 |
2736 |
+--- a/drivers/platform/x86/mlx-platform.c |
2737 |
++++ b/drivers/platform/x86/mlx-platform.c |
2738 |
+@@ -221,15 +221,6 @@ static struct i2c_board_info mlxplat_mlxcpld_psu[] = { |
2739 |
+ }, |
2740 |
+ }; |
2741 |
+ |
2742 |
+-static struct i2c_board_info mlxplat_mlxcpld_ng_psu[] = { |
2743 |
+- { |
2744 |
+- I2C_BOARD_INFO("24c32", 0x51), |
2745 |
+- }, |
2746 |
+- { |
2747 |
+- I2C_BOARD_INFO("24c32", 0x50), |
2748 |
+- }, |
2749 |
+-}; |
2750 |
+- |
2751 |
+ static struct i2c_board_info mlxplat_mlxcpld_pwr[] = { |
2752 |
+ { |
2753 |
+ I2C_BOARD_INFO("dps460", 0x59), |
2754 |
+@@ -589,15 +580,13 @@ static struct mlxreg_core_data mlxplat_mlxcpld_default_ng_psu_items_data[] = { |
2755 |
+ .label = "psu1", |
2756 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
2757 |
+ .mask = BIT(0), |
2758 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_ng_psu[0], |
2759 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
2760 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
2761 |
+ }, |
2762 |
+ { |
2763 |
+ .label = "psu2", |
2764 |
+ .reg = MLXPLAT_CPLD_LPC_REG_PSU_OFFSET, |
2765 |
+ .mask = BIT(1), |
2766 |
+- .hpdev.brdinfo = &mlxplat_mlxcpld_ng_psu[1], |
2767 |
+- .hpdev.nr = MLXPLAT_CPLD_PSU_MSNXXXX_NR, |
2768 |
++ .hpdev.nr = MLXPLAT_CPLD_NR_NONE, |
2769 |
+ }, |
2770 |
+ }; |
2771 |
+ |
2772 |
+diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c |
2773 |
+index 7a4a6406cf69a..69f8be065919e 100644 |
2774 |
+--- a/drivers/pwm/pwm-lpss.c |
2775 |
++++ b/drivers/pwm/pwm-lpss.c |
2776 |
+@@ -105,10 +105,12 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm, |
2777 |
+ * The equation is: |
2778 |
+ * base_unit = round(base_unit_range * freq / c) |
2779 |
+ */ |
2780 |
+- base_unit_range = BIT(lpwm->info->base_unit_bits) - 1; |
2781 |
++ base_unit_range = BIT(lpwm->info->base_unit_bits); |
2782 |
+ freq *= base_unit_range; |
2783 |
+ |
2784 |
+ base_unit = DIV_ROUND_CLOSEST_ULL(freq, c); |
2785 |
++ /* base_unit must not be 0 and we also want to avoid overflowing it */ |
2786 |
++ base_unit = clamp_val(base_unit, 1, base_unit_range - 1); |
2787 |
+ |
2788 |
+ on_time_div = 255ULL * duty_ns; |
2789 |
+ do_div(on_time_div, period_ns); |
2790 |
+@@ -116,8 +118,7 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm, |
2791 |
+ |
2792 |
+ orig_ctrl = ctrl = pwm_lpss_read(pwm); |
2793 |
+ ctrl &= ~PWM_ON_TIME_DIV_MASK; |
2794 |
+- ctrl &= ~(base_unit_range << PWM_BASE_UNIT_SHIFT); |
2795 |
+- base_unit &= base_unit_range; |
2796 |
++ ctrl &= ~((base_unit_range - 1) << PWM_BASE_UNIT_SHIFT); |
2797 |
+ ctrl |= (u32) base_unit << PWM_BASE_UNIT_SHIFT; |
2798 |
+ ctrl |= on_time_div; |
2799 |
+ |
2800 |
+diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c |
2801 |
+index 37e6270749eef..c290c89421314 100644 |
2802 |
+--- a/drivers/regulator/core.c |
2803 |
++++ b/drivers/regulator/core.c |
2804 |
+@@ -4363,15 +4363,20 @@ regulator_register(const struct regulator_desc *regulator_desc, |
2805 |
+ else if (regulator_desc->supply_name) |
2806 |
+ rdev->supply_name = regulator_desc->supply_name; |
2807 |
+ |
2808 |
+- /* |
2809 |
+- * Attempt to resolve the regulator supply, if specified, |
2810 |
+- * but don't return an error if we fail because we will try |
2811 |
+- * to resolve it again later as more regulators are added. |
2812 |
+- */ |
2813 |
+- if (regulator_resolve_supply(rdev)) |
2814 |
+- rdev_dbg(rdev, "unable to resolve supply\n"); |
2815 |
+- |
2816 |
+ ret = set_machine_constraints(rdev, constraints); |
2817 |
++ if (ret == -EPROBE_DEFER) { |
2818 |
++ /* Regulator might be in bypass mode and so needs its supply |
2819 |
++ * to set the constraints */ |
2820 |
++ /* FIXME: this currently triggers a chicken-and-egg problem |
2821 |
++ * when creating -SUPPLY symlink in sysfs to a regulator |
2822 |
++ * that is just being created */ |
2823 |
++ ret = regulator_resolve_supply(rdev); |
2824 |
++ if (!ret) |
2825 |
++ ret = set_machine_constraints(rdev, constraints); |
2826 |
++ else |
2827 |
++ rdev_dbg(rdev, "unable to resolve supply early: %pe\n", |
2828 |
++ ERR_PTR(ret)); |
2829 |
++ } |
2830 |
+ if (ret < 0) |
2831 |
+ goto wash; |
2832 |
+ |
2833 |
+diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c |
2834 |
+index 3660059784f74..6221a8372cee2 100644 |
2835 |
+--- a/drivers/scsi/be2iscsi/be_main.c |
2836 |
++++ b/drivers/scsi/be2iscsi/be_main.c |
2837 |
+@@ -3039,6 +3039,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, |
2838 |
+ goto create_eq_error; |
2839 |
+ } |
2840 |
+ |
2841 |
++ mem->dma = paddr; |
2842 |
+ mem->va = eq_vaddress; |
2843 |
+ ret = be_fill_queue(eq, phba->params.num_eq_entries, |
2844 |
+ sizeof(struct be_eq_entry), eq_vaddress); |
2845 |
+@@ -3048,7 +3049,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, |
2846 |
+ goto create_eq_error; |
2847 |
+ } |
2848 |
+ |
2849 |
+- mem->dma = paddr; |
2850 |
+ ret = beiscsi_cmd_eq_create(&phba->ctrl, eq, |
2851 |
+ BEISCSI_EQ_DELAY_DEF); |
2852 |
+ if (ret) { |
2853 |
+@@ -3105,6 +3105,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, |
2854 |
+ goto create_cq_error; |
2855 |
+ } |
2856 |
+ |
2857 |
++ mem->dma = paddr; |
2858 |
+ ret = be_fill_queue(cq, phba->params.num_cq_entries, |
2859 |
+ sizeof(struct sol_cqe), cq_vaddress); |
2860 |
+ if (ret) { |
2861 |
+@@ -3114,7 +3115,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, |
2862 |
+ goto create_cq_error; |
2863 |
+ } |
2864 |
+ |
2865 |
+- mem->dma = paddr; |
2866 |
+ ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false, |
2867 |
+ false, 0); |
2868 |
+ if (ret) { |
2869 |
+diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c |
2870 |
+index e519238864758..1b6f9351b43f9 100644 |
2871 |
+--- a/drivers/scsi/csiostor/csio_hw.c |
2872 |
++++ b/drivers/scsi/csiostor/csio_hw.c |
2873 |
+@@ -2384,7 +2384,7 @@ static int csio_hw_prep_fw(struct csio_hw *hw, struct fw_info *fw_info, |
2874 |
+ FW_HDR_FW_VER_MICRO_G(c), FW_HDR_FW_VER_BUILD_G(c), |
2875 |
+ FW_HDR_FW_VER_MAJOR_G(k), FW_HDR_FW_VER_MINOR_G(k), |
2876 |
+ FW_HDR_FW_VER_MICRO_G(k), FW_HDR_FW_VER_BUILD_G(k)); |
2877 |
+- ret = EINVAL; |
2878 |
++ ret = -EINVAL; |
2879 |
+ goto bye; |
2880 |
+ } |
2881 |
+ |
2882 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
2883 |
+index 3e2f8ce1d9a97..7821c1695e824 100644 |
2884 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
2885 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
2886 |
+@@ -676,7 +676,7 @@ int qla_nvme_register_hba(struct scsi_qla_host *vha) |
2887 |
+ struct nvme_fc_port_template *tmpl; |
2888 |
+ struct qla_hw_data *ha; |
2889 |
+ struct nvme_fc_port_info pinfo; |
2890 |
+- int ret = EINVAL; |
2891 |
++ int ret = -EINVAL; |
2892 |
+ |
2893 |
+ if (!IS_ENABLED(CONFIG_NVME_FC)) |
2894 |
+ return ret; |
2895 |
+diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
2896 |
+index f59b8982b2883..4ba9f46fcf748 100644 |
2897 |
+--- a/drivers/scsi/qla4xxx/ql4_os.c |
2898 |
++++ b/drivers/scsi/qla4xxx/ql4_os.c |
2899 |
+@@ -1221,7 +1221,7 @@ static int qla4xxx_get_host_stats(struct Scsi_Host *shost, char *buf, int len) |
2900 |
+ le64_to_cpu(ql_iscsi_stats->iscsi_sequence_error); |
2901 |
+ exit_host_stats: |
2902 |
+ if (ql_iscsi_stats) |
2903 |
+- dma_free_coherent(&ha->pdev->dev, host_stats_size, |
2904 |
++ dma_free_coherent(&ha->pdev->dev, stats_size, |
2905 |
+ ql_iscsi_stats, iscsi_stats_dma); |
2906 |
+ |
2907 |
+ ql4_printk(KERN_INFO, ha, "%s: Get host stats done\n", |
2908 |
+diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c |
2909 |
+index 943172806a8a7..3e63e4ce45b04 100644 |
2910 |
+--- a/drivers/slimbus/core.c |
2911 |
++++ b/drivers/slimbus/core.c |
2912 |
+@@ -255,8 +255,6 @@ int slim_unregister_controller(struct slim_controller *ctrl) |
2913 |
+ { |
2914 |
+ /* Remove all clients */ |
2915 |
+ device_for_each_child(ctrl->dev, NULL, slim_ctrl_remove_device); |
2916 |
+- /* Enter Clock Pause */ |
2917 |
+- slim_ctrl_clk_pause(ctrl, false, 0); |
2918 |
+ ida_simple_remove(&ctrl_ida, ctrl->id); |
2919 |
+ |
2920 |
+ return 0; |
2921 |
+@@ -297,8 +295,8 @@ void slim_report_absent(struct slim_device *sbdev) |
2922 |
+ mutex_lock(&ctrl->lock); |
2923 |
+ sbdev->is_laddr_valid = false; |
2924 |
+ mutex_unlock(&ctrl->lock); |
2925 |
+- |
2926 |
+- ida_simple_remove(&ctrl->laddr_ida, sbdev->laddr); |
2927 |
++ if (!ctrl->get_laddr) |
2928 |
++ ida_simple_remove(&ctrl->laddr_ida, sbdev->laddr); |
2929 |
+ slim_device_update_status(sbdev, SLIM_DEVICE_STATUS_DOWN); |
2930 |
+ } |
2931 |
+ EXPORT_SYMBOL_GPL(slim_report_absent); |
2932 |
+diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
2933 |
+index f40ac8dcb0817..522a87fc573a6 100644 |
2934 |
+--- a/drivers/slimbus/qcom-ngd-ctrl.c |
2935 |
++++ b/drivers/slimbus/qcom-ngd-ctrl.c |
2936 |
+@@ -1272,9 +1272,13 @@ static void qcom_slim_ngd_qmi_del_server(struct qmi_handle *hdl, |
2937 |
+ { |
2938 |
+ struct qcom_slim_ngd_qmi *qmi = |
2939 |
+ container_of(hdl, struct qcom_slim_ngd_qmi, svc_event_hdl); |
2940 |
++ struct qcom_slim_ngd_ctrl *ctrl = |
2941 |
++ container_of(qmi, struct qcom_slim_ngd_ctrl, qmi); |
2942 |
+ |
2943 |
+ qmi->svc_info.sq_node = 0; |
2944 |
+ qmi->svc_info.sq_port = 0; |
2945 |
++ |
2946 |
++ qcom_slim_ngd_enable(ctrl, false); |
2947 |
+ } |
2948 |
+ |
2949 |
+ static struct qmi_ops qcom_slim_ngd_qmi_svc_event_ops = { |
2950 |
+diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c |
2951 |
+index 7b7151ec14c8a..1d948fee1a039 100644 |
2952 |
+--- a/drivers/spi/spi-s3c64xx.c |
2953 |
++++ b/drivers/spi/spi-s3c64xx.c |
2954 |
+@@ -122,6 +122,7 @@ |
2955 |
+ |
2956 |
+ struct s3c64xx_spi_dma_data { |
2957 |
+ struct dma_chan *ch; |
2958 |
++ dma_cookie_t cookie; |
2959 |
+ enum dma_transfer_direction direction; |
2960 |
+ }; |
2961 |
+ |
2962 |
+@@ -264,12 +265,13 @@ static void s3c64xx_spi_dmacb(void *data) |
2963 |
+ spin_unlock_irqrestore(&sdd->lock, flags); |
2964 |
+ } |
2965 |
+ |
2966 |
+-static void prepare_dma(struct s3c64xx_spi_dma_data *dma, |
2967 |
++static int prepare_dma(struct s3c64xx_spi_dma_data *dma, |
2968 |
+ struct sg_table *sgt) |
2969 |
+ { |
2970 |
+ struct s3c64xx_spi_driver_data *sdd; |
2971 |
+ struct dma_slave_config config; |
2972 |
+ struct dma_async_tx_descriptor *desc; |
2973 |
++ int ret; |
2974 |
+ |
2975 |
+ memset(&config, 0, sizeof(config)); |
2976 |
+ |
2977 |
+@@ -293,12 +295,24 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma, |
2978 |
+ |
2979 |
+ desc = dmaengine_prep_slave_sg(dma->ch, sgt->sgl, sgt->nents, |
2980 |
+ dma->direction, DMA_PREP_INTERRUPT); |
2981 |
++ if (!desc) { |
2982 |
++ dev_err(&sdd->pdev->dev, "unable to prepare %s scatterlist", |
2983 |
++ dma->direction == DMA_DEV_TO_MEM ? "rx" : "tx"); |
2984 |
++ return -ENOMEM; |
2985 |
++ } |
2986 |
+ |
2987 |
+ desc->callback = s3c64xx_spi_dmacb; |
2988 |
+ desc->callback_param = dma; |
2989 |
+ |
2990 |
+- dmaengine_submit(desc); |
2991 |
++ dma->cookie = dmaengine_submit(desc); |
2992 |
++ ret = dma_submit_error(dma->cookie); |
2993 |
++ if (ret) { |
2994 |
++ dev_err(&sdd->pdev->dev, "DMA submission failed"); |
2995 |
++ return -EIO; |
2996 |
++ } |
2997 |
++ |
2998 |
+ dma_async_issue_pending(dma->ch); |
2999 |
++ return 0; |
3000 |
+ } |
3001 |
+ |
3002 |
+ static void s3c64xx_spi_set_cs(struct spi_device *spi, bool enable) |
3003 |
+@@ -348,11 +362,12 @@ static bool s3c64xx_spi_can_dma(struct spi_master *master, |
3004 |
+ return xfer->len > (FIFO_LVL_MASK(sdd) >> 1) + 1; |
3005 |
+ } |
3006 |
+ |
3007 |
+-static void s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, |
3008 |
++static int s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, |
3009 |
+ struct spi_transfer *xfer, int dma_mode) |
3010 |
+ { |
3011 |
+ void __iomem *regs = sdd->regs; |
3012 |
+ u32 modecfg, chcfg; |
3013 |
++ int ret = 0; |
3014 |
+ |
3015 |
+ modecfg = readl(regs + S3C64XX_SPI_MODE_CFG); |
3016 |
+ modecfg &= ~(S3C64XX_SPI_MODE_TXDMA_ON | S3C64XX_SPI_MODE_RXDMA_ON); |
3017 |
+@@ -378,7 +393,7 @@ static void s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, |
3018 |
+ chcfg |= S3C64XX_SPI_CH_TXCH_ON; |
3019 |
+ if (dma_mode) { |
3020 |
+ modecfg |= S3C64XX_SPI_MODE_TXDMA_ON; |
3021 |
+- prepare_dma(&sdd->tx_dma, &xfer->tx_sg); |
3022 |
++ ret = prepare_dma(&sdd->tx_dma, &xfer->tx_sg); |
3023 |
+ } else { |
3024 |
+ switch (sdd->cur_bpw) { |
3025 |
+ case 32: |
3026 |
+@@ -410,12 +425,17 @@ static void s3c64xx_enable_datapath(struct s3c64xx_spi_driver_data *sdd, |
3027 |
+ writel(((xfer->len * 8 / sdd->cur_bpw) & 0xffff) |
3028 |
+ | S3C64XX_SPI_PACKET_CNT_EN, |
3029 |
+ regs + S3C64XX_SPI_PACKET_CNT); |
3030 |
+- prepare_dma(&sdd->rx_dma, &xfer->rx_sg); |
3031 |
++ ret = prepare_dma(&sdd->rx_dma, &xfer->rx_sg); |
3032 |
+ } |
3033 |
+ } |
3034 |
+ |
3035 |
++ if (ret) |
3036 |
++ return ret; |
3037 |
++ |
3038 |
+ writel(modecfg, regs + S3C64XX_SPI_MODE_CFG); |
3039 |
+ writel(chcfg, regs + S3C64XX_SPI_CH_CFG); |
3040 |
++ |
3041 |
++ return 0; |
3042 |
+ } |
3043 |
+ |
3044 |
+ static u32 s3c64xx_spi_wait_for_timeout(struct s3c64xx_spi_driver_data *sdd, |
3045 |
+@@ -548,9 +568,10 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, |
3046 |
+ return 0; |
3047 |
+ } |
3048 |
+ |
3049 |
+-static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) |
3050 |
++static int s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) |
3051 |
+ { |
3052 |
+ void __iomem *regs = sdd->regs; |
3053 |
++ int ret; |
3054 |
+ u32 val; |
3055 |
+ |
3056 |
+ /* Disable Clock */ |
3057 |
+@@ -598,7 +619,9 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) |
3058 |
+ |
3059 |
+ if (sdd->port_conf->clk_from_cmu) { |
3060 |
+ /* The src_clk clock is divided internally by 2 */ |
3061 |
+- clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); |
3062 |
++ ret = clk_set_rate(sdd->src_clk, sdd->cur_speed * 2); |
3063 |
++ if (ret) |
3064 |
++ return ret; |
3065 |
+ } else { |
3066 |
+ /* Configure Clock */ |
3067 |
+ val = readl(regs + S3C64XX_SPI_CLK_CFG); |
3068 |
+@@ -612,6 +635,8 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) |
3069 |
+ val |= S3C64XX_SPI_ENCLK_ENABLE; |
3070 |
+ writel(val, regs + S3C64XX_SPI_CLK_CFG); |
3071 |
+ } |
3072 |
++ |
3073 |
++ return 0; |
3074 |
+ } |
3075 |
+ |
3076 |
+ #define XFER_DMAADDR_INVALID DMA_BIT_MASK(32) |
3077 |
+@@ -654,7 +679,9 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, |
3078 |
+ sdd->cur_bpw = bpw; |
3079 |
+ sdd->cur_speed = speed; |
3080 |
+ sdd->cur_mode = spi->mode; |
3081 |
+- s3c64xx_spi_config(sdd); |
3082 |
++ status = s3c64xx_spi_config(sdd); |
3083 |
++ if (status) |
3084 |
++ return status; |
3085 |
+ } |
3086 |
+ |
3087 |
+ if (!is_polling(sdd) && (xfer->len > fifo_len) && |
3088 |
+@@ -678,13 +705,18 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master, |
3089 |
+ sdd->state &= ~RXBUSY; |
3090 |
+ sdd->state &= ~TXBUSY; |
3091 |
+ |
3092 |
+- s3c64xx_enable_datapath(sdd, xfer, use_dma); |
3093 |
+- |
3094 |
+ /* Start the signals */ |
3095 |
+ s3c64xx_spi_set_cs(spi, true); |
3096 |
+ |
3097 |
++ status = s3c64xx_enable_datapath(sdd, xfer, use_dma); |
3098 |
++ |
3099 |
+ spin_unlock_irqrestore(&sdd->lock, flags); |
3100 |
+ |
3101 |
++ if (status) { |
3102 |
++ dev_err(&spi->dev, "failed to enable data path for transfer: %d\n", status); |
3103 |
++ break; |
3104 |
++ } |
3105 |
++ |
3106 |
+ if (use_dma) |
3107 |
+ status = s3c64xx_wait_for_dma(sdd, xfer); |
3108 |
+ else |
3109 |
+diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |
3110 |
+index 28cae82d795c7..fb824c5174497 100644 |
3111 |
+--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |
3112 |
++++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |
3113 |
+@@ -599,7 +599,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, |
3114 |
+ |
3115 |
+ prxbIndicateArray = kmalloc_array(REORDER_WIN_SIZE, |
3116 |
+ sizeof(struct ieee80211_rxb *), |
3117 |
+- GFP_KERNEL); |
3118 |
++ GFP_ATOMIC); |
3119 |
+ if (!prxbIndicateArray) |
3120 |
+ return; |
3121 |
+ |
3122 |
+diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c |
3123 |
+index 99314e5162447..0219b5a865bee 100644 |
3124 |
+--- a/drivers/target/target_core_user.c |
3125 |
++++ b/drivers/target/target_core_user.c |
3126 |
+@@ -680,7 +680,7 @@ static void scatter_data_area(struct tcmu_dev *udev, |
3127 |
+ void *from, *to = NULL; |
3128 |
+ size_t copy_bytes, to_offset, offset; |
3129 |
+ struct scatterlist *sg; |
3130 |
+- struct page *page; |
3131 |
++ struct page *page = NULL; |
3132 |
+ |
3133 |
+ for_each_sg(data_sg, sg, data_nents, i) { |
3134 |
+ int sg_remaining = sg->length; |
3135 |
+diff --git a/drivers/tty/hvc/hvcs.c b/drivers/tty/hvc/hvcs.c |
3136 |
+index cb4db1b3ca3c0..7853c6375325d 100644 |
3137 |
+--- a/drivers/tty/hvc/hvcs.c |
3138 |
++++ b/drivers/tty/hvc/hvcs.c |
3139 |
+@@ -1218,13 +1218,6 @@ static void hvcs_close(struct tty_struct *tty, struct file *filp) |
3140 |
+ |
3141 |
+ tty_wait_until_sent(tty, HVCS_CLOSE_WAIT); |
3142 |
+ |
3143 |
+- /* |
3144 |
+- * This line is important because it tells hvcs_open that this |
3145 |
+- * device needs to be re-configured the next time hvcs_open is |
3146 |
+- * called. |
3147 |
+- */ |
3148 |
+- tty->driver_data = NULL; |
3149 |
+- |
3150 |
+ free_irq(irq, hvcsd); |
3151 |
+ return; |
3152 |
+ } else if (hvcsd->port.count < 0) { |
3153 |
+@@ -1239,6 +1232,13 @@ static void hvcs_cleanup(struct tty_struct * tty) |
3154 |
+ { |
3155 |
+ struct hvcs_struct *hvcsd = tty->driver_data; |
3156 |
+ |
3157 |
++ /* |
3158 |
++ * This line is important because it tells hvcs_open that this |
3159 |
++ * device needs to be re-configured the next time hvcs_open is |
3160 |
++ * called. |
3161 |
++ */ |
3162 |
++ tty->driver_data = NULL; |
3163 |
++ |
3164 |
+ tty_port_put(&hvcsd->port); |
3165 |
+ } |
3166 |
+ |
3167 |
+diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c |
3168 |
+index 00099a8439d21..c6a1d8c4e6894 100644 |
3169 |
+--- a/drivers/tty/pty.c |
3170 |
++++ b/drivers/tty/pty.c |
3171 |
+@@ -120,10 +120,10 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
3172 |
+ spin_lock_irqsave(&to->port->lock, flags); |
3173 |
+ /* Stuff the data into the input queue of the other end */ |
3174 |
+ c = tty_insert_flip_string(to->port, buf, c); |
3175 |
++ spin_unlock_irqrestore(&to->port->lock, flags); |
3176 |
+ /* And shovel */ |
3177 |
+ if (c) |
3178 |
+ tty_flip_buffer_push(to->port); |
3179 |
+- spin_unlock_irqrestore(&to->port->lock, flags); |
3180 |
+ } |
3181 |
+ return c; |
3182 |
+ } |
3183 |
+diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig |
3184 |
+index df8bd0c7b97db..cd13065095bc3 100644 |
3185 |
+--- a/drivers/tty/serial/Kconfig |
3186 |
++++ b/drivers/tty/serial/Kconfig |
3187 |
+@@ -9,6 +9,7 @@ menu "Serial drivers" |
3188 |
+ |
3189 |
+ config SERIAL_EARLYCON |
3190 |
+ bool |
3191 |
++ depends on SERIAL_CORE |
3192 |
+ help |
3193 |
+ Support for early consoles with the earlycon parameter. This enables |
3194 |
+ the console before standard serial driver is probed. The console is |
3195 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
3196 |
+index f18aa3f59e519..8e98b4df9b109 100644 |
3197 |
+--- a/drivers/usb/dwc2/gadget.c |
3198 |
++++ b/drivers/usb/dwc2/gadget.c |
3199 |
+@@ -671,8 +671,11 @@ static u32 dwc2_hsotg_read_frameno(struct dwc2_hsotg *hsotg) |
3200 |
+ */ |
3201 |
+ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep) |
3202 |
+ { |
3203 |
++ const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc; |
3204 |
+ int is_isoc = hs_ep->isochronous; |
3205 |
+ unsigned int maxsize; |
3206 |
++ u32 mps = hs_ep->ep.maxpacket; |
3207 |
++ int dir_in = hs_ep->dir_in; |
3208 |
+ |
3209 |
+ if (is_isoc) |
3210 |
+ maxsize = (hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT : |
3211 |
+@@ -681,6 +684,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep) |
3212 |
+ else |
3213 |
+ maxsize = DEV_DMA_NBYTES_LIMIT * MAX_DMA_DESC_NUM_GENERIC; |
3214 |
+ |
3215 |
++ /* Interrupt OUT EP with mps not multiple of 4 */ |
3216 |
++ if (hs_ep->index) |
3217 |
++ if (usb_endpoint_xfer_int(ep_desc) && !dir_in && (mps % 4)) |
3218 |
++ maxsize = mps * MAX_DMA_DESC_NUM_GENERIC; |
3219 |
++ |
3220 |
+ return maxsize; |
3221 |
+ } |
3222 |
+ |
3223 |
+@@ -696,11 +704,14 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep) |
3224 |
+ * Isochronous - descriptor rx/tx bytes bitfield limit, |
3225 |
+ * Control In/Bulk/Interrupt - multiple of mps. This will allow to not |
3226 |
+ * have concatenations from various descriptors within one packet. |
3227 |
++ * Interrupt OUT - if mps not multiple of 4 then a single packet corresponds |
3228 |
++ * to a single descriptor. |
3229 |
+ * |
3230 |
+ * Selects corresponding mask for RX/TX bytes as well. |
3231 |
+ */ |
3232 |
+ static u32 dwc2_gadget_get_desc_params(struct dwc2_hsotg_ep *hs_ep, u32 *mask) |
3233 |
+ { |
3234 |
++ const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc; |
3235 |
+ u32 mps = hs_ep->ep.maxpacket; |
3236 |
+ int dir_in = hs_ep->dir_in; |
3237 |
+ u32 desc_size = 0; |
3238 |
+@@ -724,6 +735,13 @@ static u32 dwc2_gadget_get_desc_params(struct dwc2_hsotg_ep *hs_ep, u32 *mask) |
3239 |
+ desc_size -= desc_size % mps; |
3240 |
+ } |
3241 |
+ |
3242 |
++ /* Interrupt OUT EP with mps not multiple of 4 */ |
3243 |
++ if (hs_ep->index) |
3244 |
++ if (usb_endpoint_xfer_int(ep_desc) && !dir_in && (mps % 4)) { |
3245 |
++ desc_size = mps; |
3246 |
++ *mask = DEV_DMA_NBYTES_MASK; |
3247 |
++ } |
3248 |
++ |
3249 |
+ return desc_size; |
3250 |
+ } |
3251 |
+ |
3252 |
+@@ -1044,13 +1062,7 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg, |
3253 |
+ length += (mps - (length % mps)); |
3254 |
+ } |
3255 |
+ |
3256 |
+- /* |
3257 |
+- * If more data to send, adjust DMA for EP0 out data stage. |
3258 |
+- * ureq->dma stays unchanged, hence increment it by already |
3259 |
+- * passed passed data count before starting new transaction. |
3260 |
+- */ |
3261 |
+- if (!index && hsotg->ep0_state == DWC2_EP0_DATA_OUT && |
3262 |
+- continuing) |
3263 |
++ if (continuing) |
3264 |
+ offset = ureq->actual; |
3265 |
+ |
3266 |
+ /* Fill DDMA chain entries */ |
3267 |
+@@ -2220,22 +2232,36 @@ static void dwc2_hsotg_change_ep_iso_parity(struct dwc2_hsotg *hsotg, |
3268 |
+ */ |
3269 |
+ static unsigned int dwc2_gadget_get_xfersize_ddma(struct dwc2_hsotg_ep *hs_ep) |
3270 |
+ { |
3271 |
++ const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc; |
3272 |
+ struct dwc2_hsotg *hsotg = hs_ep->parent; |
3273 |
+ unsigned int bytes_rem = 0; |
3274 |
++ unsigned int bytes_rem_correction = 0; |
3275 |
+ struct dwc2_dma_desc *desc = hs_ep->desc_list; |
3276 |
+ int i; |
3277 |
+ u32 status; |
3278 |
++ u32 mps = hs_ep->ep.maxpacket; |
3279 |
++ int dir_in = hs_ep->dir_in; |
3280 |
+ |
3281 |
+ if (!desc) |
3282 |
+ return -EINVAL; |
3283 |
+ |
3284 |
++ /* Interrupt OUT EP with mps not multiple of 4 */ |
3285 |
++ if (hs_ep->index) |
3286 |
++ if (usb_endpoint_xfer_int(ep_desc) && !dir_in && (mps % 4)) |
3287 |
++ bytes_rem_correction = 4 - (mps % 4); |
3288 |
++ |
3289 |
+ for (i = 0; i < hs_ep->desc_count; ++i) { |
3290 |
+ status = desc->status; |
3291 |
+ bytes_rem += status & DEV_DMA_NBYTES_MASK; |
3292 |
++ bytes_rem -= bytes_rem_correction; |
3293 |
+ |
3294 |
+ if (status & DEV_DMA_STS_MASK) |
3295 |
+ dev_err(hsotg->dev, "descriptor %d closed with %x\n", |
3296 |
+ i, status & DEV_DMA_STS_MASK); |
3297 |
++ |
3298 |
++ if (status & DEV_DMA_L) |
3299 |
++ break; |
3300 |
++ |
3301 |
+ desc++; |
3302 |
+ } |
3303 |
+ |
3304 |
+diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c |
3305 |
+index a93415f33bf36..6d7861cba3f56 100644 |
3306 |
+--- a/drivers/usb/dwc2/params.c |
3307 |
++++ b/drivers/usb/dwc2/params.c |
3308 |
+@@ -808,7 +808,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg) |
3309 |
+ int dwc2_init_params(struct dwc2_hsotg *hsotg) |
3310 |
+ { |
3311 |
+ const struct of_device_id *match; |
3312 |
+- void (*set_params)(void *data); |
3313 |
++ void (*set_params)(struct dwc2_hsotg *data); |
3314 |
+ |
3315 |
+ dwc2_set_default_params(hsotg); |
3316 |
+ dwc2_get_device_properties(hsotg); |
3317 |
+diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c |
3318 |
+index e2eefdd8bf786..09bc917d407d4 100644 |
3319 |
+--- a/drivers/usb/gadget/function/f_ncm.c |
3320 |
++++ b/drivers/usb/gadget/function/f_ncm.c |
3321 |
+@@ -86,8 +86,10 @@ static inline struct f_ncm *func_to_ncm(struct usb_function *f) |
3322 |
+ /* peak (theoretical) bulk transfer rate in bits-per-second */ |
3323 |
+ static inline unsigned ncm_bitrate(struct usb_gadget *g) |
3324 |
+ { |
3325 |
+- if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) |
3326 |
+- return 13 * 1024 * 8 * 1000 * 8; |
3327 |
++ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) |
3328 |
++ return 4250000000U; |
3329 |
++ else if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) |
3330 |
++ return 3750000000U; |
3331 |
+ else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) |
3332 |
+ return 13 * 512 * 8 * 1000 * 8; |
3333 |
+ else |
3334 |
+diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c |
3335 |
+index 0ef00315ec737..39ebc1b03698b 100644 |
3336 |
+--- a/drivers/usb/gadget/function/u_ether.c |
3337 |
++++ b/drivers/usb/gadget/function/u_ether.c |
3338 |
+@@ -93,7 +93,7 @@ struct eth_dev { |
3339 |
+ static inline int qlen(struct usb_gadget *gadget, unsigned qmult) |
3340 |
+ { |
3341 |
+ if (gadget_is_dualspeed(gadget) && (gadget->speed == USB_SPEED_HIGH || |
3342 |
+- gadget->speed == USB_SPEED_SUPER)) |
3343 |
++ gadget->speed >= USB_SPEED_SUPER)) |
3344 |
+ return qmult * DEFAULT_QLEN; |
3345 |
+ else |
3346 |
+ return DEFAULT_QLEN; |
3347 |
+diff --git a/drivers/video/backlight/sky81452-backlight.c b/drivers/video/backlight/sky81452-backlight.c |
3348 |
+index d414c7a3acf5a..a2f77625b7170 100644 |
3349 |
+--- a/drivers/video/backlight/sky81452-backlight.c |
3350 |
++++ b/drivers/video/backlight/sky81452-backlight.c |
3351 |
+@@ -207,6 +207,7 @@ static struct sky81452_bl_platform_data *sky81452_bl_parse_dt( |
3352 |
+ num_entry); |
3353 |
+ if (ret < 0) { |
3354 |
+ dev_err(dev, "led-sources node is invalid.\n"); |
3355 |
++ of_node_put(np); |
3356 |
+ return ERR_PTR(-EINVAL); |
3357 |
+ } |
3358 |
+ |
3359 |
+diff --git a/drivers/video/fbdev/aty/radeon_base.c b/drivers/video/fbdev/aty/radeon_base.c |
3360 |
+index e8594bbaea609..c6109a385cac9 100644 |
3361 |
+--- a/drivers/video/fbdev/aty/radeon_base.c |
3362 |
++++ b/drivers/video/fbdev/aty/radeon_base.c |
3363 |
+@@ -2327,7 +2327,7 @@ static int radeonfb_pci_register(struct pci_dev *pdev, |
3364 |
+ |
3365 |
+ ret = radeon_kick_out_firmware_fb(pdev); |
3366 |
+ if (ret) |
3367 |
+- return ret; |
3368 |
++ goto err_release_fb; |
3369 |
+ |
3370 |
+ /* request the mem regions */ |
3371 |
+ ret = pci_request_region(pdev, 0, "radeonfb framebuffer"); |
3372 |
+diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c |
3373 |
+index dfe3eb769638b..fde27feae5d0c 100644 |
3374 |
+--- a/drivers/video/fbdev/sis/init.c |
3375 |
++++ b/drivers/video/fbdev/sis/init.c |
3376 |
+@@ -2428,6 +2428,11 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
3377 |
+ |
3378 |
+ i = 0; |
3379 |
+ |
3380 |
++ if (SiS_Pr->ChipType == SIS_730) |
3381 |
++ queuedata = &FQBQData730[0]; |
3382 |
++ else |
3383 |
++ queuedata = &FQBQData[0]; |
3384 |
++ |
3385 |
+ if(ModeNo > 0x13) { |
3386 |
+ |
3387 |
+ /* Get VCLK */ |
3388 |
+@@ -2445,12 +2450,6 @@ SiS_SetCRT1FIFO_630(struct SiS_Private *SiS_Pr, unsigned short ModeNo, |
3389 |
+ /* Get half colordepth */ |
3390 |
+ colorth = colortharray[(SiS_Pr->SiS_ModeType - ModeEGA)]; |
3391 |
+ |
3392 |
+- if(SiS_Pr->ChipType == SIS_730) { |
3393 |
+- queuedata = &FQBQData730[0]; |
3394 |
+- } else { |
3395 |
+- queuedata = &FQBQData[0]; |
3396 |
+- } |
3397 |
+- |
3398 |
+ do { |
3399 |
+ templ = SiS_CalcDelay2(SiS_Pr, queuedata[i]) * VCLK * colorth; |
3400 |
+ |
3401 |
+diff --git a/drivers/video/fbdev/vga16fb.c b/drivers/video/fbdev/vga16fb.c |
3402 |
+index 4b83109202b1c..3c4d20618de4c 100644 |
3403 |
+--- a/drivers/video/fbdev/vga16fb.c |
3404 |
++++ b/drivers/video/fbdev/vga16fb.c |
3405 |
+@@ -243,7 +243,7 @@ static void vga16fb_update_fix(struct fb_info *info) |
3406 |
+ } |
3407 |
+ |
3408 |
+ static void vga16fb_clock_chip(struct vga16fb_par *par, |
3409 |
+- unsigned int pixclock, |
3410 |
++ unsigned int *pixclock, |
3411 |
+ const struct fb_info *info, |
3412 |
+ int mul, int div) |
3413 |
+ { |
3414 |
+@@ -259,14 +259,14 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, |
3415 |
+ { 0 /* bad */, 0x00, 0x00}}; |
3416 |
+ int err; |
3417 |
+ |
3418 |
+- pixclock = (pixclock * mul) / div; |
3419 |
++ *pixclock = (*pixclock * mul) / div; |
3420 |
+ best = vgaclocks; |
3421 |
+- err = pixclock - best->pixclock; |
3422 |
++ err = *pixclock - best->pixclock; |
3423 |
+ if (err < 0) err = -err; |
3424 |
+ for (ptr = vgaclocks + 1; ptr->pixclock; ptr++) { |
3425 |
+ int tmp; |
3426 |
+ |
3427 |
+- tmp = pixclock - ptr->pixclock; |
3428 |
++ tmp = *pixclock - ptr->pixclock; |
3429 |
+ if (tmp < 0) tmp = -tmp; |
3430 |
+ if (tmp < err) { |
3431 |
+ err = tmp; |
3432 |
+@@ -275,7 +275,7 @@ static void vga16fb_clock_chip(struct vga16fb_par *par, |
3433 |
+ } |
3434 |
+ par->misc |= best->misc; |
3435 |
+ par->clkdiv = best->seq_clock_mode; |
3436 |
+- pixclock = (best->pixclock * div) / mul; |
3437 |
++ *pixclock = (best->pixclock * div) / mul; |
3438 |
+ } |
3439 |
+ |
3440 |
+ #define FAIL(X) return -EINVAL |
3441 |
+@@ -497,10 +497,10 @@ static int vga16fb_check_var(struct fb_var_screeninfo *var, |
3442 |
+ |
3443 |
+ if (mode & MODE_8BPP) |
3444 |
+ /* pixel clock == vga clock / 2 */ |
3445 |
+- vga16fb_clock_chip(par, var->pixclock, info, 1, 2); |
3446 |
++ vga16fb_clock_chip(par, &var->pixclock, info, 1, 2); |
3447 |
+ else |
3448 |
+ /* pixel clock == vga clock */ |
3449 |
+- vga16fb_clock_chip(par, var->pixclock, info, 1, 1); |
3450 |
++ vga16fb_clock_chip(par, &var->pixclock, info, 1, 1); |
3451 |
+ |
3452 |
+ var->red.offset = var->green.offset = var->blue.offset = |
3453 |
+ var->transp.offset = 0; |
3454 |
+diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c |
3455 |
+index 1bbd910d4ddb8..2a7f7f47fe893 100644 |
3456 |
+--- a/drivers/virt/fsl_hypervisor.c |
3457 |
++++ b/drivers/virt/fsl_hypervisor.c |
3458 |
+@@ -157,7 +157,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3459 |
+ |
3460 |
+ unsigned int i; |
3461 |
+ long ret = 0; |
3462 |
+- int num_pinned; /* return value from get_user_pages() */ |
3463 |
++ int num_pinned = 0; /* return value from get_user_pages_fast() */ |
3464 |
+ phys_addr_t remote_paddr; /* The next address in the remote buffer */ |
3465 |
+ uint32_t count; /* The number of bytes left to copy */ |
3466 |
+ |
3467 |
+@@ -174,7 +174,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3468 |
+ return -EINVAL; |
3469 |
+ |
3470 |
+ /* |
3471 |
+- * The array of pages returned by get_user_pages() covers only |
3472 |
++ * The array of pages returned by get_user_pages_fast() covers only |
3473 |
+ * page-aligned memory. Since the user buffer is probably not |
3474 |
+ * page-aligned, we need to handle the discrepancy. |
3475 |
+ * |
3476 |
+@@ -224,7 +224,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3477 |
+ |
3478 |
+ /* |
3479 |
+ * 'pages' is an array of struct page pointers that's initialized by |
3480 |
+- * get_user_pages(). |
3481 |
++ * get_user_pages_fast(). |
3482 |
+ */ |
3483 |
+ pages = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL); |
3484 |
+ if (!pages) { |
3485 |
+@@ -241,7 +241,7 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3486 |
+ if (!sg_list_unaligned) { |
3487 |
+ pr_debug("fsl-hv: could not allocate S/G list\n"); |
3488 |
+ ret = -ENOMEM; |
3489 |
+- goto exit; |
3490 |
++ goto free_pages; |
3491 |
+ } |
3492 |
+ sg_list = PTR_ALIGN(sg_list_unaligned, sizeof(struct fh_sg_list)); |
3493 |
+ |
3494 |
+@@ -250,7 +250,6 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3495 |
+ num_pages, param.source != -1, pages); |
3496 |
+ |
3497 |
+ if (num_pinned != num_pages) { |
3498 |
+- /* get_user_pages() failed */ |
3499 |
+ pr_debug("fsl-hv: could not lock source buffer\n"); |
3500 |
+ ret = (num_pinned < 0) ? num_pinned : -EFAULT; |
3501 |
+ goto exit; |
3502 |
+@@ -292,13 +291,13 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) |
3503 |
+ virt_to_phys(sg_list), num_pages); |
3504 |
+ |
3505 |
+ exit: |
3506 |
+- if (pages) { |
3507 |
+- for (i = 0; i < num_pages; i++) |
3508 |
+- if (pages[i]) |
3509 |
+- put_page(pages[i]); |
3510 |
++ if (pages && (num_pinned > 0)) { |
3511 |
++ for (i = 0; i < num_pinned; i++) |
3512 |
++ put_page(pages[i]); |
3513 |
+ } |
3514 |
+ |
3515 |
+ kfree(sg_list_unaligned); |
3516 |
++free_pages: |
3517 |
+ kfree(pages); |
3518 |
+ |
3519 |
+ if (!ret) |
3520 |
+diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c |
3521 |
+index 3d19595eb3521..4a9b53229fba2 100644 |
3522 |
+--- a/fs/cifs/asn1.c |
3523 |
++++ b/fs/cifs/asn1.c |
3524 |
+@@ -541,8 +541,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
3525 |
+ return 0; |
3526 |
+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON) |
3527 |
+ || (tag != ASN1_EOC)) { |
3528 |
+- cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n", |
3529 |
+- cls, con, tag, end, *end); |
3530 |
++ cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n", |
3531 |
++ cls, con, tag, end); |
3532 |
+ return 0; |
3533 |
+ } |
3534 |
+ |
3535 |
+@@ -552,8 +552,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
3536 |
+ return 0; |
3537 |
+ } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
3538 |
+ || (tag != ASN1_SEQ)) { |
3539 |
+- cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n", |
3540 |
+- cls, con, tag, end, *end); |
3541 |
++ cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 1\n", |
3542 |
++ cls, con, tag, end); |
3543 |
+ return 0; |
3544 |
+ } |
3545 |
+ |
3546 |
+@@ -563,8 +563,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
3547 |
+ return 0; |
3548 |
+ } else if ((cls != ASN1_CTX) || (con != ASN1_CON) |
3549 |
+ || (tag != ASN1_EOC)) { |
3550 |
+- cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 0\n", |
3551 |
+- cls, con, tag, end, *end); |
3552 |
++ cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p exit 0\n", |
3553 |
++ cls, con, tag, end); |
3554 |
+ return 0; |
3555 |
+ } |
3556 |
+ |
3557 |
+@@ -575,8 +575,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, |
3558 |
+ return 0; |
3559 |
+ } else if ((cls != ASN1_UNI) || (con != ASN1_CON) |
3560 |
+ || (tag != ASN1_SEQ)) { |
3561 |
+- cifs_dbg(FYI, "cls = %d con = %d tag = %d end = %p (%d) exit 1\n", |
3562 |
+- cls, con, tag, end, *end); |
3563 |
++ cifs_dbg(FYI, "cls = %d con = %d tag = %d sequence_end = %p exit 1\n", |
3564 |
++ cls, con, tag, sequence_end); |
3565 |
+ return 0; |
3566 |
+ } |
3567 |
+ |
3568 |
+diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c |
3569 |
+index 3d63c76ed0989..e20d170d13f6b 100644 |
3570 |
+--- a/fs/cifs/smb2ops.c |
3571 |
++++ b/fs/cifs/smb2ops.c |
3572 |
+@@ -2730,7 +2730,7 @@ crypt_message(struct TCP_Server_Info *server, int num_rqst, |
3573 |
+ if (rc) { |
3574 |
+ cifs_dbg(VFS, "%s: Could not get %scryption key\n", __func__, |
3575 |
+ enc ? "en" : "de"); |
3576 |
+- return 0; |
3577 |
++ return rc; |
3578 |
+ } |
3579 |
+ |
3580 |
+ rc = smb3_crypto_aead_allocate(server); |
3581 |
+diff --git a/fs/proc/base.c b/fs/proc/base.c |
3582 |
+index 3b9b726b1a6ca..5e705fa9a913d 100644 |
3583 |
+--- a/fs/proc/base.c |
3584 |
++++ b/fs/proc/base.c |
3585 |
+@@ -1035,7 +1035,6 @@ static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count, |
3586 |
+ |
3587 |
+ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy) |
3588 |
+ { |
3589 |
+- static DEFINE_MUTEX(oom_adj_mutex); |
3590 |
+ struct mm_struct *mm = NULL; |
3591 |
+ struct task_struct *task; |
3592 |
+ int err = 0; |
3593 |
+@@ -1075,7 +1074,7 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy) |
3594 |
+ struct task_struct *p = find_lock_task_mm(task); |
3595 |
+ |
3596 |
+ if (p) { |
3597 |
+- if (atomic_read(&p->mm->mm_users) > 1) { |
3598 |
++ if (test_bit(MMF_MULTIPROCESS, &p->mm->flags)) { |
3599 |
+ mm = p->mm; |
3600 |
+ mmgrab(mm); |
3601 |
+ } |
3602 |
+diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c |
3603 |
+index a73e5b34db418..5d4dc0f84f202 100644 |
3604 |
+--- a/fs/quota/quota_v2.c |
3605 |
++++ b/fs/quota/quota_v2.c |
3606 |
+@@ -283,6 +283,7 @@ static void v2r1_mem2diskdqb(void *dp, struct dquot *dquot) |
3607 |
+ d->dqb_curspace = cpu_to_le64(m->dqb_curspace); |
3608 |
+ d->dqb_btime = cpu_to_le64(m->dqb_btime); |
3609 |
+ d->dqb_id = cpu_to_le32(from_kqid(&init_user_ns, dquot->dq_id)); |
3610 |
++ d->dqb_pad = 0; |
3611 |
+ if (qtree_entry_unused(info, dp)) |
3612 |
+ d->dqb_itime = cpu_to_le64(1); |
3613 |
+ } |
3614 |
+diff --git a/fs/xfs/libxfs/xfs_rtbitmap.c b/fs/xfs/libxfs/xfs_rtbitmap.c |
3615 |
+index b228c821bae68..fe7323032e785 100644 |
3616 |
+--- a/fs/xfs/libxfs/xfs_rtbitmap.c |
3617 |
++++ b/fs/xfs/libxfs/xfs_rtbitmap.c |
3618 |
+@@ -1020,7 +1020,6 @@ xfs_rtalloc_query_range( |
3619 |
+ struct xfs_mount *mp = tp->t_mountp; |
3620 |
+ xfs_rtblock_t rtstart; |
3621 |
+ xfs_rtblock_t rtend; |
3622 |
+- xfs_rtblock_t rem; |
3623 |
+ int is_free; |
3624 |
+ int error = 0; |
3625 |
+ |
3626 |
+@@ -1029,13 +1028,12 @@ xfs_rtalloc_query_range( |
3627 |
+ if (low_rec->ar_startext >= mp->m_sb.sb_rextents || |
3628 |
+ low_rec->ar_startext == high_rec->ar_startext) |
3629 |
+ return 0; |
3630 |
+- if (high_rec->ar_startext > mp->m_sb.sb_rextents) |
3631 |
+- high_rec->ar_startext = mp->m_sb.sb_rextents; |
3632 |
++ high_rec->ar_startext = min(high_rec->ar_startext, |
3633 |
++ mp->m_sb.sb_rextents - 1); |
3634 |
+ |
3635 |
+ /* Iterate the bitmap, looking for discrepancies. */ |
3636 |
+ rtstart = low_rec->ar_startext; |
3637 |
+- rem = high_rec->ar_startext - rtstart; |
3638 |
+- while (rem) { |
3639 |
++ while (rtstart <= high_rec->ar_startext) { |
3640 |
+ /* Is the first block free? */ |
3641 |
+ error = xfs_rtcheck_range(mp, tp, rtstart, 1, 1, &rtend, |
3642 |
+ &is_free); |
3643 |
+@@ -1044,7 +1042,7 @@ xfs_rtalloc_query_range( |
3644 |
+ |
3645 |
+ /* How long does the extent go for? */ |
3646 |
+ error = xfs_rtfind_forw(mp, tp, rtstart, |
3647 |
+- high_rec->ar_startext - 1, &rtend); |
3648 |
++ high_rec->ar_startext, &rtend); |
3649 |
+ if (error) |
3650 |
+ break; |
3651 |
+ |
3652 |
+@@ -1057,7 +1055,6 @@ xfs_rtalloc_query_range( |
3653 |
+ break; |
3654 |
+ } |
3655 |
+ |
3656 |
+- rem -= rtend - rtstart + 1; |
3657 |
+ rtstart = rtend + 1; |
3658 |
+ } |
3659 |
+ |
3660 |
+diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c |
3661 |
+index 3d76a9e35870a..75b57b683d3e6 100644 |
3662 |
+--- a/fs/xfs/xfs_fsmap.c |
3663 |
++++ b/fs/xfs/xfs_fsmap.c |
3664 |
+@@ -259,6 +259,9 @@ xfs_getfsmap_helper( |
3665 |
+ |
3666 |
+ /* Are we just counting mappings? */ |
3667 |
+ if (info->head->fmh_count == 0) { |
3668 |
++ if (info->head->fmh_entries == UINT_MAX) |
3669 |
++ return -ECANCELED; |
3670 |
++ |
3671 |
+ if (rec_daddr > info->next_daddr) |
3672 |
+ info->head->fmh_entries++; |
3673 |
+ |
3674 |
+diff --git a/include/linux/oom.h b/include/linux/oom.h |
3675 |
+index 69864a547663e..3f649be179dad 100644 |
3676 |
+--- a/include/linux/oom.h |
3677 |
++++ b/include/linux/oom.h |
3678 |
+@@ -45,6 +45,7 @@ struct oom_control { |
3679 |
+ }; |
3680 |
+ |
3681 |
+ extern struct mutex oom_lock; |
3682 |
++extern struct mutex oom_adj_mutex; |
3683 |
+ |
3684 |
+ static inline void set_current_oom_origin(void) |
3685 |
+ { |
3686 |
+diff --git a/include/linux/sched/coredump.h b/include/linux/sched/coredump.h |
3687 |
+index ecdc6542070f1..dfd82eab29025 100644 |
3688 |
+--- a/include/linux/sched/coredump.h |
3689 |
++++ b/include/linux/sched/coredump.h |
3690 |
+@@ -72,6 +72,7 @@ static inline int get_dumpable(struct mm_struct *mm) |
3691 |
+ #define MMF_DISABLE_THP 24 /* disable THP for all VMAs */ |
3692 |
+ #define MMF_OOM_VICTIM 25 /* mm is the oom victim */ |
3693 |
+ #define MMF_OOM_REAP_QUEUED 26 /* mm was queued for oom_reaper */ |
3694 |
++#define MMF_MULTIPROCESS 27 /* mm is shared between processes */ |
3695 |
+ #define MMF_DISABLE_THP_MASK (1 << MMF_DISABLE_THP) |
3696 |
+ |
3697 |
+ #define MMF_INIT_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\ |
3698 |
+diff --git a/include/net/ip.h b/include/net/ip.h |
3699 |
+index 5b29f357862dc..aad003685c31d 100644 |
3700 |
+--- a/include/net/ip.h |
3701 |
++++ b/include/net/ip.h |
3702 |
+@@ -399,12 +399,18 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst, |
3703 |
+ bool forwarding) |
3704 |
+ { |
3705 |
+ struct net *net = dev_net(dst->dev); |
3706 |
++ unsigned int mtu; |
3707 |
+ |
3708 |
+ if (net->ipv4.sysctl_ip_fwd_use_pmtu || |
3709 |
+ ip_mtu_locked(dst) || |
3710 |
+ !forwarding) |
3711 |
+ return dst_mtu(dst); |
3712 |
+ |
3713 |
++ /* 'forwarding = true' case should always honour route mtu */ |
3714 |
++ mtu = dst_metric_raw(dst, RTAX_MTU); |
3715 |
++ if (mtu) |
3716 |
++ return mtu; |
3717 |
++ |
3718 |
+ return min(READ_ONCE(dst->dev->mtu), IP_MAX_MTU); |
3719 |
+ } |
3720 |
+ |
3721 |
+diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h |
3722 |
+index 0d3920896d502..716db4a0fed89 100644 |
3723 |
+--- a/include/net/netfilter/nf_log.h |
3724 |
++++ b/include/net/netfilter/nf_log.h |
3725 |
+@@ -108,6 +108,7 @@ int nf_log_dump_tcp_header(struct nf_log_buf *m, const struct sk_buff *skb, |
3726 |
+ unsigned int logflags); |
3727 |
+ void nf_log_dump_sk_uid_gid(struct net *net, struct nf_log_buf *m, |
3728 |
+ struct sock *sk); |
3729 |
++void nf_log_dump_vlan(struct nf_log_buf *m, const struct sk_buff *skb); |
3730 |
+ void nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf, |
3731 |
+ unsigned int hooknum, const struct sk_buff *skb, |
3732 |
+ const struct net_device *in, |
3733 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
3734 |
+index 1a2d18e98bf99..3ed29bf8eb291 100644 |
3735 |
+--- a/kernel/fork.c |
3736 |
++++ b/kernel/fork.c |
3737 |
+@@ -1647,6 +1647,25 @@ static __always_inline void delayed_free_task(struct task_struct *tsk) |
3738 |
+ free_task(tsk); |
3739 |
+ } |
3740 |
+ |
3741 |
++static void copy_oom_score_adj(u64 clone_flags, struct task_struct *tsk) |
3742 |
++{ |
3743 |
++ /* Skip if kernel thread */ |
3744 |
++ if (!tsk->mm) |
3745 |
++ return; |
3746 |
++ |
3747 |
++ /* Skip if spawning a thread or using vfork */ |
3748 |
++ if ((clone_flags & (CLONE_VM | CLONE_THREAD | CLONE_VFORK)) != CLONE_VM) |
3749 |
++ return; |
3750 |
++ |
3751 |
++ /* We need to synchronize with __set_oom_adj */ |
3752 |
++ mutex_lock(&oom_adj_mutex); |
3753 |
++ set_bit(MMF_MULTIPROCESS, &tsk->mm->flags); |
3754 |
++ /* Update the values in case they were changed after copy_signal */ |
3755 |
++ tsk->signal->oom_score_adj = current->signal->oom_score_adj; |
3756 |
++ tsk->signal->oom_score_adj_min = current->signal->oom_score_adj_min; |
3757 |
++ mutex_unlock(&oom_adj_mutex); |
3758 |
++} |
3759 |
++ |
3760 |
+ /* |
3761 |
+ * This creates a new process as a copy of the old one, |
3762 |
+ * but does not actually start it yet. |
3763 |
+@@ -2084,6 +2103,8 @@ static __latent_entropy struct task_struct *copy_process( |
3764 |
+ trace_task_newtask(p, clone_flags); |
3765 |
+ uprobe_copy_process(p, clone_flags); |
3766 |
+ |
3767 |
++ copy_oom_score_adj(clone_flags, p); |
3768 |
++ |
3769 |
+ return p; |
3770 |
+ |
3771 |
+ bad_fork_cancel_cgroup: |
3772 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
3773 |
+index aa730a3d5c258..87cd5bf1b4874 100644 |
3774 |
+--- a/mm/memcontrol.c |
3775 |
++++ b/mm/memcontrol.c |
3776 |
+@@ -4780,7 +4780,7 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma, |
3777 |
+ struct page *page = NULL; |
3778 |
+ swp_entry_t ent = pte_to_swp_entry(ptent); |
3779 |
+ |
3780 |
+- if (!(mc.flags & MOVE_ANON) || non_swap_entry(ent)) |
3781 |
++ if (!(mc.flags & MOVE_ANON)) |
3782 |
+ return NULL; |
3783 |
+ |
3784 |
+ /* |
3785 |
+@@ -4799,6 +4799,9 @@ static struct page *mc_handle_swap_pte(struct vm_area_struct *vma, |
3786 |
+ return page; |
3787 |
+ } |
3788 |
+ |
3789 |
++ if (non_swap_entry(ent)) |
3790 |
++ return NULL; |
3791 |
++ |
3792 |
+ /* |
3793 |
+ * Because lookup_swap_cache() updates some statistics counter, |
3794 |
+ * we call find_get_page() with swapper_space directly. |
3795 |
+diff --git a/mm/oom_kill.c b/mm/oom_kill.c |
3796 |
+index a581fe2a2f1fe..928b3b5e24e6b 100644 |
3797 |
+--- a/mm/oom_kill.c |
3798 |
++++ b/mm/oom_kill.c |
3799 |
+@@ -62,6 +62,8 @@ int sysctl_oom_dump_tasks = 1; |
3800 |
+ * and mark_oom_victim |
3801 |
+ */ |
3802 |
+ DEFINE_MUTEX(oom_lock); |
3803 |
++/* Serializes oom_score_adj and oom_score_adj_min updates */ |
3804 |
++DEFINE_MUTEX(oom_adj_mutex); |
3805 |
+ |
3806 |
+ #ifdef CONFIG_NUMA |
3807 |
+ /** |
3808 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
3809 |
+index 4efa5e33513e3..59c0b1a86e51b 100644 |
3810 |
+--- a/net/ipv4/icmp.c |
3811 |
++++ b/net/ipv4/icmp.c |
3812 |
+@@ -244,7 +244,7 @@ static struct { |
3813 |
+ /** |
3814 |
+ * icmp_global_allow - Are we allowed to send one more ICMP message ? |
3815 |
+ * |
3816 |
+- * Uses a token bucket to limit our ICMP messages to sysctl_icmp_msgs_per_sec. |
3817 |
++ * Uses a token bucket to limit our ICMP messages to ~sysctl_icmp_msgs_per_sec. |
3818 |
+ * Returns false if we reached the limit and can not send another packet. |
3819 |
+ * Note: called with BH disabled |
3820 |
+ */ |
3821 |
+@@ -272,7 +272,10 @@ bool icmp_global_allow(void) |
3822 |
+ } |
3823 |
+ credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); |
3824 |
+ if (credit) { |
3825 |
+- credit--; |
3826 |
++ /* We want to use a credit of one in average, but need to randomize |
3827 |
++ * it for security reasons. |
3828 |
++ */ |
3829 |
++ credit = max_t(int, credit - prandom_u32_max(3), 0); |
3830 |
+ rc = true; |
3831 |
+ } |
3832 |
+ WRITE_ONCE(icmp_global.credit, credit); |
3833 |
+diff --git a/net/ipv4/netfilter/nf_log_arp.c b/net/ipv4/netfilter/nf_log_arp.c |
3834 |
+index df5c2a2061a4b..19fff2c589fac 100644 |
3835 |
+--- a/net/ipv4/netfilter/nf_log_arp.c |
3836 |
++++ b/net/ipv4/netfilter/nf_log_arp.c |
3837 |
+@@ -46,16 +46,31 @@ static void dump_arp_packet(struct nf_log_buf *m, |
3838 |
+ const struct nf_loginfo *info, |
3839 |
+ const struct sk_buff *skb, unsigned int nhoff) |
3840 |
+ { |
3841 |
+- const struct arphdr *ah; |
3842 |
+- struct arphdr _arph; |
3843 |
+ const struct arppayload *ap; |
3844 |
+ struct arppayload _arpp; |
3845 |
++ const struct arphdr *ah; |
3846 |
++ unsigned int logflags; |
3847 |
++ struct arphdr _arph; |
3848 |
+ |
3849 |
+ ah = skb_header_pointer(skb, 0, sizeof(_arph), &_arph); |
3850 |
+ if (ah == NULL) { |
3851 |
+ nf_log_buf_add(m, "TRUNCATED"); |
3852 |
+ return; |
3853 |
+ } |
3854 |
++ |
3855 |
++ if (info->type == NF_LOG_TYPE_LOG) |
3856 |
++ logflags = info->u.log.logflags; |
3857 |
++ else |
3858 |
++ logflags = NF_LOG_DEFAULT_MASK; |
3859 |
++ |
3860 |
++ if (logflags & NF_LOG_MACDECODE) { |
3861 |
++ nf_log_buf_add(m, "MACSRC=%pM MACDST=%pM ", |
3862 |
++ eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest); |
3863 |
++ nf_log_dump_vlan(m, skb); |
3864 |
++ nf_log_buf_add(m, "MACPROTO=%04x ", |
3865 |
++ ntohs(eth_hdr(skb)->h_proto)); |
3866 |
++ } |
3867 |
++ |
3868 |
+ nf_log_buf_add(m, "ARP HTYPE=%d PTYPE=0x%04x OPCODE=%d", |
3869 |
+ ntohs(ah->ar_hrd), ntohs(ah->ar_pro), ntohs(ah->ar_op)); |
3870 |
+ |
3871 |
+diff --git a/net/ipv4/netfilter/nf_log_ipv4.c b/net/ipv4/netfilter/nf_log_ipv4.c |
3872 |
+index 1e6f28c97d3a2..cde1918607e9c 100644 |
3873 |
+--- a/net/ipv4/netfilter/nf_log_ipv4.c |
3874 |
++++ b/net/ipv4/netfilter/nf_log_ipv4.c |
3875 |
+@@ -287,8 +287,10 @@ static void dump_ipv4_mac_header(struct nf_log_buf *m, |
3876 |
+ |
3877 |
+ switch (dev->type) { |
3878 |
+ case ARPHRD_ETHER: |
3879 |
+- nf_log_buf_add(m, "MACSRC=%pM MACDST=%pM MACPROTO=%04x ", |
3880 |
+- eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, |
3881 |
++ nf_log_buf_add(m, "MACSRC=%pM MACDST=%pM ", |
3882 |
++ eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest); |
3883 |
++ nf_log_dump_vlan(m, skb); |
3884 |
++ nf_log_buf_add(m, "MACPROTO=%04x ", |
3885 |
+ ntohs(eth_hdr(skb)->h_proto)); |
3886 |
+ return; |
3887 |
+ default: |
3888 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
3889 |
+index 3db428242b22d..48081e6d50b4e 100644 |
3890 |
+--- a/net/ipv4/route.c |
3891 |
++++ b/net/ipv4/route.c |
3892 |
+@@ -2634,10 +2634,12 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, |
3893 |
+ if (IS_ERR(rt)) |
3894 |
+ return rt; |
3895 |
+ |
3896 |
+- if (flp4->flowi4_proto) |
3897 |
++ if (flp4->flowi4_proto) { |
3898 |
++ flp4->flowi4_oif = rt->dst.dev->ifindex; |
3899 |
+ rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst, |
3900 |
+ flowi4_to_flowi(flp4), |
3901 |
+ sk, 0); |
3902 |
++ } |
3903 |
+ |
3904 |
+ return rt; |
3905 |
+ } |
3906 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
3907 |
+index 9813d62de631b..c19870d561861 100644 |
3908 |
+--- a/net/ipv4/tcp_input.c |
3909 |
++++ b/net/ipv4/tcp_input.c |
3910 |
+@@ -5631,6 +5631,8 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) |
3911 |
+ tcp_data_snd_check(sk); |
3912 |
+ if (!inet_csk_ack_scheduled(sk)) |
3913 |
+ goto no_ack; |
3914 |
++ } else { |
3915 |
++ tcp_update_wl(tp, TCP_SKB_CB(skb)->seq); |
3916 |
+ } |
3917 |
+ |
3918 |
+ __tcp_ack_snd_check(sk, 0); |
3919 |
+diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c |
3920 |
+index b924941b96a31..8b5459b34bc4a 100644 |
3921 |
+--- a/net/ipv6/ip6_fib.c |
3922 |
++++ b/net/ipv6/ip6_fib.c |
3923 |
+@@ -2417,8 +2417,10 @@ static void *ipv6_route_seq_start(struct seq_file *seq, loff_t *pos) |
3924 |
+ iter->skip = *pos; |
3925 |
+ |
3926 |
+ if (iter->tbl) { |
3927 |
++ loff_t p = 0; |
3928 |
++ |
3929 |
+ ipv6_route_seq_setup_walk(iter, net); |
3930 |
+- return ipv6_route_seq_next(seq, NULL, pos); |
3931 |
++ return ipv6_route_seq_next(seq, NULL, &p); |
3932 |
+ } else { |
3933 |
+ return NULL; |
3934 |
+ } |
3935 |
+diff --git a/net/ipv6/netfilter/nf_log_ipv6.c b/net/ipv6/netfilter/nf_log_ipv6.c |
3936 |
+index c6bf580d0f331..c456e2f902b93 100644 |
3937 |
+--- a/net/ipv6/netfilter/nf_log_ipv6.c |
3938 |
++++ b/net/ipv6/netfilter/nf_log_ipv6.c |
3939 |
+@@ -300,9 +300,11 @@ static void dump_ipv6_mac_header(struct nf_log_buf *m, |
3940 |
+ |
3941 |
+ switch (dev->type) { |
3942 |
+ case ARPHRD_ETHER: |
3943 |
+- nf_log_buf_add(m, "MACSRC=%pM MACDST=%pM MACPROTO=%04x ", |
3944 |
+- eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest, |
3945 |
+- ntohs(eth_hdr(skb)->h_proto)); |
3946 |
++ nf_log_buf_add(m, "MACSRC=%pM MACDST=%pM ", |
3947 |
++ eth_hdr(skb)->h_source, eth_hdr(skb)->h_dest); |
3948 |
++ nf_log_dump_vlan(m, skb); |
3949 |
++ nf_log_buf_add(m, "MACPROTO=%04x ", |
3950 |
++ ntohs(eth_hdr(skb)->h_proto)); |
3951 |
+ return; |
3952 |
+ default: |
3953 |
+ break; |
3954 |
+diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c |
3955 |
+index 3f75cd947045e..11f7c546e57b3 100644 |
3956 |
+--- a/net/netfilter/ipvs/ip_vs_xmit.c |
3957 |
++++ b/net/netfilter/ipvs/ip_vs_xmit.c |
3958 |
+@@ -586,6 +586,8 @@ static inline int ip_vs_tunnel_xmit_prepare(struct sk_buff *skb, |
3959 |
+ if (ret == NF_ACCEPT) { |
3960 |
+ nf_reset(skb); |
3961 |
+ skb_forward_csum(skb); |
3962 |
++ if (skb->dev) |
3963 |
++ skb->tstamp = 0; |
3964 |
+ } |
3965 |
+ return ret; |
3966 |
+ } |
3967 |
+@@ -626,6 +628,8 @@ static inline int ip_vs_nat_send_or_cont(int pf, struct sk_buff *skb, |
3968 |
+ |
3969 |
+ if (!local) { |
3970 |
+ skb_forward_csum(skb); |
3971 |
++ if (skb->dev) |
3972 |
++ skb->tstamp = 0; |
3973 |
+ NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb, |
3974 |
+ NULL, skb_dst(skb)->dev, dst_output); |
3975 |
+ } else |
3976 |
+@@ -646,6 +650,8 @@ static inline int ip_vs_send_or_cont(int pf, struct sk_buff *skb, |
3977 |
+ if (!local) { |
3978 |
+ ip_vs_drop_early_demux_sk(skb); |
3979 |
+ skb_forward_csum(skb); |
3980 |
++ if (skb->dev) |
3981 |
++ skb->tstamp = 0; |
3982 |
+ NF_HOOK(pf, NF_INET_LOCAL_OUT, cp->ipvs->net, NULL, skb, |
3983 |
+ NULL, skb_dst(skb)->dev, dst_output); |
3984 |
+ } else |
3985 |
+diff --git a/net/netfilter/nf_log_common.c b/net/netfilter/nf_log_common.c |
3986 |
+index a8c5c846aec10..b164a0e1e0536 100644 |
3987 |
+--- a/net/netfilter/nf_log_common.c |
3988 |
++++ b/net/netfilter/nf_log_common.c |
3989 |
+@@ -176,6 +176,18 @@ nf_log_dump_packet_common(struct nf_log_buf *m, u_int8_t pf, |
3990 |
+ } |
3991 |
+ EXPORT_SYMBOL_GPL(nf_log_dump_packet_common); |
3992 |
+ |
3993 |
++void nf_log_dump_vlan(struct nf_log_buf *m, const struct sk_buff *skb) |
3994 |
++{ |
3995 |
++ u16 vid; |
3996 |
++ |
3997 |
++ if (!skb_vlan_tag_present(skb)) |
3998 |
++ return; |
3999 |
++ |
4000 |
++ vid = skb_vlan_tag_get(skb); |
4001 |
++ nf_log_buf_add(m, "VPROTO=%04x VID=%u ", ntohs(skb->vlan_proto), vid); |
4002 |
++} |
4003 |
++EXPORT_SYMBOL_GPL(nf_log_dump_vlan); |
4004 |
++ |
4005 |
+ /* bridge and netdev logging families share this code. */ |
4006 |
+ void nf_log_l2packet(struct net *net, u_int8_t pf, |
4007 |
+ __be16 protocol, |
4008 |
+diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c |
4009 |
+index a65a5a5f434b8..310872a9d6602 100644 |
4010 |
+--- a/net/nfc/netlink.c |
4011 |
++++ b/net/nfc/netlink.c |
4012 |
+@@ -1235,7 +1235,7 @@ static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info) |
4013 |
+ u32 idx; |
4014 |
+ char firmware_name[NFC_FIRMWARE_NAME_MAXSIZE + 1]; |
4015 |
+ |
4016 |
+- if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) |
4017 |
++ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || !info->attrs[NFC_ATTR_FIRMWARE_NAME]) |
4018 |
+ return -EINVAL; |
4019 |
+ |
4020 |
+ idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); |
4021 |
+diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c |
4022 |
+index e4fc6b2bc29d2..f43234be5695e 100644 |
4023 |
+--- a/net/sched/act_tunnel_key.c |
4024 |
++++ b/net/sched/act_tunnel_key.c |
4025 |
+@@ -314,7 +314,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla, |
4026 |
+ |
4027 |
+ metadata = __ipv6_tun_set_dst(&saddr, &daddr, tos, ttl, dst_port, |
4028 |
+ 0, flags, |
4029 |
+- key_id, 0); |
4030 |
++ key_id, opts_len); |
4031 |
+ } else { |
4032 |
+ NL_SET_ERR_MSG(extack, "Missing either ipv4 or ipv6 src and dst"); |
4033 |
+ ret = -EINVAL; |
4034 |
+diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c |
4035 |
+index 2c9baf8bf1189..e7a6c8dcf6b8e 100644 |
4036 |
+--- a/net/smc/smc_core.c |
4037 |
++++ b/net/smc/smc_core.c |
4038 |
+@@ -770,7 +770,7 @@ static struct smc_buf_desc *smcr_new_buf_create(struct smc_link_group *lgr, |
4039 |
+ return buf_desc; |
4040 |
+ } |
4041 |
+ |
4042 |
+-#define SMCD_DMBE_SIZES 7 /* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */ |
4043 |
++#define SMCD_DMBE_SIZES 6 /* 0 -> 16KB, 1 -> 32KB, .. 6 -> 1MB */ |
4044 |
+ |
4045 |
+ static struct smc_buf_desc *smcd_new_buf_create(struct smc_link_group *lgr, |
4046 |
+ bool is_dmb, int bufsize) |
4047 |
+diff --git a/net/tipc/msg.c b/net/tipc/msg.c |
4048 |
+index b078b77620f18..0b8446cd541ce 100644 |
4049 |
+--- a/net/tipc/msg.c |
4050 |
++++ b/net/tipc/msg.c |
4051 |
+@@ -140,7 +140,8 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf) |
4052 |
+ if (fragid == FIRST_FRAGMENT) { |
4053 |
+ if (unlikely(head)) |
4054 |
+ goto err; |
4055 |
+- frag = skb_unshare(frag, GFP_ATOMIC); |
4056 |
++ if (skb_cloned(frag)) |
4057 |
++ frag = skb_copy(frag, GFP_ATOMIC); |
4058 |
+ if (unlikely(!frag)) |
4059 |
+ goto err; |
4060 |
+ head = *headbuf = frag; |
4061 |
+diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c |
4062 |
+index 575d621305786..dd0fc2aa68759 100644 |
4063 |
+--- a/net/tls/tls_device.c |
4064 |
++++ b/net/tls/tls_device.c |
4065 |
+@@ -351,13 +351,13 @@ static int tls_push_data(struct sock *sk, |
4066 |
+ struct tls_context *tls_ctx = tls_get_ctx(sk); |
4067 |
+ struct tls_offload_context_tx *ctx = tls_offload_ctx_tx(tls_ctx); |
4068 |
+ int tls_push_record_flags = flags | MSG_SENDPAGE_NOTLAST; |
4069 |
+- int more = flags & (MSG_SENDPAGE_NOTLAST | MSG_MORE); |
4070 |
+ struct tls_record_info *record = ctx->open_record; |
4071 |
+ struct page_frag *pfrag; |
4072 |
+ size_t orig_size = size; |
4073 |
+ u32 max_open_record_len; |
4074 |
+- int copy, rc = 0; |
4075 |
++ bool more = false; |
4076 |
+ bool done = false; |
4077 |
++ int copy, rc = 0; |
4078 |
+ long timeo; |
4079 |
+ |
4080 |
+ if (flags & |
4081 |
+@@ -422,9 +422,8 @@ handle_error: |
4082 |
+ if (!size) { |
4083 |
+ last_record: |
4084 |
+ tls_push_record_flags = flags; |
4085 |
+- if (more) { |
4086 |
+- tls_ctx->pending_open_record_frags = |
4087 |
+- record->num_frags; |
4088 |
++ if (flags & (MSG_SENDPAGE_NOTLAST | MSG_MORE)) { |
4089 |
++ more = true; |
4090 |
+ break; |
4091 |
+ } |
4092 |
+ |
4093 |
+@@ -445,6 +444,8 @@ last_record: |
4094 |
+ } |
4095 |
+ } while (!done); |
4096 |
+ |
4097 |
++ tls_ctx->pending_open_record_frags = more; |
4098 |
++ |
4099 |
+ if (orig_size - size > 0) |
4100 |
+ rc = orig_size - size; |
4101 |
+ |
4102 |
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
4103 |
+index 4e41792099822..fbc8875502c3e 100644 |
4104 |
+--- a/net/wireless/nl80211.c |
4105 |
++++ b/net/wireless/nl80211.c |
4106 |
+@@ -1950,7 +1950,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev, |
4107 |
+ * case we'll continue with more data in the next round, |
4108 |
+ * but break unconditionally so unsplit data stops here. |
4109 |
+ */ |
4110 |
+- state->split_start++; |
4111 |
++ if (state->split) |
4112 |
++ state->split_start++; |
4113 |
++ else |
4114 |
++ state->split_start = 0; |
4115 |
+ break; |
4116 |
+ case 9: |
4117 |
+ if (rdev->wiphy.extended_capabilities && |
4118 |
+diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c |
4119 |
+index c5dd05ace28cf..f4f3de5f06ca5 100644 |
4120 |
+--- a/security/integrity/ima/ima_crypto.c |
4121 |
++++ b/security/integrity/ima/ima_crypto.c |
4122 |
+@@ -682,6 +682,8 @@ static int ima_calc_boot_aggregate_tfm(char *digest, |
4123 |
+ ima_pcrread(i, pcr_i); |
4124 |
+ /* now accumulate with current aggregate */ |
4125 |
+ rc = crypto_shash_update(shash, pcr_i, TPM_DIGEST_SIZE); |
4126 |
++ if (rc != 0) |
4127 |
++ return rc; |
4128 |
+ } |
4129 |
+ if (!rc) |
4130 |
+ crypto_shash_final(shash, digest); |
4131 |
+diff --git a/sound/core/seq/oss/seq_oss.c b/sound/core/seq/oss/seq_oss.c |
4132 |
+index ed5bca0db3e73..f4a9d9972330b 100644 |
4133 |
+--- a/sound/core/seq/oss/seq_oss.c |
4134 |
++++ b/sound/core/seq/oss/seq_oss.c |
4135 |
+@@ -187,9 +187,12 @@ odev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
4136 |
+ if (snd_BUG_ON(!dp)) |
4137 |
+ return -ENXIO; |
4138 |
+ |
4139 |
+- mutex_lock(®ister_mutex); |
4140 |
++ if (cmd != SNDCTL_SEQ_SYNC && |
4141 |
++ mutex_lock_interruptible(®ister_mutex)) |
4142 |
++ return -ERESTARTSYS; |
4143 |
+ rc = snd_seq_oss_ioctl(dp, cmd, arg); |
4144 |
+- mutex_unlock(®ister_mutex); |
4145 |
++ if (cmd != SNDCTL_SEQ_SYNC) |
4146 |
++ mutex_unlock(®ister_mutex); |
4147 |
+ return rc; |
4148 |
+ } |
4149 |
+ |
4150 |
+diff --git a/sound/firewire/bebob/bebob_hwdep.c b/sound/firewire/bebob/bebob_hwdep.c |
4151 |
+index 04c321e08c626..a04b5880926cb 100644 |
4152 |
+--- a/sound/firewire/bebob/bebob_hwdep.c |
4153 |
++++ b/sound/firewire/bebob/bebob_hwdep.c |
4154 |
+@@ -37,12 +37,11 @@ hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count, |
4155 |
+ } |
4156 |
+ |
4157 |
+ memset(&event, 0, sizeof(event)); |
4158 |
++ count = min_t(long, count, sizeof(event.lock_status)); |
4159 |
+ if (bebob->dev_lock_changed) { |
4160 |
+ event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS; |
4161 |
+ event.lock_status.status = (bebob->dev_lock_count > 0); |
4162 |
+ bebob->dev_lock_changed = false; |
4163 |
+- |
4164 |
+- count = min_t(long, count, sizeof(event.lock_status)); |
4165 |
+ } |
4166 |
+ |
4167 |
+ spin_unlock_irq(&bebob->lock); |
4168 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4169 |
+index 24bc9e4460473..382a8d179eb0d 100644 |
4170 |
+--- a/sound/pci/hda/patch_realtek.c |
4171 |
++++ b/sound/pci/hda/patch_realtek.c |
4172 |
+@@ -1906,6 +1906,8 @@ enum { |
4173 |
+ ALC1220_FIXUP_CLEVO_P950, |
4174 |
+ ALC1220_FIXUP_CLEVO_PB51ED, |
4175 |
+ ALC1220_FIXUP_CLEVO_PB51ED_PINS, |
4176 |
++ ALC887_FIXUP_ASUS_AUDIO, |
4177 |
++ ALC887_FIXUP_ASUS_HMIC, |
4178 |
+ }; |
4179 |
+ |
4180 |
+ static void alc889_fixup_coef(struct hda_codec *codec, |
4181 |
+@@ -2118,6 +2120,31 @@ static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, |
4182 |
+ alc_fixup_headset_mode_no_hp_mic(codec, fix, action); |
4183 |
+ } |
4184 |
+ |
4185 |
++static void alc887_asus_hp_automute_hook(struct hda_codec *codec, |
4186 |
++ struct hda_jack_callback *jack) |
4187 |
++{ |
4188 |
++ struct alc_spec *spec = codec->spec; |
4189 |
++ unsigned int vref; |
4190 |
++ |
4191 |
++ snd_hda_gen_hp_automute(codec, jack); |
4192 |
++ |
4193 |
++ if (spec->gen.hp_jack_present) |
4194 |
++ vref = AC_PINCTL_VREF_80; |
4195 |
++ else |
4196 |
++ vref = AC_PINCTL_VREF_HIZ; |
4197 |
++ snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); |
4198 |
++} |
4199 |
++ |
4200 |
++static void alc887_fixup_asus_jack(struct hda_codec *codec, |
4201 |
++ const struct hda_fixup *fix, int action) |
4202 |
++{ |
4203 |
++ struct alc_spec *spec = codec->spec; |
4204 |
++ if (action != HDA_FIXUP_ACT_PROBE) |
4205 |
++ return; |
4206 |
++ snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); |
4207 |
++ spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook; |
4208 |
++} |
4209 |
++ |
4210 |
+ static const struct hda_fixup alc882_fixups[] = { |
4211 |
+ [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
4212 |
+ .type = HDA_FIXUP_PINS, |
4213 |
+@@ -2375,6 +2402,20 @@ static const struct hda_fixup alc882_fixups[] = { |
4214 |
+ .chained = true, |
4215 |
+ .chain_id = ALC1220_FIXUP_CLEVO_PB51ED, |
4216 |
+ }, |
4217 |
++ [ALC887_FIXUP_ASUS_AUDIO] = { |
4218 |
++ .type = HDA_FIXUP_PINS, |
4219 |
++ .v.pins = (const struct hda_pintbl[]) { |
4220 |
++ { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */ |
4221 |
++ { 0x19, 0x22219420 }, |
4222 |
++ {} |
4223 |
++ }, |
4224 |
++ }, |
4225 |
++ [ALC887_FIXUP_ASUS_HMIC] = { |
4226 |
++ .type = HDA_FIXUP_FUNC, |
4227 |
++ .v.func = alc887_fixup_asus_jack, |
4228 |
++ .chained = true, |
4229 |
++ .chain_id = ALC887_FIXUP_ASUS_AUDIO, |
4230 |
++ }, |
4231 |
+ }; |
4232 |
+ |
4233 |
+ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
4234 |
+@@ -2408,6 +2449,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
4235 |
+ SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), |
4236 |
+ SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
4237 |
+ SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
4238 |
++ SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC), |
4239 |
+ SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
4240 |
+ SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), |
4241 |
+ SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), |
4242 |
+diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c |
4243 |
+index 292b103abada9..475579a9830a3 100644 |
4244 |
+--- a/sound/soc/qcom/lpass-cpu.c |
4245 |
++++ b/sound/soc/qcom/lpass-cpu.c |
4246 |
+@@ -182,21 +182,6 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream, |
4247 |
+ return 0; |
4248 |
+ } |
4249 |
+ |
4250 |
+-static int lpass_cpu_daiops_hw_free(struct snd_pcm_substream *substream, |
4251 |
+- struct snd_soc_dai *dai) |
4252 |
+-{ |
4253 |
+- struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai); |
4254 |
+- int ret; |
4255 |
+- |
4256 |
+- ret = regmap_write(drvdata->lpaif_map, |
4257 |
+- LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id), |
4258 |
+- 0); |
4259 |
+- if (ret) |
4260 |
+- dev_err(dai->dev, "error writing to i2sctl reg: %d\n", ret); |
4261 |
+- |
4262 |
+- return ret; |
4263 |
+-} |
4264 |
+- |
4265 |
+ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream, |
4266 |
+ struct snd_soc_dai *dai) |
4267 |
+ { |
4268 |
+@@ -277,7 +262,6 @@ const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = { |
4269 |
+ .startup = lpass_cpu_daiops_startup, |
4270 |
+ .shutdown = lpass_cpu_daiops_shutdown, |
4271 |
+ .hw_params = lpass_cpu_daiops_hw_params, |
4272 |
+- .hw_free = lpass_cpu_daiops_hw_free, |
4273 |
+ .prepare = lpass_cpu_daiops_prepare, |
4274 |
+ .trigger = lpass_cpu_daiops_trigger, |
4275 |
+ }; |
4276 |
+diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c |
4277 |
+index d07271ea4c451..2f29672477892 100644 |
4278 |
+--- a/sound/soc/qcom/lpass-platform.c |
4279 |
++++ b/sound/soc/qcom/lpass-platform.c |
4280 |
+@@ -69,7 +69,7 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) |
4281 |
+ int ret, dma_ch, dir = substream->stream; |
4282 |
+ struct lpass_pcm_data *data; |
4283 |
+ |
4284 |
+- data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL); |
4285 |
++ data = kzalloc(sizeof(*data), GFP_KERNEL); |
4286 |
+ if (!data) |
4287 |
+ return -ENOMEM; |
4288 |
+ |
4289 |
+@@ -127,6 +127,7 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) |
4290 |
+ if (v->free_dma_channel) |
4291 |
+ v->free_dma_channel(drvdata, data->dma_ch); |
4292 |
+ |
4293 |
++ kfree(data); |
4294 |
+ return 0; |
4295 |
+ } |
4296 |
+ |