1 |
commit: f1eb05238e10533a9d19fdfc1e4cc99acfa0e9ee |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 15 12:00:42 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 15 12:00:42 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=f1eb0523 |
7 |
|
8 |
Linux patch 5.4.146 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1145_linux-5.4.146.patch | 5068 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 5072 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 0712ff5..f0cfe0c 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -623,6 +623,10 @@ Patch: 1144_linux-5.4.145.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.4.145 |
23 |
|
24 |
+Patch: 1145_linux-5.4.146.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.4.146 |
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/1145_linux-5.4.146.patch b/1145_linux-5.4.146.patch |
33 |
new file mode 100644 |
34 |
index 0000000..c7ea7f7 |
35 |
--- /dev/null |
36 |
+++ b/1145_linux-5.4.146.patch |
37 |
@@ -0,0 +1,5068 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index c32a36c8ffc90..48d0c03acfc55 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 4 |
46 |
+-SUBLEVEL = 145 |
47 |
++SUBLEVEL = 146 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Kleptomaniac Octopus |
50 |
+ |
51 |
+diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi |
52 |
+index 5b8bf58e89cb4..996e006e06c25 100644 |
53 |
+--- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi |
54 |
++++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi |
55 |
+@@ -208,12 +208,12 @@ |
56 |
+ }; |
57 |
+ |
58 |
+ pinctrl_hvi3c3_default: hvi3c3_default { |
59 |
+- function = "HVI3C3"; |
60 |
++ function = "I3C3"; |
61 |
+ groups = "HVI3C3"; |
62 |
+ }; |
63 |
+ |
64 |
+ pinctrl_hvi3c4_default: hvi3c4_default { |
65 |
+- function = "HVI3C4"; |
66 |
++ function = "I3C4"; |
67 |
+ groups = "HVI3C4"; |
68 |
+ }; |
69 |
+ |
70 |
+diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi |
71 |
+index 3efe9d41c2bb6..d7c9dbee0f016 100644 |
72 |
+--- a/arch/arm/boot/dts/meson8.dtsi |
73 |
++++ b/arch/arm/boot/dts/meson8.dtsi |
74 |
+@@ -241,8 +241,13 @@ |
75 |
+ "pp2", "ppmmu2", "pp4", "ppmmu4", |
76 |
+ "pp5", "ppmmu5", "pp6", "ppmmu6"; |
77 |
+ resets = <&reset RESET_MALI>; |
78 |
++ |
79 |
+ clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>; |
80 |
+ clock-names = "bus", "core"; |
81 |
++ |
82 |
++ assigned-clocks = <&clkc CLKID_MALI>; |
83 |
++ assigned-clock-rates = <318750000>; |
84 |
++ |
85 |
+ operating-points-v2 = <&gpu_opp_table>; |
86 |
+ }; |
87 |
+ }; |
88 |
+diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts |
89 |
+index bed1dfef19857..32d1c322dbc65 100644 |
90 |
+--- a/arch/arm/boot/dts/meson8b-ec100.dts |
91 |
++++ b/arch/arm/boot/dts/meson8b-ec100.dts |
92 |
+@@ -148,7 +148,7 @@ |
93 |
+ regulator-min-microvolt = <860000>; |
94 |
+ regulator-max-microvolt = <1140000>; |
95 |
+ |
96 |
+- vin-supply = <&vcc_5v>; |
97 |
++ pwm-supply = <&vcc_5v>; |
98 |
+ |
99 |
+ pwms = <&pwm_cd 0 1148 0>; |
100 |
+ pwm-dutycycle-range = <100 0>; |
101 |
+@@ -232,7 +232,7 @@ |
102 |
+ regulator-min-microvolt = <860000>; |
103 |
+ regulator-max-microvolt = <1140000>; |
104 |
+ |
105 |
+- vin-supply = <&vcc_5v>; |
106 |
++ pwm-supply = <&vcc_5v>; |
107 |
+ |
108 |
+ pwms = <&pwm_cd 1 1148 0>; |
109 |
+ pwm-dutycycle-range = <100 0>; |
110 |
+diff --git a/arch/arm/boot/dts/meson8b-mxq.dts b/arch/arm/boot/dts/meson8b-mxq.dts |
111 |
+index 6e39ad52e42d3..ab8fe55963f7c 100644 |
112 |
+--- a/arch/arm/boot/dts/meson8b-mxq.dts |
113 |
++++ b/arch/arm/boot/dts/meson8b-mxq.dts |
114 |
+@@ -39,6 +39,8 @@ |
115 |
+ regulator-min-microvolt = <860000>; |
116 |
+ regulator-max-microvolt = <1140000>; |
117 |
+ |
118 |
++ pwm-supply = <&vcc_5v>; |
119 |
++ |
120 |
+ pwms = <&pwm_cd 0 1148 0>; |
121 |
+ pwm-dutycycle-range = <100 0>; |
122 |
+ |
123 |
+@@ -84,7 +86,7 @@ |
124 |
+ regulator-min-microvolt = <860000>; |
125 |
+ regulator-max-microvolt = <1140000>; |
126 |
+ |
127 |
+- vin-supply = <&vcc_5v>; |
128 |
++ pwm-supply = <&vcc_5v>; |
129 |
+ |
130 |
+ pwms = <&pwm_cd 1 1148 0>; |
131 |
+ pwm-dutycycle-range = <100 0>; |
132 |
+diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts |
133 |
+index 0f9c71137bed5..c413af9a7af8e 100644 |
134 |
+--- a/arch/arm/boot/dts/meson8b-odroidc1.dts |
135 |
++++ b/arch/arm/boot/dts/meson8b-odroidc1.dts |
136 |
+@@ -130,7 +130,7 @@ |
137 |
+ regulator-min-microvolt = <860000>; |
138 |
+ regulator-max-microvolt = <1140000>; |
139 |
+ |
140 |
+- vin-supply = <&p5v0>; |
141 |
++ pwm-supply = <&p5v0>; |
142 |
+ |
143 |
+ pwms = <&pwm_cd 0 12218 0>; |
144 |
+ pwm-dutycycle-range = <91 0>; |
145 |
+@@ -162,7 +162,7 @@ |
146 |
+ regulator-min-microvolt = <860000>; |
147 |
+ regulator-max-microvolt = <1140000>; |
148 |
+ |
149 |
+- vin-supply = <&p5v0>; |
150 |
++ pwm-supply = <&p5v0>; |
151 |
+ |
152 |
+ pwms = <&pwm_cd 1 12218 0>; |
153 |
+ pwm-dutycycle-range = <91 0>; |
154 |
+diff --git a/arch/arm/net/bpf_jit_32.c b/arch/arm/net/bpf_jit_32.c |
155 |
+index 7216653424fd6..b51a8c7b01114 100644 |
156 |
+--- a/arch/arm/net/bpf_jit_32.c |
157 |
++++ b/arch/arm/net/bpf_jit_32.c |
158 |
+@@ -1602,6 +1602,9 @@ exit: |
159 |
+ rn = arm_bpf_get_reg32(src_lo, tmp2[1], ctx); |
160 |
+ emit_ldx_r(dst, rn, off, ctx, BPF_SIZE(code)); |
161 |
+ break; |
162 |
++ /* speculation barrier */ |
163 |
++ case BPF_ST | BPF_NOSPEC: |
164 |
++ break; |
165 |
+ /* ST: *(size *)(dst + off) = imm */ |
166 |
+ case BPF_ST | BPF_MEM | BPF_W: |
167 |
+ case BPF_ST | BPF_MEM | BPF_H: |
168 |
+diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
169 |
+index 25549d9552ae2..84f92b44c3235 100644 |
170 |
+--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi |
171 |
++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
172 |
+@@ -113,7 +113,7 @@ |
173 |
+ #address-cells = <0>; |
174 |
+ interrupt-controller; |
175 |
+ reg = <0x11001000 0x1000>, |
176 |
+- <0x11002000 0x1000>, |
177 |
++ <0x11002000 0x2000>, |
178 |
+ <0x11004000 0x2000>, |
179 |
+ <0x11006000 0x2000>; |
180 |
+ }; |
181 |
+diff --git a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts |
182 |
+index 67634cb01d6b6..cbdd46ed3ca63 100644 |
183 |
+--- a/arch/arm64/boot/dts/renesas/r8a77995-draak.dts |
184 |
++++ b/arch/arm64/boot/dts/renesas/r8a77995-draak.dts |
185 |
+@@ -277,10 +277,6 @@ |
186 |
+ interrupt-parent = <&gpio1>; |
187 |
+ interrupts = <28 IRQ_TYPE_LEVEL_LOW>; |
188 |
+ |
189 |
+- /* Depends on LVDS */ |
190 |
+- max-clock = <135000000>; |
191 |
+- min-vrefresh = <50>; |
192 |
+- |
193 |
+ adi,input-depth = <8>; |
194 |
+ adi,input-colorspace = "rgb"; |
195 |
+ adi,input-clock = "1x"; |
196 |
+diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c |
197 |
+index 945e5f690edec..afc7d41347f73 100644 |
198 |
+--- a/arch/arm64/net/bpf_jit_comp.c |
199 |
++++ b/arch/arm64/net/bpf_jit_comp.c |
200 |
+@@ -701,6 +701,19 @@ emit_cond_jmp: |
201 |
+ } |
202 |
+ break; |
203 |
+ |
204 |
++ /* speculation barrier */ |
205 |
++ case BPF_ST | BPF_NOSPEC: |
206 |
++ /* |
207 |
++ * Nothing required here. |
208 |
++ * |
209 |
++ * In case of arm64, we rely on the firmware mitigation of |
210 |
++ * Speculative Store Bypass as controlled via the ssbd kernel |
211 |
++ * parameter. Whenever the mitigation is enabled, it works |
212 |
++ * for all of the kernel code with no need to provide any |
213 |
++ * additional instructions. |
214 |
++ */ |
215 |
++ break; |
216 |
++ |
217 |
+ /* ST: *(size *)(dst + off) = imm */ |
218 |
+ case BPF_ST | BPF_MEM | BPF_W: |
219 |
+ case BPF_ST | BPF_MEM | BPF_H: |
220 |
+diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c |
221 |
+index a4ebd2445edae..e5831cd293d05 100644 |
222 |
+--- a/arch/m68k/emu/nfeth.c |
223 |
++++ b/arch/m68k/emu/nfeth.c |
224 |
+@@ -254,8 +254,8 @@ static void __exit nfeth_cleanup(void) |
225 |
+ |
226 |
+ for (i = 0; i < MAX_UNIT; i++) { |
227 |
+ if (nfeth_dev[i]) { |
228 |
+- unregister_netdev(nfeth_dev[0]); |
229 |
+- free_netdev(nfeth_dev[0]); |
230 |
++ unregister_netdev(nfeth_dev[i]); |
231 |
++ free_netdev(nfeth_dev[i]); |
232 |
+ } |
233 |
+ } |
234 |
+ free_irq(nfEtherIRQ, nfeth_interrupt); |
235 |
+diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c |
236 |
+index 561154cbcc401..b31b91e57c341 100644 |
237 |
+--- a/arch/mips/net/ebpf_jit.c |
238 |
++++ b/arch/mips/net/ebpf_jit.c |
239 |
+@@ -1355,6 +1355,9 @@ jeq_common: |
240 |
+ } |
241 |
+ break; |
242 |
+ |
243 |
++ case BPF_ST | BPF_NOSPEC: /* speculation barrier */ |
244 |
++ break; |
245 |
++ |
246 |
+ case BPF_ST | BPF_B | BPF_MEM: |
247 |
+ case BPF_ST | BPF_H | BPF_MEM: |
248 |
+ case BPF_ST | BPF_W | BPF_MEM: |
249 |
+diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c |
250 |
+index be3517ef0574d..20bfd753bcba6 100644 |
251 |
+--- a/arch/powerpc/net/bpf_jit_comp64.c |
252 |
++++ b/arch/powerpc/net/bpf_jit_comp64.c |
253 |
+@@ -644,6 +644,12 @@ emit_clear: |
254 |
+ } |
255 |
+ break; |
256 |
+ |
257 |
++ /* |
258 |
++ * BPF_ST NOSPEC (speculation barrier) |
259 |
++ */ |
260 |
++ case BPF_ST | BPF_NOSPEC: |
261 |
++ break; |
262 |
++ |
263 |
+ /* |
264 |
+ * BPF_ST(X) |
265 |
+ */ |
266 |
+diff --git a/arch/riscv/net/bpf_jit_comp.c b/arch/riscv/net/bpf_jit_comp.c |
267 |
+index e2279fed8f564..0eefe6193253b 100644 |
268 |
+--- a/arch/riscv/net/bpf_jit_comp.c |
269 |
++++ b/arch/riscv/net/bpf_jit_comp.c |
270 |
+@@ -1313,6 +1313,10 @@ out_be: |
271 |
+ emit(rv_ld(rd, 0, RV_REG_T1), ctx); |
272 |
+ break; |
273 |
+ |
274 |
++ /* speculation barrier */ |
275 |
++ case BPF_ST | BPF_NOSPEC: |
276 |
++ break; |
277 |
++ |
278 |
+ /* ST: *(size *)(dst + off) = imm */ |
279 |
+ case BPF_ST | BPF_MEM | BPF_B: |
280 |
+ emit_imm(RV_REG_T1, imm, ctx); |
281 |
+diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h |
282 |
+index 0fe5600a037e4..4d59d11e6813d 100644 |
283 |
+--- a/arch/s390/include/asm/kvm_host.h |
284 |
++++ b/arch/s390/include/asm/kvm_host.h |
285 |
+@@ -873,6 +873,7 @@ struct kvm_arch{ |
286 |
+ atomic64_t cmma_dirty_pages; |
287 |
+ /* subset of available cpu features enabled by user space */ |
288 |
+ DECLARE_BITMAP(cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS); |
289 |
++ /* indexed by vcpu_idx */ |
290 |
+ DECLARE_BITMAP(idle_mask, KVM_MAX_VCPUS); |
291 |
+ struct kvm_s390_gisa_interrupt gisa_int; |
292 |
+ }; |
293 |
+diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c |
294 |
+index 7184d55d87aae..b1aadc3ad065d 100644 |
295 |
+--- a/arch/s390/kernel/debug.c |
296 |
++++ b/arch/s390/kernel/debug.c |
297 |
+@@ -327,24 +327,6 @@ static debug_info_t *debug_info_create(const char *name, int pages_per_area, |
298 |
+ goto out; |
299 |
+ |
300 |
+ rc->mode = mode & ~S_IFMT; |
301 |
+- |
302 |
+- /* create root directory */ |
303 |
+- rc->debugfs_root_entry = debugfs_create_dir(rc->name, |
304 |
+- debug_debugfs_root_entry); |
305 |
+- |
306 |
+- /* append new element to linked list */ |
307 |
+- if (!debug_area_first) { |
308 |
+- /* first element in list */ |
309 |
+- debug_area_first = rc; |
310 |
+- rc->prev = NULL; |
311 |
+- } else { |
312 |
+- /* append element to end of list */ |
313 |
+- debug_area_last->next = rc; |
314 |
+- rc->prev = debug_area_last; |
315 |
+- } |
316 |
+- debug_area_last = rc; |
317 |
+- rc->next = NULL; |
318 |
+- |
319 |
+ refcount_set(&rc->ref_count, 1); |
320 |
+ out: |
321 |
+ return rc; |
322 |
+@@ -404,27 +386,10 @@ static void debug_info_get(debug_info_t *db_info) |
323 |
+ */ |
324 |
+ static void debug_info_put(debug_info_t *db_info) |
325 |
+ { |
326 |
+- int i; |
327 |
+- |
328 |
+ if (!db_info) |
329 |
+ return; |
330 |
+- if (refcount_dec_and_test(&db_info->ref_count)) { |
331 |
+- for (i = 0; i < DEBUG_MAX_VIEWS; i++) { |
332 |
+- if (!db_info->views[i]) |
333 |
+- continue; |
334 |
+- debugfs_remove(db_info->debugfs_entries[i]); |
335 |
+- } |
336 |
+- debugfs_remove(db_info->debugfs_root_entry); |
337 |
+- if (db_info == debug_area_first) |
338 |
+- debug_area_first = db_info->next; |
339 |
+- if (db_info == debug_area_last) |
340 |
+- debug_area_last = db_info->prev; |
341 |
+- if (db_info->prev) |
342 |
+- db_info->prev->next = db_info->next; |
343 |
+- if (db_info->next) |
344 |
+- db_info->next->prev = db_info->prev; |
345 |
++ if (refcount_dec_and_test(&db_info->ref_count)) |
346 |
+ debug_info_free(db_info); |
347 |
+- } |
348 |
+ } |
349 |
+ |
350 |
+ /* |
351 |
+@@ -648,6 +613,31 @@ static int debug_close(struct inode *inode, struct file *file) |
352 |
+ return 0; /* success */ |
353 |
+ } |
354 |
+ |
355 |
++/* Create debugfs entries and add to internal list. */ |
356 |
++static void _debug_register(debug_info_t *id) |
357 |
++{ |
358 |
++ /* create root directory */ |
359 |
++ id->debugfs_root_entry = debugfs_create_dir(id->name, |
360 |
++ debug_debugfs_root_entry); |
361 |
++ |
362 |
++ /* append new element to linked list */ |
363 |
++ if (!debug_area_first) { |
364 |
++ /* first element in list */ |
365 |
++ debug_area_first = id; |
366 |
++ id->prev = NULL; |
367 |
++ } else { |
368 |
++ /* append element to end of list */ |
369 |
++ debug_area_last->next = id; |
370 |
++ id->prev = debug_area_last; |
371 |
++ } |
372 |
++ debug_area_last = id; |
373 |
++ id->next = NULL; |
374 |
++ |
375 |
++ debug_register_view(id, &debug_level_view); |
376 |
++ debug_register_view(id, &debug_flush_view); |
377 |
++ debug_register_view(id, &debug_pages_view); |
378 |
++} |
379 |
++ |
380 |
+ /** |
381 |
+ * debug_register_mode() - creates and initializes debug area. |
382 |
+ * |
383 |
+@@ -677,19 +667,16 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area, |
384 |
+ if ((uid != 0) || (gid != 0)) |
385 |
+ pr_warn("Root becomes the owner of all s390dbf files in sysfs\n"); |
386 |
+ BUG_ON(!initialized); |
387 |
+- mutex_lock(&debug_mutex); |
388 |
+ |
389 |
+ /* create new debug_info */ |
390 |
+ rc = debug_info_create(name, pages_per_area, nr_areas, buf_size, mode); |
391 |
+- if (!rc) |
392 |
+- goto out; |
393 |
+- debug_register_view(rc, &debug_level_view); |
394 |
+- debug_register_view(rc, &debug_flush_view); |
395 |
+- debug_register_view(rc, &debug_pages_view); |
396 |
+-out: |
397 |
+- if (!rc) |
398 |
++ if (rc) { |
399 |
++ mutex_lock(&debug_mutex); |
400 |
++ _debug_register(rc); |
401 |
++ mutex_unlock(&debug_mutex); |
402 |
++ } else { |
403 |
+ pr_err("Registering debug feature %s failed\n", name); |
404 |
+- mutex_unlock(&debug_mutex); |
405 |
++ } |
406 |
+ return rc; |
407 |
+ } |
408 |
+ EXPORT_SYMBOL(debug_register_mode); |
409 |
+@@ -718,6 +705,27 @@ debug_info_t *debug_register(const char *name, int pages_per_area, |
410 |
+ } |
411 |
+ EXPORT_SYMBOL(debug_register); |
412 |
+ |
413 |
++/* Remove debugfs entries and remove from internal list. */ |
414 |
++static void _debug_unregister(debug_info_t *id) |
415 |
++{ |
416 |
++ int i; |
417 |
++ |
418 |
++ for (i = 0; i < DEBUG_MAX_VIEWS; i++) { |
419 |
++ if (!id->views[i]) |
420 |
++ continue; |
421 |
++ debugfs_remove(id->debugfs_entries[i]); |
422 |
++ } |
423 |
++ debugfs_remove(id->debugfs_root_entry); |
424 |
++ if (id == debug_area_first) |
425 |
++ debug_area_first = id->next; |
426 |
++ if (id == debug_area_last) |
427 |
++ debug_area_last = id->prev; |
428 |
++ if (id->prev) |
429 |
++ id->prev->next = id->next; |
430 |
++ if (id->next) |
431 |
++ id->next->prev = id->prev; |
432 |
++} |
433 |
++ |
434 |
+ /** |
435 |
+ * debug_unregister() - give back debug area. |
436 |
+ * |
437 |
+@@ -731,8 +739,10 @@ void debug_unregister(debug_info_t *id) |
438 |
+ if (!id) |
439 |
+ return; |
440 |
+ mutex_lock(&debug_mutex); |
441 |
+- debug_info_put(id); |
442 |
++ _debug_unregister(id); |
443 |
+ mutex_unlock(&debug_mutex); |
444 |
++ |
445 |
++ debug_info_put(id); |
446 |
+ } |
447 |
+ EXPORT_SYMBOL(debug_unregister); |
448 |
+ |
449 |
+diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c |
450 |
+index 62388a678b91a..fa9483aa4f575 100644 |
451 |
+--- a/arch/s390/kvm/interrupt.c |
452 |
++++ b/arch/s390/kvm/interrupt.c |
453 |
+@@ -408,13 +408,13 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu) |
454 |
+ static void __set_cpu_idle(struct kvm_vcpu *vcpu) |
455 |
+ { |
456 |
+ kvm_s390_set_cpuflags(vcpu, CPUSTAT_WAIT); |
457 |
+- set_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask); |
458 |
++ set_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask); |
459 |
+ } |
460 |
+ |
461 |
+ static void __unset_cpu_idle(struct kvm_vcpu *vcpu) |
462 |
+ { |
463 |
+ kvm_s390_clear_cpuflags(vcpu, CPUSTAT_WAIT); |
464 |
+- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask); |
465 |
++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask); |
466 |
+ } |
467 |
+ |
468 |
+ static void __reset_intercept_indicators(struct kvm_vcpu *vcpu) |
469 |
+@@ -2984,18 +2984,18 @@ int kvm_s390_get_irq_state(struct kvm_vcpu *vcpu, __u8 __user *buf, int len) |
470 |
+ |
471 |
+ static void __airqs_kick_single_vcpu(struct kvm *kvm, u8 deliverable_mask) |
472 |
+ { |
473 |
+- int vcpu_id, online_vcpus = atomic_read(&kvm->online_vcpus); |
474 |
++ int vcpu_idx, online_vcpus = atomic_read(&kvm->online_vcpus); |
475 |
+ struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int; |
476 |
+ struct kvm_vcpu *vcpu; |
477 |
+ |
478 |
+- for_each_set_bit(vcpu_id, kvm->arch.idle_mask, online_vcpus) { |
479 |
+- vcpu = kvm_get_vcpu(kvm, vcpu_id); |
480 |
++ for_each_set_bit(vcpu_idx, kvm->arch.idle_mask, online_vcpus) { |
481 |
++ vcpu = kvm_get_vcpu(kvm, vcpu_idx); |
482 |
+ if (psw_ioint_disabled(vcpu)) |
483 |
+ continue; |
484 |
+ deliverable_mask &= (u8)(vcpu->arch.sie_block->gcr[6] >> 24); |
485 |
+ if (deliverable_mask) { |
486 |
+ /* lately kicked but not yet running */ |
487 |
+- if (test_and_set_bit(vcpu_id, gi->kicked_mask)) |
488 |
++ if (test_and_set_bit(vcpu_idx, gi->kicked_mask)) |
489 |
+ return; |
490 |
+ kvm_s390_vcpu_wakeup(vcpu); |
491 |
+ return; |
492 |
+diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c |
493 |
+index 20ba8537dbcc2..9ed2fee612297 100644 |
494 |
+--- a/arch/s390/kvm/kvm-s390.c |
495 |
++++ b/arch/s390/kvm/kvm-s390.c |
496 |
+@@ -3726,7 +3726,7 @@ static int vcpu_pre_run(struct kvm_vcpu *vcpu) |
497 |
+ kvm_s390_patch_guest_per_regs(vcpu); |
498 |
+ } |
499 |
+ |
500 |
+- clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.gisa_int.kicked_mask); |
501 |
++ clear_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.gisa_int.kicked_mask); |
502 |
+ |
503 |
+ vcpu->arch.sie_block->icptcode = 0; |
504 |
+ cpuflags = atomic_read(&vcpu->arch.sie_block->cpuflags); |
505 |
+diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h |
506 |
+index 6d9448dbd052b..63d94a5253a8f 100644 |
507 |
+--- a/arch/s390/kvm/kvm-s390.h |
508 |
++++ b/arch/s390/kvm/kvm-s390.h |
509 |
+@@ -67,7 +67,7 @@ static inline int is_vcpu_stopped(struct kvm_vcpu *vcpu) |
510 |
+ |
511 |
+ static inline int is_vcpu_idle(struct kvm_vcpu *vcpu) |
512 |
+ { |
513 |
+- return test_bit(vcpu->vcpu_id, vcpu->kvm->arch.idle_mask); |
514 |
++ return test_bit(kvm_vcpu_get_idx(vcpu), vcpu->kvm->arch.idle_mask); |
515 |
+ } |
516 |
+ |
517 |
+ static inline int kvm_is_ucontrol(struct kvm *kvm) |
518 |
+diff --git a/arch/s390/mm/kasan_init.c b/arch/s390/mm/kasan_init.c |
519 |
+index 460f255729402..5182e0836ca71 100644 |
520 |
+--- a/arch/s390/mm/kasan_init.c |
521 |
++++ b/arch/s390/mm/kasan_init.c |
522 |
+@@ -101,6 +101,9 @@ static void __init kasan_early_vmemmap_populate(unsigned long address, |
523 |
+ pgt_prot = pgprot_val(PAGE_KERNEL_EXEC); |
524 |
+ sgt_prot = pgprot_val(SEGMENT_KERNEL_EXEC); |
525 |
+ |
526 |
++ /* |
527 |
++ * The first 1MB of 1:1 mapping is mapped with 4KB pages |
528 |
++ */ |
529 |
+ while (address < end) { |
530 |
+ pg_dir = pgd_offset_k(address); |
531 |
+ if (pgd_none(*pg_dir)) { |
532 |
+@@ -146,30 +149,26 @@ static void __init kasan_early_vmemmap_populate(unsigned long address, |
533 |
+ |
534 |
+ pm_dir = pmd_offset(pu_dir, address); |
535 |
+ if (pmd_none(*pm_dir)) { |
536 |
+- if (mode == POPULATE_ZERO_SHADOW && |
537 |
+- IS_ALIGNED(address, PMD_SIZE) && |
538 |
++ if (IS_ALIGNED(address, PMD_SIZE) && |
539 |
+ end - address >= PMD_SIZE) { |
540 |
+- pmd_populate(&init_mm, pm_dir, |
541 |
+- kasan_early_shadow_pte); |
542 |
+- address = (address + PMD_SIZE) & PMD_MASK; |
543 |
+- continue; |
544 |
+- } |
545 |
+- /* the first megabyte of 1:1 is mapped with 4k pages */ |
546 |
+- if (has_edat && address && end - address >= PMD_SIZE && |
547 |
+- mode != POPULATE_ZERO_SHADOW) { |
548 |
+- void *page; |
549 |
+- |
550 |
+- if (mode == POPULATE_ONE2ONE) { |
551 |
+- page = (void *)address; |
552 |
+- } else { |
553 |
+- page = kasan_early_alloc_segment(); |
554 |
+- memset(page, 0, _SEGMENT_SIZE); |
555 |
++ if (mode == POPULATE_ZERO_SHADOW) { |
556 |
++ pmd_populate(&init_mm, pm_dir, kasan_early_shadow_pte); |
557 |
++ address = (address + PMD_SIZE) & PMD_MASK; |
558 |
++ continue; |
559 |
++ } else if (has_edat && address) { |
560 |
++ void *page; |
561 |
++ |
562 |
++ if (mode == POPULATE_ONE2ONE) { |
563 |
++ page = (void *)address; |
564 |
++ } else { |
565 |
++ page = kasan_early_alloc_segment(); |
566 |
++ memset(page, 0, _SEGMENT_SIZE); |
567 |
++ } |
568 |
++ pmd_val(*pm_dir) = __pa(page) | sgt_prot; |
569 |
++ address = (address + PMD_SIZE) & PMD_MASK; |
570 |
++ continue; |
571 |
+ } |
572 |
+- pmd_val(*pm_dir) = __pa(page) | sgt_prot; |
573 |
+- address = (address + PMD_SIZE) & PMD_MASK; |
574 |
+- continue; |
575 |
+ } |
576 |
+- |
577 |
+ pt_dir = kasan_early_pte_alloc(); |
578 |
+ pmd_populate(&init_mm, pm_dir, pt_dir); |
579 |
+ } else if (pmd_large(*pm_dir)) { |
580 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
581 |
+index e160f4650f8e4..3e6612d8b921c 100644 |
582 |
+--- a/arch/s390/net/bpf_jit_comp.c |
583 |
++++ b/arch/s390/net/bpf_jit_comp.c |
584 |
+@@ -913,6 +913,11 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, |
585 |
+ break; |
586 |
+ } |
587 |
+ break; |
588 |
++ /* |
589 |
++ * BPF_NOSPEC (speculation barrier) |
590 |
++ */ |
591 |
++ case BPF_ST | BPF_NOSPEC: |
592 |
++ break; |
593 |
+ /* |
594 |
+ * BPF_ST(X) |
595 |
+ */ |
596 |
+diff --git a/arch/sparc/net/bpf_jit_comp_64.c b/arch/sparc/net/bpf_jit_comp_64.c |
597 |
+index 3364e2a009899..fef734473c0f3 100644 |
598 |
+--- a/arch/sparc/net/bpf_jit_comp_64.c |
599 |
++++ b/arch/sparc/net/bpf_jit_comp_64.c |
600 |
+@@ -1287,6 +1287,9 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx) |
601 |
+ return 1; |
602 |
+ break; |
603 |
+ } |
604 |
++ /* speculation barrier */ |
605 |
++ case BPF_ST | BPF_NOSPEC: |
606 |
++ break; |
607 |
+ /* ST: *(size *)(dst + off) = imm */ |
608 |
+ case BPF_ST | BPF_MEM | BPF_W: |
609 |
+ case BPF_ST | BPF_MEM | BPF_H: |
610 |
+diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c |
611 |
+index ff07040287c40..b7baaa9733173 100644 |
612 |
+--- a/arch/x86/events/amd/ibs.c |
613 |
++++ b/arch/x86/events/amd/ibs.c |
614 |
+@@ -562,6 +562,7 @@ static struct perf_ibs perf_ibs_op = { |
615 |
+ .start = perf_ibs_start, |
616 |
+ .stop = perf_ibs_stop, |
617 |
+ .read = perf_ibs_read, |
618 |
++ .capabilities = PERF_PMU_CAP_NO_EXCLUDE, |
619 |
+ }, |
620 |
+ .msr = MSR_AMD64_IBSOPCTL, |
621 |
+ .config_mask = IBS_OP_CONFIG_MASK, |
622 |
+diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c |
623 |
+index 21eb593e0313e..008bcb15fe96a 100644 |
624 |
+--- a/arch/x86/kernel/cpu/resctrl/monitor.c |
625 |
++++ b/arch/x86/kernel/cpu/resctrl/monitor.c |
626 |
+@@ -242,6 +242,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read *rr) |
627 |
+ case QOS_L3_MBM_LOCAL_EVENT_ID: |
628 |
+ m = &rr->d->mbm_local[rmid]; |
629 |
+ break; |
630 |
++ default: |
631 |
++ /* |
632 |
++ * Code would never reach here because an invalid |
633 |
++ * event id would fail the __rmid_read. |
634 |
++ */ |
635 |
++ return RMID_VAL_ERROR; |
636 |
+ } |
637 |
+ |
638 |
+ if (rr->first) { |
639 |
+diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c |
640 |
+index 023bd3e1aa0d2..3041015b05f71 100644 |
641 |
+--- a/arch/x86/kvm/vmx/nested.c |
642 |
++++ b/arch/x86/kvm/vmx/nested.c |
643 |
+@@ -2057,12 +2057,11 @@ static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12) |
644 |
+ ~PIN_BASED_VMX_PREEMPTION_TIMER); |
645 |
+ |
646 |
+ /* Posted interrupts setting is only taken from vmcs12. */ |
647 |
+- if (nested_cpu_has_posted_intr(vmcs12)) { |
648 |
++ vmx->nested.pi_pending = false; |
649 |
++ if (nested_cpu_has_posted_intr(vmcs12)) |
650 |
+ vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv; |
651 |
+- vmx->nested.pi_pending = false; |
652 |
+- } else { |
653 |
++ else |
654 |
+ exec_control &= ~PIN_BASED_POSTED_INTR; |
655 |
+- } |
656 |
+ pin_controls_set(vmx, exec_control); |
657 |
+ |
658 |
+ /* |
659 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
660 |
+index 364e96e508d90..f1a0eebdcf641 100644 |
661 |
+--- a/arch/x86/kvm/x86.c |
662 |
++++ b/arch/x86/kvm/x86.c |
663 |
+@@ -2764,6 +2764,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
664 |
+ if (!msr_info->host_initiated) { |
665 |
+ s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; |
666 |
+ adjust_tsc_offset_guest(vcpu, adj); |
667 |
++ /* Before back to guest, tsc_timestamp must be adjusted |
668 |
++ * as well, otherwise guest's percpu pvclock time could jump. |
669 |
++ */ |
670 |
++ kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
671 |
+ } |
672 |
+ vcpu->arch.ia32_tsc_adjust_msr = data; |
673 |
+ } |
674 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
675 |
+index 6e884f17634fe..55f62dca28aa2 100644 |
676 |
+--- a/arch/x86/net/bpf_jit_comp.c |
677 |
++++ b/arch/x86/net/bpf_jit_comp.c |
678 |
+@@ -728,6 +728,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
679 |
+ } |
680 |
+ break; |
681 |
+ |
682 |
++ /* speculation barrier */ |
683 |
++ case BPF_ST | BPF_NOSPEC: |
684 |
++ if (boot_cpu_has(X86_FEATURE_XMM2)) |
685 |
++ /* Emit 'lfence' */ |
686 |
++ EMIT3(0x0F, 0xAE, 0xE8); |
687 |
++ break; |
688 |
++ |
689 |
+ /* ST: *(u8*)(dst_reg + off) = imm */ |
690 |
+ case BPF_ST | BPF_MEM | BPF_B: |
691 |
+ if (is_ereg(dst_reg)) |
692 |
+diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c |
693 |
+index 0fcba32077c87..2914f900034e0 100644 |
694 |
+--- a/arch/x86/net/bpf_jit_comp32.c |
695 |
++++ b/arch/x86/net/bpf_jit_comp32.c |
696 |
+@@ -1705,6 +1705,12 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, |
697 |
+ i++; |
698 |
+ break; |
699 |
+ } |
700 |
++ /* speculation barrier */ |
701 |
++ case BPF_ST | BPF_NOSPEC: |
702 |
++ if (boot_cpu_has(X86_FEATURE_XMM2)) |
703 |
++ /* Emit 'lfence' */ |
704 |
++ EMIT3(0x0F, 0xAE, 0xE8); |
705 |
++ break; |
706 |
+ /* ST: *(u8*)(dst_reg + off) = imm */ |
707 |
+ case BPF_ST | BPF_MEM | BPF_H: |
708 |
+ case BPF_ST | BPF_MEM | BPF_B: |
709 |
+diff --git a/certs/Makefile b/certs/Makefile |
710 |
+index f4b90bad8690a..2baef6fba029e 100644 |
711 |
+--- a/certs/Makefile |
712 |
++++ b/certs/Makefile |
713 |
+@@ -46,11 +46,19 @@ endif |
714 |
+ redirect_openssl = 2>&1 |
715 |
+ quiet_redirect_openssl = 2>&1 |
716 |
+ silent_redirect_openssl = 2>/dev/null |
717 |
++openssl_available = $(shell openssl help 2>/dev/null && echo yes) |
718 |
+ |
719 |
+ # We do it this way rather than having a boolean option for enabling an |
720 |
+ # external private key, because 'make randconfig' might enable such a |
721 |
+ # boolean option and we unfortunately can't make it depend on !RANDCONFIG. |
722 |
+ ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") |
723 |
++ |
724 |
++ifeq ($(openssl_available),yes) |
725 |
++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null) |
726 |
++ |
727 |
++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem")) |
728 |
++endif |
729 |
++ |
730 |
+ $(obj)/signing_key.pem: $(obj)/x509.genkey |
731 |
+ @$(kecho) "###" |
732 |
+ @$(kecho) "### Now generating an X.509 key pair to be used for signing modules." |
733 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
734 |
+index f67b3fb33d579..7788af0ca1090 100644 |
735 |
+--- a/drivers/ata/libata-core.c |
736 |
++++ b/drivers/ata/libata-core.c |
737 |
+@@ -6394,7 +6394,7 @@ int ata_host_start(struct ata_host *host) |
738 |
+ have_stop = 1; |
739 |
+ } |
740 |
+ |
741 |
+- if (host->ops->host_stop) |
742 |
++ if (host->ops && host->ops->host_stop) |
743 |
+ have_stop = 1; |
744 |
+ |
745 |
+ if (have_stop) { |
746 |
+diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c |
747 |
+index e0893f1b14522..43c0452a8ba91 100644 |
748 |
+--- a/drivers/base/regmap/regmap.c |
749 |
++++ b/drivers/base/regmap/regmap.c |
750 |
+@@ -1505,7 +1505,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, |
751 |
+ if (ret) { |
752 |
+ dev_err(map->dev, |
753 |
+ "Error in caching of register: %x ret: %d\n", |
754 |
+- reg + i, ret); |
755 |
++ reg + regmap_get_offset(map, i), ret); |
756 |
+ return ret; |
757 |
+ } |
758 |
+ } |
759 |
+diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c |
760 |
+index 6535614a7dc13..1df2b5801c3bc 100644 |
761 |
+--- a/drivers/bcma/main.c |
762 |
++++ b/drivers/bcma/main.c |
763 |
+@@ -236,6 +236,7 @@ EXPORT_SYMBOL(bcma_core_irq); |
764 |
+ |
765 |
+ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) |
766 |
+ { |
767 |
++ device_initialize(&core->dev); |
768 |
+ core->dev.release = bcma_release_core_dev; |
769 |
+ core->dev.bus = &bcma_bus_type; |
770 |
+ dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); |
771 |
+@@ -277,11 +278,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) |
772 |
+ { |
773 |
+ int err; |
774 |
+ |
775 |
+- err = device_register(&core->dev); |
776 |
++ err = device_add(&core->dev); |
777 |
+ if (err) { |
778 |
+ bcma_err(bus, "Could not register dev for core 0x%03X\n", |
779 |
+ core->id.id); |
780 |
+- put_device(&core->dev); |
781 |
+ return; |
782 |
+ } |
783 |
+ core->dev_registered = true; |
784 |
+@@ -372,7 +372,7 @@ void bcma_unregister_cores(struct bcma_bus *bus) |
785 |
+ /* Now noone uses internally-handled cores, we can free them */ |
786 |
+ list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
787 |
+ list_del(&core->list); |
788 |
+- kfree(core); |
789 |
++ put_device(&core->dev); |
790 |
+ } |
791 |
+ } |
792 |
+ |
793 |
+diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c |
794 |
+index 25e81b1a59a54..bc3ab98855cf0 100644 |
795 |
+--- a/drivers/block/nbd.c |
796 |
++++ b/drivers/block/nbd.c |
797 |
+@@ -1744,7 +1744,17 @@ static int nbd_dev_add(int index) |
798 |
+ refcount_set(&nbd->refs, 1); |
799 |
+ INIT_LIST_HEAD(&nbd->list); |
800 |
+ disk->major = NBD_MAJOR; |
801 |
++ |
802 |
++ /* Too big first_minor can cause duplicate creation of |
803 |
++ * sysfs files/links, since first_minor will be truncated to |
804 |
++ * byte in __device_add_disk(). |
805 |
++ */ |
806 |
+ disk->first_minor = index << part_shift; |
807 |
++ if (disk->first_minor > 0xff) { |
808 |
++ err = -EINVAL; |
809 |
++ goto out_free_idr; |
810 |
++ } |
811 |
++ |
812 |
+ disk->fops = &nbd_fops; |
813 |
+ disk->private_data = nbd; |
814 |
+ sprintf(disk->disk_name, "nbd%d", index); |
815 |
+diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c |
816 |
+index 47680237d0beb..8bc893df47364 100644 |
817 |
+--- a/drivers/clk/mvebu/kirkwood.c |
818 |
++++ b/drivers/clk/mvebu/kirkwood.c |
819 |
+@@ -265,6 +265,7 @@ static const char *powersave_parents[] = { |
820 |
+ static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = { |
821 |
+ { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents), |
822 |
+ 11, 1, 0 }, |
823 |
++ { } |
824 |
+ }; |
825 |
+ |
826 |
+ static struct clk *clk_muxing_get_src( |
827 |
+diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c |
828 |
+index ef773db080e90..a0570213170d8 100644 |
829 |
+--- a/drivers/clocksource/sh_cmt.c |
830 |
++++ b/drivers/clocksource/sh_cmt.c |
831 |
+@@ -568,7 +568,8 @@ static int sh_cmt_start(struct sh_cmt_channel *ch, unsigned long flag) |
832 |
+ ch->flags |= flag; |
833 |
+ |
834 |
+ /* setup timeout if no clockevent */ |
835 |
+- if ((flag == FLAG_CLOCKSOURCE) && (!(ch->flags & FLAG_CLOCKEVENT))) |
836 |
++ if (ch->cmt->num_channels == 1 && |
837 |
++ flag == FLAG_CLOCKSOURCE && (!(ch->flags & FLAG_CLOCKEVENT))) |
838 |
+ __sh_cmt_set_next(ch, ch->max_match_value); |
839 |
+ out: |
840 |
+ raw_spin_unlock_irqrestore(&ch->lock, flags); |
841 |
+@@ -604,20 +605,25 @@ static struct sh_cmt_channel *cs_to_sh_cmt(struct clocksource *cs) |
842 |
+ static u64 sh_cmt_clocksource_read(struct clocksource *cs) |
843 |
+ { |
844 |
+ struct sh_cmt_channel *ch = cs_to_sh_cmt(cs); |
845 |
+- unsigned long flags; |
846 |
+ u32 has_wrapped; |
847 |
+- u64 value; |
848 |
+- u32 raw; |
849 |
+ |
850 |
+- raw_spin_lock_irqsave(&ch->lock, flags); |
851 |
+- value = ch->total_cycles; |
852 |
+- raw = sh_cmt_get_counter(ch, &has_wrapped); |
853 |
++ if (ch->cmt->num_channels == 1) { |
854 |
++ unsigned long flags; |
855 |
++ u64 value; |
856 |
++ u32 raw; |
857 |
+ |
858 |
+- if (unlikely(has_wrapped)) |
859 |
+- raw += ch->match_value + 1; |
860 |
+- raw_spin_unlock_irqrestore(&ch->lock, flags); |
861 |
++ raw_spin_lock_irqsave(&ch->lock, flags); |
862 |
++ value = ch->total_cycles; |
863 |
++ raw = sh_cmt_get_counter(ch, &has_wrapped); |
864 |
++ |
865 |
++ if (unlikely(has_wrapped)) |
866 |
++ raw += ch->match_value + 1; |
867 |
++ raw_spin_unlock_irqrestore(&ch->lock, flags); |
868 |
++ |
869 |
++ return value + raw; |
870 |
++ } |
871 |
+ |
872 |
+- return value + raw; |
873 |
++ return sh_cmt_get_counter(ch, &has_wrapped); |
874 |
+ } |
875 |
+ |
876 |
+ static int sh_cmt_clocksource_enable(struct clocksource *cs) |
877 |
+@@ -680,7 +686,7 @@ static int sh_cmt_register_clocksource(struct sh_cmt_channel *ch, |
878 |
+ cs->disable = sh_cmt_clocksource_disable; |
879 |
+ cs->suspend = sh_cmt_clocksource_suspend; |
880 |
+ cs->resume = sh_cmt_clocksource_resume; |
881 |
+- cs->mask = CLOCKSOURCE_MASK(sizeof(u64) * 8); |
882 |
++ cs->mask = CLOCKSOURCE_MASK(ch->cmt->info->width); |
883 |
+ cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; |
884 |
+ |
885 |
+ dev_info(&ch->cmt->pdev->dev, "ch%u: used as clock source\n", |
886 |
+diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c |
887 |
+index 5c23a9a56921b..f261a57af1c01 100644 |
888 |
+--- a/drivers/counter/104-quad-8.c |
889 |
++++ b/drivers/counter/104-quad-8.c |
890 |
+@@ -1230,12 +1230,13 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, |
891 |
+ case 1: |
892 |
+ case 3: |
893 |
+ quad8_preset_register_set(priv, count->id, ceiling); |
894 |
+- break; |
895 |
++ mutex_unlock(&priv->lock); |
896 |
++ return len; |
897 |
+ } |
898 |
+ |
899 |
+ mutex_unlock(&priv->lock); |
900 |
+ |
901 |
+- return len; |
902 |
++ return -EINVAL; |
903 |
+ } |
904 |
+ |
905 |
+ static ssize_t quad8_count_preset_enable_read(struct counter_device *counter, |
906 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
907 |
+index f8a48a84df2ab..66fa524b6261e 100644 |
908 |
+--- a/drivers/crypto/mxs-dcp.c |
909 |
++++ b/drivers/crypto/mxs-dcp.c |
910 |
+@@ -168,15 +168,19 @@ static struct dcp *global_sdcp; |
911 |
+ |
912 |
+ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx) |
913 |
+ { |
914 |
++ int dma_err; |
915 |
+ struct dcp *sdcp = global_sdcp; |
916 |
+ const int chan = actx->chan; |
917 |
+ uint32_t stat; |
918 |
+ unsigned long ret; |
919 |
+ struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; |
920 |
+- |
921 |
+ dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc), |
922 |
+ DMA_TO_DEVICE); |
923 |
+ |
924 |
++ dma_err = dma_mapping_error(sdcp->dev, desc_phys); |
925 |
++ if (dma_err) |
926 |
++ return dma_err; |
927 |
++ |
928 |
+ reinit_completion(&sdcp->completion[chan]); |
929 |
+ |
930 |
+ /* Clear status register. */ |
931 |
+@@ -214,18 +218,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx) |
932 |
+ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
933 |
+ struct ablkcipher_request *req, int init) |
934 |
+ { |
935 |
++ dma_addr_t key_phys, src_phys, dst_phys; |
936 |
+ struct dcp *sdcp = global_sdcp; |
937 |
+ struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; |
938 |
+ struct dcp_aes_req_ctx *rctx = ablkcipher_request_ctx(req); |
939 |
+ int ret; |
940 |
+ |
941 |
+- dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key, |
942 |
+- 2 * AES_KEYSIZE_128, |
943 |
+- DMA_TO_DEVICE); |
944 |
+- dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf, |
945 |
+- DCP_BUF_SZ, DMA_TO_DEVICE); |
946 |
+- dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, |
947 |
+- DCP_BUF_SZ, DMA_FROM_DEVICE); |
948 |
++ key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key, |
949 |
++ 2 * AES_KEYSIZE_128, DMA_TO_DEVICE); |
950 |
++ ret = dma_mapping_error(sdcp->dev, key_phys); |
951 |
++ if (ret) |
952 |
++ return ret; |
953 |
++ |
954 |
++ src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf, |
955 |
++ DCP_BUF_SZ, DMA_TO_DEVICE); |
956 |
++ ret = dma_mapping_error(sdcp->dev, src_phys); |
957 |
++ if (ret) |
958 |
++ goto err_src; |
959 |
++ |
960 |
++ dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, |
961 |
++ DCP_BUF_SZ, DMA_FROM_DEVICE); |
962 |
++ ret = dma_mapping_error(sdcp->dev, dst_phys); |
963 |
++ if (ret) |
964 |
++ goto err_dst; |
965 |
+ |
966 |
+ if (actx->fill % AES_BLOCK_SIZE) { |
967 |
+ dev_err(sdcp->dev, "Invalid block size!\n"); |
968 |
+@@ -263,10 +278,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
969 |
+ ret = mxs_dcp_start_dma(actx); |
970 |
+ |
971 |
+ aes_done_run: |
972 |
++ dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE); |
973 |
++err_dst: |
974 |
++ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
975 |
++err_src: |
976 |
+ dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128, |
977 |
+ DMA_TO_DEVICE); |
978 |
+- dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
979 |
+- dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE); |
980 |
+ |
981 |
+ return ret; |
982 |
+ } |
983 |
+@@ -565,6 +582,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
984 |
+ dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf, |
985 |
+ DCP_BUF_SZ, DMA_TO_DEVICE); |
986 |
+ |
987 |
++ ret = dma_mapping_error(sdcp->dev, buf_phys); |
988 |
++ if (ret) |
989 |
++ return ret; |
990 |
++ |
991 |
+ /* Fill in the DMA descriptor. */ |
992 |
+ desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE | |
993 |
+ MXS_DCP_CONTROL0_INTERRUPT | |
994 |
+@@ -597,6 +618,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
995 |
+ if (rctx->fini) { |
996 |
+ digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf, |
997 |
+ DCP_SHA_PAY_SZ, DMA_FROM_DEVICE); |
998 |
++ ret = dma_mapping_error(sdcp->dev, digest_phys); |
999 |
++ if (ret) |
1000 |
++ goto done_run; |
1001 |
++ |
1002 |
+ desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM; |
1003 |
+ desc->payload = digest_phys; |
1004 |
+ } |
1005 |
+diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
1006 |
+index f80db1eb29945..f8a146554b1f3 100644 |
1007 |
+--- a/drivers/crypto/omap-sham.c |
1008 |
++++ b/drivers/crypto/omap-sham.c |
1009 |
+@@ -1734,7 +1734,7 @@ static void omap_sham_done_task(unsigned long data) |
1010 |
+ if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags)) |
1011 |
+ goto finish; |
1012 |
+ } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) { |
1013 |
+- if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) { |
1014 |
++ if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) { |
1015 |
+ omap_sham_update_dma_stop(dd); |
1016 |
+ if (dd->err) { |
1017 |
+ err = dd->err; |
1018 |
+diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
1019 |
+index d2d0ae445fd89..7c7d49a8a4034 100644 |
1020 |
+--- a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
1021 |
++++ b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
1022 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) |
1023 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
1024 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
1025 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
1026 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
1027 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
1028 |
+ hw_data->init_arb = adf_vf_int_noop; |
1029 |
+ hw_data->exit_arb = adf_vf_void_noop; |
1030 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
1031 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
1032 |
+ hw_data->get_accel_mask = get_accel_mask; |
1033 |
+ hw_data->get_ae_mask = get_ae_mask; |
1034 |
+ hw_data->get_num_accels = get_num_accels; |
1035 |
+diff --git a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
1036 |
+index 38e4bc04f407b..90e8a7564756b 100644 |
1037 |
+--- a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
1038 |
++++ b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
1039 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) |
1040 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
1041 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
1042 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
1043 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
1044 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
1045 |
+ hw_data->init_arb = adf_vf_int_noop; |
1046 |
+ hw_data->exit_arb = adf_vf_void_noop; |
1047 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
1048 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
1049 |
+ hw_data->get_accel_mask = get_accel_mask; |
1050 |
+ hw_data->get_ae_mask = get_ae_mask; |
1051 |
+ hw_data->get_num_accels = get_num_accels; |
1052 |
+diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h |
1053 |
+index d78f8d5c89c3f..289dd7e48d4a4 100644 |
1054 |
+--- a/drivers/crypto/qat/qat_common/adf_common_drv.h |
1055 |
++++ b/drivers/crypto/qat/qat_common/adf_common_drv.h |
1056 |
+@@ -239,8 +239,8 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, |
1057 |
+ void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev); |
1058 |
+ void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev); |
1059 |
+ |
1060 |
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev); |
1061 |
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev); |
1062 |
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev); |
1063 |
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev); |
1064 |
+ int adf_init_pf_wq(void); |
1065 |
+ void adf_exit_pf_wq(void); |
1066 |
+ int adf_init_vf_wq(void); |
1067 |
+@@ -263,12 +263,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev) |
1068 |
+ { |
1069 |
+ } |
1070 |
+ |
1071 |
+-static inline int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
1072 |
++static inline int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev) |
1073 |
+ { |
1074 |
+ return 0; |
1075 |
+ } |
1076 |
+ |
1077 |
+-static inline void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
1078 |
++static inline void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) |
1079 |
+ { |
1080 |
+ } |
1081 |
+ |
1082 |
+diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c |
1083 |
+index 26556c7130497..7a7d43c475342 100644 |
1084 |
+--- a/drivers/crypto/qat/qat_common/adf_init.c |
1085 |
++++ b/drivers/crypto/qat/qat_common/adf_init.c |
1086 |
+@@ -105,6 +105,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) |
1087 |
+ struct service_hndl *service; |
1088 |
+ struct list_head *list_itr; |
1089 |
+ struct adf_hw_device_data *hw_data = accel_dev->hw_device; |
1090 |
++ int ret; |
1091 |
+ |
1092 |
+ if (!hw_data) { |
1093 |
+ dev_err(&GET_DEV(accel_dev), |
1094 |
+@@ -171,9 +172,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) |
1095 |
+ } |
1096 |
+ |
1097 |
+ hw_data->enable_error_correction(accel_dev); |
1098 |
+- hw_data->enable_vf2pf_comms(accel_dev); |
1099 |
++ ret = hw_data->enable_vf2pf_comms(accel_dev); |
1100 |
+ |
1101 |
+- return 0; |
1102 |
++ return ret; |
1103 |
+ } |
1104 |
+ EXPORT_SYMBOL_GPL(adf_dev_init); |
1105 |
+ |
1106 |
+diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c |
1107 |
+index 4898ef41fd9fd..7d319c5c071c4 100644 |
1108 |
+--- a/drivers/crypto/qat/qat_common/adf_isr.c |
1109 |
++++ b/drivers/crypto/qat/qat_common/adf_isr.c |
1110 |
+@@ -59,6 +59,8 @@ |
1111 |
+ #include "adf_transport_access_macros.h" |
1112 |
+ #include "adf_transport_internal.h" |
1113 |
+ |
1114 |
++#define ADF_MAX_NUM_VFS 32 |
1115 |
++ |
1116 |
+ static int adf_enable_msix(struct adf_accel_dev *accel_dev) |
1117 |
+ { |
1118 |
+ struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev; |
1119 |
+@@ -111,7 +113,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr) |
1120 |
+ struct adf_bar *pmisc = |
1121 |
+ &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)]; |
1122 |
+ void __iomem *pmisc_bar_addr = pmisc->virt_addr; |
1123 |
+- u32 vf_mask; |
1124 |
++ unsigned long vf_mask; |
1125 |
+ |
1126 |
+ /* Get the interrupt sources triggered by VFs */ |
1127 |
+ vf_mask = ((ADF_CSR_RD(pmisc_bar_addr, ADF_ERRSOU5) & |
1128 |
+@@ -132,8 +134,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr) |
1129 |
+ * unless the VF is malicious and is attempting to |
1130 |
+ * flood the host OS with VF2PF interrupts. |
1131 |
+ */ |
1132 |
+- for_each_set_bit(i, (const unsigned long *)&vf_mask, |
1133 |
+- (sizeof(vf_mask) * BITS_PER_BYTE)) { |
1134 |
++ for_each_set_bit(i, &vf_mask, ADF_MAX_NUM_VFS) { |
1135 |
+ vf_info = accel_dev->pf.vf_info + i; |
1136 |
+ |
1137 |
+ if (!__ratelimit(&vf_info->vf2pf_ratelimit)) { |
1138 |
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1139 |
+index b3875fdf6cd72..c64481160b711 100644 |
1140 |
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1141 |
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1142 |
+@@ -231,7 +231,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) |
1143 |
+ |
1144 |
+ return ret; |
1145 |
+ } |
1146 |
+-EXPORT_SYMBOL_GPL(adf_iov_putmsg); |
1147 |
+ |
1148 |
+ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) |
1149 |
+ { |
1150 |
+@@ -361,6 +360,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) |
1151 |
+ msg |= ADF_PFVF_COMPATIBILITY_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT; |
1152 |
+ BUILD_BUG_ON(ADF_PFVF_COMPATIBILITY_VERSION > 255); |
1153 |
+ |
1154 |
++ reinit_completion(&accel_dev->vf.iov_msg_completion); |
1155 |
++ |
1156 |
+ /* Send request from VF to PF */ |
1157 |
+ ret = adf_iov_putmsg(accel_dev, msg, 0); |
1158 |
+ if (ret) { |
1159 |
+diff --git a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1160 |
+index cd5f37dffe8a6..1830194567e84 100644 |
1161 |
+--- a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1162 |
++++ b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1163 |
+@@ -49,14 +49,14 @@ |
1164 |
+ #include "adf_pf2vf_msg.h" |
1165 |
+ |
1166 |
+ /** |
1167 |
+- * adf_vf2pf_init() - send init msg to PF |
1168 |
++ * adf_vf2pf_notify_init() - send init msg to PF |
1169 |
+ * @accel_dev: Pointer to acceleration VF device. |
1170 |
+ * |
1171 |
+ * Function sends an init messge from the VF to a PF |
1172 |
+ * |
1173 |
+ * Return: 0 on success, error code otherwise. |
1174 |
+ */ |
1175 |
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
1176 |
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev) |
1177 |
+ { |
1178 |
+ u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | |
1179 |
+ (ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT)); |
1180 |
+@@ -69,17 +69,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
1181 |
+ set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status); |
1182 |
+ return 0; |
1183 |
+ } |
1184 |
+-EXPORT_SYMBOL_GPL(adf_vf2pf_init); |
1185 |
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init); |
1186 |
+ |
1187 |
+ /** |
1188 |
+- * adf_vf2pf_shutdown() - send shutdown msg to PF |
1189 |
++ * adf_vf2pf_notify_shutdown() - send shutdown msg to PF |
1190 |
+ * @accel_dev: Pointer to acceleration VF device. |
1191 |
+ * |
1192 |
+ * Function sends a shutdown messge from the VF to a PF |
1193 |
+ * |
1194 |
+ * Return: void |
1195 |
+ */ |
1196 |
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
1197 |
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) |
1198 |
+ { |
1199 |
+ u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | |
1200 |
+ (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT)); |
1201 |
+@@ -89,4 +89,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
1202 |
+ dev_err(&GET_DEV(accel_dev), |
1203 |
+ "Failed to send Shutdown event to PF\n"); |
1204 |
+ } |
1205 |
+-EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown); |
1206 |
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_shutdown); |
1207 |
+diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1208 |
+index df9a1f35b8320..ef90902c8200d 100644 |
1209 |
+--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1210 |
++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1211 |
+@@ -203,6 +203,7 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1212 |
+ struct adf_bar *pmisc = |
1213 |
+ &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)]; |
1214 |
+ void __iomem *pmisc_bar_addr = pmisc->virt_addr; |
1215 |
++ bool handled = false; |
1216 |
+ u32 v_int; |
1217 |
+ |
1218 |
+ /* Read VF INT source CSR to determine the source of VF interrupt */ |
1219 |
+@@ -215,7 +216,7 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1220 |
+ |
1221 |
+ /* Schedule tasklet to handle interrupt BH */ |
1222 |
+ tasklet_hi_schedule(&accel_dev->vf.pf2vf_bh_tasklet); |
1223 |
+- return IRQ_HANDLED; |
1224 |
++ handled = true; |
1225 |
+ } |
1226 |
+ |
1227 |
+ /* Check bundle interrupt */ |
1228 |
+@@ -227,10 +228,10 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1229 |
+ WRITE_CSR_INT_FLAG_AND_COL(bank->csr_addr, bank->bank_number, |
1230 |
+ 0); |
1231 |
+ tasklet_hi_schedule(&bank->resp_handler); |
1232 |
+- return IRQ_HANDLED; |
1233 |
++ handled = true; |
1234 |
+ } |
1235 |
+ |
1236 |
+- return IRQ_NONE; |
1237 |
++ return handled ? IRQ_HANDLED : IRQ_NONE; |
1238 |
+ } |
1239 |
+ |
1240 |
+ static int adf_request_msi_irq(struct adf_accel_dev *accel_dev) |
1241 |
+diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1242 |
+index a3b4dd8099a7b..3a8361c83f0b1 100644 |
1243 |
+--- a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1244 |
++++ b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1245 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) |
1246 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
1247 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
1248 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
1249 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
1250 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
1251 |
+ hw_data->init_arb = adf_vf_int_noop; |
1252 |
+ hw_data->exit_arb = adf_vf_void_noop; |
1253 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
1254 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
1255 |
+ hw_data->get_accel_mask = get_accel_mask; |
1256 |
+ hw_data->get_ae_mask = get_ae_mask; |
1257 |
+ hw_data->get_num_accels = get_num_accels; |
1258 |
+diff --git a/drivers/edac/i10nm_base.c b/drivers/edac/i10nm_base.c |
1259 |
+index f72be5f94e6fa..29576922df78f 100644 |
1260 |
+--- a/drivers/edac/i10nm_base.c |
1261 |
++++ b/drivers/edac/i10nm_base.c |
1262 |
+@@ -26,8 +26,8 @@ |
1263 |
+ pci_read_config_dword((d)->uracu, 0xd8 + (i) * 4, &(reg)) |
1264 |
+ #define I10NM_GET_DIMMMTR(m, i, j) \ |
1265 |
+ readl((m)->mbase + 0x2080c + (i) * 0x4000 + (j) * 4) |
1266 |
+-#define I10NM_GET_MCDDRTCFG(m, i, j) \ |
1267 |
+- readl((m)->mbase + 0x20970 + (i) * 0x4000 + (j) * 4) |
1268 |
++#define I10NM_GET_MCDDRTCFG(m, i) \ |
1269 |
++ readl((m)->mbase + 0x20970 + (i) * 0x4000) |
1270 |
+ #define I10NM_GET_MCMTR(m, i) \ |
1271 |
+ readl((m)->mbase + 0x20ef8 + (i) * 0x4000) |
1272 |
+ |
1273 |
+@@ -156,11 +156,11 @@ static int i10nm_get_dimm_config(struct mem_ctl_info *mci) |
1274 |
+ continue; |
1275 |
+ |
1276 |
+ ndimms = 0; |
1277 |
++ mcddrtcfg = I10NM_GET_MCDDRTCFG(imc, i); |
1278 |
+ for (j = 0; j < I10NM_NUM_DIMMS; j++) { |
1279 |
+ dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, |
1280 |
+ mci->n_layers, i, j, 0); |
1281 |
+ mtr = I10NM_GET_DIMMMTR(imc, i, j); |
1282 |
+- mcddrtcfg = I10NM_GET_MCDDRTCFG(imc, i, j); |
1283 |
+ edac_dbg(1, "dimmmtr 0x%x mcddrtcfg 0x%x (mc%d ch%d dimm%d)\n", |
1284 |
+ mtr, mcddrtcfg, imc->mc, i, j); |
1285 |
+ |
1286 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c |
1287 |
+index 82155ac3288a0..64ee44c2fdd1d 100644 |
1288 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c |
1289 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c |
1290 |
+@@ -163,17 +163,28 @@ static int acp_poweron(struct generic_pm_domain *genpd) |
1291 |
+ return 0; |
1292 |
+ } |
1293 |
+ |
1294 |
+-static struct device *get_mfd_cell_dev(const char *device_name, int r) |
1295 |
++static int acp_genpd_add_device(struct device *dev, void *data) |
1296 |
+ { |
1297 |
+- char auto_dev_name[25]; |
1298 |
+- struct device *dev; |
1299 |
++ struct generic_pm_domain *gpd = data; |
1300 |
++ int ret; |
1301 |
+ |
1302 |
+- snprintf(auto_dev_name, sizeof(auto_dev_name), |
1303 |
+- "%s.%d.auto", device_name, r); |
1304 |
+- dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name); |
1305 |
+- dev_info(dev, "device %s added to pm domain\n", auto_dev_name); |
1306 |
++ ret = pm_genpd_add_device(gpd, dev); |
1307 |
++ if (ret) |
1308 |
++ dev_err(dev, "Failed to add dev to genpd %d\n", ret); |
1309 |
+ |
1310 |
+- return dev; |
1311 |
++ return ret; |
1312 |
++} |
1313 |
++ |
1314 |
++static int acp_genpd_remove_device(struct device *dev, void *data) |
1315 |
++{ |
1316 |
++ int ret; |
1317 |
++ |
1318 |
++ ret = pm_genpd_remove_device(dev); |
1319 |
++ if (ret) |
1320 |
++ dev_err(dev, "Failed to remove dev from genpd %d\n", ret); |
1321 |
++ |
1322 |
++ /* Continue to remove */ |
1323 |
++ return 0; |
1324 |
+ } |
1325 |
+ |
1326 |
+ /** |
1327 |
+@@ -184,11 +195,10 @@ static struct device *get_mfd_cell_dev(const char *device_name, int r) |
1328 |
+ */ |
1329 |
+ static int acp_hw_init(void *handle) |
1330 |
+ { |
1331 |
+- int r, i; |
1332 |
++ int r; |
1333 |
+ uint64_t acp_base; |
1334 |
+ u32 val = 0; |
1335 |
+ u32 count = 0; |
1336 |
+- struct device *dev; |
1337 |
+ struct i2s_platform_data *i2s_pdata = NULL; |
1338 |
+ |
1339 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
1340 |
+@@ -344,15 +354,10 @@ static int acp_hw_init(void *handle) |
1341 |
+ if (r) |
1342 |
+ goto failure; |
1343 |
+ |
1344 |
+- for (i = 0; i < ACP_DEVS ; i++) { |
1345 |
+- dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
1346 |
+- r = pm_genpd_add_device(&adev->acp.acp_genpd->gpd, dev); |
1347 |
+- if (r) { |
1348 |
+- dev_err(dev, "Failed to add dev to genpd\n"); |
1349 |
+- goto failure; |
1350 |
+- } |
1351 |
+- } |
1352 |
+- |
1353 |
++ r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd, |
1354 |
++ acp_genpd_add_device); |
1355 |
++ if (r) |
1356 |
++ goto failure; |
1357 |
+ |
1358 |
+ /* Assert Soft reset of ACP */ |
1359 |
+ val = cgs_read_register(adev->acp.cgs_device, mmACP_SOFT_RESET); |
1360 |
+@@ -413,10 +418,8 @@ failure: |
1361 |
+ */ |
1362 |
+ static int acp_hw_fini(void *handle) |
1363 |
+ { |
1364 |
+- int i, ret; |
1365 |
+ u32 val = 0; |
1366 |
+ u32 count = 0; |
1367 |
+- struct device *dev; |
1368 |
+ struct amdgpu_device *adev = (struct amdgpu_device *)handle; |
1369 |
+ |
1370 |
+ /* return early if no ACP */ |
1371 |
+@@ -461,13 +464,8 @@ static int acp_hw_fini(void *handle) |
1372 |
+ udelay(100); |
1373 |
+ } |
1374 |
+ |
1375 |
+- for (i = 0; i < ACP_DEVS ; i++) { |
1376 |
+- dev = get_mfd_cell_dev(adev->acp.acp_cell[i].name, i); |
1377 |
+- ret = pm_genpd_remove_device(dev); |
1378 |
+- /* If removal fails, dont giveup and try rest */ |
1379 |
+- if (ret) |
1380 |
+- dev_err(dev, "remove dev from genpd failed\n"); |
1381 |
+- } |
1382 |
++ device_for_each_child(adev->acp.parent, NULL, |
1383 |
++ acp_genpd_remove_device); |
1384 |
+ |
1385 |
+ mfd_remove_devices(adev->acp.parent); |
1386 |
+ kfree(adev->acp.acp_res); |
1387 |
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
1388 |
+index 179e8d52cadb4..a08ca7a47400f 100644 |
1389 |
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
1390 |
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c |
1391 |
+@@ -281,10 +281,12 @@ static void dpu_hw_ctl_clear_all_blendstages(struct dpu_hw_ctl *ctx) |
1392 |
+ int i; |
1393 |
+ |
1394 |
+ for (i = 0; i < ctx->mixer_count; i++) { |
1395 |
+- DPU_REG_WRITE(c, CTL_LAYER(LM_0 + i), 0); |
1396 |
+- DPU_REG_WRITE(c, CTL_LAYER_EXT(LM_0 + i), 0); |
1397 |
+- DPU_REG_WRITE(c, CTL_LAYER_EXT2(LM_0 + i), 0); |
1398 |
+- DPU_REG_WRITE(c, CTL_LAYER_EXT3(LM_0 + i), 0); |
1399 |
++ enum dpu_lm mixer_id = ctx->mixer_hw_caps[i].id; |
1400 |
++ |
1401 |
++ DPU_REG_WRITE(c, CTL_LAYER(mixer_id), 0); |
1402 |
++ DPU_REG_WRITE(c, CTL_LAYER_EXT(mixer_id), 0); |
1403 |
++ DPU_REG_WRITE(c, CTL_LAYER_EXT2(mixer_id), 0); |
1404 |
++ DPU_REG_WRITE(c, CTL_LAYER_EXT3(mixer_id), 0); |
1405 |
+ } |
1406 |
+ } |
1407 |
+ |
1408 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c |
1409 |
+index 55ea4bc2ee9cb..0d37ae5b310c4 100644 |
1410 |
+--- a/drivers/gpu/drm/msm/dsi/dsi.c |
1411 |
++++ b/drivers/gpu/drm/msm/dsi/dsi.c |
1412 |
+@@ -26,8 +26,10 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) |
1413 |
+ } |
1414 |
+ |
1415 |
+ phy_pdev = of_find_device_by_node(phy_node); |
1416 |
+- if (phy_pdev) |
1417 |
++ if (phy_pdev) { |
1418 |
+ msm_dsi->phy = platform_get_drvdata(phy_pdev); |
1419 |
++ msm_dsi->phy_dev = &phy_pdev->dev; |
1420 |
++ } |
1421 |
+ |
1422 |
+ of_node_put(phy_node); |
1423 |
+ |
1424 |
+@@ -36,8 +38,6 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) |
1425 |
+ return -EPROBE_DEFER; |
1426 |
+ } |
1427 |
+ |
1428 |
+- msm_dsi->phy_dev = get_device(&phy_pdev->dev); |
1429 |
+- |
1430 |
+ return 0; |
1431 |
+ } |
1432 |
+ |
1433 |
+diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c |
1434 |
+index 238fb6d54df47..413bf314a2bc3 100644 |
1435 |
+--- a/drivers/gpu/drm/panfrost/panfrost_device.c |
1436 |
++++ b/drivers/gpu/drm/panfrost/panfrost_device.c |
1437 |
+@@ -59,7 +59,8 @@ static int panfrost_clk_init(struct panfrost_device *pfdev) |
1438 |
+ if (IS_ERR(pfdev->bus_clock)) { |
1439 |
+ dev_err(pfdev->dev, "get bus_clock failed %ld\n", |
1440 |
+ PTR_ERR(pfdev->bus_clock)); |
1441 |
+- return PTR_ERR(pfdev->bus_clock); |
1442 |
++ err = PTR_ERR(pfdev->bus_clock); |
1443 |
++ goto disable_clock; |
1444 |
+ } |
1445 |
+ |
1446 |
+ if (pfdev->bus_clock) { |
1447 |
+diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c |
1448 |
+index ff340d7ae2e52..6a880c2623808 100644 |
1449 |
+--- a/drivers/i2c/busses/i2c-highlander.c |
1450 |
++++ b/drivers/i2c/busses/i2c-highlander.c |
1451 |
+@@ -379,7 +379,7 @@ static int highlander_i2c_probe(struct platform_device *pdev) |
1452 |
+ platform_set_drvdata(pdev, dev); |
1453 |
+ |
1454 |
+ dev->irq = platform_get_irq(pdev, 0); |
1455 |
+- if (iic_force_poll) |
1456 |
++ if (dev->irq < 0 || iic_force_poll) |
1457 |
+ dev->irq = 0; |
1458 |
+ |
1459 |
+ if (dev->irq) { |
1460 |
+diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c |
1461 |
+index 2f8b8050a2233..899624721c1ea 100644 |
1462 |
+--- a/drivers/i2c/busses/i2c-iop3xx.c |
1463 |
++++ b/drivers/i2c/busses/i2c-iop3xx.c |
1464 |
+@@ -467,16 +467,14 @@ iop3xx_i2c_probe(struct platform_device *pdev) |
1465 |
+ |
1466 |
+ irq = platform_get_irq(pdev, 0); |
1467 |
+ if (irq < 0) { |
1468 |
+- ret = -ENXIO; |
1469 |
++ ret = irq; |
1470 |
+ goto unmap; |
1471 |
+ } |
1472 |
+ ret = request_irq(irq, iop3xx_i2c_irq_handler, 0, |
1473 |
+ pdev->name, adapter_data); |
1474 |
+ |
1475 |
+- if (ret) { |
1476 |
+- ret = -EIO; |
1477 |
++ if (ret) |
1478 |
+ goto unmap; |
1479 |
+- } |
1480 |
+ |
1481 |
+ memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); |
1482 |
+ new_adapter->owner = THIS_MODULE; |
1483 |
+diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c |
1484 |
+index e1ef0122ef759..5587e7c549c4f 100644 |
1485 |
+--- a/drivers/i2c/busses/i2c-mt65xx.c |
1486 |
++++ b/drivers/i2c/busses/i2c-mt65xx.c |
1487 |
+@@ -932,7 +932,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) |
1488 |
+ return PTR_ERR(i2c->pdmabase); |
1489 |
+ |
1490 |
+ irq = platform_get_irq(pdev, 0); |
1491 |
+- if (irq <= 0) |
1492 |
++ if (irq < 0) |
1493 |
+ return irq; |
1494 |
+ |
1495 |
+ init_completion(&i2c->msg_complete); |
1496 |
+diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c |
1497 |
+index d6322698b2458..e6f927c6f8af9 100644 |
1498 |
+--- a/drivers/i2c/busses/i2c-s3c2410.c |
1499 |
++++ b/drivers/i2c/busses/i2c-s3c2410.c |
1500 |
+@@ -1141,7 +1141,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) |
1501 |
+ */ |
1502 |
+ if (!(i2c->quirks & QUIRK_POLL)) { |
1503 |
+ i2c->irq = ret = platform_get_irq(pdev, 0); |
1504 |
+- if (ret <= 0) { |
1505 |
++ if (ret < 0) { |
1506 |
+ dev_err(&pdev->dev, "cannot find IRQ\n"); |
1507 |
+ clk_unprepare(i2c->clk); |
1508 |
+ return ret; |
1509 |
+diff --git a/drivers/leds/leds-lt3593.c b/drivers/leds/leds-lt3593.c |
1510 |
+index c94995f0daa2a..03ae33093ce63 100644 |
1511 |
+--- a/drivers/leds/leds-lt3593.c |
1512 |
++++ b/drivers/leds/leds-lt3593.c |
1513 |
+@@ -103,10 +103,9 @@ static int lt3593_led_probe(struct platform_device *pdev) |
1514 |
+ init_data.default_label = ":"; |
1515 |
+ |
1516 |
+ ret = devm_led_classdev_register_ext(dev, &led_data->cdev, &init_data); |
1517 |
+- if (ret < 0) { |
1518 |
+- fwnode_handle_put(child); |
1519 |
++ fwnode_handle_put(child); |
1520 |
++ if (ret < 0) |
1521 |
+ return ret; |
1522 |
+- } |
1523 |
+ |
1524 |
+ led_data->cdev.dev->of_node = dev->of_node; |
1525 |
+ platform_set_drvdata(pdev, led_data); |
1526 |
+diff --git a/drivers/leds/trigger/ledtrig-audio.c b/drivers/leds/trigger/ledtrig-audio.c |
1527 |
+index f76621e88482d..c6b437e6369b8 100644 |
1528 |
+--- a/drivers/leds/trigger/ledtrig-audio.c |
1529 |
++++ b/drivers/leds/trigger/ledtrig-audio.c |
1530 |
+@@ -6,10 +6,33 @@ |
1531 |
+ #include <linux/kernel.h> |
1532 |
+ #include <linux/leds.h> |
1533 |
+ #include <linux/module.h> |
1534 |
++#include "../leds.h" |
1535 |
+ |
1536 |
+-static struct led_trigger *ledtrig_audio[NUM_AUDIO_LEDS]; |
1537 |
+ static enum led_brightness audio_state[NUM_AUDIO_LEDS]; |
1538 |
+ |
1539 |
++static int ledtrig_audio_mute_activate(struct led_classdev *led_cdev) |
1540 |
++{ |
1541 |
++ led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MUTE]); |
1542 |
++ return 0; |
1543 |
++} |
1544 |
++ |
1545 |
++static int ledtrig_audio_micmute_activate(struct led_classdev *led_cdev) |
1546 |
++{ |
1547 |
++ led_set_brightness_nosleep(led_cdev, audio_state[LED_AUDIO_MICMUTE]); |
1548 |
++ return 0; |
1549 |
++} |
1550 |
++ |
1551 |
++static struct led_trigger ledtrig_audio[NUM_AUDIO_LEDS] = { |
1552 |
++ [LED_AUDIO_MUTE] = { |
1553 |
++ .name = "audio-mute", |
1554 |
++ .activate = ledtrig_audio_mute_activate, |
1555 |
++ }, |
1556 |
++ [LED_AUDIO_MICMUTE] = { |
1557 |
++ .name = "audio-micmute", |
1558 |
++ .activate = ledtrig_audio_micmute_activate, |
1559 |
++ }, |
1560 |
++}; |
1561 |
++ |
1562 |
+ enum led_brightness ledtrig_audio_get(enum led_audio type) |
1563 |
+ { |
1564 |
+ return audio_state[type]; |
1565 |
+@@ -19,24 +42,22 @@ EXPORT_SYMBOL_GPL(ledtrig_audio_get); |
1566 |
+ void ledtrig_audio_set(enum led_audio type, enum led_brightness state) |
1567 |
+ { |
1568 |
+ audio_state[type] = state; |
1569 |
+- led_trigger_event(ledtrig_audio[type], state); |
1570 |
++ led_trigger_event(&ledtrig_audio[type], state); |
1571 |
+ } |
1572 |
+ EXPORT_SYMBOL_GPL(ledtrig_audio_set); |
1573 |
+ |
1574 |
+ static int __init ledtrig_audio_init(void) |
1575 |
+ { |
1576 |
+- led_trigger_register_simple("audio-mute", |
1577 |
+- &ledtrig_audio[LED_AUDIO_MUTE]); |
1578 |
+- led_trigger_register_simple("audio-micmute", |
1579 |
+- &ledtrig_audio[LED_AUDIO_MICMUTE]); |
1580 |
++ led_trigger_register(&ledtrig_audio[LED_AUDIO_MUTE]); |
1581 |
++ led_trigger_register(&ledtrig_audio[LED_AUDIO_MICMUTE]); |
1582 |
+ return 0; |
1583 |
+ } |
1584 |
+ module_init(ledtrig_audio_init); |
1585 |
+ |
1586 |
+ static void __exit ledtrig_audio_exit(void) |
1587 |
+ { |
1588 |
+- led_trigger_unregister_simple(ledtrig_audio[LED_AUDIO_MUTE]); |
1589 |
+- led_trigger_unregister_simple(ledtrig_audio[LED_AUDIO_MICMUTE]); |
1590 |
++ led_trigger_unregister(&ledtrig_audio[LED_AUDIO_MUTE]); |
1591 |
++ led_trigger_unregister(&ledtrig_audio[LED_AUDIO_MICMUTE]); |
1592 |
+ } |
1593 |
+ module_exit(ledtrig_audio_exit); |
1594 |
+ |
1595 |
+diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c |
1596 |
+index b0d569032dd4e..efdf6ce0443ea 100644 |
1597 |
+--- a/drivers/md/bcache/super.c |
1598 |
++++ b/drivers/md/bcache/super.c |
1599 |
+@@ -839,20 +839,20 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, |
1600 |
+ n = BITS_TO_LONGS(d->nr_stripes) * sizeof(unsigned long); |
1601 |
+ d->full_dirty_stripes = kvzalloc(n, GFP_KERNEL); |
1602 |
+ if (!d->full_dirty_stripes) |
1603 |
+- return -ENOMEM; |
1604 |
++ goto out_free_stripe_sectors_dirty; |
1605 |
+ |
1606 |
+ idx = ida_simple_get(&bcache_device_idx, 0, |
1607 |
+ BCACHE_DEVICE_IDX_MAX, GFP_KERNEL); |
1608 |
+ if (idx < 0) |
1609 |
+- return idx; |
1610 |
++ goto out_free_full_dirty_stripes; |
1611 |
+ |
1612 |
+ if (bioset_init(&d->bio_split, 4, offsetof(struct bbio, bio), |
1613 |
+ BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER)) |
1614 |
+- goto err; |
1615 |
++ goto out_ida_remove; |
1616 |
+ |
1617 |
+ d->disk = alloc_disk(BCACHE_MINORS); |
1618 |
+ if (!d->disk) |
1619 |
+- goto err; |
1620 |
++ goto out_bioset_exit; |
1621 |
+ |
1622 |
+ set_capacity(d->disk, sectors); |
1623 |
+ snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", idx); |
1624 |
+@@ -887,8 +887,14 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size, |
1625 |
+ |
1626 |
+ return 0; |
1627 |
+ |
1628 |
+-err: |
1629 |
++out_bioset_exit: |
1630 |
++ bioset_exit(&d->bio_split); |
1631 |
++out_ida_remove: |
1632 |
+ ida_simple_remove(&bcache_device_idx, idx); |
1633 |
++out_free_full_dirty_stripes: |
1634 |
++ kvfree(d->full_dirty_stripes); |
1635 |
++out_free_stripe_sectors_dirty: |
1636 |
++ kvfree(d->stripe_sectors_dirty); |
1637 |
+ return -ENOMEM; |
1638 |
+ |
1639 |
+ } |
1640 |
+diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c |
1641 |
+index e43d8327b8103..1088161498df0 100644 |
1642 |
+--- a/drivers/media/i2c/tda1997x.c |
1643 |
++++ b/drivers/media/i2c/tda1997x.c |
1644 |
+@@ -2233,6 +2233,7 @@ static int tda1997x_core_init(struct v4l2_subdev *sd) |
1645 |
+ /* get initial HDMI status */ |
1646 |
+ state->hdmi_status = io_read(sd, REG_HDMI_FLAGS); |
1647 |
+ |
1648 |
++ io_write(sd, REG_EDID_ENABLE, EDID_ENABLE_A_EN | EDID_ENABLE_B_EN); |
1649 |
+ return 0; |
1650 |
+ } |
1651 |
+ |
1652 |
+diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c |
1653 |
+index 00c7bed3dd572..e6b68be09f8f0 100644 |
1654 |
+--- a/drivers/media/platform/coda/coda-bit.c |
1655 |
++++ b/drivers/media/platform/coda/coda-bit.c |
1656 |
+@@ -2023,17 +2023,25 @@ static int __coda_start_decoding(struct coda_ctx *ctx) |
1657 |
+ u32 src_fourcc, dst_fourcc; |
1658 |
+ int ret; |
1659 |
+ |
1660 |
++ q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); |
1661 |
++ q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
1662 |
++ src_fourcc = q_data_src->fourcc; |
1663 |
++ dst_fourcc = q_data_dst->fourcc; |
1664 |
++ |
1665 |
+ if (!ctx->initialized) { |
1666 |
+ ret = __coda_decoder_seq_init(ctx); |
1667 |
+ if (ret < 0) |
1668 |
+ return ret; |
1669 |
++ } else { |
1670 |
++ ctx->frame_mem_ctrl &= ~(CODA_FRAME_CHROMA_INTERLEAVE | (0x3 << 9) | |
1671 |
++ CODA9_FRAME_TILED2LINEAR); |
1672 |
++ if (dst_fourcc == V4L2_PIX_FMT_NV12 || dst_fourcc == V4L2_PIX_FMT_YUYV) |
1673 |
++ ctx->frame_mem_ctrl |= CODA_FRAME_CHROMA_INTERLEAVE; |
1674 |
++ if (ctx->tiled_map_type == GDI_TILED_FRAME_MB_RASTER_MAP) |
1675 |
++ ctx->frame_mem_ctrl |= (0x3 << 9) | |
1676 |
++ ((ctx->use_vdoa) ? 0 : CODA9_FRAME_TILED2LINEAR); |
1677 |
+ } |
1678 |
+ |
1679 |
+- q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); |
1680 |
+- q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
1681 |
+- src_fourcc = q_data_src->fourcc; |
1682 |
+- dst_fourcc = q_data_dst->fourcc; |
1683 |
+- |
1684 |
+ coda_write(dev, ctx->parabuf.paddr, CODA_REG_BIT_PARA_BUF_ADDR); |
1685 |
+ |
1686 |
+ ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc); |
1687 |
+diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c |
1688 |
+index 30028ceb548b1..766ca497f8565 100644 |
1689 |
+--- a/drivers/media/platform/qcom/venus/venc.c |
1690 |
++++ b/drivers/media/platform/qcom/venus/venc.c |
1691 |
+@@ -308,6 +308,8 @@ venc_try_fmt_common(struct venus_inst *inst, struct v4l2_format *f) |
1692 |
+ else |
1693 |
+ return NULL; |
1694 |
+ fmt = find_format(inst, pixmp->pixelformat, f->type); |
1695 |
++ if (!fmt) |
1696 |
++ return NULL; |
1697 |
+ } |
1698 |
+ |
1699 |
+ pixmp->width = clamp(pixmp->width, frame_width_min(inst), |
1700 |
+diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c |
1701 |
+index 4077217777f92..93194f03764d2 100644 |
1702 |
+--- a/drivers/media/spi/cxd2880-spi.c |
1703 |
++++ b/drivers/media/spi/cxd2880-spi.c |
1704 |
+@@ -524,13 +524,13 @@ cxd2880_spi_probe(struct spi_device *spi) |
1705 |
+ if (IS_ERR(dvb_spi->vcc_supply)) { |
1706 |
+ if (PTR_ERR(dvb_spi->vcc_supply) == -EPROBE_DEFER) { |
1707 |
+ ret = -EPROBE_DEFER; |
1708 |
+- goto fail_adapter; |
1709 |
++ goto fail_regulator; |
1710 |
+ } |
1711 |
+ dvb_spi->vcc_supply = NULL; |
1712 |
+ } else { |
1713 |
+ ret = regulator_enable(dvb_spi->vcc_supply); |
1714 |
+ if (ret) |
1715 |
+- goto fail_adapter; |
1716 |
++ goto fail_regulator; |
1717 |
+ } |
1718 |
+ |
1719 |
+ dvb_spi->spi = spi; |
1720 |
+@@ -618,6 +618,9 @@ fail_frontend: |
1721 |
+ fail_attach: |
1722 |
+ dvb_unregister_adapter(&dvb_spi->adapter); |
1723 |
+ fail_adapter: |
1724 |
++ if (!dvb_spi->vcc_supply) |
1725 |
++ regulator_disable(dvb_spi->vcc_supply); |
1726 |
++fail_regulator: |
1727 |
+ kfree(dvb_spi); |
1728 |
+ return ret; |
1729 |
+ } |
1730 |
+diff --git a/drivers/media/usb/dvb-usb/dvb-usb-i2c.c b/drivers/media/usb/dvb-usb/dvb-usb-i2c.c |
1731 |
+index 2e07106f46803..bc4b2abdde1a4 100644 |
1732 |
+--- a/drivers/media/usb/dvb-usb/dvb-usb-i2c.c |
1733 |
++++ b/drivers/media/usb/dvb-usb/dvb-usb-i2c.c |
1734 |
+@@ -17,7 +17,8 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) |
1735 |
+ |
1736 |
+ if (d->props.i2c_algo == NULL) { |
1737 |
+ err("no i2c algorithm specified"); |
1738 |
+- return -EINVAL; |
1739 |
++ ret = -EINVAL; |
1740 |
++ goto err; |
1741 |
+ } |
1742 |
+ |
1743 |
+ strscpy(d->i2c_adap.name, d->desc->name, sizeof(d->i2c_adap.name)); |
1744 |
+@@ -27,11 +28,15 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) |
1745 |
+ |
1746 |
+ i2c_set_adapdata(&d->i2c_adap, d); |
1747 |
+ |
1748 |
+- if ((ret = i2c_add_adapter(&d->i2c_adap)) < 0) |
1749 |
++ ret = i2c_add_adapter(&d->i2c_adap); |
1750 |
++ if (ret < 0) { |
1751 |
+ err("could not add i2c adapter"); |
1752 |
++ goto err; |
1753 |
++ } |
1754 |
+ |
1755 |
+ d->state |= DVB_USB_STATE_I2C; |
1756 |
+ |
1757 |
++err: |
1758 |
+ return ret; |
1759 |
+ } |
1760 |
+ |
1761 |
+diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c |
1762 |
+index f57c4627624f5..e7720ff11d3d9 100644 |
1763 |
+--- a/drivers/media/usb/dvb-usb/dvb-usb-init.c |
1764 |
++++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c |
1765 |
+@@ -194,8 +194,8 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) |
1766 |
+ |
1767 |
+ err_adapter_init: |
1768 |
+ dvb_usb_adapter_exit(d); |
1769 |
+-err_i2c_init: |
1770 |
+ dvb_usb_i2c_exit(d); |
1771 |
++err_i2c_init: |
1772 |
+ if (d->priv && d->props.priv_destroy) |
1773 |
+ d->props.priv_destroy(d); |
1774 |
+ err_priv_init: |
1775 |
+diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1776 |
+index e368935a50894..c16d4f1624952 100644 |
1777 |
+--- a/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1778 |
++++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1779 |
+@@ -130,7 +130,7 @@ ret: |
1780 |
+ |
1781 |
+ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) |
1782 |
+ { |
1783 |
+- int i; |
1784 |
++ int i, ret; |
1785 |
+ u8 b; |
1786 |
+ |
1787 |
+ mac[0] = 0x00; |
1788 |
+@@ -139,7 +139,9 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) |
1789 |
+ |
1790 |
+ /* this is a complete guess, but works for my box */ |
1791 |
+ for (i = 136; i < 139; i++) { |
1792 |
+- dibusb_read_eeprom_byte(d,i, &b); |
1793 |
++ ret = dibusb_read_eeprom_byte(d, i, &b); |
1794 |
++ if (ret) |
1795 |
++ return ret; |
1796 |
+ |
1797 |
+ mac[5 - (i - 136)] = b; |
1798 |
+ } |
1799 |
+diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c |
1800 |
+index 381b5c898a076..b7ee972455e5b 100644 |
1801 |
+--- a/drivers/media/usb/dvb-usb/vp702x.c |
1802 |
++++ b/drivers/media/usb/dvb-usb/vp702x.c |
1803 |
+@@ -291,16 +291,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
1804 |
+ static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) |
1805 |
+ { |
1806 |
+ u8 i, *buf; |
1807 |
++ int ret; |
1808 |
+ struct vp702x_device_state *st = d->priv; |
1809 |
+ |
1810 |
+ mutex_lock(&st->buf_mutex); |
1811 |
+ buf = st->buf; |
1812 |
+- for (i = 6; i < 12; i++) |
1813 |
+- vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1); |
1814 |
++ for (i = 6; i < 12; i++) { |
1815 |
++ ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, |
1816 |
++ &buf[i - 6], 1); |
1817 |
++ if (ret < 0) |
1818 |
++ goto err; |
1819 |
++ } |
1820 |
+ |
1821 |
+ memcpy(mac, buf, 6); |
1822 |
++err: |
1823 |
+ mutex_unlock(&st->buf_mutex); |
1824 |
+- return 0; |
1825 |
++ return ret; |
1826 |
+ } |
1827 |
+ |
1828 |
+ static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) |
1829 |
+diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c |
1830 |
+index 59529cbf9cd0b..0b6d77c3bec86 100644 |
1831 |
+--- a/drivers/media/usb/em28xx/em28xx-input.c |
1832 |
++++ b/drivers/media/usb/em28xx/em28xx-input.c |
1833 |
+@@ -842,7 +842,6 @@ error: |
1834 |
+ kfree(ir); |
1835 |
+ ref_put: |
1836 |
+ em28xx_shutdown_buttons(dev); |
1837 |
+- kref_put(&dev->ref, em28xx_free_device); |
1838 |
+ return err; |
1839 |
+ } |
1840 |
+ |
1841 |
+diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c |
1842 |
+index 153a0c3e3da64..b9302d77d6c83 100644 |
1843 |
+--- a/drivers/media/usb/go7007/go7007-driver.c |
1844 |
++++ b/drivers/media/usb/go7007/go7007-driver.c |
1845 |
+@@ -691,49 +691,23 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board, |
1846 |
+ struct device *dev) |
1847 |
+ { |
1848 |
+ struct go7007 *go; |
1849 |
+- int i; |
1850 |
+ |
1851 |
+ go = kzalloc(sizeof(struct go7007), GFP_KERNEL); |
1852 |
+ if (go == NULL) |
1853 |
+ return NULL; |
1854 |
+ go->dev = dev; |
1855 |
+ go->board_info = board; |
1856 |
+- go->board_id = 0; |
1857 |
+ go->tuner_type = -1; |
1858 |
+- go->channel_number = 0; |
1859 |
+- go->name[0] = 0; |
1860 |
+ mutex_init(&go->hw_lock); |
1861 |
+ init_waitqueue_head(&go->frame_waitq); |
1862 |
+ spin_lock_init(&go->spinlock); |
1863 |
+ go->status = STATUS_INIT; |
1864 |
+- memset(&go->i2c_adapter, 0, sizeof(go->i2c_adapter)); |
1865 |
+- go->i2c_adapter_online = 0; |
1866 |
+- go->interrupt_available = 0; |
1867 |
+ init_waitqueue_head(&go->interrupt_waitq); |
1868 |
+- go->input = 0; |
1869 |
+ go7007_update_board(go); |
1870 |
+- go->encoder_h_halve = 0; |
1871 |
+- go->encoder_v_halve = 0; |
1872 |
+- go->encoder_subsample = 0; |
1873 |
+ go->format = V4L2_PIX_FMT_MJPEG; |
1874 |
+ go->bitrate = 1500000; |
1875 |
+ go->fps_scale = 1; |
1876 |
+- go->pali = 0; |
1877 |
+ go->aspect_ratio = GO7007_RATIO_1_1; |
1878 |
+- go->gop_size = 0; |
1879 |
+- go->ipb = 0; |
1880 |
+- go->closed_gop = 0; |
1881 |
+- go->repeat_seqhead = 0; |
1882 |
+- go->seq_header_enable = 0; |
1883 |
+- go->gop_header_enable = 0; |
1884 |
+- go->dvd_mode = 0; |
1885 |
+- go->interlace_coding = 0; |
1886 |
+- for (i = 0; i < 4; ++i) |
1887 |
+- go->modet[i].enable = 0; |
1888 |
+- for (i = 0; i < 1624; ++i) |
1889 |
+- go->modet_map[i] = 0; |
1890 |
+- go->audio_deliver = NULL; |
1891 |
+- go->audio_enabled = 0; |
1892 |
+ |
1893 |
+ return go; |
1894 |
+ } |
1895 |
+diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c |
1896 |
+index 6ace82028667b..7b280cb363271 100644 |
1897 |
+--- a/drivers/mmc/host/dw_mmc.c |
1898 |
++++ b/drivers/mmc/host/dw_mmc.c |
1899 |
+@@ -782,6 +782,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host, |
1900 |
+ int ret = 0; |
1901 |
+ |
1902 |
+ /* Set external dma config: burst size, burst width */ |
1903 |
++ memset(&cfg, 0, sizeof(cfg)); |
1904 |
+ cfg.dst_addr = host->phy_regs + fifo_offset; |
1905 |
+ cfg.src_addr = cfg.dst_addr; |
1906 |
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1907 |
+diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c |
1908 |
+index a0670e9cd0127..5553a5643f405 100644 |
1909 |
+--- a/drivers/mmc/host/moxart-mmc.c |
1910 |
++++ b/drivers/mmc/host/moxart-mmc.c |
1911 |
+@@ -631,6 +631,7 @@ static int moxart_probe(struct platform_device *pdev) |
1912 |
+ host->dma_chan_tx, host->dma_chan_rx); |
1913 |
+ host->have_dma = true; |
1914 |
+ |
1915 |
++ memset(&cfg, 0, sizeof(cfg)); |
1916 |
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1917 |
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1918 |
+ |
1919 |
+diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
1920 |
+index d82a519a0cd9a..f9f246c82c974 100644 |
1921 |
+--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
1922 |
++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c |
1923 |
+@@ -2013,10 +2013,11 @@ int rvu_mbox_handler_npc_mcam_unmap_counter(struct rvu *rvu, |
1924 |
+ index = find_next_bit(mcam->bmap, mcam->bmap_entries, entry); |
1925 |
+ if (index >= mcam->bmap_entries) |
1926 |
+ break; |
1927 |
++ entry = index + 1; |
1928 |
++ |
1929 |
+ if (mcam->entry2cntr_map[index] != req->cntr) |
1930 |
+ continue; |
1931 |
+ |
1932 |
+- entry = index + 1; |
1933 |
+ npc_unmap_mcam_entry_and_cntr(rvu, mcam, blkaddr, |
1934 |
+ index, req->cntr); |
1935 |
+ } |
1936 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1937 |
+index d48292ccda294..9239d767443f2 100644 |
1938 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1939 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/fs.h |
1940 |
+@@ -234,18 +234,12 @@ struct ttc_params { |
1941 |
+ |
1942 |
+ void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, struct ttc_params *ttc_params); |
1943 |
+ void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params); |
1944 |
+-void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params); |
1945 |
+ |
1946 |
+ int mlx5e_create_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
1947 |
+ struct mlx5e_ttc_table *ttc); |
1948 |
+ void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv, |
1949 |
+ struct mlx5e_ttc_table *ttc); |
1950 |
+ |
1951 |
+-int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
1952 |
+- struct mlx5e_ttc_table *ttc); |
1953 |
+-void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv, |
1954 |
+- struct mlx5e_ttc_table *ttc); |
1955 |
+- |
1956 |
+ void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft); |
1957 |
+ |
1958 |
+ void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv); |
1959 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1960 |
+index c4ac7a9968d16..c3b9278486a1e 100644 |
1961 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1962 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_fs.c |
1963 |
+@@ -1123,7 +1123,7 @@ void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, |
1964 |
+ ttc_params->inner_ttc = &priv->fs.inner_ttc; |
1965 |
+ } |
1966 |
+ |
1967 |
+-void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params) |
1968 |
++static void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params) |
1969 |
+ { |
1970 |
+ struct mlx5_flow_table_attr *ft_attr = &ttc_params->ft_attr; |
1971 |
+ |
1972 |
+@@ -1142,8 +1142,8 @@ void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params) |
1973 |
+ ft_attr->prio = MLX5E_NIC_PRIO; |
1974 |
+ } |
1975 |
+ |
1976 |
+-int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
1977 |
+- struct mlx5e_ttc_table *ttc) |
1978 |
++static int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
1979 |
++ struct mlx5e_ttc_table *ttc) |
1980 |
+ { |
1981 |
+ struct mlx5e_flow_table *ft = &ttc->ft; |
1982 |
+ int err; |
1983 |
+@@ -1173,8 +1173,8 @@ err: |
1984 |
+ return err; |
1985 |
+ } |
1986 |
+ |
1987 |
+-void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv, |
1988 |
+- struct mlx5e_ttc_table *ttc) |
1989 |
++static void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv, |
1990 |
++ struct mlx5e_ttc_table *ttc) |
1991 |
+ { |
1992 |
+ if (!mlx5e_tunnel_inner_ft_supported(priv->mdev)) |
1993 |
+ return; |
1994 |
+diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c |
1995 |
+index 0fed2419623d1..1f3d12faa2a5b 100644 |
1996 |
+--- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c |
1997 |
++++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c |
1998 |
+@@ -319,17 +319,6 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) |
1999 |
+ } |
2000 |
+ |
2001 |
+ mlx5e_set_ttc_basic_params(priv, &ttc_params); |
2002 |
+- mlx5e_set_inner_ttc_ft_params(&ttc_params); |
2003 |
+- for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) |
2004 |
+- ttc_params.indir_tirn[tt] = priv->inner_indir_tir[tt].tirn; |
2005 |
+- |
2006 |
+- err = mlx5e_create_inner_ttc_table(priv, &ttc_params, &priv->fs.inner_ttc); |
2007 |
+- if (err) { |
2008 |
+- netdev_err(priv->netdev, "Failed to create inner ttc table, err=%d\n", |
2009 |
+- err); |
2010 |
+- goto err_destroy_arfs_tables; |
2011 |
+- } |
2012 |
+- |
2013 |
+ mlx5e_set_ttc_ft_params(&ttc_params); |
2014 |
+ for (tt = 0; tt < MLX5E_NUM_INDIR_TIRS; tt++) |
2015 |
+ ttc_params.indir_tirn[tt] = priv->indir_tir[tt].tirn; |
2016 |
+@@ -338,13 +327,11 @@ static int mlx5i_create_flow_steering(struct mlx5e_priv *priv) |
2017 |
+ if (err) { |
2018 |
+ netdev_err(priv->netdev, "Failed to create ttc table, err=%d\n", |
2019 |
+ err); |
2020 |
+- goto err_destroy_inner_ttc_table; |
2021 |
++ goto err_destroy_arfs_tables; |
2022 |
+ } |
2023 |
+ |
2024 |
+ return 0; |
2025 |
+ |
2026 |
+-err_destroy_inner_ttc_table: |
2027 |
+- mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc); |
2028 |
+ err_destroy_arfs_tables: |
2029 |
+ mlx5e_arfs_destroy_tables(priv); |
2030 |
+ |
2031 |
+@@ -354,7 +341,6 @@ err_destroy_arfs_tables: |
2032 |
+ static void mlx5i_destroy_flow_steering(struct mlx5e_priv *priv) |
2033 |
+ { |
2034 |
+ mlx5e_destroy_ttc_table(priv, &priv->fs.ttc); |
2035 |
+- mlx5e_destroy_inner_ttc_table(priv, &priv->fs.inner_ttc); |
2036 |
+ mlx5e_arfs_destroy_tables(priv); |
2037 |
+ } |
2038 |
+ |
2039 |
+@@ -379,7 +365,7 @@ static int mlx5i_init_rx(struct mlx5e_priv *priv) |
2040 |
+ if (err) |
2041 |
+ goto err_destroy_indirect_rqts; |
2042 |
+ |
2043 |
+- err = mlx5e_create_indirect_tirs(priv, true); |
2044 |
++ err = mlx5e_create_indirect_tirs(priv, false); |
2045 |
+ if (err) |
2046 |
+ goto err_destroy_direct_rqts; |
2047 |
+ |
2048 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c |
2049 |
+index baac016f3ec0b..15591ad5fe4ea 100644 |
2050 |
+--- a/drivers/net/ethernet/qualcomm/qca_spi.c |
2051 |
++++ b/drivers/net/ethernet/qualcomm/qca_spi.c |
2052 |
+@@ -434,7 +434,7 @@ qcaspi_receive(struct qcaspi *qca) |
2053 |
+ skb_put(qca->rx_skb, retcode); |
2054 |
+ qca->rx_skb->protocol = eth_type_trans( |
2055 |
+ qca->rx_skb, qca->rx_skb->dev); |
2056 |
+- qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY; |
2057 |
++ skb_checksum_none_assert(qca->rx_skb); |
2058 |
+ netif_rx_ni(qca->rx_skb); |
2059 |
+ qca->rx_skb = netdev_alloc_skb_ip_align(net_dev, |
2060 |
+ net_dev->mtu + VLAN_ETH_HLEN); |
2061 |
+diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c |
2062 |
+index 0981068504fa7..ade70f5df496c 100644 |
2063 |
+--- a/drivers/net/ethernet/qualcomm/qca_uart.c |
2064 |
++++ b/drivers/net/ethernet/qualcomm/qca_uart.c |
2065 |
+@@ -107,7 +107,7 @@ qca_tty_receive(struct serdev_device *serdev, const unsigned char *data, |
2066 |
+ skb_put(qca->rx_skb, retcode); |
2067 |
+ qca->rx_skb->protocol = eth_type_trans( |
2068 |
+ qca->rx_skb, qca->rx_skb->dev); |
2069 |
+- qca->rx_skb->ip_summed = CHECKSUM_UNNECESSARY; |
2070 |
++ skb_checksum_none_assert(qca->rx_skb); |
2071 |
+ netif_rx_ni(qca->rx_skb); |
2072 |
+ qca->rx_skb = netdev_alloc_skb_ip_align(netdev, |
2073 |
+ netdev->mtu + |
2074 |
+diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c |
2075 |
+index c610fe21c85c0..31ffec3a59727 100644 |
2076 |
+--- a/drivers/net/wireless/ath/ath6kl/wmi.c |
2077 |
++++ b/drivers/net/wireless/ath/ath6kl/wmi.c |
2078 |
+@@ -2510,8 +2510,10 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx) |
2079 |
+ goto free_data_skb; |
2080 |
+ |
2081 |
+ for (index = 0; index < num_pri_streams; index++) { |
2082 |
+- if (WARN_ON(!data_sync_bufs[index].skb)) |
2083 |
++ if (WARN_ON(!data_sync_bufs[index].skb)) { |
2084 |
++ ret = -ENOMEM; |
2085 |
+ goto free_data_skb; |
2086 |
++ } |
2087 |
+ |
2088 |
+ ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev, |
2089 |
+ data_sync_bufs[index]. |
2090 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
2091 |
+index bda042138e967..e6001f0a81a3a 100644 |
2092 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
2093 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c |
2094 |
+@@ -2073,7 +2073,7 @@ cleanup: |
2095 |
+ |
2096 |
+ err = brcmf_pcie_probe(pdev, NULL); |
2097 |
+ if (err) |
2098 |
+- brcmf_err(bus, "probe after resume failed, err=%d\n", err); |
2099 |
++ __brcmf_err(NULL, __func__, "probe after resume failed, err=%d\n", err); |
2100 |
+ |
2101 |
+ return err; |
2102 |
+ } |
2103 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c |
2104 |
+index 03791f3fe480c..5e6c5d13319d5 100644 |
2105 |
+--- a/drivers/net/wireless/rsi/rsi_91x_hal.c |
2106 |
++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c |
2107 |
+@@ -1038,8 +1038,10 @@ static int rsi_load_9116_firmware(struct rsi_hw *adapter) |
2108 |
+ } |
2109 |
+ |
2110 |
+ ta_firmware = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); |
2111 |
+- if (!ta_firmware) |
2112 |
++ if (!ta_firmware) { |
2113 |
++ status = -ENOMEM; |
2114 |
+ goto fail_release_fw; |
2115 |
++ } |
2116 |
+ fw_p = ta_firmware; |
2117 |
+ instructions_sz = fw_entry->size; |
2118 |
+ rsi_dbg(INFO_ZONE, "FW Length = %d bytes\n", instructions_sz); |
2119 |
+diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c |
2120 |
+index a296f4e0d324a..e8aa3d4bda885 100644 |
2121 |
+--- a/drivers/net/wireless/rsi/rsi_91x_usb.c |
2122 |
++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c |
2123 |
+@@ -806,6 +806,7 @@ static int rsi_probe(struct usb_interface *pfunction, |
2124 |
+ } else { |
2125 |
+ rsi_dbg(ERR_ZONE, "%s: Unsupported RSI device id 0x%x\n", |
2126 |
+ __func__, id->idProduct); |
2127 |
++ status = -ENODEV; |
2128 |
+ goto err1; |
2129 |
+ } |
2130 |
+ |
2131 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
2132 |
+index b8c0f75bfb7ba..dcc3d2393605e 100644 |
2133 |
+--- a/drivers/nvme/host/rdma.c |
2134 |
++++ b/drivers/nvme/host/rdma.c |
2135 |
+@@ -665,13 +665,13 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) |
2136 |
+ if (ret) |
2137 |
+ return ret; |
2138 |
+ |
2139 |
+- ctrl->ctrl.queue_count = nr_io_queues + 1; |
2140 |
+- if (ctrl->ctrl.queue_count < 2) { |
2141 |
++ if (nr_io_queues == 0) { |
2142 |
+ dev_err(ctrl->ctrl.device, |
2143 |
+ "unable to set any I/O queues\n"); |
2144 |
+ return -ENOMEM; |
2145 |
+ } |
2146 |
+ |
2147 |
++ ctrl->ctrl.queue_count = nr_io_queues + 1; |
2148 |
+ dev_info(ctrl->ctrl.device, |
2149 |
+ "creating %d I/O queues.\n", nr_io_queues); |
2150 |
+ |
2151 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
2152 |
+index 718152adc6254..f6427a10a9908 100644 |
2153 |
+--- a/drivers/nvme/host/tcp.c |
2154 |
++++ b/drivers/nvme/host/tcp.c |
2155 |
+@@ -1649,13 +1649,13 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) |
2156 |
+ if (ret) |
2157 |
+ return ret; |
2158 |
+ |
2159 |
+- ctrl->queue_count = nr_io_queues + 1; |
2160 |
+- if (ctrl->queue_count < 2) { |
2161 |
++ if (nr_io_queues == 0) { |
2162 |
+ dev_err(ctrl->device, |
2163 |
+ "unable to set any I/O queues\n"); |
2164 |
+ return -ENOMEM; |
2165 |
+ } |
2166 |
+ |
2167 |
++ ctrl->queue_count = nr_io_queues + 1; |
2168 |
+ dev_info(ctrl->device, |
2169 |
+ "creating %d I/O queues.\n", nr_io_queues); |
2170 |
+ |
2171 |
+diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c |
2172 |
+index 4e9004fe5c6f3..5e47395afc1d5 100644 |
2173 |
+--- a/drivers/nvme/target/fabrics-cmd.c |
2174 |
++++ b/drivers/nvme/target/fabrics-cmd.c |
2175 |
+@@ -116,6 +116,7 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req) |
2176 |
+ if (!sqsize) { |
2177 |
+ pr_warn("queue size zero!\n"); |
2178 |
+ req->error_loc = offsetof(struct nvmf_connect_command, sqsize); |
2179 |
++ req->cqe->result.u32 = IPO_IATTR_CONNECT_SQE(sqsize); |
2180 |
+ ret = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR; |
2181 |
+ goto err; |
2182 |
+ } |
2183 |
+@@ -250,11 +251,11 @@ static void nvmet_execute_io_connect(struct nvmet_req *req) |
2184 |
+ } |
2185 |
+ |
2186 |
+ status = nvmet_install_queue(ctrl, req); |
2187 |
+- if (status) { |
2188 |
+- /* pass back cntlid that had the issue of installing queue */ |
2189 |
+- req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid); |
2190 |
++ if (status) |
2191 |
+ goto out_ctrl_put; |
2192 |
+- } |
2193 |
++ |
2194 |
++ /* pass back cntlid for successful completion */ |
2195 |
++ req->cqe->result.u16 = cpu_to_le16(ctrl->cntlid); |
2196 |
+ |
2197 |
+ pr_debug("adding queue %d to ctrl %d.\n", qid, ctrl->cntlid); |
2198 |
+ |
2199 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
2200 |
+index 3c3bc9f584983..58c33b65d451a 100644 |
2201 |
+--- a/drivers/pci/pci.c |
2202 |
++++ b/drivers/pci/pci.c |
2203 |
+@@ -2253,7 +2253,14 @@ static int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable |
2204 |
+ if (enable) { |
2205 |
+ int error; |
2206 |
+ |
2207 |
+- if (pci_pme_capable(dev, state)) |
2208 |
++ /* |
2209 |
++ * Enable PME signaling if the device can signal PME from |
2210 |
++ * D3cold regardless of whether or not it can signal PME from |
2211 |
++ * the current target state, because that will allow it to |
2212 |
++ * signal PME when the hierarchy above it goes into D3cold and |
2213 |
++ * the device itself ends up in D3cold as a result of that. |
2214 |
++ */ |
2215 |
++ if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold)) |
2216 |
+ pci_pme_active(dev, true); |
2217 |
+ else |
2218 |
+ ret = 1; |
2219 |
+@@ -2357,16 +2364,20 @@ static pci_power_t pci_target_state(struct pci_dev *dev, bool wakeup) |
2220 |
+ if (dev->current_state == PCI_D3cold) |
2221 |
+ target_state = PCI_D3cold; |
2222 |
+ |
2223 |
+- if (wakeup) { |
2224 |
++ if (wakeup && dev->pme_support) { |
2225 |
++ pci_power_t state = target_state; |
2226 |
++ |
2227 |
+ /* |
2228 |
+ * Find the deepest state from which the device can generate |
2229 |
+ * PME#. |
2230 |
+ */ |
2231 |
+- if (dev->pme_support) { |
2232 |
+- while (target_state |
2233 |
+- && !(dev->pme_support & (1 << target_state))) |
2234 |
+- target_state--; |
2235 |
+- } |
2236 |
++ while (state && !(dev->pme_support & (1 << state))) |
2237 |
++ state--; |
2238 |
++ |
2239 |
++ if (state) |
2240 |
++ return state; |
2241 |
++ else if (dev->pme_support & 1) |
2242 |
++ return PCI_D0; |
2243 |
+ } |
2244 |
+ |
2245 |
+ return target_state; |
2246 |
+diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c |
2247 |
+index f40fa0e63b6e5..993e4a4a34b38 100644 |
2248 |
+--- a/drivers/power/supply/axp288_fuel_gauge.c |
2249 |
++++ b/drivers/power/supply/axp288_fuel_gauge.c |
2250 |
+@@ -149,7 +149,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg) |
2251 |
+ } |
2252 |
+ |
2253 |
+ if (ret < 0) { |
2254 |
+- dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret); |
2255 |
++ dev_err(&info->pdev->dev, "Error reading reg 0x%02x err: %d\n", reg, ret); |
2256 |
+ return ret; |
2257 |
+ } |
2258 |
+ |
2259 |
+@@ -163,7 +163,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val) |
2260 |
+ ret = regmap_write(info->regmap, reg, (unsigned int)val); |
2261 |
+ |
2262 |
+ if (ret < 0) |
2263 |
+- dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret); |
2264 |
++ dev_err(&info->pdev->dev, "Error writing reg 0x%02x err: %d\n", reg, ret); |
2265 |
+ |
2266 |
+ return ret; |
2267 |
+ } |
2268 |
+diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c |
2269 |
+index fa862f0380c41..ab4740c3bf573 100644 |
2270 |
+--- a/drivers/power/supply/max17042_battery.c |
2271 |
++++ b/drivers/power/supply/max17042_battery.c |
2272 |
+@@ -726,7 +726,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip) |
2273 |
+ struct max17042_config_data *config = chip->pdata->config_data; |
2274 |
+ |
2275 |
+ max17042_override_por(map, MAX17042_TGAIN, config->tgain); |
2276 |
+- max17042_override_por(map, MAx17042_TOFF, config->toff); |
2277 |
++ max17042_override_por(map, MAX17042_TOFF, config->toff); |
2278 |
+ max17042_override_por(map, MAX17042_CGAIN, config->cgain); |
2279 |
+ max17042_override_por(map, MAX17042_COFF, config->coff); |
2280 |
+ |
2281 |
+diff --git a/drivers/regulator/vctrl-regulator.c b/drivers/regulator/vctrl-regulator.c |
2282 |
+index cbadb1c996790..d2a37978fc3a8 100644 |
2283 |
+--- a/drivers/regulator/vctrl-regulator.c |
2284 |
++++ b/drivers/regulator/vctrl-regulator.c |
2285 |
+@@ -37,7 +37,6 @@ struct vctrl_voltage_table { |
2286 |
+ struct vctrl_data { |
2287 |
+ struct regulator_dev *rdev; |
2288 |
+ struct regulator_desc desc; |
2289 |
+- struct regulator *ctrl_reg; |
2290 |
+ bool enabled; |
2291 |
+ unsigned int min_slew_down_rate; |
2292 |
+ unsigned int ovp_threshold; |
2293 |
+@@ -82,7 +81,12 @@ static int vctrl_calc_output_voltage(struct vctrl_data *vctrl, int ctrl_uV) |
2294 |
+ static int vctrl_get_voltage(struct regulator_dev *rdev) |
2295 |
+ { |
2296 |
+ struct vctrl_data *vctrl = rdev_get_drvdata(rdev); |
2297 |
+- int ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev); |
2298 |
++ int ctrl_uV; |
2299 |
++ |
2300 |
++ if (!rdev->supply) |
2301 |
++ return -EPROBE_DEFER; |
2302 |
++ |
2303 |
++ ctrl_uV = regulator_get_voltage_rdev(rdev->supply->rdev); |
2304 |
+ |
2305 |
+ return vctrl_calc_output_voltage(vctrl, ctrl_uV); |
2306 |
+ } |
2307 |
+@@ -92,14 +96,19 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, |
2308 |
+ unsigned int *selector) |
2309 |
+ { |
2310 |
+ struct vctrl_data *vctrl = rdev_get_drvdata(rdev); |
2311 |
+- struct regulator *ctrl_reg = vctrl->ctrl_reg; |
2312 |
+- int orig_ctrl_uV = regulator_get_voltage_rdev(ctrl_reg->rdev); |
2313 |
+- int uV = vctrl_calc_output_voltage(vctrl, orig_ctrl_uV); |
2314 |
++ int orig_ctrl_uV; |
2315 |
++ int uV; |
2316 |
+ int ret; |
2317 |
+ |
2318 |
++ if (!rdev->supply) |
2319 |
++ return -EPROBE_DEFER; |
2320 |
++ |
2321 |
++ orig_ctrl_uV = regulator_get_voltage_rdev(rdev->supply->rdev); |
2322 |
++ uV = vctrl_calc_output_voltage(vctrl, orig_ctrl_uV); |
2323 |
++ |
2324 |
+ if (req_min_uV >= uV || !vctrl->ovp_threshold) |
2325 |
+ /* voltage rising or no OVP */ |
2326 |
+- return regulator_set_voltage_rdev(ctrl_reg->rdev, |
2327 |
++ return regulator_set_voltage_rdev(rdev->supply->rdev, |
2328 |
+ vctrl_calc_ctrl_voltage(vctrl, req_min_uV), |
2329 |
+ vctrl_calc_ctrl_voltage(vctrl, req_max_uV), |
2330 |
+ PM_SUSPEND_ON); |
2331 |
+@@ -117,7 +126,7 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, |
2332 |
+ next_uV = max_t(int, req_min_uV, uV - max_drop_uV); |
2333 |
+ next_ctrl_uV = vctrl_calc_ctrl_voltage(vctrl, next_uV); |
2334 |
+ |
2335 |
+- ret = regulator_set_voltage_rdev(ctrl_reg->rdev, |
2336 |
++ ret = regulator_set_voltage_rdev(rdev->supply->rdev, |
2337 |
+ next_ctrl_uV, |
2338 |
+ next_ctrl_uV, |
2339 |
+ PM_SUSPEND_ON); |
2340 |
+@@ -134,7 +143,7 @@ static int vctrl_set_voltage(struct regulator_dev *rdev, |
2341 |
+ |
2342 |
+ err: |
2343 |
+ /* Try to go back to original voltage */ |
2344 |
+- regulator_set_voltage_rdev(ctrl_reg->rdev, orig_ctrl_uV, orig_ctrl_uV, |
2345 |
++ regulator_set_voltage_rdev(rdev->supply->rdev, orig_ctrl_uV, orig_ctrl_uV, |
2346 |
+ PM_SUSPEND_ON); |
2347 |
+ |
2348 |
+ return ret; |
2349 |
+@@ -151,16 +160,18 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, |
2350 |
+ unsigned int selector) |
2351 |
+ { |
2352 |
+ struct vctrl_data *vctrl = rdev_get_drvdata(rdev); |
2353 |
+- struct regulator *ctrl_reg = vctrl->ctrl_reg; |
2354 |
+ unsigned int orig_sel = vctrl->sel; |
2355 |
+ int ret; |
2356 |
+ |
2357 |
++ if (!rdev->supply) |
2358 |
++ return -EPROBE_DEFER; |
2359 |
++ |
2360 |
+ if (selector >= rdev->desc->n_voltages) |
2361 |
+ return -EINVAL; |
2362 |
+ |
2363 |
+ if (selector >= vctrl->sel || !vctrl->ovp_threshold) { |
2364 |
+ /* voltage rising or no OVP */ |
2365 |
+- ret = regulator_set_voltage_rdev(ctrl_reg->rdev, |
2366 |
++ ret = regulator_set_voltage_rdev(rdev->supply->rdev, |
2367 |
+ vctrl->vtable[selector].ctrl, |
2368 |
+ vctrl->vtable[selector].ctrl, |
2369 |
+ PM_SUSPEND_ON); |
2370 |
+@@ -179,7 +190,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, |
2371 |
+ else |
2372 |
+ next_sel = vctrl->vtable[vctrl->sel].ovp_min_sel; |
2373 |
+ |
2374 |
+- ret = regulator_set_voltage_rdev(ctrl_reg->rdev, |
2375 |
++ ret = regulator_set_voltage_rdev(rdev->supply->rdev, |
2376 |
+ vctrl->vtable[next_sel].ctrl, |
2377 |
+ vctrl->vtable[next_sel].ctrl, |
2378 |
+ PM_SUSPEND_ON); |
2379 |
+@@ -202,7 +213,7 @@ static int vctrl_set_voltage_sel(struct regulator_dev *rdev, |
2380 |
+ err: |
2381 |
+ if (vctrl->sel != orig_sel) { |
2382 |
+ /* Try to go back to original voltage */ |
2383 |
+- if (!regulator_set_voltage_rdev(ctrl_reg->rdev, |
2384 |
++ if (!regulator_set_voltage_rdev(rdev->supply->rdev, |
2385 |
+ vctrl->vtable[orig_sel].ctrl, |
2386 |
+ vctrl->vtable[orig_sel].ctrl, |
2387 |
+ PM_SUSPEND_ON)) |
2388 |
+@@ -234,10 +245,6 @@ static int vctrl_parse_dt(struct platform_device *pdev, |
2389 |
+ u32 pval; |
2390 |
+ u32 vrange_ctrl[2]; |
2391 |
+ |
2392 |
+- vctrl->ctrl_reg = devm_regulator_get(&pdev->dev, "ctrl"); |
2393 |
+- if (IS_ERR(vctrl->ctrl_reg)) |
2394 |
+- return PTR_ERR(vctrl->ctrl_reg); |
2395 |
+- |
2396 |
+ ret = of_property_read_u32(np, "ovp-threshold-percent", &pval); |
2397 |
+ if (!ret) { |
2398 |
+ vctrl->ovp_threshold = pval; |
2399 |
+@@ -315,11 +322,11 @@ static int vctrl_cmp_ctrl_uV(const void *a, const void *b) |
2400 |
+ return at->ctrl - bt->ctrl; |
2401 |
+ } |
2402 |
+ |
2403 |
+-static int vctrl_init_vtable(struct platform_device *pdev) |
2404 |
++static int vctrl_init_vtable(struct platform_device *pdev, |
2405 |
++ struct regulator *ctrl_reg) |
2406 |
+ { |
2407 |
+ struct vctrl_data *vctrl = platform_get_drvdata(pdev); |
2408 |
+ struct regulator_desc *rdesc = &vctrl->desc; |
2409 |
+- struct regulator *ctrl_reg = vctrl->ctrl_reg; |
2410 |
+ struct vctrl_voltage_range *vrange_ctrl = &vctrl->vrange.ctrl; |
2411 |
+ int n_voltages; |
2412 |
+ int ctrl_uV; |
2413 |
+@@ -395,23 +402,19 @@ static int vctrl_init_vtable(struct platform_device *pdev) |
2414 |
+ static int vctrl_enable(struct regulator_dev *rdev) |
2415 |
+ { |
2416 |
+ struct vctrl_data *vctrl = rdev_get_drvdata(rdev); |
2417 |
+- int ret = regulator_enable(vctrl->ctrl_reg); |
2418 |
+ |
2419 |
+- if (!ret) |
2420 |
+- vctrl->enabled = true; |
2421 |
++ vctrl->enabled = true; |
2422 |
+ |
2423 |
+- return ret; |
2424 |
++ return 0; |
2425 |
+ } |
2426 |
+ |
2427 |
+ static int vctrl_disable(struct regulator_dev *rdev) |
2428 |
+ { |
2429 |
+ struct vctrl_data *vctrl = rdev_get_drvdata(rdev); |
2430 |
+- int ret = regulator_disable(vctrl->ctrl_reg); |
2431 |
+ |
2432 |
+- if (!ret) |
2433 |
+- vctrl->enabled = false; |
2434 |
++ vctrl->enabled = false; |
2435 |
+ |
2436 |
+- return ret; |
2437 |
++ return 0; |
2438 |
+ } |
2439 |
+ |
2440 |
+ static int vctrl_is_enabled(struct regulator_dev *rdev) |
2441 |
+@@ -447,6 +450,7 @@ static int vctrl_probe(struct platform_device *pdev) |
2442 |
+ struct regulator_desc *rdesc; |
2443 |
+ struct regulator_config cfg = { }; |
2444 |
+ struct vctrl_voltage_range *vrange_ctrl; |
2445 |
++ struct regulator *ctrl_reg; |
2446 |
+ int ctrl_uV; |
2447 |
+ int ret; |
2448 |
+ |
2449 |
+@@ -461,15 +465,20 @@ static int vctrl_probe(struct platform_device *pdev) |
2450 |
+ if (ret) |
2451 |
+ return ret; |
2452 |
+ |
2453 |
++ ctrl_reg = devm_regulator_get(&pdev->dev, "ctrl"); |
2454 |
++ if (IS_ERR(ctrl_reg)) |
2455 |
++ return PTR_ERR(ctrl_reg); |
2456 |
++ |
2457 |
+ vrange_ctrl = &vctrl->vrange.ctrl; |
2458 |
+ |
2459 |
+ rdesc = &vctrl->desc; |
2460 |
+ rdesc->name = "vctrl"; |
2461 |
+ rdesc->type = REGULATOR_VOLTAGE; |
2462 |
+ rdesc->owner = THIS_MODULE; |
2463 |
++ rdesc->supply_name = "ctrl"; |
2464 |
+ |
2465 |
+- if ((regulator_get_linear_step(vctrl->ctrl_reg) == 1) || |
2466 |
+- (regulator_count_voltages(vctrl->ctrl_reg) == -EINVAL)) { |
2467 |
++ if ((regulator_get_linear_step(ctrl_reg) == 1) || |
2468 |
++ (regulator_count_voltages(ctrl_reg) == -EINVAL)) { |
2469 |
+ rdesc->continuous_voltage_range = true; |
2470 |
+ rdesc->ops = &vctrl_ops_cont; |
2471 |
+ } else { |
2472 |
+@@ -486,11 +495,12 @@ static int vctrl_probe(struct platform_device *pdev) |
2473 |
+ cfg.init_data = init_data; |
2474 |
+ |
2475 |
+ if (!rdesc->continuous_voltage_range) { |
2476 |
+- ret = vctrl_init_vtable(pdev); |
2477 |
++ ret = vctrl_init_vtable(pdev, ctrl_reg); |
2478 |
+ if (ret) |
2479 |
+ return ret; |
2480 |
+ |
2481 |
+- ctrl_uV = regulator_get_voltage_rdev(vctrl->ctrl_reg->rdev); |
2482 |
++ /* Use locked consumer API when not in regulator framework */ |
2483 |
++ ctrl_uV = regulator_get_voltage(ctrl_reg); |
2484 |
+ if (ctrl_uV < 0) { |
2485 |
+ dev_err(&pdev->dev, "failed to get control voltage\n"); |
2486 |
+ return ctrl_uV; |
2487 |
+@@ -513,6 +523,9 @@ static int vctrl_probe(struct platform_device *pdev) |
2488 |
+ } |
2489 |
+ } |
2490 |
+ |
2491 |
++ /* Drop ctrl-supply here in favor of regulator core managed supply */ |
2492 |
++ devm_regulator_put(ctrl_reg); |
2493 |
++ |
2494 |
+ vctrl->rdev = devm_regulator_register(&pdev->dev, rdesc, &cfg); |
2495 |
+ if (IS_ERR(vctrl->rdev)) { |
2496 |
+ ret = PTR_ERR(vctrl->rdev); |
2497 |
+diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c |
2498 |
+index 5734a78dbb8e6..7950ac59b1744 100644 |
2499 |
+--- a/drivers/s390/cio/css.c |
2500 |
++++ b/drivers/s390/cio/css.c |
2501 |
+@@ -426,9 +426,26 @@ static ssize_t pimpampom_show(struct device *dev, |
2502 |
+ } |
2503 |
+ static DEVICE_ATTR_RO(pimpampom); |
2504 |
+ |
2505 |
++static ssize_t dev_busid_show(struct device *dev, |
2506 |
++ struct device_attribute *attr, |
2507 |
++ char *buf) |
2508 |
++{ |
2509 |
++ struct subchannel *sch = to_subchannel(dev); |
2510 |
++ struct pmcw *pmcw = &sch->schib.pmcw; |
2511 |
++ |
2512 |
++ if ((pmcw->st == SUBCHANNEL_TYPE_IO || |
2513 |
++ pmcw->st == SUBCHANNEL_TYPE_MSG) && pmcw->dnv) |
2514 |
++ return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid, |
2515 |
++ pmcw->dev); |
2516 |
++ else |
2517 |
++ return sysfs_emit(buf, "none\n"); |
2518 |
++} |
2519 |
++static DEVICE_ATTR_RO(dev_busid); |
2520 |
++ |
2521 |
+ static struct attribute *io_subchannel_type_attrs[] = { |
2522 |
+ &dev_attr_chpids.attr, |
2523 |
+ &dev_attr_pimpampom.attr, |
2524 |
++ &dev_attr_dev_busid.attr, |
2525 |
+ NULL, |
2526 |
+ }; |
2527 |
+ ATTRIBUTE_GROUPS(io_subchannel_type); |
2528 |
+diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c |
2529 |
+index 51850cc68b701..aa24237a78405 100644 |
2530 |
+--- a/drivers/soc/qcom/rpmhpd.c |
2531 |
++++ b/drivers/soc/qcom/rpmhpd.c |
2532 |
+@@ -235,12 +235,11 @@ static int rpmhpd_power_on(struct generic_pm_domain *domain) |
2533 |
+ static int rpmhpd_power_off(struct generic_pm_domain *domain) |
2534 |
+ { |
2535 |
+ struct rpmhpd *pd = domain_to_rpmhpd(domain); |
2536 |
+- int ret = 0; |
2537 |
++ int ret; |
2538 |
+ |
2539 |
+ mutex_lock(&rpmhpd_lock); |
2540 |
+ |
2541 |
+- ret = rpmhpd_aggregate_corner(pd, pd->level[0]); |
2542 |
+- |
2543 |
++ ret = rpmhpd_aggregate_corner(pd, 0); |
2544 |
+ if (!ret) |
2545 |
+ pd->enabled = false; |
2546 |
+ |
2547 |
+diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c |
2548 |
+index 70c3c90b997c9..c428d0f78816e 100644 |
2549 |
+--- a/drivers/soc/qcom/smsm.c |
2550 |
++++ b/drivers/soc/qcom/smsm.c |
2551 |
+@@ -109,7 +109,7 @@ struct smsm_entry { |
2552 |
+ DECLARE_BITMAP(irq_enabled, 32); |
2553 |
+ DECLARE_BITMAP(irq_rising, 32); |
2554 |
+ DECLARE_BITMAP(irq_falling, 32); |
2555 |
+- u32 last_value; |
2556 |
++ unsigned long last_value; |
2557 |
+ |
2558 |
+ u32 *remote_state; |
2559 |
+ u32 *subscription; |
2560 |
+@@ -204,8 +204,7 @@ static irqreturn_t smsm_intr(int irq, void *data) |
2561 |
+ u32 val; |
2562 |
+ |
2563 |
+ val = readl(entry->remote_state); |
2564 |
+- changed = val ^ entry->last_value; |
2565 |
+- entry->last_value = val; |
2566 |
++ changed = val ^ xchg(&entry->last_value, val); |
2567 |
+ |
2568 |
+ for_each_set_bit(i, entry->irq_enabled, 32) { |
2569 |
+ if (!(changed & BIT(i))) |
2570 |
+@@ -266,6 +265,12 @@ static void smsm_unmask_irq(struct irq_data *irqd) |
2571 |
+ struct qcom_smsm *smsm = entry->smsm; |
2572 |
+ u32 val; |
2573 |
+ |
2574 |
++ /* Make sure our last cached state is up-to-date */ |
2575 |
++ if (readl(entry->remote_state) & BIT(irq)) |
2576 |
++ set_bit(irq, &entry->last_value); |
2577 |
++ else |
2578 |
++ clear_bit(irq, &entry->last_value); |
2579 |
++ |
2580 |
+ set_bit(irq, entry->irq_enabled); |
2581 |
+ |
2582 |
+ if (entry->subscription) { |
2583 |
+diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig |
2584 |
+index b71b73bf5fc5c..785990720479c 100644 |
2585 |
+--- a/drivers/soc/rockchip/Kconfig |
2586 |
++++ b/drivers/soc/rockchip/Kconfig |
2587 |
+@@ -6,8 +6,8 @@ if ARCH_ROCKCHIP || COMPILE_TEST |
2588 |
+ # |
2589 |
+ |
2590 |
+ config ROCKCHIP_GRF |
2591 |
+- bool |
2592 |
+- default y |
2593 |
++ bool "Rockchip General Register Files support" if COMPILE_TEST |
2594 |
++ default y if ARCH_ROCKCHIP |
2595 |
+ help |
2596 |
+ The General Register Files are a central component providing |
2597 |
+ special additional settings registers for a lot of soc-components. |
2598 |
+diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c |
2599 |
+index 40dccc580e866..3e0200618af30 100644 |
2600 |
+--- a/drivers/spi/spi-fsl-dspi.c |
2601 |
++++ b/drivers/spi/spi-fsl-dspi.c |
2602 |
+@@ -423,6 +423,7 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) |
2603 |
+ goto err_rx_dma_buf; |
2604 |
+ } |
2605 |
+ |
2606 |
++ memset(&cfg, 0, sizeof(cfg)); |
2607 |
+ cfg.src_addr = phy_addr + SPI_POPR; |
2608 |
+ cfg.dst_addr = phy_addr + SPI_PUSHR; |
2609 |
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
2610 |
+diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c |
2611 |
+index 8272bde5d706f..b5268b0d7b4c8 100644 |
2612 |
+--- a/drivers/spi/spi-pic32.c |
2613 |
++++ b/drivers/spi/spi-pic32.c |
2614 |
+@@ -361,6 +361,7 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width) |
2615 |
+ struct dma_slave_config cfg; |
2616 |
+ int ret; |
2617 |
+ |
2618 |
++ memset(&cfg, 0, sizeof(cfg)); |
2619 |
+ cfg.device_fc = true; |
2620 |
+ cfg.src_addr = pic32s->dma_base + buf_offset; |
2621 |
+ cfg.dst_addr = pic32s->dma_base + buf_offset; |
2622 |
+diff --git a/drivers/spi/spi-sprd-adi.c b/drivers/spi/spi-sprd-adi.c |
2623 |
+index 09f983524d51b..e804a3854c351 100644 |
2624 |
+--- a/drivers/spi/spi-sprd-adi.c |
2625 |
++++ b/drivers/spi/spi-sprd-adi.c |
2626 |
+@@ -102,7 +102,7 @@ |
2627 |
+ #define HWRST_STATUS_WATCHDOG 0xf0 |
2628 |
+ |
2629 |
+ /* Use default timeout 50 ms that converts to watchdog values */ |
2630 |
+-#define WDG_LOAD_VAL ((50 * 1000) / 32768) |
2631 |
++#define WDG_LOAD_VAL ((50 * 32768) / 1000) |
2632 |
+ #define WDG_LOAD_MASK GENMASK(15, 0) |
2633 |
+ #define WDG_UNLOCK_KEY 0xe551 |
2634 |
+ |
2635 |
+diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c |
2636 |
+index 5cf6993ddce57..1ced6eb8b3303 100644 |
2637 |
+--- a/drivers/spi/spi-zynq-qspi.c |
2638 |
++++ b/drivers/spi/spi-zynq-qspi.c |
2639 |
+@@ -533,7 +533,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, |
2640 |
+ zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true); |
2641 |
+ zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET, |
2642 |
+ ZYNQ_QSPI_IXR_RXTX_MASK); |
2643 |
+- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion, |
2644 |
++ if (!wait_for_completion_timeout(&xqspi->data_completion, |
2645 |
+ msecs_to_jiffies(1000))) |
2646 |
+ err = -ETIMEDOUT; |
2647 |
+ } |
2648 |
+@@ -551,7 +551,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, |
2649 |
+ zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true); |
2650 |
+ zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET, |
2651 |
+ ZYNQ_QSPI_IXR_RXTX_MASK); |
2652 |
+- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion, |
2653 |
++ if (!wait_for_completion_timeout(&xqspi->data_completion, |
2654 |
+ msecs_to_jiffies(1000))) |
2655 |
+ err = -ETIMEDOUT; |
2656 |
+ } |
2657 |
+@@ -567,7 +567,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, |
2658 |
+ zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true); |
2659 |
+ zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET, |
2660 |
+ ZYNQ_QSPI_IXR_RXTX_MASK); |
2661 |
+- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion, |
2662 |
++ if (!wait_for_completion_timeout(&xqspi->data_completion, |
2663 |
+ msecs_to_jiffies(1000))) |
2664 |
+ err = -ETIMEDOUT; |
2665 |
+ |
2666 |
+@@ -591,7 +591,7 @@ static int zynq_qspi_exec_mem_op(struct spi_mem *mem, |
2667 |
+ zynq_qspi_write_op(xqspi, ZYNQ_QSPI_FIFO_DEPTH, true); |
2668 |
+ zynq_qspi_write(xqspi, ZYNQ_QSPI_IEN_OFFSET, |
2669 |
+ ZYNQ_QSPI_IXR_RXTX_MASK); |
2670 |
+- if (!wait_for_completion_interruptible_timeout(&xqspi->data_completion, |
2671 |
++ if (!wait_for_completion_timeout(&xqspi->data_completion, |
2672 |
+ msecs_to_jiffies(1000))) |
2673 |
+ err = -ETIMEDOUT; |
2674 |
+ } |
2675 |
+diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c |
2676 |
+index b053345dfd1ae..13e705b53217d 100644 |
2677 |
+--- a/drivers/tty/serial/fsl_lpuart.c |
2678 |
++++ b/drivers/tty/serial/fsl_lpuart.c |
2679 |
+@@ -2414,7 +2414,7 @@ static int lpuart_probe(struct platform_device *pdev) |
2680 |
+ return PTR_ERR(sport->port.membase); |
2681 |
+ |
2682 |
+ sport->port.membase += sdata->reg_off; |
2683 |
+- sport->port.mapbase = res->start; |
2684 |
++ sport->port.mapbase = res->start + sdata->reg_off; |
2685 |
+ sport->port.dev = &pdev->dev; |
2686 |
+ sport->port.type = PORT_LPUART; |
2687 |
+ sport->devtype = sdata->devtype; |
2688 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
2689 |
+index cee7514c3aaf2..ddfe873b5fccb 100644 |
2690 |
+--- a/drivers/tty/tty_io.c |
2691 |
++++ b/drivers/tty/tty_io.c |
2692 |
+@@ -2176,8 +2176,6 @@ static int tty_fasync(int fd, struct file *filp, int on) |
2693 |
+ * Locking: |
2694 |
+ * Called functions take tty_ldiscs_lock |
2695 |
+ * current->signal->tty check is safe without locks |
2696 |
+- * |
2697 |
+- * FIXME: may race normal receive processing |
2698 |
+ */ |
2699 |
+ |
2700 |
+ static int tiocsti(struct tty_struct *tty, char __user *p) |
2701 |
+@@ -2193,8 +2191,10 @@ static int tiocsti(struct tty_struct *tty, char __user *p) |
2702 |
+ ld = tty_ldisc_ref_wait(tty); |
2703 |
+ if (!ld) |
2704 |
+ return -EIO; |
2705 |
++ tty_buffer_lock_exclusive(tty->port); |
2706 |
+ if (ld->ops->receive_buf) |
2707 |
+ ld->ops->receive_buf(tty, &ch, &mbz, 1); |
2708 |
++ tty_buffer_unlock_exclusive(tty->port); |
2709 |
+ tty_ldisc_deref(ld); |
2710 |
+ return 0; |
2711 |
+ } |
2712 |
+diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c |
2713 |
+index 194ffb1ed4620..d7714c94b1196 100644 |
2714 |
+--- a/drivers/usb/gadget/udc/at91_udc.c |
2715 |
++++ b/drivers/usb/gadget/udc/at91_udc.c |
2716 |
+@@ -1878,7 +1878,9 @@ static int at91udc_probe(struct platform_device *pdev) |
2717 |
+ clk_disable(udc->iclk); |
2718 |
+ |
2719 |
+ /* request UDC and maybe VBUS irqs */ |
2720 |
+- udc->udp_irq = platform_get_irq(pdev, 0); |
2721 |
++ udc->udp_irq = retval = platform_get_irq(pdev, 0); |
2722 |
++ if (retval < 0) |
2723 |
++ goto err_unprepare_iclk; |
2724 |
+ retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0, |
2725 |
+ driver_name, udc); |
2726 |
+ if (retval) { |
2727 |
+diff --git a/drivers/usb/gadget/udc/bdc/bdc_core.c b/drivers/usb/gadget/udc/bdc/bdc_core.c |
2728 |
+index 3d33499db50b5..845aead48d85b 100644 |
2729 |
+--- a/drivers/usb/gadget/udc/bdc/bdc_core.c |
2730 |
++++ b/drivers/usb/gadget/udc/bdc/bdc_core.c |
2731 |
+@@ -565,7 +565,8 @@ static int bdc_probe(struct platform_device *pdev) |
2732 |
+ if (ret) { |
2733 |
+ dev_err(dev, |
2734 |
+ "No suitable DMA config available, abort\n"); |
2735 |
+- return -ENOTSUPP; |
2736 |
++ ret = -ENOTSUPP; |
2737 |
++ goto phycleanup; |
2738 |
+ } |
2739 |
+ dev_dbg(dev, "Using 32-bit address\n"); |
2740 |
+ } |
2741 |
+diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c |
2742 |
+index 35e02a8d0091a..bdba3f48c0527 100644 |
2743 |
+--- a/drivers/usb/gadget/udc/mv_u3d_core.c |
2744 |
++++ b/drivers/usb/gadget/udc/mv_u3d_core.c |
2745 |
+@@ -1922,14 +1922,6 @@ static int mv_u3d_probe(struct platform_device *dev) |
2746 |
+ goto err_get_irq; |
2747 |
+ } |
2748 |
+ u3d->irq = r->start; |
2749 |
+- if (request_irq(u3d->irq, mv_u3d_irq, |
2750 |
+- IRQF_SHARED, driver_name, u3d)) { |
2751 |
+- u3d->irq = 0; |
2752 |
+- dev_err(&dev->dev, "Request irq %d for u3d failed\n", |
2753 |
+- u3d->irq); |
2754 |
+- retval = -ENODEV; |
2755 |
+- goto err_request_irq; |
2756 |
+- } |
2757 |
+ |
2758 |
+ /* initialize gadget structure */ |
2759 |
+ u3d->gadget.ops = &mv_u3d_ops; /* usb_gadget_ops */ |
2760 |
+@@ -1942,6 +1934,15 @@ static int mv_u3d_probe(struct platform_device *dev) |
2761 |
+ |
2762 |
+ mv_u3d_eps_init(u3d); |
2763 |
+ |
2764 |
++ if (request_irq(u3d->irq, mv_u3d_irq, |
2765 |
++ IRQF_SHARED, driver_name, u3d)) { |
2766 |
++ u3d->irq = 0; |
2767 |
++ dev_err(&dev->dev, "Request irq %d for u3d failed\n", |
2768 |
++ u3d->irq); |
2769 |
++ retval = -ENODEV; |
2770 |
++ goto err_request_irq; |
2771 |
++ } |
2772 |
++ |
2773 |
+ /* external vbus detection */ |
2774 |
+ if (u3d->vbus) { |
2775 |
+ u3d->clock_gating = 1; |
2776 |
+@@ -1965,8 +1966,8 @@ static int mv_u3d_probe(struct platform_device *dev) |
2777 |
+ |
2778 |
+ err_unregister: |
2779 |
+ free_irq(u3d->irq, u3d); |
2780 |
+-err_request_irq: |
2781 |
+ err_get_irq: |
2782 |
++err_request_irq: |
2783 |
+ kfree(u3d->status_req); |
2784 |
+ err_alloc_status_req: |
2785 |
+ kfree(u3d->eps); |
2786 |
+diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
2787 |
+index 08a93cf68efff..b6653bc7acc26 100644 |
2788 |
+--- a/drivers/usb/gadget/udc/renesas_usb3.c |
2789 |
++++ b/drivers/usb/gadget/udc/renesas_usb3.c |
2790 |
+@@ -2692,10 +2692,15 @@ static const struct renesas_usb3_priv renesas_usb3_priv_r8a77990 = { |
2791 |
+ |
2792 |
+ static const struct of_device_id usb3_of_match[] = { |
2793 |
+ { |
2794 |
++ .compatible = "renesas,r8a774c0-usb3-peri", |
2795 |
++ .data = &renesas_usb3_priv_r8a77990, |
2796 |
++ }, { |
2797 |
+ .compatible = "renesas,r8a7795-usb3-peri", |
2798 |
+ .data = &renesas_usb3_priv_gen3, |
2799 |
+- }, |
2800 |
+- { |
2801 |
++ }, { |
2802 |
++ .compatible = "renesas,r8a77990-usb3-peri", |
2803 |
++ .data = &renesas_usb3_priv_r8a77990, |
2804 |
++ }, { |
2805 |
+ .compatible = "renesas,rcar-gen3-usb3-peri", |
2806 |
+ .data = &renesas_usb3_priv_gen3, |
2807 |
+ }, |
2808 |
+@@ -2704,18 +2709,10 @@ static const struct of_device_id usb3_of_match[] = { |
2809 |
+ MODULE_DEVICE_TABLE(of, usb3_of_match); |
2810 |
+ |
2811 |
+ static const struct soc_device_attribute renesas_usb3_quirks_match[] = { |
2812 |
+- { |
2813 |
+- .soc_id = "r8a774c0", |
2814 |
+- .data = &renesas_usb3_priv_r8a77990, |
2815 |
+- }, |
2816 |
+ { |
2817 |
+ .soc_id = "r8a7795", .revision = "ES1.*", |
2818 |
+ .data = &renesas_usb3_priv_r8a7795_es1, |
2819 |
+ }, |
2820 |
+- { |
2821 |
+- .soc_id = "r8a77990", |
2822 |
+- .data = &renesas_usb3_priv_r8a77990, |
2823 |
+- }, |
2824 |
+ { /* sentinel */ }, |
2825 |
+ }; |
2826 |
+ |
2827 |
+diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c |
2828 |
+index a319b1df3011c..3626758b3e2aa 100644 |
2829 |
+--- a/drivers/usb/host/ehci-orion.c |
2830 |
++++ b/drivers/usb/host/ehci-orion.c |
2831 |
+@@ -264,8 +264,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) |
2832 |
+ * the clock does not exists. |
2833 |
+ */ |
2834 |
+ priv->clk = devm_clk_get(&pdev->dev, NULL); |
2835 |
+- if (!IS_ERR(priv->clk)) |
2836 |
+- clk_prepare_enable(priv->clk); |
2837 |
++ if (!IS_ERR(priv->clk)) { |
2838 |
++ err = clk_prepare_enable(priv->clk); |
2839 |
++ if (err) |
2840 |
++ goto err_put_hcd; |
2841 |
++ } |
2842 |
+ |
2843 |
+ priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); |
2844 |
+ if (IS_ERR(priv->phy)) { |
2845 |
+@@ -311,6 +314,7 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) |
2846 |
+ err_dis_clk: |
2847 |
+ if (!IS_ERR(priv->clk)) |
2848 |
+ clk_disable_unprepare(priv->clk); |
2849 |
++err_put_hcd: |
2850 |
+ usb_put_hcd(hcd); |
2851 |
+ err: |
2852 |
+ dev_err(&pdev->dev, "init %s fail, %d\n", |
2853 |
+diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c |
2854 |
+index fb6f5e9ae5c62..fed43c6dd85cc 100644 |
2855 |
+--- a/drivers/usb/host/ohci-tmio.c |
2856 |
++++ b/drivers/usb/host/ohci-tmio.c |
2857 |
+@@ -202,6 +202,9 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) |
2858 |
+ if (!cell) |
2859 |
+ return -EINVAL; |
2860 |
+ |
2861 |
++ if (irq < 0) |
2862 |
++ return irq; |
2863 |
++ |
2864 |
+ hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev)); |
2865 |
+ if (!hcd) { |
2866 |
+ ret = -ENOMEM; |
2867 |
+diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c |
2868 |
+index b451f4695f3f0..446c7bf67873c 100644 |
2869 |
+--- a/drivers/usb/phy/phy-fsl-usb.c |
2870 |
++++ b/drivers/usb/phy/phy-fsl-usb.c |
2871 |
+@@ -873,6 +873,8 @@ int usb_otg_start(struct platform_device *pdev) |
2872 |
+ |
2873 |
+ /* request irq */ |
2874 |
+ p_otg->irq = platform_get_irq(pdev, 0); |
2875 |
++ if (p_otg->irq < 0) |
2876 |
++ return p_otg->irq; |
2877 |
+ status = request_irq(p_otg->irq, fsl_otg_isr, |
2878 |
+ IRQF_SHARED, driver_name, p_otg); |
2879 |
+ if (status) { |
2880 |
+diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c |
2881 |
+index baebb1f5a9737..a3e043e3e4aae 100644 |
2882 |
+--- a/drivers/usb/phy/phy-tahvo.c |
2883 |
++++ b/drivers/usb/phy/phy-tahvo.c |
2884 |
+@@ -393,7 +393,9 @@ static int tahvo_usb_probe(struct platform_device *pdev) |
2885 |
+ |
2886 |
+ dev_set_drvdata(&pdev->dev, tu); |
2887 |
+ |
2888 |
+- tu->irq = platform_get_irq(pdev, 0); |
2889 |
++ tu->irq = ret = platform_get_irq(pdev, 0); |
2890 |
++ if (ret < 0) |
2891 |
++ return ret; |
2892 |
+ ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, |
2893 |
+ IRQF_ONESHOT, |
2894 |
+ "tahvo-vbus", tu); |
2895 |
+diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c |
2896 |
+index 9a7e655d52801..9337c30f0743b 100644 |
2897 |
+--- a/drivers/usb/phy/phy-twl6030-usb.c |
2898 |
++++ b/drivers/usb/phy/phy-twl6030-usb.c |
2899 |
+@@ -348,6 +348,11 @@ static int twl6030_usb_probe(struct platform_device *pdev) |
2900 |
+ twl->irq2 = platform_get_irq(pdev, 1); |
2901 |
+ twl->linkstat = MUSB_UNKNOWN; |
2902 |
+ |
2903 |
++ if (twl->irq1 < 0) |
2904 |
++ return twl->irq1; |
2905 |
++ if (twl->irq2 < 0) |
2906 |
++ return twl->irq2; |
2907 |
++ |
2908 |
+ twl->comparator.set_vbus = twl6030_set_vbus; |
2909 |
+ twl->comparator.start_srp = twl6030_start_srp; |
2910 |
+ |
2911 |
+diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c |
2912 |
+index 746eebc411dfa..047f80ee37e81 100644 |
2913 |
+--- a/drivers/video/backlight/pwm_bl.c |
2914 |
++++ b/drivers/video/backlight/pwm_bl.c |
2915 |
+@@ -415,6 +415,33 @@ static bool pwm_backlight_is_linear(struct platform_pwm_backlight_data *data) |
2916 |
+ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) |
2917 |
+ { |
2918 |
+ struct device_node *node = pb->dev->of_node; |
2919 |
++ bool active = true; |
2920 |
++ |
2921 |
++ /* |
2922 |
++ * If the enable GPIO is present, observable (either as input |
2923 |
++ * or output) and off then the backlight is not currently active. |
2924 |
++ * */ |
2925 |
++ if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0) |
2926 |
++ active = false; |
2927 |
++ |
2928 |
++ if (!regulator_is_enabled(pb->power_supply)) |
2929 |
++ active = false; |
2930 |
++ |
2931 |
++ if (!pwm_is_enabled(pb->pwm)) |
2932 |
++ active = false; |
2933 |
++ |
2934 |
++ /* |
2935 |
++ * Synchronize the enable_gpio with the observed state of the |
2936 |
++ * hardware. |
2937 |
++ */ |
2938 |
++ if (pb->enable_gpio) |
2939 |
++ gpiod_direction_output(pb->enable_gpio, active); |
2940 |
++ |
2941 |
++ /* |
2942 |
++ * Do not change pb->enabled here! pb->enabled essentially |
2943 |
++ * tells us if we own one of the regulator's use counts and |
2944 |
++ * right now we do not. |
2945 |
++ */ |
2946 |
+ |
2947 |
+ /* Not booted with device tree or no phandle link to the node */ |
2948 |
+ if (!node || !node->phandle) |
2949 |
+@@ -426,20 +453,7 @@ static int pwm_backlight_initial_power_state(const struct pwm_bl_data *pb) |
2950 |
+ * assume that another driver will enable the backlight at the |
2951 |
+ * appropriate time. Therefore, if it is disabled, keep it so. |
2952 |
+ */ |
2953 |
+- |
2954 |
+- /* if the enable GPIO is disabled, do not enable the backlight */ |
2955 |
+- if (pb->enable_gpio && gpiod_get_value_cansleep(pb->enable_gpio) == 0) |
2956 |
+- return FB_BLANK_POWERDOWN; |
2957 |
+- |
2958 |
+- /* The regulator is disabled, do not enable the backlight */ |
2959 |
+- if (!regulator_is_enabled(pb->power_supply)) |
2960 |
+- return FB_BLANK_POWERDOWN; |
2961 |
+- |
2962 |
+- /* The PWM is disabled, keep it like this */ |
2963 |
+- if (!pwm_is_enabled(pb->pwm)) |
2964 |
+- return FB_BLANK_POWERDOWN; |
2965 |
+- |
2966 |
+- return FB_BLANK_UNBLANK; |
2967 |
++ return active ? FB_BLANK_UNBLANK: FB_BLANK_POWERDOWN; |
2968 |
+ } |
2969 |
+ |
2970 |
+ static int pwm_backlight_probe(struct platform_device *pdev) |
2971 |
+@@ -508,18 +522,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) |
2972 |
+ pb->enable_gpio = gpio_to_desc(data->enable_gpio); |
2973 |
+ } |
2974 |
+ |
2975 |
+- /* |
2976 |
+- * If the GPIO is not known to be already configured as output, that |
2977 |
+- * is, if gpiod_get_direction returns either 1 or -EINVAL, change the |
2978 |
+- * direction to output and set the GPIO as active. |
2979 |
+- * Do not force the GPIO to active when it was already output as it |
2980 |
+- * could cause backlight flickering or we would enable the backlight too |
2981 |
+- * early. Leave the decision of the initial backlight state for later. |
2982 |
+- */ |
2983 |
+- if (pb->enable_gpio && |
2984 |
+- gpiod_get_direction(pb->enable_gpio) != 0) |
2985 |
+- gpiod_direction_output(pb->enable_gpio, 1); |
2986 |
+- |
2987 |
+ pb->power_supply = devm_regulator_get(&pdev->dev, "power"); |
2988 |
+ if (IS_ERR(pb->power_supply)) { |
2989 |
+ ret = PTR_ERR(pb->power_supply); |
2990 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
2991 |
+index d87de5d467189..03b1bf994cc90 100644 |
2992 |
+--- a/drivers/video/fbdev/core/fbmem.c |
2993 |
++++ b/drivers/video/fbdev/core/fbmem.c |
2994 |
+@@ -957,6 +957,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
2995 |
+ struct fb_var_screeninfo old_var; |
2996 |
+ struct fb_videomode mode; |
2997 |
+ struct fb_event event; |
2998 |
++ u32 unused; |
2999 |
+ |
3000 |
+ if (var->activate & FB_ACTIVATE_INV_MODE) { |
3001 |
+ struct fb_videomode mode1, mode2; |
3002 |
+@@ -1003,6 +1004,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
3003 |
+ if (var->xres < 8 || var->yres < 8) |
3004 |
+ return -EINVAL; |
3005 |
+ |
3006 |
++ /* Too huge resolution causes multiplication overflow. */ |
3007 |
++ if (check_mul_overflow(var->xres, var->yres, &unused) || |
3008 |
++ check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused)) |
3009 |
++ return -EINVAL; |
3010 |
++ |
3011 |
+ ret = info->fbops->fb_check_var(var, info); |
3012 |
+ |
3013 |
+ if (ret) |
3014 |
+diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c |
3015 |
+index 9bd03a2310328..171ad8b42107e 100644 |
3016 |
+--- a/fs/cifs/cifs_unicode.c |
3017 |
++++ b/fs/cifs/cifs_unicode.c |
3018 |
+@@ -358,14 +358,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen, |
3019 |
+ if (!dst) |
3020 |
+ return NULL; |
3021 |
+ cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage, |
3022 |
+- NO_MAP_UNI_RSVD); |
3023 |
++ NO_MAP_UNI_RSVD); |
3024 |
+ } else { |
3025 |
+- len = strnlen(src, maxlen); |
3026 |
+- len++; |
3027 |
+- dst = kmalloc(len, GFP_KERNEL); |
3028 |
+- if (!dst) |
3029 |
+- return NULL; |
3030 |
+- strlcpy(dst, src, len); |
3031 |
++ dst = kstrndup(src, maxlen, GFP_KERNEL); |
3032 |
+ } |
3033 |
+ |
3034 |
+ return dst; |
3035 |
+diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c |
3036 |
+index 943637298f650..a32c5c7dcfd89 100644 |
3037 |
+--- a/fs/debugfs/file.c |
3038 |
++++ b/fs/debugfs/file.c |
3039 |
+@@ -178,8 +178,10 @@ static int open_proxy_open(struct inode *inode, struct file *filp) |
3040 |
+ if (!fops_get(real_fops)) { |
3041 |
+ #ifdef CONFIG_MODULES |
3042 |
+ if (real_fops->owner && |
3043 |
+- real_fops->owner->state == MODULE_STATE_GOING) |
3044 |
++ real_fops->owner->state == MODULE_STATE_GOING) { |
3045 |
++ r = -ENXIO; |
3046 |
+ goto out; |
3047 |
++ } |
3048 |
+ #endif |
3049 |
+ |
3050 |
+ /* Huh? Module did not clean up after itself at exit? */ |
3051 |
+@@ -313,8 +315,10 @@ static int full_proxy_open(struct inode *inode, struct file *filp) |
3052 |
+ if (!fops_get(real_fops)) { |
3053 |
+ #ifdef CONFIG_MODULES |
3054 |
+ if (real_fops->owner && |
3055 |
+- real_fops->owner->state == MODULE_STATE_GOING) |
3056 |
++ real_fops->owner->state == MODULE_STATE_GOING) { |
3057 |
++ r = -ENXIO; |
3058 |
+ goto out; |
3059 |
++ } |
3060 |
+ #endif |
3061 |
+ |
3062 |
+ /* Huh? Module did not cleanup after itself at exit? */ |
3063 |
+diff --git a/fs/fcntl.c b/fs/fcntl.c |
3064 |
+index 3dc90e5293e65..fa0fdd829613c 100644 |
3065 |
+--- a/fs/fcntl.c |
3066 |
++++ b/fs/fcntl.c |
3067 |
+@@ -993,13 +993,14 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band) |
3068 |
+ { |
3069 |
+ while (fa) { |
3070 |
+ struct fown_struct *fown; |
3071 |
++ unsigned long flags; |
3072 |
+ |
3073 |
+ if (fa->magic != FASYNC_MAGIC) { |
3074 |
+ printk(KERN_ERR "kill_fasync: bad magic number in " |
3075 |
+ "fasync_struct!\n"); |
3076 |
+ return; |
3077 |
+ } |
3078 |
+- read_lock(&fa->fa_lock); |
3079 |
++ read_lock_irqsave(&fa->fa_lock, flags); |
3080 |
+ if (fa->fa_file) { |
3081 |
+ fown = &fa->fa_file->f_owner; |
3082 |
+ /* Don't send SIGURG to processes which have not set a |
3083 |
+@@ -1008,7 +1009,7 @@ static void kill_fasync_rcu(struct fasync_struct *fa, int sig, int band) |
3084 |
+ if (!(sig == SIGURG && fown->signum == 0)) |
3085 |
+ send_sigio(fown, fa->fa_fd, band); |
3086 |
+ } |
3087 |
+- read_unlock(&fa->fa_lock); |
3088 |
++ read_unlock_irqrestore(&fa->fa_lock, flags); |
3089 |
+ fa = rcu_dereference(fa->fa_next); |
3090 |
+ } |
3091 |
+ } |
3092 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
3093 |
+index 0883e5b24c901..1de59998e0e75 100644 |
3094 |
+--- a/fs/fuse/file.c |
3095 |
++++ b/fs/fuse/file.c |
3096 |
+@@ -193,12 +193,11 @@ void fuse_finish_open(struct inode *inode, struct file *file) |
3097 |
+ struct fuse_file *ff = file->private_data; |
3098 |
+ struct fuse_conn *fc = get_fuse_conn(inode); |
3099 |
+ |
3100 |
+- if (!(ff->open_flags & FOPEN_KEEP_CACHE)) |
3101 |
+- invalidate_inode_pages2(inode->i_mapping); |
3102 |
+ if (ff->open_flags & FOPEN_STREAM) |
3103 |
+ stream_open(inode, file); |
3104 |
+ else if (ff->open_flags & FOPEN_NONSEEKABLE) |
3105 |
+ nonseekable_open(inode, file); |
3106 |
++ |
3107 |
+ if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { |
3108 |
+ struct fuse_inode *fi = get_fuse_inode(inode); |
3109 |
+ |
3110 |
+@@ -206,10 +205,14 @@ void fuse_finish_open(struct inode *inode, struct file *file) |
3111 |
+ fi->attr_version = atomic64_inc_return(&fc->attr_version); |
3112 |
+ i_size_write(inode, 0); |
3113 |
+ spin_unlock(&fi->lock); |
3114 |
++ truncate_pagecache(inode, 0); |
3115 |
+ fuse_invalidate_attr(inode); |
3116 |
+ if (fc->writeback_cache) |
3117 |
+ file_update_time(file); |
3118 |
++ } else if (!(ff->open_flags & FOPEN_KEEP_CACHE)) { |
3119 |
++ invalidate_inode_pages2(inode->i_mapping); |
3120 |
+ } |
3121 |
++ |
3122 |
+ if ((file->f_mode & FMODE_WRITE) && fc->writeback_cache) |
3123 |
+ fuse_link_write_file(file); |
3124 |
+ } |
3125 |
+@@ -3185,7 +3188,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
3126 |
+ |
3127 |
+ static int fuse_writeback_range(struct inode *inode, loff_t start, loff_t end) |
3128 |
+ { |
3129 |
+- int err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
3130 |
++ int err = filemap_write_and_wait_range(inode->i_mapping, start, -1); |
3131 |
+ |
3132 |
+ if (!err) |
3133 |
+ fuse_sync_writes(inode); |
3134 |
+diff --git a/fs/iomap/swapfile.c b/fs/iomap/swapfile.c |
3135 |
+index bd0cc3dcc9807..2d18246f67266 100644 |
3136 |
+--- a/fs/iomap/swapfile.c |
3137 |
++++ b/fs/iomap/swapfile.c |
3138 |
+@@ -30,11 +30,16 @@ static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi) |
3139 |
+ { |
3140 |
+ struct iomap *iomap = &isi->iomap; |
3141 |
+ unsigned long nr_pages; |
3142 |
++ unsigned long max_pages; |
3143 |
+ uint64_t first_ppage; |
3144 |
+ uint64_t first_ppage_reported; |
3145 |
+ uint64_t next_ppage; |
3146 |
+ int error; |
3147 |
+ |
3148 |
++ if (unlikely(isi->nr_pages >= isi->sis->max)) |
3149 |
++ return 0; |
3150 |
++ max_pages = isi->sis->max - isi->nr_pages; |
3151 |
++ |
3152 |
+ /* |
3153 |
+ * Round the start up and the end down so that the physical |
3154 |
+ * extent aligns to a page boundary. |
3155 |
+@@ -47,6 +52,7 @@ static int iomap_swapfile_add_extent(struct iomap_swapfile_info *isi) |
3156 |
+ if (first_ppage >= next_ppage) |
3157 |
+ return 0; |
3158 |
+ nr_pages = next_ppage - first_ppage; |
3159 |
++ nr_pages = min(nr_pages, max_pages); |
3160 |
+ |
3161 |
+ /* |
3162 |
+ * Calculate how much swap space we're adding; the first page contains |
3163 |
+diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c |
3164 |
+index 62c0462dc89f3..bf30f6ce8dd10 100644 |
3165 |
+--- a/fs/isofs/inode.c |
3166 |
++++ b/fs/isofs/inode.c |
3167 |
+@@ -155,7 +155,6 @@ struct iso9660_options{ |
3168 |
+ unsigned int overriderockperm:1; |
3169 |
+ unsigned int uid_set:1; |
3170 |
+ unsigned int gid_set:1; |
3171 |
+- unsigned int utf8:1; |
3172 |
+ unsigned char map; |
3173 |
+ unsigned char check; |
3174 |
+ unsigned int blocksize; |
3175 |
+@@ -355,7 +354,6 @@ static int parse_options(char *options, struct iso9660_options *popt) |
3176 |
+ popt->gid = GLOBAL_ROOT_GID; |
3177 |
+ popt->uid = GLOBAL_ROOT_UID; |
3178 |
+ popt->iocharset = NULL; |
3179 |
+- popt->utf8 = 0; |
3180 |
+ popt->overriderockperm = 0; |
3181 |
+ popt->session=-1; |
3182 |
+ popt->sbsector=-1; |
3183 |
+@@ -388,10 +386,13 @@ static int parse_options(char *options, struct iso9660_options *popt) |
3184 |
+ case Opt_cruft: |
3185 |
+ popt->cruft = 1; |
3186 |
+ break; |
3187 |
++#ifdef CONFIG_JOLIET |
3188 |
+ case Opt_utf8: |
3189 |
+- popt->utf8 = 1; |
3190 |
++ kfree(popt->iocharset); |
3191 |
++ popt->iocharset = kstrdup("utf8", GFP_KERNEL); |
3192 |
++ if (!popt->iocharset) |
3193 |
++ return 0; |
3194 |
+ break; |
3195 |
+-#ifdef CONFIG_JOLIET |
3196 |
+ case Opt_iocharset: |
3197 |
+ kfree(popt->iocharset); |
3198 |
+ popt->iocharset = match_strdup(&args[0]); |
3199 |
+@@ -494,7 +495,6 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root) |
3200 |
+ if (sbi->s_nocompress) seq_puts(m, ",nocompress"); |
3201 |
+ if (sbi->s_overriderockperm) seq_puts(m, ",overriderockperm"); |
3202 |
+ if (sbi->s_showassoc) seq_puts(m, ",showassoc"); |
3203 |
+- if (sbi->s_utf8) seq_puts(m, ",utf8"); |
3204 |
+ |
3205 |
+ if (sbi->s_check) seq_printf(m, ",check=%c", sbi->s_check); |
3206 |
+ if (sbi->s_mapping) seq_printf(m, ",map=%c", sbi->s_mapping); |
3207 |
+@@ -517,9 +517,10 @@ static int isofs_show_options(struct seq_file *m, struct dentry *root) |
3208 |
+ seq_printf(m, ",fmode=%o", sbi->s_fmode); |
3209 |
+ |
3210 |
+ #ifdef CONFIG_JOLIET |
3211 |
+- if (sbi->s_nls_iocharset && |
3212 |
+- strcmp(sbi->s_nls_iocharset->charset, CONFIG_NLS_DEFAULT) != 0) |
3213 |
++ if (sbi->s_nls_iocharset) |
3214 |
+ seq_printf(m, ",iocharset=%s", sbi->s_nls_iocharset->charset); |
3215 |
++ else |
3216 |
++ seq_puts(m, ",iocharset=utf8"); |
3217 |
+ #endif |
3218 |
+ return 0; |
3219 |
+ } |
3220 |
+@@ -867,14 +868,13 @@ root_found: |
3221 |
+ sbi->s_nls_iocharset = NULL; |
3222 |
+ |
3223 |
+ #ifdef CONFIG_JOLIET |
3224 |
+- if (joliet_level && opt.utf8 == 0) { |
3225 |
++ if (joliet_level) { |
3226 |
+ char *p = opt.iocharset ? opt.iocharset : CONFIG_NLS_DEFAULT; |
3227 |
+- sbi->s_nls_iocharset = load_nls(p); |
3228 |
+- if (! sbi->s_nls_iocharset) { |
3229 |
+- /* Fail only if explicit charset specified */ |
3230 |
+- if (opt.iocharset) |
3231 |
++ if (strcmp(p, "utf8") != 0) { |
3232 |
++ sbi->s_nls_iocharset = opt.iocharset ? |
3233 |
++ load_nls(opt.iocharset) : load_nls_default(); |
3234 |
++ if (!sbi->s_nls_iocharset) |
3235 |
+ goto out_freesbi; |
3236 |
+- sbi->s_nls_iocharset = load_nls_default(); |
3237 |
+ } |
3238 |
+ } |
3239 |
+ #endif |
3240 |
+@@ -890,7 +890,6 @@ root_found: |
3241 |
+ sbi->s_gid = opt.gid; |
3242 |
+ sbi->s_uid_set = opt.uid_set; |
3243 |
+ sbi->s_gid_set = opt.gid_set; |
3244 |
+- sbi->s_utf8 = opt.utf8; |
3245 |
+ sbi->s_nocompress = opt.nocompress; |
3246 |
+ sbi->s_overriderockperm = opt.overriderockperm; |
3247 |
+ /* |
3248 |
+diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h |
3249 |
+index 055ec6c586f7f..dcdc191ed1834 100644 |
3250 |
+--- a/fs/isofs/isofs.h |
3251 |
++++ b/fs/isofs/isofs.h |
3252 |
+@@ -44,7 +44,6 @@ struct isofs_sb_info { |
3253 |
+ unsigned char s_session; |
3254 |
+ unsigned int s_high_sierra:1; |
3255 |
+ unsigned int s_rock:2; |
3256 |
+- unsigned int s_utf8:1; |
3257 |
+ unsigned int s_cruft:1; /* Broken disks with high byte of length |
3258 |
+ * containing junk */ |
3259 |
+ unsigned int s_nocompress:1; |
3260 |
+diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c |
3261 |
+index be8b6a9d0b926..c0f04a1e7f695 100644 |
3262 |
+--- a/fs/isofs/joliet.c |
3263 |
++++ b/fs/isofs/joliet.c |
3264 |
+@@ -41,14 +41,12 @@ uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls) |
3265 |
+ int |
3266 |
+ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, struct inode * inode) |
3267 |
+ { |
3268 |
+- unsigned char utf8; |
3269 |
+ struct nls_table *nls; |
3270 |
+ unsigned char len = 0; |
3271 |
+ |
3272 |
+- utf8 = ISOFS_SB(inode->i_sb)->s_utf8; |
3273 |
+ nls = ISOFS_SB(inode->i_sb)->s_nls_iocharset; |
3274 |
+ |
3275 |
+- if (utf8) { |
3276 |
++ if (!nls) { |
3277 |
+ len = utf16s_to_utf8s((const wchar_t *) de->name, |
3278 |
+ de->name_len[0] >> 1, UTF16_BIG_ENDIAN, |
3279 |
+ outname, PAGE_SIZE); |
3280 |
+diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c |
3281 |
+index 61d3cc2283dc8..498cb70c2c0d0 100644 |
3282 |
+--- a/fs/lockd/svclock.c |
3283 |
++++ b/fs/lockd/svclock.c |
3284 |
+@@ -634,7 +634,7 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file, |
3285 |
+ conflock->caller = "somehost"; /* FIXME */ |
3286 |
+ conflock->len = strlen(conflock->caller); |
3287 |
+ conflock->oh.len = 0; /* don't return OH info */ |
3288 |
+- conflock->svid = ((struct nlm_lockowner *)lock->fl.fl_owner)->pid; |
3289 |
++ conflock->svid = lock->fl.fl_pid; |
3290 |
+ conflock->fl.fl_type = lock->fl.fl_type; |
3291 |
+ conflock->fl.fl_start = lock->fl.fl_start; |
3292 |
+ conflock->fl.fl_end = lock->fl.fl_end; |
3293 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
3294 |
+index 8cb2f744dde6b..3283cc2a4e42c 100644 |
3295 |
+--- a/fs/nfsd/nfs4state.c |
3296 |
++++ b/fs/nfsd/nfs4state.c |
3297 |
+@@ -2572,9 +2572,9 @@ static void force_expire_client(struct nfs4_client *clp) |
3298 |
+ struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); |
3299 |
+ bool already_expired; |
3300 |
+ |
3301 |
+- spin_lock(&clp->cl_lock); |
3302 |
++ spin_lock(&nn->client_lock); |
3303 |
+ clp->cl_time = 0; |
3304 |
+- spin_unlock(&clp->cl_lock); |
3305 |
++ spin_unlock(&nn->client_lock); |
3306 |
+ |
3307 |
+ wait_event(expiry_wq, atomic_read(&clp->cl_rpc_users) == 0); |
3308 |
+ spin_lock(&nn->client_lock); |
3309 |
+diff --git a/fs/udf/misc.c b/fs/udf/misc.c |
3310 |
+index 401e64cde1be0..853bcff51043f 100644 |
3311 |
+--- a/fs/udf/misc.c |
3312 |
++++ b/fs/udf/misc.c |
3313 |
+@@ -173,13 +173,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, |
3314 |
+ else |
3315 |
+ offset = le32_to_cpu(eahd->appAttrLocation); |
3316 |
+ |
3317 |
+- while (offset < iinfo->i_lenEAttr) { |
3318 |
++ while (offset + sizeof(*gaf) < iinfo->i_lenEAttr) { |
3319 |
++ uint32_t attrLength; |
3320 |
++ |
3321 |
+ gaf = (struct genericFormat *)&ea[offset]; |
3322 |
++ attrLength = le32_to_cpu(gaf->attrLength); |
3323 |
++ |
3324 |
++ /* Detect undersized elements and buffer overflows */ |
3325 |
++ if ((attrLength < sizeof(*gaf)) || |
3326 |
++ (attrLength > (iinfo->i_lenEAttr - offset))) |
3327 |
++ break; |
3328 |
++ |
3329 |
+ if (le32_to_cpu(gaf->attrType) == type && |
3330 |
+ gaf->attrSubtype == subtype) |
3331 |
+ return gaf; |
3332 |
+ else |
3333 |
+- offset += le32_to_cpu(gaf->attrLength); |
3334 |
++ offset += attrLength; |
3335 |
+ } |
3336 |
+ } |
3337 |
+ |
3338 |
+diff --git a/fs/udf/super.c b/fs/udf/super.c |
3339 |
+index 8bb001c7927f0..5663bae95700c 100644 |
3340 |
+--- a/fs/udf/super.c |
3341 |
++++ b/fs/udf/super.c |
3342 |
+@@ -108,16 +108,10 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb) |
3343 |
+ return NULL; |
3344 |
+ lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data; |
3345 |
+ partnum = le32_to_cpu(lvid->numOfPartitions); |
3346 |
+- if ((sb->s_blocksize - sizeof(struct logicalVolIntegrityDescImpUse) - |
3347 |
+- offsetof(struct logicalVolIntegrityDesc, impUse)) / |
3348 |
+- (2 * sizeof(uint32_t)) < partnum) { |
3349 |
+- udf_err(sb, "Logical volume integrity descriptor corrupted " |
3350 |
+- "(numOfPartitions = %u)!\n", partnum); |
3351 |
+- return NULL; |
3352 |
+- } |
3353 |
+ /* The offset is to skip freeSpaceTable and sizeTable arrays */ |
3354 |
+ offset = partnum * 2 * sizeof(uint32_t); |
3355 |
+- return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]); |
3356 |
++ return (struct logicalVolIntegrityDescImpUse *) |
3357 |
++ (((uint8_t *)(lvid + 1)) + offset); |
3358 |
+ } |
3359 |
+ |
3360 |
+ /* UDF filesystem type */ |
3361 |
+@@ -349,10 +343,10 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root) |
3362 |
+ seq_printf(seq, ",lastblock=%u", sbi->s_last_block); |
3363 |
+ if (sbi->s_anchor != 0) |
3364 |
+ seq_printf(seq, ",anchor=%u", sbi->s_anchor); |
3365 |
+- if (UDF_QUERY_FLAG(sb, UDF_FLAG_UTF8)) |
3366 |
+- seq_puts(seq, ",utf8"); |
3367 |
+- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP) && sbi->s_nls_map) |
3368 |
++ if (sbi->s_nls_map) |
3369 |
+ seq_printf(seq, ",iocharset=%s", sbi->s_nls_map->charset); |
3370 |
++ else |
3371 |
++ seq_puts(seq, ",iocharset=utf8"); |
3372 |
+ |
3373 |
+ return 0; |
3374 |
+ } |
3375 |
+@@ -557,19 +551,24 @@ static int udf_parse_options(char *options, struct udf_options *uopt, |
3376 |
+ /* Ignored (never implemented properly) */ |
3377 |
+ break; |
3378 |
+ case Opt_utf8: |
3379 |
+- uopt->flags |= (1 << UDF_FLAG_UTF8); |
3380 |
++ if (!remount) { |
3381 |
++ unload_nls(uopt->nls_map); |
3382 |
++ uopt->nls_map = NULL; |
3383 |
++ } |
3384 |
+ break; |
3385 |
+ case Opt_iocharset: |
3386 |
+ if (!remount) { |
3387 |
+- if (uopt->nls_map) |
3388 |
+- unload_nls(uopt->nls_map); |
3389 |
+- /* |
3390 |
+- * load_nls() failure is handled later in |
3391 |
+- * udf_fill_super() after all options are |
3392 |
+- * parsed. |
3393 |
+- */ |
3394 |
++ unload_nls(uopt->nls_map); |
3395 |
++ uopt->nls_map = NULL; |
3396 |
++ } |
3397 |
++ /* When nls_map is not loaded then UTF-8 is used */ |
3398 |
++ if (!remount && strcmp(args[0].from, "utf8") != 0) { |
3399 |
+ uopt->nls_map = load_nls(args[0].from); |
3400 |
+- uopt->flags |= (1 << UDF_FLAG_NLS_MAP); |
3401 |
++ if (!uopt->nls_map) { |
3402 |
++ pr_err("iocharset %s not found\n", |
3403 |
++ args[0].from); |
3404 |
++ return 0; |
3405 |
++ } |
3406 |
+ } |
3407 |
+ break; |
3408 |
+ case Opt_uforget: |
3409 |
+@@ -1548,6 +1547,7 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ |
3410 |
+ struct udf_sb_info *sbi = UDF_SB(sb); |
3411 |
+ struct logicalVolIntegrityDesc *lvid; |
3412 |
+ int indirections = 0; |
3413 |
++ u32 parts, impuselen; |
3414 |
+ |
3415 |
+ while (++indirections <= UDF_MAX_LVID_NESTING) { |
3416 |
+ final_bh = NULL; |
3417 |
+@@ -1574,15 +1574,27 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ |
3418 |
+ |
3419 |
+ lvid = (struct logicalVolIntegrityDesc *)final_bh->b_data; |
3420 |
+ if (lvid->nextIntegrityExt.extLength == 0) |
3421 |
+- return; |
3422 |
++ goto check; |
3423 |
+ |
3424 |
+ loc = leea_to_cpu(lvid->nextIntegrityExt); |
3425 |
+ } |
3426 |
+ |
3427 |
+ udf_warn(sb, "Too many LVID indirections (max %u), ignoring.\n", |
3428 |
+ UDF_MAX_LVID_NESTING); |
3429 |
++out_err: |
3430 |
+ brelse(sbi->s_lvid_bh); |
3431 |
+ sbi->s_lvid_bh = NULL; |
3432 |
++ return; |
3433 |
++check: |
3434 |
++ parts = le32_to_cpu(lvid->numOfPartitions); |
3435 |
++ impuselen = le32_to_cpu(lvid->lengthOfImpUse); |
3436 |
++ if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize || |
3437 |
++ sizeof(struct logicalVolIntegrityDesc) + impuselen + |
3438 |
++ 2 * parts * sizeof(u32) > sb->s_blocksize) { |
3439 |
++ udf_warn(sb, "Corrupted LVID (parts=%u, impuselen=%u), " |
3440 |
++ "ignoring.\n", parts, impuselen); |
3441 |
++ goto out_err; |
3442 |
++ } |
3443 |
+ } |
3444 |
+ |
3445 |
+ /* |
3446 |
+@@ -2145,21 +2157,6 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) |
3447 |
+ if (!udf_parse_options((char *)options, &uopt, false)) |
3448 |
+ goto parse_options_failure; |
3449 |
+ |
3450 |
+- if (uopt.flags & (1 << UDF_FLAG_UTF8) && |
3451 |
+- uopt.flags & (1 << UDF_FLAG_NLS_MAP)) { |
3452 |
+- udf_err(sb, "utf8 cannot be combined with iocharset\n"); |
3453 |
+- goto parse_options_failure; |
3454 |
+- } |
3455 |
+- if ((uopt.flags & (1 << UDF_FLAG_NLS_MAP)) && !uopt.nls_map) { |
3456 |
+- uopt.nls_map = load_nls_default(); |
3457 |
+- if (!uopt.nls_map) |
3458 |
+- uopt.flags &= ~(1 << UDF_FLAG_NLS_MAP); |
3459 |
+- else |
3460 |
+- udf_debug("Using default NLS map\n"); |
3461 |
+- } |
3462 |
+- if (!(uopt.flags & (1 << UDF_FLAG_NLS_MAP))) |
3463 |
+- uopt.flags |= (1 << UDF_FLAG_UTF8); |
3464 |
+- |
3465 |
+ fileset.logicalBlockNum = 0xFFFFFFFF; |
3466 |
+ fileset.partitionReferenceNum = 0xFFFF; |
3467 |
+ |
3468 |
+@@ -2314,8 +2311,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) |
3469 |
+ error_out: |
3470 |
+ iput(sbi->s_vat_inode); |
3471 |
+ parse_options_failure: |
3472 |
+- if (uopt.nls_map) |
3473 |
+- unload_nls(uopt.nls_map); |
3474 |
++ unload_nls(uopt.nls_map); |
3475 |
+ if (lvid_open) |
3476 |
+ udf_close_lvid(sb); |
3477 |
+ brelse(sbi->s_lvid_bh); |
3478 |
+@@ -2365,8 +2361,7 @@ static void udf_put_super(struct super_block *sb) |
3479 |
+ sbi = UDF_SB(sb); |
3480 |
+ |
3481 |
+ iput(sbi->s_vat_inode); |
3482 |
+- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) |
3483 |
+- unload_nls(sbi->s_nls_map); |
3484 |
++ unload_nls(sbi->s_nls_map); |
3485 |
+ if (!sb_rdonly(sb)) |
3486 |
+ udf_close_lvid(sb); |
3487 |
+ brelse(sbi->s_lvid_bh); |
3488 |
+diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h |
3489 |
+index 3d83be54c4748..8eace7a633d38 100644 |
3490 |
+--- a/fs/udf/udf_sb.h |
3491 |
++++ b/fs/udf/udf_sb.h |
3492 |
+@@ -20,8 +20,6 @@ |
3493 |
+ #define UDF_FLAG_UNDELETE 6 |
3494 |
+ #define UDF_FLAG_UNHIDE 7 |
3495 |
+ #define UDF_FLAG_VARCONV 8 |
3496 |
+-#define UDF_FLAG_NLS_MAP 9 |
3497 |
+-#define UDF_FLAG_UTF8 10 |
3498 |
+ #define UDF_FLAG_UID_FORGET 11 /* save -1 for uid to disk */ |
3499 |
+ #define UDF_FLAG_GID_FORGET 12 |
3500 |
+ #define UDF_FLAG_UID_SET 13 |
3501 |
+diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c |
3502 |
+index 5fcfa96463ebb..622569007b530 100644 |
3503 |
+--- a/fs/udf/unicode.c |
3504 |
++++ b/fs/udf/unicode.c |
3505 |
+@@ -177,7 +177,7 @@ static int udf_name_from_CS0(struct super_block *sb, |
3506 |
+ return 0; |
3507 |
+ } |
3508 |
+ |
3509 |
+- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) |
3510 |
++ if (UDF_SB(sb)->s_nls_map) |
3511 |
+ conv_f = UDF_SB(sb)->s_nls_map->uni2char; |
3512 |
+ else |
3513 |
+ conv_f = NULL; |
3514 |
+@@ -285,7 +285,7 @@ static int udf_name_to_CS0(struct super_block *sb, |
3515 |
+ if (ocu_max_len <= 0) |
3516 |
+ return 0; |
3517 |
+ |
3518 |
+- if (UDF_QUERY_FLAG(sb, UDF_FLAG_NLS_MAP)) |
3519 |
++ if (UDF_SB(sb)->s_nls_map) |
3520 |
+ conv_f = UDF_SB(sb)->s_nls_map->char2uni; |
3521 |
+ else |
3522 |
+ conv_f = NULL; |
3523 |
+diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h |
3524 |
+index 22f070085971b..ee10a9f06b97c 100644 |
3525 |
+--- a/include/linux/bpf_verifier.h |
3526 |
++++ b/include/linux/bpf_verifier.h |
3527 |
+@@ -194,6 +194,13 @@ struct bpf_idx_pair { |
3528 |
+ u32 idx; |
3529 |
+ }; |
3530 |
+ |
3531 |
++struct bpf_id_pair { |
3532 |
++ u32 old; |
3533 |
++ u32 cur; |
3534 |
++}; |
3535 |
++ |
3536 |
++/* Maximum number of register states that can exist at once */ |
3537 |
++#define BPF_ID_MAP_SIZE (MAX_BPF_REG + MAX_BPF_STACK / BPF_REG_SIZE) |
3538 |
+ #define MAX_CALL_FRAMES 8 |
3539 |
+ struct bpf_verifier_state { |
3540 |
+ /* call stack tracking */ |
3541 |
+@@ -301,8 +308,8 @@ struct bpf_insn_aux_data { |
3542 |
+ }; |
3543 |
+ }; |
3544 |
+ int ctx_field_size; /* the ctx field size for load insn, maybe 0 */ |
3545 |
+- int sanitize_stack_off; /* stack slot to be cleared */ |
3546 |
+ bool seen; /* this insn was processed by the verifier */ |
3547 |
++ bool sanitize_stack_spill; /* subject to Spectre v4 sanitation */ |
3548 |
+ bool zext_dst; /* this insn zero extends dst reg */ |
3549 |
+ u8 alu_state; /* used in combination with alu_limit */ |
3550 |
+ bool prune_point; |
3551 |
+@@ -364,12 +371,14 @@ struct bpf_verifier_env { |
3552 |
+ struct bpf_map *used_maps[MAX_USED_MAPS]; /* array of map's used by eBPF program */ |
3553 |
+ u32 used_map_cnt; /* number of used maps */ |
3554 |
+ u32 id_gen; /* used to generate unique reg IDs */ |
3555 |
++ bool explore_alu_limits; |
3556 |
+ bool allow_ptr_leaks; |
3557 |
+ bool seen_direct_write; |
3558 |
+ struct bpf_insn_aux_data *insn_aux_data; /* array of per-insn state */ |
3559 |
+ const struct bpf_line_info *prev_linfo; |
3560 |
+ struct bpf_verifier_log log; |
3561 |
+ struct bpf_subprog_info subprog_info[BPF_MAX_SUBPROGS + 1]; |
3562 |
++ struct bpf_id_pair idmap_scratch[BPF_ID_MAP_SIZE]; |
3563 |
+ struct { |
3564 |
+ int *insn_state; |
3565 |
+ int *insn_stack; |
3566 |
+diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h |
3567 |
+index 73f8c3cb95888..9ee6ccc18424f 100644 |
3568 |
+--- a/include/linux/energy_model.h |
3569 |
++++ b/include/linux/energy_model.h |
3570 |
+@@ -42,6 +42,22 @@ struct em_perf_domain { |
3571 |
+ |
3572 |
+ #define EM_CPU_MAX_POWER 0xFFFF |
3573 |
+ |
3574 |
++/* |
3575 |
++ * Increase resolution of energy estimation calculations for 64-bit |
3576 |
++ * architectures. The extra resolution improves decision made by EAS for the |
3577 |
++ * task placement when two Performance Domains might provide similar energy |
3578 |
++ * estimation values (w/o better resolution the values could be equal). |
3579 |
++ * |
3580 |
++ * We increase resolution only if we have enough bits to allow this increased |
3581 |
++ * resolution (i.e. 64-bit). The costs for increasing resolution when 32-bit |
3582 |
++ * are pretty high and the returns do not justify the increased costs. |
3583 |
++ */ |
3584 |
++#ifdef CONFIG_64BIT |
3585 |
++#define em_scale_power(p) ((p) * 1000) |
3586 |
++#else |
3587 |
++#define em_scale_power(p) (p) |
3588 |
++#endif |
3589 |
++ |
3590 |
+ struct em_data_callback { |
3591 |
+ /** |
3592 |
+ * active_power() - Provide power at the next capacity state of a CPU |
3593 |
+diff --git a/include/linux/filter.h b/include/linux/filter.h |
3594 |
+index c53e2fe3c8f7f..c4f89340f4986 100644 |
3595 |
+--- a/include/linux/filter.h |
3596 |
++++ b/include/linux/filter.h |
3597 |
+@@ -68,6 +68,11 @@ struct ctl_table_header; |
3598 |
+ /* unused opcode to mark call to interpreter with arguments */ |
3599 |
+ #define BPF_CALL_ARGS 0xe0 |
3600 |
+ |
3601 |
++/* unused opcode to mark speculation barrier for mitigating |
3602 |
++ * Speculative Store Bypass |
3603 |
++ */ |
3604 |
++#define BPF_NOSPEC 0xc0 |
3605 |
++ |
3606 |
+ /* As per nm, we expose JITed images as text (code) section for |
3607 |
+ * kallsyms. That way, tools like perf can find it to match |
3608 |
+ * addresses. |
3609 |
+@@ -368,6 +373,16 @@ static inline bool insn_is_zext(const struct bpf_insn *insn) |
3610 |
+ .off = 0, \ |
3611 |
+ .imm = 0 }) |
3612 |
+ |
3613 |
++/* Speculation barrier */ |
3614 |
++ |
3615 |
++#define BPF_ST_NOSPEC() \ |
3616 |
++ ((struct bpf_insn) { \ |
3617 |
++ .code = BPF_ST | BPF_NOSPEC, \ |
3618 |
++ .dst_reg = 0, \ |
3619 |
++ .src_reg = 0, \ |
3620 |
++ .off = 0, \ |
3621 |
++ .imm = 0 }) |
3622 |
++ |
3623 |
+ /* Internal classic blocks for direct assignment */ |
3624 |
+ |
3625 |
+ #define __BPF_STMT(CODE, K) \ |
3626 |
+diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h |
3627 |
+index 1f98b52118f0a..48be92aded5ee 100644 |
3628 |
+--- a/include/linux/hrtimer.h |
3629 |
++++ b/include/linux/hrtimer.h |
3630 |
+@@ -317,16 +317,12 @@ struct clock_event_device; |
3631 |
+ |
3632 |
+ extern void hrtimer_interrupt(struct clock_event_device *dev); |
3633 |
+ |
3634 |
+-extern void clock_was_set_delayed(void); |
3635 |
+- |
3636 |
+ extern unsigned int hrtimer_resolution; |
3637 |
+ |
3638 |
+ #else |
3639 |
+ |
3640 |
+ #define hrtimer_resolution (unsigned int)LOW_RES_NSEC |
3641 |
+ |
3642 |
+-static inline void clock_was_set_delayed(void) { } |
3643 |
+- |
3644 |
+ #endif |
3645 |
+ |
3646 |
+ static inline ktime_t |
3647 |
+@@ -350,7 +346,6 @@ hrtimer_expires_remaining_adjusted(const struct hrtimer *timer) |
3648 |
+ timer->base->get_time()); |
3649 |
+ } |
3650 |
+ |
3651 |
+-extern void clock_was_set(void); |
3652 |
+ #ifdef CONFIG_TIMERFD |
3653 |
+ extern void timerfd_clock_was_set(void); |
3654 |
+ #else |
3655 |
+diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h |
3656 |
+index 4badd53229490..2f9ff5017f122 100644 |
3657 |
+--- a/include/linux/power/max17042_battery.h |
3658 |
++++ b/include/linux/power/max17042_battery.h |
3659 |
+@@ -69,7 +69,7 @@ enum max17042_register { |
3660 |
+ MAX17042_RelaxCFG = 0x2A, |
3661 |
+ MAX17042_MiscCFG = 0x2B, |
3662 |
+ MAX17042_TGAIN = 0x2C, |
3663 |
+- MAx17042_TOFF = 0x2D, |
3664 |
++ MAX17042_TOFF = 0x2D, |
3665 |
+ MAX17042_CGAIN = 0x2E, |
3666 |
+ MAX17042_COFF = 0x2F, |
3667 |
+ |
3668 |
+diff --git a/include/linux/time64.h b/include/linux/time64.h |
3669 |
+index 5eab3f2635186..f6059c505986b 100644 |
3670 |
+--- a/include/linux/time64.h |
3671 |
++++ b/include/linux/time64.h |
3672 |
+@@ -33,7 +33,9 @@ struct itimerspec64 { |
3673 |
+ #define TIME64_MIN (-TIME64_MAX - 1) |
3674 |
+ |
3675 |
+ #define KTIME_MAX ((s64)~((u64)1 << 63)) |
3676 |
++#define KTIME_MIN (-KTIME_MAX - 1) |
3677 |
+ #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) |
3678 |
++#define KTIME_SEC_MIN (KTIME_MIN / NSEC_PER_SEC) |
3679 |
+ |
3680 |
+ /* |
3681 |
+ * Limits for settimeofday(): |
3682 |
+@@ -132,10 +134,13 @@ static inline bool timespec64_valid_settod(const struct timespec64 *ts) |
3683 |
+ */ |
3684 |
+ static inline s64 timespec64_to_ns(const struct timespec64 *ts) |
3685 |
+ { |
3686 |
+- /* Prevent multiplication overflow */ |
3687 |
+- if ((unsigned long long)ts->tv_sec >= KTIME_SEC_MAX) |
3688 |
++ /* Prevent multiplication overflow / underflow */ |
3689 |
++ if (ts->tv_sec >= KTIME_SEC_MAX) |
3690 |
+ return KTIME_MAX; |
3691 |
+ |
3692 |
++ if (ts->tv_sec <= KTIME_SEC_MIN) |
3693 |
++ return KTIME_MIN; |
3694 |
++ |
3695 |
+ return ((s64) ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec; |
3696 |
+ } |
3697 |
+ |
3698 |
+diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h |
3699 |
+index 8649422e760cc..63038eb23560b 100644 |
3700 |
+--- a/include/uapi/linux/bpf.h |
3701 |
++++ b/include/uapi/linux/bpf.h |
3702 |
+@@ -2264,7 +2264,7 @@ union bpf_attr { |
3703 |
+ * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) |
3704 |
+ * Description |
3705 |
+ * Select a **SO_REUSEPORT** socket from a |
3706 |
+- * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*. |
3707 |
++ * **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*. |
3708 |
+ * It checks the selected socket is matching the incoming |
3709 |
+ * request in the socket buffer. |
3710 |
+ * Return |
3711 |
+diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c |
3712 |
+index 323913ba13b38..d9a3d995bd966 100644 |
3713 |
+--- a/kernel/bpf/core.c |
3714 |
++++ b/kernel/bpf/core.c |
3715 |
+@@ -31,6 +31,7 @@ |
3716 |
+ #include <linux/rcupdate.h> |
3717 |
+ #include <linux/perf_event.h> |
3718 |
+ |
3719 |
++#include <asm/barrier.h> |
3720 |
+ #include <asm/unaligned.h> |
3721 |
+ |
3722 |
+ /* Registers */ |
3723 |
+@@ -1310,6 +1311,7 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) |
3724 |
+ /* Non-UAPI available opcodes. */ |
3725 |
+ [BPF_JMP | BPF_CALL_ARGS] = &&JMP_CALL_ARGS, |
3726 |
+ [BPF_JMP | BPF_TAIL_CALL] = &&JMP_TAIL_CALL, |
3727 |
++ [BPF_ST | BPF_NOSPEC] = &&ST_NOSPEC, |
3728 |
+ }; |
3729 |
+ #undef BPF_INSN_3_LBL |
3730 |
+ #undef BPF_INSN_2_LBL |
3731 |
+@@ -1550,7 +1552,21 @@ out: |
3732 |
+ COND_JMP(s, JSGE, >=) |
3733 |
+ COND_JMP(s, JSLE, <=) |
3734 |
+ #undef COND_JMP |
3735 |
+- /* STX and ST and LDX*/ |
3736 |
++ /* ST, STX and LDX*/ |
3737 |
++ ST_NOSPEC: |
3738 |
++ /* Speculation barrier for mitigating Speculative Store Bypass. |
3739 |
++ * In case of arm64, we rely on the firmware mitigation as |
3740 |
++ * controlled via the ssbd kernel parameter. Whenever the |
3741 |
++ * mitigation is enabled, it works for all of the kernel code |
3742 |
++ * with no need to provide any additional instructions here. |
3743 |
++ * In case of x86, we use 'lfence' insn for mitigation. We |
3744 |
++ * reuse preexisting logic from Spectre v1 mitigation that |
3745 |
++ * happens to produce the required code on x86 for v4 as well. |
3746 |
++ */ |
3747 |
++#ifdef CONFIG_X86 |
3748 |
++ barrier_nospec(); |
3749 |
++#endif |
3750 |
++ CONT; |
3751 |
+ #define LDST(SIZEOP, SIZE) \ |
3752 |
+ STX_MEM_##SIZEOP: \ |
3753 |
+ *(SIZE *)(unsigned long) (DST + insn->off) = SRC; \ |
3754 |
+diff --git a/kernel/bpf/disasm.c b/kernel/bpf/disasm.c |
3755 |
+index b44d8c447afd1..ff1dd7d45b58a 100644 |
3756 |
+--- a/kernel/bpf/disasm.c |
3757 |
++++ b/kernel/bpf/disasm.c |
3758 |
+@@ -162,15 +162,17 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs, |
3759 |
+ else |
3760 |
+ verbose(cbs->private_data, "BUG_%02x\n", insn->code); |
3761 |
+ } else if (class == BPF_ST) { |
3762 |
+- if (BPF_MODE(insn->code) != BPF_MEM) { |
3763 |
++ if (BPF_MODE(insn->code) == BPF_MEM) { |
3764 |
++ verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", |
3765 |
++ insn->code, |
3766 |
++ bpf_ldst_string[BPF_SIZE(insn->code) >> 3], |
3767 |
++ insn->dst_reg, |
3768 |
++ insn->off, insn->imm); |
3769 |
++ } else if (BPF_MODE(insn->code) == 0xc0 /* BPF_NOSPEC, no UAPI */) { |
3770 |
++ verbose(cbs->private_data, "(%02x) nospec\n", insn->code); |
3771 |
++ } else { |
3772 |
+ verbose(cbs->private_data, "BUG_st_%02x\n", insn->code); |
3773 |
+- return; |
3774 |
+ } |
3775 |
+- verbose(cbs->private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", |
3776 |
+- insn->code, |
3777 |
+- bpf_ldst_string[BPF_SIZE(insn->code) >> 3], |
3778 |
+- insn->dst_reg, |
3779 |
+- insn->off, insn->imm); |
3780 |
+ } else if (class == BPF_LDX) { |
3781 |
+ if (BPF_MODE(insn->code) != BPF_MEM) { |
3782 |
+ verbose(cbs->private_data, "BUG_ldx_%02x\n", insn->code); |
3783 |
+diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c |
3784 |
+index 4deaf15b7618b..60383b28549be 100644 |
3785 |
+--- a/kernel/bpf/verifier.c |
3786 |
++++ b/kernel/bpf/verifier.c |
3787 |
+@@ -1920,6 +1920,19 @@ static int check_stack_write(struct bpf_verifier_env *env, |
3788 |
+ cur = env->cur_state->frame[env->cur_state->curframe]; |
3789 |
+ if (value_regno >= 0) |
3790 |
+ reg = &cur->regs[value_regno]; |
3791 |
++ if (!env->allow_ptr_leaks) { |
3792 |
++ bool sanitize = reg && is_spillable_regtype(reg->type); |
3793 |
++ |
3794 |
++ for (i = 0; i < size; i++) { |
3795 |
++ if (state->stack[spi].slot_type[i] == STACK_INVALID) { |
3796 |
++ sanitize = true; |
3797 |
++ break; |
3798 |
++ } |
3799 |
++ } |
3800 |
++ |
3801 |
++ if (sanitize) |
3802 |
++ env->insn_aux_data[insn_idx].sanitize_stack_spill = true; |
3803 |
++ } |
3804 |
+ |
3805 |
+ if (reg && size == BPF_REG_SIZE && register_is_const(reg) && |
3806 |
+ !register_is_null(reg) && env->allow_ptr_leaks) { |
3807 |
+@@ -1942,47 +1955,10 @@ static int check_stack_write(struct bpf_verifier_env *env, |
3808 |
+ verbose(env, "invalid size of register spill\n"); |
3809 |
+ return -EACCES; |
3810 |
+ } |
3811 |
+- |
3812 |
+ if (state != cur && reg->type == PTR_TO_STACK) { |
3813 |
+ verbose(env, "cannot spill pointers to stack into stack frame of the caller\n"); |
3814 |
+ return -EINVAL; |
3815 |
+ } |
3816 |
+- |
3817 |
+- if (!env->allow_ptr_leaks) { |
3818 |
+- bool sanitize = false; |
3819 |
+- |
3820 |
+- if (state->stack[spi].slot_type[0] == STACK_SPILL && |
3821 |
+- register_is_const(&state->stack[spi].spilled_ptr)) |
3822 |
+- sanitize = true; |
3823 |
+- for (i = 0; i < BPF_REG_SIZE; i++) |
3824 |
+- if (state->stack[spi].slot_type[i] == STACK_MISC) { |
3825 |
+- sanitize = true; |
3826 |
+- break; |
3827 |
+- } |
3828 |
+- if (sanitize) { |
3829 |
+- int *poff = &env->insn_aux_data[insn_idx].sanitize_stack_off; |
3830 |
+- int soff = (-spi - 1) * BPF_REG_SIZE; |
3831 |
+- |
3832 |
+- /* detected reuse of integer stack slot with a pointer |
3833 |
+- * which means either llvm is reusing stack slot or |
3834 |
+- * an attacker is trying to exploit CVE-2018-3639 |
3835 |
+- * (speculative store bypass) |
3836 |
+- * Have to sanitize that slot with preemptive |
3837 |
+- * store of zero. |
3838 |
+- */ |
3839 |
+- if (*poff && *poff != soff) { |
3840 |
+- /* disallow programs where single insn stores |
3841 |
+- * into two different stack slots, since verifier |
3842 |
+- * cannot sanitize them |
3843 |
+- */ |
3844 |
+- verbose(env, |
3845 |
+- "insn %d cannot access two stack slots fp%d and fp%d", |
3846 |
+- insn_idx, *poff, soff); |
3847 |
+- return -EINVAL; |
3848 |
+- } |
3849 |
+- *poff = soff; |
3850 |
+- } |
3851 |
+- } |
3852 |
+ save_register_state(state, spi, reg); |
3853 |
+ } else { |
3854 |
+ u8 type = STACK_MISC; |
3855 |
+@@ -4473,6 +4449,12 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env, |
3856 |
+ alu_state |= off_is_imm ? BPF_ALU_IMMEDIATE : 0; |
3857 |
+ alu_state |= ptr_is_dst_reg ? |
3858 |
+ BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST; |
3859 |
++ |
3860 |
++ /* Limit pruning on unknown scalars to enable deep search for |
3861 |
++ * potential masking differences from other program paths. |
3862 |
++ */ |
3863 |
++ if (!off_is_imm) |
3864 |
++ env->explore_alu_limits = true; |
3865 |
+ } |
3866 |
+ |
3867 |
+ err = update_alu_sanitation_state(aux, alu_state, alu_limit); |
3868 |
+@@ -7000,13 +6982,6 @@ static bool range_within(struct bpf_reg_state *old, |
3869 |
+ old->smax_value >= cur->smax_value; |
3870 |
+ } |
3871 |
+ |
3872 |
+-/* Maximum number of register states that can exist at once */ |
3873 |
+-#define ID_MAP_SIZE (MAX_BPF_REG + MAX_BPF_STACK / BPF_REG_SIZE) |
3874 |
+-struct idpair { |
3875 |
+- u32 old; |
3876 |
+- u32 cur; |
3877 |
+-}; |
3878 |
+- |
3879 |
+ /* If in the old state two registers had the same id, then they need to have |
3880 |
+ * the same id in the new state as well. But that id could be different from |
3881 |
+ * the old state, so we need to track the mapping from old to new ids. |
3882 |
+@@ -7017,11 +6992,11 @@ struct idpair { |
3883 |
+ * So we look through our idmap to see if this old id has been seen before. If |
3884 |
+ * so, we require the new id to match; otherwise, we add the id pair to the map. |
3885 |
+ */ |
3886 |
+-static bool check_ids(u32 old_id, u32 cur_id, struct idpair *idmap) |
3887 |
++static bool check_ids(u32 old_id, u32 cur_id, struct bpf_id_pair *idmap) |
3888 |
+ { |
3889 |
+ unsigned int i; |
3890 |
+ |
3891 |
+- for (i = 0; i < ID_MAP_SIZE; i++) { |
3892 |
++ for (i = 0; i < BPF_ID_MAP_SIZE; i++) { |
3893 |
+ if (!idmap[i].old) { |
3894 |
+ /* Reached an empty slot; haven't seen this id before */ |
3895 |
+ idmap[i].old = old_id; |
3896 |
+@@ -7133,8 +7108,8 @@ next: |
3897 |
+ } |
3898 |
+ |
3899 |
+ /* Returns true if (rold safe implies rcur safe) */ |
3900 |
+-static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, |
3901 |
+- struct idpair *idmap) |
3902 |
++static bool regsafe(struct bpf_verifier_env *env, struct bpf_reg_state *rold, |
3903 |
++ struct bpf_reg_state *rcur, struct bpf_id_pair *idmap) |
3904 |
+ { |
3905 |
+ bool equal; |
3906 |
+ |
3907 |
+@@ -7160,6 +7135,8 @@ static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, |
3908 |
+ return false; |
3909 |
+ switch (rold->type) { |
3910 |
+ case SCALAR_VALUE: |
3911 |
++ if (env->explore_alu_limits) |
3912 |
++ return false; |
3913 |
+ if (rcur->type == SCALAR_VALUE) { |
3914 |
+ if (!rold->precise && !rcur->precise) |
3915 |
+ return true; |
3916 |
+@@ -7249,9 +7226,8 @@ static bool regsafe(struct bpf_reg_state *rold, struct bpf_reg_state *rcur, |
3917 |
+ return false; |
3918 |
+ } |
3919 |
+ |
3920 |
+-static bool stacksafe(struct bpf_func_state *old, |
3921 |
+- struct bpf_func_state *cur, |
3922 |
+- struct idpair *idmap) |
3923 |
++static bool stacksafe(struct bpf_verifier_env *env, struct bpf_func_state *old, |
3924 |
++ struct bpf_func_state *cur, struct bpf_id_pair *idmap) |
3925 |
+ { |
3926 |
+ int i, spi; |
3927 |
+ |
3928 |
+@@ -7296,9 +7272,8 @@ static bool stacksafe(struct bpf_func_state *old, |
3929 |
+ continue; |
3930 |
+ if (old->stack[spi].slot_type[0] != STACK_SPILL) |
3931 |
+ continue; |
3932 |
+- if (!regsafe(&old->stack[spi].spilled_ptr, |
3933 |
+- &cur->stack[spi].spilled_ptr, |
3934 |
+- idmap)) |
3935 |
++ if (!regsafe(env, &old->stack[spi].spilled_ptr, |
3936 |
++ &cur->stack[spi].spilled_ptr, idmap)) |
3937 |
+ /* when explored and current stack slot are both storing |
3938 |
+ * spilled registers, check that stored pointers types |
3939 |
+ * are the same as well. |
3940 |
+@@ -7348,32 +7323,24 @@ static bool refsafe(struct bpf_func_state *old, struct bpf_func_state *cur) |
3941 |
+ * whereas register type in current state is meaningful, it means that |
3942 |
+ * the current state will reach 'bpf_exit' instruction safely |
3943 |
+ */ |
3944 |
+-static bool func_states_equal(struct bpf_func_state *old, |
3945 |
++static bool func_states_equal(struct bpf_verifier_env *env, struct bpf_func_state *old, |
3946 |
+ struct bpf_func_state *cur) |
3947 |
+ { |
3948 |
+- struct idpair *idmap; |
3949 |
+- bool ret = false; |
3950 |
+ int i; |
3951 |
+ |
3952 |
+- idmap = kcalloc(ID_MAP_SIZE, sizeof(struct idpair), GFP_KERNEL); |
3953 |
+- /* If we failed to allocate the idmap, just say it's not safe */ |
3954 |
+- if (!idmap) |
3955 |
+- return false; |
3956 |
+- |
3957 |
+- for (i = 0; i < MAX_BPF_REG; i++) { |
3958 |
+- if (!regsafe(&old->regs[i], &cur->regs[i], idmap)) |
3959 |
+- goto out_free; |
3960 |
+- } |
3961 |
++ memset(env->idmap_scratch, 0, sizeof(env->idmap_scratch)); |
3962 |
++ for (i = 0; i < MAX_BPF_REG; i++) |
3963 |
++ if (!regsafe(env, &old->regs[i], &cur->regs[i], |
3964 |
++ env->idmap_scratch)) |
3965 |
++ return false; |
3966 |
+ |
3967 |
+- if (!stacksafe(old, cur, idmap)) |
3968 |
+- goto out_free; |
3969 |
++ if (!stacksafe(env, old, cur, env->idmap_scratch)) |
3970 |
++ return false; |
3971 |
+ |
3972 |
+ if (!refsafe(old, cur)) |
3973 |
+- goto out_free; |
3974 |
+- ret = true; |
3975 |
+-out_free: |
3976 |
+- kfree(idmap); |
3977 |
+- return ret; |
3978 |
++ return false; |
3979 |
++ |
3980 |
++ return true; |
3981 |
+ } |
3982 |
+ |
3983 |
+ static bool states_equal(struct bpf_verifier_env *env, |
3984 |
+@@ -7400,7 +7367,7 @@ static bool states_equal(struct bpf_verifier_env *env, |
3985 |
+ for (i = 0; i <= old->curframe; i++) { |
3986 |
+ if (old->frame[i]->callsite != cur->frame[i]->callsite) |
3987 |
+ return false; |
3988 |
+- if (!func_states_equal(old->frame[i], cur->frame[i])) |
3989 |
++ if (!func_states_equal(env, old->frame[i], cur->frame[i])) |
3990 |
+ return false; |
3991 |
+ } |
3992 |
+ return true; |
3993 |
+@@ -8401,10 +8368,11 @@ static void convert_pseudo_ld_imm64(struct bpf_verifier_env *env) |
3994 |
+ * insni[off, off + cnt). Adjust corresponding insn_aux_data by copying |
3995 |
+ * [0, off) and [off, end) to new locations, so the patched range stays zero |
3996 |
+ */ |
3997 |
+-static int adjust_insn_aux_data(struct bpf_verifier_env *env, |
3998 |
+- struct bpf_prog *new_prog, u32 off, u32 cnt) |
3999 |
++static void adjust_insn_aux_data(struct bpf_verifier_env *env, |
4000 |
++ struct bpf_insn_aux_data *new_data, |
4001 |
++ struct bpf_prog *new_prog, u32 off, u32 cnt) |
4002 |
+ { |
4003 |
+- struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data; |
4004 |
++ struct bpf_insn_aux_data *old_data = env->insn_aux_data; |
4005 |
+ struct bpf_insn *insn = new_prog->insnsi; |
4006 |
+ bool old_seen = old_data[off].seen; |
4007 |
+ u32 prog_len; |
4008 |
+@@ -8417,12 +8385,9 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env, |
4009 |
+ old_data[off].zext_dst = insn_has_def32(env, insn + off + cnt - 1); |
4010 |
+ |
4011 |
+ if (cnt == 1) |
4012 |
+- return 0; |
4013 |
++ return; |
4014 |
+ prog_len = new_prog->len; |
4015 |
+- new_data = vzalloc(array_size(prog_len, |
4016 |
+- sizeof(struct bpf_insn_aux_data))); |
4017 |
+- if (!new_data) |
4018 |
+- return -ENOMEM; |
4019 |
++ |
4020 |
+ memcpy(new_data, old_data, sizeof(struct bpf_insn_aux_data) * off); |
4021 |
+ memcpy(new_data + off + cnt - 1, old_data + off, |
4022 |
+ sizeof(struct bpf_insn_aux_data) * (prog_len - off - cnt + 1)); |
4023 |
+@@ -8433,7 +8398,6 @@ static int adjust_insn_aux_data(struct bpf_verifier_env *env, |
4024 |
+ } |
4025 |
+ env->insn_aux_data = new_data; |
4026 |
+ vfree(old_data); |
4027 |
+- return 0; |
4028 |
+ } |
4029 |
+ |
4030 |
+ static void adjust_subprog_starts(struct bpf_verifier_env *env, u32 off, u32 len) |
4031 |
+@@ -8454,6 +8418,14 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of |
4032 |
+ const struct bpf_insn *patch, u32 len) |
4033 |
+ { |
4034 |
+ struct bpf_prog *new_prog; |
4035 |
++ struct bpf_insn_aux_data *new_data = NULL; |
4036 |
++ |
4037 |
++ if (len > 1) { |
4038 |
++ new_data = vzalloc(array_size(env->prog->len + len - 1, |
4039 |
++ sizeof(struct bpf_insn_aux_data))); |
4040 |
++ if (!new_data) |
4041 |
++ return NULL; |
4042 |
++ } |
4043 |
+ |
4044 |
+ new_prog = bpf_patch_insn_single(env->prog, off, patch, len); |
4045 |
+ if (IS_ERR(new_prog)) { |
4046 |
+@@ -8461,10 +8433,10 @@ static struct bpf_prog *bpf_patch_insn_data(struct bpf_verifier_env *env, u32 of |
4047 |
+ verbose(env, |
4048 |
+ "insn %d cannot be patched due to 16-bit range\n", |
4049 |
+ env->insn_aux_data[off].orig_idx); |
4050 |
++ vfree(new_data); |
4051 |
+ return NULL; |
4052 |
+ } |
4053 |
+- if (adjust_insn_aux_data(env, new_prog, off, len)) |
4054 |
+- return NULL; |
4055 |
++ adjust_insn_aux_data(env, new_data, new_prog, off, len); |
4056 |
+ adjust_subprog_starts(env, off, len); |
4057 |
+ return new_prog; |
4058 |
+ } |
4059 |
+@@ -8849,35 +8821,33 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
4060 |
+ |
4061 |
+ for (i = 0; i < insn_cnt; i++, insn++) { |
4062 |
+ bpf_convert_ctx_access_t convert_ctx_access; |
4063 |
++ bool ctx_access; |
4064 |
+ |
4065 |
+ if (insn->code == (BPF_LDX | BPF_MEM | BPF_B) || |
4066 |
+ insn->code == (BPF_LDX | BPF_MEM | BPF_H) || |
4067 |
+ insn->code == (BPF_LDX | BPF_MEM | BPF_W) || |
4068 |
+- insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) |
4069 |
++ insn->code == (BPF_LDX | BPF_MEM | BPF_DW)) { |
4070 |
+ type = BPF_READ; |
4071 |
+- else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || |
4072 |
+- insn->code == (BPF_STX | BPF_MEM | BPF_H) || |
4073 |
+- insn->code == (BPF_STX | BPF_MEM | BPF_W) || |
4074 |
+- insn->code == (BPF_STX | BPF_MEM | BPF_DW)) |
4075 |
++ ctx_access = true; |
4076 |
++ } else if (insn->code == (BPF_STX | BPF_MEM | BPF_B) || |
4077 |
++ insn->code == (BPF_STX | BPF_MEM | BPF_H) || |
4078 |
++ insn->code == (BPF_STX | BPF_MEM | BPF_W) || |
4079 |
++ insn->code == (BPF_STX | BPF_MEM | BPF_DW) || |
4080 |
++ insn->code == (BPF_ST | BPF_MEM | BPF_B) || |
4081 |
++ insn->code == (BPF_ST | BPF_MEM | BPF_H) || |
4082 |
++ insn->code == (BPF_ST | BPF_MEM | BPF_W) || |
4083 |
++ insn->code == (BPF_ST | BPF_MEM | BPF_DW)) { |
4084 |
+ type = BPF_WRITE; |
4085 |
+- else |
4086 |
++ ctx_access = BPF_CLASS(insn->code) == BPF_STX; |
4087 |
++ } else { |
4088 |
+ continue; |
4089 |
++ } |
4090 |
+ |
4091 |
+ if (type == BPF_WRITE && |
4092 |
+- env->insn_aux_data[i + delta].sanitize_stack_off) { |
4093 |
++ env->insn_aux_data[i + delta].sanitize_stack_spill) { |
4094 |
+ struct bpf_insn patch[] = { |
4095 |
+- /* Sanitize suspicious stack slot with zero. |
4096 |
+- * There are no memory dependencies for this store, |
4097 |
+- * since it's only using frame pointer and immediate |
4098 |
+- * constant of zero |
4099 |
+- */ |
4100 |
+- BPF_ST_MEM(BPF_DW, BPF_REG_FP, |
4101 |
+- env->insn_aux_data[i + delta].sanitize_stack_off, |
4102 |
+- 0), |
4103 |
+- /* the original STX instruction will immediately |
4104 |
+- * overwrite the same stack slot with appropriate value |
4105 |
+- */ |
4106 |
+ *insn, |
4107 |
++ BPF_ST_NOSPEC(), |
4108 |
+ }; |
4109 |
+ |
4110 |
+ cnt = ARRAY_SIZE(patch); |
4111 |
+@@ -8891,6 +8861,9 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
4112 |
+ continue; |
4113 |
+ } |
4114 |
+ |
4115 |
++ if (!ctx_access) |
4116 |
++ continue; |
4117 |
++ |
4118 |
+ switch (env->insn_aux_data[i + delta].ptr_type) { |
4119 |
+ case PTR_TO_CTX: |
4120 |
+ if (!ops->convert_ctx_access) |
4121 |
+@@ -8952,6 +8925,10 @@ static int convert_ctx_accesses(struct bpf_verifier_env *env) |
4122 |
+ if (is_narrower_load && size < target_size) { |
4123 |
+ u8 shift = bpf_ctx_narrow_access_offset( |
4124 |
+ off, size, size_default) * 8; |
4125 |
++ if (shift && cnt + 1 >= ARRAY_SIZE(insn_buf)) { |
4126 |
++ verbose(env, "bpf verifier narrow ctx load misconfigured\n"); |
4127 |
++ return -EINVAL; |
4128 |
++ } |
4129 |
+ if (ctx_field_size <= 4) { |
4130 |
+ if (shift) |
4131 |
+ insn_buf[cnt++] = BPF_ALU32_IMM(BPF_RSH, |
4132 |
+diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c |
4133 |
+index bab6a934862e3..badfa8f153599 100644 |
4134 |
+--- a/kernel/cgroup/cpuset.c |
4135 |
++++ b/kernel/cgroup/cpuset.c |
4136 |
+@@ -3166,6 +3166,13 @@ static void cpuset_hotplug_workfn(struct work_struct *work) |
4137 |
+ cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus); |
4138 |
+ mems_updated = !nodes_equal(top_cpuset.effective_mems, new_mems); |
4139 |
+ |
4140 |
++ /* |
4141 |
++ * In the rare case that hotplug removes all the cpus in subparts_cpus, |
4142 |
++ * we assumed that cpus are updated. |
4143 |
++ */ |
4144 |
++ if (!cpus_updated && top_cpuset.nr_subparts_cpus) |
4145 |
++ cpus_updated = true; |
4146 |
++ |
4147 |
+ /* synchronize cpus_allowed to cpu_active_mask */ |
4148 |
+ if (cpus_updated) { |
4149 |
+ spin_lock_irq(&callback_lock); |
4150 |
+diff --git a/kernel/irq/timings.c b/kernel/irq/timings.c |
4151 |
+index b5985da80acf0..7ccc8edce46dc 100644 |
4152 |
+--- a/kernel/irq/timings.c |
4153 |
++++ b/kernel/irq/timings.c |
4154 |
+@@ -799,12 +799,14 @@ static int __init irq_timings_test_irqs(struct timings_intervals *ti) |
4155 |
+ |
4156 |
+ __irq_timings_store(irq, irqs, ti->intervals[i]); |
4157 |
+ if (irqs->circ_timings[i & IRQ_TIMINGS_MASK] != index) { |
4158 |
++ ret = -EBADSLT; |
4159 |
+ pr_err("Failed to store in the circular buffer\n"); |
4160 |
+ goto out; |
4161 |
+ } |
4162 |
+ } |
4163 |
+ |
4164 |
+ if (irqs->count != ti->count) { |
4165 |
++ ret = -ERANGE; |
4166 |
+ pr_err("Count differs\n"); |
4167 |
+ goto out; |
4168 |
+ } |
4169 |
+diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c |
4170 |
+index c0c7784f074b2..b02fff28221f0 100644 |
4171 |
+--- a/kernel/locking/mutex.c |
4172 |
++++ b/kernel/locking/mutex.c |
4173 |
+@@ -938,7 +938,6 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, |
4174 |
+ struct ww_acquire_ctx *ww_ctx, const bool use_ww_ctx) |
4175 |
+ { |
4176 |
+ struct mutex_waiter waiter; |
4177 |
+- bool first = false; |
4178 |
+ struct ww_mutex *ww; |
4179 |
+ int ret; |
4180 |
+ |
4181 |
+@@ -1017,6 +1016,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, |
4182 |
+ |
4183 |
+ set_current_state(state); |
4184 |
+ for (;;) { |
4185 |
++ bool first; |
4186 |
++ |
4187 |
+ /* |
4188 |
+ * Once we hold wait_lock, we're serialized against |
4189 |
+ * mutex_unlock() handing the lock off to us, do a trylock |
4190 |
+@@ -1045,15 +1046,9 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, |
4191 |
+ spin_unlock(&lock->wait_lock); |
4192 |
+ schedule_preempt_disabled(); |
4193 |
+ |
4194 |
+- /* |
4195 |
+- * ww_mutex needs to always recheck its position since its waiter |
4196 |
+- * list is not FIFO ordered. |
4197 |
+- */ |
4198 |
+- if (ww_ctx || !first) { |
4199 |
+- first = __mutex_waiter_is_first(lock, &waiter); |
4200 |
+- if (first) |
4201 |
+- __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF); |
4202 |
+- } |
4203 |
++ first = __mutex_waiter_is_first(lock, &waiter); |
4204 |
++ if (first) |
4205 |
++ __mutex_set_flag(lock, MUTEX_FLAG_HANDOFF); |
4206 |
+ |
4207 |
+ set_current_state(state); |
4208 |
+ /* |
4209 |
+diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c |
4210 |
+index 8dac32bd90894..7ef35eb985baf 100644 |
4211 |
+--- a/kernel/power/energy_model.c |
4212 |
++++ b/kernel/power/energy_model.c |
4213 |
+@@ -149,7 +149,9 @@ static struct em_perf_domain *em_create_pd(cpumask_t *span, int nr_states, |
4214 |
+ /* Compute the cost of each capacity_state. */ |
4215 |
+ fmax = (u64) table[nr_states - 1].frequency; |
4216 |
+ for (i = 0; i < nr_states; i++) { |
4217 |
+- table[i].cost = div64_u64(fmax * table[i].power, |
4218 |
++ unsigned long power_res = em_scale_power(table[i].power); |
4219 |
++ |
4220 |
++ table[i].cost = div64_u64(fmax * power_res, |
4221 |
+ table[i].frequency); |
4222 |
+ } |
4223 |
+ |
4224 |
+diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h |
4225 |
+index c0b8c458d8a6a..b8c9744ad595b 100644 |
4226 |
+--- a/kernel/rcu/tree_stall.h |
4227 |
++++ b/kernel/rcu/tree_stall.h |
4228 |
+@@ -7,6 +7,8 @@ |
4229 |
+ * Author: Paul E. McKenney <paulmck@×××××××××.com> |
4230 |
+ */ |
4231 |
+ |
4232 |
++#include <linux/kvm_para.h> |
4233 |
++ |
4234 |
+ ////////////////////////////////////////////////////////////////////////////// |
4235 |
+ // |
4236 |
+ // Controlling CPU stall warnings, including delay calculation. |
4237 |
+@@ -525,6 +527,14 @@ static void check_cpu_stall(struct rcu_data *rdp) |
4238 |
+ (READ_ONCE(rnp->qsmask) & rdp->grpmask) && |
4239 |
+ cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) { |
4240 |
+ |
4241 |
++ /* |
4242 |
++ * If a virtual machine is stopped by the host it can look to |
4243 |
++ * the watchdog like an RCU stall. Check to see if the host |
4244 |
++ * stopped the vm. |
4245 |
++ */ |
4246 |
++ if (kvm_check_and_clear_guest_paused()) |
4247 |
++ return; |
4248 |
++ |
4249 |
+ /* We haven't checked in, so go dump stack. */ |
4250 |
+ print_cpu_stall(); |
4251 |
+ if (rcu_cpu_stall_ftrace_dump) |
4252 |
+@@ -534,6 +544,14 @@ static void check_cpu_stall(struct rcu_data *rdp) |
4253 |
+ ULONG_CMP_GE(j, js + RCU_STALL_RAT_DELAY) && |
4254 |
+ cmpxchg(&rcu_state.jiffies_stall, js, jn) == js) { |
4255 |
+ |
4256 |
++ /* |
4257 |
++ * If a virtual machine is stopped by the host it can look to |
4258 |
++ * the watchdog like an RCU stall. Check to see if the host |
4259 |
++ * stopped the vm. |
4260 |
++ */ |
4261 |
++ if (kvm_check_and_clear_guest_paused()) |
4262 |
++ return; |
4263 |
++ |
4264 |
+ /* They had a few time units to dump stack, so complain. */ |
4265 |
+ print_other_cpu_stall(gs2); |
4266 |
+ if (rcu_cpu_stall_ftrace_dump) |
4267 |
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c |
4268 |
+index 8294debf68c4d..5dc43d37e6a2b 100644 |
4269 |
+--- a/kernel/sched/core.c |
4270 |
++++ b/kernel/sched/core.c |
4271 |
+@@ -1110,6 +1110,23 @@ static inline void uclamp_rq_dec(struct rq *rq, struct task_struct *p) |
4272 |
+ uclamp_rq_dec_id(rq, p, clamp_id); |
4273 |
+ } |
4274 |
+ |
4275 |
++static inline void uclamp_rq_reinc_id(struct rq *rq, struct task_struct *p, |
4276 |
++ enum uclamp_id clamp_id) |
4277 |
++{ |
4278 |
++ if (!p->uclamp[clamp_id].active) |
4279 |
++ return; |
4280 |
++ |
4281 |
++ uclamp_rq_dec_id(rq, p, clamp_id); |
4282 |
++ uclamp_rq_inc_id(rq, p, clamp_id); |
4283 |
++ |
4284 |
++ /* |
4285 |
++ * Make sure to clear the idle flag if we've transiently reached 0 |
4286 |
++ * active tasks on rq. |
4287 |
++ */ |
4288 |
++ if (clamp_id == UCLAMP_MAX && (rq->uclamp_flags & UCLAMP_FLAG_IDLE)) |
4289 |
++ rq->uclamp_flags &= ~UCLAMP_FLAG_IDLE; |
4290 |
++} |
4291 |
++ |
4292 |
+ static inline void |
4293 |
+ uclamp_update_active(struct task_struct *p) |
4294 |
+ { |
4295 |
+@@ -1133,12 +1150,8 @@ uclamp_update_active(struct task_struct *p) |
4296 |
+ * affecting a valid clamp bucket, the next time it's enqueued, |
4297 |
+ * it will already see the updated clamp bucket value. |
4298 |
+ */ |
4299 |
+- for_each_clamp_id(clamp_id) { |
4300 |
+- if (p->uclamp[clamp_id].active) { |
4301 |
+- uclamp_rq_dec_id(rq, p, clamp_id); |
4302 |
+- uclamp_rq_inc_id(rq, p, clamp_id); |
4303 |
+- } |
4304 |
+- } |
4305 |
++ for_each_clamp_id(clamp_id) |
4306 |
++ uclamp_rq_reinc_id(rq, p, clamp_id); |
4307 |
+ |
4308 |
+ task_rq_unlock(rq, p, &rf); |
4309 |
+ } |
4310 |
+diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c |
4311 |
+index 3cf776d5bce8f..2bda9fdba31c4 100644 |
4312 |
+--- a/kernel/sched/deadline.c |
4313 |
++++ b/kernel/sched/deadline.c |
4314 |
+@@ -1654,6 +1654,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused |
4315 |
+ */ |
4316 |
+ raw_spin_lock(&rq->lock); |
4317 |
+ if (p->dl.dl_non_contending) { |
4318 |
++ update_rq_clock(rq); |
4319 |
+ sub_running_bw(&p->dl, &rq->dl); |
4320 |
+ p->dl.dl_non_contending = 0; |
4321 |
+ /* |
4322 |
+@@ -2622,7 +2623,7 @@ void __setparam_dl(struct task_struct *p, const struct sched_attr *attr) |
4323 |
+ dl_se->dl_runtime = attr->sched_runtime; |
4324 |
+ dl_se->dl_deadline = attr->sched_deadline; |
4325 |
+ dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline; |
4326 |
+- dl_se->flags = attr->sched_flags; |
4327 |
++ dl_se->flags = attr->sched_flags & SCHED_DL_FLAGS; |
4328 |
+ dl_se->dl_bw = to_ratio(dl_se->dl_period, dl_se->dl_runtime); |
4329 |
+ dl_se->dl_density = to_ratio(dl_se->dl_deadline, dl_se->dl_runtime); |
4330 |
+ } |
4331 |
+@@ -2635,7 +2636,8 @@ void __getparam_dl(struct task_struct *p, struct sched_attr *attr) |
4332 |
+ attr->sched_runtime = dl_se->dl_runtime; |
4333 |
+ attr->sched_deadline = dl_se->dl_deadline; |
4334 |
+ attr->sched_period = dl_se->dl_period; |
4335 |
+- attr->sched_flags = dl_se->flags; |
4336 |
++ attr->sched_flags &= ~SCHED_DL_FLAGS; |
4337 |
++ attr->sched_flags |= dl_se->flags; |
4338 |
+ } |
4339 |
+ |
4340 |
+ /* |
4341 |
+@@ -2710,7 +2712,7 @@ bool dl_param_changed(struct task_struct *p, const struct sched_attr *attr) |
4342 |
+ if (dl_se->dl_runtime != attr->sched_runtime || |
4343 |
+ dl_se->dl_deadline != attr->sched_deadline || |
4344 |
+ dl_se->dl_period != attr->sched_period || |
4345 |
+- dl_se->flags != attr->sched_flags) |
4346 |
++ dl_se->flags != (attr->sched_flags & SCHED_DL_FLAGS)) |
4347 |
+ return true; |
4348 |
+ |
4349 |
+ return false; |
4350 |
+diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h |
4351 |
+index 4e490e3db2f86..fe755c1a0af95 100644 |
4352 |
+--- a/kernel/sched/sched.h |
4353 |
++++ b/kernel/sched/sched.h |
4354 |
+@@ -209,6 +209,8 @@ static inline int task_has_dl_policy(struct task_struct *p) |
4355 |
+ */ |
4356 |
+ #define SCHED_FLAG_SUGOV 0x10000000 |
4357 |
+ |
4358 |
++#define SCHED_DL_FLAGS (SCHED_FLAG_RECLAIM | SCHED_FLAG_DL_OVERRUN | SCHED_FLAG_SUGOV) |
4359 |
++ |
4360 |
+ static inline bool dl_entity_is_special(struct sched_dl_entity *dl_se) |
4361 |
+ { |
4362 |
+ #ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL |
4363 |
+diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c |
4364 |
+index 1f3e3a17f67e0..e1e8d5dab0c59 100644 |
4365 |
+--- a/kernel/time/hrtimer.c |
4366 |
++++ b/kernel/time/hrtimer.c |
4367 |
+@@ -759,22 +759,6 @@ static void hrtimer_switch_to_hres(void) |
4368 |
+ retrigger_next_event(NULL); |
4369 |
+ } |
4370 |
+ |
4371 |
+-static void clock_was_set_work(struct work_struct *work) |
4372 |
+-{ |
4373 |
+- clock_was_set(); |
4374 |
+-} |
4375 |
+- |
4376 |
+-static DECLARE_WORK(hrtimer_work, clock_was_set_work); |
4377 |
+- |
4378 |
+-/* |
4379 |
+- * Called from timekeeping and resume code to reprogram the hrtimer |
4380 |
+- * interrupt device on all cpus. |
4381 |
+- */ |
4382 |
+-void clock_was_set_delayed(void) |
4383 |
+-{ |
4384 |
+- schedule_work(&hrtimer_work); |
4385 |
+-} |
4386 |
+- |
4387 |
+ #else |
4388 |
+ |
4389 |
+ static inline int hrtimer_is_hres_enabled(void) { return 0; } |
4390 |
+@@ -892,6 +876,22 @@ void clock_was_set(void) |
4391 |
+ timerfd_clock_was_set(); |
4392 |
+ } |
4393 |
+ |
4394 |
++static void clock_was_set_work(struct work_struct *work) |
4395 |
++{ |
4396 |
++ clock_was_set(); |
4397 |
++} |
4398 |
++ |
4399 |
++static DECLARE_WORK(hrtimer_work, clock_was_set_work); |
4400 |
++ |
4401 |
++/* |
4402 |
++ * Called from timekeeping and resume code to reprogram the hrtimer |
4403 |
++ * interrupt device on all cpus and to notify timerfd. |
4404 |
++ */ |
4405 |
++void clock_was_set_delayed(void) |
4406 |
++{ |
4407 |
++ schedule_work(&hrtimer_work); |
4408 |
++} |
4409 |
++ |
4410 |
+ /* |
4411 |
+ * During resume we might have to reprogram the high resolution timer |
4412 |
+ * interrupt on all online CPUs. However, all other CPUs will be |
4413 |
+@@ -1031,12 +1031,13 @@ static void __remove_hrtimer(struct hrtimer *timer, |
4414 |
+ * remove hrtimer, called with base lock held |
4415 |
+ */ |
4416 |
+ static inline int |
4417 |
+-remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool restart) |
4418 |
++remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, |
4419 |
++ bool restart, bool keep_local) |
4420 |
+ { |
4421 |
+ u8 state = timer->state; |
4422 |
+ |
4423 |
+ if (state & HRTIMER_STATE_ENQUEUED) { |
4424 |
+- int reprogram; |
4425 |
++ bool reprogram; |
4426 |
+ |
4427 |
+ /* |
4428 |
+ * Remove the timer and force reprogramming when high |
4429 |
+@@ -1049,8 +1050,16 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_clock_base *base, bool rest |
4430 |
+ debug_deactivate(timer); |
4431 |
+ reprogram = base->cpu_base == this_cpu_ptr(&hrtimer_bases); |
4432 |
+ |
4433 |
++ /* |
4434 |
++ * If the timer is not restarted then reprogramming is |
4435 |
++ * required if the timer is local. If it is local and about |
4436 |
++ * to be restarted, avoid programming it twice (on removal |
4437 |
++ * and a moment later when it's requeued). |
4438 |
++ */ |
4439 |
+ if (!restart) |
4440 |
+ state = HRTIMER_STATE_INACTIVE; |
4441 |
++ else |
4442 |
++ reprogram &= !keep_local; |
4443 |
+ |
4444 |
+ __remove_hrtimer(timer, base, state, reprogram); |
4445 |
+ return 1; |
4446 |
+@@ -1104,9 +1113,31 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
4447 |
+ struct hrtimer_clock_base *base) |
4448 |
+ { |
4449 |
+ struct hrtimer_clock_base *new_base; |
4450 |
++ bool force_local, first; |
4451 |
++ |
4452 |
++ /* |
4453 |
++ * If the timer is on the local cpu base and is the first expiring |
4454 |
++ * timer then this might end up reprogramming the hardware twice |
4455 |
++ * (on removal and on enqueue). To avoid that by prevent the |
4456 |
++ * reprogram on removal, keep the timer local to the current CPU |
4457 |
++ * and enforce reprogramming after it is queued no matter whether |
4458 |
++ * it is the new first expiring timer again or not. |
4459 |
++ */ |
4460 |
++ force_local = base->cpu_base == this_cpu_ptr(&hrtimer_bases); |
4461 |
++ force_local &= base->cpu_base->next_timer == timer; |
4462 |
+ |
4463 |
+- /* Remove an active timer from the queue: */ |
4464 |
+- remove_hrtimer(timer, base, true); |
4465 |
++ /* |
4466 |
++ * Remove an active timer from the queue. In case it is not queued |
4467 |
++ * on the current CPU, make sure that remove_hrtimer() updates the |
4468 |
++ * remote data correctly. |
4469 |
++ * |
4470 |
++ * If it's on the current CPU and the first expiring timer, then |
4471 |
++ * skip reprogramming, keep the timer local and enforce |
4472 |
++ * reprogramming later if it was the first expiring timer. This |
4473 |
++ * avoids programming the underlying clock event twice (once at |
4474 |
++ * removal and once after enqueue). |
4475 |
++ */ |
4476 |
++ remove_hrtimer(timer, base, true, force_local); |
4477 |
+ |
4478 |
+ if (mode & HRTIMER_MODE_REL) |
4479 |
+ tim = ktime_add_safe(tim, base->get_time()); |
4480 |
+@@ -1116,9 +1147,24 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, |
4481 |
+ hrtimer_set_expires_range_ns(timer, tim, delta_ns); |
4482 |
+ |
4483 |
+ /* Switch the timer base, if necessary: */ |
4484 |
+- new_base = switch_hrtimer_base(timer, base, mode & HRTIMER_MODE_PINNED); |
4485 |
++ if (!force_local) { |
4486 |
++ new_base = switch_hrtimer_base(timer, base, |
4487 |
++ mode & HRTIMER_MODE_PINNED); |
4488 |
++ } else { |
4489 |
++ new_base = base; |
4490 |
++ } |
4491 |
++ |
4492 |
++ first = enqueue_hrtimer(timer, new_base, mode); |
4493 |
++ if (!force_local) |
4494 |
++ return first; |
4495 |
+ |
4496 |
+- return enqueue_hrtimer(timer, new_base, mode); |
4497 |
++ /* |
4498 |
++ * Timer was forced to stay on the current CPU to avoid |
4499 |
++ * reprogramming on removal and enqueue. Force reprogram the |
4500 |
++ * hardware by evaluating the new first expiring timer. |
4501 |
++ */ |
4502 |
++ hrtimer_force_reprogram(new_base->cpu_base, 1); |
4503 |
++ return 0; |
4504 |
+ } |
4505 |
+ |
4506 |
+ /** |
4507 |
+@@ -1184,7 +1230,7 @@ int hrtimer_try_to_cancel(struct hrtimer *timer) |
4508 |
+ base = lock_hrtimer_base(timer, &flags); |
4509 |
+ |
4510 |
+ if (!hrtimer_callback_running(timer)) |
4511 |
+- ret = remove_hrtimer(timer, base, false); |
4512 |
++ ret = remove_hrtimer(timer, base, false, false); |
4513 |
+ |
4514 |
+ unlock_hrtimer_base(timer, &flags); |
4515 |
+ |
4516 |
+diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c |
4517 |
+index eacb0ca301932..30e061b210b7c 100644 |
4518 |
+--- a/kernel/time/posix-cpu-timers.c |
4519 |
++++ b/kernel/time/posix-cpu-timers.c |
4520 |
+@@ -1201,8 +1201,6 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid, |
4521 |
+ } |
4522 |
+ } |
4523 |
+ |
4524 |
+- if (!*newval) |
4525 |
+- return; |
4526 |
+ *newval += now; |
4527 |
+ } |
4528 |
+ |
4529 |
+diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h |
4530 |
+index 7b24961367292..5294f5b1f9550 100644 |
4531 |
+--- a/kernel/time/tick-internal.h |
4532 |
++++ b/kernel/time/tick-internal.h |
4533 |
+@@ -165,3 +165,6 @@ DECLARE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases); |
4534 |
+ |
4535 |
+ extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem); |
4536 |
+ void timer_clear_idle(void); |
4537 |
++ |
4538 |
++void clock_was_set(void); |
4539 |
++void clock_was_set_delayed(void); |
4540 |
+diff --git a/lib/mpi/mpiutil.c b/lib/mpi/mpiutil.c |
4541 |
+index 20ed0f7667871..00825028cc847 100644 |
4542 |
+--- a/lib/mpi/mpiutil.c |
4543 |
++++ b/lib/mpi/mpiutil.c |
4544 |
+@@ -91,7 +91,7 @@ int mpi_resize(MPI a, unsigned nlimbs) |
4545 |
+ return 0; /* no need to do it */ |
4546 |
+ |
4547 |
+ if (a->d) { |
4548 |
+- p = kmalloc_array(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL); |
4549 |
++ p = kcalloc(nlimbs, sizeof(mpi_limb_t), GFP_KERNEL); |
4550 |
+ if (!p) |
4551 |
+ return -ENOMEM; |
4552 |
+ memcpy(p, a->d, a->alloced * sizeof(mpi_limb_t)); |
4553 |
+diff --git a/net/6lowpan/debugfs.c b/net/6lowpan/debugfs.c |
4554 |
+index 1c140af06d527..600b9563bfc53 100644 |
4555 |
+--- a/net/6lowpan/debugfs.c |
4556 |
++++ b/net/6lowpan/debugfs.c |
4557 |
+@@ -170,7 +170,8 @@ static void lowpan_dev_debugfs_ctx_init(struct net_device *dev, |
4558 |
+ struct dentry *root; |
4559 |
+ char buf[32]; |
4560 |
+ |
4561 |
+- WARN_ON_ONCE(id > LOWPAN_IPHC_CTX_TABLE_SIZE); |
4562 |
++ if (WARN_ON_ONCE(id >= LOWPAN_IPHC_CTX_TABLE_SIZE)) |
4563 |
++ return; |
4564 |
+ |
4565 |
+ sprintf(buf, "%d", id); |
4566 |
+ |
4567 |
+diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h |
4568 |
+index c32638dddbf94..f6b9dc4e408f2 100644 |
4569 |
+--- a/net/bluetooth/cmtp/cmtp.h |
4570 |
++++ b/net/bluetooth/cmtp/cmtp.h |
4571 |
+@@ -26,7 +26,7 @@ |
4572 |
+ #include <linux/types.h> |
4573 |
+ #include <net/bluetooth/bluetooth.h> |
4574 |
+ |
4575 |
+-#define BTNAMSIZ 18 |
4576 |
++#define BTNAMSIZ 21 |
4577 |
+ |
4578 |
+ /* CMTP ioctl defines */ |
4579 |
+ #define CMTPCONNADD _IOW('C', 200, int) |
4580 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
4581 |
+index 83a07fca9000f..bdd330527cfa2 100644 |
4582 |
+--- a/net/bluetooth/hci_core.c |
4583 |
++++ b/net/bluetooth/hci_core.c |
4584 |
+@@ -1297,6 +1297,12 @@ int hci_inquiry(void __user *arg) |
4585 |
+ goto done; |
4586 |
+ } |
4587 |
+ |
4588 |
++ /* Restrict maximum inquiry length to 60 seconds */ |
4589 |
++ if (ir.length > 60) { |
4590 |
++ err = -EINVAL; |
4591 |
++ goto done; |
4592 |
++ } |
4593 |
++ |
4594 |
+ hci_dev_lock(hdev); |
4595 |
+ if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || |
4596 |
+ inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) { |
4597 |
+@@ -1685,6 +1691,14 @@ int hci_dev_do_close(struct hci_dev *hdev) |
4598 |
+ hci_request_cancel_all(hdev); |
4599 |
+ hci_req_sync_lock(hdev); |
4600 |
+ |
4601 |
++ if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && |
4602 |
++ !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && |
4603 |
++ test_bit(HCI_UP, &hdev->flags)) { |
4604 |
++ /* Execute vendor specific shutdown routine */ |
4605 |
++ if (hdev->shutdown) |
4606 |
++ hdev->shutdown(hdev); |
4607 |
++ } |
4608 |
++ |
4609 |
+ if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { |
4610 |
+ cancel_delayed_work_sync(&hdev->cmd_timer); |
4611 |
+ hci_req_sync_unlock(hdev); |
4612 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
4613 |
+index b91d6b440fdf6..1b7540cb8e5c4 100644 |
4614 |
+--- a/net/bluetooth/sco.c |
4615 |
++++ b/net/bluetooth/sco.c |
4616 |
+@@ -84,7 +84,6 @@ static void sco_sock_timeout(struct timer_list *t) |
4617 |
+ sk->sk_state_change(sk); |
4618 |
+ bh_unlock_sock(sk); |
4619 |
+ |
4620 |
+- sco_sock_kill(sk); |
4621 |
+ sock_put(sk); |
4622 |
+ } |
4623 |
+ |
4624 |
+@@ -176,7 +175,6 @@ static void sco_conn_del(struct hci_conn *hcon, int err) |
4625 |
+ sco_sock_clear_timer(sk); |
4626 |
+ sco_chan_del(sk, err); |
4627 |
+ bh_unlock_sock(sk); |
4628 |
+- sco_sock_kill(sk); |
4629 |
+ sock_put(sk); |
4630 |
+ } |
4631 |
+ |
4632 |
+@@ -393,8 +391,7 @@ static void sco_sock_cleanup_listen(struct sock *parent) |
4633 |
+ */ |
4634 |
+ static void sco_sock_kill(struct sock *sk) |
4635 |
+ { |
4636 |
+- if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket || |
4637 |
+- sock_flag(sk, SOCK_DEAD)) |
4638 |
++ if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket) |
4639 |
+ return; |
4640 |
+ |
4641 |
+ BT_DBG("sk %p state %d", sk, sk->sk_state); |
4642 |
+@@ -446,7 +443,6 @@ static void sco_sock_close(struct sock *sk) |
4643 |
+ lock_sock(sk); |
4644 |
+ __sco_sock_close(sk); |
4645 |
+ release_sock(sk); |
4646 |
+- sco_sock_kill(sk); |
4647 |
+ } |
4648 |
+ |
4649 |
+ static void sco_sock_init(struct sock *sk, struct sock *parent) |
4650 |
+@@ -761,6 +757,11 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting) |
4651 |
+ cp.max_latency = cpu_to_le16(0xffff); |
4652 |
+ cp.retrans_effort = 0xff; |
4653 |
+ break; |
4654 |
++ default: |
4655 |
++ /* use CVSD settings as fallback */ |
4656 |
++ cp.max_latency = cpu_to_le16(0xffff); |
4657 |
++ cp.retrans_effort = 0xff; |
4658 |
++ break; |
4659 |
+ } |
4660 |
+ |
4661 |
+ hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, |
4662 |
+diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c |
4663 |
+index c303873496a34..9bf15512601bf 100644 |
4664 |
+--- a/net/core/net_namespace.c |
4665 |
++++ b/net/core/net_namespace.c |
4666 |
+@@ -211,9 +211,9 @@ static int net_eq_idr(int id, void *net, void *peer) |
4667 |
+ return 0; |
4668 |
+ } |
4669 |
+ |
4670 |
+-/* Should be called with nsid_lock held. If a new id is assigned, the bool alloc |
4671 |
+- * is set to true, thus the caller knows that the new id must be notified via |
4672 |
+- * rtnl. |
4673 |
++/* Must be called from RCU-critical section or with nsid_lock held. If |
4674 |
++ * a new id is assigned, the bool alloc is set to true, thus the |
4675 |
++ * caller knows that the new id must be notified via rtnl. |
4676 |
+ */ |
4677 |
+ static int __peernet2id_alloc(struct net *net, struct net *peer, bool *alloc) |
4678 |
+ { |
4679 |
+@@ -237,7 +237,7 @@ static int __peernet2id_alloc(struct net *net, struct net *peer, bool *alloc) |
4680 |
+ return NETNSA_NSID_NOT_ASSIGNED; |
4681 |
+ } |
4682 |
+ |
4683 |
+-/* should be called with nsid_lock held */ |
4684 |
++/* Must be called from RCU-critical section or with nsid_lock held */ |
4685 |
+ static int __peernet2id(struct net *net, struct net *peer) |
4686 |
+ { |
4687 |
+ bool no = false; |
4688 |
+@@ -281,9 +281,10 @@ int peernet2id(struct net *net, struct net *peer) |
4689 |
+ { |
4690 |
+ int id; |
4691 |
+ |
4692 |
+- spin_lock_bh(&net->nsid_lock); |
4693 |
++ rcu_read_lock(); |
4694 |
+ id = __peernet2id(net, peer); |
4695 |
+- spin_unlock_bh(&net->nsid_lock); |
4696 |
++ rcu_read_unlock(); |
4697 |
++ |
4698 |
+ return id; |
4699 |
+ } |
4700 |
+ EXPORT_SYMBOL(peernet2id); |
4701 |
+@@ -962,6 +963,7 @@ struct rtnl_net_dump_cb { |
4702 |
+ int s_idx; |
4703 |
+ }; |
4704 |
+ |
4705 |
++/* Runs in RCU-critical section. */ |
4706 |
+ static int rtnl_net_dumpid_one(int id, void *peer, void *data) |
4707 |
+ { |
4708 |
+ struct rtnl_net_dump_cb *net_cb = (struct rtnl_net_dump_cb *)data; |
4709 |
+@@ -1046,19 +1048,9 @@ static int rtnl_net_dumpid(struct sk_buff *skb, struct netlink_callback *cb) |
4710 |
+ goto end; |
4711 |
+ } |
4712 |
+ |
4713 |
+- spin_lock_bh(&net_cb.tgt_net->nsid_lock); |
4714 |
+- if (net_cb.fillargs.add_ref && |
4715 |
+- !net_eq(net_cb.ref_net, net_cb.tgt_net) && |
4716 |
+- !spin_trylock_bh(&net_cb.ref_net->nsid_lock)) { |
4717 |
+- spin_unlock_bh(&net_cb.tgt_net->nsid_lock); |
4718 |
+- err = -EAGAIN; |
4719 |
+- goto end; |
4720 |
+- } |
4721 |
++ rcu_read_lock(); |
4722 |
+ idr_for_each(&net_cb.tgt_net->netns_ids, rtnl_net_dumpid_one, &net_cb); |
4723 |
+- if (net_cb.fillargs.add_ref && |
4724 |
+- !net_eq(net_cb.ref_net, net_cb.tgt_net)) |
4725 |
+- spin_unlock_bh(&net_cb.ref_net->nsid_lock); |
4726 |
+- spin_unlock_bh(&net_cb.tgt_net->nsid_lock); |
4727 |
++ rcu_read_unlock(); |
4728 |
+ |
4729 |
+ cb->args[0] = net_cb.idx; |
4730 |
+ end: |
4731 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
4732 |
+index 0e976848d4bb9..539492998864e 100644 |
4733 |
+--- a/net/ipv4/route.c |
4734 |
++++ b/net/ipv4/route.c |
4735 |
+@@ -610,18 +610,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe) |
4736 |
+ } |
4737 |
+ } |
4738 |
+ |
4739 |
+-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash) |
4740 |
++static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash) |
4741 |
+ { |
4742 |
+- struct fib_nh_exception *fnhe, *oldest; |
4743 |
++ struct fib_nh_exception __rcu **fnhe_p, **oldest_p; |
4744 |
++ struct fib_nh_exception *fnhe, *oldest = NULL; |
4745 |
+ |
4746 |
+- oldest = rcu_dereference(hash->chain); |
4747 |
+- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; |
4748 |
+- fnhe = rcu_dereference(fnhe->fnhe_next)) { |
4749 |
+- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) |
4750 |
++ for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) { |
4751 |
++ fnhe = rcu_dereference_protected(*fnhe_p, |
4752 |
++ lockdep_is_held(&fnhe_lock)); |
4753 |
++ if (!fnhe) |
4754 |
++ break; |
4755 |
++ if (!oldest || |
4756 |
++ time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) { |
4757 |
+ oldest = fnhe; |
4758 |
++ oldest_p = fnhe_p; |
4759 |
++ } |
4760 |
+ } |
4761 |
+ fnhe_flush_routes(oldest); |
4762 |
+- return oldest; |
4763 |
++ *oldest_p = oldest->fnhe_next; |
4764 |
++ kfree_rcu(oldest, rcu); |
4765 |
+ } |
4766 |
+ |
4767 |
+ static inline u32 fnhe_hashfun(__be32 daddr) |
4768 |
+@@ -700,16 +707,21 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr, |
4769 |
+ if (rt) |
4770 |
+ fill_route_from_fnhe(rt, fnhe); |
4771 |
+ } else { |
4772 |
+- if (depth > FNHE_RECLAIM_DEPTH) |
4773 |
+- fnhe = fnhe_oldest(hash); |
4774 |
+- else { |
4775 |
+- fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); |
4776 |
+- if (!fnhe) |
4777 |
+- goto out_unlock; |
4778 |
+- |
4779 |
+- fnhe->fnhe_next = hash->chain; |
4780 |
+- rcu_assign_pointer(hash->chain, fnhe); |
4781 |
++ /* Randomize max depth to avoid some side channels attacks. */ |
4782 |
++ int max_depth = FNHE_RECLAIM_DEPTH + |
4783 |
++ prandom_u32_max(FNHE_RECLAIM_DEPTH); |
4784 |
++ |
4785 |
++ while (depth > max_depth) { |
4786 |
++ fnhe_remove_oldest(hash); |
4787 |
++ depth--; |
4788 |
+ } |
4789 |
++ |
4790 |
++ fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); |
4791 |
++ if (!fnhe) |
4792 |
++ goto out_unlock; |
4793 |
++ |
4794 |
++ fnhe->fnhe_next = hash->chain; |
4795 |
++ |
4796 |
+ fnhe->fnhe_genid = genid; |
4797 |
+ fnhe->fnhe_daddr = daddr; |
4798 |
+ fnhe->fnhe_gw = gw; |
4799 |
+@@ -717,6 +729,8 @@ static void update_or_create_fnhe(struct fib_nh_common *nhc, __be32 daddr, |
4800 |
+ fnhe->fnhe_mtu_locked = lock; |
4801 |
+ fnhe->fnhe_expires = max(1UL, expires); |
4802 |
+ |
4803 |
++ rcu_assign_pointer(hash->chain, fnhe); |
4804 |
++ |
4805 |
+ /* Exception created; mark the cached routes for the nexthop |
4806 |
+ * stale, so anyone caching it rechecks if this exception |
4807 |
+ * applies to them. |
4808 |
+@@ -2990,7 +3004,7 @@ static struct sk_buff *inet_rtm_getroute_build_skb(__be32 src, __be32 dst, |
4809 |
+ udph = skb_put_zero(skb, sizeof(struct udphdr)); |
4810 |
+ udph->source = sport; |
4811 |
+ udph->dest = dport; |
4812 |
+- udph->len = sizeof(struct udphdr); |
4813 |
++ udph->len = htons(sizeof(struct udphdr)); |
4814 |
+ udph->check = 0; |
4815 |
+ break; |
4816 |
+ } |
4817 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
4818 |
+index 91788ff19a5d4..2ce85e52aea7c 100644 |
4819 |
+--- a/net/ipv4/tcp_ipv4.c |
4820 |
++++ b/net/ipv4/tcp_ipv4.c |
4821 |
+@@ -2304,6 +2304,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos) |
4822 |
+ static void *tcp_seek_last_pos(struct seq_file *seq) |
4823 |
+ { |
4824 |
+ struct tcp_iter_state *st = seq->private; |
4825 |
++ int bucket = st->bucket; |
4826 |
+ int offset = st->offset; |
4827 |
+ int orig_num = st->num; |
4828 |
+ void *rc = NULL; |
4829 |
+@@ -2314,7 +2315,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq) |
4830 |
+ break; |
4831 |
+ st->state = TCP_SEQ_STATE_LISTENING; |
4832 |
+ rc = listening_get_next(seq, NULL); |
4833 |
+- while (offset-- && rc) |
4834 |
++ while (offset-- && rc && bucket == st->bucket) |
4835 |
+ rc = listening_get_next(seq, rc); |
4836 |
+ if (rc) |
4837 |
+ break; |
4838 |
+@@ -2325,7 +2326,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq) |
4839 |
+ if (st->bucket > tcp_hashinfo.ehash_mask) |
4840 |
+ break; |
4841 |
+ rc = established_get_first(seq); |
4842 |
+- while (offset-- && rc) |
4843 |
++ while (offset-- && rc && bucket == st->bucket) |
4844 |
+ rc = established_get_next(seq, rc); |
4845 |
+ } |
4846 |
+ |
4847 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
4848 |
+index d6fc22f7d7a67..575bd0f1b0089 100644 |
4849 |
+--- a/net/ipv6/route.c |
4850 |
++++ b/net/ipv6/route.c |
4851 |
+@@ -1667,6 +1667,7 @@ static int rt6_insert_exception(struct rt6_info *nrt, |
4852 |
+ struct in6_addr *src_key = NULL; |
4853 |
+ struct rt6_exception *rt6_ex; |
4854 |
+ struct fib6_nh *nh = res->nh; |
4855 |
++ int max_depth; |
4856 |
+ int err = 0; |
4857 |
+ |
4858 |
+ spin_lock_bh(&rt6_exception_lock); |
4859 |
+@@ -1721,7 +1722,9 @@ static int rt6_insert_exception(struct rt6_info *nrt, |
4860 |
+ bucket->depth++; |
4861 |
+ net->ipv6.rt6_stats->fib_rt_cache++; |
4862 |
+ |
4863 |
+- if (bucket->depth > FIB6_MAX_DEPTH) |
4864 |
++ /* Randomize max depth to avoid some side channels attacks. */ |
4865 |
++ max_depth = FIB6_MAX_DEPTH + prandom_u32_max(FIB6_MAX_DEPTH); |
4866 |
++ while (bucket->depth > max_depth) |
4867 |
+ rt6_exception_remove_oldest(bucket); |
4868 |
+ |
4869 |
+ out: |
4870 |
+diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c |
4871 |
+index 538722522ffe9..4dfac7a25e5ad 100644 |
4872 |
+--- a/net/mac80211/tx.c |
4873 |
++++ b/net/mac80211/tx.c |
4874 |
+@@ -3189,7 +3189,9 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata, |
4875 |
+ if (info->control.flags & IEEE80211_TX_CTRL_AMSDU) |
4876 |
+ return true; |
4877 |
+ |
4878 |
+- if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr))) |
4879 |
++ if (!ieee80211_amsdu_realloc_pad(local, skb, |
4880 |
++ sizeof(*amsdu_hdr) + |
4881 |
++ local->hw.extra_tx_headroom)) |
4882 |
+ return false; |
4883 |
+ |
4884 |
+ data = skb_push(skb, sizeof(*amsdu_hdr)); |
4885 |
+diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c |
4886 |
+index 4cb43a2c07d14..8cd3daf0e3db6 100644 |
4887 |
+--- a/net/netlabel/netlabel_cipso_v4.c |
4888 |
++++ b/net/netlabel/netlabel_cipso_v4.c |
4889 |
+@@ -187,14 +187,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4890 |
+ } |
4891 |
+ doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size, |
4892 |
+ sizeof(u32), |
4893 |
+- GFP_KERNEL); |
4894 |
++ GFP_KERNEL | __GFP_NOWARN); |
4895 |
+ if (doi_def->map.std->lvl.local == NULL) { |
4896 |
+ ret_val = -ENOMEM; |
4897 |
+ goto add_std_failure; |
4898 |
+ } |
4899 |
+ doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size, |
4900 |
+ sizeof(u32), |
4901 |
+- GFP_KERNEL); |
4902 |
++ GFP_KERNEL | __GFP_NOWARN); |
4903 |
+ if (doi_def->map.std->lvl.cipso == NULL) { |
4904 |
+ ret_val = -ENOMEM; |
4905 |
+ goto add_std_failure; |
4906 |
+@@ -263,7 +263,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4907 |
+ doi_def->map.std->cat.local = kcalloc( |
4908 |
+ doi_def->map.std->cat.local_size, |
4909 |
+ sizeof(u32), |
4910 |
+- GFP_KERNEL); |
4911 |
++ GFP_KERNEL | __GFP_NOWARN); |
4912 |
+ if (doi_def->map.std->cat.local == NULL) { |
4913 |
+ ret_val = -ENOMEM; |
4914 |
+ goto add_std_failure; |
4915 |
+@@ -271,7 +271,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4916 |
+ doi_def->map.std->cat.cipso = kcalloc( |
4917 |
+ doi_def->map.std->cat.cipso_size, |
4918 |
+ sizeof(u32), |
4919 |
+- GFP_KERNEL); |
4920 |
++ GFP_KERNEL | __GFP_NOWARN); |
4921 |
+ if (doi_def->map.std->cat.cipso == NULL) { |
4922 |
+ ret_val = -ENOMEM; |
4923 |
+ goto add_std_failure; |
4924 |
+diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c |
4925 |
+index 39b427dc75128..e5972889cd81c 100644 |
4926 |
+--- a/net/sched/sch_cbq.c |
4927 |
++++ b/net/sched/sch_cbq.c |
4928 |
+@@ -1614,7 +1614,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t |
4929 |
+ err = tcf_block_get(&cl->block, &cl->filter_list, sch, extack); |
4930 |
+ if (err) { |
4931 |
+ kfree(cl); |
4932 |
+- return err; |
4933 |
++ goto failure; |
4934 |
+ } |
4935 |
+ |
4936 |
+ if (tca[TCA_RATE]) { |
4937 |
+diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig |
4938 |
+index d2054bec49094..748f3ee27b23d 100644 |
4939 |
+--- a/security/integrity/ima/Kconfig |
4940 |
++++ b/security/integrity/ima/Kconfig |
4941 |
+@@ -6,7 +6,6 @@ config IMA |
4942 |
+ select SECURITYFS |
4943 |
+ select CRYPTO |
4944 |
+ select CRYPTO_HMAC |
4945 |
+- select CRYPTO_MD5 |
4946 |
+ select CRYPTO_SHA1 |
4947 |
+ select CRYPTO_HASH_INFO |
4948 |
+ select TCG_TPM if HAS_IOMEM && !UML |
4949 |
+diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c |
4950 |
+index 1e5c019161738..95cc31525c573 100644 |
4951 |
+--- a/security/integrity/ima/ima_mok.c |
4952 |
++++ b/security/integrity/ima/ima_mok.c |
4953 |
+@@ -21,7 +21,7 @@ struct key *ima_blacklist_keyring; |
4954 |
+ /* |
4955 |
+ * Allocate the IMA blacklist keyring |
4956 |
+ */ |
4957 |
+-__init int ima_mok_init(void) |
4958 |
++static __init int ima_mok_init(void) |
4959 |
+ { |
4960 |
+ struct key_restriction *restriction; |
4961 |
+ |
4962 |
+diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c |
4963 |
+index 81906c25e4a87..016aff97e2fb2 100644 |
4964 |
+--- a/sound/soc/codecs/wcd9335.c |
4965 |
++++ b/sound/soc/codecs/wcd9335.c |
4966 |
+@@ -4076,6 +4076,16 @@ static int wcd9335_setup_irqs(struct wcd9335_codec *wcd) |
4967 |
+ return ret; |
4968 |
+ } |
4969 |
+ |
4970 |
++static void wcd9335_teardown_irqs(struct wcd9335_codec *wcd) |
4971 |
++{ |
4972 |
++ int i; |
4973 |
++ |
4974 |
++ /* disable interrupts on all slave ports */ |
4975 |
++ for (i = 0; i < WCD9335_SLIM_NUM_PORT_REG; i++) |
4976 |
++ regmap_write(wcd->if_regmap, WCD9335_SLIM_PGD_PORT_INT_EN0 + i, |
4977 |
++ 0x00); |
4978 |
++} |
4979 |
++ |
4980 |
+ static void wcd9335_cdc_sido_ccl_enable(struct wcd9335_codec *wcd, |
4981 |
+ bool ccl_flag) |
4982 |
+ { |
4983 |
+@@ -4844,6 +4854,7 @@ static void wcd9335_codec_init(struct snd_soc_component *component) |
4984 |
+ static int wcd9335_codec_probe(struct snd_soc_component *component) |
4985 |
+ { |
4986 |
+ struct wcd9335_codec *wcd = dev_get_drvdata(component->dev); |
4987 |
++ int ret; |
4988 |
+ int i; |
4989 |
+ |
4990 |
+ snd_soc_component_init_regmap(component, wcd->regmap); |
4991 |
+@@ -4861,7 +4872,15 @@ static int wcd9335_codec_probe(struct snd_soc_component *component) |
4992 |
+ for (i = 0; i < NUM_CODEC_DAIS; i++) |
4993 |
+ INIT_LIST_HEAD(&wcd->dai[i].slim_ch_list); |
4994 |
+ |
4995 |
+- return wcd9335_setup_irqs(wcd); |
4996 |
++ ret = wcd9335_setup_irqs(wcd); |
4997 |
++ if (ret) |
4998 |
++ goto free_clsh_ctrl; |
4999 |
++ |
5000 |
++ return 0; |
5001 |
++ |
5002 |
++free_clsh_ctrl: |
5003 |
++ wcd_clsh_ctrl_free(wcd->clsh_ctrl); |
5004 |
++ return ret; |
5005 |
+ } |
5006 |
+ |
5007 |
+ static void wcd9335_codec_remove(struct snd_soc_component *comp) |
5008 |
+@@ -4869,7 +4888,7 @@ static void wcd9335_codec_remove(struct snd_soc_component *comp) |
5009 |
+ struct wcd9335_codec *wcd = dev_get_drvdata(comp->dev); |
5010 |
+ |
5011 |
+ wcd_clsh_ctrl_free(wcd->clsh_ctrl); |
5012 |
+- free_irq(regmap_irq_get_virq(wcd->irq_data, WCD9335_IRQ_SLIMBUS), wcd); |
5013 |
++ wcd9335_teardown_irqs(wcd); |
5014 |
+ } |
5015 |
+ |
5016 |
+ static int wcd9335_codec_set_sysclk(struct snd_soc_component *comp, |
5017 |
+diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c |
5018 |
+index 1940b17f27efa..254b796e635d1 100644 |
5019 |
+--- a/sound/soc/intel/skylake/skl-topology.c |
5020 |
++++ b/sound/soc/intel/skylake/skl-topology.c |
5021 |
+@@ -113,7 +113,7 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w, |
5022 |
+ |
5023 |
+ static void skl_dump_mconfig(struct skl_dev *skl, struct skl_module_cfg *mcfg) |
5024 |
+ { |
5025 |
+- struct skl_module_iface *iface = &mcfg->module->formats[0]; |
5026 |
++ struct skl_module_iface *iface = &mcfg->module->formats[mcfg->fmt_idx]; |
5027 |
+ |
5028 |
+ dev_dbg(skl->dev, "Dumping config\n"); |
5029 |
+ dev_dbg(skl->dev, "Input Format:\n"); |
5030 |
+@@ -195,8 +195,8 @@ static void skl_tplg_update_params_fixup(struct skl_module_cfg *m_cfg, |
5031 |
+ struct skl_module_fmt *in_fmt, *out_fmt; |
5032 |
+ |
5033 |
+ /* Fixups will be applied to pin 0 only */ |
5034 |
+- in_fmt = &m_cfg->module->formats[0].inputs[0].fmt; |
5035 |
+- out_fmt = &m_cfg->module->formats[0].outputs[0].fmt; |
5036 |
++ in_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].inputs[0].fmt; |
5037 |
++ out_fmt = &m_cfg->module->formats[m_cfg->fmt_idx].outputs[0].fmt; |
5038 |
+ |
5039 |
+ if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
5040 |
+ if (is_fe) { |
5041 |
+@@ -239,9 +239,9 @@ static void skl_tplg_update_buffer_size(struct skl_dev *skl, |
5042 |
+ /* Since fixups is applied to pin 0 only, ibs, obs needs |
5043 |
+ * change for pin 0 only |
5044 |
+ */ |
5045 |
+- res = &mcfg->module->resources[0]; |
5046 |
+- in_fmt = &mcfg->module->formats[0].inputs[0].fmt; |
5047 |
+- out_fmt = &mcfg->module->formats[0].outputs[0].fmt; |
5048 |
++ res = &mcfg->module->resources[mcfg->res_idx]; |
5049 |
++ in_fmt = &mcfg->module->formats[mcfg->fmt_idx].inputs[0].fmt; |
5050 |
++ out_fmt = &mcfg->module->formats[mcfg->fmt_idx].outputs[0].fmt; |
5051 |
+ |
5052 |
+ if (mcfg->m_type == SKL_MODULE_TYPE_SRCINT) |
5053 |
+ multiplier = 5; |
5054 |
+@@ -1463,12 +1463,6 @@ static int skl_tplg_tlv_control_set(struct snd_kcontrol *kcontrol, |
5055 |
+ struct skl_dev *skl = get_skl_ctx(w->dapm->dev); |
5056 |
+ |
5057 |
+ if (ac->params) { |
5058 |
+- /* |
5059 |
+- * Widget data is expected to be stripped of T and L |
5060 |
+- */ |
5061 |
+- size -= 2 * sizeof(unsigned int); |
5062 |
+- data += 2; |
5063 |
+- |
5064 |
+ if (size > ac->max) |
5065 |
+ return -EINVAL; |
5066 |
+ ac->size = size; |
5067 |
+@@ -1637,11 +1631,12 @@ int skl_tplg_update_pipe_params(struct device *dev, |
5068 |
+ struct skl_module_cfg *mconfig, |
5069 |
+ struct skl_pipe_params *params) |
5070 |
+ { |
5071 |
+- struct skl_module_res *res = &mconfig->module->resources[0]; |
5072 |
++ struct skl_module_res *res; |
5073 |
+ struct skl_dev *skl = get_skl_ctx(dev); |
5074 |
+ struct skl_module_fmt *format = NULL; |
5075 |
+ u8 cfg_idx = mconfig->pipe->cur_config_idx; |
5076 |
+ |
5077 |
++ res = &mconfig->module->resources[mconfig->res_idx]; |
5078 |
+ skl_tplg_fill_dma_id(mconfig, params); |
5079 |
+ mconfig->fmt_idx = mconfig->mod_cfg[cfg_idx].fmt_idx; |
5080 |
+ mconfig->res_idx = mconfig->mod_cfg[cfg_idx].res_idx; |
5081 |
+@@ -1650,9 +1645,9 @@ int skl_tplg_update_pipe_params(struct device *dev, |
5082 |
+ return 0; |
5083 |
+ |
5084 |
+ if (params->stream == SNDRV_PCM_STREAM_PLAYBACK) |
5085 |
+- format = &mconfig->module->formats[0].inputs[0].fmt; |
5086 |
++ format = &mconfig->module->formats[mconfig->fmt_idx].inputs[0].fmt; |
5087 |
+ else |
5088 |
+- format = &mconfig->module->formats[0].outputs[0].fmt; |
5089 |
++ format = &mconfig->module->formats[mconfig->fmt_idx].outputs[0].fmt; |
5090 |
+ |
5091 |
+ /* set the hw_params */ |
5092 |
+ format->s_freq = params->s_freq; |
5093 |
+diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h |
5094 |
+index 8649422e760cc..63038eb23560b 100644 |
5095 |
+--- a/tools/include/uapi/linux/bpf.h |
5096 |
++++ b/tools/include/uapi/linux/bpf.h |
5097 |
+@@ -2264,7 +2264,7 @@ union bpf_attr { |
5098 |
+ * int bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags) |
5099 |
+ * Description |
5100 |
+ * Select a **SO_REUSEPORT** socket from a |
5101 |
+- * **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*. |
5102 |
++ * **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*. |
5103 |
+ * It checks the selected socket is matching the incoming |
5104 |
+ * request in the socket buffer. |
5105 |
+ * Return |