1 |
commit: 598ad5bdcb5346e952e480a99a53f2b9157112d0 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 31 15:02:12 2019 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 31 15:02:12 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=598ad5bd |
7 |
|
8 |
Linux patch 4.19.47 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1046_linux-4.19.47.patch | 9410 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 9414 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 87c4eaf..0c0cd1a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -227,6 +227,10 @@ Patch: 1045_linux-4.19.46.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.19.46 |
23 |
|
24 |
+Patch: 1046_linux-4.19.47.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.19.47 |
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/1046_linux-4.19.47.patch b/1046_linux-4.19.47.patch |
33 |
new file mode 100644 |
34 |
index 0000000..645af41 |
35 |
--- /dev/null |
36 |
+++ b/1046_linux-4.19.47.patch |
37 |
@@ -0,0 +1,9410 @@ |
38 |
+diff --git a/Documentation/arm64/silicon-errata.txt b/Documentation/arm64/silicon-errata.txt |
39 |
+index 3c6fc2e08d04..eeb3fc9d777b 100644 |
40 |
+--- a/Documentation/arm64/silicon-errata.txt |
41 |
++++ b/Documentation/arm64/silicon-errata.txt |
42 |
+@@ -58,6 +58,7 @@ stable kernels. |
43 |
+ | ARM | Cortex-A72 | #853709 | N/A | |
44 |
+ | ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 | |
45 |
+ | ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 | |
46 |
++| ARM | Cortex-A76 | #1463225 | ARM64_ERRATUM_1463225 | |
47 |
+ | ARM | MMU-500 | #841119,#826419 | N/A | |
48 |
+ | | | | | |
49 |
+ | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 | |
50 |
+diff --git a/Documentation/sysctl/net.txt b/Documentation/sysctl/net.txt |
51 |
+index 9ecde517728c..2793d4eac55f 100644 |
52 |
+--- a/Documentation/sysctl/net.txt |
53 |
++++ b/Documentation/sysctl/net.txt |
54 |
+@@ -92,6 +92,14 @@ Values : |
55 |
+ 0 - disable JIT kallsyms export (default value) |
56 |
+ 1 - enable JIT kallsyms export for privileged users only |
57 |
+ |
58 |
++bpf_jit_limit |
59 |
++------------- |
60 |
++ |
61 |
++This enforces a global limit for memory allocations to the BPF JIT |
62 |
++compiler in order to reject unprivileged JIT requests once it has |
63 |
++been surpassed. bpf_jit_limit contains the value of the global limit |
64 |
++in bytes. |
65 |
++ |
66 |
+ dev_weight |
67 |
+ -------------- |
68 |
+ |
69 |
+diff --git a/Makefile b/Makefile |
70 |
+index 5383dd317d59..b3ba28ff73d5 100644 |
71 |
+--- a/Makefile |
72 |
++++ b/Makefile |
73 |
+@@ -1,7 +1,7 @@ |
74 |
+ # SPDX-License-Identifier: GPL-2.0 |
75 |
+ VERSION = 4 |
76 |
+ PATCHLEVEL = 19 |
77 |
+-SUBLEVEL = 46 |
78 |
++SUBLEVEL = 47 |
79 |
+ EXTRAVERSION = |
80 |
+ NAME = "People's Front" |
81 |
+ |
82 |
+diff --git a/arch/arm/include/asm/cp15.h b/arch/arm/include/asm/cp15.h |
83 |
+index 07e27f212dc7..d2453e2d3f1f 100644 |
84 |
+--- a/arch/arm/include/asm/cp15.h |
85 |
++++ b/arch/arm/include/asm/cp15.h |
86 |
+@@ -68,6 +68,8 @@ |
87 |
+ #define BPIALL __ACCESS_CP15(c7, 0, c5, 6) |
88 |
+ #define ICIALLU __ACCESS_CP15(c7, 0, c5, 0) |
89 |
+ |
90 |
++#define CNTVCT __ACCESS_CP15_64(1, c14) |
91 |
++ |
92 |
+ extern unsigned long cr_alignment; /* defined in entry-armv.S */ |
93 |
+ |
94 |
+ static inline unsigned long get_cr(void) |
95 |
+diff --git a/arch/arm/vdso/vgettimeofday.c b/arch/arm/vdso/vgettimeofday.c |
96 |
+index a9dd619c6c29..7bdbf5d5c47d 100644 |
97 |
+--- a/arch/arm/vdso/vgettimeofday.c |
98 |
++++ b/arch/arm/vdso/vgettimeofday.c |
99 |
+@@ -18,9 +18,9 @@ |
100 |
+ #include <linux/compiler.h> |
101 |
+ #include <linux/hrtimer.h> |
102 |
+ #include <linux/time.h> |
103 |
+-#include <asm/arch_timer.h> |
104 |
+ #include <asm/barrier.h> |
105 |
+ #include <asm/bug.h> |
106 |
++#include <asm/cp15.h> |
107 |
+ #include <asm/page.h> |
108 |
+ #include <asm/unistd.h> |
109 |
+ #include <asm/vdso_datapage.h> |
110 |
+@@ -123,7 +123,8 @@ static notrace u64 get_ns(struct vdso_data *vdata) |
111 |
+ u64 cycle_now; |
112 |
+ u64 nsec; |
113 |
+ |
114 |
+- cycle_now = arch_counter_get_cntvct(); |
115 |
++ isb(); |
116 |
++ cycle_now = read_sysreg(CNTVCT); |
117 |
+ |
118 |
+ cycle_delta = (cycle_now - vdata->cs_cycle_last) & vdata->cs_mask; |
119 |
+ |
120 |
+diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig |
121 |
+index 1b1a0e95c751..8790a29d0af4 100644 |
122 |
+--- a/arch/arm64/Kconfig |
123 |
++++ b/arch/arm64/Kconfig |
124 |
+@@ -479,6 +479,24 @@ config ARM64_ERRATUM_1024718 |
125 |
+ |
126 |
+ If unsure, say Y. |
127 |
+ |
128 |
++config ARM64_ERRATUM_1463225 |
129 |
++ bool "Cortex-A76: Software Step might prevent interrupt recognition" |
130 |
++ default y |
131 |
++ help |
132 |
++ This option adds a workaround for Arm Cortex-A76 erratum 1463225. |
133 |
++ |
134 |
++ On the affected Cortex-A76 cores (r0p0 to r3p1), software stepping |
135 |
++ of a system call instruction (SVC) can prevent recognition of |
136 |
++ subsequent interrupts when software stepping is disabled in the |
137 |
++ exception handler of the system call and either kernel debugging |
138 |
++ is enabled or VHE is in use. |
139 |
++ |
140 |
++ Work around the erratum by triggering a dummy step exception |
141 |
++ when handling a system call from a task that is being stepped |
142 |
++ in a VHE configuration of the kernel. |
143 |
++ |
144 |
++ If unsure, say Y. |
145 |
++ |
146 |
+ config CAVIUM_ERRATUM_22375 |
147 |
+ bool "Cavium erratum 22375, 24313" |
148 |
+ default y |
149 |
+diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h |
150 |
+index ae1f70450fb2..25ce9056cf64 100644 |
151 |
+--- a/arch/arm64/include/asm/cpucaps.h |
152 |
++++ b/arch/arm64/include/asm/cpucaps.h |
153 |
+@@ -51,7 +51,8 @@ |
154 |
+ #define ARM64_SSBD 30 |
155 |
+ #define ARM64_MISMATCHED_CACHE_TYPE 31 |
156 |
+ #define ARM64_HAS_STAGE2_FWB 32 |
157 |
++#define ARM64_WORKAROUND_1463225 33 |
158 |
+ |
159 |
+-#define ARM64_NCAPS 33 |
160 |
++#define ARM64_NCAPS 34 |
161 |
+ |
162 |
+ #endif /* __ASM_CPUCAPS_H */ |
163 |
+diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cputype.h |
164 |
+index ea690b3562af..b4a48419769f 100644 |
165 |
+--- a/arch/arm64/include/asm/cputype.h |
166 |
++++ b/arch/arm64/include/asm/cputype.h |
167 |
+@@ -86,6 +86,7 @@ |
168 |
+ #define ARM_CPU_PART_CORTEX_A75 0xD0A |
169 |
+ #define ARM_CPU_PART_CORTEX_A35 0xD04 |
170 |
+ #define ARM_CPU_PART_CORTEX_A55 0xD05 |
171 |
++#define ARM_CPU_PART_CORTEX_A76 0xD0B |
172 |
+ |
173 |
+ #define APM_CPU_PART_POTENZA 0x000 |
174 |
+ |
175 |
+@@ -110,6 +111,7 @@ |
176 |
+ #define MIDR_CORTEX_A75 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A75) |
177 |
+ #define MIDR_CORTEX_A35 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A35) |
178 |
+ #define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55) |
179 |
++#define MIDR_CORTEX_A76 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A76) |
180 |
+ #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX) |
181 |
+ #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_81XX) |
182 |
+ #define MIDR_THUNDERX_83XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_THUNDERX_83XX) |
183 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
184 |
+index 1bdeca8918a6..ea423db39364 100644 |
185 |
+--- a/arch/arm64/include/asm/pgtable.h |
186 |
++++ b/arch/arm64/include/asm/pgtable.h |
187 |
+@@ -444,6 +444,8 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
188 |
+ return __pmd_to_phys(pmd); |
189 |
+ } |
190 |
+ |
191 |
++static inline void pte_unmap(pte_t *pte) { } |
192 |
++ |
193 |
+ /* Find an entry in the third-level page table. */ |
194 |
+ #define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
195 |
+ |
196 |
+@@ -452,7 +454,6 @@ static inline phys_addr_t pmd_page_paddr(pmd_t pmd) |
197 |
+ |
198 |
+ #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) |
199 |
+ #define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr)) |
200 |
+-#define pte_unmap(pte) do { } while (0) |
201 |
+ #define pte_unmap_nested(pte) do { } while (0) |
202 |
+ |
203 |
+ #define pte_set_fixmap(addr) ((pte_t *)set_fixmap_offset(FIX_PTE, addr)) |
204 |
+diff --git a/arch/arm64/include/asm/vdso_datapage.h b/arch/arm64/include/asm/vdso_datapage.h |
205 |
+index 2b9a63771eda..f89263c8e11a 100644 |
206 |
+--- a/arch/arm64/include/asm/vdso_datapage.h |
207 |
++++ b/arch/arm64/include/asm/vdso_datapage.h |
208 |
+@@ -38,6 +38,7 @@ struct vdso_data { |
209 |
+ __u32 tz_minuteswest; /* Whacky timezone stuff */ |
210 |
+ __u32 tz_dsttime; |
211 |
+ __u32 use_syscall; |
212 |
++ __u32 hrtimer_res; |
213 |
+ }; |
214 |
+ |
215 |
+ #endif /* !__ASSEMBLY__ */ |
216 |
+diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c |
217 |
+index 323aeb5f2fe6..92fba851ce53 100644 |
218 |
+--- a/arch/arm64/kernel/asm-offsets.c |
219 |
++++ b/arch/arm64/kernel/asm-offsets.c |
220 |
+@@ -99,7 +99,7 @@ int main(void) |
221 |
+ DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); |
222 |
+ DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); |
223 |
+ DEFINE(CLOCK_MONOTONIC_RAW, CLOCK_MONOTONIC_RAW); |
224 |
+- DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); |
225 |
++ DEFINE(CLOCK_REALTIME_RES, offsetof(struct vdso_data, hrtimer_res)); |
226 |
+ DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); |
227 |
+ DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE); |
228 |
+ DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC); |
229 |
+diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c |
230 |
+index dec10898d688..dc6c535cbd13 100644 |
231 |
+--- a/arch/arm64/kernel/cpu_errata.c |
232 |
++++ b/arch/arm64/kernel/cpu_errata.c |
233 |
+@@ -411,6 +411,22 @@ static bool has_ssbd_mitigation(const struct arm64_cpu_capabilities *entry, |
234 |
+ } |
235 |
+ #endif /* CONFIG_ARM64_SSBD */ |
236 |
+ |
237 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
238 |
++DEFINE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
239 |
++ |
240 |
++static bool |
241 |
++has_cortex_a76_erratum_1463225(const struct arm64_cpu_capabilities *entry, |
242 |
++ int scope) |
243 |
++{ |
244 |
++ u32 midr = read_cpuid_id(); |
245 |
++ /* Cortex-A76 r0p0 - r3p1 */ |
246 |
++ struct midr_range range = MIDR_RANGE(MIDR_CORTEX_A76, 0, 0, 3, 1); |
247 |
++ |
248 |
++ WARN_ON(scope != SCOPE_LOCAL_CPU || preemptible()); |
249 |
++ return is_midr_in_range(midr, &range) && is_kernel_in_hyp_mode(); |
250 |
++} |
251 |
++#endif |
252 |
++ |
253 |
+ #define CAP_MIDR_RANGE(model, v_min, r_min, v_max, r_max) \ |
254 |
+ .matches = is_affected_midr_range, \ |
255 |
+ .midr_range = MIDR_RANGE(model, v_min, r_min, v_max, r_max) |
256 |
+@@ -679,6 +695,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { |
257 |
+ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
258 |
+ .matches = has_ssbd_mitigation, |
259 |
+ }, |
260 |
++#endif |
261 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
262 |
++ { |
263 |
++ .desc = "ARM erratum 1463225", |
264 |
++ .capability = ARM64_WORKAROUND_1463225, |
265 |
++ .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, |
266 |
++ .matches = has_cortex_a76_erratum_1463225, |
267 |
++ }, |
268 |
+ #endif |
269 |
+ { |
270 |
+ } |
271 |
+diff --git a/arch/arm64/kernel/cpu_ops.c b/arch/arm64/kernel/cpu_ops.c |
272 |
+index ea001241bdd4..00f8b8612b69 100644 |
273 |
+--- a/arch/arm64/kernel/cpu_ops.c |
274 |
++++ b/arch/arm64/kernel/cpu_ops.c |
275 |
+@@ -85,6 +85,7 @@ static const char *__init cpu_read_enable_method(int cpu) |
276 |
+ pr_err("%pOF: missing enable-method property\n", |
277 |
+ dn); |
278 |
+ } |
279 |
++ of_node_put(dn); |
280 |
+ } else { |
281 |
+ enable_method = acpi_get_enable_method(cpu); |
282 |
+ if (!enable_method) { |
283 |
+diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c |
284 |
+index b09b6f75f759..06941c1fe418 100644 |
285 |
+--- a/arch/arm64/kernel/kaslr.c |
286 |
++++ b/arch/arm64/kernel/kaslr.c |
287 |
+@@ -145,15 +145,15 @@ u64 __init kaslr_early_init(u64 dt_phys) |
288 |
+ |
289 |
+ if (IS_ENABLED(CONFIG_RANDOMIZE_MODULE_REGION_FULL)) { |
290 |
+ /* |
291 |
+- * Randomize the module region over a 4 GB window covering the |
292 |
++ * Randomize the module region over a 2 GB window covering the |
293 |
+ * kernel. This reduces the risk of modules leaking information |
294 |
+ * about the address of the kernel itself, but results in |
295 |
+ * branches between modules and the core kernel that are |
296 |
+ * resolved via PLTs. (Branches between modules will be |
297 |
+ * resolved normally.) |
298 |
+ */ |
299 |
+- module_range = SZ_4G - (u64)(_end - _stext); |
300 |
+- module_alloc_base = max((u64)_end + offset - SZ_4G, |
301 |
++ module_range = SZ_2G - (u64)(_end - _stext); |
302 |
++ module_alloc_base = max((u64)_end + offset - SZ_2G, |
303 |
+ (u64)MODULES_VADDR); |
304 |
+ } else { |
305 |
+ /* |
306 |
+diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c |
307 |
+index f0f27aeefb73..0b368ceccee4 100644 |
308 |
+--- a/arch/arm64/kernel/module.c |
309 |
++++ b/arch/arm64/kernel/module.c |
310 |
+@@ -56,7 +56,7 @@ void *module_alloc(unsigned long size) |
311 |
+ * can simply omit this fallback in that case. |
312 |
+ */ |
313 |
+ p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base, |
314 |
+- module_alloc_base + SZ_4G, GFP_KERNEL, |
315 |
++ module_alloc_base + SZ_2G, GFP_KERNEL, |
316 |
+ PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, |
317 |
+ __builtin_return_address(0)); |
318 |
+ |
319 |
+diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c |
320 |
+index 5610ac01c1ec..871c739f060a 100644 |
321 |
+--- a/arch/arm64/kernel/syscall.c |
322 |
++++ b/arch/arm64/kernel/syscall.c |
323 |
+@@ -8,6 +8,7 @@ |
324 |
+ #include <linux/syscalls.h> |
325 |
+ |
326 |
+ #include <asm/daifflags.h> |
327 |
++#include <asm/debug-monitors.h> |
328 |
+ #include <asm/fpsimd.h> |
329 |
+ #include <asm/syscall.h> |
330 |
+ #include <asm/thread_info.h> |
331 |
+@@ -60,6 +61,35 @@ static inline bool has_syscall_work(unsigned long flags) |
332 |
+ int syscall_trace_enter(struct pt_regs *regs); |
333 |
+ void syscall_trace_exit(struct pt_regs *regs); |
334 |
+ |
335 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
336 |
++DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
337 |
++ |
338 |
++static void cortex_a76_erratum_1463225_svc_handler(void) |
339 |
++{ |
340 |
++ u32 reg, val; |
341 |
++ |
342 |
++ if (!unlikely(test_thread_flag(TIF_SINGLESTEP))) |
343 |
++ return; |
344 |
++ |
345 |
++ if (!unlikely(this_cpu_has_cap(ARM64_WORKAROUND_1463225))) |
346 |
++ return; |
347 |
++ |
348 |
++ __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 1); |
349 |
++ reg = read_sysreg(mdscr_el1); |
350 |
++ val = reg | DBG_MDSCR_SS | DBG_MDSCR_KDE; |
351 |
++ write_sysreg(val, mdscr_el1); |
352 |
++ asm volatile("msr daifclr, #8"); |
353 |
++ isb(); |
354 |
++ |
355 |
++ /* We will have taken a single-step exception by this point */ |
356 |
++ |
357 |
++ write_sysreg(reg, mdscr_el1); |
358 |
++ __this_cpu_write(__in_cortex_a76_erratum_1463225_wa, 0); |
359 |
++} |
360 |
++#else |
361 |
++static void cortex_a76_erratum_1463225_svc_handler(void) { } |
362 |
++#endif /* CONFIG_ARM64_ERRATUM_1463225 */ |
363 |
++ |
364 |
+ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
365 |
+ const syscall_fn_t syscall_table[]) |
366 |
+ { |
367 |
+@@ -68,6 +98,7 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, |
368 |
+ regs->orig_x0 = regs->regs[0]; |
369 |
+ regs->syscallno = scno; |
370 |
+ |
371 |
++ cortex_a76_erratum_1463225_svc_handler(); |
372 |
+ local_daif_restore(DAIF_PROCCTX); |
373 |
+ user_exit(); |
374 |
+ |
375 |
+diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c |
376 |
+index 2d419006ad43..ec0bb588d755 100644 |
377 |
+--- a/arch/arm64/kernel/vdso.c |
378 |
++++ b/arch/arm64/kernel/vdso.c |
379 |
+@@ -232,6 +232,9 @@ void update_vsyscall(struct timekeeper *tk) |
380 |
+ vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; |
381 |
+ vdso_data->wtm_clock_nsec = tk->wall_to_monotonic.tv_nsec; |
382 |
+ |
383 |
++ /* Read without the seqlock held by clock_getres() */ |
384 |
++ WRITE_ONCE(vdso_data->hrtimer_res, hrtimer_resolution); |
385 |
++ |
386 |
+ if (!use_syscall) { |
387 |
+ /* tkr_mono.cycle_last == tkr_raw.cycle_last */ |
388 |
+ vdso_data->cs_cycle_last = tk->tkr_mono.cycle_last; |
389 |
+diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S |
390 |
+index e8f60112818f..856fee6d3512 100644 |
391 |
+--- a/arch/arm64/kernel/vdso/gettimeofday.S |
392 |
++++ b/arch/arm64/kernel/vdso/gettimeofday.S |
393 |
+@@ -308,13 +308,14 @@ ENTRY(__kernel_clock_getres) |
394 |
+ ccmp w0, #CLOCK_MONOTONIC_RAW, #0x4, ne |
395 |
+ b.ne 1f |
396 |
+ |
397 |
+- ldr x2, 5f |
398 |
++ adr vdso_data, _vdso_data |
399 |
++ ldr w2, [vdso_data, #CLOCK_REALTIME_RES] |
400 |
+ b 2f |
401 |
+ 1: |
402 |
+ cmp w0, #CLOCK_REALTIME_COARSE |
403 |
+ ccmp w0, #CLOCK_MONOTONIC_COARSE, #0x4, ne |
404 |
+ b.ne 4f |
405 |
+- ldr x2, 6f |
406 |
++ ldr x2, 5f |
407 |
+ 2: |
408 |
+ cbz x1, 3f |
409 |
+ stp xzr, x2, [x1] |
410 |
+@@ -328,8 +329,6 @@ ENTRY(__kernel_clock_getres) |
411 |
+ svc #0 |
412 |
+ ret |
413 |
+ 5: |
414 |
+- .quad CLOCK_REALTIME_RES |
415 |
+-6: |
416 |
+ .quad CLOCK_COARSE_RES |
417 |
+ .cfi_endproc |
418 |
+ ENDPROC(__kernel_clock_getres) |
419 |
+diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c |
420 |
+index c389f2bef938..d3a5bb16f0b2 100644 |
421 |
+--- a/arch/arm64/mm/dma-mapping.c |
422 |
++++ b/arch/arm64/mm/dma-mapping.c |
423 |
+@@ -664,6 +664,11 @@ static int __iommu_mmap_attrs(struct device *dev, struct vm_area_struct *vma, |
424 |
+ if (dma_mmap_from_dev_coherent(dev, vma, cpu_addr, size, &ret)) |
425 |
+ return ret; |
426 |
+ |
427 |
++ if (!is_vmalloc_addr(cpu_addr)) { |
428 |
++ unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr)); |
429 |
++ return __swiotlb_mmap_pfn(vma, pfn, size); |
430 |
++ } |
431 |
++ |
432 |
+ if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { |
433 |
+ /* |
434 |
+ * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped, |
435 |
+@@ -687,6 +692,11 @@ static int __iommu_get_sgtable(struct device *dev, struct sg_table *sgt, |
436 |
+ unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
437 |
+ struct vm_struct *area = find_vm_area(cpu_addr); |
438 |
+ |
439 |
++ if (!is_vmalloc_addr(cpu_addr)) { |
440 |
++ struct page *page = virt_to_page(cpu_addr); |
441 |
++ return __swiotlb_get_sgtable_page(sgt, page, size); |
442 |
++ } |
443 |
++ |
444 |
+ if (attrs & DMA_ATTR_FORCE_CONTIGUOUS) { |
445 |
+ /* |
446 |
+ * DMA_ATTR_FORCE_CONTIGUOUS allocations are always remapped, |
447 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
448 |
+index a4c134677285..88cf0a0cb616 100644 |
449 |
+--- a/arch/arm64/mm/fault.c |
450 |
++++ b/arch/arm64/mm/fault.c |
451 |
+@@ -827,14 +827,47 @@ void __init hook_debug_fault_code(int nr, |
452 |
+ debug_fault_info[nr].name = name; |
453 |
+ } |
454 |
+ |
455 |
++#ifdef CONFIG_ARM64_ERRATUM_1463225 |
456 |
++DECLARE_PER_CPU(int, __in_cortex_a76_erratum_1463225_wa); |
457 |
++ |
458 |
++static int __exception |
459 |
++cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) |
460 |
++{ |
461 |
++ if (user_mode(regs)) |
462 |
++ return 0; |
463 |
++ |
464 |
++ if (!__this_cpu_read(__in_cortex_a76_erratum_1463225_wa)) |
465 |
++ return 0; |
466 |
++ |
467 |
++ /* |
468 |
++ * We've taken a dummy step exception from the kernel to ensure |
469 |
++ * that interrupts are re-enabled on the syscall path. Return back |
470 |
++ * to cortex_a76_erratum_1463225_svc_handler() with debug exceptions |
471 |
++ * masked so that we can safely restore the mdscr and get on with |
472 |
++ * handling the syscall. |
473 |
++ */ |
474 |
++ regs->pstate |= PSR_D_BIT; |
475 |
++ return 1; |
476 |
++} |
477 |
++#else |
478 |
++static int __exception |
479 |
++cortex_a76_erratum_1463225_debug_handler(struct pt_regs *regs) |
480 |
++{ |
481 |
++ return 0; |
482 |
++} |
483 |
++#endif /* CONFIG_ARM64_ERRATUM_1463225 */ |
484 |
++ |
485 |
+ asmlinkage int __exception do_debug_exception(unsigned long addr_if_watchpoint, |
486 |
+- unsigned int esr, |
487 |
+- struct pt_regs *regs) |
488 |
++ unsigned int esr, |
489 |
++ struct pt_regs *regs) |
490 |
+ { |
491 |
+ const struct fault_info *inf = debug_fault_info + DBG_ESR_EVT(esr); |
492 |
+ unsigned long pc = instruction_pointer(regs); |
493 |
+ int rv; |
494 |
+ |
495 |
++ if (cortex_a76_erratum_1463225_debug_handler(regs)) |
496 |
++ return 0; |
497 |
++ |
498 |
+ /* |
499 |
+ * Tell lockdep we disabled irqs in entry.S. Do nothing if they were |
500 |
+ * already disabled to preserve the last enabled/disabled addresses. |
501 |
+diff --git a/arch/powerpc/boot/addnote.c b/arch/powerpc/boot/addnote.c |
502 |
+index 9d9f6f334d3c..3da3e2b1b51b 100644 |
503 |
+--- a/arch/powerpc/boot/addnote.c |
504 |
++++ b/arch/powerpc/boot/addnote.c |
505 |
+@@ -223,7 +223,11 @@ main(int ac, char **av) |
506 |
+ PUT_16(E_PHNUM, np + 2); |
507 |
+ |
508 |
+ /* write back */ |
509 |
+- lseek(fd, (long) 0, SEEK_SET); |
510 |
++ i = lseek(fd, (long) 0, SEEK_SET); |
511 |
++ if (i < 0) { |
512 |
++ perror("lseek"); |
513 |
++ exit(1); |
514 |
++ } |
515 |
+ i = write(fd, buf, n); |
516 |
+ if (i < 0) { |
517 |
+ perror("write"); |
518 |
+diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S |
519 |
+index 4898e9491a1c..9168a247e24f 100644 |
520 |
+--- a/arch/powerpc/kernel/head_64.S |
521 |
++++ b/arch/powerpc/kernel/head_64.S |
522 |
+@@ -970,7 +970,9 @@ start_here_multiplatform: |
523 |
+ |
524 |
+ /* Restore parameters passed from prom_init/kexec */ |
525 |
+ mr r3,r31 |
526 |
+- bl early_setup /* also sets r13 and SPRG_PACA */ |
527 |
++ LOAD_REG_ADDR(r12, DOTSYM(early_setup)) |
528 |
++ mtctr r12 |
529 |
++ bctrl /* also sets r13 and SPRG_PACA */ |
530 |
+ |
531 |
+ LOAD_REG_ADDR(r3, start_here_common) |
532 |
+ ld r4,PACAKMSR(r13) |
533 |
+diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c |
534 |
+index 3c6ab22a0c4e..af3c15a1d41e 100644 |
535 |
+--- a/arch/powerpc/kernel/watchdog.c |
536 |
++++ b/arch/powerpc/kernel/watchdog.c |
537 |
+@@ -77,7 +77,7 @@ static u64 wd_smp_panic_timeout_tb __read_mostly; /* panic other CPUs */ |
538 |
+ |
539 |
+ static u64 wd_timer_period_ms __read_mostly; /* interval between heartbeat */ |
540 |
+ |
541 |
+-static DEFINE_PER_CPU(struct timer_list, wd_timer); |
542 |
++static DEFINE_PER_CPU(struct hrtimer, wd_hrtimer); |
543 |
+ static DEFINE_PER_CPU(u64, wd_timer_tb); |
544 |
+ |
545 |
+ /* SMP checker bits */ |
546 |
+@@ -293,21 +293,21 @@ out: |
547 |
+ nmi_exit(); |
548 |
+ } |
549 |
+ |
550 |
+-static void wd_timer_reset(unsigned int cpu, struct timer_list *t) |
551 |
+-{ |
552 |
+- t->expires = jiffies + msecs_to_jiffies(wd_timer_period_ms); |
553 |
+- if (wd_timer_period_ms > 1000) |
554 |
+- t->expires = __round_jiffies_up(t->expires, cpu); |
555 |
+- add_timer_on(t, cpu); |
556 |
+-} |
557 |
+- |
558 |
+-static void wd_timer_fn(struct timer_list *t) |
559 |
++static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) |
560 |
+ { |
561 |
+ int cpu = smp_processor_id(); |
562 |
+ |
563 |
++ if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) |
564 |
++ return HRTIMER_NORESTART; |
565 |
++ |
566 |
++ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
567 |
++ return HRTIMER_NORESTART; |
568 |
++ |
569 |
+ watchdog_timer_interrupt(cpu); |
570 |
+ |
571 |
+- wd_timer_reset(cpu, t); |
572 |
++ hrtimer_forward_now(hrtimer, ms_to_ktime(wd_timer_period_ms)); |
573 |
++ |
574 |
++ return HRTIMER_RESTART; |
575 |
+ } |
576 |
+ |
577 |
+ void arch_touch_nmi_watchdog(void) |
578 |
+@@ -323,37 +323,22 @@ void arch_touch_nmi_watchdog(void) |
579 |
+ } |
580 |
+ EXPORT_SYMBOL(arch_touch_nmi_watchdog); |
581 |
+ |
582 |
+-static void start_watchdog_timer_on(unsigned int cpu) |
583 |
+-{ |
584 |
+- struct timer_list *t = per_cpu_ptr(&wd_timer, cpu); |
585 |
+- |
586 |
+- per_cpu(wd_timer_tb, cpu) = get_tb(); |
587 |
+- |
588 |
+- timer_setup(t, wd_timer_fn, TIMER_PINNED); |
589 |
+- wd_timer_reset(cpu, t); |
590 |
+-} |
591 |
+- |
592 |
+-static void stop_watchdog_timer_on(unsigned int cpu) |
593 |
+-{ |
594 |
+- struct timer_list *t = per_cpu_ptr(&wd_timer, cpu); |
595 |
+- |
596 |
+- del_timer_sync(t); |
597 |
+-} |
598 |
+- |
599 |
+-static int start_wd_on_cpu(unsigned int cpu) |
600 |
++static void start_watchdog(void *arg) |
601 |
+ { |
602 |
++ struct hrtimer *hrtimer = this_cpu_ptr(&wd_hrtimer); |
603 |
++ int cpu = smp_processor_id(); |
604 |
+ unsigned long flags; |
605 |
+ |
606 |
+ if (cpumask_test_cpu(cpu, &wd_cpus_enabled)) { |
607 |
+ WARN_ON(1); |
608 |
+- return 0; |
609 |
++ return; |
610 |
+ } |
611 |
+ |
612 |
+ if (!(watchdog_enabled & NMI_WATCHDOG_ENABLED)) |
613 |
+- return 0; |
614 |
++ return; |
615 |
+ |
616 |
+ if (!cpumask_test_cpu(cpu, &watchdog_cpumask)) |
617 |
+- return 0; |
618 |
++ return; |
619 |
+ |
620 |
+ wd_smp_lock(&flags); |
621 |
+ cpumask_set_cpu(cpu, &wd_cpus_enabled); |
622 |
+@@ -363,27 +348,40 @@ static int start_wd_on_cpu(unsigned int cpu) |
623 |
+ } |
624 |
+ wd_smp_unlock(&flags); |
625 |
+ |
626 |
+- start_watchdog_timer_on(cpu); |
627 |
++ *this_cpu_ptr(&wd_timer_tb) = get_tb(); |
628 |
+ |
629 |
+- return 0; |
630 |
++ hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
631 |
++ hrtimer->function = watchdog_timer_fn; |
632 |
++ hrtimer_start(hrtimer, ms_to_ktime(wd_timer_period_ms), |
633 |
++ HRTIMER_MODE_REL_PINNED); |
634 |
+ } |
635 |
+ |
636 |
+-static int stop_wd_on_cpu(unsigned int cpu) |
637 |
++static int start_watchdog_on_cpu(unsigned int cpu) |
638 |
+ { |
639 |
++ return smp_call_function_single(cpu, start_watchdog, NULL, true); |
640 |
++} |
641 |
++ |
642 |
++static void stop_watchdog(void *arg) |
643 |
++{ |
644 |
++ struct hrtimer *hrtimer = this_cpu_ptr(&wd_hrtimer); |
645 |
++ int cpu = smp_processor_id(); |
646 |
+ unsigned long flags; |
647 |
+ |
648 |
+ if (!cpumask_test_cpu(cpu, &wd_cpus_enabled)) |
649 |
+- return 0; /* Can happen in CPU unplug case */ |
650 |
++ return; /* Can happen in CPU unplug case */ |
651 |
+ |
652 |
+- stop_watchdog_timer_on(cpu); |
653 |
++ hrtimer_cancel(hrtimer); |
654 |
+ |
655 |
+ wd_smp_lock(&flags); |
656 |
+ cpumask_clear_cpu(cpu, &wd_cpus_enabled); |
657 |
+ wd_smp_unlock(&flags); |
658 |
+ |
659 |
+ wd_smp_clear_cpu_pending(cpu, get_tb()); |
660 |
++} |
661 |
+ |
662 |
+- return 0; |
663 |
++static int stop_watchdog_on_cpu(unsigned int cpu) |
664 |
++{ |
665 |
++ return smp_call_function_single(cpu, stop_watchdog, NULL, true); |
666 |
+ } |
667 |
+ |
668 |
+ static void watchdog_calc_timeouts(void) |
669 |
+@@ -402,7 +400,7 @@ void watchdog_nmi_stop(void) |
670 |
+ int cpu; |
671 |
+ |
672 |
+ for_each_cpu(cpu, &wd_cpus_enabled) |
673 |
+- stop_wd_on_cpu(cpu); |
674 |
++ stop_watchdog_on_cpu(cpu); |
675 |
+ } |
676 |
+ |
677 |
+ void watchdog_nmi_start(void) |
678 |
+@@ -411,7 +409,7 @@ void watchdog_nmi_start(void) |
679 |
+ |
680 |
+ watchdog_calc_timeouts(); |
681 |
+ for_each_cpu_and(cpu, cpu_online_mask, &watchdog_cpumask) |
682 |
+- start_wd_on_cpu(cpu); |
683 |
++ start_watchdog_on_cpu(cpu); |
684 |
+ } |
685 |
+ |
686 |
+ /* |
687 |
+@@ -423,7 +421,8 @@ int __init watchdog_nmi_probe(void) |
688 |
+ |
689 |
+ err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, |
690 |
+ "powerpc/watchdog:online", |
691 |
+- start_wd_on_cpu, stop_wd_on_cpu); |
692 |
++ start_watchdog_on_cpu, |
693 |
++ stop_watchdog_on_cpu); |
694 |
+ if (err < 0) { |
695 |
+ pr_warn("could not be initialized"); |
696 |
+ return err; |
697 |
+diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c |
698 |
+index 10fb43efef50..f473c05e9649 100644 |
699 |
+--- a/arch/powerpc/mm/numa.c |
700 |
++++ b/arch/powerpc/mm/numa.c |
701 |
+@@ -1495,6 +1495,9 @@ int start_topology_update(void) |
702 |
+ { |
703 |
+ int rc = 0; |
704 |
+ |
705 |
++ if (!topology_updates_enabled) |
706 |
++ return 0; |
707 |
++ |
708 |
+ if (firmware_has_feature(FW_FEATURE_PRRN)) { |
709 |
+ if (!prrn_enabled) { |
710 |
+ prrn_enabled = 1; |
711 |
+@@ -1524,6 +1527,9 @@ int stop_topology_update(void) |
712 |
+ { |
713 |
+ int rc = 0; |
714 |
+ |
715 |
++ if (!topology_updates_enabled) |
716 |
++ return 0; |
717 |
++ |
718 |
+ if (prrn_enabled) { |
719 |
+ prrn_enabled = 0; |
720 |
+ #ifdef CONFIG_SMP |
721 |
+@@ -1579,11 +1585,13 @@ static ssize_t topology_write(struct file *file, const char __user *buf, |
722 |
+ |
723 |
+ kbuf[read_len] = '\0'; |
724 |
+ |
725 |
+- if (!strncmp(kbuf, "on", 2)) |
726 |
++ if (!strncmp(kbuf, "on", 2)) { |
727 |
++ topology_updates_enabled = true; |
728 |
+ start_topology_update(); |
729 |
+- else if (!strncmp(kbuf, "off", 3)) |
730 |
++ } else if (!strncmp(kbuf, "off", 3)) { |
731 |
+ stop_topology_update(); |
732 |
+- else |
733 |
++ topology_updates_enabled = false; |
734 |
++ } else |
735 |
+ return -EINVAL; |
736 |
+ |
737 |
+ return count; |
738 |
+@@ -1598,9 +1606,7 @@ static const struct file_operations topology_ops = { |
739 |
+ |
740 |
+ static int topology_update_init(void) |
741 |
+ { |
742 |
+- /* Do not poll for changes if disabled at boot */ |
743 |
+- if (topology_updates_enabled) |
744 |
+- start_topology_update(); |
745 |
++ start_topology_update(); |
746 |
+ |
747 |
+ if (vphn_enabled) |
748 |
+ topology_schedule_update(); |
749 |
+diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c |
750 |
+index 1fafc32b12a0..555322677074 100644 |
751 |
+--- a/arch/powerpc/perf/imc-pmu.c |
752 |
++++ b/arch/powerpc/perf/imc-pmu.c |
753 |
+@@ -496,6 +496,11 @@ static int nest_imc_event_init(struct perf_event *event) |
754 |
+ * Get the base memory addresss for this cpu. |
755 |
+ */ |
756 |
+ chip_id = cpu_to_chip_id(event->cpu); |
757 |
++ |
758 |
++ /* Return, if chip_id is not valid */ |
759 |
++ if (chip_id < 0) |
760 |
++ return -ENODEV; |
761 |
++ |
762 |
+ pcni = pmu->mem_info; |
763 |
+ do { |
764 |
+ if (pcni->id == chip_id) { |
765 |
+@@ -503,7 +508,7 @@ static int nest_imc_event_init(struct perf_event *event) |
766 |
+ break; |
767 |
+ } |
768 |
+ pcni++; |
769 |
+- } while (pcni); |
770 |
++ } while (pcni->vbase != 0); |
771 |
+ |
772 |
+ if (!flag) |
773 |
+ return -ENODEV; |
774 |
+diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c |
775 |
+index 58a07948c76e..3d27f02695e4 100644 |
776 |
+--- a/arch/powerpc/platforms/powernv/opal-imc.c |
777 |
++++ b/arch/powerpc/platforms/powernv/opal-imc.c |
778 |
+@@ -127,7 +127,7 @@ static int imc_get_mem_addr_nest(struct device_node *node, |
779 |
+ nr_chips)) |
780 |
+ goto error; |
781 |
+ |
782 |
+- pmu_ptr->mem_info = kcalloc(nr_chips, sizeof(*pmu_ptr->mem_info), |
783 |
++ pmu_ptr->mem_info = kcalloc(nr_chips + 1, sizeof(*pmu_ptr->mem_info), |
784 |
+ GFP_KERNEL); |
785 |
+ if (!pmu_ptr->mem_info) |
786 |
+ goto error; |
787 |
+diff --git a/arch/s390/kernel/kexec_elf.c b/arch/s390/kernel/kexec_elf.c |
788 |
+index 5a286b012043..602e7cc26d11 100644 |
789 |
+--- a/arch/s390/kernel/kexec_elf.c |
790 |
++++ b/arch/s390/kernel/kexec_elf.c |
791 |
+@@ -19,10 +19,15 @@ static int kexec_file_add_elf_kernel(struct kimage *image, |
792 |
+ struct kexec_buf buf; |
793 |
+ const Elf_Ehdr *ehdr; |
794 |
+ const Elf_Phdr *phdr; |
795 |
++ Elf_Addr entry; |
796 |
+ int i, ret; |
797 |
+ |
798 |
+ ehdr = (Elf_Ehdr *)kernel; |
799 |
+ buf.image = image; |
800 |
++ if (image->type == KEXEC_TYPE_CRASH) |
801 |
++ entry = STARTUP_KDUMP_OFFSET; |
802 |
++ else |
803 |
++ entry = ehdr->e_entry; |
804 |
+ |
805 |
+ phdr = (void *)ehdr + ehdr->e_phoff; |
806 |
+ for (i = 0; i < ehdr->e_phnum; i++, phdr++) { |
807 |
+@@ -35,7 +40,7 @@ static int kexec_file_add_elf_kernel(struct kimage *image, |
808 |
+ buf.mem = ALIGN(phdr->p_paddr, phdr->p_align); |
809 |
+ buf.memsz = phdr->p_memsz; |
810 |
+ |
811 |
+- if (phdr->p_paddr == 0) { |
812 |
++ if (entry - phdr->p_paddr < phdr->p_memsz) { |
813 |
+ data->kernel_buf = buf.buffer; |
814 |
+ data->memsz += STARTUP_NORMAL_OFFSET; |
815 |
+ |
816 |
+diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c |
817 |
+index f2cc7da473e4..ae894ac83fd6 100644 |
818 |
+--- a/arch/s390/mm/pgtable.c |
819 |
++++ b/arch/s390/mm/pgtable.c |
820 |
+@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm, |
821 |
+ return old; |
822 |
+ } |
823 |
+ |
824 |
++#ifdef CONFIG_PGSTE |
825 |
+ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) |
826 |
+ { |
827 |
+ pgd_t *pgd; |
828 |
+@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) |
829 |
+ pmd = pmd_alloc(mm, pud, addr); |
830 |
+ return pmd; |
831 |
+ } |
832 |
++#endif |
833 |
+ |
834 |
+ pmd_t pmdp_xchg_direct(struct mm_struct *mm, unsigned long addr, |
835 |
+ pmd_t *pmdp, pmd_t new) |
836 |
+diff --git a/arch/sh/include/cpu-sh4/cpu/sh7786.h b/arch/sh/include/cpu-sh4/cpu/sh7786.h |
837 |
+index 96b8cb1f754a..029bbadaf7ab 100644 |
838 |
+--- a/arch/sh/include/cpu-sh4/cpu/sh7786.h |
839 |
++++ b/arch/sh/include/cpu-sh4/cpu/sh7786.h |
840 |
+@@ -135,7 +135,7 @@ enum { |
841 |
+ |
842 |
+ static inline u32 sh7786_mm_sel(void) |
843 |
+ { |
844 |
+- return __raw_readl(0xFC400020) & 0x7; |
845 |
++ return __raw_readl((const volatile void __iomem *)0xFC400020) & 0x7; |
846 |
+ } |
847 |
+ |
848 |
+ #endif /* __CPU_SH7786_H__ */ |
849 |
+diff --git a/arch/x86/Makefile b/arch/x86/Makefile |
850 |
+index ffc823a8312f..ab2071e40efe 100644 |
851 |
+--- a/arch/x86/Makefile |
852 |
++++ b/arch/x86/Makefile |
853 |
+@@ -47,7 +47,7 @@ export REALMODE_CFLAGS |
854 |
+ export BITS |
855 |
+ |
856 |
+ ifdef CONFIG_X86_NEED_RELOCS |
857 |
+- LDFLAGS_vmlinux := --emit-relocs |
858 |
++ LDFLAGS_vmlinux := --emit-relocs --discard-none |
859 |
+ endif |
860 |
+ |
861 |
+ # |
862 |
+diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c |
863 |
+index 56194c571299..4a650eb3d94a 100644 |
864 |
+--- a/arch/x86/events/intel/cstate.c |
865 |
++++ b/arch/x86/events/intel/cstate.c |
866 |
+@@ -584,6 +584,8 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = { |
867 |
+ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_X, glm_cstates), |
868 |
+ |
869 |
+ X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates), |
870 |
++ |
871 |
++ X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_MOBILE, snb_cstates), |
872 |
+ { }, |
873 |
+ }; |
874 |
+ MODULE_DEVICE_TABLE(x86cpu, intel_cstates_match); |
875 |
+diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/intel/rapl.c |
876 |
+index 91039ffed633..2413169ce362 100644 |
877 |
+--- a/arch/x86/events/intel/rapl.c |
878 |
++++ b/arch/x86/events/intel/rapl.c |
879 |
+@@ -780,6 +780,8 @@ static const struct x86_cpu_id rapl_cpu_match[] __initconst = { |
880 |
+ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT_X, hsw_rapl_init), |
881 |
+ |
882 |
+ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ATOM_GOLDMONT_PLUS, hsw_rapl_init), |
883 |
++ |
884 |
++ X86_RAPL_MODEL_MATCH(INTEL_FAM6_ICELAKE_MOBILE, skl_rapl_init), |
885 |
+ {}, |
886 |
+ }; |
887 |
+ |
888 |
+diff --git a/arch/x86/events/msr.c b/arch/x86/events/msr.c |
889 |
+index 1b9f85abf9bc..ace6c1e752fb 100644 |
890 |
+--- a/arch/x86/events/msr.c |
891 |
++++ b/arch/x86/events/msr.c |
892 |
+@@ -89,6 +89,7 @@ static bool test_intel(int idx) |
893 |
+ case INTEL_FAM6_SKYLAKE_X: |
894 |
+ case INTEL_FAM6_KABYLAKE_MOBILE: |
895 |
+ case INTEL_FAM6_KABYLAKE_DESKTOP: |
896 |
++ case INTEL_FAM6_ICELAKE_MOBILE: |
897 |
+ if (idx == PERF_MSR_SMI || idx == PERF_MSR_PPERF) |
898 |
+ return true; |
899 |
+ break; |
900 |
+diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c |
901 |
+index 86b1341cba9a..513ba49c204f 100644 |
902 |
+--- a/arch/x86/ia32/ia32_signal.c |
903 |
++++ b/arch/x86/ia32/ia32_signal.c |
904 |
+@@ -61,9 +61,8 @@ |
905 |
+ } while (0) |
906 |
+ |
907 |
+ #define RELOAD_SEG(seg) { \ |
908 |
+- unsigned int pre = GET_SEG(seg); \ |
909 |
++ unsigned int pre = (seg) | 3; \ |
910 |
+ unsigned int cur = get_user_seg(seg); \ |
911 |
+- pre |= 3; \ |
912 |
+ if (pre != cur) \ |
913 |
+ set_user_seg(seg, pre); \ |
914 |
+ } |
915 |
+@@ -72,6 +71,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
916 |
+ struct sigcontext_32 __user *sc) |
917 |
+ { |
918 |
+ unsigned int tmpflags, err = 0; |
919 |
++ u16 gs, fs, es, ds; |
920 |
+ void __user *buf; |
921 |
+ u32 tmp; |
922 |
+ |
923 |
+@@ -79,16 +79,10 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
924 |
+ current->restart_block.fn = do_no_restart_syscall; |
925 |
+ |
926 |
+ get_user_try { |
927 |
+- /* |
928 |
+- * Reload fs and gs if they have changed in the signal |
929 |
+- * handler. This does not handle long fs/gs base changes in |
930 |
+- * the handler, but does not clobber them at least in the |
931 |
+- * normal case. |
932 |
+- */ |
933 |
+- RELOAD_SEG(gs); |
934 |
+- RELOAD_SEG(fs); |
935 |
+- RELOAD_SEG(ds); |
936 |
+- RELOAD_SEG(es); |
937 |
++ gs = GET_SEG(gs); |
938 |
++ fs = GET_SEG(fs); |
939 |
++ ds = GET_SEG(ds); |
940 |
++ es = GET_SEG(es); |
941 |
+ |
942 |
+ COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx); |
943 |
+ COPY(dx); COPY(cx); COPY(ip); COPY(ax); |
944 |
+@@ -106,6 +100,17 @@ static int ia32_restore_sigcontext(struct pt_regs *regs, |
945 |
+ buf = compat_ptr(tmp); |
946 |
+ } get_user_catch(err); |
947 |
+ |
948 |
++ /* |
949 |
++ * Reload fs and gs if they have changed in the signal |
950 |
++ * handler. This does not handle long fs/gs base changes in |
951 |
++ * the handler, but does not clobber them at least in the |
952 |
++ * normal case. |
953 |
++ */ |
954 |
++ RELOAD_SEG(gs); |
955 |
++ RELOAD_SEG(fs); |
956 |
++ RELOAD_SEG(ds); |
957 |
++ RELOAD_SEG(es); |
958 |
++ |
959 |
+ err |= fpu__restore_sig(buf, 1); |
960 |
+ |
961 |
+ force_iret(); |
962 |
+diff --git a/arch/x86/include/asm/text-patching.h b/arch/x86/include/asm/text-patching.h |
963 |
+index 05861cc08787..0bbb07eaed6b 100644 |
964 |
+--- a/arch/x86/include/asm/text-patching.h |
965 |
++++ b/arch/x86/include/asm/text-patching.h |
966 |
+@@ -39,6 +39,7 @@ extern int poke_int3_handler(struct pt_regs *regs); |
967 |
+ extern void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler); |
968 |
+ extern int after_bootmem; |
969 |
+ |
970 |
++#ifndef CONFIG_UML_X86 |
971 |
+ static inline void int3_emulate_jmp(struct pt_regs *regs, unsigned long ip) |
972 |
+ { |
973 |
+ regs->ip = ip; |
974 |
+@@ -65,6 +66,7 @@ static inline void int3_emulate_call(struct pt_regs *regs, unsigned long func) |
975 |
+ int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE); |
976 |
+ int3_emulate_jmp(regs, func); |
977 |
+ } |
978 |
+-#endif |
979 |
++#endif /* CONFIG_X86_64 */ |
980 |
++#endif /* !CONFIG_UML_X86 */ |
981 |
+ |
982 |
+ #endif /* _ASM_X86_TEXT_PATCHING_H */ |
983 |
+diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c |
984 |
+index b9d5e7c9ef43..918a23704c0c 100644 |
985 |
+--- a/arch/x86/kernel/alternative.c |
986 |
++++ b/arch/x86/kernel/alternative.c |
987 |
+@@ -662,15 +662,29 @@ void __init alternative_instructions(void) |
988 |
+ * handlers seeing an inconsistent instruction while you patch. |
989 |
+ */ |
990 |
+ void *__init_or_module text_poke_early(void *addr, const void *opcode, |
991 |
+- size_t len) |
992 |
++ size_t len) |
993 |
+ { |
994 |
+ unsigned long flags; |
995 |
+- local_irq_save(flags); |
996 |
+- memcpy(addr, opcode, len); |
997 |
+- local_irq_restore(flags); |
998 |
+- sync_core(); |
999 |
+- /* Could also do a CLFLUSH here to speed up CPU recovery; but |
1000 |
+- that causes hangs on some VIA CPUs. */ |
1001 |
++ |
1002 |
++ if (boot_cpu_has(X86_FEATURE_NX) && |
1003 |
++ is_module_text_address((unsigned long)addr)) { |
1004 |
++ /* |
1005 |
++ * Modules text is marked initially as non-executable, so the |
1006 |
++ * code cannot be running and speculative code-fetches are |
1007 |
++ * prevented. Just change the code. |
1008 |
++ */ |
1009 |
++ memcpy(addr, opcode, len); |
1010 |
++ } else { |
1011 |
++ local_irq_save(flags); |
1012 |
++ memcpy(addr, opcode, len); |
1013 |
++ local_irq_restore(flags); |
1014 |
++ sync_core(); |
1015 |
++ |
1016 |
++ /* |
1017 |
++ * Could also do a CLFLUSH here to speed up CPU recovery; but |
1018 |
++ * that causes hangs on some VIA CPUs. |
1019 |
++ */ |
1020 |
++ } |
1021 |
+ return addr; |
1022 |
+ } |
1023 |
+ |
1024 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
1025 |
+index c805a06e14c3..ff1c00b695ae 100644 |
1026 |
+--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c |
1027 |
++++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c |
1028 |
+@@ -46,8 +46,6 @@ |
1029 |
+ static struct mce i_mce; |
1030 |
+ static struct dentry *dfs_inj; |
1031 |
+ |
1032 |
+-static u8 n_banks; |
1033 |
+- |
1034 |
+ #define MAX_FLAG_OPT_SIZE 4 |
1035 |
+ #define NBCFG 0x44 |
1036 |
+ |
1037 |
+@@ -567,9 +565,15 @@ err: |
1038 |
+ static int inj_bank_set(void *data, u64 val) |
1039 |
+ { |
1040 |
+ struct mce *m = (struct mce *)data; |
1041 |
++ u8 n_banks; |
1042 |
++ u64 cap; |
1043 |
++ |
1044 |
++ /* Get bank count on target CPU so we can handle non-uniform values. */ |
1045 |
++ rdmsrl_on_cpu(m->extcpu, MSR_IA32_MCG_CAP, &cap); |
1046 |
++ n_banks = cap & MCG_BANKCNT_MASK; |
1047 |
+ |
1048 |
+ if (val >= n_banks) { |
1049 |
+- pr_err("Non-existent MCE bank: %llu\n", val); |
1050 |
++ pr_err("MCA bank %llu non-existent on CPU%d\n", val, m->extcpu); |
1051 |
+ return -EINVAL; |
1052 |
+ } |
1053 |
+ |
1054 |
+@@ -659,10 +663,6 @@ static struct dfs_node { |
1055 |
+ static int __init debugfs_init(void) |
1056 |
+ { |
1057 |
+ unsigned int i; |
1058 |
+- u64 cap; |
1059 |
+- |
1060 |
+- rdmsrl(MSR_IA32_MCG_CAP, cap); |
1061 |
+- n_banks = cap & MCG_BANKCNT_MASK; |
1062 |
+ |
1063 |
+ dfs_inj = debugfs_create_dir("mce-inject", NULL); |
1064 |
+ if (!dfs_inj) |
1065 |
+diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c |
1066 |
+index f9e7096b1804..fee118b3b69f 100644 |
1067 |
+--- a/arch/x86/kernel/cpu/mcheck/mce.c |
1068 |
++++ b/arch/x86/kernel/cpu/mcheck/mce.c |
1069 |
+@@ -711,19 +711,49 @@ bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b) |
1070 |
+ |
1071 |
+ barrier(); |
1072 |
+ m.status = mce_rdmsrl(msr_ops.status(i)); |
1073 |
++ |
1074 |
++ /* If this entry is not valid, ignore it */ |
1075 |
+ if (!(m.status & MCI_STATUS_VAL)) |
1076 |
+ continue; |
1077 |
+ |
1078 |
+ /* |
1079 |
+- * Uncorrected or signalled events are handled by the exception |
1080 |
+- * handler when it is enabled, so don't process those here. |
1081 |
+- * |
1082 |
+- * TBD do the same check for MCI_STATUS_EN here? |
1083 |
++ * If we are logging everything (at CPU online) or this |
1084 |
++ * is a corrected error, then we must log it. |
1085 |
+ */ |
1086 |
+- if (!(flags & MCP_UC) && |
1087 |
+- (m.status & (mca_cfg.ser ? MCI_STATUS_S : MCI_STATUS_UC))) |
1088 |
+- continue; |
1089 |
++ if ((flags & MCP_UC) || !(m.status & MCI_STATUS_UC)) |
1090 |
++ goto log_it; |
1091 |
++ |
1092 |
++ /* |
1093 |
++ * Newer Intel systems that support software error |
1094 |
++ * recovery need to make additional checks. Other |
1095 |
++ * CPUs should skip over uncorrected errors, but log |
1096 |
++ * everything else. |
1097 |
++ */ |
1098 |
++ if (!mca_cfg.ser) { |
1099 |
++ if (m.status & MCI_STATUS_UC) |
1100 |
++ continue; |
1101 |
++ goto log_it; |
1102 |
++ } |
1103 |
++ |
1104 |
++ /* Log "not enabled" (speculative) errors */ |
1105 |
++ if (!(m.status & MCI_STATUS_EN)) |
1106 |
++ goto log_it; |
1107 |
++ |
1108 |
++ /* |
1109 |
++ * Log UCNA (SDM: 15.6.3 "UCR Error Classification") |
1110 |
++ * UC == 1 && PCC == 0 && S == 0 |
1111 |
++ */ |
1112 |
++ if (!(m.status & MCI_STATUS_PCC) && !(m.status & MCI_STATUS_S)) |
1113 |
++ goto log_it; |
1114 |
++ |
1115 |
++ /* |
1116 |
++ * Skip anything else. Presumption is that our read of this |
1117 |
++ * bank is racing with a machine check. Leave the log alone |
1118 |
++ * for do_machine_check() to deal with it. |
1119 |
++ */ |
1120 |
++ continue; |
1121 |
+ |
1122 |
++log_it: |
1123 |
+ error_seen = true; |
1124 |
+ |
1125 |
+ mce_read_aux(&m, i); |
1126 |
+@@ -1450,13 +1480,12 @@ EXPORT_SYMBOL_GPL(mce_notify_irq); |
1127 |
+ static int __mcheck_cpu_mce_banks_init(void) |
1128 |
+ { |
1129 |
+ int i; |
1130 |
+- u8 num_banks = mca_cfg.banks; |
1131 |
+ |
1132 |
+- mce_banks = kcalloc(num_banks, sizeof(struct mce_bank), GFP_KERNEL); |
1133 |
++ mce_banks = kcalloc(MAX_NR_BANKS, sizeof(struct mce_bank), GFP_KERNEL); |
1134 |
+ if (!mce_banks) |
1135 |
+ return -ENOMEM; |
1136 |
+ |
1137 |
+- for (i = 0; i < num_banks; i++) { |
1138 |
++ for (i = 0; i < MAX_NR_BANKS; i++) { |
1139 |
+ struct mce_bank *b = &mce_banks[i]; |
1140 |
+ |
1141 |
+ b->ctl = -1ULL; |
1142 |
+@@ -1470,28 +1499,19 @@ static int __mcheck_cpu_mce_banks_init(void) |
1143 |
+ */ |
1144 |
+ static int __mcheck_cpu_cap_init(void) |
1145 |
+ { |
1146 |
+- unsigned b; |
1147 |
+ u64 cap; |
1148 |
++ u8 b; |
1149 |
+ |
1150 |
+ rdmsrl(MSR_IA32_MCG_CAP, cap); |
1151 |
+ |
1152 |
+ b = cap & MCG_BANKCNT_MASK; |
1153 |
+- if (!mca_cfg.banks) |
1154 |
+- pr_info("CPU supports %d MCE banks\n", b); |
1155 |
+- |
1156 |
+- if (b > MAX_NR_BANKS) { |
1157 |
+- pr_warn("Using only %u machine check banks out of %u\n", |
1158 |
+- MAX_NR_BANKS, b); |
1159 |
++ if (WARN_ON_ONCE(b > MAX_NR_BANKS)) |
1160 |
+ b = MAX_NR_BANKS; |
1161 |
+- } |
1162 |
+ |
1163 |
+- /* Don't support asymmetric configurations today */ |
1164 |
+- WARN_ON(mca_cfg.banks != 0 && b != mca_cfg.banks); |
1165 |
+- mca_cfg.banks = b; |
1166 |
++ mca_cfg.banks = max(mca_cfg.banks, b); |
1167 |
+ |
1168 |
+ if (!mce_banks) { |
1169 |
+ int err = __mcheck_cpu_mce_banks_init(); |
1170 |
+- |
1171 |
+ if (err) |
1172 |
+ return err; |
1173 |
+ } |
1174 |
+@@ -2473,6 +2493,8 @@ EXPORT_SYMBOL_GPL(mcsafe_key); |
1175 |
+ |
1176 |
+ static int __init mcheck_late_init(void) |
1177 |
+ { |
1178 |
++ pr_info("Using %d MCE banks\n", mca_cfg.banks); |
1179 |
++ |
1180 |
+ if (mca_cfg.recovery) |
1181 |
+ static_branch_inc(&mcsafe_key); |
1182 |
+ |
1183 |
+diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
1184 |
+index b9bc8a1a584e..b43ddefd77f4 100644 |
1185 |
+--- a/arch/x86/kernel/cpu/microcode/core.c |
1186 |
++++ b/arch/x86/kernel/cpu/microcode/core.c |
1187 |
+@@ -418,8 +418,9 @@ static int do_microcode_update(const void __user *buf, size_t size) |
1188 |
+ if (ustate == UCODE_ERROR) { |
1189 |
+ error = -1; |
1190 |
+ break; |
1191 |
+- } else if (ustate == UCODE_OK) |
1192 |
++ } else if (ustate == UCODE_NEW) { |
1193 |
+ apply_microcode_on_target(cpu); |
1194 |
++ } |
1195 |
+ } |
1196 |
+ |
1197 |
+ return error; |
1198 |
+diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c |
1199 |
+index 0469cd078db1..b50ac9c7397b 100644 |
1200 |
+--- a/arch/x86/kernel/irq_64.c |
1201 |
++++ b/arch/x86/kernel/irq_64.c |
1202 |
+@@ -26,9 +26,18 @@ int sysctl_panic_on_stackoverflow; |
1203 |
+ /* |
1204 |
+ * Probabilistic stack overflow check: |
1205 |
+ * |
1206 |
+- * Only check the stack in process context, because everything else |
1207 |
+- * runs on the big interrupt stacks. Checking reliably is too expensive, |
1208 |
+- * so we just check from interrupts. |
1209 |
++ * Regular device interrupts can enter on the following stacks: |
1210 |
++ * |
1211 |
++ * - User stack |
1212 |
++ * |
1213 |
++ * - Kernel task stack |
1214 |
++ * |
1215 |
++ * - Interrupt stack if a device driver reenables interrupts |
1216 |
++ * which should only happen in really old drivers. |
1217 |
++ * |
1218 |
++ * - Debug IST stack |
1219 |
++ * |
1220 |
++ * All other contexts are invalid. |
1221 |
+ */ |
1222 |
+ static inline void stack_overflow_check(struct pt_regs *regs) |
1223 |
+ { |
1224 |
+@@ -53,8 +62,8 @@ static inline void stack_overflow_check(struct pt_regs *regs) |
1225 |
+ return; |
1226 |
+ |
1227 |
+ oist = this_cpu_ptr(&orig_ist); |
1228 |
+- estack_top = (u64)oist->ist[0] - EXCEPTION_STKSZ + STACK_TOP_MARGIN; |
1229 |
+- estack_bottom = (u64)oist->ist[N_EXCEPTION_STACKS - 1]; |
1230 |
++ estack_bottom = (u64)oist->ist[DEBUG_STACK]; |
1231 |
++ estack_top = estack_bottom - DEBUG_STKSZ + STACK_TOP_MARGIN; |
1232 |
+ if (regs->sp >= estack_top && regs->sp <= estack_bottom) |
1233 |
+ return; |
1234 |
+ |
1235 |
+diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c |
1236 |
+index f58336af095c..6645f123419c 100644 |
1237 |
+--- a/arch/x86/kernel/module.c |
1238 |
++++ b/arch/x86/kernel/module.c |
1239 |
+@@ -87,7 +87,7 @@ void *module_alloc(unsigned long size) |
1240 |
+ p = __vmalloc_node_range(size, MODULE_ALIGN, |
1241 |
+ MODULES_VADDR + get_module_load_offset(), |
1242 |
+ MODULES_END, GFP_KERNEL, |
1243 |
+- PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE, |
1244 |
++ PAGE_KERNEL, 0, NUMA_NO_NODE, |
1245 |
+ __builtin_return_address(0)); |
1246 |
+ if (p && (kasan_module_alloc(p, size) < 0)) { |
1247 |
+ vfree(p); |
1248 |
+diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c |
1249 |
+index 92a3b312a53c..44e647a65de8 100644 |
1250 |
+--- a/arch/x86/kernel/signal.c |
1251 |
++++ b/arch/x86/kernel/signal.c |
1252 |
+@@ -132,16 +132,6 @@ static int restore_sigcontext(struct pt_regs *regs, |
1253 |
+ COPY_SEG_CPL3(cs); |
1254 |
+ COPY_SEG_CPL3(ss); |
1255 |
+ |
1256 |
+-#ifdef CONFIG_X86_64 |
1257 |
+- /* |
1258 |
+- * Fix up SS if needed for the benefit of old DOSEMU and |
1259 |
+- * CRIU. |
1260 |
+- */ |
1261 |
+- if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && |
1262 |
+- user_64bit_mode(regs))) |
1263 |
+- force_valid_ss(regs); |
1264 |
+-#endif |
1265 |
+- |
1266 |
+ get_user_ex(tmpflags, &sc->flags); |
1267 |
+ regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); |
1268 |
+ regs->orig_ax = -1; /* disable syscall checks */ |
1269 |
+@@ -150,6 +140,15 @@ static int restore_sigcontext(struct pt_regs *regs, |
1270 |
+ buf = (void __user *)buf_val; |
1271 |
+ } get_user_catch(err); |
1272 |
+ |
1273 |
++#ifdef CONFIG_X86_64 |
1274 |
++ /* |
1275 |
++ * Fix up SS if needed for the benefit of old DOSEMU and |
1276 |
++ * CRIU. |
1277 |
++ */ |
1278 |
++ if (unlikely(!(uc_flags & UC_STRICT_RESTORE_SS) && user_64bit_mode(regs))) |
1279 |
++ force_valid_ss(regs); |
1280 |
++#endif |
1281 |
++ |
1282 |
+ err |= fpu__restore_sig(buf, IS_ENABLED(CONFIG_X86_32)); |
1283 |
+ |
1284 |
+ force_iret(); |
1285 |
+@@ -461,6 +460,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
1286 |
+ { |
1287 |
+ struct rt_sigframe __user *frame; |
1288 |
+ void __user *fp = NULL; |
1289 |
++ unsigned long uc_flags; |
1290 |
+ int err = 0; |
1291 |
+ |
1292 |
+ frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp); |
1293 |
+@@ -473,9 +473,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, |
1294 |
+ return -EFAULT; |
1295 |
+ } |
1296 |
+ |
1297 |
++ uc_flags = frame_uc_flags(regs); |
1298 |
++ |
1299 |
+ put_user_try { |
1300 |
+ /* Create the ucontext. */ |
1301 |
+- put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
1302 |
++ put_user_ex(uc_flags, &frame->uc.uc_flags); |
1303 |
+ put_user_ex(0, &frame->uc.uc_link); |
1304 |
+ save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
1305 |
+ |
1306 |
+@@ -541,6 +543,7 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
1307 |
+ { |
1308 |
+ #ifdef CONFIG_X86_X32_ABI |
1309 |
+ struct rt_sigframe_x32 __user *frame; |
1310 |
++ unsigned long uc_flags; |
1311 |
+ void __user *restorer; |
1312 |
+ int err = 0; |
1313 |
+ void __user *fpstate = NULL; |
1314 |
+@@ -555,9 +558,11 @@ static int x32_setup_rt_frame(struct ksignal *ksig, |
1315 |
+ return -EFAULT; |
1316 |
+ } |
1317 |
+ |
1318 |
++ uc_flags = frame_uc_flags(regs); |
1319 |
++ |
1320 |
+ put_user_try { |
1321 |
+ /* Create the ucontext. */ |
1322 |
+- put_user_ex(frame_uc_flags(regs), &frame->uc.uc_flags); |
1323 |
++ put_user_ex(uc_flags, &frame->uc.uc_flags); |
1324 |
+ put_user_ex(0, &frame->uc.uc_link); |
1325 |
+ compat_save_altstack_ex(&frame->uc.uc_stack, regs->sp); |
1326 |
+ put_user_ex(0, &frame->uc.uc__pad0); |
1327 |
+diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S |
1328 |
+index 85e6d5620188..2fb152d813c1 100644 |
1329 |
+--- a/arch/x86/kernel/vmlinux.lds.S |
1330 |
++++ b/arch/x86/kernel/vmlinux.lds.S |
1331 |
+@@ -151,11 +151,11 @@ SECTIONS |
1332 |
+ *(.text.__x86.indirect_thunk) |
1333 |
+ __indirect_thunk_end = .; |
1334 |
+ #endif |
1335 |
+- |
1336 |
+- /* End of text section */ |
1337 |
+- _etext = .; |
1338 |
+ } :text = 0x9090 |
1339 |
+ |
1340 |
++ /* End of text section */ |
1341 |
++ _etext = .; |
1342 |
++ |
1343 |
+ NOTES :text :note |
1344 |
+ |
1345 |
+ EXCEPTION_TABLE(16) :text = 0x9090 |
1346 |
+diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
1347 |
+index 8dd9208ae4de..ea454d3f7763 100644 |
1348 |
+--- a/arch/x86/kvm/svm.c |
1349 |
++++ b/arch/x86/kvm/svm.c |
1350 |
+@@ -2022,7 +2022,11 @@ static void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu) |
1351 |
+ if (!kvm_vcpu_apicv_active(vcpu)) |
1352 |
+ return; |
1353 |
+ |
1354 |
+- if (WARN_ON(h_physical_id >= AVIC_MAX_PHYSICAL_ID_COUNT)) |
1355 |
++ /* |
1356 |
++ * Since the host physical APIC id is 8 bits, |
1357 |
++ * we can support host APIC ID upto 255. |
1358 |
++ */ |
1359 |
++ if (WARN_ON(h_physical_id > AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK)) |
1360 |
+ return; |
1361 |
+ |
1362 |
+ entry = READ_ONCE(*(svm->avic_physical_id_cache)); |
1363 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
1364 |
+index d0eb37c069b8..be4ba0975a0f 100644 |
1365 |
+--- a/arch/x86/kvm/x86.c |
1366 |
++++ b/arch/x86/kvm/x86.c |
1367 |
+@@ -1188,7 +1188,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
1368 |
+ u64 efer = msr_info->data; |
1369 |
+ |
1370 |
+ if (efer & efer_reserved_bits) |
1371 |
+- return false; |
1372 |
++ return 1; |
1373 |
+ |
1374 |
+ if (!msr_info->host_initiated) { |
1375 |
+ if (!__kvm_valid_efer(vcpu, efer)) |
1376 |
+diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S |
1377 |
+index 3b24dc05251c..9d05572370ed 100644 |
1378 |
+--- a/arch/x86/lib/memcpy_64.S |
1379 |
++++ b/arch/x86/lib/memcpy_64.S |
1380 |
+@@ -257,6 +257,7 @@ ENTRY(__memcpy_mcsafe) |
1381 |
+ /* Copy successful. Return zero */ |
1382 |
+ .L_done_memcpy_trap: |
1383 |
+ xorl %eax, %eax |
1384 |
++.L_done: |
1385 |
+ ret |
1386 |
+ ENDPROC(__memcpy_mcsafe) |
1387 |
+ EXPORT_SYMBOL_GPL(__memcpy_mcsafe) |
1388 |
+@@ -273,7 +274,7 @@ EXPORT_SYMBOL_GPL(__memcpy_mcsafe) |
1389 |
+ addl %edx, %ecx |
1390 |
+ .E_trailing_bytes: |
1391 |
+ mov %ecx, %eax |
1392 |
+- ret |
1393 |
++ jmp .L_done |
1394 |
+ |
1395 |
+ /* |
1396 |
+ * For write fault handling, given the destination is unaligned, |
1397 |
+diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c |
1398 |
+index 47bebfe6efa7..9d9765e4d1ef 100644 |
1399 |
+--- a/arch/x86/mm/fault.c |
1400 |
++++ b/arch/x86/mm/fault.c |
1401 |
+@@ -427,8 +427,6 @@ static noinline int vmalloc_fault(unsigned long address) |
1402 |
+ if (!(address >= VMALLOC_START && address < VMALLOC_END)) |
1403 |
+ return -1; |
1404 |
+ |
1405 |
+- WARN_ON_ONCE(in_nmi()); |
1406 |
+- |
1407 |
+ /* |
1408 |
+ * Copy kernel mappings over when needed. This can also |
1409 |
+ * happen within a race in page table update. In the later |
1410 |
+diff --git a/block/genhd.c b/block/genhd.c |
1411 |
+index be5bab20b2ab..2b2a936cf848 100644 |
1412 |
+--- a/block/genhd.c |
1413 |
++++ b/block/genhd.c |
1414 |
+@@ -518,6 +518,18 @@ void blk_free_devt(dev_t devt) |
1415 |
+ } |
1416 |
+ } |
1417 |
+ |
1418 |
++/** |
1419 |
++ * We invalidate devt by assigning NULL pointer for devt in idr. |
1420 |
++ */ |
1421 |
++void blk_invalidate_devt(dev_t devt) |
1422 |
++{ |
1423 |
++ if (MAJOR(devt) == BLOCK_EXT_MAJOR) { |
1424 |
++ spin_lock_bh(&ext_devt_lock); |
1425 |
++ idr_replace(&ext_devt_idr, NULL, blk_mangle_minor(MINOR(devt))); |
1426 |
++ spin_unlock_bh(&ext_devt_lock); |
1427 |
++ } |
1428 |
++} |
1429 |
++ |
1430 |
+ static char *bdevt_str(dev_t devt, char *buf) |
1431 |
+ { |
1432 |
+ if (MAJOR(devt) <= 0xff && MINOR(devt) <= 0xff) { |
1433 |
+@@ -769,6 +781,13 @@ void del_gendisk(struct gendisk *disk) |
1434 |
+ |
1435 |
+ if (!(disk->flags & GENHD_FL_HIDDEN)) |
1436 |
+ blk_unregister_region(disk_devt(disk), disk->minors); |
1437 |
++ /* |
1438 |
++ * Remove gendisk pointer from idr so that it cannot be looked up |
1439 |
++ * while RCU period before freeing gendisk is running to prevent |
1440 |
++ * use-after-free issues. Note that the device number stays |
1441 |
++ * "in-use" until we really free the gendisk. |
1442 |
++ */ |
1443 |
++ blk_invalidate_devt(disk_devt(disk)); |
1444 |
+ |
1445 |
+ kobject_put(disk->part0.holder_dir); |
1446 |
+ kobject_put(disk->slave_dir); |
1447 |
+diff --git a/block/partition-generic.c b/block/partition-generic.c |
1448 |
+index 5f8db5c5140f..98d60a59b843 100644 |
1449 |
+--- a/block/partition-generic.c |
1450 |
++++ b/block/partition-generic.c |
1451 |
+@@ -289,6 +289,13 @@ void delete_partition(struct gendisk *disk, int partno) |
1452 |
+ kobject_put(part->holder_dir); |
1453 |
+ device_del(part_to_dev(part)); |
1454 |
+ |
1455 |
++ /* |
1456 |
++ * Remove gendisk pointer from idr so that it cannot be looked up |
1457 |
++ * while RCU period before freeing gendisk is running to prevent |
1458 |
++ * use-after-free issues. Note that the device number stays |
1459 |
++ * "in-use" until we really free the gendisk. |
1460 |
++ */ |
1461 |
++ blk_invalidate_devt(part_devt(part)); |
1462 |
+ hd_struct_kill(part); |
1463 |
+ } |
1464 |
+ |
1465 |
+diff --git a/block/sed-opal.c b/block/sed-opal.c |
1466 |
+index e0de4dd448b3..119640897293 100644 |
1467 |
+--- a/block/sed-opal.c |
1468 |
++++ b/block/sed-opal.c |
1469 |
+@@ -2095,13 +2095,16 @@ static int opal_erase_locking_range(struct opal_dev *dev, |
1470 |
+ static int opal_enable_disable_shadow_mbr(struct opal_dev *dev, |
1471 |
+ struct opal_mbr_data *opal_mbr) |
1472 |
+ { |
1473 |
++ u8 enable_disable = opal_mbr->enable_disable == OPAL_MBR_ENABLE ? |
1474 |
++ OPAL_TRUE : OPAL_FALSE; |
1475 |
++ |
1476 |
+ const struct opal_step mbr_steps[] = { |
1477 |
+ { opal_discovery0, }, |
1478 |
+ { start_admin1LSP_opal_session, &opal_mbr->key }, |
1479 |
+- { set_mbr_done, &opal_mbr->enable_disable }, |
1480 |
++ { set_mbr_done, &enable_disable }, |
1481 |
+ { end_opal_session, }, |
1482 |
+ { start_admin1LSP_opal_session, &opal_mbr->key }, |
1483 |
+- { set_mbr_enable_disable, &opal_mbr->enable_disable }, |
1484 |
++ { set_mbr_enable_disable, &enable_disable }, |
1485 |
+ { end_opal_session, }, |
1486 |
+ { NULL, } |
1487 |
+ }; |
1488 |
+@@ -2221,7 +2224,7 @@ static int __opal_lock_unlock(struct opal_dev *dev, |
1489 |
+ |
1490 |
+ static int __opal_set_mbr_done(struct opal_dev *dev, struct opal_key *key) |
1491 |
+ { |
1492 |
+- u8 mbr_done_tf = 1; |
1493 |
++ u8 mbr_done_tf = OPAL_TRUE; |
1494 |
+ const struct opal_step mbrdone_step [] = { |
1495 |
+ { opal_discovery0, }, |
1496 |
+ { start_admin1LSP_opal_session, key }, |
1497 |
+diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c |
1498 |
+index e48eebc27b81..43c2615434b4 100644 |
1499 |
+--- a/drivers/acpi/arm64/iort.c |
1500 |
++++ b/drivers/acpi/arm64/iort.c |
1501 |
+@@ -1231,18 +1231,24 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node) |
1502 |
+ /* |
1503 |
+ * set numa proximity domain for smmuv3 device |
1504 |
+ */ |
1505 |
+-static void __init arm_smmu_v3_set_proximity(struct device *dev, |
1506 |
++static int __init arm_smmu_v3_set_proximity(struct device *dev, |
1507 |
+ struct acpi_iort_node *node) |
1508 |
+ { |
1509 |
+ struct acpi_iort_smmu_v3 *smmu; |
1510 |
+ |
1511 |
+ smmu = (struct acpi_iort_smmu_v3 *)node->node_data; |
1512 |
+ if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) { |
1513 |
+- set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm)); |
1514 |
++ int node = acpi_map_pxm_to_node(smmu->pxm); |
1515 |
++ |
1516 |
++ if (node != NUMA_NO_NODE && !node_online(node)) |
1517 |
++ return -EINVAL; |
1518 |
++ |
1519 |
++ set_dev_node(dev, node); |
1520 |
+ pr_info("SMMU-v3[%llx] Mapped to Proximity domain %d\n", |
1521 |
+ smmu->base_address, |
1522 |
+ smmu->pxm); |
1523 |
+ } |
1524 |
++ return 0; |
1525 |
+ } |
1526 |
+ #else |
1527 |
+ #define arm_smmu_v3_set_proximity NULL |
1528 |
+@@ -1317,7 +1323,7 @@ struct iort_dev_config { |
1529 |
+ int (*dev_count_resources)(struct acpi_iort_node *node); |
1530 |
+ void (*dev_init_resources)(struct resource *res, |
1531 |
+ struct acpi_iort_node *node); |
1532 |
+- void (*dev_set_proximity)(struct device *dev, |
1533 |
++ int (*dev_set_proximity)(struct device *dev, |
1534 |
+ struct acpi_iort_node *node); |
1535 |
+ }; |
1536 |
+ |
1537 |
+@@ -1368,8 +1374,11 @@ static int __init iort_add_platform_device(struct acpi_iort_node *node, |
1538 |
+ if (!pdev) |
1539 |
+ return -ENOMEM; |
1540 |
+ |
1541 |
+- if (ops->dev_set_proximity) |
1542 |
+- ops->dev_set_proximity(&pdev->dev, node); |
1543 |
++ if (ops->dev_set_proximity) { |
1544 |
++ ret = ops->dev_set_proximity(&pdev->dev, node); |
1545 |
++ if (ret) |
1546 |
++ goto dev_put; |
1547 |
++ } |
1548 |
+ |
1549 |
+ count = ops->dev_count_resources(node); |
1550 |
+ |
1551 |
+diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c |
1552 |
+index 693cf05b0cc4..288673cff85e 100644 |
1553 |
+--- a/drivers/acpi/property.c |
1554 |
++++ b/drivers/acpi/property.c |
1555 |
+@@ -975,6 +975,14 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, |
1556 |
+ const struct acpi_data_node *data = to_acpi_data_node(fwnode); |
1557 |
+ struct acpi_data_node *dn; |
1558 |
+ |
1559 |
++ /* |
1560 |
++ * We can have a combination of device and data nodes, e.g. with |
1561 |
++ * hierarchical _DSD properties. Make sure the adev pointer is |
1562 |
++ * restored before going through data nodes, otherwise we will |
1563 |
++ * be looking for data_nodes below the last device found instead |
1564 |
++ * of the common fwnode shared by device_nodes and data_nodes. |
1565 |
++ */ |
1566 |
++ adev = to_acpi_device_node(fwnode); |
1567 |
+ if (adev) |
1568 |
+ head = &adev->data.subnodes; |
1569 |
+ else if (data) |
1570 |
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c |
1571 |
+index a690fd400260..4abd7c6531d9 100644 |
1572 |
+--- a/drivers/base/power/main.c |
1573 |
++++ b/drivers/base/power/main.c |
1574 |
+@@ -1736,6 +1736,10 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async) |
1575 |
+ if (dev->power.syscore) |
1576 |
+ goto Complete; |
1577 |
+ |
1578 |
++ /* Avoid direct_complete to let wakeup_path propagate. */ |
1579 |
++ if (device_may_wakeup(dev) || dev->power.wakeup_path) |
1580 |
++ dev->power.direct_complete = false; |
1581 |
++ |
1582 |
+ if (dev->power.direct_complete) { |
1583 |
+ if (pm_runtime_status_suspended(dev)) { |
1584 |
+ pm_runtime_disable(dev); |
1585 |
+diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c |
1586 |
+index f0d593c3fa72..77004c29da08 100644 |
1587 |
+--- a/drivers/bluetooth/hci_qca.c |
1588 |
++++ b/drivers/bluetooth/hci_qca.c |
1589 |
+@@ -504,6 +504,8 @@ static int qca_open(struct hci_uart *hu) |
1590 |
+ qcadev = serdev_device_get_drvdata(hu->serdev); |
1591 |
+ if (qcadev->btsoc_type != QCA_WCN3990) { |
1592 |
+ gpiod_set_value_cansleep(qcadev->bt_en, 1); |
1593 |
++ /* Controller needs time to bootup. */ |
1594 |
++ msleep(150); |
1595 |
+ } else { |
1596 |
+ hu->init_speed = qcadev->init_speed; |
1597 |
+ hu->oper_speed = qcadev->oper_speed; |
1598 |
+diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c |
1599 |
+index b65ff6962899..e9b6ac61fb7f 100644 |
1600 |
+--- a/drivers/char/hw_random/omap-rng.c |
1601 |
++++ b/drivers/char/hw_random/omap-rng.c |
1602 |
+@@ -443,6 +443,7 @@ static int omap_rng_probe(struct platform_device *pdev) |
1603 |
+ priv->rng.read = omap_rng_do_read; |
1604 |
+ priv->rng.init = omap_rng_init; |
1605 |
+ priv->rng.cleanup = omap_rng_cleanup; |
1606 |
++ priv->rng.quality = 900; |
1607 |
+ |
1608 |
+ priv->rng.priv = (unsigned long)priv; |
1609 |
+ platform_set_drvdata(pdev, priv); |
1610 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
1611 |
+index c75b6cdf0053..0a84b7f468ad 100644 |
1612 |
+--- a/drivers/char/random.c |
1613 |
++++ b/drivers/char/random.c |
1614 |
+@@ -778,6 +778,7 @@ static struct crng_state **crng_node_pool __read_mostly; |
1615 |
+ #endif |
1616 |
+ |
1617 |
+ static void invalidate_batched_entropy(void); |
1618 |
++static void numa_crng_init(void); |
1619 |
+ |
1620 |
+ static bool trust_cpu __ro_after_init = IS_ENABLED(CONFIG_RANDOM_TRUST_CPU); |
1621 |
+ static int __init parse_trust_cpu(char *arg) |
1622 |
+@@ -806,7 +807,9 @@ static void crng_initialize(struct crng_state *crng) |
1623 |
+ } |
1624 |
+ crng->state[i] ^= rv; |
1625 |
+ } |
1626 |
+- if (trust_cpu && arch_init) { |
1627 |
++ if (trust_cpu && arch_init && crng == &primary_crng) { |
1628 |
++ invalidate_batched_entropy(); |
1629 |
++ numa_crng_init(); |
1630 |
+ crng_init = 2; |
1631 |
+ pr_notice("random: crng done (trusting CPU's manufacturer)\n"); |
1632 |
+ } |
1633 |
+@@ -2212,8 +2215,8 @@ struct batched_entropy { |
1634 |
+ u32 entropy_u32[CHACHA20_BLOCK_SIZE / sizeof(u32)]; |
1635 |
+ }; |
1636 |
+ unsigned int position; |
1637 |
++ spinlock_t batch_lock; |
1638 |
+ }; |
1639 |
+-static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_reset_lock); |
1640 |
+ |
1641 |
+ /* |
1642 |
+ * Get a random word for internal kernel use only. The quality of the random |
1643 |
+@@ -2223,12 +2226,14 @@ static rwlock_t batched_entropy_reset_lock = __RW_LOCK_UNLOCKED(batched_entropy_ |
1644 |
+ * wait_for_random_bytes() should be called and return 0 at least once |
1645 |
+ * at any point prior. |
1646 |
+ */ |
1647 |
+-static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64); |
1648 |
++static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u64) = { |
1649 |
++ .batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u64.lock), |
1650 |
++}; |
1651 |
++ |
1652 |
+ u64 get_random_u64(void) |
1653 |
+ { |
1654 |
+ u64 ret; |
1655 |
+- bool use_lock; |
1656 |
+- unsigned long flags = 0; |
1657 |
++ unsigned long flags; |
1658 |
+ struct batched_entropy *batch; |
1659 |
+ static void *previous; |
1660 |
+ |
1661 |
+@@ -2243,28 +2248,25 @@ u64 get_random_u64(void) |
1662 |
+ |
1663 |
+ warn_unseeded_randomness(&previous); |
1664 |
+ |
1665 |
+- use_lock = READ_ONCE(crng_init) < 2; |
1666 |
+- batch = &get_cpu_var(batched_entropy_u64); |
1667 |
+- if (use_lock) |
1668 |
+- read_lock_irqsave(&batched_entropy_reset_lock, flags); |
1669 |
++ batch = raw_cpu_ptr(&batched_entropy_u64); |
1670 |
++ spin_lock_irqsave(&batch->batch_lock, flags); |
1671 |
+ if (batch->position % ARRAY_SIZE(batch->entropy_u64) == 0) { |
1672 |
+ extract_crng((__u32 *)batch->entropy_u64); |
1673 |
+ batch->position = 0; |
1674 |
+ } |
1675 |
+ ret = batch->entropy_u64[batch->position++]; |
1676 |
+- if (use_lock) |
1677 |
+- read_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
1678 |
+- put_cpu_var(batched_entropy_u64); |
1679 |
++ spin_unlock_irqrestore(&batch->batch_lock, flags); |
1680 |
+ return ret; |
1681 |
+ } |
1682 |
+ EXPORT_SYMBOL(get_random_u64); |
1683 |
+ |
1684 |
+-static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32); |
1685 |
++static DEFINE_PER_CPU(struct batched_entropy, batched_entropy_u32) = { |
1686 |
++ .batch_lock = __SPIN_LOCK_UNLOCKED(batched_entropy_u32.lock), |
1687 |
++}; |
1688 |
+ u32 get_random_u32(void) |
1689 |
+ { |
1690 |
+ u32 ret; |
1691 |
+- bool use_lock; |
1692 |
+- unsigned long flags = 0; |
1693 |
++ unsigned long flags; |
1694 |
+ struct batched_entropy *batch; |
1695 |
+ static void *previous; |
1696 |
+ |
1697 |
+@@ -2273,18 +2275,14 @@ u32 get_random_u32(void) |
1698 |
+ |
1699 |
+ warn_unseeded_randomness(&previous); |
1700 |
+ |
1701 |
+- use_lock = READ_ONCE(crng_init) < 2; |
1702 |
+- batch = &get_cpu_var(batched_entropy_u32); |
1703 |
+- if (use_lock) |
1704 |
+- read_lock_irqsave(&batched_entropy_reset_lock, flags); |
1705 |
++ batch = raw_cpu_ptr(&batched_entropy_u32); |
1706 |
++ spin_lock_irqsave(&batch->batch_lock, flags); |
1707 |
+ if (batch->position % ARRAY_SIZE(batch->entropy_u32) == 0) { |
1708 |
+ extract_crng(batch->entropy_u32); |
1709 |
+ batch->position = 0; |
1710 |
+ } |
1711 |
+ ret = batch->entropy_u32[batch->position++]; |
1712 |
+- if (use_lock) |
1713 |
+- read_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
1714 |
+- put_cpu_var(batched_entropy_u32); |
1715 |
++ spin_unlock_irqrestore(&batch->batch_lock, flags); |
1716 |
+ return ret; |
1717 |
+ } |
1718 |
+ EXPORT_SYMBOL(get_random_u32); |
1719 |
+@@ -2298,12 +2296,19 @@ static void invalidate_batched_entropy(void) |
1720 |
+ int cpu; |
1721 |
+ unsigned long flags; |
1722 |
+ |
1723 |
+- write_lock_irqsave(&batched_entropy_reset_lock, flags); |
1724 |
+ for_each_possible_cpu (cpu) { |
1725 |
+- per_cpu_ptr(&batched_entropy_u32, cpu)->position = 0; |
1726 |
+- per_cpu_ptr(&batched_entropy_u64, cpu)->position = 0; |
1727 |
++ struct batched_entropy *batched_entropy; |
1728 |
++ |
1729 |
++ batched_entropy = per_cpu_ptr(&batched_entropy_u32, cpu); |
1730 |
++ spin_lock_irqsave(&batched_entropy->batch_lock, flags); |
1731 |
++ batched_entropy->position = 0; |
1732 |
++ spin_unlock(&batched_entropy->batch_lock); |
1733 |
++ |
1734 |
++ batched_entropy = per_cpu_ptr(&batched_entropy_u64, cpu); |
1735 |
++ spin_lock(&batched_entropy->batch_lock); |
1736 |
++ batched_entropy->position = 0; |
1737 |
++ spin_unlock_irqrestore(&batched_entropy->batch_lock, flags); |
1738 |
+ } |
1739 |
+- write_unlock_irqrestore(&batched_entropy_reset_lock, flags); |
1740 |
+ } |
1741 |
+ |
1742 |
+ /** |
1743 |
+diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c |
1744 |
+index 5b5b5d72eab7..c55f6aeb4227 100644 |
1745 |
+--- a/drivers/char/virtio_console.c |
1746 |
++++ b/drivers/char/virtio_console.c |
1747 |
+@@ -75,7 +75,7 @@ struct ports_driver_data { |
1748 |
+ /* All the console devices handled by this driver */ |
1749 |
+ struct list_head consoles; |
1750 |
+ }; |
1751 |
+-static struct ports_driver_data pdrvdata; |
1752 |
++static struct ports_driver_data pdrvdata = { .next_vtermno = 1}; |
1753 |
+ |
1754 |
+ static DEFINE_SPINLOCK(pdrvdata_lock); |
1755 |
+ static DECLARE_COMPLETION(early_console_added); |
1756 |
+@@ -1405,6 +1405,7 @@ static int add_port(struct ports_device *portdev, u32 id) |
1757 |
+ port->async_queue = NULL; |
1758 |
+ |
1759 |
+ port->cons.ws.ws_row = port->cons.ws.ws_col = 0; |
1760 |
++ port->cons.vtermno = 0; |
1761 |
+ |
1762 |
+ port->host_connected = port->guest_connected = false; |
1763 |
+ port->stats = (struct port_stats) { 0 }; |
1764 |
+diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c |
1765 |
+index 450de24a1b42..64191694ff6e 100644 |
1766 |
+--- a/drivers/clk/rockchip/clk-rk3288.c |
1767 |
++++ b/drivers/clk/rockchip/clk-rk3288.c |
1768 |
+@@ -198,7 +198,7 @@ PNAME(mux_hsadcout_p) = { "hsadc_src", "ext_hsadc" }; |
1769 |
+ PNAME(mux_edp_24m_p) = { "ext_edp_24m", "xin24m" }; |
1770 |
+ PNAME(mux_tspout_p) = { "cpll", "gpll", "npll", "xin27m" }; |
1771 |
+ |
1772 |
+-PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vepu", "aclk_vdpu" }; |
1773 |
++PNAME(mux_aclk_vcodec_pre_p) = { "aclk_vdpu", "aclk_vepu" }; |
1774 |
+ PNAME(mux_usbphy480m_p) = { "sclk_otgphy1_480m", "sclk_otgphy2_480m", |
1775 |
+ "sclk_otgphy0_480m" }; |
1776 |
+ PNAME(mux_hsicphy480m_p) = { "cpll", "gpll", "usbphy480m_src" }; |
1777 |
+@@ -292,13 +292,13 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
1778 |
+ COMPOSITE_NOMUX(0, "aclk_core_mp", "armclk", CLK_IGNORE_UNUSED, |
1779 |
+ RK3288_CLKSEL_CON(0), 4, 4, DFLAGS | CLK_DIVIDER_READ_ONLY, |
1780 |
+ RK3288_CLKGATE_CON(12), 6, GFLAGS), |
1781 |
+- COMPOSITE_NOMUX(0, "atclk", "armclk", CLK_IGNORE_UNUSED, |
1782 |
++ COMPOSITE_NOMUX(0, "atclk", "armclk", 0, |
1783 |
+ RK3288_CLKSEL_CON(37), 4, 5, DFLAGS | CLK_DIVIDER_READ_ONLY, |
1784 |
+ RK3288_CLKGATE_CON(12), 7, GFLAGS), |
1785 |
+ COMPOSITE_NOMUX(0, "pclk_dbg_pre", "armclk", CLK_IGNORE_UNUSED, |
1786 |
+ RK3288_CLKSEL_CON(37), 9, 5, DFLAGS | CLK_DIVIDER_READ_ONLY, |
1787 |
+ RK3288_CLKGATE_CON(12), 8, GFLAGS), |
1788 |
+- GATE(0, "pclk_dbg", "pclk_dbg_pre", CLK_IGNORE_UNUSED, |
1789 |
++ GATE(0, "pclk_dbg", "pclk_dbg_pre", 0, |
1790 |
+ RK3288_CLKGATE_CON(12), 9, GFLAGS), |
1791 |
+ GATE(0, "cs_dbg", "pclk_dbg_pre", CLK_IGNORE_UNUSED, |
1792 |
+ RK3288_CLKGATE_CON(12), 10, GFLAGS), |
1793 |
+@@ -399,7 +399,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
1794 |
+ COMPOSITE(0, "aclk_vdpu", mux_pll_src_cpll_gpll_usb480m_p, 0, |
1795 |
+ RK3288_CLKSEL_CON(32), 14, 2, MFLAGS, 8, 5, DFLAGS, |
1796 |
+ RK3288_CLKGATE_CON(3), 11, GFLAGS), |
1797 |
+- MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, 0, |
1798 |
++ MUXGRF(0, "aclk_vcodec_pre", mux_aclk_vcodec_pre_p, CLK_SET_RATE_PARENT, |
1799 |
+ RK3288_GRF_SOC_CON(0), 7, 1, MFLAGS), |
1800 |
+ GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 0, |
1801 |
+ RK3288_CLKGATE_CON(9), 0, GFLAGS), |
1802 |
+@@ -626,7 +626,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
1803 |
+ INVERTER(SCLK_HSADC, "sclk_hsadc", "sclk_hsadc_out", |
1804 |
+ RK3288_CLKSEL_CON(22), 7, IFLAGS), |
1805 |
+ |
1806 |
+- GATE(0, "jtag", "ext_jtag", CLK_IGNORE_UNUSED, |
1807 |
++ GATE(0, "jtag", "ext_jtag", 0, |
1808 |
+ RK3288_CLKGATE_CON(4), 14, GFLAGS), |
1809 |
+ |
1810 |
+ COMPOSITE_NODIV(SCLK_USBPHY480M_SRC, "usbphy480m_src", mux_usbphy480m_p, 0, |
1811 |
+@@ -635,7 +635,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
1812 |
+ COMPOSITE_NODIV(SCLK_HSICPHY480M, "sclk_hsicphy480m", mux_hsicphy480m_p, 0, |
1813 |
+ RK3288_CLKSEL_CON(29), 0, 2, MFLAGS, |
1814 |
+ RK3288_CLKGATE_CON(3), 6, GFLAGS), |
1815 |
+- GATE(0, "hsicphy12m_xin12m", "xin12m", CLK_IGNORE_UNUSED, |
1816 |
++ GATE(0, "hsicphy12m_xin12m", "xin12m", 0, |
1817 |
+ RK3288_CLKGATE_CON(13), 9, GFLAGS), |
1818 |
+ DIV(0, "hsicphy12m_usbphy", "sclk_hsicphy480m", 0, |
1819 |
+ RK3288_CLKSEL_CON(11), 8, 6, DFLAGS), |
1820 |
+@@ -676,7 +676,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { |
1821 |
+ GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 3, GFLAGS), |
1822 |
+ GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 9, GFLAGS), |
1823 |
+ GATE(PCLK_EFUSE256, "pclk_efuse_256", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 10, GFLAGS), |
1824 |
+- GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(11), 11, GFLAGS), |
1825 |
++ GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", 0, RK3288_CLKGATE_CON(11), 11, GFLAGS), |
1826 |
+ |
1827 |
+ /* ddrctrl [DDR Controller PHY clock] gates */ |
1828 |
+ GATE(0, "nclk_ddrupctl0", "ddrphy", CLK_IGNORE_UNUSED, RK3288_CLKGATE_CON(11), 4, GFLAGS), |
1829 |
+@@ -816,12 +816,9 @@ static const char *const rk3288_critical_clocks[] __initconst = { |
1830 |
+ "pclk_alive_niu", |
1831 |
+ "pclk_pd_pmu", |
1832 |
+ "pclk_pmu_niu", |
1833 |
+- "pclk_core_niu", |
1834 |
+- "pclk_ddrupctl0", |
1835 |
+- "pclk_publ0", |
1836 |
+- "pclk_ddrupctl1", |
1837 |
+- "pclk_publ1", |
1838 |
+ "pmu_hclk_otg0", |
1839 |
++ /* pwm-regulators on some boards, so handoff-critical later */ |
1840 |
++ "pclk_rkpwm", |
1841 |
+ }; |
1842 |
+ |
1843 |
+ static void __iomem *rk3288_cru_base; |
1844 |
+diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
1845 |
+index 505c9a55d555..d3213594d1a7 100644 |
1846 |
+--- a/drivers/cpufreq/cpufreq.c |
1847 |
++++ b/drivers/cpufreq/cpufreq.c |
1848 |
+@@ -1103,6 +1103,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) |
1849 |
+ cpufreq_global_kobject, "policy%u", cpu); |
1850 |
+ if (ret) { |
1851 |
+ pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); |
1852 |
++ kobject_put(&policy->kobj); |
1853 |
+ goto err_free_real_cpus; |
1854 |
+ } |
1855 |
+ |
1856 |
+diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c |
1857 |
+index 6d53f7d9fc7a..69fc5cf4782f 100644 |
1858 |
+--- a/drivers/cpufreq/cpufreq_governor.c |
1859 |
++++ b/drivers/cpufreq/cpufreq_governor.c |
1860 |
+@@ -459,6 +459,8 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy) |
1861 |
+ /* Failure, so roll back. */ |
1862 |
+ pr_err("initialization failed (dbs_data kobject init error %d)\n", ret); |
1863 |
+ |
1864 |
++ kobject_put(&dbs_data->attr_set.kobj); |
1865 |
++ |
1866 |
+ policy->governor_data = NULL; |
1867 |
+ |
1868 |
+ if (!have_governor_per_policy()) |
1869 |
+diff --git a/drivers/cpufreq/kirkwood-cpufreq.c b/drivers/cpufreq/kirkwood-cpufreq.c |
1870 |
+index c2dd43f3f5d8..8d63a6dc8383 100644 |
1871 |
+--- a/drivers/cpufreq/kirkwood-cpufreq.c |
1872 |
++++ b/drivers/cpufreq/kirkwood-cpufreq.c |
1873 |
+@@ -124,13 +124,14 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) |
1874 |
+ priv.cpu_clk = of_clk_get_by_name(np, "cpu_clk"); |
1875 |
+ if (IS_ERR(priv.cpu_clk)) { |
1876 |
+ dev_err(priv.dev, "Unable to get cpuclk\n"); |
1877 |
+- return PTR_ERR(priv.cpu_clk); |
1878 |
++ err = PTR_ERR(priv.cpu_clk); |
1879 |
++ goto out_node; |
1880 |
+ } |
1881 |
+ |
1882 |
+ err = clk_prepare_enable(priv.cpu_clk); |
1883 |
+ if (err) { |
1884 |
+ dev_err(priv.dev, "Unable to prepare cpuclk\n"); |
1885 |
+- return err; |
1886 |
++ goto out_node; |
1887 |
+ } |
1888 |
+ |
1889 |
+ kirkwood_freq_table[0].frequency = clk_get_rate(priv.cpu_clk) / 1000; |
1890 |
+@@ -161,20 +162,22 @@ static int kirkwood_cpufreq_probe(struct platform_device *pdev) |
1891 |
+ goto out_ddr; |
1892 |
+ } |
1893 |
+ |
1894 |
+- of_node_put(np); |
1895 |
+- np = NULL; |
1896 |
+- |
1897 |
+ err = cpufreq_register_driver(&kirkwood_cpufreq_driver); |
1898 |
+- if (!err) |
1899 |
+- return 0; |
1900 |
++ if (err) { |
1901 |
++ dev_err(priv.dev, "Failed to register cpufreq driver\n"); |
1902 |
++ goto out_powersave; |
1903 |
++ } |
1904 |
+ |
1905 |
+- dev_err(priv.dev, "Failed to register cpufreq driver\n"); |
1906 |
++ of_node_put(np); |
1907 |
++ return 0; |
1908 |
+ |
1909 |
++out_powersave: |
1910 |
+ clk_disable_unprepare(priv.powersave_clk); |
1911 |
+ out_ddr: |
1912 |
+ clk_disable_unprepare(priv.ddr_clk); |
1913 |
+ out_cpu: |
1914 |
+ clk_disable_unprepare(priv.cpu_clk); |
1915 |
++out_node: |
1916 |
+ of_node_put(np); |
1917 |
+ |
1918 |
+ return err; |
1919 |
+diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c |
1920 |
+index 75dfbd2a58ea..c7710c149de8 100644 |
1921 |
+--- a/drivers/cpufreq/pasemi-cpufreq.c |
1922 |
++++ b/drivers/cpufreq/pasemi-cpufreq.c |
1923 |
+@@ -146,6 +146,7 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) |
1924 |
+ |
1925 |
+ cpu = of_get_cpu_node(policy->cpu, NULL); |
1926 |
+ |
1927 |
++ of_node_put(cpu); |
1928 |
+ if (!cpu) |
1929 |
+ goto out; |
1930 |
+ |
1931 |
+diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c |
1932 |
+index 61ae06ca008e..e225edb5c359 100644 |
1933 |
+--- a/drivers/cpufreq/pmac32-cpufreq.c |
1934 |
++++ b/drivers/cpufreq/pmac32-cpufreq.c |
1935 |
+@@ -552,6 +552,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) |
1936 |
+ volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); |
1937 |
+ if (volt_gpio_np) |
1938 |
+ voltage_gpio = read_gpio(volt_gpio_np); |
1939 |
++ of_node_put(volt_gpio_np); |
1940 |
+ if (!voltage_gpio){ |
1941 |
+ pr_err("missing cpu-vcore-select gpio\n"); |
1942 |
+ return 1; |
1943 |
+@@ -588,6 +589,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) |
1944 |
+ if (volt_gpio_np) |
1945 |
+ voltage_gpio = read_gpio(volt_gpio_np); |
1946 |
+ |
1947 |
++ of_node_put(volt_gpio_np); |
1948 |
+ pvr = mfspr(SPRN_PVR); |
1949 |
+ has_cpu_l2lve = !((pvr & 0xf00) == 0x100); |
1950 |
+ |
1951 |
+diff --git a/drivers/cpufreq/ppc_cbe_cpufreq.c b/drivers/cpufreq/ppc_cbe_cpufreq.c |
1952 |
+index 41a0f0be3f9f..8414c3a4ea08 100644 |
1953 |
+--- a/drivers/cpufreq/ppc_cbe_cpufreq.c |
1954 |
++++ b/drivers/cpufreq/ppc_cbe_cpufreq.c |
1955 |
+@@ -86,6 +86,7 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) |
1956 |
+ if (!cbe_get_cpu_pmd_regs(policy->cpu) || |
1957 |
+ !cbe_get_cpu_mic_tm_regs(policy->cpu)) { |
1958 |
+ pr_info("invalid CBE regs pointers for cpufreq\n"); |
1959 |
++ of_node_put(cpu); |
1960 |
+ return -EINVAL; |
1961 |
+ } |
1962 |
+ |
1963 |
+diff --git a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1964 |
+index a4b5ff2b72f8..f6936bb3b7be 100644 |
1965 |
+--- a/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1966 |
++++ b/drivers/crypto/sunxi-ss/sun4i-ss-hash.c |
1967 |
+@@ -240,7 +240,10 @@ static int sun4i_hash(struct ahash_request *areq) |
1968 |
+ } |
1969 |
+ } else { |
1970 |
+ /* Since we have the flag final, we can go up to modulo 4 */ |
1971 |
+- end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
1972 |
++ if (areq->nbytes < 4) |
1973 |
++ end = 0; |
1974 |
++ else |
1975 |
++ end = ((areq->nbytes + op->len) / 4) * 4 - op->len; |
1976 |
+ } |
1977 |
+ |
1978 |
+ /* TODO if SGlen % 4 and !op->len then DMA */ |
1979 |
+diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl |
1980 |
+index de78282b8f44..9c6b5c1d6a1a 100644 |
1981 |
+--- a/drivers/crypto/vmx/aesp8-ppc.pl |
1982 |
++++ b/drivers/crypto/vmx/aesp8-ppc.pl |
1983 |
+@@ -1357,7 +1357,7 @@ Loop_ctr32_enc: |
1984 |
+ addi $idx,$idx,16 |
1985 |
+ bdnz Loop_ctr32_enc |
1986 |
+ |
1987 |
+- vadduwm $ivec,$ivec,$one |
1988 |
++ vadduqm $ivec,$ivec,$one |
1989 |
+ vmr $dat,$inptail |
1990 |
+ lvx $inptail,0,$inp |
1991 |
+ addi $inp,$inp,16 |
1992 |
+diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c |
1993 |
+index a75b95fac3bd..db5b8fe1dd4a 100644 |
1994 |
+--- a/drivers/dma/at_xdmac.c |
1995 |
++++ b/drivers/dma/at_xdmac.c |
1996 |
+@@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data) |
1997 |
+ struct at_xdmac_desc, |
1998 |
+ xfer_node); |
1999 |
+ dev_vdbg(chan2dev(&atchan->chan), "%s: desc 0x%p\n", __func__, desc); |
2000 |
+- BUG_ON(!desc->active_xfer); |
2001 |
++ if (!desc->active_xfer) { |
2002 |
++ dev_err(chan2dev(&atchan->chan), "Xfer not active: exiting"); |
2003 |
++ spin_unlock_bh(&atchan->lock); |
2004 |
++ return; |
2005 |
++ } |
2006 |
+ |
2007 |
+ txd = &desc->tx_dma_desc; |
2008 |
+ |
2009 |
+diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c |
2010 |
+index 88750a34e859..bc8050c025b7 100644 |
2011 |
+--- a/drivers/dma/pl330.c |
2012 |
++++ b/drivers/dma/pl330.c |
2013 |
+@@ -961,6 +961,7 @@ static void _stop(struct pl330_thread *thrd) |
2014 |
+ { |
2015 |
+ void __iomem *regs = thrd->dmac->base; |
2016 |
+ u8 insn[6] = {0, 0, 0, 0, 0, 0}; |
2017 |
++ u32 inten = readl(regs + INTEN); |
2018 |
+ |
2019 |
+ if (_state(thrd) == PL330_STATE_FAULT_COMPLETING) |
2020 |
+ UNTIL(thrd, PL330_STATE_FAULTING | PL330_STATE_KILLING); |
2021 |
+@@ -973,10 +974,13 @@ static void _stop(struct pl330_thread *thrd) |
2022 |
+ |
2023 |
+ _emit_KILL(0, insn); |
2024 |
+ |
2025 |
+- /* Stop generating interrupts for SEV */ |
2026 |
+- writel(readl(regs + INTEN) & ~(1 << thrd->ev), regs + INTEN); |
2027 |
+- |
2028 |
+ _execute_DBGINSN(thrd, insn, is_manager(thrd)); |
2029 |
++ |
2030 |
++ /* clear the event */ |
2031 |
++ if (inten & (1 << thrd->ev)) |
2032 |
++ writel(1 << thrd->ev, regs + INTCLR); |
2033 |
++ /* Stop generating interrupts for SEV */ |
2034 |
++ writel(inten & ~(1 << thrd->ev), regs + INTEN); |
2035 |
+ } |
2036 |
+ |
2037 |
+ /* Start doing req 'idx' of thread 'thrd' */ |
2038 |
+diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c |
2039 |
+index b26256f23d67..09b6756366c3 100644 |
2040 |
+--- a/drivers/dma/tegra210-adma.c |
2041 |
++++ b/drivers/dma/tegra210-adma.c |
2042 |
+@@ -22,7 +22,6 @@ |
2043 |
+ #include <linux/of_device.h> |
2044 |
+ #include <linux/of_dma.h> |
2045 |
+ #include <linux/of_irq.h> |
2046 |
+-#include <linux/pm_clock.h> |
2047 |
+ #include <linux/pm_runtime.h> |
2048 |
+ #include <linux/slab.h> |
2049 |
+ |
2050 |
+@@ -141,6 +140,7 @@ struct tegra_adma { |
2051 |
+ struct dma_device dma_dev; |
2052 |
+ struct device *dev; |
2053 |
+ void __iomem *base_addr; |
2054 |
++ struct clk *ahub_clk; |
2055 |
+ unsigned int nr_channels; |
2056 |
+ unsigned long rx_requests_reserved; |
2057 |
+ unsigned long tx_requests_reserved; |
2058 |
+@@ -637,8 +637,9 @@ static int tegra_adma_runtime_suspend(struct device *dev) |
2059 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
2060 |
+ |
2061 |
+ tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD); |
2062 |
++ clk_disable_unprepare(tdma->ahub_clk); |
2063 |
+ |
2064 |
+- return pm_clk_suspend(dev); |
2065 |
++ return 0; |
2066 |
+ } |
2067 |
+ |
2068 |
+ static int tegra_adma_runtime_resume(struct device *dev) |
2069 |
+@@ -646,10 +647,11 @@ static int tegra_adma_runtime_resume(struct device *dev) |
2070 |
+ struct tegra_adma *tdma = dev_get_drvdata(dev); |
2071 |
+ int ret; |
2072 |
+ |
2073 |
+- ret = pm_clk_resume(dev); |
2074 |
+- if (ret) |
2075 |
++ ret = clk_prepare_enable(tdma->ahub_clk); |
2076 |
++ if (ret) { |
2077 |
++ dev_err(dev, "ahub clk_enable failed: %d\n", ret); |
2078 |
+ return ret; |
2079 |
+- |
2080 |
++ } |
2081 |
+ tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd); |
2082 |
+ |
2083 |
+ return 0; |
2084 |
+@@ -692,13 +694,11 @@ static int tegra_adma_probe(struct platform_device *pdev) |
2085 |
+ if (IS_ERR(tdma->base_addr)) |
2086 |
+ return PTR_ERR(tdma->base_addr); |
2087 |
+ |
2088 |
+- ret = pm_clk_create(&pdev->dev); |
2089 |
+- if (ret) |
2090 |
+- return ret; |
2091 |
+- |
2092 |
+- ret = of_pm_clk_add_clk(&pdev->dev, "d_audio"); |
2093 |
+- if (ret) |
2094 |
+- goto clk_destroy; |
2095 |
++ tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio"); |
2096 |
++ if (IS_ERR(tdma->ahub_clk)) { |
2097 |
++ dev_err(&pdev->dev, "Error: Missing ahub controller clock\n"); |
2098 |
++ return PTR_ERR(tdma->ahub_clk); |
2099 |
++ } |
2100 |
+ |
2101 |
+ pm_runtime_enable(&pdev->dev); |
2102 |
+ |
2103 |
+@@ -775,8 +775,6 @@ rpm_put: |
2104 |
+ pm_runtime_put_sync(&pdev->dev); |
2105 |
+ rpm_disable: |
2106 |
+ pm_runtime_disable(&pdev->dev); |
2107 |
+-clk_destroy: |
2108 |
+- pm_clk_destroy(&pdev->dev); |
2109 |
+ |
2110 |
+ return ret; |
2111 |
+ } |
2112 |
+@@ -786,6 +784,7 @@ static int tegra_adma_remove(struct platform_device *pdev) |
2113 |
+ struct tegra_adma *tdma = platform_get_drvdata(pdev); |
2114 |
+ int i; |
2115 |
+ |
2116 |
++ of_dma_controller_free(pdev->dev.of_node); |
2117 |
+ dma_async_device_unregister(&tdma->dma_dev); |
2118 |
+ |
2119 |
+ for (i = 0; i < tdma->nr_channels; ++i) |
2120 |
+@@ -793,7 +792,6 @@ static int tegra_adma_remove(struct platform_device *pdev) |
2121 |
+ |
2122 |
+ pm_runtime_put_sync(&pdev->dev); |
2123 |
+ pm_runtime_disable(&pdev->dev); |
2124 |
+- pm_clk_destroy(&pdev->dev); |
2125 |
+ |
2126 |
+ return 0; |
2127 |
+ } |
2128 |
+diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c |
2129 |
+index da0e9bc4262f..9327479c719c 100644 |
2130 |
+--- a/drivers/extcon/extcon-arizona.c |
2131 |
++++ b/drivers/extcon/extcon-arizona.c |
2132 |
+@@ -1726,6 +1726,16 @@ static int arizona_extcon_remove(struct platform_device *pdev) |
2133 |
+ struct arizona_extcon_info *info = platform_get_drvdata(pdev); |
2134 |
+ struct arizona *arizona = info->arizona; |
2135 |
+ int jack_irq_rise, jack_irq_fall; |
2136 |
++ bool change; |
2137 |
++ |
2138 |
++ regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1, |
2139 |
++ ARIZONA_MICD_ENA, 0, |
2140 |
++ &change); |
2141 |
++ |
2142 |
++ if (change) { |
2143 |
++ regulator_disable(info->micvdd); |
2144 |
++ pm_runtime_put(info->dev); |
2145 |
++ } |
2146 |
+ |
2147 |
+ gpiod_put(info->micd_pol_gpio); |
2148 |
+ |
2149 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2150 |
+index 7056925eb386..869ff624b108 100644 |
2151 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2152 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |
2153 |
+@@ -136,8 +136,9 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, |
2154 |
+ { |
2155 |
+ struct amdgpu_device *adev = ring->adev; |
2156 |
+ struct amdgpu_fence *fence; |
2157 |
+- struct dma_fence *old, **ptr; |
2158 |
++ struct dma_fence __rcu **ptr; |
2159 |
+ uint32_t seq; |
2160 |
++ int r; |
2161 |
+ |
2162 |
+ fence = kmem_cache_alloc(amdgpu_fence_slab, GFP_KERNEL); |
2163 |
+ if (fence == NULL) |
2164 |
+@@ -153,15 +154,24 @@ int amdgpu_fence_emit(struct amdgpu_ring *ring, struct dma_fence **f, |
2165 |
+ seq, flags | AMDGPU_FENCE_FLAG_INT); |
2166 |
+ |
2167 |
+ ptr = &ring->fence_drv.fences[seq & ring->fence_drv.num_fences_mask]; |
2168 |
++ if (unlikely(rcu_dereference_protected(*ptr, 1))) { |
2169 |
++ struct dma_fence *old; |
2170 |
++ |
2171 |
++ rcu_read_lock(); |
2172 |
++ old = dma_fence_get_rcu_safe(ptr); |
2173 |
++ rcu_read_unlock(); |
2174 |
++ |
2175 |
++ if (old) { |
2176 |
++ r = dma_fence_wait(old, false); |
2177 |
++ dma_fence_put(old); |
2178 |
++ if (r) |
2179 |
++ return r; |
2180 |
++ } |
2181 |
++ } |
2182 |
++ |
2183 |
+ /* This function can't be called concurrently anyway, otherwise |
2184 |
+ * emitting the fence would mess up the hardware ring buffer. |
2185 |
+ */ |
2186 |
+- old = rcu_dereference_protected(*ptr, 1); |
2187 |
+- if (old && !dma_fence_is_signaled(old)) { |
2188 |
+- DRM_INFO("rcu slot is busy\n"); |
2189 |
+- dma_fence_wait(old, false); |
2190 |
+- } |
2191 |
+- |
2192 |
+ rcu_assign_pointer(*ptr, dma_fence_get(&fence->base)); |
2193 |
+ |
2194 |
+ *f = &fence->base; |
2195 |
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2196 |
+index 76ee2de43ea6..dac7978f5ee1 100644 |
2197 |
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2198 |
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c |
2199 |
+@@ -4369,8 +4369,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, |
2200 |
+ static void amdgpu_dm_crtc_copy_transient_flags(struct drm_crtc_state *crtc_state, |
2201 |
+ struct dc_stream_state *stream_state) |
2202 |
+ { |
2203 |
+- stream_state->mode_changed = |
2204 |
+- crtc_state->mode_changed || crtc_state->active_changed; |
2205 |
++ stream_state->mode_changed = drm_atomic_crtc_needs_modeset(crtc_state); |
2206 |
+ } |
2207 |
+ |
2208 |
+ static int amdgpu_dm_atomic_commit(struct drm_device *dev, |
2209 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2210 |
+index 87bf422f16be..e0a96abb3c46 100644 |
2211 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2212 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c |
2213 |
+@@ -1401,10 +1401,12 @@ bool dc_remove_plane_from_context( |
2214 |
+ * For head pipe detach surfaces from pipe for tail |
2215 |
+ * pipe just zero it out |
2216 |
+ */ |
2217 |
+- if (!pipe_ctx->top_pipe) { |
2218 |
++ if (!pipe_ctx->top_pipe || |
2219 |
++ (!pipe_ctx->top_pipe->top_pipe && |
2220 |
++ pipe_ctx->top_pipe->stream_res.opp != pipe_ctx->stream_res.opp)) { |
2221 |
+ pipe_ctx->plane_state = NULL; |
2222 |
+ pipe_ctx->bottom_pipe = NULL; |
2223 |
+- } else { |
2224 |
++ } else { |
2225 |
+ memset(pipe_ctx, 0, sizeof(*pipe_ctx)); |
2226 |
+ } |
2227 |
+ } |
2228 |
+diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2229 |
+index 4a863a5dab41..321af9af95e8 100644 |
2230 |
+--- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2231 |
++++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_dscl.c |
2232 |
+@@ -406,15 +406,25 @@ void dpp1_dscl_calc_lb_num_partitions( |
2233 |
+ int *num_part_y, |
2234 |
+ int *num_part_c) |
2235 |
+ { |
2236 |
++ int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a, |
2237 |
++ lb_bpc, memory_line_size_y, memory_line_size_c, memory_line_size_a; |
2238 |
++ |
2239 |
+ int line_size = scl_data->viewport.width < scl_data->recout.width ? |
2240 |
+ scl_data->viewport.width : scl_data->recout.width; |
2241 |
+ int line_size_c = scl_data->viewport_c.width < scl_data->recout.width ? |
2242 |
+ scl_data->viewport_c.width : scl_data->recout.width; |
2243 |
+- int lb_bpc = dpp1_dscl_get_lb_depth_bpc(scl_data->lb_params.depth); |
2244 |
+- int memory_line_size_y = (line_size * lb_bpc + 71) / 72; /* +71 to ceil */ |
2245 |
+- int memory_line_size_c = (line_size_c * lb_bpc + 71) / 72; /* +71 to ceil */ |
2246 |
+- int memory_line_size_a = (line_size + 5) / 6; /* +5 to ceil */ |
2247 |
+- int lb_memory_size, lb_memory_size_c, lb_memory_size_a, num_partitions_a; |
2248 |
++ |
2249 |
++ if (line_size == 0) |
2250 |
++ line_size = 1; |
2251 |
++ |
2252 |
++ if (line_size_c == 0) |
2253 |
++ line_size_c = 1; |
2254 |
++ |
2255 |
++ |
2256 |
++ lb_bpc = dpp1_dscl_get_lb_depth_bpc(scl_data->lb_params.depth); |
2257 |
++ memory_line_size_y = (line_size * lb_bpc + 71) / 72; /* +71 to ceil */ |
2258 |
++ memory_line_size_c = (line_size_c * lb_bpc + 71) / 72; /* +71 to ceil */ |
2259 |
++ memory_line_size_a = (line_size + 5) / 6; /* +5 to ceil */ |
2260 |
+ |
2261 |
+ if (lb_config == LB_MEMORY_CONFIG_1) { |
2262 |
+ lb_memory_size = 816; |
2263 |
+diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c |
2264 |
+index 0201ccb22f4c..d8ae4ca129c7 100644 |
2265 |
+--- a/drivers/gpu/drm/drm_drv.c |
2266 |
++++ b/drivers/gpu/drm/drm_drv.c |
2267 |
+@@ -499,7 +499,7 @@ int drm_dev_init(struct drm_device *dev, |
2268 |
+ } |
2269 |
+ |
2270 |
+ kref_init(&dev->ref); |
2271 |
+- dev->dev = parent; |
2272 |
++ dev->dev = get_device(parent); |
2273 |
+ dev->driver = driver; |
2274 |
+ |
2275 |
+ INIT_LIST_HEAD(&dev->filelist); |
2276 |
+@@ -568,6 +568,7 @@ err_minors: |
2277 |
+ drm_minor_free(dev, DRM_MINOR_RENDER); |
2278 |
+ drm_fs_inode_free(dev->anon_inode); |
2279 |
+ err_free: |
2280 |
++ put_device(dev->dev); |
2281 |
+ mutex_destroy(&dev->master_mutex); |
2282 |
+ mutex_destroy(&dev->ctxlist_mutex); |
2283 |
+ mutex_destroy(&dev->clientlist_mutex); |
2284 |
+@@ -603,6 +604,8 @@ void drm_dev_fini(struct drm_device *dev) |
2285 |
+ drm_minor_free(dev, DRM_MINOR_PRIMARY); |
2286 |
+ drm_minor_free(dev, DRM_MINOR_RENDER); |
2287 |
+ |
2288 |
++ put_device(dev->dev); |
2289 |
++ |
2290 |
+ mutex_destroy(&dev->master_mutex); |
2291 |
+ mutex_destroy(&dev->ctxlist_mutex); |
2292 |
+ mutex_destroy(&dev->clientlist_mutex); |
2293 |
+diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c |
2294 |
+index e4ccb52c67ea..334addaca9c5 100644 |
2295 |
+--- a/drivers/gpu/drm/drm_file.c |
2296 |
++++ b/drivers/gpu/drm/drm_file.c |
2297 |
+@@ -567,6 +567,7 @@ put_back_event: |
2298 |
+ file_priv->event_space -= length; |
2299 |
+ list_add(&e->link, &file_priv->event_list); |
2300 |
+ spin_unlock_irq(&dev->event_lock); |
2301 |
++ wake_up_interruptible(&file_priv->event_wait); |
2302 |
+ break; |
2303 |
+ } |
2304 |
+ |
2305 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
2306 |
+index 83c1f46670bf..00675fcbffa2 100644 |
2307 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
2308 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c |
2309 |
+@@ -527,6 +527,9 @@ static int etnaviv_bind(struct device *dev) |
2310 |
+ } |
2311 |
+ drm->dev_private = priv; |
2312 |
+ |
2313 |
++ dev->dma_parms = &priv->dma_parms; |
2314 |
++ dma_set_max_seg_size(dev, SZ_2G); |
2315 |
++ |
2316 |
+ mutex_init(&priv->gem_lock); |
2317 |
+ INIT_LIST_HEAD(&priv->gem_list); |
2318 |
+ priv->num_gpus = 0; |
2319 |
+@@ -564,6 +567,8 @@ static void etnaviv_unbind(struct device *dev) |
2320 |
+ |
2321 |
+ component_unbind_all(dev, drm); |
2322 |
+ |
2323 |
++ dev->dma_parms = NULL; |
2324 |
++ |
2325 |
+ drm->dev_private = NULL; |
2326 |
+ kfree(priv); |
2327 |
+ |
2328 |
+diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
2329 |
+index 8d02d1b7dcf5..b2930d1fe97c 100644 |
2330 |
+--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
2331 |
++++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h |
2332 |
+@@ -43,6 +43,7 @@ struct etnaviv_file_private { |
2333 |
+ |
2334 |
+ struct etnaviv_drm_private { |
2335 |
+ int num_gpus; |
2336 |
++ struct device_dma_parameters dma_parms; |
2337 |
+ struct etnaviv_gpu *gpu[ETNA_MAX_PIPES]; |
2338 |
+ |
2339 |
+ /* list of GEM objects: */ |
2340 |
+diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
2341 |
+index ab1d9308c311..ba6f3c14495c 100644 |
2342 |
+--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
2343 |
++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c |
2344 |
+@@ -35,7 +35,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) |
2345 |
+ { |
2346 |
+ struct device *dev = &gpu->pdev->dev; |
2347 |
+ const struct firmware *fw; |
2348 |
+- struct device_node *np; |
2349 |
++ struct device_node *np, *mem_np; |
2350 |
+ struct resource r; |
2351 |
+ phys_addr_t mem_phys; |
2352 |
+ ssize_t mem_size; |
2353 |
+@@ -49,11 +49,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname) |
2354 |
+ if (!np) |
2355 |
+ return -ENODEV; |
2356 |
+ |
2357 |
+- np = of_parse_phandle(np, "memory-region", 0); |
2358 |
+- if (!np) |
2359 |
++ mem_np = of_parse_phandle(np, "memory-region", 0); |
2360 |
++ of_node_put(np); |
2361 |
++ if (!mem_np) |
2362 |
+ return -EINVAL; |
2363 |
+ |
2364 |
+- ret = of_address_to_resource(np, 0, &r); |
2365 |
++ ret = of_address_to_resource(mem_np, 0, &r); |
2366 |
++ of_node_put(mem_np); |
2367 |
+ if (ret) |
2368 |
+ return ret; |
2369 |
+ |
2370 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
2371 |
+index 157b076a1272..38c9c086754b 100644 |
2372 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
2373 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/nv50.c |
2374 |
+@@ -109,7 +109,7 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
2375 |
+ struct nvkm_device *device = bar->base.subdev.device; |
2376 |
+ static struct lock_class_key bar1_lock; |
2377 |
+ static struct lock_class_key bar2_lock; |
2378 |
+- u64 start, limit; |
2379 |
++ u64 start, limit, size; |
2380 |
+ int ret; |
2381 |
+ |
2382 |
+ ret = nvkm_gpuobj_new(device, 0x20000, 0, false, NULL, &bar->mem); |
2383 |
+@@ -127,7 +127,10 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
2384 |
+ |
2385 |
+ /* BAR2 */ |
2386 |
+ start = 0x0100000000ULL; |
2387 |
+- limit = start + device->func->resource_size(device, 3); |
2388 |
++ size = device->func->resource_size(device, 3); |
2389 |
++ if (!size) |
2390 |
++ return -ENOMEM; |
2391 |
++ limit = start + size; |
2392 |
+ |
2393 |
+ ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0, |
2394 |
+ &bar2_lock, "bar2", &bar->bar2_vmm); |
2395 |
+@@ -164,7 +167,10 @@ nv50_bar_oneinit(struct nvkm_bar *base) |
2396 |
+ |
2397 |
+ /* BAR1 */ |
2398 |
+ start = 0x0000000000ULL; |
2399 |
+- limit = start + device->func->resource_size(device, 1); |
2400 |
++ size = device->func->resource_size(device, 1); |
2401 |
++ if (!size) |
2402 |
++ return -ENOMEM; |
2403 |
++ limit = start + size; |
2404 |
+ |
2405 |
+ ret = nvkm_vmm_new(device, start, limit-- - start, NULL, 0, |
2406 |
+ &bar1_lock, "bar1", &bar->bar1_vmm); |
2407 |
+diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c |
2408 |
+index 74467b308721..8160954ebc25 100644 |
2409 |
+--- a/drivers/gpu/drm/omapdrm/dss/dsi.c |
2410 |
++++ b/drivers/gpu/drm/omapdrm/dss/dsi.c |
2411 |
+@@ -1386,12 +1386,9 @@ static int dsi_pll_enable(struct dss_pll *pll) |
2412 |
+ */ |
2413 |
+ dsi_enable_scp_clk(dsi); |
2414 |
+ |
2415 |
+- if (!dsi->vdds_dsi_enabled) { |
2416 |
+- r = regulator_enable(dsi->vdds_dsi_reg); |
2417 |
+- if (r) |
2418 |
+- goto err0; |
2419 |
+- dsi->vdds_dsi_enabled = true; |
2420 |
+- } |
2421 |
++ r = regulator_enable(dsi->vdds_dsi_reg); |
2422 |
++ if (r) |
2423 |
++ goto err0; |
2424 |
+ |
2425 |
+ /* XXX PLL does not come out of reset without this... */ |
2426 |
+ dispc_pck_free_enable(dsi->dss->dispc, 1); |
2427 |
+@@ -1416,36 +1413,25 @@ static int dsi_pll_enable(struct dss_pll *pll) |
2428 |
+ |
2429 |
+ return 0; |
2430 |
+ err1: |
2431 |
+- if (dsi->vdds_dsi_enabled) { |
2432 |
+- regulator_disable(dsi->vdds_dsi_reg); |
2433 |
+- dsi->vdds_dsi_enabled = false; |
2434 |
+- } |
2435 |
++ regulator_disable(dsi->vdds_dsi_reg); |
2436 |
+ err0: |
2437 |
+ dsi_disable_scp_clk(dsi); |
2438 |
+ dsi_runtime_put(dsi); |
2439 |
+ return r; |
2440 |
+ } |
2441 |
+ |
2442 |
+-static void dsi_pll_uninit(struct dsi_data *dsi, bool disconnect_lanes) |
2443 |
++static void dsi_pll_disable(struct dss_pll *pll) |
2444 |
+ { |
2445 |
++ struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); |
2446 |
++ |
2447 |
+ dsi_pll_power(dsi, DSI_PLL_POWER_OFF); |
2448 |
+- if (disconnect_lanes) { |
2449 |
+- WARN_ON(!dsi->vdds_dsi_enabled); |
2450 |
+- regulator_disable(dsi->vdds_dsi_reg); |
2451 |
+- dsi->vdds_dsi_enabled = false; |
2452 |
+- } |
2453 |
++ |
2454 |
++ regulator_disable(dsi->vdds_dsi_reg); |
2455 |
+ |
2456 |
+ dsi_disable_scp_clk(dsi); |
2457 |
+ dsi_runtime_put(dsi); |
2458 |
+ |
2459 |
+- DSSDBG("PLL uninit done\n"); |
2460 |
+-} |
2461 |
+- |
2462 |
+-static void dsi_pll_disable(struct dss_pll *pll) |
2463 |
+-{ |
2464 |
+- struct dsi_data *dsi = container_of(pll, struct dsi_data, pll); |
2465 |
+- |
2466 |
+- dsi_pll_uninit(dsi, true); |
2467 |
++ DSSDBG("PLL disable done\n"); |
2468 |
+ } |
2469 |
+ |
2470 |
+ static void dsi_dump_dsi_clocks(struct dsi_data *dsi, struct seq_file *s) |
2471 |
+@@ -4195,11 +4181,11 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
2472 |
+ |
2473 |
+ r = dss_pll_enable(&dsi->pll); |
2474 |
+ if (r) |
2475 |
+- goto err0; |
2476 |
++ return r; |
2477 |
+ |
2478 |
+ r = dsi_configure_dsi_clocks(dsi); |
2479 |
+ if (r) |
2480 |
+- goto err1; |
2481 |
++ goto err0; |
2482 |
+ |
2483 |
+ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, |
2484 |
+ dsi->module_id == 0 ? |
2485 |
+@@ -4207,6 +4193,14 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
2486 |
+ |
2487 |
+ DSSDBG("PLL OK\n"); |
2488 |
+ |
2489 |
++ if (!dsi->vdds_dsi_enabled) { |
2490 |
++ r = regulator_enable(dsi->vdds_dsi_reg); |
2491 |
++ if (r) |
2492 |
++ goto err1; |
2493 |
++ |
2494 |
++ dsi->vdds_dsi_enabled = true; |
2495 |
++ } |
2496 |
++ |
2497 |
+ r = dsi_cio_init(dsi); |
2498 |
+ if (r) |
2499 |
+ goto err2; |
2500 |
+@@ -4235,10 +4229,13 @@ static int dsi_display_init_dsi(struct dsi_data *dsi) |
2501 |
+ err3: |
2502 |
+ dsi_cio_uninit(dsi); |
2503 |
+ err2: |
2504 |
+- dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
2505 |
++ regulator_disable(dsi->vdds_dsi_reg); |
2506 |
++ dsi->vdds_dsi_enabled = false; |
2507 |
+ err1: |
2508 |
+- dss_pll_disable(&dsi->pll); |
2509 |
++ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
2510 |
+ err0: |
2511 |
++ dss_pll_disable(&dsi->pll); |
2512 |
++ |
2513 |
+ return r; |
2514 |
+ } |
2515 |
+ |
2516 |
+@@ -4257,7 +4254,12 @@ static void dsi_display_uninit_dsi(struct dsi_data *dsi, bool disconnect_lanes, |
2517 |
+ |
2518 |
+ dss_select_dsi_clk_source(dsi->dss, dsi->module_id, DSS_CLK_SRC_FCK); |
2519 |
+ dsi_cio_uninit(dsi); |
2520 |
+- dsi_pll_uninit(dsi, disconnect_lanes); |
2521 |
++ dss_pll_disable(&dsi->pll); |
2522 |
++ |
2523 |
++ if (disconnect_lanes) { |
2524 |
++ regulator_disable(dsi->vdds_dsi_reg); |
2525 |
++ dsi->vdds_dsi_enabled = false; |
2526 |
++ } |
2527 |
+ } |
2528 |
+ |
2529 |
+ static int dsi_display_enable(struct omap_dss_device *dssdev) |
2530 |
+diff --git a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
2531 |
+index 87fa316e1d7b..58ccf648b70f 100644 |
2532 |
+--- a/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
2533 |
++++ b/drivers/gpu/drm/panel/panel-orisetech-otm8009a.c |
2534 |
+@@ -248,6 +248,9 @@ static int otm8009a_init_sequence(struct otm8009a *ctx) |
2535 |
+ /* Send Command GRAM memory write (no parameters) */ |
2536 |
+ dcs_write_seq(ctx, MIPI_DCS_WRITE_MEMORY_START); |
2537 |
+ |
2538 |
++ /* Wait a short while to let the panel be ready before the 1st frame */ |
2539 |
++ mdelay(10); |
2540 |
++ |
2541 |
+ return 0; |
2542 |
+ } |
2543 |
+ |
2544 |
+diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c |
2545 |
+index b9baefdba38a..1c318ad32a8c 100644 |
2546 |
+--- a/drivers/gpu/drm/pl111/pl111_versatile.c |
2547 |
++++ b/drivers/gpu/drm/pl111/pl111_versatile.c |
2548 |
+@@ -330,6 +330,7 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) |
2549 |
+ ret = vexpress_muxfpga_init(); |
2550 |
+ if (ret) { |
2551 |
+ dev_err(dev, "unable to initialize muxfpga driver\n"); |
2552 |
++ of_node_put(np); |
2553 |
+ return ret; |
2554 |
+ } |
2555 |
+ |
2556 |
+@@ -337,17 +338,20 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) |
2557 |
+ pdev = of_find_device_by_node(np); |
2558 |
+ if (!pdev) { |
2559 |
+ dev_err(dev, "can't find the sysreg device, deferring\n"); |
2560 |
++ of_node_put(np); |
2561 |
+ return -EPROBE_DEFER; |
2562 |
+ } |
2563 |
+ map = dev_get_drvdata(&pdev->dev); |
2564 |
+ if (!map) { |
2565 |
+ dev_err(dev, "sysreg has not yet probed\n"); |
2566 |
+ platform_device_put(pdev); |
2567 |
++ of_node_put(np); |
2568 |
+ return -EPROBE_DEFER; |
2569 |
+ } |
2570 |
+ } else { |
2571 |
+ map = syscon_node_to_regmap(np); |
2572 |
+ } |
2573 |
++ of_node_put(np); |
2574 |
+ |
2575 |
+ if (IS_ERR(map)) { |
2576 |
+ dev_err(dev, "no Versatile syscon regmap\n"); |
2577 |
+diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
2578 |
+index e3b34a345546..97a0573cc514 100644 |
2579 |
+--- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
2580 |
++++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c |
2581 |
+@@ -357,7 +357,13 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, |
2582 |
+ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, |
2583 |
+ struct drm_display_mode *mode) |
2584 |
+ { |
2585 |
+- return mode->vtotal - (mode->vsync_end - mode->vdisplay) + 1; |
2586 |
++ u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); |
2587 |
++ u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; |
2588 |
++ |
2589 |
++ if (delay > mode->vtotal) |
2590 |
++ delay = delay % mode->vtotal; |
2591 |
++ |
2592 |
++ return max_t(u16, delay, 1); |
2593 |
+ } |
2594 |
+ |
2595 |
+ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, |
2596 |
+diff --git a/drivers/gpu/drm/tinydrm/ili9225.c b/drivers/gpu/drm/tinydrm/ili9225.c |
2597 |
+index 455fefe012f5..6044a01069ce 100644 |
2598 |
+--- a/drivers/gpu/drm/tinydrm/ili9225.c |
2599 |
++++ b/drivers/gpu/drm/tinydrm/ili9225.c |
2600 |
+@@ -278,7 +278,7 @@ static void ili9225_pipe_disable(struct drm_simple_display_pipe *pipe) |
2601 |
+ mipi->enabled = false; |
2602 |
+ } |
2603 |
+ |
2604 |
+-static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par, |
2605 |
++static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par, |
2606 |
+ size_t num) |
2607 |
+ { |
2608 |
+ struct spi_device *spi = mipi->spi; |
2609 |
+@@ -288,11 +288,11 @@ static int ili9225_dbi_command(struct mipi_dbi *mipi, u8 cmd, u8 *par, |
2610 |
+ |
2611 |
+ gpiod_set_value_cansleep(mipi->dc, 0); |
2612 |
+ speed_hz = mipi_dbi_spi_cmd_max_speed(spi, 1); |
2613 |
+- ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, &cmd, 1); |
2614 |
++ ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, cmd, 1); |
2615 |
+ if (ret || !num) |
2616 |
+ return ret; |
2617 |
+ |
2618 |
+- if (cmd == ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) |
2619 |
++ if (*cmd == ILI9225_WRITE_DATA_TO_GRAM && !mipi->swap_bytes) |
2620 |
+ bpw = 16; |
2621 |
+ |
2622 |
+ gpiod_set_value_cansleep(mipi->dc, 1); |
2623 |
+diff --git a/drivers/gpu/drm/tinydrm/mipi-dbi.c b/drivers/gpu/drm/tinydrm/mipi-dbi.c |
2624 |
+index cb3441e51d5f..e772a8a9da80 100644 |
2625 |
+--- a/drivers/gpu/drm/tinydrm/mipi-dbi.c |
2626 |
++++ b/drivers/gpu/drm/tinydrm/mipi-dbi.c |
2627 |
+@@ -144,16 +144,42 @@ EXPORT_SYMBOL(mipi_dbi_command_read); |
2628 |
+ */ |
2629 |
+ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len) |
2630 |
+ { |
2631 |
++ u8 *cmdbuf; |
2632 |
+ int ret; |
2633 |
+ |
2634 |
++ /* SPI requires dma-safe buffers */ |
2635 |
++ cmdbuf = kmemdup(&cmd, 1, GFP_KERNEL); |
2636 |
++ if (!cmdbuf) |
2637 |
++ return -ENOMEM; |
2638 |
++ |
2639 |
+ mutex_lock(&mipi->cmdlock); |
2640 |
+- ret = mipi->command(mipi, cmd, data, len); |
2641 |
++ ret = mipi->command(mipi, cmdbuf, data, len); |
2642 |
+ mutex_unlock(&mipi->cmdlock); |
2643 |
+ |
2644 |
++ kfree(cmdbuf); |
2645 |
++ |
2646 |
+ return ret; |
2647 |
+ } |
2648 |
+ EXPORT_SYMBOL(mipi_dbi_command_buf); |
2649 |
+ |
2650 |
++/* This should only be used by mipi_dbi_command() */ |
2651 |
++int mipi_dbi_command_stackbuf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len) |
2652 |
++{ |
2653 |
++ u8 *buf; |
2654 |
++ int ret; |
2655 |
++ |
2656 |
++ buf = kmemdup(data, len, GFP_KERNEL); |
2657 |
++ if (!buf) |
2658 |
++ return -ENOMEM; |
2659 |
++ |
2660 |
++ ret = mipi_dbi_command_buf(mipi, cmd, buf, len); |
2661 |
++ |
2662 |
++ kfree(buf); |
2663 |
++ |
2664 |
++ return ret; |
2665 |
++} |
2666 |
++EXPORT_SYMBOL(mipi_dbi_command_stackbuf); |
2667 |
++ |
2668 |
+ /** |
2669 |
+ * mipi_dbi_buf_copy - Copy a framebuffer, transforming it if necessary |
2670 |
+ * @dst: The destination buffer |
2671 |
+@@ -741,18 +767,18 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *mipi, int dc, |
2672 |
+ return 0; |
2673 |
+ } |
2674 |
+ |
2675 |
+-static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 cmd, |
2676 |
++static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 *cmd, |
2677 |
+ u8 *parameters, size_t num) |
2678 |
+ { |
2679 |
+- unsigned int bpw = (cmd == MIPI_DCS_WRITE_MEMORY_START) ? 16 : 8; |
2680 |
++ unsigned int bpw = (*cmd == MIPI_DCS_WRITE_MEMORY_START) ? 16 : 8; |
2681 |
+ int ret; |
2682 |
+ |
2683 |
+- if (mipi_dbi_command_is_read(mipi, cmd)) |
2684 |
++ if (mipi_dbi_command_is_read(mipi, *cmd)) |
2685 |
+ return -ENOTSUPP; |
2686 |
+ |
2687 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, parameters, num); |
2688 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num); |
2689 |
+ |
2690 |
+- ret = mipi_dbi_spi1_transfer(mipi, 0, &cmd, 1, 8); |
2691 |
++ ret = mipi_dbi_spi1_transfer(mipi, 0, cmd, 1, 8); |
2692 |
+ if (ret || !num) |
2693 |
+ return ret; |
2694 |
+ |
2695 |
+@@ -761,7 +787,7 @@ static int mipi_dbi_typec1_command(struct mipi_dbi *mipi, u8 cmd, |
2696 |
+ |
2697 |
+ /* MIPI DBI Type C Option 3 */ |
2698 |
+ |
2699 |
+-static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
2700 |
++static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 *cmd, |
2701 |
+ u8 *data, size_t len) |
2702 |
+ { |
2703 |
+ struct spi_device *spi = mipi->spi; |
2704 |
+@@ -770,7 +796,7 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
2705 |
+ struct spi_transfer tr[2] = { |
2706 |
+ { |
2707 |
+ .speed_hz = speed_hz, |
2708 |
+- .tx_buf = &cmd, |
2709 |
++ .tx_buf = cmd, |
2710 |
+ .len = 1, |
2711 |
+ }, { |
2712 |
+ .speed_hz = speed_hz, |
2713 |
+@@ -788,8 +814,8 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
2714 |
+ * Support non-standard 24-bit and 32-bit Nokia read commands which |
2715 |
+ * start with a dummy clock, so we need to read an extra byte. |
2716 |
+ */ |
2717 |
+- if (cmd == MIPI_DCS_GET_DISPLAY_ID || |
2718 |
+- cmd == MIPI_DCS_GET_DISPLAY_STATUS) { |
2719 |
++ if (*cmd == MIPI_DCS_GET_DISPLAY_ID || |
2720 |
++ *cmd == MIPI_DCS_GET_DISPLAY_STATUS) { |
2721 |
+ if (!(len == 3 || len == 4)) |
2722 |
+ return -EINVAL; |
2723 |
+ |
2724 |
+@@ -819,7 +845,7 @@ static int mipi_dbi_typec3_command_read(struct mipi_dbi *mipi, u8 cmd, |
2725 |
+ data[i] = (buf[i] << 1) | !!(buf[i + 1] & BIT(7)); |
2726 |
+ } |
2727 |
+ |
2728 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, data, len); |
2729 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, data, len); |
2730 |
+ |
2731 |
+ err_free: |
2732 |
+ kfree(buf); |
2733 |
+@@ -827,7 +853,7 @@ err_free: |
2734 |
+ return ret; |
2735 |
+ } |
2736 |
+ |
2737 |
+-static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 cmd, |
2738 |
++static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 *cmd, |
2739 |
+ u8 *par, size_t num) |
2740 |
+ { |
2741 |
+ struct spi_device *spi = mipi->spi; |
2742 |
+@@ -835,18 +861,18 @@ static int mipi_dbi_typec3_command(struct mipi_dbi *mipi, u8 cmd, |
2743 |
+ u32 speed_hz; |
2744 |
+ int ret; |
2745 |
+ |
2746 |
+- if (mipi_dbi_command_is_read(mipi, cmd)) |
2747 |
++ if (mipi_dbi_command_is_read(mipi, *cmd)) |
2748 |
+ return mipi_dbi_typec3_command_read(mipi, cmd, par, num); |
2749 |
+ |
2750 |
+- MIPI_DBI_DEBUG_COMMAND(cmd, par, num); |
2751 |
++ MIPI_DBI_DEBUG_COMMAND(*cmd, par, num); |
2752 |
+ |
2753 |
+ gpiod_set_value_cansleep(mipi->dc, 0); |
2754 |
+ speed_hz = mipi_dbi_spi_cmd_max_speed(spi, 1); |
2755 |
+- ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, &cmd, 1); |
2756 |
++ ret = tinydrm_spi_transfer(spi, speed_hz, NULL, 8, cmd, 1); |
2757 |
+ if (ret || !num) |
2758 |
+ return ret; |
2759 |
+ |
2760 |
+- if (cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes) |
2761 |
++ if (*cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes) |
2762 |
+ bpw = 16; |
2763 |
+ |
2764 |
+ gpiod_set_value_cansleep(mipi->dc, 1); |
2765 |
+diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c |
2766 |
+index 2a85fa68ffea..2a4c6187e675 100644 |
2767 |
+--- a/drivers/gpu/drm/v3d/v3d_drv.c |
2768 |
++++ b/drivers/gpu/drm/v3d/v3d_drv.c |
2769 |
+@@ -305,14 +305,18 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) |
2770 |
+ if (ret) |
2771 |
+ goto dev_destroy; |
2772 |
+ |
2773 |
+- v3d_irq_init(v3d); |
2774 |
++ ret = v3d_irq_init(v3d); |
2775 |
++ if (ret) |
2776 |
++ goto gem_destroy; |
2777 |
+ |
2778 |
+ ret = drm_dev_register(drm, 0); |
2779 |
+ if (ret) |
2780 |
+- goto gem_destroy; |
2781 |
++ goto irq_disable; |
2782 |
+ |
2783 |
+ return 0; |
2784 |
+ |
2785 |
++irq_disable: |
2786 |
++ v3d_irq_disable(v3d); |
2787 |
+ gem_destroy: |
2788 |
+ v3d_gem_destroy(drm); |
2789 |
+ dev_destroy: |
2790 |
+diff --git a/drivers/gpu/drm/v3d/v3d_drv.h b/drivers/gpu/drm/v3d/v3d_drv.h |
2791 |
+index e6fed696ad86..0ad73f4b7509 100644 |
2792 |
+--- a/drivers/gpu/drm/v3d/v3d_drv.h |
2793 |
++++ b/drivers/gpu/drm/v3d/v3d_drv.h |
2794 |
+@@ -284,7 +284,7 @@ void v3d_invalidate_caches(struct v3d_dev *v3d); |
2795 |
+ void v3d_flush_caches(struct v3d_dev *v3d); |
2796 |
+ |
2797 |
+ /* v3d_irq.c */ |
2798 |
+-void v3d_irq_init(struct v3d_dev *v3d); |
2799 |
++int v3d_irq_init(struct v3d_dev *v3d); |
2800 |
+ void v3d_irq_enable(struct v3d_dev *v3d); |
2801 |
+ void v3d_irq_disable(struct v3d_dev *v3d); |
2802 |
+ void v3d_irq_reset(struct v3d_dev *v3d); |
2803 |
+diff --git a/drivers/gpu/drm/v3d/v3d_irq.c b/drivers/gpu/drm/v3d/v3d_irq.c |
2804 |
+index e07514eb11b5..22be0f2dff99 100644 |
2805 |
+--- a/drivers/gpu/drm/v3d/v3d_irq.c |
2806 |
++++ b/drivers/gpu/drm/v3d/v3d_irq.c |
2807 |
+@@ -137,7 +137,7 @@ v3d_hub_irq(int irq, void *arg) |
2808 |
+ return status; |
2809 |
+ } |
2810 |
+ |
2811 |
+-void |
2812 |
++int |
2813 |
+ v3d_irq_init(struct v3d_dev *v3d) |
2814 |
+ { |
2815 |
+ int ret, core; |
2816 |
+@@ -154,13 +154,22 @@ v3d_irq_init(struct v3d_dev *v3d) |
2817 |
+ ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 0), |
2818 |
+ v3d_hub_irq, IRQF_SHARED, |
2819 |
+ "v3d_hub", v3d); |
2820 |
++ if (ret) |
2821 |
++ goto fail; |
2822 |
++ |
2823 |
+ ret = devm_request_irq(v3d->dev, platform_get_irq(v3d->pdev, 1), |
2824 |
+ v3d_irq, IRQF_SHARED, |
2825 |
+ "v3d_core0", v3d); |
2826 |
+ if (ret) |
2827 |
+- dev_err(v3d->dev, "IRQ setup failed: %d\n", ret); |
2828 |
++ goto fail; |
2829 |
+ |
2830 |
+ v3d_irq_enable(v3d); |
2831 |
++ return 0; |
2832 |
++ |
2833 |
++fail: |
2834 |
++ if (ret != -EPROBE_DEFER) |
2835 |
++ dev_err(v3d->dev, "IRQ setup failed: %d\n", ret); |
2836 |
++ return ret; |
2837 |
+ } |
2838 |
+ |
2839 |
+ void |
2840 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
2841 |
+index 44564f61e9cc..861375561156 100644 |
2842 |
+--- a/drivers/hid/hid-core.c |
2843 |
++++ b/drivers/hid/hid-core.c |
2844 |
+@@ -215,13 +215,14 @@ static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) |
2845 |
+ * Add a usage to the temporary parser table. |
2846 |
+ */ |
2847 |
+ |
2848 |
+-static int hid_add_usage(struct hid_parser *parser, unsigned usage) |
2849 |
++static int hid_add_usage(struct hid_parser *parser, unsigned usage, u8 size) |
2850 |
+ { |
2851 |
+ if (parser->local.usage_index >= HID_MAX_USAGES) { |
2852 |
+ hid_err(parser->device, "usage index exceeded\n"); |
2853 |
+ return -1; |
2854 |
+ } |
2855 |
+ parser->local.usage[parser->local.usage_index] = usage; |
2856 |
++ parser->local.usage_size[parser->local.usage_index] = size; |
2857 |
+ parser->local.collection_index[parser->local.usage_index] = |
2858 |
+ parser->collection_stack_ptr ? |
2859 |
+ parser->collection_stack[parser->collection_stack_ptr - 1] : 0; |
2860 |
+@@ -482,10 +483,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
2861 |
+ return 0; |
2862 |
+ } |
2863 |
+ |
2864 |
+- if (item->size <= 2) |
2865 |
+- data = (parser->global.usage_page << 16) + data; |
2866 |
+- |
2867 |
+- return hid_add_usage(parser, data); |
2868 |
++ return hid_add_usage(parser, data, item->size); |
2869 |
+ |
2870 |
+ case HID_LOCAL_ITEM_TAG_USAGE_MINIMUM: |
2871 |
+ |
2872 |
+@@ -494,9 +492,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
2873 |
+ return 0; |
2874 |
+ } |
2875 |
+ |
2876 |
+- if (item->size <= 2) |
2877 |
+- data = (parser->global.usage_page << 16) + data; |
2878 |
+- |
2879 |
+ parser->local.usage_minimum = data; |
2880 |
+ return 0; |
2881 |
+ |
2882 |
+@@ -507,9 +502,6 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
2883 |
+ return 0; |
2884 |
+ } |
2885 |
+ |
2886 |
+- if (item->size <= 2) |
2887 |
+- data = (parser->global.usage_page << 16) + data; |
2888 |
+- |
2889 |
+ count = data - parser->local.usage_minimum; |
2890 |
+ if (count + parser->local.usage_index >= HID_MAX_USAGES) { |
2891 |
+ /* |
2892 |
+@@ -529,7 +521,7 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
2893 |
+ } |
2894 |
+ |
2895 |
+ for (n = parser->local.usage_minimum; n <= data; n++) |
2896 |
+- if (hid_add_usage(parser, n)) { |
2897 |
++ if (hid_add_usage(parser, n, item->size)) { |
2898 |
+ dbg_hid("hid_add_usage failed\n"); |
2899 |
+ return -1; |
2900 |
+ } |
2901 |
+@@ -543,6 +535,22 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) |
2902 |
+ return 0; |
2903 |
+ } |
2904 |
+ |
2905 |
++/* |
2906 |
++ * Concatenate Usage Pages into Usages where relevant: |
2907 |
++ * As per specification, 6.2.2.8: "When the parser encounters a main item it |
2908 |
++ * concatenates the last declared Usage Page with a Usage to form a complete |
2909 |
++ * usage value." |
2910 |
++ */ |
2911 |
++ |
2912 |
++static void hid_concatenate_usage_page(struct hid_parser *parser) |
2913 |
++{ |
2914 |
++ int i; |
2915 |
++ |
2916 |
++ for (i = 0; i < parser->local.usage_index; i++) |
2917 |
++ if (parser->local.usage_size[i] <= 2) |
2918 |
++ parser->local.usage[i] += parser->global.usage_page << 16; |
2919 |
++} |
2920 |
++ |
2921 |
+ /* |
2922 |
+ * Process a main item. |
2923 |
+ */ |
2924 |
+@@ -552,6 +560,8 @@ static int hid_parser_main(struct hid_parser *parser, struct hid_item *item) |
2925 |
+ __u32 data; |
2926 |
+ int ret; |
2927 |
+ |
2928 |
++ hid_concatenate_usage_page(parser); |
2929 |
++ |
2930 |
+ data = item_udata(item); |
2931 |
+ |
2932 |
+ switch (item->tag) { |
2933 |
+@@ -761,6 +771,8 @@ static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) |
2934 |
+ __u32 data; |
2935 |
+ int i; |
2936 |
+ |
2937 |
++ hid_concatenate_usage_page(parser); |
2938 |
++ |
2939 |
+ data = item_udata(item); |
2940 |
+ |
2941 |
+ switch (item->tag) { |
2942 |
+diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c |
2943 |
+index 8425d3548a41..e642cfaf303b 100644 |
2944 |
+--- a/drivers/hid/hid-logitech-hidpp.c |
2945 |
++++ b/drivers/hid/hid-logitech-hidpp.c |
2946 |
+@@ -725,13 +725,16 @@ static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, |
2947 |
+ |
2948 |
+ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
2949 |
+ { |
2950 |
++ const u8 ping_byte = 0x5a; |
2951 |
++ u8 ping_data[3] = { 0, 0, ping_byte }; |
2952 |
+ struct hidpp_report response; |
2953 |
+ int ret; |
2954 |
+ |
2955 |
+- ret = hidpp_send_fap_command_sync(hidpp, |
2956 |
++ ret = hidpp_send_rap_command_sync(hidpp, |
2957 |
++ REPORT_ID_HIDPP_SHORT, |
2958 |
+ HIDPP_PAGE_ROOT_IDX, |
2959 |
+ CMD_ROOT_GET_PROTOCOL_VERSION, |
2960 |
+- NULL, 0, &response); |
2961 |
++ ping_data, sizeof(ping_data), &response); |
2962 |
+ |
2963 |
+ if (ret == HIDPP_ERROR_INVALID_SUBID) { |
2964 |
+ hidpp->protocol_major = 1; |
2965 |
+@@ -751,8 +754,14 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) |
2966 |
+ if (ret) |
2967 |
+ return ret; |
2968 |
+ |
2969 |
+- hidpp->protocol_major = response.fap.params[0]; |
2970 |
+- hidpp->protocol_minor = response.fap.params[1]; |
2971 |
++ if (response.rap.params[2] != ping_byte) { |
2972 |
++ hid_err(hidpp->hid_dev, "%s: ping mismatch 0x%02x != 0x%02x\n", |
2973 |
++ __func__, response.rap.params[2], ping_byte); |
2974 |
++ return -EPROTO; |
2975 |
++ } |
2976 |
++ |
2977 |
++ hidpp->protocol_major = response.rap.params[0]; |
2978 |
++ hidpp->protocol_minor = response.rap.params[1]; |
2979 |
+ |
2980 |
+ return ret; |
2981 |
+ } |
2982 |
+@@ -901,7 +910,11 @@ static int hidpp_map_battery_level(int capacity) |
2983 |
+ { |
2984 |
+ if (capacity < 11) |
2985 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_CRITICAL; |
2986 |
+- else if (capacity < 31) |
2987 |
++ /* |
2988 |
++ * The spec says this should be < 31 but some devices report 30 |
2989 |
++ * with brand new batteries and Windows reports 30 as "Good". |
2990 |
++ */ |
2991 |
++ else if (capacity < 30) |
2992 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_LOW; |
2993 |
+ else if (capacity < 81) |
2994 |
+ return POWER_SUPPLY_CAPACITY_LEVEL_NORMAL; |
2995 |
+diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c |
2996 |
+index 73c681162653..623736d2a7c1 100644 |
2997 |
+--- a/drivers/hwmon/f71805f.c |
2998 |
++++ b/drivers/hwmon/f71805f.c |
2999 |
+@@ -96,17 +96,23 @@ superio_select(int base, int ld) |
3000 |
+ outb(ld, base + 1); |
3001 |
+ } |
3002 |
+ |
3003 |
+-static inline void |
3004 |
++static inline int |
3005 |
+ superio_enter(int base) |
3006 |
+ { |
3007 |
++ if (!request_muxed_region(base, 2, DRVNAME)) |
3008 |
++ return -EBUSY; |
3009 |
++ |
3010 |
+ outb(0x87, base); |
3011 |
+ outb(0x87, base); |
3012 |
++ |
3013 |
++ return 0; |
3014 |
+ } |
3015 |
+ |
3016 |
+ static inline void |
3017 |
+ superio_exit(int base) |
3018 |
+ { |
3019 |
+ outb(0xaa, base); |
3020 |
++ release_region(base, 2); |
3021 |
+ } |
3022 |
+ |
3023 |
+ /* |
3024 |
+@@ -1561,7 +1567,7 @@ exit: |
3025 |
+ static int __init f71805f_find(int sioaddr, unsigned short *address, |
3026 |
+ struct f71805f_sio_data *sio_data) |
3027 |
+ { |
3028 |
+- int err = -ENODEV; |
3029 |
++ int err; |
3030 |
+ u16 devid; |
3031 |
+ |
3032 |
+ static const char * const names[] = { |
3033 |
+@@ -1569,8 +1575,11 @@ static int __init f71805f_find(int sioaddr, unsigned short *address, |
3034 |
+ "F71872F/FG or F71806F/FG", |
3035 |
+ }; |
3036 |
+ |
3037 |
+- superio_enter(sioaddr); |
3038 |
++ err = superio_enter(sioaddr); |
3039 |
++ if (err) |
3040 |
++ return err; |
3041 |
+ |
3042 |
++ err = -ENODEV; |
3043 |
+ devid = superio_inw(sioaddr, SIO_REG_MANID); |
3044 |
+ if (devid != SIO_FINTEK_ID) |
3045 |
+ goto exit; |
3046 |
+diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c |
3047 |
+index dc5a9d5ada51..81a05cd1a512 100644 |
3048 |
+--- a/drivers/hwmon/pc87427.c |
3049 |
++++ b/drivers/hwmon/pc87427.c |
3050 |
+@@ -106,6 +106,13 @@ static const char *logdev_str[2] = { DRVNAME " FMC", DRVNAME " HMC" }; |
3051 |
+ #define LD_IN 1 |
3052 |
+ #define LD_TEMP 1 |
3053 |
+ |
3054 |
++static inline int superio_enter(int sioaddr) |
3055 |
++{ |
3056 |
++ if (!request_muxed_region(sioaddr, 2, DRVNAME)) |
3057 |
++ return -EBUSY; |
3058 |
++ return 0; |
3059 |
++} |
3060 |
++ |
3061 |
+ static inline void superio_outb(int sioaddr, int reg, int val) |
3062 |
+ { |
3063 |
+ outb(reg, sioaddr); |
3064 |
+@@ -122,6 +129,7 @@ static inline void superio_exit(int sioaddr) |
3065 |
+ { |
3066 |
+ outb(0x02, sioaddr); |
3067 |
+ outb(0x02, sioaddr + 1); |
3068 |
++ release_region(sioaddr, 2); |
3069 |
+ } |
3070 |
+ |
3071 |
+ /* |
3072 |
+@@ -1220,7 +1228,11 @@ static int __init pc87427_find(int sioaddr, struct pc87427_sio_data *sio_data) |
3073 |
+ { |
3074 |
+ u16 val; |
3075 |
+ u8 cfg, cfg_b; |
3076 |
+- int i, err = 0; |
3077 |
++ int i, err; |
3078 |
++ |
3079 |
++ err = superio_enter(sioaddr); |
3080 |
++ if (err) |
3081 |
++ return err; |
3082 |
+ |
3083 |
+ /* Identify device */ |
3084 |
+ val = force_id ? force_id : superio_inb(sioaddr, SIOREG_DEVID); |
3085 |
+diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c |
3086 |
+index 6bd200756560..cbdb5c4991ae 100644 |
3087 |
+--- a/drivers/hwmon/smsc47b397.c |
3088 |
++++ b/drivers/hwmon/smsc47b397.c |
3089 |
+@@ -72,14 +72,19 @@ static inline void superio_select(int ld) |
3090 |
+ superio_outb(0x07, ld); |
3091 |
+ } |
3092 |
+ |
3093 |
+-static inline void superio_enter(void) |
3094 |
++static inline int superio_enter(void) |
3095 |
+ { |
3096 |
++ if (!request_muxed_region(REG, 2, DRVNAME)) |
3097 |
++ return -EBUSY; |
3098 |
++ |
3099 |
+ outb(0x55, REG); |
3100 |
++ return 0; |
3101 |
+ } |
3102 |
+ |
3103 |
+ static inline void superio_exit(void) |
3104 |
+ { |
3105 |
+ outb(0xAA, REG); |
3106 |
++ release_region(REG, 2); |
3107 |
+ } |
3108 |
+ |
3109 |
+ #define SUPERIO_REG_DEVID 0x20 |
3110 |
+@@ -300,8 +305,12 @@ static int __init smsc47b397_find(void) |
3111 |
+ u8 id, rev; |
3112 |
+ char *name; |
3113 |
+ unsigned short addr; |
3114 |
++ int err; |
3115 |
++ |
3116 |
++ err = superio_enter(); |
3117 |
++ if (err) |
3118 |
++ return err; |
3119 |
+ |
3120 |
+- superio_enter(); |
3121 |
+ id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
3122 |
+ |
3123 |
+ switch (id) { |
3124 |
+diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c |
3125 |
+index c7b6a425e2c0..5eeac9853d0a 100644 |
3126 |
+--- a/drivers/hwmon/smsc47m1.c |
3127 |
++++ b/drivers/hwmon/smsc47m1.c |
3128 |
+@@ -73,16 +73,21 @@ superio_inb(int reg) |
3129 |
+ /* logical device for fans is 0x0A */ |
3130 |
+ #define superio_select() superio_outb(0x07, 0x0A) |
3131 |
+ |
3132 |
+-static inline void |
3133 |
++static inline int |
3134 |
+ superio_enter(void) |
3135 |
+ { |
3136 |
++ if (!request_muxed_region(REG, 2, DRVNAME)) |
3137 |
++ return -EBUSY; |
3138 |
++ |
3139 |
+ outb(0x55, REG); |
3140 |
++ return 0; |
3141 |
+ } |
3142 |
+ |
3143 |
+ static inline void |
3144 |
+ superio_exit(void) |
3145 |
+ { |
3146 |
+ outb(0xAA, REG); |
3147 |
++ release_region(REG, 2); |
3148 |
+ } |
3149 |
+ |
3150 |
+ #define SUPERIO_REG_ACT 0x30 |
3151 |
+@@ -531,8 +536,12 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
3152 |
+ { |
3153 |
+ u8 val; |
3154 |
+ unsigned short addr; |
3155 |
++ int err; |
3156 |
++ |
3157 |
++ err = superio_enter(); |
3158 |
++ if (err) |
3159 |
++ return err; |
3160 |
+ |
3161 |
+- superio_enter(); |
3162 |
+ val = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID); |
3163 |
+ |
3164 |
+ /* |
3165 |
+@@ -608,13 +617,14 @@ static int __init smsc47m1_find(struct smsc47m1_sio_data *sio_data) |
3166 |
+ static void smsc47m1_restore(const struct smsc47m1_sio_data *sio_data) |
3167 |
+ { |
3168 |
+ if ((sio_data->activate & 0x01) == 0) { |
3169 |
+- superio_enter(); |
3170 |
+- superio_select(); |
3171 |
+- |
3172 |
+- pr_info("Disabling device\n"); |
3173 |
+- superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
3174 |
+- |
3175 |
+- superio_exit(); |
3176 |
++ if (!superio_enter()) { |
3177 |
++ superio_select(); |
3178 |
++ pr_info("Disabling device\n"); |
3179 |
++ superio_outb(SUPERIO_REG_ACT, sio_data->activate); |
3180 |
++ superio_exit(); |
3181 |
++ } else { |
3182 |
++ pr_warn("Failed to disable device\n"); |
3183 |
++ } |
3184 |
+ } |
3185 |
+ } |
3186 |
+ |
3187 |
+diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c |
3188 |
+index 3a6bfa51cb94..95d5e8ec8b7f 100644 |
3189 |
+--- a/drivers/hwmon/vt1211.c |
3190 |
++++ b/drivers/hwmon/vt1211.c |
3191 |
+@@ -226,15 +226,21 @@ static inline void superio_select(int sio_cip, int ldn) |
3192 |
+ outb(ldn, sio_cip + 1); |
3193 |
+ } |
3194 |
+ |
3195 |
+-static inline void superio_enter(int sio_cip) |
3196 |
++static inline int superio_enter(int sio_cip) |
3197 |
+ { |
3198 |
++ if (!request_muxed_region(sio_cip, 2, DRVNAME)) |
3199 |
++ return -EBUSY; |
3200 |
++ |
3201 |
+ outb(0x87, sio_cip); |
3202 |
+ outb(0x87, sio_cip); |
3203 |
++ |
3204 |
++ return 0; |
3205 |
+ } |
3206 |
+ |
3207 |
+ static inline void superio_exit(int sio_cip) |
3208 |
+ { |
3209 |
+ outb(0xaa, sio_cip); |
3210 |
++ release_region(sio_cip, 2); |
3211 |
+ } |
3212 |
+ |
3213 |
+ /* --------------------------------------------------------------------- |
3214 |
+@@ -1282,11 +1288,14 @@ EXIT: |
3215 |
+ |
3216 |
+ static int __init vt1211_find(int sio_cip, unsigned short *address) |
3217 |
+ { |
3218 |
+- int err = -ENODEV; |
3219 |
++ int err; |
3220 |
+ int devid; |
3221 |
+ |
3222 |
+- superio_enter(sio_cip); |
3223 |
++ err = superio_enter(sio_cip); |
3224 |
++ if (err) |
3225 |
++ return err; |
3226 |
+ |
3227 |
++ err = -ENODEV; |
3228 |
+ devid = force_id ? force_id : superio_inb(sio_cip, SIO_VT1211_DEVID); |
3229 |
+ if (devid != SIO_VT1211_ID) |
3230 |
+ goto EXIT; |
3231 |
+diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig |
3232 |
+index 4a754921fb6f..9421c1ec86f7 100644 |
3233 |
+--- a/drivers/iio/adc/Kconfig |
3234 |
++++ b/drivers/iio/adc/Kconfig |
3235 |
+@@ -696,6 +696,7 @@ config STM32_DFSDM_ADC |
3236 |
+ depends on (ARCH_STM32 && OF) || COMPILE_TEST |
3237 |
+ select STM32_DFSDM_CORE |
3238 |
+ select REGMAP_MMIO |
3239 |
++ select IIO_BUFFER |
3240 |
+ select IIO_BUFFER_HW_CONSUMER |
3241 |
+ help |
3242 |
+ Select this option to support ADCSigma delta modulator for |
3243 |
+diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c |
3244 |
+index ae2a5097f449..25af4c76b57f 100644 |
3245 |
+--- a/drivers/iio/adc/ad_sigma_delta.c |
3246 |
++++ b/drivers/iio/adc/ad_sigma_delta.c |
3247 |
+@@ -62,7 +62,7 @@ int ad_sd_write_reg(struct ad_sigma_delta *sigma_delta, unsigned int reg, |
3248 |
+ struct spi_transfer t = { |
3249 |
+ .tx_buf = data, |
3250 |
+ .len = size + 1, |
3251 |
+- .cs_change = sigma_delta->bus_locked, |
3252 |
++ .cs_change = sigma_delta->keep_cs_asserted, |
3253 |
+ }; |
3254 |
+ struct spi_message m; |
3255 |
+ int ret; |
3256 |
+@@ -218,6 +218,7 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
3257 |
+ |
3258 |
+ spi_bus_lock(sigma_delta->spi->master); |
3259 |
+ sigma_delta->bus_locked = true; |
3260 |
++ sigma_delta->keep_cs_asserted = true; |
3261 |
+ reinit_completion(&sigma_delta->completion); |
3262 |
+ |
3263 |
+ ret = ad_sigma_delta_set_mode(sigma_delta, mode); |
3264 |
+@@ -235,9 +236,10 @@ static int ad_sd_calibrate(struct ad_sigma_delta *sigma_delta, |
3265 |
+ ret = 0; |
3266 |
+ } |
3267 |
+ out: |
3268 |
++ sigma_delta->keep_cs_asserted = false; |
3269 |
++ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
3270 |
+ sigma_delta->bus_locked = false; |
3271 |
+ spi_bus_unlock(sigma_delta->spi->master); |
3272 |
+- ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
3273 |
+ |
3274 |
+ return ret; |
3275 |
+ } |
3276 |
+@@ -289,6 +291,7 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
3277 |
+ |
3278 |
+ spi_bus_lock(sigma_delta->spi->master); |
3279 |
+ sigma_delta->bus_locked = true; |
3280 |
++ sigma_delta->keep_cs_asserted = true; |
3281 |
+ reinit_completion(&sigma_delta->completion); |
3282 |
+ |
3283 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_SINGLE); |
3284 |
+@@ -298,9 +301,6 @@ int ad_sigma_delta_single_conversion(struct iio_dev *indio_dev, |
3285 |
+ ret = wait_for_completion_interruptible_timeout( |
3286 |
+ &sigma_delta->completion, HZ); |
3287 |
+ |
3288 |
+- sigma_delta->bus_locked = false; |
3289 |
+- spi_bus_unlock(sigma_delta->spi->master); |
3290 |
+- |
3291 |
+ if (ret == 0) |
3292 |
+ ret = -EIO; |
3293 |
+ if (ret < 0) |
3294 |
+@@ -316,7 +316,10 @@ out: |
3295 |
+ sigma_delta->irq_dis = true; |
3296 |
+ } |
3297 |
+ |
3298 |
++ sigma_delta->keep_cs_asserted = false; |
3299 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
3300 |
++ sigma_delta->bus_locked = false; |
3301 |
++ spi_bus_unlock(sigma_delta->spi->master); |
3302 |
+ mutex_unlock(&indio_dev->mlock); |
3303 |
+ |
3304 |
+ if (ret) |
3305 |
+@@ -353,6 +356,8 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) |
3306 |
+ |
3307 |
+ spi_bus_lock(sigma_delta->spi->master); |
3308 |
+ sigma_delta->bus_locked = true; |
3309 |
++ sigma_delta->keep_cs_asserted = true; |
3310 |
++ |
3311 |
+ ret = ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_CONTINUOUS); |
3312 |
+ if (ret) |
3313 |
+ goto err_unlock; |
3314 |
+@@ -381,6 +386,7 @@ static int ad_sd_buffer_postdisable(struct iio_dev *indio_dev) |
3315 |
+ sigma_delta->irq_dis = true; |
3316 |
+ } |
3317 |
+ |
3318 |
++ sigma_delta->keep_cs_asserted = false; |
3319 |
+ ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); |
3320 |
+ |
3321 |
+ sigma_delta->bus_locked = false; |
3322 |
+diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c |
3323 |
+index a5bd5944bc66..c9cd7e5c1b61 100644 |
3324 |
+--- a/drivers/iio/adc/ti-ads7950.c |
3325 |
++++ b/drivers/iio/adc/ti-ads7950.c |
3326 |
+@@ -56,6 +56,9 @@ struct ti_ads7950_state { |
3327 |
+ struct spi_message ring_msg; |
3328 |
+ struct spi_message scan_single_msg; |
3329 |
+ |
3330 |
++ /* Lock to protect the spi xfer buffers */ |
3331 |
++ struct mutex slock; |
3332 |
++ |
3333 |
+ struct regulator *reg; |
3334 |
+ unsigned int vref_mv; |
3335 |
+ |
3336 |
+@@ -277,6 +280,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p) |
3337 |
+ struct ti_ads7950_state *st = iio_priv(indio_dev); |
3338 |
+ int ret; |
3339 |
+ |
3340 |
++ mutex_lock(&st->slock); |
3341 |
+ ret = spi_sync(st->spi, &st->ring_msg); |
3342 |
+ if (ret < 0) |
3343 |
+ goto out; |
3344 |
+@@ -285,6 +289,7 @@ static irqreturn_t ti_ads7950_trigger_handler(int irq, void *p) |
3345 |
+ iio_get_time_ns(indio_dev)); |
3346 |
+ |
3347 |
+ out: |
3348 |
++ mutex_unlock(&st->slock); |
3349 |
+ iio_trigger_notify_done(indio_dev->trig); |
3350 |
+ |
3351 |
+ return IRQ_HANDLED; |
3352 |
+@@ -295,7 +300,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch) |
3353 |
+ struct ti_ads7950_state *st = iio_priv(indio_dev); |
3354 |
+ int ret, cmd; |
3355 |
+ |
3356 |
+- mutex_lock(&indio_dev->mlock); |
3357 |
++ mutex_lock(&st->slock); |
3358 |
+ |
3359 |
+ cmd = TI_ADS7950_CR_WRITE | TI_ADS7950_CR_CHAN(ch) | st->settings; |
3360 |
+ st->single_tx = cpu_to_be16(cmd); |
3361 |
+@@ -307,7 +312,7 @@ static int ti_ads7950_scan_direct(struct iio_dev *indio_dev, unsigned int ch) |
3362 |
+ ret = be16_to_cpu(st->single_rx); |
3363 |
+ |
3364 |
+ out: |
3365 |
+- mutex_unlock(&indio_dev->mlock); |
3366 |
++ mutex_unlock(&st->slock); |
3367 |
+ |
3368 |
+ return ret; |
3369 |
+ } |
3370 |
+@@ -423,16 +428,19 @@ static int ti_ads7950_probe(struct spi_device *spi) |
3371 |
+ if (ACPI_COMPANION(&spi->dev)) |
3372 |
+ st->vref_mv = TI_ADS7950_VA_MV_ACPI_DEFAULT; |
3373 |
+ |
3374 |
++ mutex_init(&st->slock); |
3375 |
++ |
3376 |
+ st->reg = devm_regulator_get(&spi->dev, "vref"); |
3377 |
+ if (IS_ERR(st->reg)) { |
3378 |
+ dev_err(&spi->dev, "Failed get get regulator \"vref\"\n"); |
3379 |
+- return PTR_ERR(st->reg); |
3380 |
++ ret = PTR_ERR(st->reg); |
3381 |
++ goto error_destroy_mutex; |
3382 |
+ } |
3383 |
+ |
3384 |
+ ret = regulator_enable(st->reg); |
3385 |
+ if (ret) { |
3386 |
+ dev_err(&spi->dev, "Failed to enable regulator \"vref\"\n"); |
3387 |
+- return ret; |
3388 |
++ goto error_destroy_mutex; |
3389 |
+ } |
3390 |
+ |
3391 |
+ ret = iio_triggered_buffer_setup(indio_dev, NULL, |
3392 |
+@@ -454,6 +462,8 @@ error_cleanup_ring: |
3393 |
+ iio_triggered_buffer_cleanup(indio_dev); |
3394 |
+ error_disable_reg: |
3395 |
+ regulator_disable(st->reg); |
3396 |
++error_destroy_mutex: |
3397 |
++ mutex_destroy(&st->slock); |
3398 |
+ |
3399 |
+ return ret; |
3400 |
+ } |
3401 |
+@@ -466,6 +476,7 @@ static int ti_ads7950_remove(struct spi_device *spi) |
3402 |
+ iio_device_unregister(indio_dev); |
3403 |
+ iio_triggered_buffer_cleanup(indio_dev); |
3404 |
+ regulator_disable(st->reg); |
3405 |
++ mutex_destroy(&st->slock); |
3406 |
+ |
3407 |
+ return 0; |
3408 |
+ } |
3409 |
+diff --git a/drivers/iio/common/ssp_sensors/ssp_iio.c b/drivers/iio/common/ssp_sensors/ssp_iio.c |
3410 |
+index 645f2e3975db..e38f704d88b7 100644 |
3411 |
+--- a/drivers/iio/common/ssp_sensors/ssp_iio.c |
3412 |
++++ b/drivers/iio/common/ssp_sensors/ssp_iio.c |
3413 |
+@@ -81,7 +81,7 @@ int ssp_common_process_data(struct iio_dev *indio_dev, void *buf, |
3414 |
+ unsigned int len, int64_t timestamp) |
3415 |
+ { |
3416 |
+ __le32 time; |
3417 |
+- int64_t calculated_time; |
3418 |
++ int64_t calculated_time = 0; |
3419 |
+ struct ssp_sensor_data *spd = iio_priv(indio_dev); |
3420 |
+ |
3421 |
+ if (indio_dev->scan_bytes == 0) |
3422 |
+diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c |
3423 |
+index 3de7f4426ac4..86abba5827a2 100644 |
3424 |
+--- a/drivers/iio/magnetometer/hmc5843_i2c.c |
3425 |
++++ b/drivers/iio/magnetometer/hmc5843_i2c.c |
3426 |
+@@ -58,8 +58,13 @@ static const struct regmap_config hmc5843_i2c_regmap_config = { |
3427 |
+ static int hmc5843_i2c_probe(struct i2c_client *cli, |
3428 |
+ const struct i2c_device_id *id) |
3429 |
+ { |
3430 |
++ struct regmap *regmap = devm_regmap_init_i2c(cli, |
3431 |
++ &hmc5843_i2c_regmap_config); |
3432 |
++ if (IS_ERR(regmap)) |
3433 |
++ return PTR_ERR(regmap); |
3434 |
++ |
3435 |
+ return hmc5843_common_probe(&cli->dev, |
3436 |
+- devm_regmap_init_i2c(cli, &hmc5843_i2c_regmap_config), |
3437 |
++ regmap, |
3438 |
+ id->driver_data, id->name); |
3439 |
+ } |
3440 |
+ |
3441 |
+diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c |
3442 |
+index 535f03a70d63..79b2b707f90e 100644 |
3443 |
+--- a/drivers/iio/magnetometer/hmc5843_spi.c |
3444 |
++++ b/drivers/iio/magnetometer/hmc5843_spi.c |
3445 |
+@@ -58,6 +58,7 @@ static const struct regmap_config hmc5843_spi_regmap_config = { |
3446 |
+ static int hmc5843_spi_probe(struct spi_device *spi) |
3447 |
+ { |
3448 |
+ int ret; |
3449 |
++ struct regmap *regmap; |
3450 |
+ const struct spi_device_id *id = spi_get_device_id(spi); |
3451 |
+ |
3452 |
+ spi->mode = SPI_MODE_3; |
3453 |
+@@ -67,8 +68,12 @@ static int hmc5843_spi_probe(struct spi_device *spi) |
3454 |
+ if (ret) |
3455 |
+ return ret; |
3456 |
+ |
3457 |
++ regmap = devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config); |
3458 |
++ if (IS_ERR(regmap)) |
3459 |
++ return PTR_ERR(regmap); |
3460 |
++ |
3461 |
+ return hmc5843_common_probe(&spi->dev, |
3462 |
+- devm_regmap_init_spi(spi, &hmc5843_spi_regmap_config), |
3463 |
++ regmap, |
3464 |
+ id->driver_data, id->name); |
3465 |
+ } |
3466 |
+ |
3467 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
3468 |
+index 6f5be7802476..39dc7be56884 100644 |
3469 |
+--- a/drivers/infiniband/core/cma.c |
3470 |
++++ b/drivers/infiniband/core/cma.c |
3471 |
+@@ -1078,18 +1078,31 @@ static inline bool cma_any_addr(const struct sockaddr *addr) |
3472 |
+ return cma_zero_addr(addr) || cma_loopback_addr(addr); |
3473 |
+ } |
3474 |
+ |
3475 |
+-static int cma_addr_cmp(struct sockaddr *src, struct sockaddr *dst) |
3476 |
++static int cma_addr_cmp(const struct sockaddr *src, const struct sockaddr *dst) |
3477 |
+ { |
3478 |
+ if (src->sa_family != dst->sa_family) |
3479 |
+ return -1; |
3480 |
+ |
3481 |
+ switch (src->sa_family) { |
3482 |
+ case AF_INET: |
3483 |
+- return ((struct sockaddr_in *) src)->sin_addr.s_addr != |
3484 |
+- ((struct sockaddr_in *) dst)->sin_addr.s_addr; |
3485 |
+- case AF_INET6: |
3486 |
+- return ipv6_addr_cmp(&((struct sockaddr_in6 *) src)->sin6_addr, |
3487 |
+- &((struct sockaddr_in6 *) dst)->sin6_addr); |
3488 |
++ return ((struct sockaddr_in *)src)->sin_addr.s_addr != |
3489 |
++ ((struct sockaddr_in *)dst)->sin_addr.s_addr; |
3490 |
++ case AF_INET6: { |
3491 |
++ struct sockaddr_in6 *src_addr6 = (struct sockaddr_in6 *)src; |
3492 |
++ struct sockaddr_in6 *dst_addr6 = (struct sockaddr_in6 *)dst; |
3493 |
++ bool link_local; |
3494 |
++ |
3495 |
++ if (ipv6_addr_cmp(&src_addr6->sin6_addr, |
3496 |
++ &dst_addr6->sin6_addr)) |
3497 |
++ return 1; |
3498 |
++ link_local = ipv6_addr_type(&dst_addr6->sin6_addr) & |
3499 |
++ IPV6_ADDR_LINKLOCAL; |
3500 |
++ /* Link local must match their scope_ids */ |
3501 |
++ return link_local ? (src_addr6->sin6_scope_id != |
3502 |
++ dst_addr6->sin6_scope_id) : |
3503 |
++ 0; |
3504 |
++ } |
3505 |
++ |
3506 |
+ default: |
3507 |
+ return ib_addr_cmp(&((struct sockaddr_ib *) src)->sib_addr, |
3508 |
+ &((struct sockaddr_ib *) dst)->sib_addr); |
3509 |
+diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c |
3510 |
+index a68569ec86bf..3be6405d9855 100644 |
3511 |
+--- a/drivers/infiniband/hw/cxgb4/cm.c |
3512 |
++++ b/drivers/infiniband/hw/cxgb4/cm.c |
3513 |
+@@ -458,6 +458,8 @@ static struct sk_buff *get_skb(struct sk_buff *skb, int len, gfp_t gfp) |
3514 |
+ skb_reset_transport_header(skb); |
3515 |
+ } else { |
3516 |
+ skb = alloc_skb(len, gfp); |
3517 |
++ if (!skb) |
3518 |
++ return NULL; |
3519 |
+ } |
3520 |
+ t4_set_arp_err_handler(skb, NULL, NULL); |
3521 |
+ return skb; |
3522 |
+diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c |
3523 |
+index da786eb18558..368f4f08b686 100644 |
3524 |
+--- a/drivers/infiniband/hw/hfi1/init.c |
3525 |
++++ b/drivers/infiniband/hw/hfi1/init.c |
3526 |
+@@ -798,7 +798,8 @@ static int create_workqueues(struct hfi1_devdata *dd) |
3527 |
+ ppd->hfi1_wq = |
3528 |
+ alloc_workqueue( |
3529 |
+ "hfi%d_%d", |
3530 |
+- WQ_SYSFS | WQ_HIGHPRI | WQ_CPU_INTENSIVE, |
3531 |
++ WQ_SYSFS | WQ_HIGHPRI | WQ_CPU_INTENSIVE | |
3532 |
++ WQ_MEM_RECLAIM, |
3533 |
+ HFI1_MAX_ACTIVE_WORKQUEUE_ENTRIES, |
3534 |
+ dd->unit, pidx); |
3535 |
+ if (!ppd->hfi1_wq) |
3536 |
+diff --git a/drivers/infiniband/hw/hns/hns_roce_ah.c b/drivers/infiniband/hw/hns/hns_roce_ah.c |
3537 |
+index 0d96c5bb38cd..d2d4ab9ab071 100644 |
3538 |
+--- a/drivers/infiniband/hw/hns/hns_roce_ah.c |
3539 |
++++ b/drivers/infiniband/hw/hns/hns_roce_ah.c |
3540 |
+@@ -66,7 +66,7 @@ struct ib_ah *hns_roce_create_ah(struct ib_pd *ibpd, |
3541 |
+ HNS_ROCE_VLAN_SL_BIT_MASK) << |
3542 |
+ HNS_ROCE_VLAN_SL_SHIFT; |
3543 |
+ |
3544 |
+- ah->av.port_pd = cpu_to_be32(to_hr_pd(ibpd)->pdn | |
3545 |
++ ah->av.port_pd = cpu_to_le32(to_hr_pd(ibpd)->pdn | |
3546 |
+ (rdma_ah_get_port_num(ah_attr) << |
3547 |
+ HNS_ROCE_PORT_NUM_SHIFT)); |
3548 |
+ ah->av.gid_index = grh->sgid_index; |
3549 |
+diff --git a/drivers/md/bcache/alloc.c b/drivers/md/bcache/alloc.c |
3550 |
+index 7a28232d868b..de85b3af3b39 100644 |
3551 |
+--- a/drivers/md/bcache/alloc.c |
3552 |
++++ b/drivers/md/bcache/alloc.c |
3553 |
+@@ -327,10 +327,11 @@ static int bch_allocator_thread(void *arg) |
3554 |
+ * possibly issue discards to them, then we add the bucket to |
3555 |
+ * the free list: |
3556 |
+ */ |
3557 |
+- while (!fifo_empty(&ca->free_inc)) { |
3558 |
++ while (1) { |
3559 |
+ long bucket; |
3560 |
+ |
3561 |
+- fifo_pop(&ca->free_inc, bucket); |
3562 |
++ if (!fifo_pop(&ca->free_inc, bucket)) |
3563 |
++ break; |
3564 |
+ |
3565 |
+ if (ca->discard) { |
3566 |
+ mutex_unlock(&ca->set->bucket_lock); |
3567 |
+diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c |
3568 |
+index 772258ee1f51..f880e5eba8dd 100644 |
3569 |
+--- a/drivers/md/bcache/journal.c |
3570 |
++++ b/drivers/md/bcache/journal.c |
3571 |
+@@ -317,6 +317,18 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) |
3572 |
+ } |
3573 |
+ } |
3574 |
+ |
3575 |
++bool is_discard_enabled(struct cache_set *s) |
3576 |
++{ |
3577 |
++ struct cache *ca; |
3578 |
++ unsigned int i; |
3579 |
++ |
3580 |
++ for_each_cache(ca, s, i) |
3581 |
++ if (ca->discard) |
3582 |
++ return true; |
3583 |
++ |
3584 |
++ return false; |
3585 |
++} |
3586 |
++ |
3587 |
+ int bch_journal_replay(struct cache_set *s, struct list_head *list) |
3588 |
+ { |
3589 |
+ int ret = 0, keys = 0, entries = 0; |
3590 |
+@@ -330,9 +342,17 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list) |
3591 |
+ list_for_each_entry(i, list, list) { |
3592 |
+ BUG_ON(i->pin && atomic_read(i->pin) != 1); |
3593 |
+ |
3594 |
+- cache_set_err_on(n != i->j.seq, s, |
3595 |
+-"bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
3596 |
+- n, i->j.seq - 1, start, end); |
3597 |
++ if (n != i->j.seq) { |
3598 |
++ if (n == start && is_discard_enabled(s)) |
3599 |
++ pr_info("bcache: journal entries %llu-%llu may be discarded! (replaying %llu-%llu)", |
3600 |
++ n, i->j.seq - 1, start, end); |
3601 |
++ else { |
3602 |
++ pr_err("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)", |
3603 |
++ n, i->j.seq - 1, start, end); |
3604 |
++ ret = -EIO; |
3605 |
++ goto err; |
3606 |
++ } |
3607 |
++ } |
3608 |
+ |
3609 |
+ for (k = i->j.start; |
3610 |
+ k < bset_bkey_last(&i->j); |
3611 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
3612 |
+index 2c0d35c882ed..2409507d7bff 100644 |
3613 |
+--- a/drivers/md/bcache/super.c |
3614 |
++++ b/drivers/md/bcache/super.c |
3615 |
+@@ -1770,13 +1770,15 @@ err: |
3616 |
+ return NULL; |
3617 |
+ } |
3618 |
+ |
3619 |
+-static void run_cache_set(struct cache_set *c) |
3620 |
++static int run_cache_set(struct cache_set *c) |
3621 |
+ { |
3622 |
+ const char *err = "cannot allocate memory"; |
3623 |
+ struct cached_dev *dc, *t; |
3624 |
+ struct cache *ca; |
3625 |
+ struct closure cl; |
3626 |
+ unsigned int i; |
3627 |
++ LIST_HEAD(journal); |
3628 |
++ struct journal_replay *l; |
3629 |
+ |
3630 |
+ closure_init_stack(&cl); |
3631 |
+ |
3632 |
+@@ -1864,7 +1866,9 @@ static void run_cache_set(struct cache_set *c) |
3633 |
+ if (j->version < BCACHE_JSET_VERSION_UUID) |
3634 |
+ __uuid_write(c); |
3635 |
+ |
3636 |
+- bch_journal_replay(c, &journal); |
3637 |
++ err = "bcache: replay journal failed"; |
3638 |
++ if (bch_journal_replay(c, &journal)) |
3639 |
++ goto err; |
3640 |
+ } else { |
3641 |
+ pr_notice("invalidating existing data"); |
3642 |
+ |
3643 |
+@@ -1932,11 +1936,19 @@ static void run_cache_set(struct cache_set *c) |
3644 |
+ flash_devs_run(c); |
3645 |
+ |
3646 |
+ set_bit(CACHE_SET_RUNNING, &c->flags); |
3647 |
+- return; |
3648 |
++ return 0; |
3649 |
+ err: |
3650 |
++ while (!list_empty(&journal)) { |
3651 |
++ l = list_first_entry(&journal, struct journal_replay, list); |
3652 |
++ list_del(&l->list); |
3653 |
++ kfree(l); |
3654 |
++ } |
3655 |
++ |
3656 |
+ closure_sync(&cl); |
3657 |
+ /* XXX: test this, it's broken */ |
3658 |
+ bch_cache_set_error(c, "%s", err); |
3659 |
++ |
3660 |
++ return -EIO; |
3661 |
+ } |
3662 |
+ |
3663 |
+ static bool can_attach_cache(struct cache *ca, struct cache_set *c) |
3664 |
+@@ -2000,8 +2012,11 @@ found: |
3665 |
+ ca->set->cache[ca->sb.nr_this_dev] = ca; |
3666 |
+ c->cache_by_alloc[c->caches_loaded++] = ca; |
3667 |
+ |
3668 |
+- if (c->caches_loaded == c->sb.nr_in_set) |
3669 |
+- run_cache_set(c); |
3670 |
++ if (c->caches_loaded == c->sb.nr_in_set) { |
3671 |
++ err = "failed to run cache set"; |
3672 |
++ if (run_cache_set(c) < 0) |
3673 |
++ goto err; |
3674 |
++ } |
3675 |
+ |
3676 |
+ return NULL; |
3677 |
+ err: |
3678 |
+diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c |
3679 |
+index 6889c25c62cb..9226dca44e90 100644 |
3680 |
+--- a/drivers/media/common/videobuf2/videobuf2-core.c |
3681 |
++++ b/drivers/media/common/videobuf2/videobuf2-core.c |
3682 |
+@@ -668,6 +668,11 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory, |
3683 |
+ return -EBUSY; |
3684 |
+ } |
3685 |
+ |
3686 |
++ if (q->waiting_in_dqbuf && *count) { |
3687 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
3688 |
++ return -EBUSY; |
3689 |
++ } |
3690 |
++ |
3691 |
+ if (*count == 0 || q->num_buffers != 0 || |
3692 |
+ (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) { |
3693 |
+ /* |
3694 |
+@@ -797,6 +802,10 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory, |
3695 |
+ } |
3696 |
+ |
3697 |
+ if (!q->num_buffers) { |
3698 |
++ if (q->waiting_in_dqbuf && *count) { |
3699 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
3700 |
++ return -EBUSY; |
3701 |
++ } |
3702 |
+ memset(q->alloc_devs, 0, sizeof(q->alloc_devs)); |
3703 |
+ q->memory = memory; |
3704 |
+ q->waiting_for_buffers = !q->is_output; |
3705 |
+@@ -1466,6 +1475,11 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
3706 |
+ for (;;) { |
3707 |
+ int ret; |
3708 |
+ |
3709 |
++ if (q->waiting_in_dqbuf) { |
3710 |
++ dprintk(1, "another dup()ped fd is waiting for a buffer\n"); |
3711 |
++ return -EBUSY; |
3712 |
++ } |
3713 |
++ |
3714 |
+ if (!q->streaming) { |
3715 |
+ dprintk(1, "streaming off, will not wait for buffers\n"); |
3716 |
+ return -EINVAL; |
3717 |
+@@ -1493,6 +1507,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
3718 |
+ return -EAGAIN; |
3719 |
+ } |
3720 |
+ |
3721 |
++ q->waiting_in_dqbuf = 1; |
3722 |
+ /* |
3723 |
+ * We are streaming and blocking, wait for another buffer to |
3724 |
+ * become ready or for streamoff. Driver's lock is released to |
3725 |
+@@ -1513,6 +1528,7 @@ static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking) |
3726 |
+ * the locks or return an error if one occurred. |
3727 |
+ */ |
3728 |
+ call_void_qop(q, wait_finish, q); |
3729 |
++ q->waiting_in_dqbuf = 0; |
3730 |
+ if (ret) { |
3731 |
+ dprintk(1, "sleep was interrupted\n"); |
3732 |
+ return ret; |
3733 |
+@@ -2361,6 +2377,12 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_ |
3734 |
+ if (!data) |
3735 |
+ return -EINVAL; |
3736 |
+ |
3737 |
++ if (q->waiting_in_dqbuf) { |
3738 |
++ dprintk(3, "another dup()ped fd is %s\n", |
3739 |
++ read ? "reading" : "writing"); |
3740 |
++ return -EBUSY; |
3741 |
++ } |
3742 |
++ |
3743 |
+ /* |
3744 |
+ * Initialize emulator on first call. |
3745 |
+ */ |
3746 |
+diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c |
3747 |
+index dffd2d4bf1c8..c25c92797408 100644 |
3748 |
+--- a/drivers/media/dvb-frontends/m88ds3103.c |
3749 |
++++ b/drivers/media/dvb-frontends/m88ds3103.c |
3750 |
+@@ -309,6 +309,9 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
3751 |
+ u16 u16tmp; |
3752 |
+ u32 tuner_frequency_khz, target_mclk; |
3753 |
+ s32 s32tmp; |
3754 |
++ static const struct reg_sequence reset_buf[] = { |
3755 |
++ {0x07, 0x80}, {0x07, 0x00} |
3756 |
++ }; |
3757 |
+ |
3758 |
+ dev_dbg(&client->dev, |
3759 |
+ "delivery_system=%d modulation=%d frequency=%u symbol_rate=%d inversion=%d pilot=%d rolloff=%d\n", |
3760 |
+@@ -321,11 +324,7 @@ static int m88ds3103_set_frontend(struct dvb_frontend *fe) |
3761 |
+ } |
3762 |
+ |
3763 |
+ /* reset */ |
3764 |
+- ret = regmap_write(dev->regmap, 0x07, 0x80); |
3765 |
+- if (ret) |
3766 |
+- goto err; |
3767 |
+- |
3768 |
+- ret = regmap_write(dev->regmap, 0x07, 0x00); |
3769 |
++ ret = regmap_multi_reg_write(dev->regmap, reset_buf, 2); |
3770 |
+ if (ret) |
3771 |
+ goto err; |
3772 |
+ |
3773 |
+diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c |
3774 |
+index feacd8da421d..d55d8f169dca 100644 |
3775 |
+--- a/drivers/media/dvb-frontends/si2165.c |
3776 |
++++ b/drivers/media/dvb-frontends/si2165.c |
3777 |
+@@ -275,18 +275,20 @@ static u32 si2165_get_fe_clk(struct si2165_state *state) |
3778 |
+ |
3779 |
+ static int si2165_wait_init_done(struct si2165_state *state) |
3780 |
+ { |
3781 |
+- int ret = -EINVAL; |
3782 |
++ int ret; |
3783 |
+ u8 val = 0; |
3784 |
+ int i; |
3785 |
+ |
3786 |
+ for (i = 0; i < 3; ++i) { |
3787 |
+- si2165_readreg8(state, REG_INIT_DONE, &val); |
3788 |
++ ret = si2165_readreg8(state, REG_INIT_DONE, &val); |
3789 |
++ if (ret < 0) |
3790 |
++ return ret; |
3791 |
+ if (val == 0x01) |
3792 |
+ return 0; |
3793 |
+ usleep_range(1000, 50000); |
3794 |
+ } |
3795 |
+ dev_err(&state->client->dev, "init_done was not set\n"); |
3796 |
+- return ret; |
3797 |
++ return -EINVAL; |
3798 |
+ } |
3799 |
+ |
3800 |
+ static int si2165_upload_firmware_block(struct si2165_state *state, |
3801 |
+diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c |
3802 |
+index 4715edc8ca33..e6a8b5669b9c 100644 |
3803 |
+--- a/drivers/media/i2c/ov2659.c |
3804 |
++++ b/drivers/media/i2c/ov2659.c |
3805 |
+@@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, |
3806 |
+ if (ov2659_formats[index].code == mf->code) |
3807 |
+ break; |
3808 |
+ |
3809 |
+- if (index < 0) |
3810 |
+- return -EINVAL; |
3811 |
++ if (index < 0) { |
3812 |
++ index = 0; |
3813 |
++ mf->code = ov2659_formats[index].code; |
3814 |
++ } |
3815 |
+ |
3816 |
+ mf->colorspace = V4L2_COLORSPACE_SRGB; |
3817 |
+ mf->field = V4L2_FIELD_NONE; |
3818 |
+diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c |
3819 |
+index a9264d515e54..edded869d792 100644 |
3820 |
+--- a/drivers/media/i2c/ov6650.c |
3821 |
++++ b/drivers/media/i2c/ov6650.c |
3822 |
+@@ -811,9 +811,16 @@ static int ov6650_video_probe(struct i2c_client *client) |
3823 |
+ u8 pidh, pidl, midh, midl; |
3824 |
+ int ret; |
3825 |
+ |
3826 |
++ priv->clk = v4l2_clk_get(&client->dev, NULL); |
3827 |
++ if (IS_ERR(priv->clk)) { |
3828 |
++ ret = PTR_ERR(priv->clk); |
3829 |
++ dev_err(&client->dev, "v4l2_clk request err: %d\n", ret); |
3830 |
++ return ret; |
3831 |
++ } |
3832 |
++ |
3833 |
+ ret = ov6650_s_power(&priv->subdev, 1); |
3834 |
+ if (ret < 0) |
3835 |
+- return ret; |
3836 |
++ goto eclkput; |
3837 |
+ |
3838 |
+ msleep(20); |
3839 |
+ |
3840 |
+@@ -850,6 +857,11 @@ static int ov6650_video_probe(struct i2c_client *client) |
3841 |
+ |
3842 |
+ done: |
3843 |
+ ov6650_s_power(&priv->subdev, 0); |
3844 |
++ if (!ret) |
3845 |
++ return 0; |
3846 |
++eclkput: |
3847 |
++ v4l2_clk_put(priv->clk); |
3848 |
++ |
3849 |
+ return ret; |
3850 |
+ } |
3851 |
+ |
3852 |
+@@ -992,18 +1004,9 @@ static int ov6650_probe(struct i2c_client *client, |
3853 |
+ priv->code = MEDIA_BUS_FMT_YUYV8_2X8; |
3854 |
+ priv->colorspace = V4L2_COLORSPACE_JPEG; |
3855 |
+ |
3856 |
+- priv->clk = v4l2_clk_get(&client->dev, NULL); |
3857 |
+- if (IS_ERR(priv->clk)) { |
3858 |
+- ret = PTR_ERR(priv->clk); |
3859 |
+- goto eclkget; |
3860 |
+- } |
3861 |
+- |
3862 |
+ ret = ov6650_video_probe(client); |
3863 |
+- if (ret) { |
3864 |
+- v4l2_clk_put(priv->clk); |
3865 |
+-eclkget: |
3866 |
++ if (ret) |
3867 |
+ v4l2_ctrl_handler_free(&priv->hdl); |
3868 |
+- } |
3869 |
+ |
3870 |
+ return ret; |
3871 |
+ } |
3872 |
+diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c |
3873 |
+index 5817d9cde4d0..6d8e4afe9673 100644 |
3874 |
+--- a/drivers/media/pci/saa7146/hexium_gemini.c |
3875 |
++++ b/drivers/media/pci/saa7146/hexium_gemini.c |
3876 |
+@@ -270,9 +270,8 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d |
3877 |
+ /* enable i2c-port pins */ |
3878 |
+ saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26)); |
3879 |
+ |
3880 |
+- hexium->i2c_adapter = (struct i2c_adapter) { |
3881 |
+- .name = "hexium gemini", |
3882 |
+- }; |
3883 |
++ strscpy(hexium->i2c_adapter.name, "hexium gemini", |
3884 |
++ sizeof(hexium->i2c_adapter.name)); |
3885 |
+ saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
3886 |
+ if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
3887 |
+ DEB_S("cannot register i2c-device. skipping.\n"); |
3888 |
+diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c |
3889 |
+index 0a05176c18ab..a794f9e5f990 100644 |
3890 |
+--- a/drivers/media/pci/saa7146/hexium_orion.c |
3891 |
++++ b/drivers/media/pci/saa7146/hexium_orion.c |
3892 |
+@@ -231,9 +231,8 @@ static int hexium_probe(struct saa7146_dev *dev) |
3893 |
+ saa7146_write(dev, DD1_STREAM_B, 0x00000000); |
3894 |
+ saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26)); |
3895 |
+ |
3896 |
+- hexium->i2c_adapter = (struct i2c_adapter) { |
3897 |
+- .name = "hexium orion", |
3898 |
+- }; |
3899 |
++ strscpy(hexium->i2c_adapter.name, "hexium orion", |
3900 |
++ sizeof(hexium->i2c_adapter.name)); |
3901 |
+ saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); |
3902 |
+ if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { |
3903 |
+ DEB_S("cannot register i2c-device. skipping.\n"); |
3904 |
+diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c |
3905 |
+index d20d3df5778b..a3cfefdbee12 100644 |
3906 |
+--- a/drivers/media/platform/coda/coda-bit.c |
3907 |
++++ b/drivers/media/platform/coda/coda-bit.c |
3908 |
+@@ -1999,6 +1999,9 @@ static int coda_prepare_decode(struct coda_ctx *ctx) |
3909 |
+ /* Clear decode success flag */ |
3910 |
+ coda_write(dev, 0, CODA_RET_DEC_PIC_SUCCESS); |
3911 |
+ |
3912 |
++ /* Clear error return value */ |
3913 |
++ coda_write(dev, 0, CODA_RET_DEC_PIC_ERR_MB); |
3914 |
++ |
3915 |
+ trace_coda_dec_pic_run(ctx, meta); |
3916 |
+ |
3917 |
+ coda_command_async(ctx, CODA_COMMAND_PIC_RUN); |
3918 |
+diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c |
3919 |
+index 721564176d8c..d38682265892 100644 |
3920 |
+--- a/drivers/media/platform/stm32/stm32-dcmi.c |
3921 |
++++ b/drivers/media/platform/stm32/stm32-dcmi.c |
3922 |
+@@ -808,6 +808,9 @@ static int dcmi_try_fmt(struct stm32_dcmi *dcmi, struct v4l2_format *f, |
3923 |
+ |
3924 |
+ sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat); |
3925 |
+ if (!sd_fmt) { |
3926 |
++ if (!dcmi->num_of_sd_formats) |
3927 |
++ return -ENODATA; |
3928 |
++ |
3929 |
+ sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1]; |
3930 |
+ pix->pixelformat = sd_fmt->fourcc; |
3931 |
+ } |
3932 |
+@@ -986,6 +989,9 @@ static int dcmi_set_sensor_format(struct stm32_dcmi *dcmi, |
3933 |
+ |
3934 |
+ sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat); |
3935 |
+ if (!sd_fmt) { |
3936 |
++ if (!dcmi->num_of_sd_formats) |
3937 |
++ return -ENODATA; |
3938 |
++ |
3939 |
+ sd_fmt = dcmi->sd_formats[dcmi->num_of_sd_formats - 1]; |
3940 |
+ pix->pixelformat = sd_fmt->fourcc; |
3941 |
+ } |
3942 |
+@@ -1645,7 +1651,7 @@ static int dcmi_probe(struct platform_device *pdev) |
3943 |
+ dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); |
3944 |
+ if (IS_ERR(dcmi->rstc)) { |
3945 |
+ dev_err(&pdev->dev, "Could not get reset control\n"); |
3946 |
+- return -ENODEV; |
3947 |
++ return PTR_ERR(dcmi->rstc); |
3948 |
+ } |
3949 |
+ |
3950 |
+ /* Get bus characteristics from devicetree */ |
3951 |
+@@ -1660,7 +1666,7 @@ static int dcmi_probe(struct platform_device *pdev) |
3952 |
+ of_node_put(np); |
3953 |
+ if (ret) { |
3954 |
+ dev_err(&pdev->dev, "Could not parse the endpoint\n"); |
3955 |
+- return -ENODEV; |
3956 |
++ return ret; |
3957 |
+ } |
3958 |
+ |
3959 |
+ if (ep.bus_type == V4L2_MBUS_CSI2) { |
3960 |
+@@ -1673,8 +1679,9 @@ static int dcmi_probe(struct platform_device *pdev) |
3961 |
+ |
3962 |
+ irq = platform_get_irq(pdev, 0); |
3963 |
+ if (irq <= 0) { |
3964 |
+- dev_err(&pdev->dev, "Could not get irq\n"); |
3965 |
+- return -ENODEV; |
3966 |
++ if (irq != -EPROBE_DEFER) |
3967 |
++ dev_err(&pdev->dev, "Could not get irq\n"); |
3968 |
++ return irq; |
3969 |
+ } |
3970 |
+ |
3971 |
+ dcmi->res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
3972 |
+@@ -1694,12 +1701,13 @@ static int dcmi_probe(struct platform_device *pdev) |
3973 |
+ dev_name(&pdev->dev), dcmi); |
3974 |
+ if (ret) { |
3975 |
+ dev_err(&pdev->dev, "Unable to request irq %d\n", irq); |
3976 |
+- return -ENODEV; |
3977 |
++ return ret; |
3978 |
+ } |
3979 |
+ |
3980 |
+ mclk = devm_clk_get(&pdev->dev, "mclk"); |
3981 |
+ if (IS_ERR(mclk)) { |
3982 |
+- dev_err(&pdev->dev, "Unable to get mclk\n"); |
3983 |
++ if (PTR_ERR(mclk) != -EPROBE_DEFER) |
3984 |
++ dev_err(&pdev->dev, "Unable to get mclk\n"); |
3985 |
+ return PTR_ERR(mclk); |
3986 |
+ } |
3987 |
+ |
3988 |
+diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c |
3989 |
+index c01e1592ad0a..c8ffe7bff77f 100644 |
3990 |
+--- a/drivers/media/platform/video-mux.c |
3991 |
++++ b/drivers/media/platform/video-mux.c |
3992 |
+@@ -365,9 +365,14 @@ static int video_mux_probe(struct platform_device *pdev) |
3993 |
+ vmux->active = -1; |
3994 |
+ vmux->pads = devm_kcalloc(dev, num_pads, sizeof(*vmux->pads), |
3995 |
+ GFP_KERNEL); |
3996 |
++ if (!vmux->pads) |
3997 |
++ return -ENOMEM; |
3998 |
++ |
3999 |
+ vmux->format_mbus = devm_kcalloc(dev, num_pads, |
4000 |
+ sizeof(*vmux->format_mbus), |
4001 |
+ GFP_KERNEL); |
4002 |
++ if (!vmux->format_mbus) |
4003 |
++ return -ENOMEM; |
4004 |
+ |
4005 |
+ for (i = 0; i < num_pads; i++) { |
4006 |
+ vmux->pads[i].flags = (i < num_pads - 1) ? MEDIA_PAD_FL_SINK |
4007 |
+diff --git a/drivers/media/platform/vimc/vimc-core.c b/drivers/media/platform/vimc/vimc-core.c |
4008 |
+index 9246f265de31..27db8835c241 100644 |
4009 |
+--- a/drivers/media/platform/vimc/vimc-core.c |
4010 |
++++ b/drivers/media/platform/vimc/vimc-core.c |
4011 |
+@@ -303,6 +303,8 @@ static int vimc_probe(struct platform_device *pdev) |
4012 |
+ |
4013 |
+ dev_dbg(&pdev->dev, "probe"); |
4014 |
+ |
4015 |
++ memset(&vimc->mdev, 0, sizeof(vimc->mdev)); |
4016 |
++ |
4017 |
+ /* Create platform_device for each entity in the topology*/ |
4018 |
+ vimc->subdevs = devm_kcalloc(&vimc->pdev.dev, vimc->pipe_cfg->num_ents, |
4019 |
+ sizeof(*vimc->subdevs), GFP_KERNEL); |
4020 |
+diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c |
4021 |
+index fcc897fb247b..392754c18046 100644 |
4022 |
+--- a/drivers/media/platform/vimc/vimc-streamer.c |
4023 |
++++ b/drivers/media/platform/vimc/vimc-streamer.c |
4024 |
+@@ -120,7 +120,6 @@ static int vimc_streamer_thread(void *data) |
4025 |
+ int i; |
4026 |
+ |
4027 |
+ set_freezable(); |
4028 |
+- set_current_state(TASK_UNINTERRUPTIBLE); |
4029 |
+ |
4030 |
+ for (;;) { |
4031 |
+ try_to_freeze(); |
4032 |
+@@ -137,6 +136,7 @@ static int vimc_streamer_thread(void *data) |
4033 |
+ break; |
4034 |
+ } |
4035 |
+ //wait for 60hz |
4036 |
++ set_current_state(TASK_UNINTERRUPTIBLE); |
4037 |
+ schedule_timeout(HZ / 60); |
4038 |
+ } |
4039 |
+ |
4040 |
+diff --git a/drivers/media/platform/vivid/vivid-vid-cap.c b/drivers/media/platform/vivid/vivid-vid-cap.c |
4041 |
+index baa7c83ee6e0..3b09ffceefd5 100644 |
4042 |
+--- a/drivers/media/platform/vivid/vivid-vid-cap.c |
4043 |
++++ b/drivers/media/platform/vivid/vivid-vid-cap.c |
4044 |
+@@ -992,7 +992,7 @@ int vivid_vid_cap_s_selection(struct file *file, void *fh, struct v4l2_selection |
4045 |
+ v4l2_rect_map_inside(&s->r, &dev->fmt_cap_rect); |
4046 |
+ if (dev->bitmap_cap && (compose->width != s->r.width || |
4047 |
+ compose->height != s->r.height)) { |
4048 |
+- kfree(dev->bitmap_cap); |
4049 |
++ vfree(dev->bitmap_cap); |
4050 |
+ dev->bitmap_cap = NULL; |
4051 |
+ } |
4052 |
+ *compose = s->r; |
4053 |
+diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c |
4054 |
+index 800d69c3f80b..1cf4019689a5 100644 |
4055 |
+--- a/drivers/media/radio/wl128x/fmdrv_common.c |
4056 |
++++ b/drivers/media/radio/wl128x/fmdrv_common.c |
4057 |
+@@ -489,7 +489,8 @@ int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload, |
4058 |
+ return -EIO; |
4059 |
+ } |
4060 |
+ /* Send response data to caller */ |
4061 |
+- if (response != NULL && response_len != NULL && evt_hdr->dlen) { |
4062 |
++ if (response != NULL && response_len != NULL && evt_hdr->dlen && |
4063 |
++ evt_hdr->dlen <= payload_len) { |
4064 |
+ /* Skip header info and copy only response data */ |
4065 |
+ skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
4066 |
+ memcpy(response, skb->data, evt_hdr->dlen); |
4067 |
+@@ -583,6 +584,8 @@ static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev) |
4068 |
+ return; |
4069 |
+ |
4070 |
+ fm_evt_hdr = (void *)skb->data; |
4071 |
++ if (fm_evt_hdr->dlen > sizeof(fmdev->irq_info.flag)) |
4072 |
++ return; |
4073 |
+ |
4074 |
+ /* Skip header info and copy only response data */ |
4075 |
+ skb_pull(skb, sizeof(struct fm_event_msg_hdr)); |
4076 |
+@@ -1308,7 +1311,7 @@ static int load_default_rx_configuration(struct fmdev *fmdev) |
4077 |
+ static int fm_power_up(struct fmdev *fmdev, u8 mode) |
4078 |
+ { |
4079 |
+ u16 payload; |
4080 |
+- __be16 asic_id, asic_ver; |
4081 |
++ __be16 asic_id = 0, asic_ver = 0; |
4082 |
+ int resp_len, ret; |
4083 |
+ u8 fw_name[50]; |
4084 |
+ |
4085 |
+diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c |
4086 |
+index 8bf5637b3a69..e613c0175591 100644 |
4087 |
+--- a/drivers/media/rc/serial_ir.c |
4088 |
++++ b/drivers/media/rc/serial_ir.c |
4089 |
+@@ -773,8 +773,6 @@ static void serial_ir_exit(void) |
4090 |
+ |
4091 |
+ static int __init serial_ir_init_module(void) |
4092 |
+ { |
4093 |
+- int result; |
4094 |
+- |
4095 |
+ switch (type) { |
4096 |
+ case IR_HOMEBREW: |
4097 |
+ case IR_IRDEO: |
4098 |
+@@ -802,12 +800,7 @@ static int __init serial_ir_init_module(void) |
4099 |
+ if (sense != -1) |
4100 |
+ sense = !!sense; |
4101 |
+ |
4102 |
+- result = serial_ir_init(); |
4103 |
+- if (!result) |
4104 |
+- return 0; |
4105 |
+- |
4106 |
+- serial_ir_exit(); |
4107 |
+- return result; |
4108 |
++ return serial_ir_init(); |
4109 |
+ } |
4110 |
+ |
4111 |
+ static void __exit serial_ir_exit_module(void) |
4112 |
+diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c |
4113 |
+index 62b45062b1e6..3e111f7f56df 100644 |
4114 |
+--- a/drivers/media/usb/au0828/au0828-video.c |
4115 |
++++ b/drivers/media/usb/au0828/au0828-video.c |
4116 |
+@@ -758,6 +758,9 @@ static int au0828_analog_stream_enable(struct au0828_dev *d) |
4117 |
+ |
4118 |
+ dprintk(1, "au0828_analog_stream_enable called\n"); |
4119 |
+ |
4120 |
++ if (test_bit(DEV_DISCONNECTED, &d->dev_state)) |
4121 |
++ return -ENODEV; |
4122 |
++ |
4123 |
+ iface = usb_ifnum_to_if(d->usbdev, 0); |
4124 |
+ if (iface && iface->cur_altsetting->desc.bAlternateSetting != 5) { |
4125 |
+ dprintk(1, "Changing intf#0 to alt 5\n"); |
4126 |
+@@ -839,9 +842,9 @@ int au0828_start_analog_streaming(struct vb2_queue *vq, unsigned int count) |
4127 |
+ return rc; |
4128 |
+ } |
4129 |
+ |
4130 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 1); |
4131 |
++ |
4132 |
+ if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
4133 |
+- v4l2_device_call_all(&dev->v4l2_dev, 0, video, |
4134 |
+- s_stream, 1); |
4135 |
+ dev->vid_timeout_running = 1; |
4136 |
+ mod_timer(&dev->vid_timeout, jiffies + (HZ / 10)); |
4137 |
+ } else if (vq->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
4138 |
+@@ -861,10 +864,11 @@ static void au0828_stop_streaming(struct vb2_queue *vq) |
4139 |
+ |
4140 |
+ dprintk(1, "au0828_stop_streaming called %d\n", dev->streaming_users); |
4141 |
+ |
4142 |
+- if (dev->streaming_users-- == 1) |
4143 |
++ if (dev->streaming_users-- == 1) { |
4144 |
+ au0828_uninit_isoc(dev); |
4145 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
4146 |
++ } |
4147 |
+ |
4148 |
+- v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
4149 |
+ dev->vid_timeout_running = 0; |
4150 |
+ del_timer_sync(&dev->vid_timeout); |
4151 |
+ |
4152 |
+@@ -893,8 +897,10 @@ void au0828_stop_vbi_streaming(struct vb2_queue *vq) |
4153 |
+ dprintk(1, "au0828_stop_vbi_streaming called %d\n", |
4154 |
+ dev->streaming_users); |
4155 |
+ |
4156 |
+- if (dev->streaming_users-- == 1) |
4157 |
++ if (dev->streaming_users-- == 1) { |
4158 |
+ au0828_uninit_isoc(dev); |
4159 |
++ v4l2_device_call_all(&dev->v4l2_dev, 0, video, s_stream, 0); |
4160 |
++ } |
4161 |
+ |
4162 |
+ spin_lock_irqsave(&dev->slock, flags); |
4163 |
+ if (dev->isoc_ctl.vbi_buf != NULL) { |
4164 |
+diff --git a/drivers/media/usb/cpia2/cpia2_v4l.c b/drivers/media/usb/cpia2/cpia2_v4l.c |
4165 |
+index 99f106b13280..d47318958fe5 100644 |
4166 |
+--- a/drivers/media/usb/cpia2/cpia2_v4l.c |
4167 |
++++ b/drivers/media/usb/cpia2/cpia2_v4l.c |
4168 |
+@@ -1244,8 +1244,7 @@ static int __init cpia2_init(void) |
4169 |
+ LOG("%s v%s\n", |
4170 |
+ ABOUT, CPIA_VERSION); |
4171 |
+ check_parameters(); |
4172 |
+- cpia2_usb_init(); |
4173 |
+- return 0; |
4174 |
++ return cpia2_usb_init(); |
4175 |
+ } |
4176 |
+ |
4177 |
+ |
4178 |
+diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c |
4179 |
+index e28bd8836751..ae0814dd202a 100644 |
4180 |
+--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c |
4181 |
++++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c |
4182 |
+@@ -615,16 +615,18 @@ static int dvbsky_init(struct dvb_usb_device *d) |
4183 |
+ return 0; |
4184 |
+ } |
4185 |
+ |
4186 |
+-static void dvbsky_exit(struct dvb_usb_device *d) |
4187 |
++static int dvbsky_frontend_detach(struct dvb_usb_adapter *adap) |
4188 |
+ { |
4189 |
++ struct dvb_usb_device *d = adap_to_d(adap); |
4190 |
+ struct dvbsky_state *state = d_to_priv(d); |
4191 |
+- struct dvb_usb_adapter *adap = &d->adapter[0]; |
4192 |
++ |
4193 |
++ dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); |
4194 |
+ |
4195 |
+ dvb_module_release(state->i2c_client_tuner); |
4196 |
+ dvb_module_release(state->i2c_client_demod); |
4197 |
+ dvb_module_release(state->i2c_client_ci); |
4198 |
+ |
4199 |
+- adap->fe[0] = NULL; |
4200 |
++ return 0; |
4201 |
+ } |
4202 |
+ |
4203 |
+ /* DVB USB Driver stuff */ |
4204 |
+@@ -640,11 +642,11 @@ static struct dvb_usb_device_properties dvbsky_s960_props = { |
4205 |
+ |
4206 |
+ .i2c_algo = &dvbsky_i2c_algo, |
4207 |
+ .frontend_attach = dvbsky_s960_attach, |
4208 |
++ .frontend_detach = dvbsky_frontend_detach, |
4209 |
+ .init = dvbsky_init, |
4210 |
+ .get_rc_config = dvbsky_get_rc_config, |
4211 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
4212 |
+ .identify_state = dvbsky_identify_state, |
4213 |
+- .exit = dvbsky_exit, |
4214 |
+ .read_mac_address = dvbsky_read_mac_addr, |
4215 |
+ |
4216 |
+ .num_adapters = 1, |
4217 |
+@@ -667,11 +669,11 @@ static struct dvb_usb_device_properties dvbsky_s960c_props = { |
4218 |
+ |
4219 |
+ .i2c_algo = &dvbsky_i2c_algo, |
4220 |
+ .frontend_attach = dvbsky_s960c_attach, |
4221 |
++ .frontend_detach = dvbsky_frontend_detach, |
4222 |
+ .init = dvbsky_init, |
4223 |
+ .get_rc_config = dvbsky_get_rc_config, |
4224 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
4225 |
+ .identify_state = dvbsky_identify_state, |
4226 |
+- .exit = dvbsky_exit, |
4227 |
+ .read_mac_address = dvbsky_read_mac_addr, |
4228 |
+ |
4229 |
+ .num_adapters = 1, |
4230 |
+@@ -694,11 +696,11 @@ static struct dvb_usb_device_properties dvbsky_t680c_props = { |
4231 |
+ |
4232 |
+ .i2c_algo = &dvbsky_i2c_algo, |
4233 |
+ .frontend_attach = dvbsky_t680c_attach, |
4234 |
++ .frontend_detach = dvbsky_frontend_detach, |
4235 |
+ .init = dvbsky_init, |
4236 |
+ .get_rc_config = dvbsky_get_rc_config, |
4237 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
4238 |
+ .identify_state = dvbsky_identify_state, |
4239 |
+- .exit = dvbsky_exit, |
4240 |
+ .read_mac_address = dvbsky_read_mac_addr, |
4241 |
+ |
4242 |
+ .num_adapters = 1, |
4243 |
+@@ -721,11 +723,11 @@ static struct dvb_usb_device_properties dvbsky_t330_props = { |
4244 |
+ |
4245 |
+ .i2c_algo = &dvbsky_i2c_algo, |
4246 |
+ .frontend_attach = dvbsky_t330_attach, |
4247 |
++ .frontend_detach = dvbsky_frontend_detach, |
4248 |
+ .init = dvbsky_init, |
4249 |
+ .get_rc_config = dvbsky_get_rc_config, |
4250 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
4251 |
+ .identify_state = dvbsky_identify_state, |
4252 |
+- .exit = dvbsky_exit, |
4253 |
+ .read_mac_address = dvbsky_read_mac_addr, |
4254 |
+ |
4255 |
+ .num_adapters = 1, |
4256 |
+@@ -748,11 +750,11 @@ static struct dvb_usb_device_properties mygica_t230c_props = { |
4257 |
+ |
4258 |
+ .i2c_algo = &dvbsky_i2c_algo, |
4259 |
+ .frontend_attach = dvbsky_mygica_t230c_attach, |
4260 |
++ .frontend_detach = dvbsky_frontend_detach, |
4261 |
+ .init = dvbsky_init, |
4262 |
+ .get_rc_config = dvbsky_get_rc_config, |
4263 |
+ .streaming_ctrl = dvbsky_streaming_ctrl, |
4264 |
+ .identify_state = dvbsky_identify_state, |
4265 |
+- .exit = dvbsky_exit, |
4266 |
+ |
4267 |
+ .num_adapters = 1, |
4268 |
+ .adapter = { |
4269 |
+diff --git a/drivers/media/usb/go7007/go7007-fw.c b/drivers/media/usb/go7007/go7007-fw.c |
4270 |
+index 24f5b615dc7a..dfa9f899d0c2 100644 |
4271 |
+--- a/drivers/media/usb/go7007/go7007-fw.c |
4272 |
++++ b/drivers/media/usb/go7007/go7007-fw.c |
4273 |
+@@ -1499,8 +1499,8 @@ static int modet_to_package(struct go7007 *go, __le16 *code, int space) |
4274 |
+ return cnt; |
4275 |
+ } |
4276 |
+ |
4277 |
+-static int do_special(struct go7007 *go, u16 type, __le16 *code, int space, |
4278 |
+- int *framelen) |
4279 |
++static noinline_for_stack int do_special(struct go7007 *go, u16 type, |
4280 |
++ __le16 *code, int space, int *framelen) |
4281 |
+ { |
4282 |
+ switch (type) { |
4283 |
+ case SPECIAL_FRM_HEAD: |
4284 |
+diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c |
4285 |
+index 405a6a76d820..b12356c533a6 100644 |
4286 |
+--- a/drivers/media/usb/gspca/gspca.c |
4287 |
++++ b/drivers/media/usb/gspca/gspca.c |
4288 |
+@@ -294,7 +294,7 @@ static void fill_frame(struct gspca_dev *gspca_dev, |
4289 |
+ /* check the packet status and length */ |
4290 |
+ st = urb->iso_frame_desc[i].status; |
4291 |
+ if (st) { |
4292 |
+- pr_err("ISOC data error: [%d] len=%d, status=%d\n", |
4293 |
++ gspca_dbg(gspca_dev, D_PACK, "ISOC data error: [%d] len=%d, status=%d\n", |
4294 |
+ i, len, st); |
4295 |
+ gspca_dev->last_packet_type = DISCARD_PACKET; |
4296 |
+ continue; |
4297 |
+@@ -314,6 +314,8 @@ static void fill_frame(struct gspca_dev *gspca_dev, |
4298 |
+ } |
4299 |
+ |
4300 |
+ resubmit: |
4301 |
++ if (!gspca_dev->streaming) |
4302 |
++ return; |
4303 |
+ /* resubmit the URB */ |
4304 |
+ st = usb_submit_urb(urb, GFP_ATOMIC); |
4305 |
+ if (st < 0) |
4306 |
+@@ -330,7 +332,7 @@ static void isoc_irq(struct urb *urb) |
4307 |
+ struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; |
4308 |
+ |
4309 |
+ gspca_dbg(gspca_dev, D_PACK, "isoc irq\n"); |
4310 |
+- if (!vb2_start_streaming_called(&gspca_dev->queue)) |
4311 |
++ if (!gspca_dev->streaming) |
4312 |
+ return; |
4313 |
+ fill_frame(gspca_dev, urb); |
4314 |
+ } |
4315 |
+@@ -344,7 +346,7 @@ static void bulk_irq(struct urb *urb) |
4316 |
+ int st; |
4317 |
+ |
4318 |
+ gspca_dbg(gspca_dev, D_PACK, "bulk irq\n"); |
4319 |
+- if (!vb2_start_streaming_called(&gspca_dev->queue)) |
4320 |
++ if (!gspca_dev->streaming) |
4321 |
+ return; |
4322 |
+ switch (urb->status) { |
4323 |
+ case 0: |
4324 |
+@@ -367,6 +369,8 @@ static void bulk_irq(struct urb *urb) |
4325 |
+ urb->actual_length); |
4326 |
+ |
4327 |
+ resubmit: |
4328 |
++ if (!gspca_dev->streaming) |
4329 |
++ return; |
4330 |
+ /* resubmit the URB */ |
4331 |
+ if (gspca_dev->cam.bulk_nurbs != 0) { |
4332 |
+ st = usb_submit_urb(urb, GFP_ATOMIC); |
4333 |
+@@ -1630,6 +1634,8 @@ void gspca_disconnect(struct usb_interface *intf) |
4334 |
+ |
4335 |
+ mutex_lock(&gspca_dev->usb_lock); |
4336 |
+ gspca_dev->present = false; |
4337 |
++ destroy_urbs(gspca_dev); |
4338 |
++ gspca_input_destroy_urb(gspca_dev); |
4339 |
+ |
4340 |
+ vb2_queue_error(&gspca_dev->queue); |
4341 |
+ |
4342 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4343 |
+index a8519da0020b..673fdca8d2da 100644 |
4344 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4345 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c |
4346 |
+@@ -666,6 +666,8 @@ static int ctrl_get_input(struct pvr2_ctrl *cptr,int *vp) |
4347 |
+ |
4348 |
+ static int ctrl_check_input(struct pvr2_ctrl *cptr,int v) |
4349 |
+ { |
4350 |
++ if (v < 0 || v > PVR2_CVAL_INPUT_MAX) |
4351 |
++ return 0; |
4352 |
+ return ((1 << v) & cptr->hdw->input_allowed_mask) != 0; |
4353 |
+ } |
4354 |
+ |
4355 |
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
4356 |
+index 25648add77e5..bd2b7a67b732 100644 |
4357 |
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
4358 |
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h |
4359 |
+@@ -50,6 +50,7 @@ |
4360 |
+ #define PVR2_CVAL_INPUT_COMPOSITE 2 |
4361 |
+ #define PVR2_CVAL_INPUT_SVIDEO 3 |
4362 |
+ #define PVR2_CVAL_INPUT_RADIO 4 |
4363 |
++#define PVR2_CVAL_INPUT_MAX PVR2_CVAL_INPUT_RADIO |
4364 |
+ |
4365 |
+ enum pvr2_config { |
4366 |
+ pvr2_config_empty, /* No configuration */ |
4367 |
+diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c |
4368 |
+index efb8a7965dd4..154f4204d58c 100644 |
4369 |
+--- a/drivers/mmc/core/pwrseq_emmc.c |
4370 |
++++ b/drivers/mmc/core/pwrseq_emmc.c |
4371 |
+@@ -30,19 +30,14 @@ struct mmc_pwrseq_emmc { |
4372 |
+ |
4373 |
+ #define to_pwrseq_emmc(p) container_of(p, struct mmc_pwrseq_emmc, pwrseq) |
4374 |
+ |
4375 |
+-static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) |
4376 |
+-{ |
4377 |
+- gpiod_set_value(pwrseq->reset_gpio, 1); |
4378 |
+- udelay(1); |
4379 |
+- gpiod_set_value(pwrseq->reset_gpio, 0); |
4380 |
+- udelay(200); |
4381 |
+-} |
4382 |
+- |
4383 |
+ static void mmc_pwrseq_emmc_reset(struct mmc_host *host) |
4384 |
+ { |
4385 |
+ struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq); |
4386 |
+ |
4387 |
+- __mmc_pwrseq_emmc_reset(pwrseq); |
4388 |
++ gpiod_set_value_cansleep(pwrseq->reset_gpio, 1); |
4389 |
++ udelay(1); |
4390 |
++ gpiod_set_value_cansleep(pwrseq->reset_gpio, 0); |
4391 |
++ udelay(200); |
4392 |
+ } |
4393 |
+ |
4394 |
+ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
4395 |
+@@ -50,8 +45,11 @@ static int mmc_pwrseq_emmc_reset_nb(struct notifier_block *this, |
4396 |
+ { |
4397 |
+ struct mmc_pwrseq_emmc *pwrseq = container_of(this, |
4398 |
+ struct mmc_pwrseq_emmc, reset_nb); |
4399 |
++ gpiod_set_value(pwrseq->reset_gpio, 1); |
4400 |
++ udelay(1); |
4401 |
++ gpiod_set_value(pwrseq->reset_gpio, 0); |
4402 |
++ udelay(200); |
4403 |
+ |
4404 |
+- __mmc_pwrseq_emmc_reset(pwrseq); |
4405 |
+ return NOTIFY_DONE; |
4406 |
+ } |
4407 |
+ |
4408 |
+@@ -72,14 +70,18 @@ static int mmc_pwrseq_emmc_probe(struct platform_device *pdev) |
4409 |
+ if (IS_ERR(pwrseq->reset_gpio)) |
4410 |
+ return PTR_ERR(pwrseq->reset_gpio); |
4411 |
+ |
4412 |
+- /* |
4413 |
+- * register reset handler to ensure emmc reset also from |
4414 |
+- * emergency_reboot(), priority 255 is the highest priority |
4415 |
+- * so it will be executed before any system reboot handler. |
4416 |
+- */ |
4417 |
+- pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
4418 |
+- pwrseq->reset_nb.priority = 255; |
4419 |
+- register_restart_handler(&pwrseq->reset_nb); |
4420 |
++ if (!gpiod_cansleep(pwrseq->reset_gpio)) { |
4421 |
++ /* |
4422 |
++ * register reset handler to ensure emmc reset also from |
4423 |
++ * emergency_reboot(), priority 255 is the highest priority |
4424 |
++ * so it will be executed before any system reboot handler. |
4425 |
++ */ |
4426 |
++ pwrseq->reset_nb.notifier_call = mmc_pwrseq_emmc_reset_nb; |
4427 |
++ pwrseq->reset_nb.priority = 255; |
4428 |
++ register_restart_handler(&pwrseq->reset_nb); |
4429 |
++ } else { |
4430 |
++ dev_notice(dev, "EMMC reset pin tied to a sleepy GPIO driver; reset on emergency-reboot disabled\n"); |
4431 |
++ } |
4432 |
+ |
4433 |
+ pwrseq->pwrseq.ops = &mmc_pwrseq_emmc_ops; |
4434 |
+ pwrseq->pwrseq.dev = dev; |
4435 |
+diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c |
4436 |
+index d0d9f90e7cdf..cfb8ee24eaba 100644 |
4437 |
+--- a/drivers/mmc/core/sd.c |
4438 |
++++ b/drivers/mmc/core/sd.c |
4439 |
+@@ -216,6 +216,14 @@ static int mmc_decode_scr(struct mmc_card *card) |
4440 |
+ |
4441 |
+ if (scr->sda_spec3) |
4442 |
+ scr->cmds = UNSTUFF_BITS(resp, 32, 2); |
4443 |
++ |
4444 |
++ /* SD Spec says: any SD Card shall set at least bits 0 and 2 */ |
4445 |
++ if (!(scr->bus_widths & SD_SCR_BUS_WIDTH_1) || |
4446 |
++ !(scr->bus_widths & SD_SCR_BUS_WIDTH_4)) { |
4447 |
++ pr_err("%s: invalid bus width\n", mmc_hostname(card->host)); |
4448 |
++ return -EINVAL; |
4449 |
++ } |
4450 |
++ |
4451 |
+ return 0; |
4452 |
+ } |
4453 |
+ |
4454 |
+diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c |
4455 |
+index 67f6bd24a9d0..ea254d00541f 100644 |
4456 |
+--- a/drivers/mmc/host/mmc_spi.c |
4457 |
++++ b/drivers/mmc/host/mmc_spi.c |
4458 |
+@@ -819,6 +819,10 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, |
4459 |
+ } |
4460 |
+ |
4461 |
+ status = spi_sync_locked(spi, &host->m); |
4462 |
++ if (status < 0) { |
4463 |
++ dev_dbg(&spi->dev, "read error %d\n", status); |
4464 |
++ return status; |
4465 |
++ } |
4466 |
+ |
4467 |
+ if (host->dma_dev) { |
4468 |
+ dma_sync_single_for_cpu(host->dma_dev, |
4469 |
+diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c |
4470 |
+index 94eeed2a1b53..f903ab96aa21 100644 |
4471 |
+--- a/drivers/mmc/host/sdhci-iproc.c |
4472 |
++++ b/drivers/mmc/host/sdhci-iproc.c |
4473 |
+@@ -185,7 +185,8 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = { |
4474 |
+ }; |
4475 |
+ |
4476 |
+ static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = { |
4477 |
+- .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, |
4478 |
++ .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | |
4479 |
++ SDHCI_QUIRK_NO_HISPD_BIT, |
4480 |
+ .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN | SDHCI_QUIRK2_HOST_OFF_CARD_ON, |
4481 |
+ .ops = &sdhci_iproc_32only_ops, |
4482 |
+ }; |
4483 |
+@@ -208,7 +209,8 @@ static const struct sdhci_iproc_data iproc_cygnus_data = { |
4484 |
+ |
4485 |
+ static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = { |
4486 |
+ .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | |
4487 |
+- SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12, |
4488 |
++ SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 | |
4489 |
++ SDHCI_QUIRK_NO_HISPD_BIT, |
4490 |
+ .quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN, |
4491 |
+ .ops = &sdhci_iproc_ops, |
4492 |
+ }; |
4493 |
+diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c |
4494 |
+index a7bf8515116f..e5c598ae5f24 100644 |
4495 |
+--- a/drivers/mmc/host/sdhci-of-esdhc.c |
4496 |
++++ b/drivers/mmc/host/sdhci-of-esdhc.c |
4497 |
+@@ -643,6 +643,9 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask) |
4498 |
+ sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); |
4499 |
+ sdhci_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); |
4500 |
+ |
4501 |
++ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) |
4502 |
++ mdelay(5); |
4503 |
++ |
4504 |
+ if (mask & SDHCI_RESET_ALL) { |
4505 |
+ val = sdhci_readl(host, ESDHC_TBCTL); |
4506 |
+ val &= ~ESDHC_TB_EN; |
4507 |
+@@ -917,6 +920,11 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) |
4508 |
+ if (esdhc->vendor_ver > VENDOR_V_22) |
4509 |
+ host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ; |
4510 |
+ |
4511 |
++ if (of_find_compatible_node(NULL, NULL, "fsl,p2020-esdhc")) { |
4512 |
++ host->quirks2 |= SDHCI_QUIRK_RESET_AFTER_REQUEST; |
4513 |
++ host->quirks2 |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; |
4514 |
++ } |
4515 |
++ |
4516 |
+ if (of_device_is_compatible(np, "fsl,p5040-esdhc") || |
4517 |
+ of_device_is_compatible(np, "fsl,p5020-esdhc") || |
4518 |
+ of_device_is_compatible(np, "fsl,p4080-esdhc") || |
4519 |
+diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
4520 |
+index 1b5f591cf0a2..b5d72815776c 100644 |
4521 |
+--- a/drivers/net/ethernet/amazon/ena/ena_netdev.c |
4522 |
++++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c |
4523 |
+@@ -2223,7 +2223,7 @@ static void ena_config_host_info(struct ena_com_dev *ena_dev) |
4524 |
+ |
4525 |
+ host_info->os_type = ENA_ADMIN_OS_LINUX; |
4526 |
+ host_info->kernel_ver = LINUX_VERSION_CODE; |
4527 |
+- strncpy(host_info->kernel_ver_str, utsname()->version, |
4528 |
++ strlcpy(host_info->kernel_ver_str, utsname()->version, |
4529 |
+ sizeof(host_info->kernel_ver_str) - 1); |
4530 |
+ host_info->os_dist = 0; |
4531 |
+ strncpy(host_info->os_dist_str, utsname()->release, |
4532 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
4533 |
+index c2fd323c4078..ea75f275023f 100644 |
4534 |
+--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
4535 |
++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h |
4536 |
+@@ -75,8 +75,8 @@ struct l2t_data { |
4537 |
+ struct l2t_entry *rover; /* starting point for next allocation */ |
4538 |
+ atomic_t nfree; /* number of free entries */ |
4539 |
+ rwlock_t lock; |
4540 |
+- struct l2t_entry l2tab[0]; |
4541 |
+ struct rcu_head rcu_head; /* to handle rcu cleanup */ |
4542 |
++ struct l2t_entry l2tab[]; |
4543 |
+ }; |
4544 |
+ |
4545 |
+ typedef void (*arp_failure_handler_func)(struct t3cdev * dev, |
4546 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
4547 |
+index 961e3087d1d3..bb04c695ab9f 100644 |
4548 |
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
4549 |
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c |
4550 |
+@@ -6010,15 +6010,24 @@ static int __init cxgb4_init_module(void) |
4551 |
+ |
4552 |
+ ret = pci_register_driver(&cxgb4_driver); |
4553 |
+ if (ret < 0) |
4554 |
+- debugfs_remove(cxgb4_debugfs_root); |
4555 |
++ goto err_pci; |
4556 |
+ |
4557 |
+ #if IS_ENABLED(CONFIG_IPV6) |
4558 |
+ if (!inet6addr_registered) { |
4559 |
+- register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
4560 |
+- inet6addr_registered = true; |
4561 |
++ ret = register_inet6addr_notifier(&cxgb4_inet6addr_notifier); |
4562 |
++ if (ret) |
4563 |
++ pci_unregister_driver(&cxgb4_driver); |
4564 |
++ else |
4565 |
++ inet6addr_registered = true; |
4566 |
+ } |
4567 |
+ #endif |
4568 |
+ |
4569 |
++ if (ret == 0) |
4570 |
++ return ret; |
4571 |
++ |
4572 |
++err_pci: |
4573 |
++ debugfs_remove(cxgb4_debugfs_root); |
4574 |
++ |
4575 |
+ return ret; |
4576 |
+ } |
4577 |
+ |
4578 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
4579 |
+index 8b11682ebba2..8cd339c92c1a 100644 |
4580 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
4581 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
4582 |
+@@ -7329,7 +7329,7 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
4583 |
+ |
4584 |
+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
4585 |
+ |
4586 |
+- if (pci_dev_run_wake(pdev)) |
4587 |
++ if (pci_dev_run_wake(pdev) && hw->mac.type < e1000_pch_cnp) |
4588 |
+ pm_runtime_put_noidle(&pdev->dev); |
4589 |
+ |
4590 |
+ return 0; |
4591 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c |
4592 |
+index f81ad0aa8b09..df8808cd7e11 100644 |
4593 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_main.c |
4594 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_main.c |
4595 |
+@@ -2654,6 +2654,10 @@ void i40e_vlan_stripping_enable(struct i40e_vsi *vsi) |
4596 |
+ struct i40e_vsi_context ctxt; |
4597 |
+ i40e_status ret; |
4598 |
+ |
4599 |
++ /* Don't modify stripping options if a port VLAN is active */ |
4600 |
++ if (vsi->info.pvid) |
4601 |
++ return; |
4602 |
++ |
4603 |
+ if ((vsi->info.valid_sections & |
4604 |
+ cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
4605 |
+ ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_MODE_MASK) == 0)) |
4606 |
+@@ -2684,6 +2688,10 @@ void i40e_vlan_stripping_disable(struct i40e_vsi *vsi) |
4607 |
+ struct i40e_vsi_context ctxt; |
4608 |
+ i40e_status ret; |
4609 |
+ |
4610 |
++ /* Don't modify stripping options if a port VLAN is active */ |
4611 |
++ if (vsi->info.pvid) |
4612 |
++ return; |
4613 |
++ |
4614 |
+ if ((vsi->info.valid_sections & |
4615 |
+ cpu_to_le16(I40E_AQ_VSI_PROP_VLAN_VALID)) && |
4616 |
+ ((vsi->info.port_vlan_flags & I40E_AQ_VSI_PVLAN_EMOD_MASK) == |
4617 |
+diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4618 |
+index c6d24eaede18..d86f3fa7aa6a 100644 |
4619 |
+--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4620 |
++++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |
4621 |
+@@ -2399,8 +2399,10 @@ error_param: |
4622 |
+ (u8 *)&stats, sizeof(stats)); |
4623 |
+ } |
4624 |
+ |
4625 |
+-/* If the VF is not trusted restrict the number of MAC/VLAN it can program */ |
4626 |
+-#define I40E_VC_MAX_MAC_ADDR_PER_VF 12 |
4627 |
++/* If the VF is not trusted restrict the number of MAC/VLAN it can program |
4628 |
++ * MAC filters: 16 for multicast, 1 for MAC, 1 for broadcast |
4629 |
++ */ |
4630 |
++#define I40E_VC_MAX_MAC_ADDR_PER_VF (16 + 1 + 1) |
4631 |
+ #define I40E_VC_MAX_VLAN_PER_VF 8 |
4632 |
+ |
4633 |
+ /** |
4634 |
+diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c |
4635 |
+index aa39a068858e..5aa083d9a6c9 100644 |
4636 |
+--- a/drivers/net/ethernet/intel/igb/igb_main.c |
4637 |
++++ b/drivers/net/ethernet/intel/igb/igb_main.c |
4638 |
+@@ -3468,6 +3468,9 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
4639 |
+ break; |
4640 |
+ } |
4641 |
+ } |
4642 |
++ |
4643 |
++ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP); |
4644 |
++ |
4645 |
+ pm_runtime_put_noidle(&pdev->dev); |
4646 |
+ return 0; |
4647 |
+ |
4648 |
+diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c |
4649 |
+index fb12b63439c6..35413041dcf8 100644 |
4650 |
+--- a/drivers/net/hyperv/netvsc.c |
4651 |
++++ b/drivers/net/hyperv/netvsc.c |
4652 |
+@@ -872,12 +872,6 @@ static inline int netvsc_send_pkt( |
4653 |
+ } else if (ret == -EAGAIN) { |
4654 |
+ netif_tx_stop_queue(txq); |
4655 |
+ ndev_ctx->eth_stats.stop_queue++; |
4656 |
+- if (atomic_read(&nvchan->queue_sends) < 1 && |
4657 |
+- !net_device->tx_disable) { |
4658 |
+- netif_tx_wake_queue(txq); |
4659 |
+- ndev_ctx->eth_stats.wake_queue++; |
4660 |
+- ret = -ENOSPC; |
4661 |
+- } |
4662 |
+ } else { |
4663 |
+ netdev_err(ndev, |
4664 |
+ "Unable to send packet pages %u len %u, ret %d\n", |
4665 |
+@@ -885,6 +879,15 @@ static inline int netvsc_send_pkt( |
4666 |
+ ret); |
4667 |
+ } |
4668 |
+ |
4669 |
++ if (netif_tx_queue_stopped(txq) && |
4670 |
++ atomic_read(&nvchan->queue_sends) < 1 && |
4671 |
++ !net_device->tx_disable) { |
4672 |
++ netif_tx_wake_queue(txq); |
4673 |
++ ndev_ctx->eth_stats.wake_queue++; |
4674 |
++ if (ret == -EAGAIN) |
4675 |
++ ret = -ENOSPC; |
4676 |
++ } |
4677 |
++ |
4678 |
+ return ret; |
4679 |
+ } |
4680 |
+ |
4681 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
4682 |
+index 366217263d70..d9a6699abe59 100644 |
4683 |
+--- a/drivers/net/usb/qmi_wwan.c |
4684 |
++++ b/drivers/net/usb/qmi_wwan.c |
4685 |
+@@ -63,6 +63,7 @@ enum qmi_wwan_flags { |
4686 |
+ |
4687 |
+ enum qmi_wwan_quirks { |
4688 |
+ QMI_WWAN_QUIRK_DTR = 1 << 0, /* needs "set DTR" request */ |
4689 |
++ QMI_WWAN_QUIRK_QUECTEL_DYNCFG = 1 << 1, /* check num. endpoints */ |
4690 |
+ }; |
4691 |
+ |
4692 |
+ struct qmimux_hdr { |
4693 |
+@@ -845,6 +846,16 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { |
4694 |
+ .data = QMI_WWAN_QUIRK_DTR, |
4695 |
+ }; |
4696 |
+ |
4697 |
++static const struct driver_info qmi_wwan_info_quirk_quectel_dyncfg = { |
4698 |
++ .description = "WWAN/QMI device", |
4699 |
++ .flags = FLAG_WWAN | FLAG_SEND_ZLP, |
4700 |
++ .bind = qmi_wwan_bind, |
4701 |
++ .unbind = qmi_wwan_unbind, |
4702 |
++ .manage_power = qmi_wwan_manage_power, |
4703 |
++ .rx_fixup = qmi_wwan_rx_fixup, |
4704 |
++ .data = QMI_WWAN_QUIRK_DTR | QMI_WWAN_QUIRK_QUECTEL_DYNCFG, |
4705 |
++}; |
4706 |
++ |
4707 |
+ #define HUAWEI_VENDOR_ID 0x12D1 |
4708 |
+ |
4709 |
+ /* map QMI/wwan function by a fixed interface number */ |
4710 |
+@@ -865,6 +876,15 @@ static const struct driver_info qmi_wwan_info_quirk_dtr = { |
4711 |
+ #define QMI_GOBI_DEVICE(vend, prod) \ |
4712 |
+ QMI_FIXED_INTF(vend, prod, 0) |
4713 |
+ |
4714 |
++/* Quectel does not use fixed interface numbers on at least some of their |
4715 |
++ * devices. We need to check the number of endpoints to ensure that we bind to |
4716 |
++ * the correct interface. |
4717 |
++ */ |
4718 |
++#define QMI_QUIRK_QUECTEL_DYNCFG(vend, prod) \ |
4719 |
++ USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VENDOR_SPEC, \ |
4720 |
++ USB_SUBCLASS_VENDOR_SPEC, 0xff), \ |
4721 |
++ .driver_info = (unsigned long)&qmi_wwan_info_quirk_quectel_dyncfg |
4722 |
++ |
4723 |
+ static const struct usb_device_id products[] = { |
4724 |
+ /* 1. CDC ECM like devices match on the control interface */ |
4725 |
+ { /* Huawei E392, E398 and possibly others sharing both device id and more... */ |
4726 |
+@@ -969,20 +989,9 @@ static const struct usb_device_id products[] = { |
4727 |
+ USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0x581d, USB_CLASS_VENDOR_SPEC, 1, 7), |
4728 |
+ .driver_info = (unsigned long)&qmi_wwan_info, |
4729 |
+ }, |
4730 |
+- { /* Quectel EP06/EG06/EM06 */ |
4731 |
+- USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0306, |
4732 |
+- USB_CLASS_VENDOR_SPEC, |
4733 |
+- USB_SUBCLASS_VENDOR_SPEC, |
4734 |
+- 0xff), |
4735 |
+- .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, |
4736 |
+- }, |
4737 |
+- { /* Quectel EG12/EM12 */ |
4738 |
+- USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0512, |
4739 |
+- USB_CLASS_VENDOR_SPEC, |
4740 |
+- USB_SUBCLASS_VENDOR_SPEC, |
4741 |
+- 0xff), |
4742 |
+- .driver_info = (unsigned long)&qmi_wwan_info_quirk_dtr, |
4743 |
+- }, |
4744 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ |
4745 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ |
4746 |
++ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ |
4747 |
+ |
4748 |
+ /* 3. Combined interface devices matching on interface number */ |
4749 |
+ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ |
4750 |
+@@ -1283,7 +1292,6 @@ static const struct usb_device_id products[] = { |
4751 |
+ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ |
4752 |
+ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ |
4753 |
+ {QMI_QUIRK_SET_DTR(0x1e0e, 0x9001, 5)}, /* SIMCom 7100E, 7230E, 7600E ++ */ |
4754 |
+- {QMI_QUIRK_SET_DTR(0x2c7c, 0x0125, 4)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ |
4755 |
+ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0121, 4)}, /* Quectel EC21 Mini PCIe */ |
4756 |
+ {QMI_QUIRK_SET_DTR(0x2c7c, 0x0191, 4)}, /* Quectel EG91 */ |
4757 |
+ {QMI_FIXED_INTF(0x2c7c, 0x0296, 4)}, /* Quectel BG96 */ |
4758 |
+@@ -1363,27 +1371,12 @@ static bool quectel_ec20_detected(struct usb_interface *intf) |
4759 |
+ return false; |
4760 |
+ } |
4761 |
+ |
4762 |
+-static bool quectel_diag_detected(struct usb_interface *intf) |
4763 |
+-{ |
4764 |
+- struct usb_device *dev = interface_to_usbdev(intf); |
4765 |
+- struct usb_interface_descriptor intf_desc = intf->cur_altsetting->desc; |
4766 |
+- u16 id_vendor = le16_to_cpu(dev->descriptor.idVendor); |
4767 |
+- u16 id_product = le16_to_cpu(dev->descriptor.idProduct); |
4768 |
+- |
4769 |
+- if (id_vendor != 0x2c7c || intf_desc.bNumEndpoints != 2) |
4770 |
+- return false; |
4771 |
+- |
4772 |
+- if (id_product == 0x0306 || id_product == 0x0512) |
4773 |
+- return true; |
4774 |
+- else |
4775 |
+- return false; |
4776 |
+-} |
4777 |
+- |
4778 |
+ static int qmi_wwan_probe(struct usb_interface *intf, |
4779 |
+ const struct usb_device_id *prod) |
4780 |
+ { |
4781 |
+ struct usb_device_id *id = (struct usb_device_id *)prod; |
4782 |
+ struct usb_interface_descriptor *desc = &intf->cur_altsetting->desc; |
4783 |
++ const struct driver_info *info; |
4784 |
+ |
4785 |
+ /* Workaround to enable dynamic IDs. This disables usbnet |
4786 |
+ * blacklisting functionality. Which, if required, can be |
4787 |
+@@ -1417,10 +1410,14 @@ static int qmi_wwan_probe(struct usb_interface *intf, |
4788 |
+ * we need to match on class/subclass/protocol. These values are |
4789 |
+ * identical for the diagnostic- and QMI-interface, but bNumEndpoints is |
4790 |
+ * different. Ignore the current interface if the number of endpoints |
4791 |
+- * the number for the diag interface (two). |
4792 |
++ * equals the number for the diag interface (two). |
4793 |
+ */ |
4794 |
+- if (quectel_diag_detected(intf)) |
4795 |
+- return -ENODEV; |
4796 |
++ info = (void *)&id->driver_info; |
4797 |
++ |
4798 |
++ if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) { |
4799 |
++ if (desc->bNumEndpoints == 2) |
4800 |
++ return -ENODEV; |
4801 |
++ } |
4802 |
+ |
4803 |
+ return usbnet_probe(intf, id); |
4804 |
+ } |
4805 |
+diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c |
4806 |
+index 2daf33342b23..1fc2bf66845c 100644 |
4807 |
+--- a/drivers/net/wireless/ath/wil6210/cfg80211.c |
4808 |
++++ b/drivers/net/wireless/ath/wil6210/cfg80211.c |
4809 |
+@@ -1131,7 +1131,12 @@ int wil_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, |
4810 |
+ params->wait); |
4811 |
+ |
4812 |
+ out: |
4813 |
++ /* when the sent packet was not acked by receiver(ACK=0), rc will |
4814 |
++ * be -EAGAIN. In this case this function needs to return success, |
4815 |
++ * the ACK=0 will be reflected in tx_status. |
4816 |
++ */ |
4817 |
+ tx_status = (rc == 0); |
4818 |
++ rc = (rc == -EAGAIN) ? 0 : rc; |
4819 |
+ cfg80211_mgmt_tx_status(wdev, cookie ? *cookie : 0, buf, len, |
4820 |
+ tx_status, GFP_KERNEL); |
4821 |
+ |
4822 |
+diff --git a/drivers/net/wireless/ath/wil6210/wmi.c b/drivers/net/wireless/ath/wil6210/wmi.c |
4823 |
+index 42c02a20ec97..6e3b3031f29b 100644 |
4824 |
+--- a/drivers/net/wireless/ath/wil6210/wmi.c |
4825 |
++++ b/drivers/net/wireless/ath/wil6210/wmi.c |
4826 |
+@@ -3107,8 +3107,9 @@ int wmi_mgmt_tx(struct wil6210_vif *vif, const u8 *buf, size_t len) |
4827 |
+ rc = wmi_call(wil, WMI_SW_TX_REQ_CMDID, vif->mid, cmd, total, |
4828 |
+ WMI_SW_TX_COMPLETE_EVENTID, &evt, sizeof(evt), 2000); |
4829 |
+ if (!rc && evt.evt.status != WMI_FW_STATUS_SUCCESS) { |
4830 |
+- wil_err(wil, "mgmt_tx failed with status %d\n", evt.evt.status); |
4831 |
+- rc = -EINVAL; |
4832 |
++ wil_dbg_wmi(wil, "mgmt_tx failed with status %d\n", |
4833 |
++ evt.evt.status); |
4834 |
++ rc = -EAGAIN; |
4835 |
+ } |
4836 |
+ |
4837 |
+ kfree(cmd); |
4838 |
+@@ -3160,9 +3161,9 @@ int wmi_mgmt_tx_ext(struct wil6210_vif *vif, const u8 *buf, size_t len, |
4839 |
+ rc = wmi_call(wil, WMI_SW_TX_REQ_EXT_CMDID, vif->mid, cmd, total, |
4840 |
+ WMI_SW_TX_COMPLETE_EVENTID, &evt, sizeof(evt), 2000); |
4841 |
+ if (!rc && evt.evt.status != WMI_FW_STATUS_SUCCESS) { |
4842 |
+- wil_err(wil, "mgmt_tx_ext failed with status %d\n", |
4843 |
+- evt.evt.status); |
4844 |
+- rc = -EINVAL; |
4845 |
++ wil_dbg_wmi(wil, "mgmt_tx_ext failed with status %d\n", |
4846 |
++ evt.evt.status); |
4847 |
++ rc = -EAGAIN; |
4848 |
+ } |
4849 |
+ |
4850 |
+ kfree(cmd); |
4851 |
+diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c |
4852 |
+index e99e766a3028..1cabae424839 100644 |
4853 |
+--- a/drivers/net/wireless/atmel/at76c50x-usb.c |
4854 |
++++ b/drivers/net/wireless/atmel/at76c50x-usb.c |
4855 |
+@@ -2585,8 +2585,8 @@ static int __init at76_mod_init(void) |
4856 |
+ if (result < 0) |
4857 |
+ printk(KERN_ERR DRIVER_NAME |
4858 |
+ ": usb_register failed (status %d)\n", result); |
4859 |
+- |
4860 |
+- led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
4861 |
++ else |
4862 |
++ led_trigger_register_simple("at76_usb-tx", &ledtrig_tx); |
4863 |
+ return result; |
4864 |
+ } |
4865 |
+ |
4866 |
+diff --git a/drivers/net/wireless/broadcom/b43/phy_lp.c b/drivers/net/wireless/broadcom/b43/phy_lp.c |
4867 |
+index 6922cbb99a04..5a0699fb4b9a 100644 |
4868 |
+--- a/drivers/net/wireless/broadcom/b43/phy_lp.c |
4869 |
++++ b/drivers/net/wireless/broadcom/b43/phy_lp.c |
4870 |
+@@ -1834,7 +1834,7 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, |
4871 |
+ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
4872 |
+ { |
4873 |
+ struct b43_phy_lp *lpphy = dev->phy.lp; |
4874 |
+- struct lpphy_tx_gains gains, oldgains; |
4875 |
++ struct lpphy_tx_gains oldgains; |
4876 |
+ int old_txpctl, old_afe_ovr, old_rf, old_bbmult; |
4877 |
+ |
4878 |
+ lpphy_read_tx_pctl_mode_from_hardware(dev); |
4879 |
+@@ -1848,9 +1848,9 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
4880 |
+ lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); |
4881 |
+ |
4882 |
+ if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) |
4883 |
+- lpphy_papd_cal(dev, gains, 0, 1, 30); |
4884 |
++ lpphy_papd_cal(dev, oldgains, 0, 1, 30); |
4885 |
+ else |
4886 |
+- lpphy_papd_cal(dev, gains, 0, 1, 65); |
4887 |
++ lpphy_papd_cal(dev, oldgains, 0, 1, 65); |
4888 |
+ |
4889 |
+ if (old_afe_ovr) |
4890 |
+ lpphy_set_tx_gains(dev, oldgains); |
4891 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4892 |
+index 6f3faaf1b1cb..c7c520f327f2 100644 |
4893 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4894 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |
4895 |
+@@ -3466,6 +3466,8 @@ brcmf_wowl_nd_results(struct brcmf_if *ifp, const struct brcmf_event_msg *e, |
4896 |
+ } |
4897 |
+ |
4898 |
+ netinfo = brcmf_get_netinfo_array(pfn_result); |
4899 |
++ if (netinfo->SSID_len > IEEE80211_MAX_SSID_LEN) |
4900 |
++ netinfo->SSID_len = IEEE80211_MAX_SSID_LEN; |
4901 |
+ memcpy(cfg->wowl.nd->ssid.ssid, netinfo->SSID, netinfo->SSID_len); |
4902 |
+ cfg->wowl.nd->ssid.ssid_len = netinfo->SSID_len; |
4903 |
+ cfg->wowl.nd->n_channels = 1; |
4904 |
+@@ -5366,6 +5368,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
4905 |
+ conn_info->req_ie = |
4906 |
+ kmemdup(cfg->extra_buf, conn_info->req_ie_len, |
4907 |
+ GFP_KERNEL); |
4908 |
++ if (!conn_info->req_ie) |
4909 |
++ conn_info->req_ie_len = 0; |
4910 |
+ } else { |
4911 |
+ conn_info->req_ie_len = 0; |
4912 |
+ conn_info->req_ie = NULL; |
4913 |
+@@ -5382,6 +5386,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg, |
4914 |
+ conn_info->resp_ie = |
4915 |
+ kmemdup(cfg->extra_buf, conn_info->resp_ie_len, |
4916 |
+ GFP_KERNEL); |
4917 |
++ if (!conn_info->resp_ie) |
4918 |
++ conn_info->resp_ie_len = 0; |
4919 |
+ } else { |
4920 |
+ conn_info->resp_ie_len = 0; |
4921 |
+ conn_info->resp_ie = NULL; |
4922 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
4923 |
+index 860a4372cb56..36a04c1144e5 100644 |
4924 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
4925 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c |
4926 |
+@@ -464,7 +464,8 @@ void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event) |
4927 |
+ } else { |
4928 |
+ /* Process special event packets */ |
4929 |
+ if (handle_event) |
4930 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
4931 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, |
4932 |
++ BCMILCP_SUBTYPE_VENDOR_LONG); |
4933 |
+ |
4934 |
+ brcmf_netif_rx(ifp, skb); |
4935 |
+ } |
4936 |
+@@ -481,7 +482,7 @@ void brcmf_rx_event(struct device *dev, struct sk_buff *skb) |
4937 |
+ if (brcmf_rx_hdrpull(drvr, skb, &ifp)) |
4938 |
+ return; |
4939 |
+ |
4940 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
4941 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, 0); |
4942 |
+ brcmu_pkt_buf_free_skb(skb); |
4943 |
+ } |
4944 |
+ |
4945 |
+@@ -783,17 +784,17 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
4946 |
+ bool rtnl_locked) |
4947 |
+ { |
4948 |
+ struct brcmf_if *ifp; |
4949 |
++ int ifidx; |
4950 |
+ |
4951 |
+ ifp = drvr->iflist[bsscfgidx]; |
4952 |
+- drvr->iflist[bsscfgidx] = NULL; |
4953 |
+ if (!ifp) { |
4954 |
+ brcmf_err("Null interface, bsscfgidx=%d\n", bsscfgidx); |
4955 |
+ return; |
4956 |
+ } |
4957 |
+ brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, |
4958 |
+ ifp->ifidx); |
4959 |
+- if (drvr->if2bss[ifp->ifidx] == bsscfgidx) |
4960 |
+- drvr->if2bss[ifp->ifidx] = BRCMF_BSSIDX_INVALID; |
4961 |
++ ifidx = ifp->ifidx; |
4962 |
++ |
4963 |
+ if (ifp->ndev) { |
4964 |
+ if (bsscfgidx == 0) { |
4965 |
+ if (ifp->ndev->netdev_ops == &brcmf_netdev_ops_pri) { |
4966 |
+@@ -821,6 +822,10 @@ static void brcmf_del_if(struct brcmf_pub *drvr, s32 bsscfgidx, |
4967 |
+ brcmf_p2p_ifp_removed(ifp, rtnl_locked); |
4968 |
+ kfree(ifp); |
4969 |
+ } |
4970 |
++ |
4971 |
++ drvr->iflist[bsscfgidx] = NULL; |
4972 |
++ if (drvr->if2bss[ifidx] == bsscfgidx) |
4973 |
++ drvr->if2bss[ifidx] = BRCMF_BSSIDX_INVALID; |
4974 |
+ } |
4975 |
+ |
4976 |
+ void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) |
4977 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
4978 |
+index 816f80ea925b..ebd66fe0d949 100644 |
4979 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
4980 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.h |
4981 |
+@@ -211,7 +211,7 @@ enum brcmf_fweh_event_code { |
4982 |
+ */ |
4983 |
+ #define BRCM_OUI "\x00\x10\x18" |
4984 |
+ #define BCMILCP_BCM_SUBTYPE_EVENT 1 |
4985 |
+- |
4986 |
++#define BCMILCP_SUBTYPE_VENDOR_LONG 32769 |
4987 |
+ |
4988 |
+ /** |
4989 |
+ * struct brcm_ethhdr - broadcom specific ether header. |
4990 |
+@@ -334,10 +334,10 @@ void brcmf_fweh_process_event(struct brcmf_pub *drvr, |
4991 |
+ void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing); |
4992 |
+ |
4993 |
+ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, |
4994 |
+- struct sk_buff *skb) |
4995 |
++ struct sk_buff *skb, u16 stype) |
4996 |
+ { |
4997 |
+ struct brcmf_event *event_packet; |
4998 |
+- u16 usr_stype; |
4999 |
++ u16 subtype, usr_stype; |
5000 |
+ |
5001 |
+ /* only process events when protocol matches */ |
5002 |
+ if (skb->protocol != cpu_to_be16(ETH_P_LINK_CTL)) |
5003 |
+@@ -346,8 +346,16 @@ static inline void brcmf_fweh_process_skb(struct brcmf_pub *drvr, |
5004 |
+ if ((skb->len + ETH_HLEN) < sizeof(*event_packet)) |
5005 |
+ return; |
5006 |
+ |
5007 |
+- /* check for BRCM oui match */ |
5008 |
+ event_packet = (struct brcmf_event *)skb_mac_header(skb); |
5009 |
++ |
5010 |
++ /* check subtype if needed */ |
5011 |
++ if (unlikely(stype)) { |
5012 |
++ subtype = get_unaligned_be16(&event_packet->hdr.subtype); |
5013 |
++ if (subtype != stype) |
5014 |
++ return; |
5015 |
++ } |
5016 |
++ |
5017 |
++ /* check for BRCM oui match */ |
5018 |
+ if (memcmp(BRCM_OUI, &event_packet->hdr.oui[0], |
5019 |
+ sizeof(event_packet->hdr.oui))) |
5020 |
+ return; |
5021 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
5022 |
+index f3cbf78c8899..5a0a29c4cdea 100644 |
5023 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
5024 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c |
5025 |
+@@ -579,24 +579,6 @@ static bool brcmf_fws_ifidx_match(struct sk_buff *skb, void *arg) |
5026 |
+ return ifidx == *(int *)arg; |
5027 |
+ } |
5028 |
+ |
5029 |
+-static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
5030 |
+- int ifidx) |
5031 |
+-{ |
5032 |
+- bool (*matchfn)(struct sk_buff *, void *) = NULL; |
5033 |
+- struct sk_buff *skb; |
5034 |
+- int prec; |
5035 |
+- |
5036 |
+- if (ifidx != -1) |
5037 |
+- matchfn = brcmf_fws_ifidx_match; |
5038 |
+- for (prec = 0; prec < q->num_prec; prec++) { |
5039 |
+- skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
5040 |
+- while (skb) { |
5041 |
+- brcmu_pkt_buf_free_skb(skb); |
5042 |
+- skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
5043 |
+- } |
5044 |
+- } |
5045 |
+-} |
5046 |
+- |
5047 |
+ static void brcmf_fws_hanger_init(struct brcmf_fws_hanger *hanger) |
5048 |
+ { |
5049 |
+ int i; |
5050 |
+@@ -668,6 +650,28 @@ static inline int brcmf_fws_hanger_poppkt(struct brcmf_fws_hanger *h, |
5051 |
+ return 0; |
5052 |
+ } |
5053 |
+ |
5054 |
++static void brcmf_fws_psq_flush(struct brcmf_fws_info *fws, struct pktq *q, |
5055 |
++ int ifidx) |
5056 |
++{ |
5057 |
++ bool (*matchfn)(struct sk_buff *, void *) = NULL; |
5058 |
++ struct sk_buff *skb; |
5059 |
++ int prec; |
5060 |
++ u32 hslot; |
5061 |
++ |
5062 |
++ if (ifidx != -1) |
5063 |
++ matchfn = brcmf_fws_ifidx_match; |
5064 |
++ for (prec = 0; prec < q->num_prec; prec++) { |
5065 |
++ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
5066 |
++ while (skb) { |
5067 |
++ hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); |
5068 |
++ brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, |
5069 |
++ true); |
5070 |
++ brcmu_pkt_buf_free_skb(skb); |
5071 |
++ skb = brcmu_pktq_pdeq_match(q, prec, matchfn, &ifidx); |
5072 |
++ } |
5073 |
++ } |
5074 |
++} |
5075 |
++ |
5076 |
+ static int brcmf_fws_hanger_mark_suppressed(struct brcmf_fws_hanger *h, |
5077 |
+ u32 slot_id) |
5078 |
+ { |
5079 |
+@@ -2168,6 +2172,8 @@ void brcmf_fws_del_interface(struct brcmf_if *ifp) |
5080 |
+ brcmf_fws_lock(fws); |
5081 |
+ ifp->fws_desc = NULL; |
5082 |
+ brcmf_dbg(TRACE, "deleting %s\n", entry->name); |
5083 |
++ brcmf_fws_macdesc_cleanup(fws, &fws->desc.iface[ifp->ifidx], |
5084 |
++ ifp->ifidx); |
5085 |
+ brcmf_fws_macdesc_deinit(entry); |
5086 |
+ brcmf_fws_cleanup(fws, ifp->ifidx); |
5087 |
+ brcmf_fws_unlock(fws); |
5088 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
5089 |
+index 4e8397a0cbc8..ee922b052561 100644 |
5090 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
5091 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c |
5092 |
+@@ -1116,7 +1116,7 @@ static void brcmf_msgbuf_process_event(struct brcmf_msgbuf *msgbuf, void *buf) |
5093 |
+ |
5094 |
+ skb->protocol = eth_type_trans(skb, ifp->ndev); |
5095 |
+ |
5096 |
+- brcmf_fweh_process_skb(ifp->drvr, skb); |
5097 |
++ brcmf_fweh_process_skb(ifp->drvr, skb, 0); |
5098 |
+ |
5099 |
+ exit: |
5100 |
+ brcmu_pkt_buf_free_skb(skb); |
5101 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
5102 |
+index a4308c6e72d7..44ead0fea7c6 100644 |
5103 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
5104 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c |
5105 |
+@@ -160,7 +160,7 @@ struct brcmf_usbdev_info { |
5106 |
+ |
5107 |
+ struct usb_device *usbdev; |
5108 |
+ struct device *dev; |
5109 |
+- struct mutex dev_init_lock; |
5110 |
++ struct completion dev_init_done; |
5111 |
+ |
5112 |
+ int ctl_in_pipe, ctl_out_pipe; |
5113 |
+ struct urb *ctl_urb; /* URB for control endpoint */ |
5114 |
+@@ -684,12 +684,18 @@ static int brcmf_usb_up(struct device *dev) |
5115 |
+ |
5116 |
+ static void brcmf_cancel_all_urbs(struct brcmf_usbdev_info *devinfo) |
5117 |
+ { |
5118 |
++ int i; |
5119 |
++ |
5120 |
+ if (devinfo->ctl_urb) |
5121 |
+ usb_kill_urb(devinfo->ctl_urb); |
5122 |
+ if (devinfo->bulk_urb) |
5123 |
+ usb_kill_urb(devinfo->bulk_urb); |
5124 |
+- brcmf_usb_free_q(&devinfo->tx_postq, true); |
5125 |
+- brcmf_usb_free_q(&devinfo->rx_postq, true); |
5126 |
++ if (devinfo->tx_reqs) |
5127 |
++ for (i = 0; i < devinfo->bus_pub.ntxq; i++) |
5128 |
++ usb_kill_urb(devinfo->tx_reqs[i].urb); |
5129 |
++ if (devinfo->rx_reqs) |
5130 |
++ for (i = 0; i < devinfo->bus_pub.nrxq; i++) |
5131 |
++ usb_kill_urb(devinfo->rx_reqs[i].urb); |
5132 |
+ } |
5133 |
+ |
5134 |
+ static void brcmf_usb_down(struct device *dev) |
5135 |
+@@ -1195,11 +1201,11 @@ static void brcmf_usb_probe_phase2(struct device *dev, int ret, |
5136 |
+ if (ret) |
5137 |
+ goto error; |
5138 |
+ |
5139 |
+- mutex_unlock(&devinfo->dev_init_lock); |
5140 |
++ complete(&devinfo->dev_init_done); |
5141 |
+ return; |
5142 |
+ error: |
5143 |
+ brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), ret); |
5144 |
+- mutex_unlock(&devinfo->dev_init_lock); |
5145 |
++ complete(&devinfo->dev_init_done); |
5146 |
+ device_release_driver(dev); |
5147 |
+ } |
5148 |
+ |
5149 |
+@@ -1267,7 +1273,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo) |
5150 |
+ if (ret) |
5151 |
+ goto fail; |
5152 |
+ /* we are done */ |
5153 |
+- mutex_unlock(&devinfo->dev_init_lock); |
5154 |
++ complete(&devinfo->dev_init_done); |
5155 |
+ return 0; |
5156 |
+ } |
5157 |
+ bus->chip = bus_pub->devid; |
5158 |
+@@ -1327,11 +1333,10 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
5159 |
+ |
5160 |
+ devinfo->usbdev = usb; |
5161 |
+ devinfo->dev = &usb->dev; |
5162 |
+- /* Take an init lock, to protect for disconnect while still loading. |
5163 |
++ /* Init completion, to protect for disconnect while still loading. |
5164 |
+ * Necessary because of the asynchronous firmware load construction |
5165 |
+ */ |
5166 |
+- mutex_init(&devinfo->dev_init_lock); |
5167 |
+- mutex_lock(&devinfo->dev_init_lock); |
5168 |
++ init_completion(&devinfo->dev_init_done); |
5169 |
+ |
5170 |
+ usb_set_intfdata(intf, devinfo); |
5171 |
+ |
5172 |
+@@ -1409,7 +1414,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) |
5173 |
+ return 0; |
5174 |
+ |
5175 |
+ fail: |
5176 |
+- mutex_unlock(&devinfo->dev_init_lock); |
5177 |
++ complete(&devinfo->dev_init_done); |
5178 |
+ kfree(devinfo); |
5179 |
+ usb_set_intfdata(intf, NULL); |
5180 |
+ return ret; |
5181 |
+@@ -1424,7 +1429,7 @@ brcmf_usb_disconnect(struct usb_interface *intf) |
5182 |
+ devinfo = (struct brcmf_usbdev_info *)usb_get_intfdata(intf); |
5183 |
+ |
5184 |
+ if (devinfo) { |
5185 |
+- mutex_lock(&devinfo->dev_init_lock); |
5186 |
++ wait_for_completion(&devinfo->dev_init_done); |
5187 |
+ /* Make sure that devinfo still exists. Firmware probe routines |
5188 |
+ * may have released the device and cleared the intfdata. |
5189 |
+ */ |
5190 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
5191 |
+index 8eff2753abad..d493021f6031 100644 |
5192 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
5193 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/vendor.c |
5194 |
+@@ -35,9 +35,10 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
5195 |
+ struct brcmf_if *ifp; |
5196 |
+ const struct brcmf_vndr_dcmd_hdr *cmdhdr = data; |
5197 |
+ struct sk_buff *reply; |
5198 |
+- int ret, payload, ret_len; |
5199 |
++ unsigned int payload, ret_len; |
5200 |
+ void *dcmd_buf = NULL, *wr_pointer; |
5201 |
+ u16 msglen, maxmsglen = PAGE_SIZE - 0x100; |
5202 |
++ int ret; |
5203 |
+ |
5204 |
+ if (len < sizeof(*cmdhdr)) { |
5205 |
+ brcmf_err("vendor command too short: %d\n", len); |
5206 |
+@@ -65,7 +66,7 @@ static int brcmf_cfg80211_vndr_cmds_dcmd_handler(struct wiphy *wiphy, |
5207 |
+ brcmf_err("oversize return buffer %d\n", ret_len); |
5208 |
+ ret_len = BRCMF_DCMD_MAXLEN; |
5209 |
+ } |
5210 |
+- payload = max(ret_len, len) + 1; |
5211 |
++ payload = max_t(unsigned int, ret_len, len) + 1; |
5212 |
+ dcmd_buf = vzalloc(payload); |
5213 |
+ if (NULL == dcmd_buf) |
5214 |
+ return -ENOMEM; |
5215 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5216 |
+index b2905f01b7df..6dcd5374d9b4 100644 |
5217 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5218 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c |
5219 |
+@@ -1388,10 +1388,15 @@ out_err: |
5220 |
+ static void iwl_pcie_rx_handle(struct iwl_trans *trans, int queue) |
5221 |
+ { |
5222 |
+ struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
5223 |
+- struct iwl_rxq *rxq = &trans_pcie->rxq[queue]; |
5224 |
++ struct iwl_rxq *rxq; |
5225 |
+ u32 r, i, count = 0; |
5226 |
+ bool emergency = false; |
5227 |
+ |
5228 |
++ if (WARN_ON_ONCE(!trans_pcie->rxq || !trans_pcie->rxq[queue].bd)) |
5229 |
++ return; |
5230 |
++ |
5231 |
++ rxq = &trans_pcie->rxq[queue]; |
5232 |
++ |
5233 |
+ restart: |
5234 |
+ spin_lock(&rxq->lock); |
5235 |
+ /* uCode's read index (stored in shared DRAM) indicates the last Rx |
5236 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
5237 |
+index 2d87ebbfa4da..47ec5293c045 100644 |
5238 |
+--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
5239 |
++++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c |
5240 |
+@@ -4045,16 +4045,20 @@ static int mwifiex_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev, |
5241 |
+ |
5242 |
+ if (mwifiex_send_cmd(priv, 0, 0, 0, hostcmd, true)) { |
5243 |
+ dev_err(priv->adapter->dev, "Failed to process hostcmd\n"); |
5244 |
++ kfree(hostcmd); |
5245 |
+ return -EFAULT; |
5246 |
+ } |
5247 |
+ |
5248 |
+ /* process hostcmd response*/ |
5249 |
+ skb = cfg80211_testmode_alloc_reply_skb(wiphy, hostcmd->len); |
5250 |
+- if (!skb) |
5251 |
++ if (!skb) { |
5252 |
++ kfree(hostcmd); |
5253 |
+ return -ENOMEM; |
5254 |
++ } |
5255 |
+ err = nla_put(skb, MWIFIEX_TM_ATTR_DATA, |
5256 |
+ hostcmd->len, hostcmd->cmd); |
5257 |
+ if (err) { |
5258 |
++ kfree(hostcmd); |
5259 |
+ kfree_skb(skb); |
5260 |
+ return -EMSGSIZE; |
5261 |
+ } |
5262 |
+diff --git a/drivers/net/wireless/marvell/mwifiex/cfp.c b/drivers/net/wireless/marvell/mwifiex/cfp.c |
5263 |
+index bfe84e55df77..f1522fb1c1e8 100644 |
5264 |
+--- a/drivers/net/wireless/marvell/mwifiex/cfp.c |
5265 |
++++ b/drivers/net/wireless/marvell/mwifiex/cfp.c |
5266 |
+@@ -531,5 +531,8 @@ u8 mwifiex_adjust_data_rate(struct mwifiex_private *priv, |
5267 |
+ rate_index = (rx_rate > MWIFIEX_RATE_INDEX_OFDM0) ? |
5268 |
+ rx_rate - 1 : rx_rate; |
5269 |
+ |
5270 |
++ if (rate_index >= MWIFIEX_MAX_AC_RX_RATES) |
5271 |
++ rate_index = MWIFIEX_MAX_AC_RX_RATES - 1; |
5272 |
++ |
5273 |
+ return rate_index; |
5274 |
+ } |
5275 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c |
5276 |
+index ef9b502ce576..a3189294ecb8 100644 |
5277 |
+--- a/drivers/net/wireless/realtek/rtlwifi/base.c |
5278 |
++++ b/drivers/net/wireless/realtek/rtlwifi/base.c |
5279 |
+@@ -469,6 +469,11 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) |
5280 |
+ /* <2> work queue */ |
5281 |
+ rtlpriv->works.hw = hw; |
5282 |
+ rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
5283 |
++ if (unlikely(!rtlpriv->works.rtl_wq)) { |
5284 |
++ pr_err("Failed to allocate work queue\n"); |
5285 |
++ return; |
5286 |
++ } |
5287 |
++ |
5288 |
+ INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
5289 |
+ (void *)rtl_watchdog_wq_callback); |
5290 |
+ INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
5291 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
5292 |
+index 63874512598b..b5f91c994c79 100644 |
5293 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
5294 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/fw.c |
5295 |
+@@ -622,6 +622,8 @@ void rtl88e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
5296 |
+ u1rsvdpageloc, 3); |
5297 |
+ |
5298 |
+ skb = dev_alloc_skb(totalpacketlen); |
5299 |
++ if (!skb) |
5300 |
++ return; |
5301 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
5302 |
+ |
5303 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5304 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
5305 |
+index f3bff66e85d0..81ec0e6e07c1 100644 |
5306 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
5307 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192c/fw_common.c |
5308 |
+@@ -646,6 +646,8 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
5309 |
+ |
5310 |
+ |
5311 |
+ skb = dev_alloc_skb(totalpacketlen); |
5312 |
++ if (!skb) |
5313 |
++ return; |
5314 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
5315 |
+ |
5316 |
+ if (cmd_send_packet) |
5317 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
5318 |
+index 84a0d0eb72e1..a933490928ba 100644 |
5319 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
5320 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/fw.c |
5321 |
+@@ -766,6 +766,8 @@ void rtl92ee_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
5322 |
+ u1rsvdpageloc, 3); |
5323 |
+ |
5324 |
+ skb = dev_alloc_skb(totalpacketlen); |
5325 |
++ if (!skb) |
5326 |
++ return; |
5327 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
5328 |
+ |
5329 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5330 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
5331 |
+index bf9859f74b6f..52f108744e96 100644 |
5332 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
5333 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/fw.c |
5334 |
+@@ -470,6 +470,8 @@ void rtl8723e_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) |
5335 |
+ u1rsvdpageloc, 3); |
5336 |
+ |
5337 |
+ skb = dev_alloc_skb(totalpacketlen); |
5338 |
++ if (!skb) |
5339 |
++ return; |
5340 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
5341 |
+ |
5342 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5343 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
5344 |
+index f2441fbb92f1..307c2bd77f06 100644 |
5345 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
5346 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8723be/fw.c |
5347 |
+@@ -584,6 +584,8 @@ void rtl8723be_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
5348 |
+ u1rsvdpageloc, sizeof(u1rsvdpageloc)); |
5349 |
+ |
5350 |
+ skb = dev_alloc_skb(totalpacketlen); |
5351 |
++ if (!skb) |
5352 |
++ return; |
5353 |
+ skb_put_data(skb, &reserved_page_packet, totalpacketlen); |
5354 |
+ |
5355 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5356 |
+diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
5357 |
+index d868a034659f..d7235f6165fd 100644 |
5358 |
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
5359 |
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.c |
5360 |
+@@ -1645,6 +1645,8 @@ out: |
5361 |
+ &reserved_page_packet_8812[0], totalpacketlen); |
5362 |
+ |
5363 |
+ skb = dev_alloc_skb(totalpacketlen); |
5364 |
++ if (!skb) |
5365 |
++ return; |
5366 |
+ skb_put_data(skb, &reserved_page_packet_8812, totalpacketlen); |
5367 |
+ |
5368 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5369 |
+@@ -1781,6 +1783,8 @@ out: |
5370 |
+ &reserved_page_packet_8821[0], totalpacketlen); |
5371 |
+ |
5372 |
+ skb = dev_alloc_skb(totalpacketlen); |
5373 |
++ if (!skb) |
5374 |
++ return; |
5375 |
+ skb_put_data(skb, &reserved_page_packet_8821, totalpacketlen); |
5376 |
+ |
5377 |
+ rtstatus = rtl_cmd_send_packet(hw, skb); |
5378 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5379 |
+index 4e510cbe0a89..be59d66585d6 100644 |
5380 |
+--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5381 |
++++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c |
5382 |
+@@ -188,27 +188,27 @@ bool rsi_is_cipher_wep(struct rsi_common *common) |
5383 |
+ * @adapter: Pointer to the adapter structure. |
5384 |
+ * @band: Operating band to be set. |
5385 |
+ * |
5386 |
+- * Return: None. |
5387 |
++ * Return: int - 0 on success, negative error on failure. |
5388 |
+ */ |
5389 |
+-static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
5390 |
++static int rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
5391 |
+ { |
5392 |
+ struct ieee80211_supported_band *sbands = &adapter->sbands[band]; |
5393 |
+ void *channels = NULL; |
5394 |
+ |
5395 |
+ if (band == NL80211_BAND_2GHZ) { |
5396 |
+- channels = kmalloc(sizeof(rsi_2ghz_channels), GFP_KERNEL); |
5397 |
+- memcpy(channels, |
5398 |
+- rsi_2ghz_channels, |
5399 |
+- sizeof(rsi_2ghz_channels)); |
5400 |
++ channels = kmemdup(rsi_2ghz_channels, sizeof(rsi_2ghz_channels), |
5401 |
++ GFP_KERNEL); |
5402 |
++ if (!channels) |
5403 |
++ return -ENOMEM; |
5404 |
+ sbands->band = NL80211_BAND_2GHZ; |
5405 |
+ sbands->n_channels = ARRAY_SIZE(rsi_2ghz_channels); |
5406 |
+ sbands->bitrates = rsi_rates; |
5407 |
+ sbands->n_bitrates = ARRAY_SIZE(rsi_rates); |
5408 |
+ } else { |
5409 |
+- channels = kmalloc(sizeof(rsi_5ghz_channels), GFP_KERNEL); |
5410 |
+- memcpy(channels, |
5411 |
+- rsi_5ghz_channels, |
5412 |
+- sizeof(rsi_5ghz_channels)); |
5413 |
++ channels = kmemdup(rsi_5ghz_channels, sizeof(rsi_5ghz_channels), |
5414 |
++ GFP_KERNEL); |
5415 |
++ if (!channels) |
5416 |
++ return -ENOMEM; |
5417 |
+ sbands->band = NL80211_BAND_5GHZ; |
5418 |
+ sbands->n_channels = ARRAY_SIZE(rsi_5ghz_channels); |
5419 |
+ sbands->bitrates = &rsi_rates[4]; |
5420 |
+@@ -227,6 +227,7 @@ static void rsi_register_rates_channels(struct rsi_hw *adapter, int band) |
5421 |
+ sbands->ht_cap.mcs.rx_mask[0] = 0xff; |
5422 |
+ sbands->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED; |
5423 |
+ /* sbands->ht_cap.mcs.rx_highest = 0x82; */ |
5424 |
++ return 0; |
5425 |
+ } |
5426 |
+ |
5427 |
+ /** |
5428 |
+@@ -1985,11 +1986,16 @@ int rsi_mac80211_attach(struct rsi_common *common) |
5429 |
+ wiphy->available_antennas_rx = 1; |
5430 |
+ wiphy->available_antennas_tx = 1; |
5431 |
+ |
5432 |
+- rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ); |
5433 |
++ status = rsi_register_rates_channels(adapter, NL80211_BAND_2GHZ); |
5434 |
++ if (status) |
5435 |
++ return status; |
5436 |
+ wiphy->bands[NL80211_BAND_2GHZ] = |
5437 |
+ &adapter->sbands[NL80211_BAND_2GHZ]; |
5438 |
+ if (common->num_supp_bands > 1) { |
5439 |
+- rsi_register_rates_channels(adapter, NL80211_BAND_5GHZ); |
5440 |
++ status = rsi_register_rates_channels(adapter, |
5441 |
++ NL80211_BAND_5GHZ); |
5442 |
++ if (status) |
5443 |
++ return status; |
5444 |
+ wiphy->bands[NL80211_BAND_5GHZ] = |
5445 |
+ &adapter->sbands[NL80211_BAND_5GHZ]; |
5446 |
+ } |
5447 |
+diff --git a/drivers/net/wireless/st/cw1200/main.c b/drivers/net/wireless/st/cw1200/main.c |
5448 |
+index 90dc979f260b..c1608f0bf6d0 100644 |
5449 |
+--- a/drivers/net/wireless/st/cw1200/main.c |
5450 |
++++ b/drivers/net/wireless/st/cw1200/main.c |
5451 |
+@@ -345,6 +345,11 @@ static struct ieee80211_hw *cw1200_init_common(const u8 *macaddr, |
5452 |
+ mutex_init(&priv->wsm_cmd_mux); |
5453 |
+ mutex_init(&priv->conf_mutex); |
5454 |
+ priv->workqueue = create_singlethread_workqueue("cw1200_wq"); |
5455 |
++ if (!priv->workqueue) { |
5456 |
++ ieee80211_free_hw(hw); |
5457 |
++ return NULL; |
5458 |
++ } |
5459 |
++ |
5460 |
+ sema_init(&priv->scan.lock, 1); |
5461 |
+ INIT_WORK(&priv->scan.work, cw1200_scan_work); |
5462 |
+ INIT_DELAYED_WORK(&priv->scan.probe_work, cw1200_probe_work); |
5463 |
+diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c |
5464 |
+index cff027fc2676..a7ce2f1761a2 100644 |
5465 |
+--- a/drivers/nvdimm/pmem.c |
5466 |
++++ b/drivers/nvdimm/pmem.c |
5467 |
+@@ -281,16 +281,22 @@ static long pmem_dax_direct_access(struct dax_device *dax_dev, |
5468 |
+ return __pmem_direct_access(pmem, pgoff, nr_pages, kaddr, pfn); |
5469 |
+ } |
5470 |
+ |
5471 |
++/* |
5472 |
++ * Use the 'no check' versions of copy_from_iter_flushcache() and |
5473 |
++ * copy_to_iter_mcsafe() to bypass HARDENED_USERCOPY overhead. Bounds |
5474 |
++ * checking, both file offset and device offset, is handled by |
5475 |
++ * dax_iomap_actor() |
5476 |
++ */ |
5477 |
+ static size_t pmem_copy_from_iter(struct dax_device *dax_dev, pgoff_t pgoff, |
5478 |
+ void *addr, size_t bytes, struct iov_iter *i) |
5479 |
+ { |
5480 |
+- return copy_from_iter_flushcache(addr, bytes, i); |
5481 |
++ return _copy_from_iter_flushcache(addr, bytes, i); |
5482 |
+ } |
5483 |
+ |
5484 |
+ static size_t pmem_copy_to_iter(struct dax_device *dax_dev, pgoff_t pgoff, |
5485 |
+ void *addr, size_t bytes, struct iov_iter *i) |
5486 |
+ { |
5487 |
+- return copy_to_iter_mcsafe(addr, bytes, i); |
5488 |
++ return _copy_to_iter_mcsafe(addr, bytes, i); |
5489 |
+ } |
5490 |
+ |
5491 |
+ static const struct dax_operations pmem_dax_ops = { |
5492 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
5493 |
+index 2cdb3032ca0f..abfb46378cc1 100644 |
5494 |
+--- a/drivers/nvme/host/core.c |
5495 |
++++ b/drivers/nvme/host/core.c |
5496 |
+@@ -1480,6 +1480,10 @@ static void nvme_update_disk_info(struct gendisk *disk, |
5497 |
+ sector_t capacity = le64_to_cpup(&id->nsze) << (ns->lba_shift - 9); |
5498 |
+ unsigned short bs = 1 << ns->lba_shift; |
5499 |
+ |
5500 |
++ if (ns->lba_shift > PAGE_SHIFT) { |
5501 |
++ /* unsupported block size, set capacity to 0 later */ |
5502 |
++ bs = (1 << 9); |
5503 |
++ } |
5504 |
+ blk_mq_freeze_queue(disk->queue); |
5505 |
+ blk_integrity_unregister(disk); |
5506 |
+ |
5507 |
+@@ -1490,7 +1494,8 @@ static void nvme_update_disk_info(struct gendisk *disk, |
5508 |
+ if (ns->ms && !ns->ext && |
5509 |
+ (ns->ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) |
5510 |
+ nvme_init_integrity(disk, ns->ms, ns->pi_type); |
5511 |
+- if (ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk)) |
5512 |
++ if ((ns->ms && !nvme_ns_has_pi(ns) && !blk_get_integrity(disk)) || |
5513 |
++ ns->lba_shift > PAGE_SHIFT) |
5514 |
+ capacity = 0; |
5515 |
+ |
5516 |
+ set_capacity(disk, capacity); |
5517 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
5518 |
+index 0939a4e178fb..e4f167e35353 100644 |
5519 |
+--- a/drivers/nvme/host/rdma.c |
5520 |
++++ b/drivers/nvme/host/rdma.c |
5521 |
+@@ -880,8 +880,9 @@ static void nvme_rdma_teardown_admin_queue(struct nvme_rdma_ctrl *ctrl, |
5522 |
+ { |
5523 |
+ blk_mq_quiesce_queue(ctrl->ctrl.admin_q); |
5524 |
+ nvme_rdma_stop_queue(&ctrl->queues[0]); |
5525 |
+- blk_mq_tagset_busy_iter(&ctrl->admin_tag_set, nvme_cancel_request, |
5526 |
+- &ctrl->ctrl); |
5527 |
++ if (ctrl->ctrl.admin_tagset) |
5528 |
++ blk_mq_tagset_busy_iter(ctrl->ctrl.admin_tagset, |
5529 |
++ nvme_cancel_request, &ctrl->ctrl); |
5530 |
+ blk_mq_unquiesce_queue(ctrl->ctrl.admin_q); |
5531 |
+ nvme_rdma_destroy_admin_queue(ctrl, remove); |
5532 |
+ } |
5533 |
+@@ -892,8 +893,9 @@ static void nvme_rdma_teardown_io_queues(struct nvme_rdma_ctrl *ctrl, |
5534 |
+ if (ctrl->ctrl.queue_count > 1) { |
5535 |
+ nvme_stop_queues(&ctrl->ctrl); |
5536 |
+ nvme_rdma_stop_io_queues(ctrl); |
5537 |
+- blk_mq_tagset_busy_iter(&ctrl->tag_set, nvme_cancel_request, |
5538 |
+- &ctrl->ctrl); |
5539 |
++ if (ctrl->ctrl.tagset) |
5540 |
++ blk_mq_tagset_busy_iter(ctrl->ctrl.tagset, |
5541 |
++ nvme_cancel_request, &ctrl->ctrl); |
5542 |
+ if (remove) |
5543 |
+ nvme_start_queues(&ctrl->ctrl); |
5544 |
+ nvme_rdma_destroy_io_queues(ctrl, remove); |
5545 |
+diff --git a/drivers/perf/arm-cci.c b/drivers/perf/arm-cci.c |
5546 |
+index 1bfeb160c5b1..14a541c453e5 100644 |
5547 |
+--- a/drivers/perf/arm-cci.c |
5548 |
++++ b/drivers/perf/arm-cci.c |
5549 |
+@@ -1692,21 +1692,24 @@ static int cci_pmu_probe(struct platform_device *pdev) |
5550 |
+ raw_spin_lock_init(&cci_pmu->hw_events.pmu_lock); |
5551 |
+ mutex_init(&cci_pmu->reserve_mutex); |
5552 |
+ atomic_set(&cci_pmu->active_events, 0); |
5553 |
+- cci_pmu->cpu = get_cpu(); |
5554 |
+- |
5555 |
+- ret = cci_pmu_init(cci_pmu, pdev); |
5556 |
+- if (ret) { |
5557 |
+- put_cpu(); |
5558 |
+- return ret; |
5559 |
+- } |
5560 |
+ |
5561 |
++ cci_pmu->cpu = raw_smp_processor_id(); |
5562 |
++ g_cci_pmu = cci_pmu; |
5563 |
+ cpuhp_setup_state_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
5564 |
+ "perf/arm/cci:online", NULL, |
5565 |
+ cci_pmu_offline_cpu); |
5566 |
+- put_cpu(); |
5567 |
+- g_cci_pmu = cci_pmu; |
5568 |
++ |
5569 |
++ ret = cci_pmu_init(cci_pmu, pdev); |
5570 |
++ if (ret) |
5571 |
++ goto error_pmu_init; |
5572 |
++ |
5573 |
+ pr_info("ARM %s PMU driver probed", cci_pmu->model->name); |
5574 |
+ return 0; |
5575 |
++ |
5576 |
++error_pmu_init: |
5577 |
++ cpuhp_remove_state(CPUHP_AP_PERF_ARM_CCI_ONLINE); |
5578 |
++ g_cci_pmu = NULL; |
5579 |
++ return ret; |
5580 |
+ } |
5581 |
+ |
5582 |
+ static int cci_pmu_remove(struct platform_device *pdev) |
5583 |
+diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c |
5584 |
+index 15c8fc2abf01..1f8809bab002 100644 |
5585 |
+--- a/drivers/phy/allwinner/phy-sun4i-usb.c |
5586 |
++++ b/drivers/phy/allwinner/phy-sun4i-usb.c |
5587 |
+@@ -550,6 +550,7 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) |
5588 |
+ struct sun4i_usb_phy_data *data = |
5589 |
+ container_of(work, struct sun4i_usb_phy_data, detect.work); |
5590 |
+ struct phy *phy0 = data->phys[0].phy; |
5591 |
++ struct sun4i_usb_phy *phy = phy_get_drvdata(phy0); |
5592 |
+ bool force_session_end, id_notify = false, vbus_notify = false; |
5593 |
+ int id_det, vbus_det; |
5594 |
+ |
5595 |
+@@ -606,6 +607,9 @@ static void sun4i_usb_phy0_id_vbus_det_scan(struct work_struct *work) |
5596 |
+ mutex_unlock(&phy0->mutex); |
5597 |
+ } |
5598 |
+ |
5599 |
++ /* Enable PHY0 passby for host mode only. */ |
5600 |
++ sun4i_usb_phy_passby(phy, !id_det); |
5601 |
++ |
5602 |
+ /* Re-route PHY0 if necessary */ |
5603 |
+ if (data->cfg->phy0_dual_route) |
5604 |
+ sun4i_usb_phy0_reroute(data, id_det); |
5605 |
+diff --git a/drivers/phy/motorola/Kconfig b/drivers/phy/motorola/Kconfig |
5606 |
+index 82651524ffb9..718f8729701d 100644 |
5607 |
+--- a/drivers/phy/motorola/Kconfig |
5608 |
++++ b/drivers/phy/motorola/Kconfig |
5609 |
+@@ -13,7 +13,7 @@ config PHY_CPCAP_USB |
5610 |
+ |
5611 |
+ config PHY_MAPPHONE_MDM6600 |
5612 |
+ tristate "Motorola Mapphone MDM6600 modem USB PHY driver" |
5613 |
+- depends on OF && USB_SUPPORT |
5614 |
++ depends on OF && USB_SUPPORT && GPIOLIB |
5615 |
+ select GENERIC_PHY |
5616 |
+ help |
5617 |
+ Enable this for MDM6600 USB modem to work on Motorola phones |
5618 |
+diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c |
5619 |
+index 302190d1558d..0d7d379e9bb8 100644 |
5620 |
+--- a/drivers/pinctrl/pinctrl-pistachio.c |
5621 |
++++ b/drivers/pinctrl/pinctrl-pistachio.c |
5622 |
+@@ -1368,6 +1368,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
5623 |
+ if (!of_find_property(child, "gpio-controller", NULL)) { |
5624 |
+ dev_err(pctl->dev, |
5625 |
+ "No gpio-controller property for bank %u\n", i); |
5626 |
++ of_node_put(child); |
5627 |
+ ret = -ENODEV; |
5628 |
+ goto err; |
5629 |
+ } |
5630 |
+@@ -1375,6 +1376,7 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl) |
5631 |
+ irq = irq_of_parse_and_map(child, 0); |
5632 |
+ if (irq < 0) { |
5633 |
+ dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq); |
5634 |
++ of_node_put(child); |
5635 |
+ ret = irq; |
5636 |
+ goto err; |
5637 |
+ } |
5638 |
+diff --git a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
5639 |
+index 44c6b753f692..85ddf49a5188 100644 |
5640 |
+--- a/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
5641 |
++++ b/drivers/pinctrl/samsung/pinctrl-exynos-arm.c |
5642 |
+@@ -71,6 +71,7 @@ s5pv210_retention_init(struct samsung_pinctrl_drv_data *drvdata, |
5643 |
+ } |
5644 |
+ |
5645 |
+ clk_base = of_iomap(np, 0); |
5646 |
++ of_node_put(np); |
5647 |
+ if (!clk_base) { |
5648 |
+ pr_err("%s: failed to map clock registers\n", __func__); |
5649 |
+ return ERR_PTR(-EINVAL); |
5650 |
+diff --git a/drivers/pinctrl/zte/pinctrl-zx.c b/drivers/pinctrl/zte/pinctrl-zx.c |
5651 |
+index caa44dd2880a..3cb69309912b 100644 |
5652 |
+--- a/drivers/pinctrl/zte/pinctrl-zx.c |
5653 |
++++ b/drivers/pinctrl/zte/pinctrl-zx.c |
5654 |
+@@ -411,6 +411,7 @@ int zx_pinctrl_init(struct platform_device *pdev, |
5655 |
+ } |
5656 |
+ |
5657 |
+ zpctl->aux_base = of_iomap(np, 0); |
5658 |
++ of_node_put(np); |
5659 |
+ if (!zpctl->aux_base) |
5660 |
+ return -ENOMEM; |
5661 |
+ |
5662 |
+diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c |
5663 |
+index 01ffc0ef8033..fbcf13bbbd8d 100644 |
5664 |
+--- a/drivers/rtc/rtc-88pm860x.c |
5665 |
++++ b/drivers/rtc/rtc-88pm860x.c |
5666 |
+@@ -414,7 +414,7 @@ static int pm860x_rtc_remove(struct platform_device *pdev) |
5667 |
+ struct pm860x_rtc_info *info = platform_get_drvdata(pdev); |
5668 |
+ |
5669 |
+ #ifdef VRTC_CALIBRATION |
5670 |
+- flush_scheduled_work(); |
5671 |
++ cancel_delayed_work_sync(&info->calib_work); |
5672 |
+ /* disable measurement */ |
5673 |
+ pm860x_set_bits(info->i2c, PM8607_MEAS_EN2, MEAS2_VRTC, 0); |
5674 |
+ #endif /* VRTC_CALIBRATION */ |
5675 |
+diff --git a/drivers/rtc/rtc-stm32.c b/drivers/rtc/rtc-stm32.c |
5676 |
+index c5908cfea234..8e6c9b3bcc29 100644 |
5677 |
+--- a/drivers/rtc/rtc-stm32.c |
5678 |
++++ b/drivers/rtc/rtc-stm32.c |
5679 |
+@@ -788,11 +788,14 @@ static int stm32_rtc_probe(struct platform_device *pdev) |
5680 |
+ ret = device_init_wakeup(&pdev->dev, true); |
5681 |
+ if (rtc->data->has_wakeirq) { |
5682 |
+ rtc->wakeirq_alarm = platform_get_irq(pdev, 1); |
5683 |
+- if (rtc->wakeirq_alarm <= 0) |
5684 |
+- ret = rtc->wakeirq_alarm; |
5685 |
+- else |
5686 |
++ if (rtc->wakeirq_alarm > 0) { |
5687 |
+ ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, |
5688 |
+ rtc->wakeirq_alarm); |
5689 |
++ } else { |
5690 |
++ ret = rtc->wakeirq_alarm; |
5691 |
++ if (rtc->wakeirq_alarm == -EPROBE_DEFER) |
5692 |
++ goto err; |
5693 |
++ } |
5694 |
+ } |
5695 |
+ if (ret) |
5696 |
+ dev_warn(&pdev->dev, "alarm can't wake up the system: %d", ret); |
5697 |
+diff --git a/drivers/rtc/rtc-xgene.c b/drivers/rtc/rtc-xgene.c |
5698 |
+index 153820876a82..2f741f455c30 100644 |
5699 |
+--- a/drivers/rtc/rtc-xgene.c |
5700 |
++++ b/drivers/rtc/rtc-xgene.c |
5701 |
+@@ -168,6 +168,10 @@ static int xgene_rtc_probe(struct platform_device *pdev) |
5702 |
+ if (IS_ERR(pdata->csr_base)) |
5703 |
+ return PTR_ERR(pdata->csr_base); |
5704 |
+ |
5705 |
++ pdata->rtc = devm_rtc_allocate_device(&pdev->dev); |
5706 |
++ if (IS_ERR(pdata->rtc)) |
5707 |
++ return PTR_ERR(pdata->rtc); |
5708 |
++ |
5709 |
+ irq = platform_get_irq(pdev, 0); |
5710 |
+ if (irq < 0) { |
5711 |
+ dev_err(&pdev->dev, "No IRQ resource\n"); |
5712 |
+@@ -198,15 +202,15 @@ static int xgene_rtc_probe(struct platform_device *pdev) |
5713 |
+ return ret; |
5714 |
+ } |
5715 |
+ |
5716 |
+- pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
5717 |
+- &xgene_rtc_ops, THIS_MODULE); |
5718 |
+- if (IS_ERR(pdata->rtc)) { |
5719 |
+- clk_disable_unprepare(pdata->clk); |
5720 |
+- return PTR_ERR(pdata->rtc); |
5721 |
+- } |
5722 |
+- |
5723 |
+ /* HW does not support update faster than 1 seconds */ |
5724 |
+ pdata->rtc->uie_unsupported = 1; |
5725 |
++ pdata->rtc->ops = &xgene_rtc_ops; |
5726 |
++ |
5727 |
++ ret = rtc_register_device(pdata->rtc); |
5728 |
++ if (ret) { |
5729 |
++ clk_disable_unprepare(pdata->clk); |
5730 |
++ return ret; |
5731 |
++ } |
5732 |
+ |
5733 |
+ return 0; |
5734 |
+ } |
5735 |
+diff --git a/drivers/s390/cio/cio.h b/drivers/s390/cio/cio.h |
5736 |
+index 9811fd8a0c73..92eabbb5f18d 100644 |
5737 |
+--- a/drivers/s390/cio/cio.h |
5738 |
++++ b/drivers/s390/cio/cio.h |
5739 |
+@@ -115,7 +115,7 @@ struct subchannel { |
5740 |
+ struct schib_config config; |
5741 |
+ } __attribute__ ((aligned(8))); |
5742 |
+ |
5743 |
+-DECLARE_PER_CPU(struct irb, cio_irb); |
5744 |
++DECLARE_PER_CPU_ALIGNED(struct irb, cio_irb); |
5745 |
+ |
5746 |
+ #define to_subchannel(n) container_of(n, struct subchannel, dev) |
5747 |
+ |
5748 |
+diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_drv.c |
5749 |
+index fabd9798e4c4..7a06cdff6572 100644 |
5750 |
+--- a/drivers/s390/cio/vfio_ccw_drv.c |
5751 |
++++ b/drivers/s390/cio/vfio_ccw_drv.c |
5752 |
+@@ -40,26 +40,30 @@ int vfio_ccw_sch_quiesce(struct subchannel *sch) |
5753 |
+ if (ret != -EBUSY) |
5754 |
+ goto out_unlock; |
5755 |
+ |
5756 |
++ iretry = 255; |
5757 |
+ do { |
5758 |
+- iretry = 255; |
5759 |
+ |
5760 |
+ ret = cio_cancel_halt_clear(sch, &iretry); |
5761 |
+- while (ret == -EBUSY) { |
5762 |
+- /* |
5763 |
+- * Flush all I/O and wait for |
5764 |
+- * cancel/halt/clear completion. |
5765 |
+- */ |
5766 |
+- private->completion = &completion; |
5767 |
+- spin_unlock_irq(sch->lock); |
5768 |
+ |
5769 |
+- wait_for_completion_timeout(&completion, 3*HZ); |
5770 |
++ if (ret == -EIO) { |
5771 |
++ pr_err("vfio_ccw: could not quiesce subchannel 0.%x.%04x!\n", |
5772 |
++ sch->schid.ssid, sch->schid.sch_no); |
5773 |
++ break; |
5774 |
++ } |
5775 |
++ |
5776 |
++ /* |
5777 |
++ * Flush all I/O and wait for |
5778 |
++ * cancel/halt/clear completion. |
5779 |
++ */ |
5780 |
++ private->completion = &completion; |
5781 |
++ spin_unlock_irq(sch->lock); |
5782 |
+ |
5783 |
+- spin_lock_irq(sch->lock); |
5784 |
+- private->completion = NULL; |
5785 |
+- flush_workqueue(vfio_ccw_work_q); |
5786 |
+- ret = cio_cancel_halt_clear(sch, &iretry); |
5787 |
+- }; |
5788 |
++ if (ret == -EBUSY) |
5789 |
++ wait_for_completion_timeout(&completion, 3*HZ); |
5790 |
+ |
5791 |
++ private->completion = NULL; |
5792 |
++ flush_workqueue(vfio_ccw_work_q); |
5793 |
++ spin_lock_irq(sch->lock); |
5794 |
+ ret = cio_disable_subchannel(sch); |
5795 |
+ } while (ret == -EBUSY); |
5796 |
+ out_unlock: |
5797 |
+diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c |
5798 |
+index f673e106c041..dc5ff47de3fe 100644 |
5799 |
+--- a/drivers/s390/cio/vfio_ccw_ops.c |
5800 |
++++ b/drivers/s390/cio/vfio_ccw_ops.c |
5801 |
+@@ -130,11 +130,12 @@ static int vfio_ccw_mdev_remove(struct mdev_device *mdev) |
5802 |
+ |
5803 |
+ if ((private->state != VFIO_CCW_STATE_NOT_OPER) && |
5804 |
+ (private->state != VFIO_CCW_STATE_STANDBY)) { |
5805 |
+- if (!vfio_ccw_mdev_reset(mdev)) |
5806 |
++ if (!vfio_ccw_sch_quiesce(private->sch)) |
5807 |
+ private->state = VFIO_CCW_STATE_STANDBY; |
5808 |
+ /* The state will be NOT_OPER on error. */ |
5809 |
+ } |
5810 |
+ |
5811 |
++ cp_free(&private->cp); |
5812 |
+ private->mdev = NULL; |
5813 |
+ atomic_inc(&private->avail); |
5814 |
+ |
5815 |
+@@ -158,6 +159,14 @@ static void vfio_ccw_mdev_release(struct mdev_device *mdev) |
5816 |
+ struct vfio_ccw_private *private = |
5817 |
+ dev_get_drvdata(mdev_parent_dev(mdev)); |
5818 |
+ |
5819 |
++ if ((private->state != VFIO_CCW_STATE_NOT_OPER) && |
5820 |
++ (private->state != VFIO_CCW_STATE_STANDBY)) { |
5821 |
++ if (!vfio_ccw_mdev_reset(mdev)) |
5822 |
++ private->state = VFIO_CCW_STATE_STANDBY; |
5823 |
++ /* The state will be NOT_OPER on error. */ |
5824 |
++ } |
5825 |
++ |
5826 |
++ cp_free(&private->cp); |
5827 |
+ vfio_unregister_notifier(mdev_dev(mdev), VFIO_IOMMU_NOTIFY, |
5828 |
+ &private->nb); |
5829 |
+ } |
5830 |
+diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c |
5831 |
+index e6854127b434..b2737bfeb8bb 100644 |
5832 |
+--- a/drivers/s390/crypto/zcrypt_api.c |
5833 |
++++ b/drivers/s390/crypto/zcrypt_api.c |
5834 |
+@@ -224,6 +224,7 @@ static long zcrypt_rsa_modexpo(struct ica_rsa_modexpo *mex) |
5835 |
+ trace_s390_zcrypt_req(mex, TP_ICARSAMODEXPO); |
5836 |
+ |
5837 |
+ if (mex->outputdatalength < mex->inputdatalength) { |
5838 |
++ func_code = 0; |
5839 |
+ rc = -EINVAL; |
5840 |
+ goto out; |
5841 |
+ } |
5842 |
+@@ -298,6 +299,7 @@ static long zcrypt_rsa_crt(struct ica_rsa_modexpo_crt *crt) |
5843 |
+ trace_s390_zcrypt_req(crt, TP_ICARSACRT); |
5844 |
+ |
5845 |
+ if (crt->outputdatalength < crt->inputdatalength) { |
5846 |
++ func_code = 0; |
5847 |
+ rc = -EINVAL; |
5848 |
+ goto out; |
5849 |
+ } |
5850 |
+@@ -483,6 +485,7 @@ static long zcrypt_send_ep11_cprb(struct ep11_urb *xcrb) |
5851 |
+ |
5852 |
+ targets = kcalloc(target_num, sizeof(*targets), GFP_KERNEL); |
5853 |
+ if (!targets) { |
5854 |
++ func_code = 0; |
5855 |
+ rc = -ENOMEM; |
5856 |
+ goto out; |
5857 |
+ } |
5858 |
+@@ -490,6 +493,7 @@ static long zcrypt_send_ep11_cprb(struct ep11_urb *xcrb) |
5859 |
+ uptr = (struct ep11_target_dev __force __user *) xcrb->targets; |
5860 |
+ if (copy_from_user(targets, uptr, |
5861 |
+ target_num * sizeof(*targets))) { |
5862 |
++ func_code = 0; |
5863 |
+ rc = -EFAULT; |
5864 |
+ goto out_free; |
5865 |
+ } |
5866 |
+diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h |
5867 |
+index 2d1f6a583641..b2657582cfcf 100644 |
5868 |
+--- a/drivers/s390/net/qeth_core.h |
5869 |
++++ b/drivers/s390/net/qeth_core.h |
5870 |
+@@ -201,6 +201,12 @@ struct qeth_vnicc_info { |
5871 |
+ bool rx_bcast_enabled; |
5872 |
+ }; |
5873 |
+ |
5874 |
++static inline int qeth_is_adp_supported(struct qeth_ipa_info *ipa, |
5875 |
++ enum qeth_ipa_setadp_cmd func) |
5876 |
++{ |
5877 |
++ return (ipa->supported_funcs & func); |
5878 |
++} |
5879 |
++ |
5880 |
+ static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa, |
5881 |
+ enum qeth_ipa_funcs func) |
5882 |
+ { |
5883 |
+@@ -214,9 +220,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, |
5884 |
+ } |
5885 |
+ |
5886 |
+ #define qeth_adp_supported(c, f) \ |
5887 |
+- qeth_is_ipa_supported(&c->options.adp, f) |
5888 |
+-#define qeth_adp_enabled(c, f) \ |
5889 |
+- qeth_is_ipa_enabled(&c->options.adp, f) |
5890 |
++ qeth_is_adp_supported(&c->options.adp, f) |
5891 |
+ #define qeth_is_supported(c, f) \ |
5892 |
+ qeth_is_ipa_supported(&c->options.ipa4, f) |
5893 |
+ #define qeth_is_enabled(c, f) \ |
5894 |
+diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c |
5895 |
+index 56aacf32f71b..461afc276db7 100644 |
5896 |
+--- a/drivers/s390/net/qeth_core_main.c |
5897 |
++++ b/drivers/s390/net/qeth_core_main.c |
5898 |
+@@ -1370,7 +1370,7 @@ static void qeth_set_multiple_write_queues(struct qeth_card *card) |
5899 |
+ card->qdio.no_out_queues = 4; |
5900 |
+ } |
5901 |
+ |
5902 |
+-static void qeth_update_from_chp_desc(struct qeth_card *card) |
5903 |
++static int qeth_update_from_chp_desc(struct qeth_card *card) |
5904 |
+ { |
5905 |
+ struct ccw_device *ccwdev; |
5906 |
+ struct channel_path_desc_fmt0 *chp_dsc; |
5907 |
+@@ -1380,7 +1380,7 @@ static void qeth_update_from_chp_desc(struct qeth_card *card) |
5908 |
+ ccwdev = card->data.ccwdev; |
5909 |
+ chp_dsc = ccw_device_get_chp_desc(ccwdev, 0); |
5910 |
+ if (!chp_dsc) |
5911 |
+- goto out; |
5912 |
++ return -ENOMEM; |
5913 |
+ |
5914 |
+ card->info.func_level = 0x4100 + chp_dsc->desc; |
5915 |
+ if (card->info.type == QETH_CARD_TYPE_IQD) |
5916 |
+@@ -1395,6 +1395,7 @@ out: |
5917 |
+ kfree(chp_dsc); |
5918 |
+ QETH_DBF_TEXT_(SETUP, 2, "nr:%x", card->qdio.no_out_queues); |
5919 |
+ QETH_DBF_TEXT_(SETUP, 2, "lvl:%02x", card->info.func_level); |
5920 |
++ return 0; |
5921 |
+ } |
5922 |
+ |
5923 |
+ static void qeth_init_qdio_info(struct qeth_card *card) |
5924 |
+@@ -5090,7 +5091,9 @@ int qeth_core_hardsetup_card(struct qeth_card *card) |
5925 |
+ |
5926 |
+ QETH_DBF_TEXT(SETUP, 2, "hrdsetup"); |
5927 |
+ atomic_set(&card->force_alloc_skb, 0); |
5928 |
+- qeth_update_from_chp_desc(card); |
5929 |
++ rc = qeth_update_from_chp_desc(card); |
5930 |
++ if (rc) |
5931 |
++ return rc; |
5932 |
+ retry: |
5933 |
+ if (retries < 3) |
5934 |
+ QETH_DBF_MESSAGE(2, "%s Retrying to do IDX activates.\n", |
5935 |
+@@ -5768,7 +5771,9 @@ static int qeth_core_probe_device(struct ccwgroup_device *gdev) |
5936 |
+ gdev->cdev[2]->handler = qeth_irq; |
5937 |
+ |
5938 |
+ qeth_setup_card(card); |
5939 |
+- qeth_update_from_chp_desc(card); |
5940 |
++ rc = qeth_update_from_chp_desc(card); |
5941 |
++ if (rc) |
5942 |
++ goto err_chp_desc; |
5943 |
+ |
5944 |
+ card->dev = qeth_alloc_netdev(card); |
5945 |
+ if (!card->dev) { |
5946 |
+@@ -5806,6 +5811,7 @@ err_disc: |
5947 |
+ qeth_core_free_discipline(card); |
5948 |
+ err_load: |
5949 |
+ free_netdev(card->dev); |
5950 |
++err_chp_desc: |
5951 |
+ err_card: |
5952 |
+ qeth_core_free_card(card); |
5953 |
+ err_dev: |
5954 |
+diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c |
5955 |
+index e9ecc667e3fb..231eb79efa32 100644 |
5956 |
+--- a/drivers/scsi/libsas/sas_expander.c |
5957 |
++++ b/drivers/scsi/libsas/sas_expander.c |
5958 |
+@@ -2040,6 +2040,11 @@ static int sas_rediscover_dev(struct domain_device *dev, int phy_id, bool last) |
5959 |
+ if ((SAS_ADDR(sas_addr) == 0) || (res == -ECOMM)) { |
5960 |
+ phy->phy_state = PHY_EMPTY; |
5961 |
+ sas_unregister_devs_sas_addr(dev, phy_id, last); |
5962 |
++ /* |
5963 |
++ * Even though the PHY is empty, for convenience we discover |
5964 |
++ * the PHY to update the PHY info, like negotiated linkrate. |
5965 |
++ */ |
5966 |
++ sas_ex_phy_discover(dev, phy_id); |
5967 |
+ return res; |
5968 |
+ } else if (SAS_ADDR(sas_addr) == SAS_ADDR(phy->attached_sas_addr) && |
5969 |
+ dev_type_flutter(type, phy->attached_dev_type)) { |
5970 |
+diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c |
5971 |
+index 1a964e71582f..d909d90035bb 100644 |
5972 |
+--- a/drivers/scsi/lpfc/lpfc_ct.c |
5973 |
++++ b/drivers/scsi/lpfc/lpfc_ct.c |
5974 |
+@@ -1762,6 +1762,9 @@ lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, |
5975 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
5976 |
+ memset(ae, 0, 256); |
5977 |
+ |
5978 |
++ /* This string MUST be consistent with other FC platforms |
5979 |
++ * supported by Broadcom. |
5980 |
++ */ |
5981 |
+ strncpy(ae->un.AttrString, |
5982 |
+ "Emulex Corporation", |
5983 |
+ sizeof(ae->un.AttrString)); |
5984 |
+@@ -2117,10 +2120,11 @@ lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, |
5985 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
5986 |
+ memset(ae, 0, 32); |
5987 |
+ |
5988 |
+- ae->un.AttrTypes[3] = 0x02; /* Type 1 - ELS */ |
5989 |
+- ae->un.AttrTypes[2] = 0x01; /* Type 8 - FCP */ |
5990 |
+- ae->un.AttrTypes[6] = 0x01; /* Type 40 - NVME */ |
5991 |
+- ae->un.AttrTypes[7] = 0x01; /* Type 32 - CT */ |
5992 |
++ ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
5993 |
++ ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
5994 |
++ if (vport->nvmei_support || vport->phba->nvmet_support) |
5995 |
++ ae->un.AttrTypes[6] = 0x01; /* Type 0x28 - NVME */ |
5996 |
++ ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
5997 |
+ size = FOURBYTES + 32; |
5998 |
+ ad->AttrLen = cpu_to_be16(size); |
5999 |
+ ad->AttrType = cpu_to_be16(RPRT_SUPPORTED_FC4_TYPES); |
6000 |
+@@ -2425,9 +2429,11 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, |
6001 |
+ ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue; |
6002 |
+ memset(ae, 0, 32); |
6003 |
+ |
6004 |
+- ae->un.AttrTypes[3] = 0x02; /* Type 1 - ELS */ |
6005 |
+- ae->un.AttrTypes[2] = 0x01; /* Type 8 - FCP */ |
6006 |
+- ae->un.AttrTypes[7] = 0x01; /* Type 32 - CT */ |
6007 |
++ ae->un.AttrTypes[3] = 0x02; /* Type 0x1 - ELS */ |
6008 |
++ ae->un.AttrTypes[2] = 0x01; /* Type 0x8 - FCP */ |
6009 |
++ if (vport->phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) |
6010 |
++ ae->un.AttrTypes[6] = 0x1; /* Type 0x28 - NVME */ |
6011 |
++ ae->un.AttrTypes[7] = 0x01; /* Type 0x20 - CT */ |
6012 |
+ size = FOURBYTES + 32; |
6013 |
+ ad->AttrLen = cpu_to_be16(size); |
6014 |
+ ad->AttrType = cpu_to_be16(RPRT_ACTIVE_FC4_TYPES); |
6015 |
+diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c |
6016 |
+index eb71877f12f8..ccdd82b1123f 100644 |
6017 |
+--- a/drivers/scsi/lpfc/lpfc_hbadisc.c |
6018 |
++++ b/drivers/scsi/lpfc/lpfc_hbadisc.c |
6019 |
+@@ -921,7 +921,11 @@ lpfc_linkdown(struct lpfc_hba *phba) |
6020 |
+ } |
6021 |
+ } |
6022 |
+ lpfc_destroy_vport_work_array(phba, vports); |
6023 |
+- /* Clean up any firmware default rpi's */ |
6024 |
++ |
6025 |
++ /* Clean up any SLI3 firmware default rpi's */ |
6026 |
++ if (phba->sli_rev > LPFC_SLI_REV3) |
6027 |
++ goto skip_unreg_did; |
6028 |
++ |
6029 |
+ mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
6030 |
+ if (mb) { |
6031 |
+ lpfc_unreg_did(phba, 0xffff, LPFC_UNREG_ALL_DFLT_RPIS, mb); |
6032 |
+@@ -933,6 +937,7 @@ lpfc_linkdown(struct lpfc_hba *phba) |
6033 |
+ } |
6034 |
+ } |
6035 |
+ |
6036 |
++ skip_unreg_did: |
6037 |
+ /* Setup myDID for link up if we are in pt2pt mode */ |
6038 |
+ if (phba->pport->fc_flag & FC_PT2PT) { |
6039 |
+ mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
6040 |
+@@ -4855,6 +4860,10 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport) |
6041 |
+ LPFC_MBOXQ_t *mbox; |
6042 |
+ int rc; |
6043 |
+ |
6044 |
++ /* Unreg DID is an SLI3 operation. */ |
6045 |
++ if (phba->sli_rev > LPFC_SLI_REV3) |
6046 |
++ return; |
6047 |
++ |
6048 |
+ mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
6049 |
+ if (mbox) { |
6050 |
+ lpfc_unreg_did(phba, vport->vpi, LPFC_UNREG_ALL_DFLT_RPIS, |
6051 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
6052 |
+index ca62117a2d13..099f70798fdd 100644 |
6053 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
6054 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
6055 |
+@@ -2482,15 +2482,15 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) |
6056 |
+ if (!cstat) |
6057 |
+ return -ENOMEM; |
6058 |
+ |
6059 |
++ if (!IS_ENABLED(CONFIG_NVME_FC)) |
6060 |
++ return ret; |
6061 |
++ |
6062 |
+ /* localport is allocated from the stack, but the registration |
6063 |
+ * call allocates heap memory as well as the private area. |
6064 |
+ */ |
6065 |
+-#if (IS_ENABLED(CONFIG_NVME_FC)) |
6066 |
++ |
6067 |
+ ret = nvme_fc_register_localport(&nfcp_info, &lpfc_nvme_template, |
6068 |
+ &vport->phba->pcidev->dev, &localport); |
6069 |
+-#else |
6070 |
+- ret = -ENOMEM; |
6071 |
+-#endif |
6072 |
+ if (!ret) { |
6073 |
+ lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME | LOG_NVME_DISC, |
6074 |
+ "6005 Successfully registered local " |
6075 |
+diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c |
6076 |
+index 6bbc38b1b465..a17c13846d1e 100644 |
6077 |
+--- a/drivers/scsi/qedf/qedf_io.c |
6078 |
++++ b/drivers/scsi/qedf/qedf_io.c |
6079 |
+@@ -902,6 +902,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req) |
6080 |
+ if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) { |
6081 |
+ QEDF_ERR(&(qedf->dbg_ctx), "Session not offloaded yet.\n"); |
6082 |
+ kref_put(&io_req->refcount, qedf_release_cmd); |
6083 |
++ return -EINVAL; |
6084 |
+ } |
6085 |
+ |
6086 |
+ /* Obtain free SQE */ |
6087 |
+diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c |
6088 |
+index d4821b9dea45..4130b9117055 100644 |
6089 |
+--- a/drivers/scsi/qedi/qedi_iscsi.c |
6090 |
++++ b/drivers/scsi/qedi/qedi_iscsi.c |
6091 |
+@@ -1001,6 +1001,9 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep) |
6092 |
+ qedi_ep = ep->dd_data; |
6093 |
+ qedi = qedi_ep->qedi; |
6094 |
+ |
6095 |
++ if (qedi_ep->state == EP_STATE_OFLDCONN_START) |
6096 |
++ goto ep_exit_recover; |
6097 |
++ |
6098 |
+ flush_work(&qedi_ep->offload_work); |
6099 |
+ |
6100 |
+ if (qedi_ep->conn) { |
6101 |
+diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
6102 |
+index 36cbb29c84f6..88d8acf86a2a 100644 |
6103 |
+--- a/drivers/scsi/qla2xxx/qla_isr.c |
6104 |
++++ b/drivers/scsi/qla2xxx/qla_isr.c |
6105 |
+@@ -3449,7 +3449,7 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp) |
6106 |
+ ql_log(ql_log_fatal, vha, 0x00c8, |
6107 |
+ "Failed to allocate memory for ha->msix_entries.\n"); |
6108 |
+ ret = -ENOMEM; |
6109 |
+- goto msix_out; |
6110 |
++ goto free_irqs; |
6111 |
+ } |
6112 |
+ ha->flags.msix_enabled = 1; |
6113 |
+ |
6114 |
+@@ -3532,6 +3532,10 @@ msix_register_fail: |
6115 |
+ |
6116 |
+ msix_out: |
6117 |
+ return ret; |
6118 |
++ |
6119 |
++free_irqs: |
6120 |
++ pci_free_irq_vectors(ha->pdev); |
6121 |
++ goto msix_out; |
6122 |
+ } |
6123 |
+ |
6124 |
+ int |
6125 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
6126 |
+index a8c67cd17625..9d7feb005acf 100644 |
6127 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
6128 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
6129 |
+@@ -684,7 +684,6 @@ done: |
6130 |
+ void qla24xx_do_nack_work(struct scsi_qla_host *vha, struct qla_work_evt *e) |
6131 |
+ { |
6132 |
+ fc_port_t *t; |
6133 |
+- unsigned long flags; |
6134 |
+ |
6135 |
+ switch (e->u.nack.type) { |
6136 |
+ case SRB_NACK_PRLI: |
6137 |
+@@ -694,10 +693,8 @@ void qla24xx_do_nack_work(struct scsi_qla_host *vha, struct qla_work_evt *e) |
6138 |
+ if (t) { |
6139 |
+ ql_log(ql_log_info, vha, 0xd034, |
6140 |
+ "%s create sess success %p", __func__, t); |
6141 |
+- spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
6142 |
+ /* create sess has an extra kref */ |
6143 |
+ vha->hw->tgt.tgt_ops->put_sess(e->u.nack.fcport); |
6144 |
+- spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
6145 |
+ } |
6146 |
+ break; |
6147 |
+ } |
6148 |
+@@ -709,9 +706,6 @@ void qla24xx_delete_sess_fn(struct work_struct *work) |
6149 |
+ { |
6150 |
+ fc_port_t *fcport = container_of(work, struct fc_port, del_work); |
6151 |
+ struct qla_hw_data *ha = fcport->vha->hw; |
6152 |
+- unsigned long flags; |
6153 |
+- |
6154 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
6155 |
+ |
6156 |
+ if (fcport->se_sess) { |
6157 |
+ ha->tgt.tgt_ops->shutdown_sess(fcport); |
6158 |
+@@ -719,7 +713,6 @@ void qla24xx_delete_sess_fn(struct work_struct *work) |
6159 |
+ } else { |
6160 |
+ qlt_unreg_sess(fcport); |
6161 |
+ } |
6162 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6163 |
+ } |
6164 |
+ |
6165 |
+ /* |
6166 |
+@@ -788,8 +781,9 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) |
6167 |
+ fcport->port_name, sess->loop_id); |
6168 |
+ sess->local = 0; |
6169 |
+ } |
6170 |
+- ha->tgt.tgt_ops->put_sess(sess); |
6171 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6172 |
++ |
6173 |
++ ha->tgt.tgt_ops->put_sess(sess); |
6174 |
+ } |
6175 |
+ |
6176 |
+ /* |
6177 |
+@@ -4135,9 +4129,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd) |
6178 |
+ /* |
6179 |
+ * Drop extra session reference from qla_tgt_handle_cmd_for_atio*( |
6180 |
+ */ |
6181 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
6182 |
+ ha->tgt.tgt_ops->put_sess(sess); |
6183 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6184 |
+ return; |
6185 |
+ |
6186 |
+ out_term: |
6187 |
+@@ -4154,9 +4146,7 @@ out_term: |
6188 |
+ target_free_tag(sess->se_sess, &cmd->se_cmd); |
6189 |
+ spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); |
6190 |
+ |
6191 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
6192 |
+ ha->tgt.tgt_ops->put_sess(sess); |
6193 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6194 |
+ } |
6195 |
+ |
6196 |
+ static void qlt_do_work(struct work_struct *work) |
6197 |
+@@ -4365,9 +4355,7 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha, |
6198 |
+ if (!cmd) { |
6199 |
+ ql_dbg(ql_dbg_io, vha, 0x3062, |
6200 |
+ "qla_target(%d): Allocation of cmd failed\n", vha->vp_idx); |
6201 |
+- spin_lock_irqsave(&ha->tgt.sess_lock, flags); |
6202 |
+ ha->tgt.tgt_ops->put_sess(sess); |
6203 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6204 |
+ return -EBUSY; |
6205 |
+ } |
6206 |
+ |
6207 |
+@@ -6105,17 +6093,19 @@ static void qlt_abort_work(struct qla_tgt *tgt, |
6208 |
+ } |
6209 |
+ |
6210 |
+ rc = __qlt_24xx_handle_abts(vha, &prm->abts, sess); |
6211 |
+- ha->tgt.tgt_ops->put_sess(sess); |
6212 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
6213 |
+ |
6214 |
++ ha->tgt.tgt_ops->put_sess(sess); |
6215 |
++ |
6216 |
+ if (rc != 0) |
6217 |
+ goto out_term; |
6218 |
+ return; |
6219 |
+ |
6220 |
+ out_term2: |
6221 |
++ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
6222 |
++ |
6223 |
+ if (sess) |
6224 |
+ ha->tgt.tgt_ops->put_sess(sess); |
6225 |
+- spin_unlock_irqrestore(&ha->tgt.sess_lock, flags2); |
6226 |
+ |
6227 |
+ out_term: |
6228 |
+ spin_lock_irqsave(&ha->hardware_lock, flags); |
6229 |
+@@ -6175,9 +6165,10 @@ static void qlt_tmr_work(struct qla_tgt *tgt, |
6230 |
+ scsilun_to_int((struct scsi_lun *)&a->u.isp24.fcp_cmnd.lun); |
6231 |
+ |
6232 |
+ rc = qlt_issue_task_mgmt(sess, unpacked_lun, fn, iocb, 0); |
6233 |
+- ha->tgt.tgt_ops->put_sess(sess); |
6234 |
+ spin_unlock_irqrestore(&ha->tgt.sess_lock, flags); |
6235 |
+ |
6236 |
++ ha->tgt.tgt_ops->put_sess(sess); |
6237 |
++ |
6238 |
+ if (rc != 0) |
6239 |
+ goto out_term; |
6240 |
+ return; |
6241 |
+diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6242 |
+index 64e2d859f633..b8c1a739dfbd 100644 |
6243 |
+--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6244 |
++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
6245 |
+@@ -350,7 +350,6 @@ static void tcm_qla2xxx_put_sess(struct fc_port *sess) |
6246 |
+ if (!sess) |
6247 |
+ return; |
6248 |
+ |
6249 |
+- assert_spin_locked(&sess->vha->hw->tgt.sess_lock); |
6250 |
+ kref_put(&sess->sess_kref, tcm_qla2xxx_release_session); |
6251 |
+ } |
6252 |
+ |
6253 |
+@@ -365,8 +364,9 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess) |
6254 |
+ |
6255 |
+ spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags); |
6256 |
+ target_sess_cmd_list_set_waiting(se_sess); |
6257 |
+- tcm_qla2xxx_put_sess(sess); |
6258 |
+ spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags); |
6259 |
++ |
6260 |
++ tcm_qla2xxx_put_sess(sess); |
6261 |
+ } |
6262 |
+ |
6263 |
+ static u32 tcm_qla2xxx_sess_get_index(struct se_session *se_sess) |
6264 |
+@@ -390,6 +390,8 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) |
6265 |
+ cmd->se_cmd.transport_state, |
6266 |
+ cmd->se_cmd.t_state, |
6267 |
+ cmd->se_cmd.se_cmd_flags); |
6268 |
++ transport_generic_request_failure(&cmd->se_cmd, |
6269 |
++ TCM_CHECK_CONDITION_ABORT_CMD); |
6270 |
+ return 0; |
6271 |
+ } |
6272 |
+ cmd->trc_flags |= TRC_XFR_RDY; |
6273 |
+@@ -829,7 +831,6 @@ static void tcm_qla2xxx_clear_nacl_from_fcport_map(struct fc_port *sess) |
6274 |
+ |
6275 |
+ static void tcm_qla2xxx_shutdown_sess(struct fc_port *sess) |
6276 |
+ { |
6277 |
+- assert_spin_locked(&sess->vha->hw->tgt.sess_lock); |
6278 |
+ target_sess_cmd_list_set_waiting(sess->se_sess); |
6279 |
+ } |
6280 |
+ |
6281 |
+diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
6282 |
+index 5dd3e4e01b10..25c8ce54a976 100644 |
6283 |
+--- a/drivers/scsi/qla4xxx/ql4_os.c |
6284 |
++++ b/drivers/scsi/qla4xxx/ql4_os.c |
6285 |
+@@ -5935,7 +5935,7 @@ static int get_fw_boot_info(struct scsi_qla_host *ha, uint16_t ddb_index[]) |
6286 |
+ val = rd_nvram_byte(ha, sec_addr); |
6287 |
+ if (val & BIT_7) |
6288 |
+ ddb_index[1] = (val & 0x7f); |
6289 |
+- |
6290 |
++ goto exit_boot_info; |
6291 |
+ } else if (is_qla80XX(ha)) { |
6292 |
+ buf = dma_alloc_coherent(&ha->pdev->dev, size, |
6293 |
+ &buf_dma, GFP_KERNEL); |
6294 |
+diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c |
6295 |
+index e925eda93191..77cb45ef55fc 100644 |
6296 |
+--- a/drivers/scsi/sd.c |
6297 |
++++ b/drivers/scsi/sd.c |
6298 |
+@@ -2605,7 +2605,6 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
6299 |
+ int res; |
6300 |
+ struct scsi_device *sdp = sdkp->device; |
6301 |
+ struct scsi_mode_data data; |
6302 |
+- int disk_ro = get_disk_ro(sdkp->disk); |
6303 |
+ int old_wp = sdkp->write_prot; |
6304 |
+ |
6305 |
+ set_disk_ro(sdkp->disk, 0); |
6306 |
+@@ -2646,7 +2645,7 @@ sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) |
6307 |
+ "Test WP failed, assume Write Enabled\n"); |
6308 |
+ } else { |
6309 |
+ sdkp->write_prot = ((data.device_specific & 0x80) != 0); |
6310 |
+- set_disk_ro(sdkp->disk, sdkp->write_prot || disk_ro); |
6311 |
++ set_disk_ro(sdkp->disk, sdkp->write_prot); |
6312 |
+ if (sdkp->first_scan || old_wp != sdkp->write_prot) { |
6313 |
+ sd_printk(KERN_NOTICE, sdkp, "Write Protect is %s\n", |
6314 |
+ sdkp->write_prot ? "on" : "off"); |
6315 |
+diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c |
6316 |
+index 452e19f8fb47..c2cee73a8560 100644 |
6317 |
+--- a/drivers/scsi/ufs/ufs-hisi.c |
6318 |
++++ b/drivers/scsi/ufs/ufs-hisi.c |
6319 |
+@@ -544,6 +544,10 @@ static int ufs_hisi_init_common(struct ufs_hba *hba) |
6320 |
+ ufshcd_set_variant(hba, host); |
6321 |
+ |
6322 |
+ host->rst = devm_reset_control_get(dev, "rst"); |
6323 |
++ if (IS_ERR(host->rst)) { |
6324 |
++ dev_err(dev, "%s: failed to get reset control\n", __func__); |
6325 |
++ return PTR_ERR(host->rst); |
6326 |
++ } |
6327 |
+ |
6328 |
+ ufs_hisi_set_pm_lvl(hba); |
6329 |
+ |
6330 |
+diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c |
6331 |
+index 6e80dfe4fa97..3183fa8c5857 100644 |
6332 |
+--- a/drivers/scsi/ufs/ufshcd.c |
6333 |
++++ b/drivers/scsi/ufs/ufshcd.c |
6334 |
+@@ -6130,19 +6130,19 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, |
6335 |
+ goto out; |
6336 |
+ } |
6337 |
+ |
6338 |
+- if (hba->vreg_info.vcc) |
6339 |
++ if (hba->vreg_info.vcc && hba->vreg_info.vcc->max_uA) |
6340 |
+ icc_level = ufshcd_get_max_icc_level( |
6341 |
+ hba->vreg_info.vcc->max_uA, |
6342 |
+ POWER_DESC_MAX_ACTV_ICC_LVLS - 1, |
6343 |
+ &desc_buf[PWR_DESC_ACTIVE_LVLS_VCC_0]); |
6344 |
+ |
6345 |
+- if (hba->vreg_info.vccq) |
6346 |
++ if (hba->vreg_info.vccq && hba->vreg_info.vccq->max_uA) |
6347 |
+ icc_level = ufshcd_get_max_icc_level( |
6348 |
+ hba->vreg_info.vccq->max_uA, |
6349 |
+ icc_level, |
6350 |
+ &desc_buf[PWR_DESC_ACTIVE_LVLS_VCCQ_0]); |
6351 |
+ |
6352 |
+- if (hba->vreg_info.vccq2) |
6353 |
++ if (hba->vreg_info.vccq2 && hba->vreg_info.vccq2->max_uA) |
6354 |
+ icc_level = ufshcd_get_max_icc_level( |
6355 |
+ hba->vreg_info.vccq2->max_uA, |
6356 |
+ icc_level, |
6357 |
+@@ -6767,6 +6767,15 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, |
6358 |
+ if (!vreg) |
6359 |
+ return 0; |
6360 |
+ |
6361 |
++ /* |
6362 |
++ * "set_load" operation shall be required on those regulators |
6363 |
++ * which specifically configured current limitation. Otherwise |
6364 |
++ * zero max_uA may cause unexpected behavior when regulator is |
6365 |
++ * enabled or set as high power mode. |
6366 |
++ */ |
6367 |
++ if (!vreg->max_uA) |
6368 |
++ return 0; |
6369 |
++ |
6370 |
+ ret = regulator_set_load(vreg->reg, ua); |
6371 |
+ if (ret < 0) { |
6372 |
+ dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n", |
6373 |
+@@ -6813,12 +6822,15 @@ static int ufshcd_config_vreg(struct device *dev, |
6374 |
+ name = vreg->name; |
6375 |
+ |
6376 |
+ if (regulator_count_voltages(reg) > 0) { |
6377 |
+- min_uV = on ? vreg->min_uV : 0; |
6378 |
+- ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
6379 |
+- if (ret) { |
6380 |
+- dev_err(dev, "%s: %s set voltage failed, err=%d\n", |
6381 |
++ if (vreg->min_uV && vreg->max_uV) { |
6382 |
++ min_uV = on ? vreg->min_uV : 0; |
6383 |
++ ret = regulator_set_voltage(reg, min_uV, vreg->max_uV); |
6384 |
++ if (ret) { |
6385 |
++ dev_err(dev, |
6386 |
++ "%s: %s set voltage failed, err=%d\n", |
6387 |
+ __func__, name, ret); |
6388 |
+- goto out; |
6389 |
++ goto out; |
6390 |
++ } |
6391 |
+ } |
6392 |
+ |
6393 |
+ uA_load = on ? vreg->max_uA : 0; |
6394 |
+diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c |
6395 |
+index 14a9d18306cb..f63d1b8a0933 100644 |
6396 |
+--- a/drivers/slimbus/qcom-ngd-ctrl.c |
6397 |
++++ b/drivers/slimbus/qcom-ngd-ctrl.c |
6398 |
+@@ -1331,6 +1331,10 @@ static int of_qcom_slim_ngd_register(struct device *parent, |
6399 |
+ return -ENOMEM; |
6400 |
+ |
6401 |
+ ngd->pdev = platform_device_alloc(QCOM_SLIM_NGD_DRV_NAME, id); |
6402 |
++ if (!ngd->pdev) { |
6403 |
++ kfree(ngd); |
6404 |
++ return -ENOMEM; |
6405 |
++ } |
6406 |
+ ngd->id = id; |
6407 |
+ ngd->pdev->dev.parent = parent; |
6408 |
+ ngd->pdev->driver_override = QCOM_SLIM_NGD_DRV_NAME; |
6409 |
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c |
6410 |
+index 08dd3a31a3e5..5b6f3655c366 100644 |
6411 |
+--- a/drivers/spi/spi-imx.c |
6412 |
++++ b/drivers/spi/spi-imx.c |
6413 |
+@@ -1427,7 +1427,7 @@ static int spi_imx_transfer(struct spi_device *spi, |
6414 |
+ |
6415 |
+ /* flush rxfifo before transfer */ |
6416 |
+ while (spi_imx->devtype_data->rx_available(spi_imx)) |
6417 |
+- spi_imx->rx(spi_imx); |
6418 |
++ readl(spi_imx->base + MXC_CSPIRXDATA); |
6419 |
+ |
6420 |
+ if (spi_imx->slave_mode) |
6421 |
+ return spi_imx_pio_transfer_slave(spi, transfer); |
6422 |
+diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c |
6423 |
+index b624f6fb04ce..729be74621e3 100644 |
6424 |
+--- a/drivers/spi/spi-pxa2xx.c |
6425 |
++++ b/drivers/spi/spi-pxa2xx.c |
6426 |
+@@ -876,10 +876,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) |
6427 |
+ |
6428 |
+ rate = min_t(int, ssp_clk, rate); |
6429 |
+ |
6430 |
++ /* |
6431 |
++ * Calculate the divisor for the SCR (Serial Clock Rate), avoiding |
6432 |
++ * that the SSP transmission rate can be greater than the device rate |
6433 |
++ */ |
6434 |
+ if (ssp->type == PXA25x_SSP || ssp->type == CE4100_SSP) |
6435 |
+- return (ssp_clk / (2 * rate) - 1) & 0xff; |
6436 |
++ return (DIV_ROUND_UP(ssp_clk, 2 * rate) - 1) & 0xff; |
6437 |
+ else |
6438 |
+- return (ssp_clk / rate - 1) & 0xfff; |
6439 |
++ return (DIV_ROUND_UP(ssp_clk, rate) - 1) & 0xfff; |
6440 |
+ } |
6441 |
+ |
6442 |
+ static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, |
6443 |
+diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c |
6444 |
+index b37de1d991d6..d61120822f02 100644 |
6445 |
+--- a/drivers/spi/spi-rspi.c |
6446 |
++++ b/drivers/spi/spi-rspi.c |
6447 |
+@@ -279,7 +279,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size) |
6448 |
+ /* Sets parity, interrupt mask */ |
6449 |
+ rspi_write8(rspi, 0x00, RSPI_SPCR2); |
6450 |
+ |
6451 |
+- /* Sets SPCMD */ |
6452 |
++ /* Resets sequencer */ |
6453 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
6454 |
+ rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
6455 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
6456 |
+ |
6457 |
+@@ -323,7 +324,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size) |
6458 |
+ rspi_write8(rspi, 0x00, RSPI_SSLND); |
6459 |
+ rspi_write8(rspi, 0x00, RSPI_SPND); |
6460 |
+ |
6461 |
+- /* Sets SPCMD */ |
6462 |
++ /* Resets sequencer */ |
6463 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
6464 |
+ rspi->spcmd |= SPCMD_SPB_8_TO_16(access_size); |
6465 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
6466 |
+ |
6467 |
+@@ -374,7 +376,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size) |
6468 |
+ /* Sets buffer to allow normal operation */ |
6469 |
+ rspi_write8(rspi, 0x00, QSPI_SPBFCR); |
6470 |
+ |
6471 |
+- /* Sets SPCMD */ |
6472 |
++ /* Resets sequencer */ |
6473 |
++ rspi_write8(rspi, 0, RSPI_SPSCR); |
6474 |
+ rspi_write16(rspi, rspi->spcmd, RSPI_SPCMD0); |
6475 |
+ |
6476 |
+ /* Sets RSPI mode */ |
6477 |
+diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c |
6478 |
+index a76acedd7e2f..a1888dc6a938 100644 |
6479 |
+--- a/drivers/spi/spi-tegra114.c |
6480 |
++++ b/drivers/spi/spi-tegra114.c |
6481 |
+@@ -1067,27 +1067,19 @@ static int tegra_spi_probe(struct platform_device *pdev) |
6482 |
+ |
6483 |
+ spi_irq = platform_get_irq(pdev, 0); |
6484 |
+ tspi->irq = spi_irq; |
6485 |
+- ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
6486 |
+- tegra_spi_isr_thread, IRQF_ONESHOT, |
6487 |
+- dev_name(&pdev->dev), tspi); |
6488 |
+- if (ret < 0) { |
6489 |
+- dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
6490 |
+- tspi->irq); |
6491 |
+- goto exit_free_master; |
6492 |
+- } |
6493 |
+ |
6494 |
+ tspi->clk = devm_clk_get(&pdev->dev, "spi"); |
6495 |
+ if (IS_ERR(tspi->clk)) { |
6496 |
+ dev_err(&pdev->dev, "can not get clock\n"); |
6497 |
+ ret = PTR_ERR(tspi->clk); |
6498 |
+- goto exit_free_irq; |
6499 |
++ goto exit_free_master; |
6500 |
+ } |
6501 |
+ |
6502 |
+ tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
6503 |
+ if (IS_ERR(tspi->rst)) { |
6504 |
+ dev_err(&pdev->dev, "can not get reset\n"); |
6505 |
+ ret = PTR_ERR(tspi->rst); |
6506 |
+- goto exit_free_irq; |
6507 |
++ goto exit_free_master; |
6508 |
+ } |
6509 |
+ |
6510 |
+ tspi->max_buf_size = SPI_FIFO_DEPTH << 2; |
6511 |
+@@ -1095,7 +1087,7 @@ static int tegra_spi_probe(struct platform_device *pdev) |
6512 |
+ |
6513 |
+ ret = tegra_spi_init_dma_param(tspi, true); |
6514 |
+ if (ret < 0) |
6515 |
+- goto exit_free_irq; |
6516 |
++ goto exit_free_master; |
6517 |
+ ret = tegra_spi_init_dma_param(tspi, false); |
6518 |
+ if (ret < 0) |
6519 |
+ goto exit_rx_dma_free; |
6520 |
+@@ -1117,18 +1109,32 @@ static int tegra_spi_probe(struct platform_device *pdev) |
6521 |
+ dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret); |
6522 |
+ goto exit_pm_disable; |
6523 |
+ } |
6524 |
++ |
6525 |
++ reset_control_assert(tspi->rst); |
6526 |
++ udelay(2); |
6527 |
++ reset_control_deassert(tspi->rst); |
6528 |
+ tspi->def_command1_reg = SPI_M_S; |
6529 |
+ tegra_spi_writel(tspi, tspi->def_command1_reg, SPI_COMMAND1); |
6530 |
+ pm_runtime_put(&pdev->dev); |
6531 |
++ ret = request_threaded_irq(tspi->irq, tegra_spi_isr, |
6532 |
++ tegra_spi_isr_thread, IRQF_ONESHOT, |
6533 |
++ dev_name(&pdev->dev), tspi); |
6534 |
++ if (ret < 0) { |
6535 |
++ dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n", |
6536 |
++ tspi->irq); |
6537 |
++ goto exit_pm_disable; |
6538 |
++ } |
6539 |
+ |
6540 |
+ master->dev.of_node = pdev->dev.of_node; |
6541 |
+ ret = devm_spi_register_master(&pdev->dev, master); |
6542 |
+ if (ret < 0) { |
6543 |
+ dev_err(&pdev->dev, "can not register to master err %d\n", ret); |
6544 |
+- goto exit_pm_disable; |
6545 |
++ goto exit_free_irq; |
6546 |
+ } |
6547 |
+ return ret; |
6548 |
+ |
6549 |
++exit_free_irq: |
6550 |
++ free_irq(spi_irq, tspi); |
6551 |
+ exit_pm_disable: |
6552 |
+ pm_runtime_disable(&pdev->dev); |
6553 |
+ if (!pm_runtime_status_suspended(&pdev->dev)) |
6554 |
+@@ -1136,8 +1142,6 @@ exit_pm_disable: |
6555 |
+ tegra_spi_deinit_dma_param(tspi, false); |
6556 |
+ exit_rx_dma_free: |
6557 |
+ tegra_spi_deinit_dma_param(tspi, true); |
6558 |
+-exit_free_irq: |
6559 |
+- free_irq(spi_irq, tspi); |
6560 |
+ exit_free_master: |
6561 |
+ spi_master_put(master); |
6562 |
+ return ret; |
6563 |
+diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c |
6564 |
+index 97d137591b18..4389ab80c23e 100644 |
6565 |
+--- a/drivers/spi/spi-topcliff-pch.c |
6566 |
++++ b/drivers/spi/spi-topcliff-pch.c |
6567 |
+@@ -1294,18 +1294,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, |
6568 |
+ dma->rx_buf_virt, dma->rx_buf_dma); |
6569 |
+ } |
6570 |
+ |
6571 |
+-static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
6572 |
++static int pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, |
6573 |
+ struct pch_spi_data *data) |
6574 |
+ { |
6575 |
+ struct pch_spi_dma_ctrl *dma; |
6576 |
++ int ret; |
6577 |
+ |
6578 |
+ dma = &data->dma; |
6579 |
++ ret = 0; |
6580 |
+ /* Get Consistent memory for Tx DMA */ |
6581 |
+ dma->tx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
6582 |
+ PCH_BUF_SIZE, &dma->tx_buf_dma, GFP_KERNEL); |
6583 |
++ if (!dma->tx_buf_virt) |
6584 |
++ ret = -ENOMEM; |
6585 |
++ |
6586 |
+ /* Get Consistent memory for Rx DMA */ |
6587 |
+ dma->rx_buf_virt = dma_alloc_coherent(&board_dat->pdev->dev, |
6588 |
+ PCH_BUF_SIZE, &dma->rx_buf_dma, GFP_KERNEL); |
6589 |
++ if (!dma->rx_buf_virt) |
6590 |
++ ret = -ENOMEM; |
6591 |
++ |
6592 |
++ return ret; |
6593 |
+ } |
6594 |
+ |
6595 |
+ static int pch_spi_pd_probe(struct platform_device *plat_dev) |
6596 |
+@@ -1382,7 +1391,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev) |
6597 |
+ |
6598 |
+ if (use_dma) { |
6599 |
+ dev_info(&plat_dev->dev, "Use DMA for data transfers\n"); |
6600 |
+- pch_alloc_dma_buf(board_dat, data); |
6601 |
++ ret = pch_alloc_dma_buf(board_dat, data); |
6602 |
++ if (ret) |
6603 |
++ goto err_spi_register_master; |
6604 |
+ } |
6605 |
+ |
6606 |
+ ret = spi_register_master(master); |
6607 |
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c |
6608 |
+index 9da0bc5a036c..88a8a8edd44b 100644 |
6609 |
+--- a/drivers/spi/spi.c |
6610 |
++++ b/drivers/spi/spi.c |
6611 |
+@@ -982,6 +982,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) |
6612 |
+ if (max_tx || max_rx) { |
6613 |
+ list_for_each_entry(xfer, &msg->transfers, |
6614 |
+ transfer_list) { |
6615 |
++ if (!xfer->len) |
6616 |
++ continue; |
6617 |
+ if (!xfer->tx_buf) |
6618 |
+ xfer->tx_buf = ctlr->dummy_tx; |
6619 |
+ if (!xfer->rx_buf) |
6620 |
+diff --git a/drivers/ssb/bridge_pcmcia_80211.c b/drivers/ssb/bridge_pcmcia_80211.c |
6621 |
+index f51f150307df..ffa379efff83 100644 |
6622 |
+--- a/drivers/ssb/bridge_pcmcia_80211.c |
6623 |
++++ b/drivers/ssb/bridge_pcmcia_80211.c |
6624 |
+@@ -113,16 +113,21 @@ static struct pcmcia_driver ssb_host_pcmcia_driver = { |
6625 |
+ .resume = ssb_host_pcmcia_resume, |
6626 |
+ }; |
6627 |
+ |
6628 |
++static int pcmcia_init_failed; |
6629 |
++ |
6630 |
+ /* |
6631 |
+ * These are not module init/exit functions! |
6632 |
+ * The module_pcmcia_driver() helper cannot be used here. |
6633 |
+ */ |
6634 |
+ int ssb_host_pcmcia_init(void) |
6635 |
+ { |
6636 |
+- return pcmcia_register_driver(&ssb_host_pcmcia_driver); |
6637 |
++ pcmcia_init_failed = pcmcia_register_driver(&ssb_host_pcmcia_driver); |
6638 |
++ |
6639 |
++ return pcmcia_init_failed; |
6640 |
+ } |
6641 |
+ |
6642 |
+ void ssb_host_pcmcia_exit(void) |
6643 |
+ { |
6644 |
+- pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
6645 |
++ if (!pcmcia_init_failed) |
6646 |
++ pcmcia_unregister_driver(&ssb_host_pcmcia_driver); |
6647 |
+ } |
6648 |
+diff --git a/drivers/staging/media/davinci_vpfe/Kconfig b/drivers/staging/media/davinci_vpfe/Kconfig |
6649 |
+index aea449a8dbf8..76818cc48ddc 100644 |
6650 |
+--- a/drivers/staging/media/davinci_vpfe/Kconfig |
6651 |
++++ b/drivers/staging/media/davinci_vpfe/Kconfig |
6652 |
+@@ -1,7 +1,7 @@ |
6653 |
+ config VIDEO_DM365_VPFE |
6654 |
+ tristate "DM365 VPFE Media Controller Capture Driver" |
6655 |
+ depends on VIDEO_V4L2 |
6656 |
+- depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || COMPILE_TEST |
6657 |
++ depends on (ARCH_DAVINCI_DM365 && !VIDEO_DM365_ISIF) || (COMPILE_TEST && !ARCH_OMAP1) |
6658 |
+ depends on VIDEO_V4L2_SUBDEV_API |
6659 |
+ depends on VIDEO_DAVINCI_VPBE_DISPLAY |
6660 |
+ select VIDEOBUF2_DMA_CONTIG |
6661 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
6662 |
+index e76720903064..c7c8ef67b67f 100644 |
6663 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
6664 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c |
6665 |
+@@ -208,6 +208,9 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state) |
6666 |
+ struct vchiq_2835_state *platform_state; |
6667 |
+ |
6668 |
+ state->platform_state = kzalloc(sizeof(*platform_state), GFP_KERNEL); |
6669 |
++ if (!state->platform_state) |
6670 |
++ return VCHIQ_ERROR; |
6671 |
++ |
6672 |
+ platform_state = (struct vchiq_2835_state *)state->platform_state; |
6673 |
+ |
6674 |
+ platform_state->inited = 1; |
6675 |
+diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
6676 |
+index 7642ced31436..63ce567eb6b7 100644 |
6677 |
+--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
6678 |
++++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c |
6679 |
+@@ -2537,6 +2537,8 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero, |
6680 |
+ local->debug[DEBUG_ENTRIES] = DEBUG_MAX; |
6681 |
+ |
6682 |
+ status = vchiq_platform_init_state(state); |
6683 |
++ if (status != VCHIQ_SUCCESS) |
6684 |
++ return VCHIQ_ERROR; |
6685 |
+ |
6686 |
+ /* |
6687 |
+ bring up slot handler thread |
6688 |
+diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c |
6689 |
+index 28fc4ce75edb..8490a1b6b615 100644 |
6690 |
+--- a/drivers/thunderbolt/icm.c |
6691 |
++++ b/drivers/thunderbolt/icm.c |
6692 |
+@@ -476,6 +476,11 @@ static void add_switch(struct tb_switch *parent_sw, u64 route, |
6693 |
+ goto out; |
6694 |
+ |
6695 |
+ sw->uuid = kmemdup(uuid, sizeof(*uuid), GFP_KERNEL); |
6696 |
++ if (!sw->uuid) { |
6697 |
++ tb_sw_warn(sw, "cannot allocate memory for switch\n"); |
6698 |
++ tb_switch_put(sw); |
6699 |
++ goto out; |
6700 |
++ } |
6701 |
+ sw->connection_id = connection_id; |
6702 |
+ sw->connection_key = connection_key; |
6703 |
+ sw->link = link; |
6704 |
+diff --git a/drivers/thunderbolt/property.c b/drivers/thunderbolt/property.c |
6705 |
+index 8fe913a95b4a..be3f8b592b05 100644 |
6706 |
+--- a/drivers/thunderbolt/property.c |
6707 |
++++ b/drivers/thunderbolt/property.c |
6708 |
+@@ -551,6 +551,11 @@ int tb_property_add_data(struct tb_property_dir *parent, const char *key, |
6709 |
+ |
6710 |
+ property->length = size / 4; |
6711 |
+ property->value.data = kzalloc(size, GFP_KERNEL); |
6712 |
++ if (!property->value.data) { |
6713 |
++ kfree(property); |
6714 |
++ return -ENOMEM; |
6715 |
++ } |
6716 |
++ |
6717 |
+ memcpy(property->value.data, buf, buflen); |
6718 |
+ |
6719 |
+ list_add_tail(&property->list, &parent->properties); |
6720 |
+@@ -581,7 +586,12 @@ int tb_property_add_text(struct tb_property_dir *parent, const char *key, |
6721 |
+ return -ENOMEM; |
6722 |
+ |
6723 |
+ property->length = size / 4; |
6724 |
+- property->value.data = kzalloc(size, GFP_KERNEL); |
6725 |
++ property->value.text = kzalloc(size, GFP_KERNEL); |
6726 |
++ if (!property->value.text) { |
6727 |
++ kfree(property); |
6728 |
++ return -ENOMEM; |
6729 |
++ } |
6730 |
++ |
6731 |
+ strcpy(property->value.text, text); |
6732 |
+ |
6733 |
+ list_add_tail(&property->list, &parent->properties); |
6734 |
+diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c |
6735 |
+index dd9ae6f5d19c..bc7efa6e515d 100644 |
6736 |
+--- a/drivers/thunderbolt/switch.c |
6737 |
++++ b/drivers/thunderbolt/switch.c |
6738 |
+@@ -9,15 +9,13 @@ |
6739 |
+ #include <linux/idr.h> |
6740 |
+ #include <linux/nvmem-provider.h> |
6741 |
+ #include <linux/pm_runtime.h> |
6742 |
++#include <linux/sched/signal.h> |
6743 |
+ #include <linux/sizes.h> |
6744 |
+ #include <linux/slab.h> |
6745 |
+ #include <linux/vmalloc.h> |
6746 |
+ |
6747 |
+ #include "tb.h" |
6748 |
+ |
6749 |
+-/* Switch authorization from userspace is serialized by this lock */ |
6750 |
+-static DEFINE_MUTEX(switch_lock); |
6751 |
+- |
6752 |
+ /* Switch NVM support */ |
6753 |
+ |
6754 |
+ #define NVM_DEVID 0x05 |
6755 |
+@@ -253,8 +251,8 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val, |
6756 |
+ struct tb_switch *sw = priv; |
6757 |
+ int ret = 0; |
6758 |
+ |
6759 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6760 |
+- return -ERESTARTSYS; |
6761 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6762 |
++ return restart_syscall(); |
6763 |
+ |
6764 |
+ /* |
6765 |
+ * Since writing the NVM image might require some special steps, |
6766 |
+@@ -274,7 +272,7 @@ static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val, |
6767 |
+ memcpy(sw->nvm->buf + offset, val, bytes); |
6768 |
+ |
6769 |
+ unlock: |
6770 |
+- mutex_unlock(&switch_lock); |
6771 |
++ mutex_unlock(&sw->tb->lock); |
6772 |
+ |
6773 |
+ return ret; |
6774 |
+ } |
6775 |
+@@ -363,10 +361,7 @@ static int tb_switch_nvm_add(struct tb_switch *sw) |
6776 |
+ } |
6777 |
+ nvm->non_active = nvm_dev; |
6778 |
+ |
6779 |
+- mutex_lock(&switch_lock); |
6780 |
+ sw->nvm = nvm; |
6781 |
+- mutex_unlock(&switch_lock); |
6782 |
+- |
6783 |
+ return 0; |
6784 |
+ |
6785 |
+ err_nvm_active: |
6786 |
+@@ -383,10 +378,8 @@ static void tb_switch_nvm_remove(struct tb_switch *sw) |
6787 |
+ { |
6788 |
+ struct tb_switch_nvm *nvm; |
6789 |
+ |
6790 |
+- mutex_lock(&switch_lock); |
6791 |
+ nvm = sw->nvm; |
6792 |
+ sw->nvm = NULL; |
6793 |
+- mutex_unlock(&switch_lock); |
6794 |
+ |
6795 |
+ if (!nvm) |
6796 |
+ return; |
6797 |
+@@ -717,8 +710,8 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) |
6798 |
+ { |
6799 |
+ int ret = -EINVAL; |
6800 |
+ |
6801 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6802 |
+- return -ERESTARTSYS; |
6803 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6804 |
++ return restart_syscall(); |
6805 |
+ |
6806 |
+ if (sw->authorized) |
6807 |
+ goto unlock; |
6808 |
+@@ -761,7 +754,7 @@ static int tb_switch_set_authorized(struct tb_switch *sw, unsigned int val) |
6809 |
+ } |
6810 |
+ |
6811 |
+ unlock: |
6812 |
+- mutex_unlock(&switch_lock); |
6813 |
++ mutex_unlock(&sw->tb->lock); |
6814 |
+ return ret; |
6815 |
+ } |
6816 |
+ |
6817 |
+@@ -818,15 +811,15 @@ static ssize_t key_show(struct device *dev, struct device_attribute *attr, |
6818 |
+ struct tb_switch *sw = tb_to_switch(dev); |
6819 |
+ ssize_t ret; |
6820 |
+ |
6821 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6822 |
+- return -ERESTARTSYS; |
6823 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6824 |
++ return restart_syscall(); |
6825 |
+ |
6826 |
+ if (sw->key) |
6827 |
+ ret = sprintf(buf, "%*phN\n", TB_SWITCH_KEY_SIZE, sw->key); |
6828 |
+ else |
6829 |
+ ret = sprintf(buf, "\n"); |
6830 |
+ |
6831 |
+- mutex_unlock(&switch_lock); |
6832 |
++ mutex_unlock(&sw->tb->lock); |
6833 |
+ return ret; |
6834 |
+ } |
6835 |
+ |
6836 |
+@@ -843,8 +836,8 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, |
6837 |
+ else if (hex2bin(key, buf, sizeof(key))) |
6838 |
+ return -EINVAL; |
6839 |
+ |
6840 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6841 |
+- return -ERESTARTSYS; |
6842 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6843 |
++ return restart_syscall(); |
6844 |
+ |
6845 |
+ if (sw->authorized) { |
6846 |
+ ret = -EBUSY; |
6847 |
+@@ -859,7 +852,7 @@ static ssize_t key_store(struct device *dev, struct device_attribute *attr, |
6848 |
+ } |
6849 |
+ } |
6850 |
+ |
6851 |
+- mutex_unlock(&switch_lock); |
6852 |
++ mutex_unlock(&sw->tb->lock); |
6853 |
+ return ret; |
6854 |
+ } |
6855 |
+ static DEVICE_ATTR(key, 0600, key_show, key_store); |
6856 |
+@@ -905,8 +898,8 @@ static ssize_t nvm_authenticate_store(struct device *dev, |
6857 |
+ bool val; |
6858 |
+ int ret; |
6859 |
+ |
6860 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6861 |
+- return -ERESTARTSYS; |
6862 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6863 |
++ return restart_syscall(); |
6864 |
+ |
6865 |
+ /* If NVMem devices are not yet added */ |
6866 |
+ if (!sw->nvm) { |
6867 |
+@@ -954,7 +947,7 @@ static ssize_t nvm_authenticate_store(struct device *dev, |
6868 |
+ } |
6869 |
+ |
6870 |
+ exit_unlock: |
6871 |
+- mutex_unlock(&switch_lock); |
6872 |
++ mutex_unlock(&sw->tb->lock); |
6873 |
+ |
6874 |
+ if (ret) |
6875 |
+ return ret; |
6876 |
+@@ -968,8 +961,8 @@ static ssize_t nvm_version_show(struct device *dev, |
6877 |
+ struct tb_switch *sw = tb_to_switch(dev); |
6878 |
+ int ret; |
6879 |
+ |
6880 |
+- if (mutex_lock_interruptible(&switch_lock)) |
6881 |
+- return -ERESTARTSYS; |
6882 |
++ if (!mutex_trylock(&sw->tb->lock)) |
6883 |
++ return restart_syscall(); |
6884 |
+ |
6885 |
+ if (sw->safe_mode) |
6886 |
+ ret = -ENODATA; |
6887 |
+@@ -978,7 +971,7 @@ static ssize_t nvm_version_show(struct device *dev, |
6888 |
+ else |
6889 |
+ ret = sprintf(buf, "%x.%x\n", sw->nvm->major, sw->nvm->minor); |
6890 |
+ |
6891 |
+- mutex_unlock(&switch_lock); |
6892 |
++ mutex_unlock(&sw->tb->lock); |
6893 |
+ |
6894 |
+ return ret; |
6895 |
+ } |
6896 |
+@@ -1296,13 +1289,14 @@ int tb_switch_configure(struct tb_switch *sw) |
6897 |
+ return tb_plug_events_active(sw, true); |
6898 |
+ } |
6899 |
+ |
6900 |
+-static void tb_switch_set_uuid(struct tb_switch *sw) |
6901 |
++static int tb_switch_set_uuid(struct tb_switch *sw) |
6902 |
+ { |
6903 |
+ u32 uuid[4]; |
6904 |
+- int cap; |
6905 |
++ int cap, ret; |
6906 |
+ |
6907 |
++ ret = 0; |
6908 |
+ if (sw->uuid) |
6909 |
+- return; |
6910 |
++ return ret; |
6911 |
+ |
6912 |
+ /* |
6913 |
+ * The newer controllers include fused UUID as part of link |
6914 |
+@@ -1310,7 +1304,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw) |
6915 |
+ */ |
6916 |
+ cap = tb_switch_find_vse_cap(sw, TB_VSE_CAP_LINK_CONTROLLER); |
6917 |
+ if (cap > 0) { |
6918 |
+- tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); |
6919 |
++ ret = tb_sw_read(sw, uuid, TB_CFG_SWITCH, cap + 3, 4); |
6920 |
++ if (ret) |
6921 |
++ return ret; |
6922 |
+ } else { |
6923 |
+ /* |
6924 |
+ * ICM generates UUID based on UID and fills the upper |
6925 |
+@@ -1325,6 +1321,9 @@ static void tb_switch_set_uuid(struct tb_switch *sw) |
6926 |
+ } |
6927 |
+ |
6928 |
+ sw->uuid = kmemdup(uuid, sizeof(uuid), GFP_KERNEL); |
6929 |
++ if (!sw->uuid) |
6930 |
++ ret = -ENOMEM; |
6931 |
++ return ret; |
6932 |
+ } |
6933 |
+ |
6934 |
+ static int tb_switch_add_dma_port(struct tb_switch *sw) |
6935 |
+@@ -1374,7 +1373,9 @@ static int tb_switch_add_dma_port(struct tb_switch *sw) |
6936 |
+ |
6937 |
+ if (status) { |
6938 |
+ tb_sw_info(sw, "switch flash authentication failed\n"); |
6939 |
+- tb_switch_set_uuid(sw); |
6940 |
++ ret = tb_switch_set_uuid(sw); |
6941 |
++ if (ret) |
6942 |
++ return ret; |
6943 |
+ nvm_set_auth_status(sw, status); |
6944 |
+ } |
6945 |
+ |
6946 |
+@@ -1424,7 +1425,9 @@ int tb_switch_add(struct tb_switch *sw) |
6947 |
+ } |
6948 |
+ tb_sw_info(sw, "uid: %#llx\n", sw->uid); |
6949 |
+ |
6950 |
+- tb_switch_set_uuid(sw); |
6951 |
++ ret = tb_switch_set_uuid(sw); |
6952 |
++ if (ret) |
6953 |
++ return ret; |
6954 |
+ |
6955 |
+ for (i = 0; i <= sw->config.max_port_number; i++) { |
6956 |
+ if (sw->ports[i].disabled) { |
6957 |
+diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h |
6958 |
+index 5067d69d0501..7a0ee9836a8a 100644 |
6959 |
+--- a/drivers/thunderbolt/tb.h |
6960 |
++++ b/drivers/thunderbolt/tb.h |
6961 |
+@@ -79,8 +79,7 @@ struct tb_switch_nvm { |
6962 |
+ * @depth: Depth in the chain this switch is connected (ICM only) |
6963 |
+ * |
6964 |
+ * When the switch is being added or removed to the domain (other |
6965 |
+- * switches) you need to have domain lock held. For switch authorization |
6966 |
+- * internal switch_lock is enough. |
6967 |
++ * switches) you need to have domain lock held. |
6968 |
+ */ |
6969 |
+ struct tb_switch { |
6970 |
+ struct device dev; |
6971 |
+diff --git a/drivers/thunderbolt/xdomain.c b/drivers/thunderbolt/xdomain.c |
6972 |
+index db8bece63327..befe75490697 100644 |
6973 |
+--- a/drivers/thunderbolt/xdomain.c |
6974 |
++++ b/drivers/thunderbolt/xdomain.c |
6975 |
+@@ -743,6 +743,7 @@ static void enumerate_services(struct tb_xdomain *xd) |
6976 |
+ struct tb_service *svc; |
6977 |
+ struct tb_property *p; |
6978 |
+ struct device *dev; |
6979 |
++ int id; |
6980 |
+ |
6981 |
+ /* |
6982 |
+ * First remove all services that are not available anymore in |
6983 |
+@@ -771,7 +772,12 @@ static void enumerate_services(struct tb_xdomain *xd) |
6984 |
+ break; |
6985 |
+ } |
6986 |
+ |
6987 |
+- svc->id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); |
6988 |
++ id = ida_simple_get(&xd->service_ids, 0, 0, GFP_KERNEL); |
6989 |
++ if (id < 0) { |
6990 |
++ kfree(svc); |
6991 |
++ break; |
6992 |
++ } |
6993 |
++ svc->id = id; |
6994 |
+ svc->dev.bus = &tb_bus_type; |
6995 |
+ svc->dev.type = &tb_service_type; |
6996 |
+ svc->dev.parent = &xd->dev; |
6997 |
+diff --git a/drivers/tty/ipwireless/main.c b/drivers/tty/ipwireless/main.c |
6998 |
+index 3475e841ef5c..4c18bbfe1a92 100644 |
6999 |
+--- a/drivers/tty/ipwireless/main.c |
7000 |
++++ b/drivers/tty/ipwireless/main.c |
7001 |
+@@ -114,6 +114,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
7002 |
+ |
7003 |
+ ipw->common_memory = ioremap(p_dev->resource[2]->start, |
7004 |
+ resource_size(p_dev->resource[2])); |
7005 |
++ if (!ipw->common_memory) { |
7006 |
++ ret = -ENOMEM; |
7007 |
++ goto exit1; |
7008 |
++ } |
7009 |
+ if (!request_mem_region(p_dev->resource[2]->start, |
7010 |
+ resource_size(p_dev->resource[2]), |
7011 |
+ IPWIRELESS_PCCARD_NAME)) { |
7012 |
+@@ -134,6 +138,10 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
7013 |
+ |
7014 |
+ ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
7015 |
+ resource_size(p_dev->resource[3])); |
7016 |
++ if (!ipw->attr_memory) { |
7017 |
++ ret = -ENOMEM; |
7018 |
++ goto exit3; |
7019 |
++ } |
7020 |
+ if (!request_mem_region(p_dev->resource[3]->start, |
7021 |
+ resource_size(p_dev->resource[3]), |
7022 |
+ IPWIRELESS_PCCARD_NAME)) { |
7023 |
+diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c |
7024 |
+index 1c21955fe7c0..b82a7d787add 100644 |
7025 |
+--- a/drivers/usb/core/hcd.c |
7026 |
++++ b/drivers/usb/core/hcd.c |
7027 |
+@@ -3017,6 +3017,9 @@ usb_hcd_platform_shutdown(struct platform_device *dev) |
7028 |
+ { |
7029 |
+ struct usb_hcd *hcd = platform_get_drvdata(dev); |
7030 |
+ |
7031 |
++ /* No need for pm_runtime_put(), we're shutting down */ |
7032 |
++ pm_runtime_get_sync(&dev->dev); |
7033 |
++ |
7034 |
+ if (hcd->driver->shutdown) |
7035 |
+ hcd->driver->shutdown(hcd); |
7036 |
+ } |
7037 |
+diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c |
7038 |
+index bbcfa63d0233..eb24ec0e160d 100644 |
7039 |
+--- a/drivers/usb/core/hub.c |
7040 |
++++ b/drivers/usb/core/hub.c |
7041 |
+@@ -5823,7 +5823,10 @@ int usb_reset_device(struct usb_device *udev) |
7042 |
+ cintf->needs_binding = 1; |
7043 |
+ } |
7044 |
+ } |
7045 |
+- usb_unbind_and_rebind_marked_interfaces(udev); |
7046 |
++ |
7047 |
++ /* If the reset failed, hub_wq will unbind drivers later */ |
7048 |
++ if (ret == 0) |
7049 |
++ usb_unbind_and_rebind_marked_interfaces(udev); |
7050 |
+ } |
7051 |
+ |
7052 |
+ usb_autosuspend_device(udev); |
7053 |
+diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c |
7054 |
+index 220c0f9b89b0..03614ef64ca4 100644 |
7055 |
+--- a/drivers/usb/dwc2/gadget.c |
7056 |
++++ b/drivers/usb/dwc2/gadget.c |
7057 |
+@@ -675,13 +675,11 @@ static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep) |
7058 |
+ unsigned int maxsize; |
7059 |
+ |
7060 |
+ if (is_isoc) |
7061 |
+- maxsize = hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT : |
7062 |
+- DEV_DMA_ISOC_RX_NBYTES_LIMIT; |
7063 |
++ maxsize = (hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT : |
7064 |
++ DEV_DMA_ISOC_RX_NBYTES_LIMIT) * |
7065 |
++ MAX_DMA_DESC_NUM_HS_ISOC; |
7066 |
+ else |
7067 |
+- maxsize = DEV_DMA_NBYTES_LIMIT; |
7068 |
+- |
7069 |
+- /* Above size of one descriptor was chosen, multiple it */ |
7070 |
+- maxsize *= MAX_DMA_DESC_NUM_GENERIC; |
7071 |
++ maxsize = DEV_DMA_NBYTES_LIMIT * MAX_DMA_DESC_NUM_GENERIC; |
7072 |
+ |
7073 |
+ return maxsize; |
7074 |
+ } |
7075 |
+@@ -864,7 +862,7 @@ static int dwc2_gadget_fill_isoc_desc(struct dwc2_hsotg_ep *hs_ep, |
7076 |
+ |
7077 |
+ /* Update index of last configured entry in the chain */ |
7078 |
+ hs_ep->next_desc++; |
7079 |
+- if (hs_ep->next_desc >= MAX_DMA_DESC_NUM_GENERIC) |
7080 |
++ if (hs_ep->next_desc >= MAX_DMA_DESC_NUM_HS_ISOC) |
7081 |
+ hs_ep->next_desc = 0; |
7082 |
+ |
7083 |
+ return 0; |
7084 |
+@@ -896,7 +894,7 @@ static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep) |
7085 |
+ } |
7086 |
+ |
7087 |
+ /* Initialize descriptor chain by Host Busy status */ |
7088 |
+- for (i = 0; i < MAX_DMA_DESC_NUM_GENERIC; i++) { |
7089 |
++ for (i = 0; i < MAX_DMA_DESC_NUM_HS_ISOC; i++) { |
7090 |
+ desc = &hs_ep->desc_list[i]; |
7091 |
+ desc->status = 0; |
7092 |
+ desc->status |= (DEV_DMA_BUFF_STS_HBUSY |
7093 |
+@@ -2083,7 +2081,7 @@ static void dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep) |
7094 |
+ dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0); |
7095 |
+ |
7096 |
+ hs_ep->compl_desc++; |
7097 |
+- if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_GENERIC - 1)) |
7098 |
++ if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC - 1)) |
7099 |
+ hs_ep->compl_desc = 0; |
7100 |
+ desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status; |
7101 |
+ } |
7102 |
+@@ -3779,6 +3777,7 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, |
7103 |
+ unsigned int i, val, size; |
7104 |
+ int ret = 0; |
7105 |
+ unsigned char ep_type; |
7106 |
++ int desc_num; |
7107 |
+ |
7108 |
+ dev_dbg(hsotg->dev, |
7109 |
+ "%s: ep %s: a 0x%02x, attr 0x%02x, mps 0x%04x, intr %d\n", |
7110 |
+@@ -3825,11 +3824,15 @@ static int dwc2_hsotg_ep_enable(struct usb_ep *ep, |
7111 |
+ dev_dbg(hsotg->dev, "%s: read DxEPCTL=0x%08x from 0x%08x\n", |
7112 |
+ __func__, epctrl, epctrl_reg); |
7113 |
+ |
7114 |
++ if (using_desc_dma(hsotg) && ep_type == USB_ENDPOINT_XFER_ISOC) |
7115 |
++ desc_num = MAX_DMA_DESC_NUM_HS_ISOC; |
7116 |
++ else |
7117 |
++ desc_num = MAX_DMA_DESC_NUM_GENERIC; |
7118 |
++ |
7119 |
+ /* Allocate DMA descriptor chain for non-ctrl endpoints */ |
7120 |
+ if (using_desc_dma(hsotg) && !hs_ep->desc_list) { |
7121 |
+ hs_ep->desc_list = dmam_alloc_coherent(hsotg->dev, |
7122 |
+- MAX_DMA_DESC_NUM_GENERIC * |
7123 |
+- sizeof(struct dwc2_dma_desc), |
7124 |
++ desc_num * sizeof(struct dwc2_dma_desc), |
7125 |
+ &hs_ep->desc_list_dma, GFP_ATOMIC); |
7126 |
+ if (!hs_ep->desc_list) { |
7127 |
+ ret = -ENOMEM; |
7128 |
+@@ -3971,7 +3974,7 @@ error1: |
7129 |
+ |
7130 |
+ error2: |
7131 |
+ if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) { |
7132 |
+- dmam_free_coherent(hsotg->dev, MAX_DMA_DESC_NUM_GENERIC * |
7133 |
++ dmam_free_coherent(hsotg->dev, desc_num * |
7134 |
+ sizeof(struct dwc2_dma_desc), |
7135 |
+ hs_ep->desc_list, hs_ep->desc_list_dma); |
7136 |
+ hs_ep->desc_list = NULL; |
7137 |
+diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c |
7138 |
+index 4d5c7dda8f54..05b9ccff7447 100644 |
7139 |
+--- a/drivers/usb/dwc3/core.c |
7140 |
++++ b/drivers/usb/dwc3/core.c |
7141 |
+@@ -1591,6 +1591,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) |
7142 |
+ spin_lock_irqsave(&dwc->lock, flags); |
7143 |
+ dwc3_gadget_suspend(dwc); |
7144 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
7145 |
++ synchronize_irq(dwc->irq_gadget); |
7146 |
+ dwc3_core_exit(dwc); |
7147 |
+ break; |
7148 |
+ case DWC3_GCTL_PRTCAP_HOST: |
7149 |
+@@ -1623,6 +1624,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) |
7150 |
+ spin_lock_irqsave(&dwc->lock, flags); |
7151 |
+ dwc3_gadget_suspend(dwc); |
7152 |
+ spin_unlock_irqrestore(&dwc->lock, flags); |
7153 |
++ synchronize_irq(dwc->irq_gadget); |
7154 |
+ } |
7155 |
+ |
7156 |
+ dwc3_otg_exit(dwc); |
7157 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
7158 |
+index 524104eed8a7..65ba1038b111 100644 |
7159 |
+--- a/drivers/usb/dwc3/gadget.c |
7160 |
++++ b/drivers/usb/dwc3/gadget.c |
7161 |
+@@ -3277,8 +3277,6 @@ int dwc3_gadget_suspend(struct dwc3 *dwc) |
7162 |
+ dwc3_disconnect_gadget(dwc); |
7163 |
+ __dwc3_gadget_stop(dwc); |
7164 |
+ |
7165 |
+- synchronize_irq(dwc->irq_gadget); |
7166 |
+- |
7167 |
+ return 0; |
7168 |
+ } |
7169 |
+ |
7170 |
+diff --git a/drivers/video/fbdev/core/fbcmap.c b/drivers/video/fbdev/core/fbcmap.c |
7171 |
+index 68a113594808..2811c4afde01 100644 |
7172 |
+--- a/drivers/video/fbdev/core/fbcmap.c |
7173 |
++++ b/drivers/video/fbdev/core/fbcmap.c |
7174 |
+@@ -94,6 +94,8 @@ int fb_alloc_cmap_gfp(struct fb_cmap *cmap, int len, int transp, gfp_t flags) |
7175 |
+ int size = len * sizeof(u16); |
7176 |
+ int ret = -ENOMEM; |
7177 |
+ |
7178 |
++ flags |= __GFP_NOWARN; |
7179 |
++ |
7180 |
+ if (cmap->len != len) { |
7181 |
+ fb_dealloc_cmap(cmap); |
7182 |
+ if (!len) |
7183 |
+diff --git a/drivers/video/fbdev/core/modedb.c b/drivers/video/fbdev/core/modedb.c |
7184 |
+index 283d9307df21..ac049871704d 100644 |
7185 |
+--- a/drivers/video/fbdev/core/modedb.c |
7186 |
++++ b/drivers/video/fbdev/core/modedb.c |
7187 |
+@@ -935,6 +935,9 @@ void fb_var_to_videomode(struct fb_videomode *mode, |
7188 |
+ if (var->vmode & FB_VMODE_DOUBLE) |
7189 |
+ vtotal *= 2; |
7190 |
+ |
7191 |
++ if (!htotal || !vtotal) |
7192 |
++ return; |
7193 |
++ |
7194 |
+ hfreq = pixclock/htotal; |
7195 |
+ mode->refresh = hfreq/vtotal; |
7196 |
+ } |
7197 |
+diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c |
7198 |
+index fd02e8a4841d..9f39f0c360e0 100644 |
7199 |
+--- a/drivers/video/fbdev/efifb.c |
7200 |
++++ b/drivers/video/fbdev/efifb.c |
7201 |
+@@ -464,7 +464,8 @@ static int efifb_probe(struct platform_device *dev) |
7202 |
+ info->apertures->ranges[0].base = efifb_fix.smem_start; |
7203 |
+ info->apertures->ranges[0].size = size_remap; |
7204 |
+ |
7205 |
+- if (!efi_mem_desc_lookup(efifb_fix.smem_start, &md)) { |
7206 |
++ if (efi_enabled(EFI_BOOT) && |
7207 |
++ !efi_mem_desc_lookup(efifb_fix.smem_start, &md)) { |
7208 |
+ if ((efifb_fix.smem_start + efifb_fix.smem_len) > |
7209 |
+ (md.phys_addr + (md.num_pages << EFI_PAGE_SHIFT))) { |
7210 |
+ pr_err("efifb: video memory @ 0x%lx spans multiple EFI memory regions\n", |
7211 |
+diff --git a/drivers/video/fbdev/udlfb.c b/drivers/video/fbdev/udlfb.c |
7212 |
+index 2001910fd241..5a0d6fb02bbc 100644 |
7213 |
+--- a/drivers/video/fbdev/udlfb.c |
7214 |
++++ b/drivers/video/fbdev/udlfb.c |
7215 |
+@@ -1659,7 +1659,7 @@ static int dlfb_usb_probe(struct usb_interface *intf, |
7216 |
+ dlfb = kzalloc(sizeof(*dlfb), GFP_KERNEL); |
7217 |
+ if (!dlfb) { |
7218 |
+ dev_err(&intf->dev, "%s: failed to allocate dlfb\n", __func__); |
7219 |
+- goto error; |
7220 |
++ return -ENOMEM; |
7221 |
+ } |
7222 |
+ |
7223 |
+ INIT_LIST_HEAD(&dlfb->deferred_free); |
7224 |
+@@ -1769,7 +1769,7 @@ static int dlfb_usb_probe(struct usb_interface *intf, |
7225 |
+ error: |
7226 |
+ if (dlfb->info) { |
7227 |
+ dlfb_ops_destroy(dlfb->info); |
7228 |
+- } else if (dlfb) { |
7229 |
++ } else { |
7230 |
+ usb_put_dev(dlfb->udev); |
7231 |
+ kfree(dlfb); |
7232 |
+ } |
7233 |
+@@ -1796,12 +1796,10 @@ static void dlfb_usb_disconnect(struct usb_interface *intf) |
7234 |
+ /* this function will wait for all in-flight urbs to complete */ |
7235 |
+ dlfb_free_urb_list(dlfb); |
7236 |
+ |
7237 |
+- if (info) { |
7238 |
+- /* remove udlfb's sysfs interfaces */ |
7239 |
+- for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) |
7240 |
+- device_remove_file(info->dev, &fb_device_attrs[i]); |
7241 |
+- device_remove_bin_file(info->dev, &edid_attr); |
7242 |
+- } |
7243 |
++ /* remove udlfb's sysfs interfaces */ |
7244 |
++ for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) |
7245 |
++ device_remove_file(info->dev, &fb_device_attrs[i]); |
7246 |
++ device_remove_bin_file(info->dev, &edid_attr); |
7247 |
+ |
7248 |
+ unregister_framebuffer(info); |
7249 |
+ } |
7250 |
+diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c |
7251 |
+index 0364d3329c52..3516ce6718d9 100644 |
7252 |
+--- a/drivers/w1/w1_io.c |
7253 |
++++ b/drivers/w1/w1_io.c |
7254 |
+@@ -432,8 +432,7 @@ int w1_reset_resume_command(struct w1_master *dev) |
7255 |
+ if (w1_reset_bus(dev)) |
7256 |
+ return -1; |
7257 |
+ |
7258 |
+- /* This will make only the last matched slave perform a skip ROM. */ |
7259 |
+- w1_write_8(dev, W1_RESUME_CMD); |
7260 |
++ w1_write_8(dev, dev->slave_count > 1 ? W1_RESUME_CMD : W1_SKIP_ROM); |
7261 |
+ return 0; |
7262 |
+ } |
7263 |
+ EXPORT_SYMBOL_GPL(w1_reset_resume_command); |
7264 |
+diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c |
7265 |
+index 2a4f52c7be22..ac6c383d6314 100644 |
7266 |
+--- a/fs/btrfs/backref.c |
7267 |
++++ b/fs/btrfs/backref.c |
7268 |
+@@ -710,7 +710,7 @@ out: |
7269 |
+ * read tree blocks and add keys where required. |
7270 |
+ */ |
7271 |
+ static int add_missing_keys(struct btrfs_fs_info *fs_info, |
7272 |
+- struct preftrees *preftrees) |
7273 |
++ struct preftrees *preftrees, bool lock) |
7274 |
+ { |
7275 |
+ struct prelim_ref *ref; |
7276 |
+ struct extent_buffer *eb; |
7277 |
+@@ -735,12 +735,14 @@ static int add_missing_keys(struct btrfs_fs_info *fs_info, |
7278 |
+ free_extent_buffer(eb); |
7279 |
+ return -EIO; |
7280 |
+ } |
7281 |
+- btrfs_tree_read_lock(eb); |
7282 |
++ if (lock) |
7283 |
++ btrfs_tree_read_lock(eb); |
7284 |
+ if (btrfs_header_level(eb) == 0) |
7285 |
+ btrfs_item_key_to_cpu(eb, &ref->key_for_search, 0); |
7286 |
+ else |
7287 |
+ btrfs_node_key_to_cpu(eb, &ref->key_for_search, 0); |
7288 |
+- btrfs_tree_read_unlock(eb); |
7289 |
++ if (lock) |
7290 |
++ btrfs_tree_read_unlock(eb); |
7291 |
+ free_extent_buffer(eb); |
7292 |
+ prelim_ref_insert(fs_info, &preftrees->indirect, ref, NULL); |
7293 |
+ cond_resched(); |
7294 |
+@@ -1225,7 +1227,7 @@ again: |
7295 |
+ |
7296 |
+ btrfs_release_path(path); |
7297 |
+ |
7298 |
+- ret = add_missing_keys(fs_info, &preftrees); |
7299 |
++ ret = add_missing_keys(fs_info, &preftrees, path->skip_locking == 0); |
7300 |
+ if (ret) |
7301 |
+ goto out; |
7302 |
+ |
7303 |
+@@ -1286,11 +1288,14 @@ again: |
7304 |
+ ret = -EIO; |
7305 |
+ goto out; |
7306 |
+ } |
7307 |
+- btrfs_tree_read_lock(eb); |
7308 |
+- btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
7309 |
++ if (!path->skip_locking) { |
7310 |
++ btrfs_tree_read_lock(eb); |
7311 |
++ btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); |
7312 |
++ } |
7313 |
+ ret = find_extent_in_eb(eb, bytenr, |
7314 |
+ *extent_item_pos, &eie, ignore_offset); |
7315 |
+- btrfs_tree_read_unlock_blocking(eb); |
7316 |
++ if (!path->skip_locking) |
7317 |
++ btrfs_tree_read_unlock_blocking(eb); |
7318 |
+ free_extent_buffer(eb); |
7319 |
+ if (ret < 0) |
7320 |
+ goto out; |
7321 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
7322 |
+index 809c2c307c64..0cc800d22a08 100644 |
7323 |
+--- a/fs/btrfs/extent-tree.c |
7324 |
++++ b/fs/btrfs/extent-tree.c |
7325 |
+@@ -3911,8 +3911,7 @@ static int create_space_info(struct btrfs_fs_info *info, u64 flags) |
7326 |
+ info->space_info_kobj, "%s", |
7327 |
+ alloc_name(space_info->flags)); |
7328 |
+ if (ret) { |
7329 |
+- percpu_counter_destroy(&space_info->total_bytes_pinned); |
7330 |
+- kfree(space_info); |
7331 |
++ kobject_put(&space_info->kobj); |
7332 |
+ return ret; |
7333 |
+ } |
7334 |
+ |
7335 |
+@@ -10789,9 +10788,9 @@ int btrfs_error_unpin_extent_range(struct btrfs_fs_info *fs_info, |
7336 |
+ * held back allocations. |
7337 |
+ */ |
7338 |
+ static int btrfs_trim_free_extents(struct btrfs_device *device, |
7339 |
+- struct fstrim_range *range, u64 *trimmed) |
7340 |
++ u64 minlen, u64 *trimmed) |
7341 |
+ { |
7342 |
+- u64 start = range->start, len = 0; |
7343 |
++ u64 start = 0, len = 0; |
7344 |
+ int ret; |
7345 |
+ |
7346 |
+ *trimmed = 0; |
7347 |
+@@ -10834,8 +10833,8 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
7348 |
+ if (!trans) |
7349 |
+ up_read(&fs_info->commit_root_sem); |
7350 |
+ |
7351 |
+- ret = find_free_dev_extent_start(trans, device, range->minlen, |
7352 |
+- start, &start, &len); |
7353 |
++ ret = find_free_dev_extent_start(trans, device, minlen, start, |
7354 |
++ &start, &len); |
7355 |
+ if (trans) { |
7356 |
+ up_read(&fs_info->commit_root_sem); |
7357 |
+ btrfs_put_transaction(trans); |
7358 |
+@@ -10848,16 +10847,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
7359 |
+ break; |
7360 |
+ } |
7361 |
+ |
7362 |
+- /* If we are out of the passed range break */ |
7363 |
+- if (start > range->start + range->len - 1) { |
7364 |
+- mutex_unlock(&fs_info->chunk_mutex); |
7365 |
+- ret = 0; |
7366 |
+- break; |
7367 |
+- } |
7368 |
+- |
7369 |
+- start = max(range->start, start); |
7370 |
+- len = min(range->len, len); |
7371 |
+- |
7372 |
+ ret = btrfs_issue_discard(device->bdev, start, len, &bytes); |
7373 |
+ mutex_unlock(&fs_info->chunk_mutex); |
7374 |
+ |
7375 |
+@@ -10867,10 +10856,6 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, |
7376 |
+ start += len; |
7377 |
+ *trimmed += bytes; |
7378 |
+ |
7379 |
+- /* We've trimmed enough */ |
7380 |
+- if (*trimmed >= range->len) |
7381 |
+- break; |
7382 |
+- |
7383 |
+ if (fatal_signal_pending(current)) { |
7384 |
+ ret = -ERESTARTSYS; |
7385 |
+ break; |
7386 |
+@@ -10954,7 +10939,8 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range) |
7387 |
+ mutex_lock(&fs_info->fs_devices->device_list_mutex); |
7388 |
+ devices = &fs_info->fs_devices->devices; |
7389 |
+ list_for_each_entry(device, devices, dev_list) { |
7390 |
+- ret = btrfs_trim_free_extents(device, range, &group_trimmed); |
7391 |
++ ret = btrfs_trim_free_extents(device, range->minlen, |
7392 |
++ &group_trimmed); |
7393 |
+ if (ret) { |
7394 |
+ dev_failed++; |
7395 |
+ dev_ret = ret; |
7396 |
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c |
7397 |
+index ca4902c66dc4..e24c0a69ff5d 100644 |
7398 |
+--- a/fs/btrfs/file.c |
7399 |
++++ b/fs/btrfs/file.c |
7400 |
+@@ -2058,6 +2058,18 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) |
7401 |
+ int ret = 0, err; |
7402 |
+ u64 len; |
7403 |
+ |
7404 |
++ /* |
7405 |
++ * If the inode needs a full sync, make sure we use a full range to |
7406 |
++ * avoid log tree corruption, due to hole detection racing with ordered |
7407 |
++ * extent completion for adjacent ranges, and assertion failures during |
7408 |
++ * hole detection. |
7409 |
++ */ |
7410 |
++ if (test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
7411 |
++ &BTRFS_I(inode)->runtime_flags)) { |
7412 |
++ start = 0; |
7413 |
++ end = LLONG_MAX; |
7414 |
++ } |
7415 |
++ |
7416 |
+ /* |
7417 |
+ * The range length can be represented by u64, we have to do the typecasts |
7418 |
+ * to avoid signed overflow if it's [0, LLONG_MAX] eg. from fsync() |
7419 |
+@@ -2565,10 +2577,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) |
7420 |
+ |
7421 |
+ ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend, |
7422 |
+ &cached_state); |
7423 |
+- if (ret) { |
7424 |
+- inode_unlock(inode); |
7425 |
++ if (ret) |
7426 |
+ goto out_only_mutex; |
7427 |
+- } |
7428 |
+ |
7429 |
+ path = btrfs_alloc_path(); |
7430 |
+ if (!path) { |
7431 |
+@@ -3151,6 +3161,7 @@ static long btrfs_fallocate(struct file *file, int mode, |
7432 |
+ ret = btrfs_qgroup_reserve_data(inode, &data_reserved, |
7433 |
+ cur_offset, last_byte - cur_offset); |
7434 |
+ if (ret < 0) { |
7435 |
++ cur_offset = last_byte; |
7436 |
+ free_extent_map(em); |
7437 |
+ break; |
7438 |
+ } |
7439 |
+@@ -3200,7 +3211,7 @@ out: |
7440 |
+ /* Let go of our reservation. */ |
7441 |
+ if (ret != 0 && !(mode & FALLOC_FL_ZERO_RANGE)) |
7442 |
+ btrfs_free_reserved_data_space(inode, data_reserved, |
7443 |
+- alloc_start, alloc_end - cur_offset); |
7444 |
++ cur_offset, alloc_end - cur_offset); |
7445 |
+ extent_changeset_free(data_reserved); |
7446 |
+ return ret; |
7447 |
+ } |
7448 |
+diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c |
7449 |
+index 0526b6c473c7..5d57ed629345 100644 |
7450 |
+--- a/fs/btrfs/relocation.c |
7451 |
++++ b/fs/btrfs/relocation.c |
7452 |
+@@ -4289,27 +4289,36 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) |
7453 |
+ mutex_lock(&fs_info->cleaner_mutex); |
7454 |
+ ret = relocate_block_group(rc); |
7455 |
+ mutex_unlock(&fs_info->cleaner_mutex); |
7456 |
+- if (ret < 0) { |
7457 |
++ if (ret < 0) |
7458 |
+ err = ret; |
7459 |
+- goto out; |
7460 |
+- } |
7461 |
+- |
7462 |
+- if (rc->extents_found == 0) |
7463 |
+- break; |
7464 |
+- |
7465 |
+- btrfs_info(fs_info, "found %llu extents", rc->extents_found); |
7466 |
+ |
7467 |
++ /* |
7468 |
++ * We may have gotten ENOSPC after we already dirtied some |
7469 |
++ * extents. If writeout happens while we're relocating a |
7470 |
++ * different block group we could end up hitting the |
7471 |
++ * BUG_ON(rc->stage == UPDATE_DATA_PTRS) in |
7472 |
++ * btrfs_reloc_cow_block. Make sure we write everything out |
7473 |
++ * properly so we don't trip over this problem, and then break |
7474 |
++ * out of the loop if we hit an error. |
7475 |
++ */ |
7476 |
+ if (rc->stage == MOVE_DATA_EXTENTS && rc->found_file_extent) { |
7477 |
+ ret = btrfs_wait_ordered_range(rc->data_inode, 0, |
7478 |
+ (u64)-1); |
7479 |
+- if (ret) { |
7480 |
++ if (ret) |
7481 |
+ err = ret; |
7482 |
+- goto out; |
7483 |
+- } |
7484 |
+ invalidate_mapping_pages(rc->data_inode->i_mapping, |
7485 |
+ 0, -1); |
7486 |
+ rc->stage = UPDATE_DATA_PTRS; |
7487 |
+ } |
7488 |
++ |
7489 |
++ if (err < 0) |
7490 |
++ goto out; |
7491 |
++ |
7492 |
++ if (rc->extents_found == 0) |
7493 |
++ break; |
7494 |
++ |
7495 |
++ btrfs_info(fs_info, "found %llu extents", rc->extents_found); |
7496 |
++ |
7497 |
+ } |
7498 |
+ |
7499 |
+ WARN_ON(rc->block_group->pinned > 0); |
7500 |
+diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c |
7501 |
+index 65bda0682928..3228d3b3084a 100644 |
7502 |
+--- a/fs/btrfs/root-tree.c |
7503 |
++++ b/fs/btrfs/root-tree.c |
7504 |
+@@ -132,16 +132,17 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root |
7505 |
+ return -ENOMEM; |
7506 |
+ |
7507 |
+ ret = btrfs_search_slot(trans, root, key, path, 0, 1); |
7508 |
+- if (ret < 0) { |
7509 |
+- btrfs_abort_transaction(trans, ret); |
7510 |
++ if (ret < 0) |
7511 |
+ goto out; |
7512 |
+- } |
7513 |
+ |
7514 |
+- if (ret != 0) { |
7515 |
+- btrfs_print_leaf(path->nodes[0]); |
7516 |
+- btrfs_crit(fs_info, "unable to update root key %llu %u %llu", |
7517 |
+- key->objectid, key->type, key->offset); |
7518 |
+- BUG_ON(1); |
7519 |
++ if (ret > 0) { |
7520 |
++ btrfs_crit(fs_info, |
7521 |
++ "unable to find root key (%llu %u %llu) in tree %llu", |
7522 |
++ key->objectid, key->type, key->offset, |
7523 |
++ root->root_key.objectid); |
7524 |
++ ret = -EUCLEAN; |
7525 |
++ btrfs_abort_transaction(trans, ret); |
7526 |
++ goto out; |
7527 |
+ } |
7528 |
+ |
7529 |
+ l = path->nodes[0]; |
7530 |
+diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c |
7531 |
+index 3717c864ba23..aefb0169d46d 100644 |
7532 |
+--- a/fs/btrfs/sysfs.c |
7533 |
++++ b/fs/btrfs/sysfs.c |
7534 |
+@@ -811,7 +811,12 @@ int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs, |
7535 |
+ fs_devs->fsid_kobj.kset = btrfs_kset; |
7536 |
+ error = kobject_init_and_add(&fs_devs->fsid_kobj, |
7537 |
+ &btrfs_ktype, parent, "%pU", fs_devs->fsid); |
7538 |
+- return error; |
7539 |
++ if (error) { |
7540 |
++ kobject_put(&fs_devs->fsid_kobj); |
7541 |
++ return error; |
7542 |
++ } |
7543 |
++ |
7544 |
++ return 0; |
7545 |
+ } |
7546 |
+ |
7547 |
+ int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info) |
7548 |
+diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c |
7549 |
+index 2f4f0958e5f2..75051d36dc1a 100644 |
7550 |
+--- a/fs/btrfs/tree-log.c |
7551 |
++++ b/fs/btrfs/tree-log.c |
7552 |
+@@ -4121,6 +4121,7 @@ fill_holes: |
7553 |
+ *last_extent, 0, |
7554 |
+ 0, len, 0, len, |
7555 |
+ 0, 0, 0); |
7556 |
++ *last_extent += len; |
7557 |
+ } |
7558 |
+ } |
7559 |
+ } |
7560 |
+diff --git a/fs/char_dev.c b/fs/char_dev.c |
7561 |
+index a279c58fe360..8a63cfa29005 100644 |
7562 |
+--- a/fs/char_dev.c |
7563 |
++++ b/fs/char_dev.c |
7564 |
+@@ -159,6 +159,12 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, |
7565 |
+ ret = -EBUSY; |
7566 |
+ goto out; |
7567 |
+ } |
7568 |
++ |
7569 |
++ if (new_min < old_min && new_max > old_max) { |
7570 |
++ ret = -EBUSY; |
7571 |
++ goto out; |
7572 |
++ } |
7573 |
++ |
7574 |
+ } |
7575 |
+ |
7576 |
+ cd->next = *cp; |
7577 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
7578 |
+index 67e8aa35197e..05dc5a4ba481 100644 |
7579 |
+--- a/fs/ext4/inode.c |
7580 |
++++ b/fs/ext4/inode.c |
7581 |
+@@ -5596,25 +5596,22 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr) |
7582 |
+ up_write(&EXT4_I(inode)->i_data_sem); |
7583 |
+ ext4_journal_stop(handle); |
7584 |
+ if (error) { |
7585 |
+- if (orphan) |
7586 |
++ if (orphan && inode->i_nlink) |
7587 |
+ ext4_orphan_del(NULL, inode); |
7588 |
+ goto err_out; |
7589 |
+ } |
7590 |
+ } |
7591 |
+- if (!shrink) |
7592 |
++ if (!shrink) { |
7593 |
+ pagecache_isize_extended(inode, oldsize, inode->i_size); |
7594 |
+- |
7595 |
+- /* |
7596 |
+- * Blocks are going to be removed from the inode. Wait |
7597 |
+- * for dio in flight. Temporarily disable |
7598 |
+- * dioread_nolock to prevent livelock. |
7599 |
+- */ |
7600 |
+- if (orphan) { |
7601 |
+- if (!ext4_should_journal_data(inode)) { |
7602 |
+- inode_dio_wait(inode); |
7603 |
+- } else |
7604 |
+- ext4_wait_for_tail_page_commit(inode); |
7605 |
++ } else { |
7606 |
++ /* |
7607 |
++ * Blocks are going to be removed from the inode. Wait |
7608 |
++ * for dio in flight. |
7609 |
++ */ |
7610 |
++ inode_dio_wait(inode); |
7611 |
+ } |
7612 |
++ if (orphan && ext4_should_journal_data(inode)) |
7613 |
++ ext4_wait_for_tail_page_commit(inode); |
7614 |
+ down_write(&EXT4_I(inode)->i_mmap_sem); |
7615 |
+ |
7616 |
+ rc = ext4_break_layouts(inode); |
7617 |
+diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c |
7618 |
+index 08314fb42652..4d02e76b648a 100644 |
7619 |
+--- a/fs/f2fs/data.c |
7620 |
++++ b/fs/f2fs/data.c |
7621 |
+@@ -197,12 +197,14 @@ struct block_device *f2fs_target_device(struct f2fs_sb_info *sbi, |
7622 |
+ struct block_device *bdev = sbi->sb->s_bdev; |
7623 |
+ int i; |
7624 |
+ |
7625 |
+- for (i = 0; i < sbi->s_ndevs; i++) { |
7626 |
+- if (FDEV(i).start_blk <= blk_addr && |
7627 |
+- FDEV(i).end_blk >= blk_addr) { |
7628 |
+- blk_addr -= FDEV(i).start_blk; |
7629 |
+- bdev = FDEV(i).bdev; |
7630 |
+- break; |
7631 |
++ if (f2fs_is_multi_device(sbi)) { |
7632 |
++ for (i = 0; i < sbi->s_ndevs; i++) { |
7633 |
++ if (FDEV(i).start_blk <= blk_addr && |
7634 |
++ FDEV(i).end_blk >= blk_addr) { |
7635 |
++ blk_addr -= FDEV(i).start_blk; |
7636 |
++ bdev = FDEV(i).bdev; |
7637 |
++ break; |
7638 |
++ } |
7639 |
+ } |
7640 |
+ } |
7641 |
+ if (bio) { |
7642 |
+@@ -216,6 +218,9 @@ int f2fs_target_device_index(struct f2fs_sb_info *sbi, block_t blkaddr) |
7643 |
+ { |
7644 |
+ int i; |
7645 |
+ |
7646 |
++ if (!f2fs_is_multi_device(sbi)) |
7647 |
++ return 0; |
7648 |
++ |
7649 |
+ for (i = 0; i < sbi->s_ndevs; i++) |
7650 |
+ if (FDEV(i).start_blk <= blkaddr && FDEV(i).end_blk >= blkaddr) |
7651 |
+ return i; |
7652 |
+diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h |
7653 |
+index 1f5d5f62bb77..a4b6eacf22ea 100644 |
7654 |
+--- a/fs/f2fs/f2fs.h |
7655 |
++++ b/fs/f2fs/f2fs.h |
7656 |
+@@ -1336,6 +1336,17 @@ static inline bool time_to_inject(struct f2fs_sb_info *sbi, int type) |
7657 |
+ } |
7658 |
+ #endif |
7659 |
+ |
7660 |
++/* |
7661 |
++ * Test if the mounted volume is a multi-device volume. |
7662 |
++ * - For a single regular disk volume, sbi->s_ndevs is 0. |
7663 |
++ * - For a single zoned disk volume, sbi->s_ndevs is 1. |
7664 |
++ * - For a multi-device volume, sbi->s_ndevs is always 2 or more. |
7665 |
++ */ |
7666 |
++static inline bool f2fs_is_multi_device(struct f2fs_sb_info *sbi) |
7667 |
++{ |
7668 |
++ return sbi->s_ndevs > 1; |
7669 |
++} |
7670 |
++ |
7671 |
+ /* For write statistics. Suppose sector size is 512 bytes, |
7672 |
+ * and the return value is in kbytes. s is of struct f2fs_sb_info. |
7673 |
+ */ |
7674 |
+@@ -3455,7 +3466,7 @@ static inline bool f2fs_force_buffered_io(struct inode *inode, int rw) |
7675 |
+ { |
7676 |
+ return (f2fs_post_read_required(inode) || |
7677 |
+ (rw == WRITE && test_opt(F2FS_I_SB(inode), LFS)) || |
7678 |
+- F2FS_I_SB(inode)->s_ndevs); |
7679 |
++ f2fs_is_multi_device(F2FS_I_SB(inode))); |
7680 |
+ } |
7681 |
+ |
7682 |
+ #ifdef CONFIG_F2FS_FAULT_INJECTION |
7683 |
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c |
7684 |
+index b3f46e3bec17..8d1eb8dec605 100644 |
7685 |
+--- a/fs/f2fs/file.c |
7686 |
++++ b/fs/f2fs/file.c |
7687 |
+@@ -2539,7 +2539,7 @@ static int f2fs_ioc_flush_device(struct file *filp, unsigned long arg) |
7688 |
+ sizeof(range))) |
7689 |
+ return -EFAULT; |
7690 |
+ |
7691 |
+- if (sbi->s_ndevs <= 1 || sbi->s_ndevs - 1 <= range.dev_num || |
7692 |
++ if (!f2fs_is_multi_device(sbi) || sbi->s_ndevs - 1 <= range.dev_num || |
7693 |
+ sbi->segs_per_sec != 1) { |
7694 |
+ f2fs_msg(sbi->sb, KERN_WARNING, |
7695 |
+ "Can't flush %u in %d for segs_per_sec %u != 1\n", |
7696 |
+diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c |
7697 |
+index 5c8d00422237..d44b57a363ff 100644 |
7698 |
+--- a/fs/f2fs/gc.c |
7699 |
++++ b/fs/f2fs/gc.c |
7700 |
+@@ -1256,7 +1256,7 @@ void f2fs_build_gc_manager(struct f2fs_sb_info *sbi) |
7701 |
+ sbi->gc_pin_file_threshold = DEF_GC_FAILED_PINNED_FILES; |
7702 |
+ |
7703 |
+ /* give warm/cold data area from slower device */ |
7704 |
+- if (sbi->s_ndevs && sbi->segs_per_sec == 1) |
7705 |
++ if (f2fs_is_multi_device(sbi) && sbi->segs_per_sec == 1) |
7706 |
+ SIT_I(sbi)->last_victim[ALLOC_NEXT] = |
7707 |
+ GET_SEGNO(sbi, FDEV(0).end_blk) + 1; |
7708 |
+ } |
7709 |
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c |
7710 |
+index ac038563273d..03fa2c4d3d79 100644 |
7711 |
+--- a/fs/f2fs/segment.c |
7712 |
++++ b/fs/f2fs/segment.c |
7713 |
+@@ -574,7 +574,7 @@ static int submit_flush_wait(struct f2fs_sb_info *sbi, nid_t ino) |
7714 |
+ int ret = 0; |
7715 |
+ int i; |
7716 |
+ |
7717 |
+- if (!sbi->s_ndevs) |
7718 |
++ if (!f2fs_is_multi_device(sbi)) |
7719 |
+ return __submit_flush_wait(sbi, sbi->sb->s_bdev); |
7720 |
+ |
7721 |
+ for (i = 0; i < sbi->s_ndevs; i++) { |
7722 |
+@@ -640,7 +640,8 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi, nid_t ino) |
7723 |
+ return ret; |
7724 |
+ } |
7725 |
+ |
7726 |
+- if (atomic_inc_return(&fcc->issing_flush) == 1 || sbi->s_ndevs > 1) { |
7727 |
++ if (atomic_inc_return(&fcc->issing_flush) == 1 || |
7728 |
++ f2fs_is_multi_device(sbi)) { |
7729 |
+ ret = submit_flush_wait(sbi, ino); |
7730 |
+ atomic_dec(&fcc->issing_flush); |
7731 |
+ |
7732 |
+@@ -746,7 +747,7 @@ int f2fs_flush_device_cache(struct f2fs_sb_info *sbi) |
7733 |
+ { |
7734 |
+ int ret = 0, i; |
7735 |
+ |
7736 |
+- if (!sbi->s_ndevs) |
7737 |
++ if (!f2fs_is_multi_device(sbi)) |
7738 |
+ return 0; |
7739 |
+ |
7740 |
+ for (i = 1; i < sbi->s_ndevs; i++) { |
7741 |
+@@ -1289,7 +1290,7 @@ static int __queue_discard_cmd(struct f2fs_sb_info *sbi, |
7742 |
+ |
7743 |
+ trace_f2fs_queue_discard(bdev, blkstart, blklen); |
7744 |
+ |
7745 |
+- if (sbi->s_ndevs) { |
7746 |
++ if (f2fs_is_multi_device(sbi)) { |
7747 |
+ int devi = f2fs_target_device_index(sbi, blkstart); |
7748 |
+ |
7749 |
+ blkstart -= FDEV(devi).start_blk; |
7750 |
+@@ -1638,7 +1639,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, |
7751 |
+ block_t lblkstart = blkstart; |
7752 |
+ int devi = 0; |
7753 |
+ |
7754 |
+- if (sbi->s_ndevs) { |
7755 |
++ if (f2fs_is_multi_device(sbi)) { |
7756 |
+ devi = f2fs_target_device_index(sbi, blkstart); |
7757 |
+ blkstart -= FDEV(devi).start_blk; |
7758 |
+ } |
7759 |
+@@ -2971,7 +2972,7 @@ static void update_device_state(struct f2fs_io_info *fio) |
7760 |
+ struct f2fs_sb_info *sbi = fio->sbi; |
7761 |
+ unsigned int devidx; |
7762 |
+ |
7763 |
+- if (!sbi->s_ndevs) |
7764 |
++ if (!f2fs_is_multi_device(sbi)) |
7765 |
+ return; |
7766 |
+ |
7767 |
+ devidx = f2fs_target_device_index(sbi, fio->new_blkaddr); |
7768 |
+diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c |
7769 |
+index 9d566e62684c..ccdd8c821abd 100644 |
7770 |
+--- a/fs/gfs2/glock.c |
7771 |
++++ b/fs/gfs2/glock.c |
7772 |
+@@ -140,6 +140,7 @@ void gfs2_glock_free(struct gfs2_glock *gl) |
7773 |
+ { |
7774 |
+ struct gfs2_sbd *sdp = gl->gl_name.ln_sbd; |
7775 |
+ |
7776 |
++ BUG_ON(atomic_read(&gl->gl_revokes)); |
7777 |
+ rhashtable_remove_fast(&gl_hash_table, &gl->gl_node, ht_parms); |
7778 |
+ smp_mb(); |
7779 |
+ wake_up_glock(gl); |
7780 |
+@@ -183,15 +184,19 @@ static int demote_ok(const struct gfs2_glock *gl) |
7781 |
+ |
7782 |
+ void gfs2_glock_add_to_lru(struct gfs2_glock *gl) |
7783 |
+ { |
7784 |
++ if (!(gl->gl_ops->go_flags & GLOF_LRU)) |
7785 |
++ return; |
7786 |
++ |
7787 |
+ spin_lock(&lru_lock); |
7788 |
+ |
7789 |
+- if (!list_empty(&gl->gl_lru)) |
7790 |
+- list_del_init(&gl->gl_lru); |
7791 |
+- else |
7792 |
++ list_del(&gl->gl_lru); |
7793 |
++ list_add_tail(&gl->gl_lru, &lru_list); |
7794 |
++ |
7795 |
++ if (!test_bit(GLF_LRU, &gl->gl_flags)) { |
7796 |
++ set_bit(GLF_LRU, &gl->gl_flags); |
7797 |
+ atomic_inc(&lru_count); |
7798 |
++ } |
7799 |
+ |
7800 |
+- list_add_tail(&gl->gl_lru, &lru_list); |
7801 |
+- set_bit(GLF_LRU, &gl->gl_flags); |
7802 |
+ spin_unlock(&lru_lock); |
7803 |
+ } |
7804 |
+ |
7805 |
+@@ -201,7 +206,7 @@ static void gfs2_glock_remove_from_lru(struct gfs2_glock *gl) |
7806 |
+ return; |
7807 |
+ |
7808 |
+ spin_lock(&lru_lock); |
7809 |
+- if (!list_empty(&gl->gl_lru)) { |
7810 |
++ if (test_bit(GLF_LRU, &gl->gl_flags)) { |
7811 |
+ list_del_init(&gl->gl_lru); |
7812 |
+ atomic_dec(&lru_count); |
7813 |
+ clear_bit(GLF_LRU, &gl->gl_flags); |
7814 |
+@@ -1158,8 +1163,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh) |
7815 |
+ !test_bit(GLF_DEMOTE, &gl->gl_flags)) |
7816 |
+ fast_path = 1; |
7817 |
+ } |
7818 |
+- if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl) && |
7819 |
+- (glops->go_flags & GLOF_LRU)) |
7820 |
++ if (!test_bit(GLF_LFLUSH, &gl->gl_flags) && demote_ok(gl)) |
7821 |
+ gfs2_glock_add_to_lru(gl); |
7822 |
+ |
7823 |
+ trace_gfs2_glock_queue(gh, 0); |
7824 |
+@@ -1455,6 +1459,7 @@ __acquires(&lru_lock) |
7825 |
+ if (!spin_trylock(&gl->gl_lockref.lock)) { |
7826 |
+ add_back_to_lru: |
7827 |
+ list_add(&gl->gl_lru, &lru_list); |
7828 |
++ set_bit(GLF_LRU, &gl->gl_flags); |
7829 |
+ atomic_inc(&lru_count); |
7830 |
+ continue; |
7831 |
+ } |
7832 |
+@@ -1462,7 +1467,6 @@ add_back_to_lru: |
7833 |
+ spin_unlock(&gl->gl_lockref.lock); |
7834 |
+ goto add_back_to_lru; |
7835 |
+ } |
7836 |
+- clear_bit(GLF_LRU, &gl->gl_flags); |
7837 |
+ gl->gl_lockref.count++; |
7838 |
+ if (demote_ok(gl)) |
7839 |
+ handle_callback(gl, LM_ST_UNLOCKED, 0, false); |
7840 |
+@@ -1497,6 +1501,7 @@ static long gfs2_scan_glock_lru(int nr) |
7841 |
+ if (!test_bit(GLF_LOCK, &gl->gl_flags)) { |
7842 |
+ list_move(&gl->gl_lru, &dispose); |
7843 |
+ atomic_dec(&lru_count); |
7844 |
++ clear_bit(GLF_LRU, &gl->gl_flags); |
7845 |
+ freed++; |
7846 |
+ continue; |
7847 |
+ } |
7848 |
+diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c |
7849 |
+index ac7caa267ed6..62edf8f5615f 100644 |
7850 |
+--- a/fs/gfs2/lock_dlm.c |
7851 |
++++ b/fs/gfs2/lock_dlm.c |
7852 |
+@@ -31,9 +31,10 @@ |
7853 |
+ * @delta is the difference between the current rtt sample and the |
7854 |
+ * running average srtt. We add 1/8 of that to the srtt in order to |
7855 |
+ * update the current srtt estimate. The variance estimate is a bit |
7856 |
+- * more complicated. We subtract the abs value of the @delta from |
7857 |
+- * the current variance estimate and add 1/4 of that to the running |
7858 |
+- * total. |
7859 |
++ * more complicated. We subtract the current variance estimate from |
7860 |
++ * the abs value of the @delta and add 1/4 of that to the running |
7861 |
++ * total. That's equivalent to 3/4 of the current variance |
7862 |
++ * estimate plus 1/4 of the abs of @delta. |
7863 |
+ * |
7864 |
+ * Note that the index points at the array entry containing the smoothed |
7865 |
+ * mean value, and the variance is always in the following entry |
7866 |
+@@ -49,7 +50,7 @@ static inline void gfs2_update_stats(struct gfs2_lkstats *s, unsigned index, |
7867 |
+ s64 delta = sample - s->stats[index]; |
7868 |
+ s->stats[index] += (delta >> 3); |
7869 |
+ index++; |
7870 |
+- s->stats[index] += ((abs(delta) - s->stats[index]) >> 2); |
7871 |
++ s->stats[index] += (s64)(abs(delta) - s->stats[index]) >> 2; |
7872 |
+ } |
7873 |
+ |
7874 |
+ /** |
7875 |
+diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c |
7876 |
+index ee20ea42e7b5..cd85092723de 100644 |
7877 |
+--- a/fs/gfs2/log.c |
7878 |
++++ b/fs/gfs2/log.c |
7879 |
+@@ -604,7 +604,8 @@ void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) |
7880 |
+ bd->bd_bh = NULL; |
7881 |
+ bd->bd_ops = &gfs2_revoke_lops; |
7882 |
+ sdp->sd_log_num_revoke++; |
7883 |
+- atomic_inc(&gl->gl_revokes); |
7884 |
++ if (atomic_inc_return(&gl->gl_revokes) == 1) |
7885 |
++ gfs2_glock_hold(gl); |
7886 |
+ set_bit(GLF_LFLUSH, &gl->gl_flags); |
7887 |
+ list_add(&bd->bd_list, &sdp->sd_log_le_revoke); |
7888 |
+ } |
7889 |
+diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c |
7890 |
+index f2567f958d00..8f99b395d7bf 100644 |
7891 |
+--- a/fs/gfs2/lops.c |
7892 |
++++ b/fs/gfs2/lops.c |
7893 |
+@@ -662,8 +662,10 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr) |
7894 |
+ bd = list_entry(head->next, struct gfs2_bufdata, bd_list); |
7895 |
+ list_del_init(&bd->bd_list); |
7896 |
+ gl = bd->bd_gl; |
7897 |
+- atomic_dec(&gl->gl_revokes); |
7898 |
+- clear_bit(GLF_LFLUSH, &gl->gl_flags); |
7899 |
++ if (atomic_dec_return(&gl->gl_revokes) == 0) { |
7900 |
++ clear_bit(GLF_LFLUSH, &gl->gl_flags); |
7901 |
++ gfs2_glock_queue_put(gl); |
7902 |
++ } |
7903 |
+ kmem_cache_free(gfs2_bufdata_cachep, bd); |
7904 |
+ } |
7905 |
+ } |
7906 |
+diff --git a/fs/internal.h b/fs/internal.h |
7907 |
+index d410186bc369..d109665b9e50 100644 |
7908 |
+--- a/fs/internal.h |
7909 |
++++ b/fs/internal.h |
7910 |
+@@ -80,9 +80,7 @@ extern int sb_prepare_remount_readonly(struct super_block *); |
7911 |
+ |
7912 |
+ extern void __init mnt_init(void); |
7913 |
+ |
7914 |
+-extern int __mnt_want_write(struct vfsmount *); |
7915 |
+ extern int __mnt_want_write_file(struct file *); |
7916 |
+-extern void __mnt_drop_write(struct vfsmount *); |
7917 |
+ extern void __mnt_drop_write_file(struct file *); |
7918 |
+ |
7919 |
+ /* |
7920 |
+diff --git a/fs/nfs/client.c b/fs/nfs/client.c |
7921 |
+index 751ca65da8a3..c092661147b3 100644 |
7922 |
+--- a/fs/nfs/client.c |
7923 |
++++ b/fs/nfs/client.c |
7924 |
+@@ -290,6 +290,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat |
7925 |
+ struct nfs_client *clp; |
7926 |
+ const struct sockaddr *sap = data->addr; |
7927 |
+ struct nfs_net *nn = net_generic(data->net, nfs_net_id); |
7928 |
++ int error; |
7929 |
+ |
7930 |
+ again: |
7931 |
+ list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) { |
7932 |
+@@ -302,9 +303,11 @@ again: |
7933 |
+ if (clp->cl_cons_state > NFS_CS_READY) { |
7934 |
+ refcount_inc(&clp->cl_count); |
7935 |
+ spin_unlock(&nn->nfs_client_lock); |
7936 |
+- nfs_wait_client_init_complete(clp); |
7937 |
++ error = nfs_wait_client_init_complete(clp); |
7938 |
+ nfs_put_client(clp); |
7939 |
+ spin_lock(&nn->nfs_client_lock); |
7940 |
++ if (error < 0) |
7941 |
++ return ERR_PTR(error); |
7942 |
+ goto again; |
7943 |
+ } |
7944 |
+ |
7945 |
+@@ -413,6 +416,8 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init) |
7946 |
+ clp = nfs_match_client(cl_init); |
7947 |
+ if (clp) { |
7948 |
+ spin_unlock(&nn->nfs_client_lock); |
7949 |
++ if (IS_ERR(clp)) |
7950 |
++ return clp; |
7951 |
+ if (new) |
7952 |
+ new->rpc_ops->free_client(new); |
7953 |
+ return nfs_found_client(cl_init, clp); |
7954 |
+diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c |
7955 |
+index fed06fd9998d..94f98e190e63 100644 |
7956 |
+--- a/fs/nfs/nfs42proc.c |
7957 |
++++ b/fs/nfs/nfs42proc.c |
7958 |
+@@ -329,9 +329,6 @@ ssize_t nfs42_proc_copy(struct file *src, loff_t pos_src, |
7959 |
+ }; |
7960 |
+ ssize_t err, err2; |
7961 |
+ |
7962 |
+- if (!nfs_server_capable(file_inode(dst), NFS_CAP_COPY)) |
7963 |
+- return -EOPNOTSUPP; |
7964 |
+- |
7965 |
+ src_lock = nfs_get_lock_context(nfs_file_open_context(src)); |
7966 |
+ if (IS_ERR(src_lock)) |
7967 |
+ return PTR_ERR(src_lock); |
7968 |
+diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c |
7969 |
+index 4288a6ecaf75..134858507268 100644 |
7970 |
+--- a/fs/nfs/nfs4file.c |
7971 |
++++ b/fs/nfs/nfs4file.c |
7972 |
+@@ -133,15 +133,11 @@ static ssize_t nfs4_copy_file_range(struct file *file_in, loff_t pos_in, |
7973 |
+ struct file *file_out, loff_t pos_out, |
7974 |
+ size_t count, unsigned int flags) |
7975 |
+ { |
7976 |
+- ssize_t ret; |
7977 |
+- |
7978 |
++ if (!nfs_server_capable(file_inode(file_out), NFS_CAP_COPY)) |
7979 |
++ return -EOPNOTSUPP; |
7980 |
+ if (file_inode(file_in) == file_inode(file_out)) |
7981 |
+- return -EINVAL; |
7982 |
+-retry: |
7983 |
+- ret = nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); |
7984 |
+- if (ret == -EAGAIN) |
7985 |
+- goto retry; |
7986 |
+- return ret; |
7987 |
++ return -EOPNOTSUPP; |
7988 |
++ return nfs42_proc_copy(file_in, pos_in, file_out, pos_out, count); |
7989 |
+ } |
7990 |
+ |
7991 |
+ static loff_t nfs4_file_llseek(struct file *filep, loff_t offset, int whence) |
7992 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
7993 |
+index b2aadd3e1fec..336f04da80ed 100644 |
7994 |
+--- a/fs/overlayfs/dir.c |
7995 |
++++ b/fs/overlayfs/dir.c |
7996 |
+@@ -260,7 +260,7 @@ static int ovl_instantiate(struct dentry *dentry, struct inode *inode, |
7997 |
+ * hashed directory inode aliases. |
7998 |
+ */ |
7999 |
+ inode = ovl_get_inode(dentry->d_sb, &oip); |
8000 |
+- if (WARN_ON(IS_ERR(inode))) |
8001 |
++ if (IS_ERR(inode)) |
8002 |
+ return PTR_ERR(inode); |
8003 |
+ } else { |
8004 |
+ WARN_ON(ovl_inode_real(inode) != d_inode(newdentry)); |
8005 |
+diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c |
8006 |
+index 3b7ed5d2279c..b48273e846ad 100644 |
8007 |
+--- a/fs/overlayfs/inode.c |
8008 |
++++ b/fs/overlayfs/inode.c |
8009 |
+@@ -832,7 +832,7 @@ struct inode *ovl_get_inode(struct super_block *sb, |
8010 |
+ int fsid = bylower ? oip->lowerpath->layer->fsid : 0; |
8011 |
+ bool is_dir, metacopy = false; |
8012 |
+ unsigned long ino = 0; |
8013 |
+- int err = -ENOMEM; |
8014 |
++ int err = oip->newinode ? -EEXIST : -ENOMEM; |
8015 |
+ |
8016 |
+ if (!realinode) |
8017 |
+ realinode = d_inode(lowerdentry); |
8018 |
+@@ -917,6 +917,7 @@ out: |
8019 |
+ return inode; |
8020 |
+ |
8021 |
+ out_err: |
8022 |
++ pr_warn_ratelimited("overlayfs: failed to get inode (%i)\n", err); |
8023 |
+ inode = ERR_PTR(err); |
8024 |
+ goto out; |
8025 |
+ } |
8026 |
+diff --git a/include/drm/tinydrm/mipi-dbi.h b/include/drm/tinydrm/mipi-dbi.h |
8027 |
+index b8ba58861986..bcc98bd447f7 100644 |
8028 |
+--- a/include/drm/tinydrm/mipi-dbi.h |
8029 |
++++ b/include/drm/tinydrm/mipi-dbi.h |
8030 |
+@@ -42,7 +42,7 @@ struct mipi_dbi { |
8031 |
+ struct spi_device *spi; |
8032 |
+ bool enabled; |
8033 |
+ struct mutex cmdlock; |
8034 |
+- int (*command)(struct mipi_dbi *mipi, u8 cmd, u8 *param, size_t num); |
8035 |
++ int (*command)(struct mipi_dbi *mipi, u8 *cmd, u8 *param, size_t num); |
8036 |
+ const u8 *read_commands; |
8037 |
+ struct gpio_desc *dc; |
8038 |
+ u16 *tx_buf; |
8039 |
+@@ -79,6 +79,7 @@ u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len); |
8040 |
+ |
8041 |
+ int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val); |
8042 |
+ int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len); |
8043 |
++int mipi_dbi_command_stackbuf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len); |
8044 |
+ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, |
8045 |
+ struct drm_clip_rect *clip, bool swap); |
8046 |
+ /** |
8047 |
+@@ -96,7 +97,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, |
8048 |
+ #define mipi_dbi_command(mipi, cmd, seq...) \ |
8049 |
+ ({ \ |
8050 |
+ u8 d[] = { seq }; \ |
8051 |
+- mipi_dbi_command_buf(mipi, cmd, d, ARRAY_SIZE(d)); \ |
8052 |
++ mipi_dbi_command_stackbuf(mipi, cmd, d, ARRAY_SIZE(d)); \ |
8053 |
+ }) |
8054 |
+ |
8055 |
+ #ifdef CONFIG_DEBUG_FS |
8056 |
+diff --git a/include/linux/bio.h b/include/linux/bio.h |
8057 |
+index 51371740d2a8..c7433a201171 100644 |
8058 |
+--- a/include/linux/bio.h |
8059 |
++++ b/include/linux/bio.h |
8060 |
+@@ -257,7 +257,7 @@ static inline void bio_cnt_set(struct bio *bio, unsigned int count) |
8061 |
+ { |
8062 |
+ if (count != 1) { |
8063 |
+ bio->bi_flags |= (1 << BIO_REFFED); |
8064 |
+- smp_mb__before_atomic(); |
8065 |
++ smp_mb(); |
8066 |
+ } |
8067 |
+ atomic_set(&bio->__bi_cnt, count); |
8068 |
+ } |
8069 |
+diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h |
8070 |
+index 6002275937f5..a6090154b2ab 100644 |
8071 |
+--- a/include/linux/cgroup-defs.h |
8072 |
++++ b/include/linux/cgroup-defs.h |
8073 |
+@@ -346,6 +346,11 @@ struct cgroup { |
8074 |
+ * Dying cgroups are cgroups which were deleted by a user, |
8075 |
+ * but are still existing because someone else is holding a reference. |
8076 |
+ * max_descendants is a maximum allowed number of descent cgroups. |
8077 |
++ * |
8078 |
++ * nr_descendants and nr_dying_descendants are protected |
8079 |
++ * by cgroup_mutex and css_set_lock. It's fine to read them holding |
8080 |
++ * any of cgroup_mutex and css_set_lock; for writing both locks |
8081 |
++ * should be held. |
8082 |
+ */ |
8083 |
+ int nr_descendants; |
8084 |
+ int nr_dying_descendants; |
8085 |
+diff --git a/include/linux/filter.h b/include/linux/filter.h |
8086 |
+index 037610845892..d52a7484aeb2 100644 |
8087 |
+--- a/include/linux/filter.h |
8088 |
++++ b/include/linux/filter.h |
8089 |
+@@ -684,6 +684,7 @@ static inline void bpf_prog_unlock_ro(struct bpf_prog *fp) |
8090 |
+ static inline void bpf_jit_binary_lock_ro(struct bpf_binary_header *hdr) |
8091 |
+ { |
8092 |
+ set_memory_ro((unsigned long)hdr, hdr->pages); |
8093 |
++ set_memory_x((unsigned long)hdr, hdr->pages); |
8094 |
+ } |
8095 |
+ |
8096 |
+ static inline void bpf_jit_binary_unlock_ro(struct bpf_binary_header *hdr) |
8097 |
+@@ -836,6 +837,7 @@ bpf_run_sk_reuseport(struct sock_reuseport *reuse, struct sock *sk, |
8098 |
+ extern int bpf_jit_enable; |
8099 |
+ extern int bpf_jit_harden; |
8100 |
+ extern int bpf_jit_kallsyms; |
8101 |
++extern int bpf_jit_limit; |
8102 |
+ |
8103 |
+ typedef void (*bpf_jit_fill_hole_t)(void *area, unsigned int size); |
8104 |
+ |
8105 |
+diff --git a/include/linux/genhd.h b/include/linux/genhd.h |
8106 |
+index f767293b00e6..f13272d84332 100644 |
8107 |
+--- a/include/linux/genhd.h |
8108 |
++++ b/include/linux/genhd.h |
8109 |
+@@ -596,6 +596,7 @@ struct unixware_disklabel { |
8110 |
+ |
8111 |
+ extern int blk_alloc_devt(struct hd_struct *part, dev_t *devt); |
8112 |
+ extern void blk_free_devt(dev_t devt); |
8113 |
++extern void blk_invalidate_devt(dev_t devt); |
8114 |
+ extern dev_t blk_lookup_devt(const char *name, int partno); |
8115 |
+ extern char *disk_name (struct gendisk *hd, int partno, char *buf); |
8116 |
+ |
8117 |
+diff --git a/include/linux/hid.h b/include/linux/hid.h |
8118 |
+index d44a78362942..8b3e5e8a72fb 100644 |
8119 |
+--- a/include/linux/hid.h |
8120 |
++++ b/include/linux/hid.h |
8121 |
+@@ -414,6 +414,7 @@ struct hid_global { |
8122 |
+ |
8123 |
+ struct hid_local { |
8124 |
+ unsigned usage[HID_MAX_USAGES]; /* usage array */ |
8125 |
++ u8 usage_size[HID_MAX_USAGES]; /* usage size array */ |
8126 |
+ unsigned collection_index[HID_MAX_USAGES]; /* collection index array */ |
8127 |
+ unsigned usage_index; |
8128 |
+ unsigned usage_minimum; |
8129 |
+diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h |
8130 |
+index 730ead1a46df..57c122ae5452 100644 |
8131 |
+--- a/include/linux/iio/adc/ad_sigma_delta.h |
8132 |
++++ b/include/linux/iio/adc/ad_sigma_delta.h |
8133 |
+@@ -66,6 +66,7 @@ struct ad_sigma_delta { |
8134 |
+ bool irq_dis; |
8135 |
+ |
8136 |
+ bool bus_locked; |
8137 |
++ bool keep_cs_asserted; |
8138 |
+ |
8139 |
+ uint8_t comm; |
8140 |
+ |
8141 |
+diff --git a/include/linux/mount.h b/include/linux/mount.h |
8142 |
+index 45b1f56c6c2f..4b0db4418954 100644 |
8143 |
+--- a/include/linux/mount.h |
8144 |
++++ b/include/linux/mount.h |
8145 |
+@@ -86,6 +86,8 @@ extern bool mnt_may_suid(struct vfsmount *mnt); |
8146 |
+ |
8147 |
+ struct path; |
8148 |
+ extern struct vfsmount *clone_private_mount(const struct path *path); |
8149 |
++extern int __mnt_want_write(struct vfsmount *); |
8150 |
++extern void __mnt_drop_write(struct vfsmount *); |
8151 |
+ |
8152 |
+ struct file_system_type; |
8153 |
+ extern struct vfsmount *vfs_kern_mount(struct file_system_type *type, |
8154 |
+diff --git a/include/linux/overflow.h b/include/linux/overflow.h |
8155 |
+index 40b48e2133cb..15eb85de9226 100644 |
8156 |
+--- a/include/linux/overflow.h |
8157 |
++++ b/include/linux/overflow.h |
8158 |
+@@ -36,6 +36,12 @@ |
8159 |
+ #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) |
8160 |
+ #define type_min(T) ((T)((T)-type_max(T)-(T)1)) |
8161 |
+ |
8162 |
++/* |
8163 |
++ * Avoids triggering -Wtype-limits compilation warning, |
8164 |
++ * while using unsigned data types to check a < 0. |
8165 |
++ */ |
8166 |
++#define is_non_negative(a) ((a) > 0 || (a) == 0) |
8167 |
++#define is_negative(a) (!(is_non_negative(a))) |
8168 |
+ |
8169 |
+ #ifdef COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW |
8170 |
+ /* |
8171 |
+@@ -227,10 +233,10 @@ |
8172 |
+ typeof(d) _d = d; \ |
8173 |
+ u64 _a_full = _a; \ |
8174 |
+ unsigned int _to_shift = \ |
8175 |
+- _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \ |
8176 |
++ is_non_negative(_s) && _s < 8 * sizeof(*d) ? _s : 0; \ |
8177 |
+ *_d = (_a_full << _to_shift); \ |
8178 |
+- (_to_shift != _s || *_d < 0 || _a < 0 || \ |
8179 |
+- (*_d >> _to_shift) != _a); \ |
8180 |
++ (_to_shift != _s || is_negative(*_d) || is_negative(_a) || \ |
8181 |
++ (*_d >> _to_shift) != _a); \ |
8182 |
+ }) |
8183 |
+ |
8184 |
+ /** |
8185 |
+diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h |
8186 |
+index d0884b525001..9d1bc65d226c 100644 |
8187 |
+--- a/include/linux/smpboot.h |
8188 |
++++ b/include/linux/smpboot.h |
8189 |
+@@ -29,7 +29,7 @@ struct smpboot_thread_data; |
8190 |
+ * @thread_comm: The base name of the thread |
8191 |
+ */ |
8192 |
+ struct smp_hotplug_thread { |
8193 |
+- struct task_struct __percpu **store; |
8194 |
++ struct task_struct * __percpu *store; |
8195 |
+ struct list_head list; |
8196 |
+ int (*thread_should_run)(unsigned int cpu); |
8197 |
+ void (*thread_fn)(unsigned int cpu); |
8198 |
+diff --git a/include/linux/time64.h b/include/linux/time64.h |
8199 |
+index 05634afba0db..4a45aea0f96e 100644 |
8200 |
+--- a/include/linux/time64.h |
8201 |
++++ b/include/linux/time64.h |
8202 |
+@@ -41,6 +41,17 @@ struct itimerspec64 { |
8203 |
+ #define KTIME_MAX ((s64)~((u64)1 << 63)) |
8204 |
+ #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
8205 |
+ |
8206 |
++/* |
8207 |
++ * Limits for settimeofday(): |
8208 |
++ * |
8209 |
++ * To prevent setting the time close to the wraparound point time setting |
8210 |
++ * is limited so a reasonable uptime can be accomodated. Uptime of 30 years |
8211 |
++ * should be really sufficient, which means the cutoff is 2232. At that |
8212 |
++ * point the cutoff is just a small part of the larger problem. |
8213 |
++ */ |
8214 |
++#define TIME_UPTIME_SEC_MAX (30LL * 365 * 24 *3600) |
8215 |
++#define TIME_SETTOD_SEC_MAX (KTIME_SEC_MAX - TIME_UPTIME_SEC_MAX) |
8216 |
++ |
8217 |
+ static inline int timespec64_equal(const struct timespec64 *a, |
8218 |
+ const struct timespec64 *b) |
8219 |
+ { |
8220 |
+@@ -108,6 +119,16 @@ static inline bool timespec64_valid_strict(const struct timespec64 *ts) |
8221 |
+ return true; |
8222 |
+ } |
8223 |
+ |
8224 |
++static inline bool timespec64_valid_settod(const struct timespec64 *ts) |
8225 |
++{ |
8226 |
++ if (!timespec64_valid(ts)) |
8227 |
++ return false; |
8228 |
++ /* Disallow values which cause overflow issues vs. CLOCK_REALTIME */ |
8229 |
++ if ((unsigned long long)ts->tv_sec >= TIME_SETTOD_SEC_MAX) |
8230 |
++ return false; |
8231 |
++ return true; |
8232 |
++} |
8233 |
++ |
8234 |
+ /** |
8235 |
+ * timespec64_to_ns - Convert timespec64 to nanoseconds |
8236 |
+ * @ts: pointer to the timespec64 variable to be converted |
8237 |
+diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h |
8238 |
+index f6818f732f34..bddd86c11f5f 100644 |
8239 |
+--- a/include/media/videobuf2-core.h |
8240 |
++++ b/include/media/videobuf2-core.h |
8241 |
+@@ -551,6 +551,7 @@ struct vb2_queue { |
8242 |
+ unsigned int start_streaming_called:1; |
8243 |
+ unsigned int error:1; |
8244 |
+ unsigned int waiting_for_buffers:1; |
8245 |
++ unsigned int waiting_in_dqbuf:1; |
8246 |
+ unsigned int is_multiplanar:1; |
8247 |
+ unsigned int is_output:1; |
8248 |
+ unsigned int copy_timestamp:1; |
8249 |
+diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h |
8250 |
+index cdd9f1fe7cfa..845d947dbae8 100644 |
8251 |
+--- a/include/net/bluetooth/hci.h |
8252 |
++++ b/include/net/bluetooth/hci.h |
8253 |
+@@ -270,6 +270,7 @@ enum { |
8254 |
+ HCI_FORCE_BREDR_SMP, |
8255 |
+ HCI_FORCE_STATIC_ADDR, |
8256 |
+ HCI_LL_RPA_RESOLUTION, |
8257 |
++ HCI_CMD_PENDING, |
8258 |
+ |
8259 |
+ __HCI_NUM_FLAGS, |
8260 |
+ }; |
8261 |
+diff --git a/kernel/acct.c b/kernel/acct.c |
8262 |
+index addf7732fb56..81f9831a7859 100644 |
8263 |
+--- a/kernel/acct.c |
8264 |
++++ b/kernel/acct.c |
8265 |
+@@ -227,7 +227,7 @@ static int acct_on(struct filename *pathname) |
8266 |
+ filp_close(file, NULL); |
8267 |
+ return PTR_ERR(internal); |
8268 |
+ } |
8269 |
+- err = mnt_want_write(internal); |
8270 |
++ err = __mnt_want_write(internal); |
8271 |
+ if (err) { |
8272 |
+ mntput(internal); |
8273 |
+ kfree(acct); |
8274 |
+@@ -252,7 +252,7 @@ static int acct_on(struct filename *pathname) |
8275 |
+ old = xchg(&ns->bacct, &acct->pin); |
8276 |
+ mutex_unlock(&acct->lock); |
8277 |
+ pin_kill(old); |
8278 |
+- mnt_drop_write(mnt); |
8279 |
++ __mnt_drop_write(mnt); |
8280 |
+ mntput(mnt); |
8281 |
+ return 0; |
8282 |
+ } |
8283 |
+diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c |
8284 |
+index bf309f2592c4..425c67e4f568 100644 |
8285 |
+--- a/kernel/auditfilter.c |
8286 |
++++ b/kernel/auditfilter.c |
8287 |
+@@ -1114,22 +1114,24 @@ int audit_rule_change(int type, int seq, void *data, size_t datasz) |
8288 |
+ int err = 0; |
8289 |
+ struct audit_entry *entry; |
8290 |
+ |
8291 |
+- entry = audit_data_to_entry(data, datasz); |
8292 |
+- if (IS_ERR(entry)) |
8293 |
+- return PTR_ERR(entry); |
8294 |
+- |
8295 |
+ switch (type) { |
8296 |
+ case AUDIT_ADD_RULE: |
8297 |
++ entry = audit_data_to_entry(data, datasz); |
8298 |
++ if (IS_ERR(entry)) |
8299 |
++ return PTR_ERR(entry); |
8300 |
+ err = audit_add_rule(entry); |
8301 |
+ audit_log_rule_change("add_rule", &entry->rule, !err); |
8302 |
+ break; |
8303 |
+ case AUDIT_DEL_RULE: |
8304 |
++ entry = audit_data_to_entry(data, datasz); |
8305 |
++ if (IS_ERR(entry)) |
8306 |
++ return PTR_ERR(entry); |
8307 |
+ err = audit_del_rule(entry); |
8308 |
+ audit_log_rule_change("remove_rule", &entry->rule, !err); |
8309 |
+ break; |
8310 |
+ default: |
8311 |
+- err = -EINVAL; |
8312 |
+ WARN_ON(1); |
8313 |
++ return -EINVAL; |
8314 |
+ } |
8315 |
+ |
8316 |
+ if (err || type == AUDIT_DEL_RULE) { |
8317 |
+diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c |
8318 |
+index 474525e3a9db..bad9985b8a08 100644 |
8319 |
+--- a/kernel/bpf/core.c |
8320 |
++++ b/kernel/bpf/core.c |
8321 |
+@@ -366,10 +366,13 @@ void bpf_prog_kallsyms_del_all(struct bpf_prog *fp) |
8322 |
+ } |
8323 |
+ |
8324 |
+ #ifdef CONFIG_BPF_JIT |
8325 |
++# define BPF_JIT_LIMIT_DEFAULT (PAGE_SIZE * 40000) |
8326 |
++ |
8327 |
+ /* All BPF JIT sysctl knobs here. */ |
8328 |
+ int bpf_jit_enable __read_mostly = IS_BUILTIN(CONFIG_BPF_JIT_ALWAYS_ON); |
8329 |
+ int bpf_jit_harden __read_mostly; |
8330 |
+ int bpf_jit_kallsyms __read_mostly; |
8331 |
++int bpf_jit_limit __read_mostly = BPF_JIT_LIMIT_DEFAULT; |
8332 |
+ |
8333 |
+ static __always_inline void |
8334 |
+ bpf_get_prog_addr_region(const struct bpf_prog *prog, |
8335 |
+@@ -578,27 +581,64 @@ int bpf_get_kallsym(unsigned int symnum, unsigned long *value, char *type, |
8336 |
+ return ret; |
8337 |
+ } |
8338 |
+ |
8339 |
++static atomic_long_t bpf_jit_current; |
8340 |
++ |
8341 |
++#if defined(MODULES_VADDR) |
8342 |
++static int __init bpf_jit_charge_init(void) |
8343 |
++{ |
8344 |
++ /* Only used as heuristic here to derive limit. */ |
8345 |
++ bpf_jit_limit = min_t(u64, round_up((MODULES_END - MODULES_VADDR) >> 2, |
8346 |
++ PAGE_SIZE), INT_MAX); |
8347 |
++ return 0; |
8348 |
++} |
8349 |
++pure_initcall(bpf_jit_charge_init); |
8350 |
++#endif |
8351 |
++ |
8352 |
++static int bpf_jit_charge_modmem(u32 pages) |
8353 |
++{ |
8354 |
++ if (atomic_long_add_return(pages, &bpf_jit_current) > |
8355 |
++ (bpf_jit_limit >> PAGE_SHIFT)) { |
8356 |
++ if (!capable(CAP_SYS_ADMIN)) { |
8357 |
++ atomic_long_sub(pages, &bpf_jit_current); |
8358 |
++ return -EPERM; |
8359 |
++ } |
8360 |
++ } |
8361 |
++ |
8362 |
++ return 0; |
8363 |
++} |
8364 |
++ |
8365 |
++static void bpf_jit_uncharge_modmem(u32 pages) |
8366 |
++{ |
8367 |
++ atomic_long_sub(pages, &bpf_jit_current); |
8368 |
++} |
8369 |
++ |
8370 |
+ struct bpf_binary_header * |
8371 |
+ bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, |
8372 |
+ unsigned int alignment, |
8373 |
+ bpf_jit_fill_hole_t bpf_fill_ill_insns) |
8374 |
+ { |
8375 |
+ struct bpf_binary_header *hdr; |
8376 |
+- unsigned int size, hole, start; |
8377 |
++ u32 size, hole, start, pages; |
8378 |
+ |
8379 |
+ /* Most of BPF filters are really small, but if some of them |
8380 |
+ * fill a page, allow at least 128 extra bytes to insert a |
8381 |
+ * random section of illegal instructions. |
8382 |
+ */ |
8383 |
+ size = round_up(proglen + sizeof(*hdr) + 128, PAGE_SIZE); |
8384 |
++ pages = size / PAGE_SIZE; |
8385 |
++ |
8386 |
++ if (bpf_jit_charge_modmem(pages)) |
8387 |
++ return NULL; |
8388 |
+ hdr = module_alloc(size); |
8389 |
+- if (hdr == NULL) |
8390 |
++ if (!hdr) { |
8391 |
++ bpf_jit_uncharge_modmem(pages); |
8392 |
+ return NULL; |
8393 |
++ } |
8394 |
+ |
8395 |
+ /* Fill space with illegal/arch-dep instructions. */ |
8396 |
+ bpf_fill_ill_insns(hdr, size); |
8397 |
+ |
8398 |
+- hdr->pages = size / PAGE_SIZE; |
8399 |
++ hdr->pages = pages; |
8400 |
+ hole = min_t(unsigned int, size - (proglen + sizeof(*hdr)), |
8401 |
+ PAGE_SIZE - sizeof(*hdr)); |
8402 |
+ start = (get_random_int() % hole) & ~(alignment - 1); |
8403 |
+@@ -611,7 +651,10 @@ bpf_jit_binary_alloc(unsigned int proglen, u8 **image_ptr, |
8404 |
+ |
8405 |
+ void bpf_jit_binary_free(struct bpf_binary_header *hdr) |
8406 |
+ { |
8407 |
++ u32 pages = hdr->pages; |
8408 |
++ |
8409 |
+ module_memfree(hdr); |
8410 |
++ bpf_jit_uncharge_modmem(pages); |
8411 |
+ } |
8412 |
+ |
8413 |
+ /* This symbol is only overridden by archs that have different |
8414 |
+diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c |
8415 |
+index 141710b82a6c..2faad033715f 100644 |
8416 |
+--- a/kernel/bpf/devmap.c |
8417 |
++++ b/kernel/bpf/devmap.c |
8418 |
+@@ -164,6 +164,9 @@ static void dev_map_free(struct bpf_map *map) |
8419 |
+ bpf_clear_redirect_map(map); |
8420 |
+ synchronize_rcu(); |
8421 |
+ |
8422 |
++ /* Make sure prior __dev_map_entry_free() have completed. */ |
8423 |
++ rcu_barrier(); |
8424 |
++ |
8425 |
+ /* To ensure all pending flush operations have completed wait for flush |
8426 |
+ * bitmap to indicate all flush_needed bits to be zero on _all_ cpus. |
8427 |
+ * Because the above synchronize_rcu() ensures the map is disconnected |
8428 |
+diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c |
8429 |
+index 63dae7e0ccae..81441117f611 100644 |
8430 |
+--- a/kernel/cgroup/cgroup.c |
8431 |
++++ b/kernel/cgroup/cgroup.c |
8432 |
+@@ -4659,9 +4659,11 @@ static void css_release_work_fn(struct work_struct *work) |
8433 |
+ if (cgroup_on_dfl(cgrp)) |
8434 |
+ cgroup_rstat_flush(cgrp); |
8435 |
+ |
8436 |
++ spin_lock_irq(&css_set_lock); |
8437 |
+ for (tcgrp = cgroup_parent(cgrp); tcgrp; |
8438 |
+ tcgrp = cgroup_parent(tcgrp)) |
8439 |
+ tcgrp->nr_dying_descendants--; |
8440 |
++ spin_unlock_irq(&css_set_lock); |
8441 |
+ |
8442 |
+ cgroup_idr_remove(&cgrp->root->cgroup_idr, cgrp->id); |
8443 |
+ cgrp->id = -1; |
8444 |
+@@ -4874,12 +4876,14 @@ static struct cgroup *cgroup_create(struct cgroup *parent) |
8445 |
+ if (ret) |
8446 |
+ goto out_idr_free; |
8447 |
+ |
8448 |
++ spin_lock_irq(&css_set_lock); |
8449 |
+ for (tcgrp = cgrp; tcgrp; tcgrp = cgroup_parent(tcgrp)) { |
8450 |
+ cgrp->ancestor_ids[tcgrp->level] = tcgrp->id; |
8451 |
+ |
8452 |
+ if (tcgrp != cgrp) |
8453 |
+ tcgrp->nr_descendants++; |
8454 |
+ } |
8455 |
++ spin_unlock_irq(&css_set_lock); |
8456 |
+ |
8457 |
+ if (notify_on_release(parent)) |
8458 |
+ set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); |
8459 |
+@@ -5162,10 +5166,12 @@ static int cgroup_destroy_locked(struct cgroup *cgrp) |
8460 |
+ if (parent && cgroup_is_threaded(cgrp)) |
8461 |
+ parent->nr_threaded_children--; |
8462 |
+ |
8463 |
++ spin_lock_irq(&css_set_lock); |
8464 |
+ for (tcgrp = cgroup_parent(cgrp); tcgrp; tcgrp = cgroup_parent(tcgrp)) { |
8465 |
+ tcgrp->nr_descendants--; |
8466 |
+ tcgrp->nr_dying_descendants++; |
8467 |
+ } |
8468 |
++ spin_unlock_irq(&css_set_lock); |
8469 |
+ |
8470 |
+ cgroup1_check_for_release(parent); |
8471 |
+ |
8472 |
+diff --git a/kernel/irq_work.c b/kernel/irq_work.c |
8473 |
+index 6b7cdf17ccf8..73288914ed5e 100644 |
8474 |
+--- a/kernel/irq_work.c |
8475 |
++++ b/kernel/irq_work.c |
8476 |
+@@ -56,61 +56,70 @@ void __weak arch_irq_work_raise(void) |
8477 |
+ */ |
8478 |
+ } |
8479 |
+ |
8480 |
+-/* |
8481 |
+- * Enqueue the irq_work @work on @cpu unless it's already pending |
8482 |
+- * somewhere. |
8483 |
+- * |
8484 |
+- * Can be re-enqueued while the callback is still in progress. |
8485 |
+- */ |
8486 |
+-bool irq_work_queue_on(struct irq_work *work, int cpu) |
8487 |
++/* Enqueue on current CPU, work must already be claimed and preempt disabled */ |
8488 |
++static void __irq_work_queue_local(struct irq_work *work) |
8489 |
+ { |
8490 |
+- /* All work should have been flushed before going offline */ |
8491 |
+- WARN_ON_ONCE(cpu_is_offline(cpu)); |
8492 |
+- |
8493 |
+-#ifdef CONFIG_SMP |
8494 |
+- |
8495 |
+- /* Arch remote IPI send/receive backend aren't NMI safe */ |
8496 |
+- WARN_ON_ONCE(in_nmi()); |
8497 |
++ /* If the work is "lazy", handle it from next tick if any */ |
8498 |
++ if (work->flags & IRQ_WORK_LAZY) { |
8499 |
++ if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && |
8500 |
++ tick_nohz_tick_stopped()) |
8501 |
++ arch_irq_work_raise(); |
8502 |
++ } else { |
8503 |
++ if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) |
8504 |
++ arch_irq_work_raise(); |
8505 |
++ } |
8506 |
++} |
8507 |
+ |
8508 |
++/* Enqueue the irq work @work on the current CPU */ |
8509 |
++bool irq_work_queue(struct irq_work *work) |
8510 |
++{ |
8511 |
+ /* Only queue if not already pending */ |
8512 |
+ if (!irq_work_claim(work)) |
8513 |
+ return false; |
8514 |
+ |
8515 |
+- if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) |
8516 |
+- arch_send_call_function_single_ipi(cpu); |
8517 |
+- |
8518 |
+-#else /* #ifdef CONFIG_SMP */ |
8519 |
+- irq_work_queue(work); |
8520 |
+-#endif /* #else #ifdef CONFIG_SMP */ |
8521 |
++ /* Queue the entry and raise the IPI if needed. */ |
8522 |
++ preempt_disable(); |
8523 |
++ __irq_work_queue_local(work); |
8524 |
++ preempt_enable(); |
8525 |
+ |
8526 |
+ return true; |
8527 |
+ } |
8528 |
++EXPORT_SYMBOL_GPL(irq_work_queue); |
8529 |
+ |
8530 |
+-/* Enqueue the irq work @work on the current CPU */ |
8531 |
+-bool irq_work_queue(struct irq_work *work) |
8532 |
++/* |
8533 |
++ * Enqueue the irq_work @work on @cpu unless it's already pending |
8534 |
++ * somewhere. |
8535 |
++ * |
8536 |
++ * Can be re-enqueued while the callback is still in progress. |
8537 |
++ */ |
8538 |
++bool irq_work_queue_on(struct irq_work *work, int cpu) |
8539 |
+ { |
8540 |
++#ifndef CONFIG_SMP |
8541 |
++ return irq_work_queue(work); |
8542 |
++ |
8543 |
++#else /* CONFIG_SMP: */ |
8544 |
++ /* All work should have been flushed before going offline */ |
8545 |
++ WARN_ON_ONCE(cpu_is_offline(cpu)); |
8546 |
++ |
8547 |
+ /* Only queue if not already pending */ |
8548 |
+ if (!irq_work_claim(work)) |
8549 |
+ return false; |
8550 |
+ |
8551 |
+- /* Queue the entry and raise the IPI if needed. */ |
8552 |
+ preempt_disable(); |
8553 |
+- |
8554 |
+- /* If the work is "lazy", handle it from next tick if any */ |
8555 |
+- if (work->flags & IRQ_WORK_LAZY) { |
8556 |
+- if (llist_add(&work->llnode, this_cpu_ptr(&lazy_list)) && |
8557 |
+- tick_nohz_tick_stopped()) |
8558 |
+- arch_irq_work_raise(); |
8559 |
++ if (cpu != smp_processor_id()) { |
8560 |
++ /* Arch remote IPI send/receive backend aren't NMI safe */ |
8561 |
++ WARN_ON_ONCE(in_nmi()); |
8562 |
++ if (llist_add(&work->llnode, &per_cpu(raised_list, cpu))) |
8563 |
++ arch_send_call_function_single_ipi(cpu); |
8564 |
+ } else { |
8565 |
+- if (llist_add(&work->llnode, this_cpu_ptr(&raised_list))) |
8566 |
+- arch_irq_work_raise(); |
8567 |
++ __irq_work_queue_local(work); |
8568 |
+ } |
8569 |
+- |
8570 |
+ preempt_enable(); |
8571 |
+ |
8572 |
+ return true; |
8573 |
++#endif /* CONFIG_SMP */ |
8574 |
+ } |
8575 |
+-EXPORT_SYMBOL_GPL(irq_work_queue); |
8576 |
++ |
8577 |
+ |
8578 |
+ bool irq_work_needs_cpu(void) |
8579 |
+ { |
8580 |
+diff --git a/kernel/module.c b/kernel/module.c |
8581 |
+index 38bf28b5cc20..f797c6ace712 100644 |
8582 |
+--- a/kernel/module.c |
8583 |
++++ b/kernel/module.c |
8584 |
+@@ -1949,8 +1949,13 @@ void module_enable_ro(const struct module *mod, bool after_init) |
8585 |
+ return; |
8586 |
+ |
8587 |
+ frob_text(&mod->core_layout, set_memory_ro); |
8588 |
++ frob_text(&mod->core_layout, set_memory_x); |
8589 |
++ |
8590 |
+ frob_rodata(&mod->core_layout, set_memory_ro); |
8591 |
++ |
8592 |
+ frob_text(&mod->init_layout, set_memory_ro); |
8593 |
++ frob_text(&mod->init_layout, set_memory_x); |
8594 |
++ |
8595 |
+ frob_rodata(&mod->init_layout, set_memory_ro); |
8596 |
+ |
8597 |
+ if (after_init) |
8598 |
+diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c |
8599 |
+index 34244523550e..19249b86fb33 100644 |
8600 |
+--- a/kernel/rcu/rcuperf.c |
8601 |
++++ b/kernel/rcu/rcuperf.c |
8602 |
+@@ -561,6 +561,10 @@ rcu_perf_cleanup(void) |
8603 |
+ |
8604 |
+ if (torture_cleanup_begin()) |
8605 |
+ return; |
8606 |
++ if (!cur_ops) { |
8607 |
++ torture_cleanup_end(); |
8608 |
++ return; |
8609 |
++ } |
8610 |
+ |
8611 |
+ if (reader_tasks) { |
8612 |
+ for (i = 0; i < nrealreaders; i++) |
8613 |
+@@ -681,6 +685,7 @@ rcu_perf_init(void) |
8614 |
+ pr_cont(" %s", perf_ops[i]->name); |
8615 |
+ pr_cont("\n"); |
8616 |
+ firsterr = -EINVAL; |
8617 |
++ cur_ops = NULL; |
8618 |
+ goto unwind; |
8619 |
+ } |
8620 |
+ if (cur_ops->init) |
8621 |
+diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c |
8622 |
+index c596c6f1e457..0b7af7e2bcbb 100644 |
8623 |
+--- a/kernel/rcu/rcutorture.c |
8624 |
++++ b/kernel/rcu/rcutorture.c |
8625 |
+@@ -1826,6 +1826,10 @@ rcu_torture_cleanup(void) |
8626 |
+ cur_ops->cb_barrier(); |
8627 |
+ return; |
8628 |
+ } |
8629 |
++ if (!cur_ops) { |
8630 |
++ torture_cleanup_end(); |
8631 |
++ return; |
8632 |
++ } |
8633 |
+ |
8634 |
+ rcu_torture_barrier_cleanup(); |
8635 |
+ torture_stop_kthread(rcu_torture_stall, stall_task); |
8636 |
+@@ -1964,6 +1968,7 @@ rcu_torture_init(void) |
8637 |
+ pr_cont(" %s", torture_ops[i]->name); |
8638 |
+ pr_cont("\n"); |
8639 |
+ firsterr = -EINVAL; |
8640 |
++ cur_ops = NULL; |
8641 |
+ goto unwind; |
8642 |
+ } |
8643 |
+ if (cur_ops->fqs == NULL && fqs_duration != 0) { |
8644 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
8645 |
+index d7f409866cdf..6138754e5030 100644 |
8646 |
+--- a/kernel/sched/core.c |
8647 |
++++ b/kernel/sched/core.c |
8648 |
+@@ -6491,6 +6491,8 @@ static void cpu_cgroup_attach(struct cgroup_taskset *tset) |
8649 |
+ static int cpu_shares_write_u64(struct cgroup_subsys_state *css, |
8650 |
+ struct cftype *cftype, u64 shareval) |
8651 |
+ { |
8652 |
++ if (shareval > scale_load_down(ULONG_MAX)) |
8653 |
++ shareval = MAX_SHARES; |
8654 |
+ return sched_group_set_shares(css_tg(css), scale_load(shareval)); |
8655 |
+ } |
8656 |
+ |
8657 |
+@@ -6593,8 +6595,10 @@ int tg_set_cfs_quota(struct task_group *tg, long cfs_quota_us) |
8658 |
+ period = ktime_to_ns(tg->cfs_bandwidth.period); |
8659 |
+ if (cfs_quota_us < 0) |
8660 |
+ quota = RUNTIME_INF; |
8661 |
+- else |
8662 |
++ else if ((u64)cfs_quota_us <= U64_MAX / NSEC_PER_USEC) |
8663 |
+ quota = (u64)cfs_quota_us * NSEC_PER_USEC; |
8664 |
++ else |
8665 |
++ return -EINVAL; |
8666 |
+ |
8667 |
+ return tg_set_cfs_bandwidth(tg, period, quota); |
8668 |
+ } |
8669 |
+@@ -6616,6 +6620,9 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) |
8670 |
+ { |
8671 |
+ u64 quota, period; |
8672 |
+ |
8673 |
++ if ((u64)cfs_period_us > U64_MAX / NSEC_PER_USEC) |
8674 |
++ return -EINVAL; |
8675 |
++ |
8676 |
+ period = (u64)cfs_period_us * NSEC_PER_USEC; |
8677 |
+ quota = tg->cfs_bandwidth.quota; |
8678 |
+ |
8679 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
8680 |
+index d31916366d39..7a1e9db617f7 100644 |
8681 |
+--- a/kernel/sched/fair.c |
8682 |
++++ b/kernel/sched/fair.c |
8683 |
+@@ -9083,22 +9083,26 @@ static inline int on_null_domain(struct rq *rq) |
8684 |
+ * - When one of the busy CPUs notice that there may be an idle rebalancing |
8685 |
+ * needed, they will kick the idle load balancer, which then does idle |
8686 |
+ * load balancing for all the idle CPUs. |
8687 |
++ * - HK_FLAG_MISC CPUs are used for this task, because HK_FLAG_SCHED not set |
8688 |
++ * anywhere yet. |
8689 |
+ */ |
8690 |
+ |
8691 |
+ static inline int find_new_ilb(void) |
8692 |
+ { |
8693 |
+- int ilb = cpumask_first(nohz.idle_cpus_mask); |
8694 |
++ int ilb; |
8695 |
+ |
8696 |
+- if (ilb < nr_cpu_ids && idle_cpu(ilb)) |
8697 |
+- return ilb; |
8698 |
++ for_each_cpu_and(ilb, nohz.idle_cpus_mask, |
8699 |
++ housekeeping_cpumask(HK_FLAG_MISC)) { |
8700 |
++ if (idle_cpu(ilb)) |
8701 |
++ return ilb; |
8702 |
++ } |
8703 |
+ |
8704 |
+ return nr_cpu_ids; |
8705 |
+ } |
8706 |
+ |
8707 |
+ /* |
8708 |
+- * Kick a CPU to do the nohz balancing, if it is time for it. We pick the |
8709 |
+- * nohz_load_balancer CPU (if there is one) otherwise fallback to any idle |
8710 |
+- * CPU (if there is one). |
8711 |
++ * Kick a CPU to do the nohz balancing, if it is time for it. We pick any |
8712 |
++ * idle CPU in the HK_FLAG_MISC housekeeping set (if there is one). |
8713 |
+ */ |
8714 |
+ static void kick_ilb(unsigned int flags) |
8715 |
+ { |
8716 |
+diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c |
8717 |
+index 2e2955a8cf8f..b980cc96604f 100644 |
8718 |
+--- a/kernel/sched/rt.c |
8719 |
++++ b/kernel/sched/rt.c |
8720 |
+@@ -2559,6 +2559,8 @@ int sched_group_set_rt_runtime(struct task_group *tg, long rt_runtime_us) |
8721 |
+ rt_runtime = (u64)rt_runtime_us * NSEC_PER_USEC; |
8722 |
+ if (rt_runtime_us < 0) |
8723 |
+ rt_runtime = RUNTIME_INF; |
8724 |
++ else if ((u64)rt_runtime_us > U64_MAX / NSEC_PER_USEC) |
8725 |
++ return -EINVAL; |
8726 |
+ |
8727 |
+ return tg_set_rt_bandwidth(tg, rt_period, rt_runtime); |
8728 |
+ } |
8729 |
+@@ -2579,6 +2581,9 @@ int sched_group_set_rt_period(struct task_group *tg, u64 rt_period_us) |
8730 |
+ { |
8731 |
+ u64 rt_runtime, rt_period; |
8732 |
+ |
8733 |
++ if (rt_period_us > U64_MAX / NSEC_PER_USEC) |
8734 |
++ return -EINVAL; |
8735 |
++ |
8736 |
+ rt_period = rt_period_us * NSEC_PER_USEC; |
8737 |
+ rt_runtime = tg->rt_bandwidth.rt_runtime; |
8738 |
+ |
8739 |
+diff --git a/kernel/time/time.c b/kernel/time/time.c |
8740 |
+index ccdb351277ee..be057d6579f1 100644 |
8741 |
+--- a/kernel/time/time.c |
8742 |
++++ b/kernel/time/time.c |
8743 |
+@@ -172,7 +172,7 @@ int do_sys_settimeofday64(const struct timespec64 *tv, const struct timezone *tz |
8744 |
+ static int firsttime = 1; |
8745 |
+ int error = 0; |
8746 |
+ |
8747 |
+- if (tv && !timespec64_valid(tv)) |
8748 |
++ if (tv && !timespec64_valid_settod(tv)) |
8749 |
+ return -EINVAL; |
8750 |
+ |
8751 |
+ error = security_settime64(tv, tz); |
8752 |
+diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c |
8753 |
+index 7846ce24ecc0..9a6bfcd22dc6 100644 |
8754 |
+--- a/kernel/time/timekeeping.c |
8755 |
++++ b/kernel/time/timekeeping.c |
8756 |
+@@ -1242,7 +1242,7 @@ int do_settimeofday64(const struct timespec64 *ts) |
8757 |
+ unsigned long flags; |
8758 |
+ int ret = 0; |
8759 |
+ |
8760 |
+- if (!timespec64_valid_strict(ts)) |
8761 |
++ if (!timespec64_valid_settod(ts)) |
8762 |
+ return -EINVAL; |
8763 |
+ |
8764 |
+ raw_spin_lock_irqsave(&timekeeper_lock, flags); |
8765 |
+@@ -1299,7 +1299,7 @@ static int timekeeping_inject_offset(const struct timespec64 *ts) |
8766 |
+ /* Make sure the proposed value is valid */ |
8767 |
+ tmp = timespec64_add(tk_xtime(tk), *ts); |
8768 |
+ if (timespec64_compare(&tk->wall_to_monotonic, ts) > 0 || |
8769 |
+- !timespec64_valid_strict(&tmp)) { |
8770 |
++ !timespec64_valid_settod(&tmp)) { |
8771 |
+ ret = -EINVAL; |
8772 |
+ goto error; |
8773 |
+ } |
8774 |
+@@ -1556,7 +1556,7 @@ void __init timekeeping_init(void) |
8775 |
+ unsigned long flags; |
8776 |
+ |
8777 |
+ read_persistent_wall_and_boot_offset(&wall_time, &boot_offset); |
8778 |
+- if (timespec64_valid_strict(&wall_time) && |
8779 |
++ if (timespec64_valid_settod(&wall_time) && |
8780 |
+ timespec64_to_ns(&wall_time) > 0) { |
8781 |
+ persistent_clock_exists = true; |
8782 |
+ } else if (timespec64_to_ns(&wall_time) != 0) { |
8783 |
+diff --git a/kernel/trace/trace_branch.c b/kernel/trace/trace_branch.c |
8784 |
+index 4ad967453b6f..3ea65cdff30d 100644 |
8785 |
+--- a/kernel/trace/trace_branch.c |
8786 |
++++ b/kernel/trace/trace_branch.c |
8787 |
+@@ -205,6 +205,8 @@ void trace_likely_condition(struct ftrace_likely_data *f, int val, int expect) |
8788 |
+ void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
8789 |
+ int expect, int is_constant) |
8790 |
+ { |
8791 |
++ unsigned long flags = user_access_save(); |
8792 |
++ |
8793 |
+ /* A constant is always correct */ |
8794 |
+ if (is_constant) { |
8795 |
+ f->constant++; |
8796 |
+@@ -223,6 +225,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, |
8797 |
+ f->data.correct++; |
8798 |
+ else |
8799 |
+ f->data.incorrect++; |
8800 |
++ |
8801 |
++ user_access_restore(flags); |
8802 |
+ } |
8803 |
+ EXPORT_SYMBOL(ftrace_likely_update); |
8804 |
+ |
8805 |
+diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c |
8806 |
+index 63d0816ab23b..7761f3294339 100644 |
8807 |
+--- a/lib/kobject_uevent.c |
8808 |
++++ b/lib/kobject_uevent.c |
8809 |
+@@ -464,6 +464,13 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
8810 |
+ int i = 0; |
8811 |
+ int retval = 0; |
8812 |
+ |
8813 |
++ /* |
8814 |
++ * Mark "remove" event done regardless of result, for some subsystems |
8815 |
++ * do not want to re-trigger "remove" event via automatic cleanup. |
8816 |
++ */ |
8817 |
++ if (action == KOBJ_REMOVE) |
8818 |
++ kobj->state_remove_uevent_sent = 1; |
8819 |
++ |
8820 |
+ pr_debug("kobject: '%s' (%p): %s\n", |
8821 |
+ kobject_name(kobj), kobj, __func__); |
8822 |
+ |
8823 |
+@@ -565,10 +572,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
8824 |
+ kobj->state_add_uevent_sent = 1; |
8825 |
+ break; |
8826 |
+ |
8827 |
+- case KOBJ_REMOVE: |
8828 |
+- kobj->state_remove_uevent_sent = 1; |
8829 |
+- break; |
8830 |
+- |
8831 |
+ case KOBJ_UNBIND: |
8832 |
+ zap_modalias_env(env); |
8833 |
+ break; |
8834 |
+diff --git a/lib/sbitmap.c b/lib/sbitmap.c |
8835 |
+index fdd1b8aa8ac6..0572ac340325 100644 |
8836 |
+--- a/lib/sbitmap.c |
8837 |
++++ b/lib/sbitmap.c |
8838 |
+@@ -356,7 +356,7 @@ static void sbitmap_queue_update_wake_batch(struct sbitmap_queue *sbq, |
8839 |
+ * to ensure that the batch size is updated before the wait |
8840 |
+ * counts. |
8841 |
+ */ |
8842 |
+- smp_mb__before_atomic(); |
8843 |
++ smp_mb(); |
8844 |
+ for (i = 0; i < SBQ_WAIT_QUEUES; i++) |
8845 |
+ atomic_set(&sbq->ws[i].wait_cnt, 1); |
8846 |
+ } |
8847 |
+diff --git a/lib/strncpy_from_user.c b/lib/strncpy_from_user.c |
8848 |
+index b53e1b5d80f4..e304b54c9c7d 100644 |
8849 |
+--- a/lib/strncpy_from_user.c |
8850 |
++++ b/lib/strncpy_from_user.c |
8851 |
+@@ -23,10 +23,11 @@ |
8852 |
+ * hit it), 'max' is the address space maximum (and we return |
8853 |
+ * -EFAULT if we hit it). |
8854 |
+ */ |
8855 |
+-static inline long do_strncpy_from_user(char *dst, const char __user *src, long count, unsigned long max) |
8856 |
++static inline long do_strncpy_from_user(char *dst, const char __user *src, |
8857 |
++ unsigned long count, unsigned long max) |
8858 |
+ { |
8859 |
+ const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
8860 |
+- long res = 0; |
8861 |
++ unsigned long res = 0; |
8862 |
+ |
8863 |
+ /* |
8864 |
+ * Truncate 'max' to the user-specified limit, so that |
8865 |
+diff --git a/lib/strnlen_user.c b/lib/strnlen_user.c |
8866 |
+index 60d0bbda8f5e..184f80f7bacf 100644 |
8867 |
+--- a/lib/strnlen_user.c |
8868 |
++++ b/lib/strnlen_user.c |
8869 |
+@@ -28,7 +28,7 @@ |
8870 |
+ static inline long do_strnlen_user(const char __user *src, unsigned long count, unsigned long max) |
8871 |
+ { |
8872 |
+ const struct word_at_a_time constants = WORD_AT_A_TIME_CONSTANTS; |
8873 |
+- long align, res = 0; |
8874 |
++ unsigned long align, res = 0; |
8875 |
+ unsigned long c; |
8876 |
+ |
8877 |
+ /* |
8878 |
+@@ -42,7 +42,7 @@ static inline long do_strnlen_user(const char __user *src, unsigned long count, |
8879 |
+ * Do everything aligned. But that means that we |
8880 |
+ * need to also expand the maximum.. |
8881 |
+ */ |
8882 |
+- align = (sizeof(long) - 1) & (unsigned long)src; |
8883 |
++ align = (sizeof(unsigned long) - 1) & (unsigned long)src; |
8884 |
+ src -= align; |
8885 |
+ max += align; |
8886 |
+ |
8887 |
+diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c |
8888 |
+index a60bacf7120b..2895e3b26e93 100644 |
8889 |
+--- a/net/batman-adv/distributed-arp-table.c |
8890 |
++++ b/net/batman-adv/distributed-arp-table.c |
8891 |
+@@ -1394,7 +1394,6 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, |
8892 |
+ hw_src, &ip_src, hw_dst, &ip_dst, |
8893 |
+ dat_entry->mac_addr, &dat_entry->ip); |
8894 |
+ dropped = true; |
8895 |
+- goto out; |
8896 |
+ } |
8897 |
+ |
8898 |
+ /* Update our internal cache with both the IP addresses the node got |
8899 |
+@@ -1403,6 +1402,9 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, |
8900 |
+ batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid); |
8901 |
+ batadv_dat_entry_add(bat_priv, ip_dst, hw_dst, vid); |
8902 |
+ |
8903 |
++ if (dropped) |
8904 |
++ goto out; |
8905 |
++ |
8906 |
+ /* If BLA is enabled, only forward ARP replies if we have claimed the |
8907 |
+ * source of the ARP reply or if no one else of the same backbone has |
8908 |
+ * already claimed that client. This prevents that different gateways |
8909 |
+diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c |
8910 |
+index 69c0d85bceb3..79b8a2d8793e 100644 |
8911 |
+--- a/net/batman-adv/main.c |
8912 |
++++ b/net/batman-adv/main.c |
8913 |
+@@ -160,6 +160,7 @@ int batadv_mesh_init(struct net_device *soft_iface) |
8914 |
+ spin_lock_init(&bat_priv->tt.commit_lock); |
8915 |
+ spin_lock_init(&bat_priv->gw.list_lock); |
8916 |
+ #ifdef CONFIG_BATMAN_ADV_MCAST |
8917 |
++ spin_lock_init(&bat_priv->mcast.mla_lock); |
8918 |
+ spin_lock_init(&bat_priv->mcast.want_lists_lock); |
8919 |
+ #endif |
8920 |
+ spin_lock_init(&bat_priv->tvlv.container_list_lock); |
8921 |
+diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c |
8922 |
+index 86725d792e15..b90fe25d6b0b 100644 |
8923 |
+--- a/net/batman-adv/multicast.c |
8924 |
++++ b/net/batman-adv/multicast.c |
8925 |
+@@ -325,8 +325,6 @@ static void batadv_mcast_mla_list_free(struct hlist_head *mcast_list) |
8926 |
+ * translation table except the ones listed in the given mcast_list. |
8927 |
+ * |
8928 |
+ * If mcast_list is NULL then all are retracted. |
8929 |
+- * |
8930 |
+- * Do not call outside of the mcast worker! (or cancel mcast worker first) |
8931 |
+ */ |
8932 |
+ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
8933 |
+ struct hlist_head *mcast_list) |
8934 |
+@@ -334,8 +332,6 @@ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
8935 |
+ struct batadv_hw_addr *mcast_entry; |
8936 |
+ struct hlist_node *tmp; |
8937 |
+ |
8938 |
+- WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); |
8939 |
+- |
8940 |
+ hlist_for_each_entry_safe(mcast_entry, tmp, &bat_priv->mcast.mla_list, |
8941 |
+ list) { |
8942 |
+ if (mcast_list && |
8943 |
+@@ -359,8 +355,6 @@ static void batadv_mcast_mla_tt_retract(struct batadv_priv *bat_priv, |
8944 |
+ * |
8945 |
+ * Adds multicast listener announcements from the given mcast_list to the |
8946 |
+ * translation table if they have not been added yet. |
8947 |
+- * |
8948 |
+- * Do not call outside of the mcast worker! (or cancel mcast worker first) |
8949 |
+ */ |
8950 |
+ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, |
8951 |
+ struct hlist_head *mcast_list) |
8952 |
+@@ -368,8 +362,6 @@ static void batadv_mcast_mla_tt_add(struct batadv_priv *bat_priv, |
8953 |
+ struct batadv_hw_addr *mcast_entry; |
8954 |
+ struct hlist_node *tmp; |
8955 |
+ |
8956 |
+- WARN_ON(delayed_work_pending(&bat_priv->mcast.work)); |
8957 |
+- |
8958 |
+ if (!mcast_list) |
8959 |
+ return; |
8960 |
+ |
8961 |
+@@ -658,7 +650,10 @@ static void batadv_mcast_mla_update(struct work_struct *work) |
8962 |
+ priv_mcast = container_of(delayed_work, struct batadv_priv_mcast, work); |
8963 |
+ bat_priv = container_of(priv_mcast, struct batadv_priv, mcast); |
8964 |
+ |
8965 |
++ spin_lock(&bat_priv->mcast.mla_lock); |
8966 |
+ __batadv_mcast_mla_update(bat_priv); |
8967 |
++ spin_unlock(&bat_priv->mcast.mla_lock); |
8968 |
++ |
8969 |
+ batadv_mcast_start_timer(bat_priv); |
8970 |
+ } |
8971 |
+ |
8972 |
+diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h |
8973 |
+index 343d304851a5..eeee3e61c625 100644 |
8974 |
+--- a/net/batman-adv/types.h |
8975 |
++++ b/net/batman-adv/types.h |
8976 |
+@@ -1215,6 +1215,11 @@ struct batadv_priv_mcast { |
8977 |
+ /** @bridged: whether the soft interface has a bridge on top */ |
8978 |
+ unsigned char bridged:1; |
8979 |
+ |
8980 |
++ /** |
8981 |
++ * @mla_lock: a lock protecting mla_list and mla_flags |
8982 |
++ */ |
8983 |
++ spinlock_t mla_lock; |
8984 |
++ |
8985 |
+ /** |
8986 |
+ * @num_want_all_unsnoopables: number of nodes wanting unsnoopable IP |
8987 |
+ * traffic |
8988 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
8989 |
+index a06f03047717..5afd67ef797a 100644 |
8990 |
+--- a/net/bluetooth/hci_core.c |
8991 |
++++ b/net/bluetooth/hci_core.c |
8992 |
+@@ -4274,6 +4274,9 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status, |
8993 |
+ return; |
8994 |
+ } |
8995 |
+ |
8996 |
++ /* If we reach this point this event matches the last command sent */ |
8997 |
++ hci_dev_clear_flag(hdev, HCI_CMD_PENDING); |
8998 |
++ |
8999 |
+ /* If the command succeeded and there's still more commands in |
9000 |
+ * this request the request is not yet complete. |
9001 |
+ */ |
9002 |
+@@ -4384,6 +4387,8 @@ static void hci_cmd_work(struct work_struct *work) |
9003 |
+ |
9004 |
+ hdev->sent_cmd = skb_clone(skb, GFP_KERNEL); |
9005 |
+ if (hdev->sent_cmd) { |
9006 |
++ if (hci_req_status_pend(hdev)) |
9007 |
++ hci_dev_set_flag(hdev, HCI_CMD_PENDING); |
9008 |
+ atomic_dec(&hdev->cmd_cnt); |
9009 |
+ hci_send_frame(hdev, skb); |
9010 |
+ if (test_bit(HCI_RESET, &hdev->flags)) |
9011 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
9012 |
+index 7f800c3480f7..3e7badb3ac2d 100644 |
9013 |
+--- a/net/bluetooth/hci_event.c |
9014 |
++++ b/net/bluetooth/hci_event.c |
9015 |
+@@ -3357,6 +3357,12 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, |
9016 |
+ hci_req_cmd_complete(hdev, *opcode, *status, req_complete, |
9017 |
+ req_complete_skb); |
9018 |
+ |
9019 |
++ if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { |
9020 |
++ bt_dev_err(hdev, |
9021 |
++ "unexpected event for opcode 0x%4.4x", *opcode); |
9022 |
++ return; |
9023 |
++ } |
9024 |
++ |
9025 |
+ if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) |
9026 |
+ queue_work(hdev->workqueue, &hdev->cmd_work); |
9027 |
+ } |
9028 |
+@@ -3464,6 +3470,12 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb, |
9029 |
+ hci_req_cmd_complete(hdev, *opcode, ev->status, req_complete, |
9030 |
+ req_complete_skb); |
9031 |
+ |
9032 |
++ if (hci_dev_test_flag(hdev, HCI_CMD_PENDING)) { |
9033 |
++ bt_dev_err(hdev, |
9034 |
++ "unexpected event for opcode 0x%4.4x", *opcode); |
9035 |
++ return; |
9036 |
++ } |
9037 |
++ |
9038 |
+ if (atomic_read(&hdev->cmd_cnt) && !skb_queue_empty(&hdev->cmd_q)) |
9039 |
+ queue_work(hdev->workqueue, &hdev->cmd_work); |
9040 |
+ } |
9041 |
+diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c |
9042 |
+index e8c9ef1e1922..9448ebd3780a 100644 |
9043 |
+--- a/net/bluetooth/hci_request.c |
9044 |
++++ b/net/bluetooth/hci_request.c |
9045 |
+@@ -46,6 +46,11 @@ void hci_req_purge(struct hci_request *req) |
9046 |
+ skb_queue_purge(&req->cmd_q); |
9047 |
+ } |
9048 |
+ |
9049 |
++bool hci_req_status_pend(struct hci_dev *hdev) |
9050 |
++{ |
9051 |
++ return hdev->req_status == HCI_REQ_PEND; |
9052 |
++} |
9053 |
++ |
9054 |
+ static int req_run(struct hci_request *req, hci_req_complete_t complete, |
9055 |
+ hci_req_complete_skb_t complete_skb) |
9056 |
+ { |
9057 |
+diff --git a/net/bluetooth/hci_request.h b/net/bluetooth/hci_request.h |
9058 |
+index 692cc8b13368..55b2050cc9ff 100644 |
9059 |
+--- a/net/bluetooth/hci_request.h |
9060 |
++++ b/net/bluetooth/hci_request.h |
9061 |
+@@ -37,6 +37,7 @@ struct hci_request { |
9062 |
+ |
9063 |
+ void hci_req_init(struct hci_request *req, struct hci_dev *hdev); |
9064 |
+ void hci_req_purge(struct hci_request *req); |
9065 |
++bool hci_req_status_pend(struct hci_dev *hdev); |
9066 |
+ int hci_req_run(struct hci_request *req, hci_req_complete_t complete); |
9067 |
+ int hci_req_run_skb(struct hci_request *req, hci_req_complete_skb_t complete); |
9068 |
+ void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, |
9069 |
+diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c |
9070 |
+index b1a2c5e38530..37b4667128a3 100644 |
9071 |
+--- a/net/core/sysctl_net_core.c |
9072 |
++++ b/net/core/sysctl_net_core.c |
9073 |
+@@ -279,7 +279,6 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write, |
9074 |
+ return ret; |
9075 |
+ } |
9076 |
+ |
9077 |
+-# ifdef CONFIG_HAVE_EBPF_JIT |
9078 |
+ static int |
9079 |
+ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
9080 |
+ void __user *buffer, size_t *lenp, |
9081 |
+@@ -290,7 +289,6 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write, |
9082 |
+ |
9083 |
+ return proc_dointvec_minmax(table, write, buffer, lenp, ppos); |
9084 |
+ } |
9085 |
+-# endif |
9086 |
+ #endif |
9087 |
+ |
9088 |
+ static struct ctl_table net_core_table[] = { |
9089 |
+@@ -397,6 +395,14 @@ static struct ctl_table net_core_table[] = { |
9090 |
+ .extra2 = &one, |
9091 |
+ }, |
9092 |
+ # endif |
9093 |
++ { |
9094 |
++ .procname = "bpf_jit_limit", |
9095 |
++ .data = &bpf_jit_limit, |
9096 |
++ .maxlen = sizeof(int), |
9097 |
++ .mode = 0600, |
9098 |
++ .proc_handler = proc_dointvec_minmax_bpf_restricted, |
9099 |
++ .extra1 = &one, |
9100 |
++ }, |
9101 |
+ #endif |
9102 |
+ { |
9103 |
+ .procname = "netdev_tstamp_prequeue", |
9104 |
+diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
9105 |
+index 3dbecae4be73..2ac749c4a6b2 100644 |
9106 |
+--- a/net/mac80211/mlme.c |
9107 |
++++ b/net/mac80211/mlme.c |
9108 |
+@@ -1156,9 +1156,6 @@ static void ieee80211_chswitch_work(struct work_struct *work) |
9109 |
+ goto out; |
9110 |
+ } |
9111 |
+ |
9112 |
+- /* XXX: shouldn't really modify cfg80211-owned data! */ |
9113 |
+- ifmgd->associated->channel = sdata->csa_chandef.chan; |
9114 |
+- |
9115 |
+ ifmgd->csa_waiting_bcn = true; |
9116 |
+ |
9117 |
+ ieee80211_sta_reset_beacon_monitor(sdata); |
9118 |
+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
9119 |
+index 048e004ed0ee..c6711ead5e59 100644 |
9120 |
+--- a/net/wireless/nl80211.c |
9121 |
++++ b/net/wireless/nl80211.c |
9122 |
+@@ -15441,6 +15441,11 @@ void cfg80211_ch_switch_notify(struct net_device *dev, |
9123 |
+ |
9124 |
+ wdev->chandef = *chandef; |
9125 |
+ wdev->preset_chandef = *chandef; |
9126 |
++ |
9127 |
++ if (wdev->iftype == NL80211_IFTYPE_STATION && |
9128 |
++ !WARN_ON(!wdev->current_bss)) |
9129 |
++ wdev->current_bss->pub.channel = chandef->chan; |
9130 |
++ |
9131 |
+ nl80211_ch_switch_notify(rdev, dev, chandef, GFP_KERNEL, |
9132 |
+ NL80211_CMD_CH_SWITCH_NOTIFY, 0); |
9133 |
+ } |
9134 |
+diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c |
9135 |
+index 186e727b737b..6fd9954e1c08 100644 |
9136 |
+--- a/security/selinux/netlabel.c |
9137 |
++++ b/security/selinux/netlabel.c |
9138 |
+@@ -288,11 +288,8 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, |
9139 |
+ int rc; |
9140 |
+ struct netlbl_lsm_secattr secattr; |
9141 |
+ struct sk_security_struct *sksec = ep->base.sk->sk_security; |
9142 |
+- struct sockaddr *addr; |
9143 |
+ struct sockaddr_in addr4; |
9144 |
+-#if IS_ENABLED(CONFIG_IPV6) |
9145 |
+ struct sockaddr_in6 addr6; |
9146 |
+-#endif |
9147 |
+ |
9148 |
+ if (ep->base.sk->sk_family != PF_INET && |
9149 |
+ ep->base.sk->sk_family != PF_INET6) |
9150 |
+@@ -310,16 +307,15 @@ int selinux_netlbl_sctp_assoc_request(struct sctp_endpoint *ep, |
9151 |
+ if (ip_hdr(skb)->version == 4) { |
9152 |
+ addr4.sin_family = AF_INET; |
9153 |
+ addr4.sin_addr.s_addr = ip_hdr(skb)->saddr; |
9154 |
+- addr = (struct sockaddr *)&addr4; |
9155 |
+-#if IS_ENABLED(CONFIG_IPV6) |
9156 |
+- } else { |
9157 |
++ rc = netlbl_conn_setattr(ep->base.sk, (void *)&addr4, &secattr); |
9158 |
++ } else if (IS_ENABLED(CONFIG_IPV6) && ip_hdr(skb)->version == 6) { |
9159 |
+ addr6.sin6_family = AF_INET6; |
9160 |
+ addr6.sin6_addr = ipv6_hdr(skb)->saddr; |
9161 |
+- addr = (struct sockaddr *)&addr6; |
9162 |
+-#endif |
9163 |
++ rc = netlbl_conn_setattr(ep->base.sk, (void *)&addr6, &secattr); |
9164 |
++ } else { |
9165 |
++ rc = -EAFNOSUPPORT; |
9166 |
+ } |
9167 |
+ |
9168 |
+- rc = netlbl_conn_setattr(ep->base.sk, addr, &secattr); |
9169 |
+ if (rc == 0) |
9170 |
+ sksec->nlbl_state = NLBL_LABELED; |
9171 |
+ |
9172 |
+diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c |
9173 |
+index d5f73c837281..7994e8ddc7d2 100644 |
9174 |
+--- a/sound/soc/codecs/hdmi-codec.c |
9175 |
++++ b/sound/soc/codecs/hdmi-codec.c |
9176 |
+@@ -439,8 +439,12 @@ static int hdmi_codec_startup(struct snd_pcm_substream *substream, |
9177 |
+ if (!ret) { |
9178 |
+ ret = snd_pcm_hw_constraint_eld(substream->runtime, |
9179 |
+ hcp->eld); |
9180 |
+- if (ret) |
9181 |
++ if (ret) { |
9182 |
++ mutex_lock(&hcp->current_stream_lock); |
9183 |
++ hcp->current_stream = NULL; |
9184 |
++ mutex_unlock(&hcp->current_stream_lock); |
9185 |
+ return ret; |
9186 |
++ } |
9187 |
+ } |
9188 |
+ /* Select chmap supported */ |
9189 |
+ hdmi_codec_eld_chmap(hcp); |
9190 |
+diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c |
9191 |
+index f70db8412c7c..160b2764b2ad 100644 |
9192 |
+--- a/sound/soc/davinci/davinci-mcasp.c |
9193 |
++++ b/sound/soc/davinci/davinci-mcasp.c |
9194 |
+@@ -43,6 +43,7 @@ |
9195 |
+ |
9196 |
+ #define MCASP_MAX_AFIFO_DEPTH 64 |
9197 |
+ |
9198 |
++#ifdef CONFIG_PM |
9199 |
+ static u32 context_regs[] = { |
9200 |
+ DAVINCI_MCASP_TXFMCTL_REG, |
9201 |
+ DAVINCI_MCASP_RXFMCTL_REG, |
9202 |
+@@ -65,6 +66,7 @@ struct davinci_mcasp_context { |
9203 |
+ u32 *xrsr_regs; /* for serializer configuration */ |
9204 |
+ bool pm_state; |
9205 |
+ }; |
9206 |
++#endif |
9207 |
+ |
9208 |
+ struct davinci_mcasp_ruledata { |
9209 |
+ struct davinci_mcasp *mcasp; |
9210 |
+diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig |
9211 |
+index 2e75b5bc5f1d..f721cd4e3f97 100644 |
9212 |
+--- a/sound/soc/fsl/Kconfig |
9213 |
++++ b/sound/soc/fsl/Kconfig |
9214 |
+@@ -173,16 +173,17 @@ config SND_MPC52xx_SOC_EFIKA |
9215 |
+ |
9216 |
+ endif # SND_POWERPC_SOC |
9217 |
+ |
9218 |
++config SND_SOC_IMX_PCM_FIQ |
9219 |
++ tristate |
9220 |
++ default y if SND_SOC_IMX_SSI=y && (SND_SOC_FSL_SSI=m || SND_SOC_FSL_SPDIF=m) && (MXC_TZIC || MXC_AVIC) |
9221 |
++ select FIQ |
9222 |
++ |
9223 |
+ if SND_IMX_SOC |
9224 |
+ |
9225 |
+ config SND_SOC_IMX_SSI |
9226 |
+ tristate |
9227 |
+ select SND_SOC_FSL_UTILS |
9228 |
+ |
9229 |
+-config SND_SOC_IMX_PCM_FIQ |
9230 |
+- tristate |
9231 |
+- select FIQ |
9232 |
+- |
9233 |
+ comment "SoC Audio support for Freescale i.MX boards:" |
9234 |
+ |
9235 |
+ config SND_MXC_SOC_WM1133_EV1 |
9236 |
+diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c |
9237 |
+index 191426a6d9ad..30a3d68b5c03 100644 |
9238 |
+--- a/sound/soc/fsl/eukrea-tlv320.c |
9239 |
++++ b/sound/soc/fsl/eukrea-tlv320.c |
9240 |
+@@ -118,13 +118,13 @@ static int eukrea_tlv320_probe(struct platform_device *pdev) |
9241 |
+ if (ret) { |
9242 |
+ dev_err(&pdev->dev, |
9243 |
+ "fsl,mux-int-port node missing or invalid.\n"); |
9244 |
+- return ret; |
9245 |
++ goto err; |
9246 |
+ } |
9247 |
+ ret = of_property_read_u32(np, "fsl,mux-ext-port", &ext_port); |
9248 |
+ if (ret) { |
9249 |
+ dev_err(&pdev->dev, |
9250 |
+ "fsl,mux-ext-port node missing or invalid.\n"); |
9251 |
+- return ret; |
9252 |
++ goto err; |
9253 |
+ } |
9254 |
+ |
9255 |
+ /* |
9256 |
+diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c |
9257 |
+index 4163f2cfc06f..bfc5b21d0c3f 100644 |
9258 |
+--- a/sound/soc/fsl/fsl_sai.c |
9259 |
++++ b/sound/soc/fsl/fsl_sai.c |
9260 |
+@@ -268,12 +268,14 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, |
9261 |
+ case SND_SOC_DAIFMT_CBS_CFS: |
9262 |
+ val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
9263 |
+ val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
9264 |
++ sai->is_slave_mode = false; |
9265 |
+ break; |
9266 |
+ case SND_SOC_DAIFMT_CBM_CFM: |
9267 |
+ sai->is_slave_mode = true; |
9268 |
+ break; |
9269 |
+ case SND_SOC_DAIFMT_CBS_CFM: |
9270 |
+ val_cr2 |= FSL_SAI_CR2_BCD_MSTR; |
9271 |
++ sai->is_slave_mode = false; |
9272 |
+ break; |
9273 |
+ case SND_SOC_DAIFMT_CBM_CFS: |
9274 |
+ val_cr4 |= FSL_SAI_CR4_FSD_MSTR; |
9275 |
+diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c |
9276 |
+index 7f0fa4b52223..cca33ab7020a 100644 |
9277 |
+--- a/sound/soc/fsl/fsl_utils.c |
9278 |
++++ b/sound/soc/fsl/fsl_utils.c |
9279 |
+@@ -71,6 +71,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, |
9280 |
+ iprop = of_get_property(dma_np, "cell-index", NULL); |
9281 |
+ if (!iprop) { |
9282 |
+ of_node_put(dma_np); |
9283 |
++ of_node_put(dma_channel_np); |
9284 |
+ return -EINVAL; |
9285 |
+ } |
9286 |
+ *dma_id = be32_to_cpup(iprop); |
9287 |
+diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c |
9288 |
+index 38f6ab74709d..07491a0f8fb8 100644 |
9289 |
+--- a/sound/soc/intel/boards/kbl_da7219_max98357a.c |
9290 |
++++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c |
9291 |
+@@ -188,7 +188,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) |
9292 |
+ |
9293 |
+ jack = &ctx->kabylake_headset; |
9294 |
+ |
9295 |
+- snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_MEDIA); |
9296 |
++ snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); |
9297 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); |
9298 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); |
9299 |
+ snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); |
9300 |
+diff --git a/tools/bpf/bpftool/.gitignore b/tools/bpf/bpftool/.gitignore |
9301 |
+index 67167e44b726..8248b8dd89d4 100644 |
9302 |
+--- a/tools/bpf/bpftool/.gitignore |
9303 |
++++ b/tools/bpf/bpftool/.gitignore |
9304 |
+@@ -1,5 +1,5 @@ |
9305 |
+ *.d |
9306 |
+-bpftool |
9307 |
++/bpftool |
9308 |
+ bpftool*.8 |
9309 |
+ bpf-helpers.* |
9310 |
+ FEATURE-DUMP.bpftool |
9311 |
+diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c |
9312 |
+index 7a0014794bff..dd0b68d1f4be 100644 |
9313 |
+--- a/tools/lib/bpf/bpf.c |
9314 |
++++ b/tools/lib/bpf/bpf.c |
9315 |
+@@ -53,6 +53,8 @@ |
9316 |
+ # define __NR_bpf 349 |
9317 |
+ # elif defined(__s390__) |
9318 |
+ # define __NR_bpf 351 |
9319 |
++# elif defined(__arc__) |
9320 |
++# define __NR_bpf 280 |
9321 |
+ # else |
9322 |
+ # error __NR_bpf not defined. libbpf does not support your arch. |
9323 |
+ # endif |
9324 |
+diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h |
9325 |
+index 6f38164b2618..c3145ab3bdca 100644 |
9326 |
+--- a/tools/lib/bpf/bpf.h |
9327 |
++++ b/tools/lib/bpf/bpf.h |
9328 |
+@@ -26,6 +26,7 @@ |
9329 |
+ #include <linux/bpf.h> |
9330 |
+ #include <stdbool.h> |
9331 |
+ #include <stddef.h> |
9332 |
++#include <stdint.h> |
9333 |
+ |
9334 |
+ struct bpf_create_map_attr { |
9335 |
+ const char *name; |
9336 |
+diff --git a/tools/testing/selftests/bpf/test_libbpf_open.c b/tools/testing/selftests/bpf/test_libbpf_open.c |
9337 |
+index 8fcd1c076add..cbd55f5f8d59 100644 |
9338 |
+--- a/tools/testing/selftests/bpf/test_libbpf_open.c |
9339 |
++++ b/tools/testing/selftests/bpf/test_libbpf_open.c |
9340 |
+@@ -11,6 +11,8 @@ static const char *__doc__ = |
9341 |
+ #include <bpf/libbpf.h> |
9342 |
+ #include <getopt.h> |
9343 |
+ |
9344 |
++#include "bpf_rlimit.h" |
9345 |
++ |
9346 |
+ static const struct option long_options[] = { |
9347 |
+ {"help", no_argument, NULL, 'h' }, |
9348 |
+ {"debug", no_argument, NULL, 'D' }, |
9349 |
+diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c |
9350 |
+index cabe2a3a3b30..cf156b353679 100644 |
9351 |
+--- a/tools/testing/selftests/bpf/trace_helpers.c |
9352 |
++++ b/tools/testing/selftests/bpf/trace_helpers.c |
9353 |
+@@ -51,6 +51,10 @@ struct ksym *ksym_search(long key) |
9354 |
+ int start = 0, end = sym_cnt; |
9355 |
+ int result; |
9356 |
+ |
9357 |
++ /* kallsyms not loaded. return NULL */ |
9358 |
++ if (sym_cnt <= 0) |
9359 |
++ return NULL; |
9360 |
++ |
9361 |
+ while (start < end) { |
9362 |
+ size_t mid = start + (end - start) / 2; |
9363 |
+ |
9364 |
+diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c |
9365 |
+index 28d321ba311b..6f339882a6ca 100644 |
9366 |
+--- a/tools/testing/selftests/cgroup/test_memcontrol.c |
9367 |
++++ b/tools/testing/selftests/cgroup/test_memcontrol.c |
9368 |
+@@ -26,7 +26,7 @@ |
9369 |
+ */ |
9370 |
+ static int test_memcg_subtree_control(const char *root) |
9371 |
+ { |
9372 |
+- char *parent, *child, *parent2, *child2; |
9373 |
++ char *parent, *child, *parent2 = NULL, *child2 = NULL; |
9374 |
+ int ret = KSFT_FAIL; |
9375 |
+ char buf[PAGE_SIZE]; |
9376 |
+ |
9377 |
+@@ -34,50 +34,54 @@ static int test_memcg_subtree_control(const char *root) |
9378 |
+ parent = cg_name(root, "memcg_test_0"); |
9379 |
+ child = cg_name(root, "memcg_test_0/memcg_test_1"); |
9380 |
+ if (!parent || !child) |
9381 |
+- goto cleanup; |
9382 |
++ goto cleanup_free; |
9383 |
+ |
9384 |
+ if (cg_create(parent)) |
9385 |
+- goto cleanup; |
9386 |
++ goto cleanup_free; |
9387 |
+ |
9388 |
+ if (cg_write(parent, "cgroup.subtree_control", "+memory")) |
9389 |
+- goto cleanup; |
9390 |
++ goto cleanup_parent; |
9391 |
+ |
9392 |
+ if (cg_create(child)) |
9393 |
+- goto cleanup; |
9394 |
++ goto cleanup_parent; |
9395 |
+ |
9396 |
+ if (cg_read_strstr(child, "cgroup.controllers", "memory")) |
9397 |
+- goto cleanup; |
9398 |
++ goto cleanup_child; |
9399 |
+ |
9400 |
+ /* Create two nested cgroups without enabling memory controller */ |
9401 |
+ parent2 = cg_name(root, "memcg_test_1"); |
9402 |
+ child2 = cg_name(root, "memcg_test_1/memcg_test_1"); |
9403 |
+ if (!parent2 || !child2) |
9404 |
+- goto cleanup; |
9405 |
++ goto cleanup_free2; |
9406 |
+ |
9407 |
+ if (cg_create(parent2)) |
9408 |
+- goto cleanup; |
9409 |
++ goto cleanup_free2; |
9410 |
+ |
9411 |
+ if (cg_create(child2)) |
9412 |
+- goto cleanup; |
9413 |
++ goto cleanup_parent2; |
9414 |
+ |
9415 |
+ if (cg_read(child2, "cgroup.controllers", buf, sizeof(buf))) |
9416 |
+- goto cleanup; |
9417 |
++ goto cleanup_all; |
9418 |
+ |
9419 |
+ if (!cg_read_strstr(child2, "cgroup.controllers", "memory")) |
9420 |
+- goto cleanup; |
9421 |
++ goto cleanup_all; |
9422 |
+ |
9423 |
+ ret = KSFT_PASS; |
9424 |
+ |
9425 |
+-cleanup: |
9426 |
+- cg_destroy(child); |
9427 |
+- cg_destroy(parent); |
9428 |
+- free(parent); |
9429 |
+- free(child); |
9430 |
+- |
9431 |
++cleanup_all: |
9432 |
+ cg_destroy(child2); |
9433 |
++cleanup_parent2: |
9434 |
+ cg_destroy(parent2); |
9435 |
++cleanup_free2: |
9436 |
+ free(parent2); |
9437 |
+ free(child2); |
9438 |
++cleanup_child: |
9439 |
++ cg_destroy(child); |
9440 |
++cleanup_parent: |
9441 |
++ cg_destroy(parent); |
9442 |
++cleanup_free: |
9443 |
++ free(parent); |
9444 |
++ free(child); |
9445 |
+ |
9446 |
+ return ret; |
9447 |
+ } |