1 |
commit: e865be67acbccf8ac9a66c3fb1e8f50a2268c171 |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 23 12:37:21 2022 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 23 12:37:21 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e865be67 |
7 |
|
8 |
Linux patch 5.10.102 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1101_linux-5.10.102.patch | 4328 +++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4332 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 25df2085..3438f96a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -447,6 +447,10 @@ Patch: 1100_linux-5.10.101.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 5.10.101 |
23 |
|
24 |
+Patch: 1101_linux-5.10.102.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 5.10.102 |
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/1101_linux-5.10.102.patch b/1101_linux-5.10.102.patch |
33 |
new file mode 100644 |
34 |
index 00000000..f176b43c |
35 |
--- /dev/null |
36 |
+++ b/1101_linux-5.10.102.patch |
37 |
@@ -0,0 +1,4328 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 32d9ed44e1c47..f71684d435e5a 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 5 |
45 |
+ PATCHLEVEL = 10 |
46 |
+-SUBLEVEL = 101 |
47 |
++SUBLEVEL = 102 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Dare mighty things |
50 |
+ |
51 |
+diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c |
52 |
+index 2000fca6bd4e6..6098666e928d0 100644 |
53 |
+--- a/arch/arm/mach-omap2/display.c |
54 |
++++ b/arch/arm/mach-omap2/display.c |
55 |
+@@ -263,9 +263,9 @@ static int __init omapdss_init_of(void) |
56 |
+ } |
57 |
+ |
58 |
+ r = of_platform_populate(node, NULL, NULL, &pdev->dev); |
59 |
++ put_device(&pdev->dev); |
60 |
+ if (r) { |
61 |
+ pr_err("Unable to populate DSS submodule devices\n"); |
62 |
+- put_device(&pdev->dev); |
63 |
+ return r; |
64 |
+ } |
65 |
+ |
66 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c |
67 |
+index 9443f129859b2..1fd67abca055b 100644 |
68 |
+--- a/arch/arm/mach-omap2/omap_hwmod.c |
69 |
++++ b/arch/arm/mach-omap2/omap_hwmod.c |
70 |
+@@ -749,8 +749,10 @@ static int __init _init_clkctrl_providers(void) |
71 |
+ |
72 |
+ for_each_matching_node(np, ti_clkctrl_match_table) { |
73 |
+ ret = _setup_clkctrl_provider(np); |
74 |
+- if (ret) |
75 |
++ if (ret) { |
76 |
++ of_node_put(np); |
77 |
+ break; |
78 |
++ } |
79 |
+ } |
80 |
+ |
81 |
+ return ret; |
82 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi |
83 |
+index 7342c8a2b322d..075153a4d49fc 100644 |
84 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi |
85 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi |
86 |
+@@ -101,6 +101,12 @@ |
87 |
+ no-map; |
88 |
+ }; |
89 |
+ |
90 |
++ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */ |
91 |
++ secmon_reserved_bl32: secmon@5300000 { |
92 |
++ reg = <0x0 0x05300000 0x0 0x2000000>; |
93 |
++ no-map; |
94 |
++ }; |
95 |
++ |
96 |
+ linux,cma { |
97 |
+ compatible = "shared-dma-pool"; |
98 |
+ reusable; |
99 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts |
100 |
+index 4d5b3e514b514..71f91e31c1818 100644 |
101 |
+--- a/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts |
102 |
++++ b/arch/arm64/boot/dts/amlogic/meson-g12a-sei510.dts |
103 |
+@@ -157,14 +157,6 @@ |
104 |
+ regulator-always-on; |
105 |
+ }; |
106 |
+ |
107 |
+- reserved-memory { |
108 |
+- /* TEE Reserved Memory */ |
109 |
+- bl32_reserved: bl32@5000000 { |
110 |
+- reg = <0x0 0x05300000 0x0 0x2000000>; |
111 |
+- no-map; |
112 |
+- }; |
113 |
+- }; |
114 |
+- |
115 |
+ sdio_pwrseq: sdio-pwrseq { |
116 |
+ compatible = "mmc-pwrseq-simple"; |
117 |
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; |
118 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
119 |
+index 0edd137151f89..47cbb0a1eb183 100644 |
120 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
121 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gx.dtsi |
122 |
+@@ -43,6 +43,12 @@ |
123 |
+ no-map; |
124 |
+ }; |
125 |
+ |
126 |
++ /* 32 MiB reserved for ARM Trusted Firmware (BL32) */ |
127 |
++ secmon_reserved_bl32: secmon@5300000 { |
128 |
++ reg = <0x0 0x05300000 0x0 0x2000000>; |
129 |
++ no-map; |
130 |
++ }; |
131 |
++ |
132 |
+ linux,cma { |
133 |
+ compatible = "shared-dma-pool"; |
134 |
+ reusable; |
135 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
136 |
+index 5ab139a34c018..c21178e9c6064 100644 |
137 |
+--- a/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
138 |
++++ b/arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts |
139 |
+@@ -203,14 +203,6 @@ |
140 |
+ regulator-always-on; |
141 |
+ }; |
142 |
+ |
143 |
+- reserved-memory { |
144 |
+- /* TEE Reserved Memory */ |
145 |
+- bl32_reserved: bl32@5000000 { |
146 |
+- reg = <0x0 0x05300000 0x0 0x2000000>; |
147 |
+- no-map; |
148 |
+- }; |
149 |
+- }; |
150 |
+- |
151 |
+ sdio_pwrseq: sdio-pwrseq { |
152 |
+ compatible = "mmc-pwrseq-simple"; |
153 |
+ reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; |
154 |
+diff --git a/arch/parisc/lib/iomap.c b/arch/parisc/lib/iomap.c |
155 |
+index f03adb1999e77..e362d6a147311 100644 |
156 |
+--- a/arch/parisc/lib/iomap.c |
157 |
++++ b/arch/parisc/lib/iomap.c |
158 |
+@@ -346,6 +346,16 @@ u64 ioread64be(const void __iomem *addr) |
159 |
+ return *((u64 *)addr); |
160 |
+ } |
161 |
+ |
162 |
++u64 ioread64_lo_hi(const void __iomem *addr) |
163 |
++{ |
164 |
++ u32 low, high; |
165 |
++ |
166 |
++ low = ioread32(addr); |
167 |
++ high = ioread32(addr + sizeof(u32)); |
168 |
++ |
169 |
++ return low + ((u64)high << 32); |
170 |
++} |
171 |
++ |
172 |
+ u64 ioread64_hi_lo(const void __iomem *addr) |
173 |
+ { |
174 |
+ u32 low, high; |
175 |
+@@ -419,6 +429,12 @@ void iowrite64be(u64 datum, void __iomem *addr) |
176 |
+ } |
177 |
+ } |
178 |
+ |
179 |
++void iowrite64_lo_hi(u64 val, void __iomem *addr) |
180 |
++{ |
181 |
++ iowrite32(val, addr); |
182 |
++ iowrite32(val >> 32, addr + sizeof(u32)); |
183 |
++} |
184 |
++ |
185 |
+ void iowrite64_hi_lo(u64 val, void __iomem *addr) |
186 |
+ { |
187 |
+ iowrite32(val >> 32, addr + sizeof(u32)); |
188 |
+@@ -527,6 +543,7 @@ EXPORT_SYMBOL(ioread32); |
189 |
+ EXPORT_SYMBOL(ioread32be); |
190 |
+ EXPORT_SYMBOL(ioread64); |
191 |
+ EXPORT_SYMBOL(ioread64be); |
192 |
++EXPORT_SYMBOL(ioread64_lo_hi); |
193 |
+ EXPORT_SYMBOL(ioread64_hi_lo); |
194 |
+ EXPORT_SYMBOL(iowrite8); |
195 |
+ EXPORT_SYMBOL(iowrite16); |
196 |
+@@ -535,6 +552,7 @@ EXPORT_SYMBOL(iowrite32); |
197 |
+ EXPORT_SYMBOL(iowrite32be); |
198 |
+ EXPORT_SYMBOL(iowrite64); |
199 |
+ EXPORT_SYMBOL(iowrite64be); |
200 |
++EXPORT_SYMBOL(iowrite64_lo_hi); |
201 |
+ EXPORT_SYMBOL(iowrite64_hi_lo); |
202 |
+ EXPORT_SYMBOL(ioread8_rep); |
203 |
+ EXPORT_SYMBOL(ioread16_rep); |
204 |
+diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c |
205 |
+index 8f10cc6ee0fce..319afa00cdf7b 100644 |
206 |
+--- a/arch/parisc/mm/init.c |
207 |
++++ b/arch/parisc/mm/init.c |
208 |
+@@ -346,9 +346,9 @@ static void __init setup_bootmem(void) |
209 |
+ |
210 |
+ static bool kernel_set_to_readonly; |
211 |
+ |
212 |
+-static void __init map_pages(unsigned long start_vaddr, |
213 |
+- unsigned long start_paddr, unsigned long size, |
214 |
+- pgprot_t pgprot, int force) |
215 |
++static void __ref map_pages(unsigned long start_vaddr, |
216 |
++ unsigned long start_paddr, unsigned long size, |
217 |
++ pgprot_t pgprot, int force) |
218 |
+ { |
219 |
+ pmd_t *pmd; |
220 |
+ pte_t *pg_table; |
221 |
+@@ -458,7 +458,7 @@ void __init set_kernel_text_rw(int enable_read_write) |
222 |
+ flush_tlb_all(); |
223 |
+ } |
224 |
+ |
225 |
+-void __ref free_initmem(void) |
226 |
++void free_initmem(void) |
227 |
+ { |
228 |
+ unsigned long init_begin = (unsigned long)__init_begin; |
229 |
+ unsigned long init_end = (unsigned long)__init_end; |
230 |
+@@ -472,7 +472,6 @@ void __ref free_initmem(void) |
231 |
+ /* The init text pages are marked R-X. We have to |
232 |
+ * flush the icache and mark them RW- |
233 |
+ * |
234 |
+- * This is tricky, because map_pages is in the init section. |
235 |
+ * Do a dummy remap of the data section first (the data |
236 |
+ * section is already PAGE_KERNEL) to pull in the TLB entries |
237 |
+ * for map_kernel */ |
238 |
+diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c |
239 |
+index a2e067f68dee8..0edebbbffcdca 100644 |
240 |
+--- a/arch/powerpc/lib/sstep.c |
241 |
++++ b/arch/powerpc/lib/sstep.c |
242 |
+@@ -3062,12 +3062,14 @@ void emulate_update_regs(struct pt_regs *regs, struct instruction_op *op) |
243 |
+ case BARRIER_EIEIO: |
244 |
+ eieio(); |
245 |
+ break; |
246 |
++#ifdef CONFIG_PPC64 |
247 |
+ case BARRIER_LWSYNC: |
248 |
+ asm volatile("lwsync" : : : "memory"); |
249 |
+ break; |
250 |
+ case BARRIER_PTESYNC: |
251 |
+ asm volatile("ptesync" : : : "memory"); |
252 |
+ break; |
253 |
++#endif |
254 |
+ } |
255 |
+ break; |
256 |
+ |
257 |
+diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c |
258 |
+index 67741d2a03085..2f83b5d948b33 100644 |
259 |
+--- a/arch/x86/kvm/pmu.c |
260 |
++++ b/arch/x86/kvm/pmu.c |
261 |
+@@ -95,7 +95,7 @@ static void kvm_perf_overflow_intr(struct perf_event *perf_event, |
262 |
+ } |
263 |
+ |
264 |
+ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, |
265 |
+- unsigned config, bool exclude_user, |
266 |
++ u64 config, bool exclude_user, |
267 |
+ bool exclude_kernel, bool intr, |
268 |
+ bool in_tx, bool in_tx_cp) |
269 |
+ { |
270 |
+@@ -170,8 +170,8 @@ static bool pmc_resume_counter(struct kvm_pmc *pmc) |
271 |
+ |
272 |
+ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) |
273 |
+ { |
274 |
+- unsigned config, type = PERF_TYPE_RAW; |
275 |
+- u8 event_select, unit_mask; |
276 |
++ u64 config; |
277 |
++ u32 type = PERF_TYPE_RAW; |
278 |
+ struct kvm *kvm = pmc->vcpu->kvm; |
279 |
+ struct kvm_pmu_event_filter *filter; |
280 |
+ int i; |
281 |
+@@ -203,23 +203,18 @@ void reprogram_gp_counter(struct kvm_pmc *pmc, u64 eventsel) |
282 |
+ if (!allow_event) |
283 |
+ return; |
284 |
+ |
285 |
+- event_select = eventsel & ARCH_PERFMON_EVENTSEL_EVENT; |
286 |
+- unit_mask = (eventsel & ARCH_PERFMON_EVENTSEL_UMASK) >> 8; |
287 |
+- |
288 |
+ if (!(eventsel & (ARCH_PERFMON_EVENTSEL_EDGE | |
289 |
+ ARCH_PERFMON_EVENTSEL_INV | |
290 |
+ ARCH_PERFMON_EVENTSEL_CMASK | |
291 |
+ HSW_IN_TX | |
292 |
+ HSW_IN_TX_CHECKPOINTED))) { |
293 |
+- config = kvm_x86_ops.pmu_ops->find_arch_event(pmc_to_pmu(pmc), |
294 |
+- event_select, |
295 |
+- unit_mask); |
296 |
++ config = kvm_x86_ops.pmu_ops->pmc_perf_hw_id(pmc); |
297 |
+ if (config != PERF_COUNT_HW_MAX) |
298 |
+ type = PERF_TYPE_HARDWARE; |
299 |
+ } |
300 |
+ |
301 |
+ if (type == PERF_TYPE_RAW) |
302 |
+- config = eventsel & X86_RAW_EVENT_MASK; |
303 |
++ config = eventsel & AMD64_RAW_EVENT_MASK; |
304 |
+ |
305 |
+ if (pmc->current_config == eventsel && pmc_resume_counter(pmc)) |
306 |
+ return; |
307 |
+diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h |
308 |
+index 067fef51760c4..1a44e29e73330 100644 |
309 |
+--- a/arch/x86/kvm/pmu.h |
310 |
++++ b/arch/x86/kvm/pmu.h |
311 |
+@@ -24,8 +24,7 @@ struct kvm_event_hw_type_mapping { |
312 |
+ }; |
313 |
+ |
314 |
+ struct kvm_pmu_ops { |
315 |
+- unsigned (*find_arch_event)(struct kvm_pmu *pmu, u8 event_select, |
316 |
+- u8 unit_mask); |
317 |
++ unsigned int (*pmc_perf_hw_id)(struct kvm_pmc *pmc); |
318 |
+ unsigned (*find_fixed_event)(int idx); |
319 |
+ bool (*pmc_is_enabled)(struct kvm_pmc *pmc); |
320 |
+ struct kvm_pmc *(*pmc_idx_to_pmc)(struct kvm_pmu *pmu, int pmc_idx); |
321 |
+diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c |
322 |
+index 8c550999ace0c..a8b5533cf601d 100644 |
323 |
+--- a/arch/x86/kvm/svm/avic.c |
324 |
++++ b/arch/x86/kvm/svm/avic.c |
325 |
+@@ -344,8 +344,6 @@ int avic_incomplete_ipi_interception(struct vcpu_svm *svm) |
326 |
+ break; |
327 |
+ } |
328 |
+ case AVIC_IPI_FAILURE_INVALID_TARGET: |
329 |
+- WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n", |
330 |
+- index, svm->vcpu.vcpu_id, icrh, icrl); |
331 |
+ break; |
332 |
+ case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: |
333 |
+ WARN_ONCE(1, "Invalid backing page\n"); |
334 |
+diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c |
335 |
+index 5a5c165a30ed1..4e7093bcb64b6 100644 |
336 |
+--- a/arch/x86/kvm/svm/pmu.c |
337 |
++++ b/arch/x86/kvm/svm/pmu.c |
338 |
+@@ -126,10 +126,10 @@ static inline struct kvm_pmc *get_gp_pmc_amd(struct kvm_pmu *pmu, u32 msr, |
339 |
+ return &pmu->gp_counters[msr_to_index(msr)]; |
340 |
+ } |
341 |
+ |
342 |
+-static unsigned amd_find_arch_event(struct kvm_pmu *pmu, |
343 |
+- u8 event_select, |
344 |
+- u8 unit_mask) |
345 |
++static unsigned int amd_pmc_perf_hw_id(struct kvm_pmc *pmc) |
346 |
+ { |
347 |
++ u8 event_select = pmc->eventsel & ARCH_PERFMON_EVENTSEL_EVENT; |
348 |
++ u8 unit_mask = (pmc->eventsel & ARCH_PERFMON_EVENTSEL_UMASK) >> 8; |
349 |
+ int i; |
350 |
+ |
351 |
+ for (i = 0; i < ARRAY_SIZE(amd_event_mapping); i++) |
352 |
+@@ -312,7 +312,7 @@ static void amd_pmu_reset(struct kvm_vcpu *vcpu) |
353 |
+ } |
354 |
+ |
355 |
+ struct kvm_pmu_ops amd_pmu_ops = { |
356 |
+- .find_arch_event = amd_find_arch_event, |
357 |
++ .pmc_perf_hw_id = amd_pmc_perf_hw_id, |
358 |
+ .find_fixed_event = amd_find_fixed_event, |
359 |
+ .pmc_is_enabled = amd_pmc_is_enabled, |
360 |
+ .pmc_idx_to_pmc = amd_pmc_idx_to_pmc, |
361 |
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c |
362 |
+index d515c8e68314c..7773a765f5489 100644 |
363 |
+--- a/arch/x86/kvm/svm/svm.c |
364 |
++++ b/arch/x86/kvm/svm/svm.c |
365 |
+@@ -4103,6 +4103,10 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i |
366 |
+ bool smep, smap, is_user; |
367 |
+ unsigned long cr4; |
368 |
+ |
369 |
++ /* Emulation is always possible when KVM has access to all guest state. */ |
370 |
++ if (!sev_guest(vcpu->kvm)) |
371 |
++ return true; |
372 |
++ |
373 |
+ /* |
374 |
+ * Detect and workaround Errata 1096 Fam_17h_00_0Fh. |
375 |
+ * |
376 |
+@@ -4151,9 +4155,6 @@ static bool svm_can_emulate_instruction(struct kvm_vcpu *vcpu, void *insn, int i |
377 |
+ smap = cr4 & X86_CR4_SMAP; |
378 |
+ is_user = svm_get_cpl(vcpu) == 3; |
379 |
+ if (smap && (!smep || is_user)) { |
380 |
+- if (!sev_guest(vcpu->kvm)) |
381 |
+- return true; |
382 |
+- |
383 |
+ pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); |
384 |
+ |
385 |
+ /* |
386 |
+diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c |
387 |
+index cdf5f34518f43..bd70c1d7f3458 100644 |
388 |
+--- a/arch/x86/kvm/vmx/pmu_intel.c |
389 |
++++ b/arch/x86/kvm/vmx/pmu_intel.c |
390 |
+@@ -68,10 +68,11 @@ static void global_ctrl_changed(struct kvm_pmu *pmu, u64 data) |
391 |
+ reprogram_counter(pmu, bit); |
392 |
+ } |
393 |
+ |
394 |
+-static unsigned intel_find_arch_event(struct kvm_pmu *pmu, |
395 |
+- u8 event_select, |
396 |
+- u8 unit_mask) |
397 |
++static unsigned int intel_pmc_perf_hw_id(struct kvm_pmc *pmc) |
398 |
+ { |
399 |
++ struct kvm_pmu *pmu = pmc_to_pmu(pmc); |
400 |
++ u8 event_select = pmc->eventsel & ARCH_PERFMON_EVENTSEL_EVENT; |
401 |
++ u8 unit_mask = (pmc->eventsel & ARCH_PERFMON_EVENTSEL_UMASK) >> 8; |
402 |
+ int i; |
403 |
+ |
404 |
+ for (i = 0; i < ARRAY_SIZE(intel_arch_events); i++) |
405 |
+@@ -432,7 +433,7 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu) |
406 |
+ } |
407 |
+ |
408 |
+ struct kvm_pmu_ops intel_pmu_ops = { |
409 |
+- .find_arch_event = intel_find_arch_event, |
410 |
++ .pmc_perf_hw_id = intel_pmc_perf_hw_id, |
411 |
+ .find_fixed_event = intel_find_fixed_event, |
412 |
+ .pmc_is_enabled = intel_pmc_is_enabled, |
413 |
+ .pmc_idx_to_pmc = intel_pmc_idx_to_pmc, |
414 |
+diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c |
415 |
+index 16ff25d6935e7..804c65d2b95f3 100644 |
416 |
+--- a/arch/x86/xen/enlighten_pv.c |
417 |
++++ b/arch/x86/xen/enlighten_pv.c |
418 |
+@@ -1387,10 +1387,6 @@ asmlinkage __visible void __init xen_start_kernel(void) |
419 |
+ |
420 |
+ xen_acpi_sleep_register(); |
421 |
+ |
422 |
+- /* Avoid searching for BIOS MP tables */ |
423 |
+- x86_init.mpparse.find_smp_config = x86_init_noop; |
424 |
+- x86_init.mpparse.get_smp_config = x86_init_uint_noop; |
425 |
+- |
426 |
+ xen_boot_params_init_edd(); |
427 |
+ |
428 |
+ #ifdef CONFIG_ACPI |
429 |
+diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c |
430 |
+index c2ac319f11a4b..8f9e7e2407c87 100644 |
431 |
+--- a/arch/x86/xen/smp_pv.c |
432 |
++++ b/arch/x86/xen/smp_pv.c |
433 |
+@@ -149,28 +149,12 @@ int xen_smp_intr_init_pv(unsigned int cpu) |
434 |
+ return rc; |
435 |
+ } |
436 |
+ |
437 |
+-static void __init xen_fill_possible_map(void) |
438 |
+-{ |
439 |
+- int i, rc; |
440 |
+- |
441 |
+- if (xen_initial_domain()) |
442 |
+- return; |
443 |
+- |
444 |
+- for (i = 0; i < nr_cpu_ids; i++) { |
445 |
+- rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); |
446 |
+- if (rc >= 0) { |
447 |
+- num_processors++; |
448 |
+- set_cpu_possible(i, true); |
449 |
+- } |
450 |
+- } |
451 |
+-} |
452 |
+- |
453 |
+-static void __init xen_filter_cpu_maps(void) |
454 |
++static void __init _get_smp_config(unsigned int early) |
455 |
+ { |
456 |
+ int i, rc; |
457 |
+ unsigned int subtract = 0; |
458 |
+ |
459 |
+- if (!xen_initial_domain()) |
460 |
++ if (early) |
461 |
+ return; |
462 |
+ |
463 |
+ num_processors = 0; |
464 |
+@@ -211,7 +195,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void) |
465 |
+ * sure the old memory can be recycled. */ |
466 |
+ make_lowmem_page_readwrite(xen_initial_gdt); |
467 |
+ |
468 |
+- xen_filter_cpu_maps(); |
469 |
+ xen_setup_vcpu_info_placement(); |
470 |
+ |
471 |
+ /* |
472 |
+@@ -491,5 +474,8 @@ static const struct smp_ops xen_smp_ops __initconst = { |
473 |
+ void __init xen_smp_init(void) |
474 |
+ { |
475 |
+ smp_ops = xen_smp_ops; |
476 |
+- xen_fill_possible_map(); |
477 |
++ |
478 |
++ /* Avoid searching for BIOS MP tables */ |
479 |
++ x86_init.mpparse.find_smp_config = x86_init_noop; |
480 |
++ x86_init.mpparse.get_smp_config = _get_smp_config; |
481 |
+ } |
482 |
+diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c |
483 |
+index b8c2ddc01aec3..8d95bf7765b19 100644 |
484 |
+--- a/block/bfq-iosched.c |
485 |
++++ b/block/bfq-iosched.c |
486 |
+@@ -6404,6 +6404,8 @@ static void bfq_exit_queue(struct elevator_queue *e) |
487 |
+ spin_unlock_irq(&bfqd->lock); |
488 |
+ #endif |
489 |
+ |
490 |
++ wbt_enable_default(bfqd->queue); |
491 |
++ |
492 |
+ kfree(bfqd); |
493 |
+ } |
494 |
+ |
495 |
+diff --git a/block/elevator.c b/block/elevator.c |
496 |
+index 2a525863d4e92..2f962662c32a1 100644 |
497 |
+--- a/block/elevator.c |
498 |
++++ b/block/elevator.c |
499 |
+@@ -518,8 +518,6 @@ void elv_unregister_queue(struct request_queue *q) |
500 |
+ kobject_del(&e->kobj); |
501 |
+ |
502 |
+ e->registered = 0; |
503 |
+- /* Re-enable throttling in case elevator disabled it */ |
504 |
+- wbt_enable_default(q); |
505 |
+ } |
506 |
+ } |
507 |
+ |
508 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
509 |
+index 1f54f82d22d61..d2b544bdc7b5e 100644 |
510 |
+--- a/drivers/ata/libata-core.c |
511 |
++++ b/drivers/ata/libata-core.c |
512 |
+@@ -3989,6 +3989,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
513 |
+ |
514 |
+ /* devices that don't properly handle TRIM commands */ |
515 |
+ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, |
516 |
++ { "M88V29*", NULL, ATA_HORKAGE_NOTRIM, }, |
517 |
+ |
518 |
+ /* |
519 |
+ * As defined, the DRAT (Deterministic Read After Trim) and RZAT |
520 |
+diff --git a/drivers/char/random.c b/drivers/char/random.c |
521 |
+index 5444206f35e22..5f541c9465598 100644 |
522 |
+--- a/drivers/char/random.c |
523 |
++++ b/drivers/char/random.c |
524 |
+@@ -1987,7 +1987,10 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) |
525 |
+ */ |
526 |
+ if (!capable(CAP_SYS_ADMIN)) |
527 |
+ return -EPERM; |
528 |
+- input_pool.entropy_count = 0; |
529 |
++ if (xchg(&input_pool.entropy_count, 0) && random_write_wakeup_bits) { |
530 |
++ wake_up_interruptible(&random_write_wait); |
531 |
++ kill_fasync(&fasync, SIGIO, POLL_OUT); |
532 |
++ } |
533 |
+ return 0; |
534 |
+ case RNDRESEEDCRNG: |
535 |
+ if (!capable(CAP_SYS_ADMIN)) |
536 |
+diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c |
537 |
+index 991a7b5da29f0..7c268d1bd2050 100644 |
538 |
+--- a/drivers/dma/sh/rcar-dmac.c |
539 |
++++ b/drivers/dma/sh/rcar-dmac.c |
540 |
+@@ -1844,8 +1844,13 @@ static int rcar_dmac_probe(struct platform_device *pdev) |
541 |
+ |
542 |
+ dmac->dev = &pdev->dev; |
543 |
+ platform_set_drvdata(pdev, dmac); |
544 |
+- dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); |
545 |
+- dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); |
546 |
++ ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); |
547 |
++ if (ret) |
548 |
++ return ret; |
549 |
++ |
550 |
++ ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); |
551 |
++ if (ret) |
552 |
++ return ret; |
553 |
+ |
554 |
+ ret = rcar_dmac_parse_of(&pdev->dev, dmac); |
555 |
+ if (ret < 0) |
556 |
+diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c |
557 |
+index bddd3b23f33fc..f04bcffd3c24a 100644 |
558 |
+--- a/drivers/dma/stm32-dmamux.c |
559 |
++++ b/drivers/dma/stm32-dmamux.c |
560 |
+@@ -292,10 +292,12 @@ static int stm32_dmamux_probe(struct platform_device *pdev) |
561 |
+ ret = of_dma_router_register(node, stm32_dmamux_route_allocate, |
562 |
+ &stm32_dmamux->dmarouter); |
563 |
+ if (ret) |
564 |
+- goto err_clk; |
565 |
++ goto pm_disable; |
566 |
+ |
567 |
+ return 0; |
568 |
+ |
569 |
++pm_disable: |
570 |
++ pm_runtime_disable(&pdev->dev); |
571 |
+ err_clk: |
572 |
+ clk_disable_unprepare(stm32_dmamux->clk); |
573 |
+ |
574 |
+diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c |
575 |
+index 01ff71f7b6456..f4eb071327be0 100644 |
576 |
+--- a/drivers/edac/edac_mc.c |
577 |
++++ b/drivers/edac/edac_mc.c |
578 |
+@@ -210,7 +210,7 @@ void *edac_align_ptr(void **p, unsigned int size, int n_elems) |
579 |
+ else |
580 |
+ return (char *)ptr; |
581 |
+ |
582 |
+- r = (unsigned long)p % align; |
583 |
++ r = (unsigned long)ptr % align; |
584 |
+ |
585 |
+ if (r == 0) |
586 |
+ return (char *)ptr; |
587 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
588 |
+index 5207ad654f18e..0b162928a248b 100644 |
589 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
590 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c |
591 |
+@@ -2120,7 +2120,7 @@ int amdgpu_copy_buffer(struct amdgpu_ring *ring, uint64_t src_offset, |
592 |
+ unsigned i; |
593 |
+ int r; |
594 |
+ |
595 |
+- if (direct_submit && !ring->sched.ready) { |
596 |
++ if (!direct_submit && !ring->sched.ready) { |
597 |
+ DRM_ERROR("Trying to move memory with ring turned off.\n"); |
598 |
+ return -EINVAL; |
599 |
+ } |
600 |
+diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig |
601 |
+index 1e1cb245fca77..8eb9bf3a1617e 100644 |
602 |
+--- a/drivers/gpu/drm/i915/Kconfig |
603 |
++++ b/drivers/gpu/drm/i915/Kconfig |
604 |
+@@ -100,6 +100,7 @@ config DRM_I915_USERPTR |
605 |
+ config DRM_I915_GVT |
606 |
+ bool "Enable Intel GVT-g graphics virtualization host support" |
607 |
+ depends on DRM_I915 |
608 |
++ depends on X86 |
609 |
+ depends on 64BIT |
610 |
+ default n |
611 |
+ help |
612 |
+diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c |
613 |
+index de995362f4283..abff2d6cedd12 100644 |
614 |
+--- a/drivers/gpu/drm/i915/display/intel_opregion.c |
615 |
++++ b/drivers/gpu/drm/i915/display/intel_opregion.c |
616 |
+@@ -361,6 +361,21 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, |
617 |
+ port++; |
618 |
+ } |
619 |
+ |
620 |
++ /* |
621 |
++ * The port numbering and mapping here is bizarre. The now-obsolete |
622 |
++ * swsci spec supports ports numbered [0..4]. Port E is handled as a |
623 |
++ * special case, but port F and beyond are not. The functionality is |
624 |
++ * supposed to be obsolete for new platforms. Just bail out if the port |
625 |
++ * number is out of bounds after mapping. |
626 |
++ */ |
627 |
++ if (port > 4) { |
628 |
++ drm_dbg_kms(&dev_priv->drm, |
629 |
++ "[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n", |
630 |
++ intel_encoder->base.base.id, intel_encoder->base.name, |
631 |
++ port_name(intel_encoder->port), port); |
632 |
++ return -EINVAL; |
633 |
++ } |
634 |
++ |
635 |
+ if (!enable) |
636 |
+ parm |= 4 << 8; |
637 |
+ |
638 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/falcon/base.c b/drivers/gpu/drm/nouveau/nvkm/falcon/base.c |
639 |
+index c6a3448180d6f..93d9575181c67 100644 |
640 |
+--- a/drivers/gpu/drm/nouveau/nvkm/falcon/base.c |
641 |
++++ b/drivers/gpu/drm/nouveau/nvkm/falcon/base.c |
642 |
+@@ -119,8 +119,12 @@ nvkm_falcon_disable(struct nvkm_falcon *falcon) |
643 |
+ int |
644 |
+ nvkm_falcon_reset(struct nvkm_falcon *falcon) |
645 |
+ { |
646 |
+- nvkm_falcon_disable(falcon); |
647 |
+- return nvkm_falcon_enable(falcon); |
648 |
++ if (!falcon->func->reset) { |
649 |
++ nvkm_falcon_disable(falcon); |
650 |
++ return nvkm_falcon_enable(falcon); |
651 |
++ } |
652 |
++ |
653 |
++ return falcon->func->reset(falcon); |
654 |
+ } |
655 |
+ |
656 |
+ int |
657 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm200.c |
658 |
+index 383376addb41c..a9d6c36195ed1 100644 |
659 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm200.c |
660 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm200.c |
661 |
+@@ -23,9 +23,38 @@ |
662 |
+ */ |
663 |
+ #include "priv.h" |
664 |
+ |
665 |
++static int |
666 |
++gm200_pmu_flcn_reset(struct nvkm_falcon *falcon) |
667 |
++{ |
668 |
++ struct nvkm_pmu *pmu = container_of(falcon, typeof(*pmu), falcon); |
669 |
++ |
670 |
++ nvkm_falcon_wr32(falcon, 0x014, 0x0000ffff); |
671 |
++ pmu->func->reset(pmu); |
672 |
++ return nvkm_falcon_enable(falcon); |
673 |
++} |
674 |
++ |
675 |
++const struct nvkm_falcon_func |
676 |
++gm200_pmu_flcn = { |
677 |
++ .debug = 0xc08, |
678 |
++ .fbif = 0xe00, |
679 |
++ .load_imem = nvkm_falcon_v1_load_imem, |
680 |
++ .load_dmem = nvkm_falcon_v1_load_dmem, |
681 |
++ .read_dmem = nvkm_falcon_v1_read_dmem, |
682 |
++ .bind_context = nvkm_falcon_v1_bind_context, |
683 |
++ .wait_for_halt = nvkm_falcon_v1_wait_for_halt, |
684 |
++ .clear_interrupt = nvkm_falcon_v1_clear_interrupt, |
685 |
++ .set_start_addr = nvkm_falcon_v1_set_start_addr, |
686 |
++ .start = nvkm_falcon_v1_start, |
687 |
++ .enable = nvkm_falcon_v1_enable, |
688 |
++ .disable = nvkm_falcon_v1_disable, |
689 |
++ .reset = gm200_pmu_flcn_reset, |
690 |
++ .cmdq = { 0x4a0, 0x4b0, 4 }, |
691 |
++ .msgq = { 0x4c8, 0x4cc, 0 }, |
692 |
++}; |
693 |
++ |
694 |
+ static const struct nvkm_pmu_func |
695 |
+ gm200_pmu = { |
696 |
+- .flcn = >215_pmu_flcn, |
697 |
++ .flcn = &gm200_pmu_flcn, |
698 |
+ .enabled = gf100_pmu_enabled, |
699 |
+ .reset = gf100_pmu_reset, |
700 |
+ }; |
701 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c |
702 |
+index 8f6ed5373ea16..7938722b4da17 100644 |
703 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c |
704 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gm20b.c |
705 |
+@@ -211,7 +211,7 @@ gm20b_pmu_recv(struct nvkm_pmu *pmu) |
706 |
+ |
707 |
+ static const struct nvkm_pmu_func |
708 |
+ gm20b_pmu = { |
709 |
+- .flcn = >215_pmu_flcn, |
710 |
++ .flcn = &gm200_pmu_flcn, |
711 |
+ .enabled = gf100_pmu_enabled, |
712 |
+ .intr = gt215_pmu_intr, |
713 |
+ .recv = gm20b_pmu_recv, |
714 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c |
715 |
+index 3d8ce14dba7bf..3dfb3e8522f6a 100644 |
716 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c |
717 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp102.c |
718 |
+@@ -39,7 +39,7 @@ gp102_pmu_enabled(struct nvkm_pmu *pmu) |
719 |
+ |
720 |
+ static const struct nvkm_pmu_func |
721 |
+ gp102_pmu = { |
722 |
+- .flcn = >215_pmu_flcn, |
723 |
++ .flcn = &gm200_pmu_flcn, |
724 |
+ .enabled = gp102_pmu_enabled, |
725 |
+ .reset = gp102_pmu_reset, |
726 |
+ }; |
727 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c |
728 |
+index 9c237c426599b..7f5f9d5448360 100644 |
729 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c |
730 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gp10b.c |
731 |
+@@ -78,7 +78,7 @@ gp10b_pmu_acr = { |
732 |
+ |
733 |
+ static const struct nvkm_pmu_func |
734 |
+ gp10b_pmu = { |
735 |
+- .flcn = >215_pmu_flcn, |
736 |
++ .flcn = &gm200_pmu_flcn, |
737 |
+ .enabled = gf100_pmu_enabled, |
738 |
+ .intr = gt215_pmu_intr, |
739 |
+ .recv = gm20b_pmu_recv, |
740 |
+diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h |
741 |
+index 276b6d778e532..b945ec320cd2e 100644 |
742 |
+--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h |
743 |
++++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/priv.h |
744 |
+@@ -44,6 +44,8 @@ void gf100_pmu_reset(struct nvkm_pmu *); |
745 |
+ |
746 |
+ void gk110_pmu_pgob(struct nvkm_pmu *, bool); |
747 |
+ |
748 |
++extern const struct nvkm_falcon_func gm200_pmu_flcn; |
749 |
++ |
750 |
+ void gm20b_pmu_acr_bld_patch(struct nvkm_acr *, u32, s64); |
751 |
+ void gm20b_pmu_acr_bld_write(struct nvkm_acr *, u32, struct nvkm_acr_lsfw *); |
752 |
+ int gm20b_pmu_acr_boot(struct nvkm_falcon *); |
753 |
+diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c |
754 |
+index cc5ee1b3af84f..12aa7877a625a 100644 |
755 |
+--- a/drivers/gpu/drm/radeon/atombios_encoders.c |
756 |
++++ b/drivers/gpu/drm/radeon/atombios_encoders.c |
757 |
+@@ -197,7 +197,8 @@ void radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder, |
758 |
+ * so don't register a backlight device |
759 |
+ */ |
760 |
+ if ((rdev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && |
761 |
+- (rdev->pdev->device == 0x6741)) |
762 |
++ (rdev->pdev->device == 0x6741) && |
763 |
++ !dmi_match(DMI_PRODUCT_NAME, "iMac12,1")) |
764 |
+ return; |
765 |
+ |
766 |
+ if (!radeon_encoder->enc_priv) |
767 |
+diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |
768 |
+index 23de359a1dec6..515e6f187dc77 100644 |
769 |
+--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |
770 |
++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |
771 |
+@@ -529,13 +529,6 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, |
772 |
+ return ret; |
773 |
+ } |
774 |
+ |
775 |
+- ret = clk_prepare_enable(hdmi->vpll_clk); |
776 |
+- if (ret) { |
777 |
+- DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n", |
778 |
+- ret); |
779 |
+- return ret; |
780 |
+- } |
781 |
+- |
782 |
+ hdmi->phy = devm_phy_optional_get(dev, "hdmi"); |
783 |
+ if (IS_ERR(hdmi->phy)) { |
784 |
+ ret = PTR_ERR(hdmi->phy); |
785 |
+@@ -544,6 +537,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, |
786 |
+ return ret; |
787 |
+ } |
788 |
+ |
789 |
++ ret = clk_prepare_enable(hdmi->vpll_clk); |
790 |
++ if (ret) { |
791 |
++ DRM_DEV_ERROR(hdmi->dev, "Failed to enable HDMI vpll: %d\n", |
792 |
++ ret); |
793 |
++ return ret; |
794 |
++ } |
795 |
++ |
796 |
+ drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); |
797 |
+ drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS); |
798 |
+ |
799 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
800 |
+index 370ec4402ebe3..d2e4f9f5507d5 100644 |
801 |
+--- a/drivers/hid/hid-ids.h |
802 |
++++ b/drivers/hid/hid-ids.h |
803 |
+@@ -1318,6 +1318,7 @@ |
804 |
+ #define USB_VENDOR_ID_UGTIZER 0x2179 |
805 |
+ #define USB_DEVICE_ID_UGTIZER_TABLET_GP0610 0x0053 |
806 |
+ #define USB_DEVICE_ID_UGTIZER_TABLET_GT5040 0x0077 |
807 |
++#define USB_DEVICE_ID_UGTIZER_TABLET_WP5540 0x0004 |
808 |
+ |
809 |
+ #define USB_VENDOR_ID_VIEWSONIC 0x0543 |
810 |
+ #define USB_DEVICE_ID_VIEWSONIC_PD1011 0xe621 |
811 |
+diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c |
812 |
+index 84a30202e3dbe..2ab71d717bb03 100644 |
813 |
+--- a/drivers/hid/hid-quirks.c |
814 |
++++ b/drivers/hid/hid-quirks.c |
815 |
+@@ -187,6 +187,7 @@ static const struct hid_device_id hid_quirks[] = { |
816 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, |
817 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, |
818 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT }, |
819 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_UGTIZER, USB_DEVICE_ID_UGTIZER_TABLET_WP5540), HID_QUIRK_MULTI_INPUT }, |
820 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH), HID_QUIRK_MULTI_INPUT }, |
821 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH), HID_QUIRK_MULTI_INPUT }, |
822 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT }, |
823 |
+diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c |
824 |
+index a5a402e776c77..362da2a83b470 100644 |
825 |
+--- a/drivers/hv/vmbus_drv.c |
826 |
++++ b/drivers/hv/vmbus_drv.c |
827 |
+@@ -1944,8 +1944,10 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) |
828 |
+ kobj->kset = dev->channels_kset; |
829 |
+ ret = kobject_init_and_add(kobj, &vmbus_chan_ktype, NULL, |
830 |
+ "%u", relid); |
831 |
+- if (ret) |
832 |
++ if (ret) { |
833 |
++ kobject_put(kobj); |
834 |
+ return ret; |
835 |
++ } |
836 |
+ |
837 |
+ ret = sysfs_create_group(kobj, &vmbus_chan_group); |
838 |
+ |
839 |
+@@ -1954,6 +1956,7 @@ int vmbus_add_channel_kobj(struct hv_device *dev, struct vmbus_channel *channel) |
840 |
+ * The calling functions' error handling paths will cleanup the |
841 |
+ * empty channel directory. |
842 |
+ */ |
843 |
++ kobject_put(kobj); |
844 |
+ dev_err(device, "Unable to set up channel sysfs files\n"); |
845 |
+ return ret; |
846 |
+ } |
847 |
+diff --git a/drivers/i2c/busses/i2c-brcmstb.c b/drivers/i2c/busses/i2c-brcmstb.c |
848 |
+index ba766d24219ef..44e2466f3c674 100644 |
849 |
+--- a/drivers/i2c/busses/i2c-brcmstb.c |
850 |
++++ b/drivers/i2c/busses/i2c-brcmstb.c |
851 |
+@@ -674,7 +674,7 @@ static int brcmstb_i2c_probe(struct platform_device *pdev) |
852 |
+ |
853 |
+ /* set the data in/out register size for compatible SoCs */ |
854 |
+ if (of_device_is_compatible(dev->device->of_node, |
855 |
+- "brcmstb,brcmper-i2c")) |
856 |
++ "brcm,brcmper-i2c")) |
857 |
+ dev->data_regsz = sizeof(u8); |
858 |
+ else |
859 |
+ dev->data_regsz = sizeof(u32); |
860 |
+diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c |
861 |
+index 1c259b5188de8..09e599069a81d 100644 |
862 |
+--- a/drivers/i2c/busses/i2c-qcom-cci.c |
863 |
++++ b/drivers/i2c/busses/i2c-qcom-cci.c |
864 |
+@@ -558,7 +558,7 @@ static int cci_probe(struct platform_device *pdev) |
865 |
+ cci->master[idx].adap.quirks = &cci->data->quirks; |
866 |
+ cci->master[idx].adap.algo = &cci_algo; |
867 |
+ cci->master[idx].adap.dev.parent = dev; |
868 |
+- cci->master[idx].adap.dev.of_node = child; |
869 |
++ cci->master[idx].adap.dev.of_node = of_node_get(child); |
870 |
+ cci->master[idx].master = idx; |
871 |
+ cci->master[idx].cci = cci; |
872 |
+ |
873 |
+@@ -643,8 +643,10 @@ static int cci_probe(struct platform_device *pdev) |
874 |
+ continue; |
875 |
+ |
876 |
+ ret = i2c_add_adapter(&cci->master[i].adap); |
877 |
+- if (ret < 0) |
878 |
++ if (ret < 0) { |
879 |
++ of_node_put(cci->master[i].adap.dev.of_node); |
880 |
+ goto error_i2c; |
881 |
++ } |
882 |
+ } |
883 |
+ |
884 |
+ pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); |
885 |
+@@ -655,9 +657,11 @@ static int cci_probe(struct platform_device *pdev) |
886 |
+ return 0; |
887 |
+ |
888 |
+ error_i2c: |
889 |
+- for (; i >= 0; i--) { |
890 |
+- if (cci->master[i].cci) |
891 |
++ for (--i ; i >= 0; i--) { |
892 |
++ if (cci->master[i].cci) { |
893 |
+ i2c_del_adapter(&cci->master[i].adap); |
894 |
++ of_node_put(cci->master[i].adap.dev.of_node); |
895 |
++ } |
896 |
+ } |
897 |
+ error: |
898 |
+ disable_irq(cci->irq); |
899 |
+@@ -673,8 +677,10 @@ static int cci_remove(struct platform_device *pdev) |
900 |
+ int i; |
901 |
+ |
902 |
+ for (i = 0; i < cci->data->num_masters; i++) { |
903 |
+- if (cci->master[i].cci) |
904 |
++ if (cci->master[i].cci) { |
905 |
+ i2c_del_adapter(&cci->master[i].adap); |
906 |
++ of_node_put(cci->master[i].adap.dev.of_node); |
907 |
++ } |
908 |
+ cci_halt(cci, i); |
909 |
+ } |
910 |
+ |
911 |
+diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c |
912 |
+index 926e55d838cb1..bd99ee0ae433d 100644 |
913 |
+--- a/drivers/irqchip/irq-sifive-plic.c |
914 |
++++ b/drivers/irqchip/irq-sifive-plic.c |
915 |
+@@ -400,3 +400,4 @@ out_free_priv: |
916 |
+ |
917 |
+ IRQCHIP_DECLARE(sifive_plic, "sifive,plic-1.0.0", plic_init); |
918 |
+ IRQCHIP_DECLARE(riscv_plic0, "riscv,plic0", plic_init); /* for legacy systems */ |
919 |
++IRQCHIP_DECLARE(thead_c900_plic, "thead,c900-plic", plic_init); /* for firmware driver */ |
920 |
+diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c |
921 |
+index 94caee49da99c..99b981a05b6c0 100644 |
922 |
+--- a/drivers/mmc/core/block.c |
923 |
++++ b/drivers/mmc/core/block.c |
924 |
+@@ -1642,31 +1642,31 @@ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req) |
925 |
+ struct mmc_card *card = mq->card; |
926 |
+ struct mmc_host *host = card->host; |
927 |
+ blk_status_t error = BLK_STS_OK; |
928 |
+- int retries = 0; |
929 |
+ |
930 |
+ do { |
931 |
+ u32 status; |
932 |
+ int err; |
933 |
++ int retries = 0; |
934 |
+ |
935 |
+- mmc_blk_rw_rq_prep(mqrq, card, 1, mq); |
936 |
++ while (retries++ <= MMC_READ_SINGLE_RETRIES) { |
937 |
++ mmc_blk_rw_rq_prep(mqrq, card, 1, mq); |
938 |
+ |
939 |
+- mmc_wait_for_req(host, mrq); |
940 |
++ mmc_wait_for_req(host, mrq); |
941 |
+ |
942 |
+- err = mmc_send_status(card, &status); |
943 |
+- if (err) |
944 |
+- goto error_exit; |
945 |
+- |
946 |
+- if (!mmc_host_is_spi(host) && |
947 |
+- !mmc_ready_for_data(status)) { |
948 |
+- err = mmc_blk_fix_state(card, req); |
949 |
++ err = mmc_send_status(card, &status); |
950 |
+ if (err) |
951 |
+ goto error_exit; |
952 |
+- } |
953 |
+ |
954 |
+- if (mrq->cmd->error && retries++ < MMC_READ_SINGLE_RETRIES) |
955 |
+- continue; |
956 |
++ if (!mmc_host_is_spi(host) && |
957 |
++ !mmc_ready_for_data(status)) { |
958 |
++ err = mmc_blk_fix_state(card, req); |
959 |
++ if (err) |
960 |
++ goto error_exit; |
961 |
++ } |
962 |
+ |
963 |
+- retries = 0; |
964 |
++ if (!mrq->cmd->error) |
965 |
++ break; |
966 |
++ } |
967 |
+ |
968 |
+ if (mrq->cmd->error || |
969 |
+ mrq->data->error || |
970 |
+diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
971 |
+index 909b14cc8e55c..580b91cbd18de 100644 |
972 |
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
973 |
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c |
974 |
+@@ -2062,7 +2062,7 @@ static int brcmnand_read_by_pio(struct mtd_info *mtd, struct nand_chip *chip, |
975 |
+ mtd->oobsize / trans, |
976 |
+ host->hwcfg.sector_size_1k); |
977 |
+ |
978 |
+- if (!ret) { |
979 |
++ if (ret != -EBADMSG) { |
980 |
+ *err_addr = brcmnand_get_uncorrecc_addr(ctrl); |
981 |
+ |
982 |
+ if (*err_addr) |
983 |
+diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
984 |
+index 226d527b6c6b7..cb7631145700a 100644 |
985 |
+--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
986 |
++++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c |
987 |
+@@ -2291,7 +2291,7 @@ static int gpmi_nfc_exec_op(struct nand_chip *chip, |
988 |
+ this->hw.must_apply_timings = false; |
989 |
+ ret = gpmi_nfc_apply_timings(this); |
990 |
+ if (ret) |
991 |
+- return ret; |
992 |
++ goto out_pm; |
993 |
+ } |
994 |
+ |
995 |
+ dev_dbg(this->dev, "%s: %d instructions\n", __func__, op->ninstrs); |
996 |
+@@ -2420,6 +2420,7 @@ unmap: |
997 |
+ |
998 |
+ this->bch = false; |
999 |
+ |
1000 |
++out_pm: |
1001 |
+ pm_runtime_mark_last_busy(this->dev); |
1002 |
+ pm_runtime_put_autosuspend(this->dev); |
1003 |
+ |
1004 |
+diff --git a/drivers/mtd/nand/raw/qcom_nandc.c b/drivers/mtd/nand/raw/qcom_nandc.c |
1005 |
+index b99d2e9d1e2c4..bb181e18c7c52 100644 |
1006 |
+--- a/drivers/mtd/nand/raw/qcom_nandc.c |
1007 |
++++ b/drivers/mtd/nand/raw/qcom_nandc.c |
1008 |
+@@ -2,7 +2,6 @@ |
1009 |
+ /* |
1010 |
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved. |
1011 |
+ */ |
1012 |
+- |
1013 |
+ #include <linux/clk.h> |
1014 |
+ #include <linux/slab.h> |
1015 |
+ #include <linux/bitops.h> |
1016 |
+@@ -2968,10 +2967,6 @@ static int qcom_nandc_probe(struct platform_device *pdev) |
1017 |
+ if (!nandc->base_dma) |
1018 |
+ return -ENXIO; |
1019 |
+ |
1020 |
+- ret = qcom_nandc_alloc(nandc); |
1021 |
+- if (ret) |
1022 |
+- goto err_nandc_alloc; |
1023 |
+- |
1024 |
+ ret = clk_prepare_enable(nandc->core_clk); |
1025 |
+ if (ret) |
1026 |
+ goto err_core_clk; |
1027 |
+@@ -2980,6 +2975,10 @@ static int qcom_nandc_probe(struct platform_device *pdev) |
1028 |
+ if (ret) |
1029 |
+ goto err_aon_clk; |
1030 |
+ |
1031 |
++ ret = qcom_nandc_alloc(nandc); |
1032 |
++ if (ret) |
1033 |
++ goto err_nandc_alloc; |
1034 |
++ |
1035 |
+ ret = qcom_nandc_setup(nandc); |
1036 |
+ if (ret) |
1037 |
+ goto err_setup; |
1038 |
+@@ -2991,15 +2990,14 @@ static int qcom_nandc_probe(struct platform_device *pdev) |
1039 |
+ return 0; |
1040 |
+ |
1041 |
+ err_setup: |
1042 |
++ qcom_nandc_unalloc(nandc); |
1043 |
++err_nandc_alloc: |
1044 |
+ clk_disable_unprepare(nandc->aon_clk); |
1045 |
+ err_aon_clk: |
1046 |
+ clk_disable_unprepare(nandc->core_clk); |
1047 |
+ err_core_clk: |
1048 |
+- qcom_nandc_unalloc(nandc); |
1049 |
+-err_nandc_alloc: |
1050 |
+ dma_unmap_resource(dev, res->start, resource_size(res), |
1051 |
+ DMA_BIDIRECTIONAL, 0); |
1052 |
+- |
1053 |
+ return ret; |
1054 |
+ } |
1055 |
+ |
1056 |
+diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c |
1057 |
+index ab8c833411654..c2cef7ba26719 100644 |
1058 |
+--- a/drivers/net/bonding/bond_3ad.c |
1059 |
++++ b/drivers/net/bonding/bond_3ad.c |
1060 |
+@@ -223,7 +223,7 @@ static inline int __check_agg_selection_timer(struct port *port) |
1061 |
+ if (bond == NULL) |
1062 |
+ return 0; |
1063 |
+ |
1064 |
+- return BOND_AD_INFO(bond).agg_select_timer ? 1 : 0; |
1065 |
++ return atomic_read(&BOND_AD_INFO(bond).agg_select_timer) ? 1 : 0; |
1066 |
+ } |
1067 |
+ |
1068 |
+ /** |
1069 |
+@@ -1976,7 +1976,7 @@ static void ad_marker_response_received(struct bond_marker *marker, |
1070 |
+ */ |
1071 |
+ void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout) |
1072 |
+ { |
1073 |
+- BOND_AD_INFO(bond).agg_select_timer = timeout; |
1074 |
++ atomic_set(&BOND_AD_INFO(bond).agg_select_timer, timeout); |
1075 |
+ } |
1076 |
+ |
1077 |
+ /** |
1078 |
+@@ -2259,6 +2259,28 @@ void bond_3ad_update_ad_actor_settings(struct bonding *bond) |
1079 |
+ spin_unlock_bh(&bond->mode_lock); |
1080 |
+ } |
1081 |
+ |
1082 |
++/** |
1083 |
++ * bond_agg_timer_advance - advance agg_select_timer |
1084 |
++ * @bond: bonding structure |
1085 |
++ * |
1086 |
++ * Return true when agg_select_timer reaches 0. |
1087 |
++ */ |
1088 |
++static bool bond_agg_timer_advance(struct bonding *bond) |
1089 |
++{ |
1090 |
++ int val, nval; |
1091 |
++ |
1092 |
++ while (1) { |
1093 |
++ val = atomic_read(&BOND_AD_INFO(bond).agg_select_timer); |
1094 |
++ if (!val) |
1095 |
++ return false; |
1096 |
++ nval = val - 1; |
1097 |
++ if (atomic_cmpxchg(&BOND_AD_INFO(bond).agg_select_timer, |
1098 |
++ val, nval) == val) |
1099 |
++ break; |
1100 |
++ } |
1101 |
++ return nval == 0; |
1102 |
++} |
1103 |
++ |
1104 |
+ /** |
1105 |
+ * bond_3ad_state_machine_handler - handle state machines timeout |
1106 |
+ * @work: work context to fetch bonding struct to work on from |
1107 |
+@@ -2294,9 +2316,7 @@ void bond_3ad_state_machine_handler(struct work_struct *work) |
1108 |
+ if (!bond_has_slaves(bond)) |
1109 |
+ goto re_arm; |
1110 |
+ |
1111 |
+- /* check if agg_select_timer timer after initialize is timed out */ |
1112 |
+- if (BOND_AD_INFO(bond).agg_select_timer && |
1113 |
+- !(--BOND_AD_INFO(bond).agg_select_timer)) { |
1114 |
++ if (bond_agg_timer_advance(bond)) { |
1115 |
+ slave = bond_first_slave_rcu(bond); |
1116 |
+ port = slave ? &(SLAVE_AD_INFO(slave)->port) : NULL; |
1117 |
+ |
1118 |
+diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c |
1119 |
+index 99770b1671923..cbeb69bca0bba 100644 |
1120 |
+--- a/drivers/net/bonding/bond_main.c |
1121 |
++++ b/drivers/net/bonding/bond_main.c |
1122 |
+@@ -2272,10 +2272,9 @@ static int __bond_release_one(struct net_device *bond_dev, |
1123 |
+ bond_select_active_slave(bond); |
1124 |
+ } |
1125 |
+ |
1126 |
+- if (!bond_has_slaves(bond)) { |
1127 |
+- bond_set_carrier(bond); |
1128 |
++ bond_set_carrier(bond); |
1129 |
++ if (!bond_has_slaves(bond)) |
1130 |
+ eth_hw_addr_random(bond_dev); |
1131 |
+- } |
1132 |
+ |
1133 |
+ unblock_netpoll_tx(); |
1134 |
+ synchronize_rcu(); |
1135 |
+diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c |
1136 |
+index dcf1fc89451f2..2044d440d7de4 100644 |
1137 |
+--- a/drivers/net/dsa/lan9303-core.c |
1138 |
++++ b/drivers/net/dsa/lan9303-core.c |
1139 |
+@@ -1305,7 +1305,7 @@ static int lan9303_probe_reset_gpio(struct lan9303 *chip, |
1140 |
+ struct device_node *np) |
1141 |
+ { |
1142 |
+ chip->reset_gpio = devm_gpiod_get_optional(chip->dev, "reset", |
1143 |
+- GPIOD_OUT_LOW); |
1144 |
++ GPIOD_OUT_HIGH); |
1145 |
+ if (IS_ERR(chip->reset_gpio)) |
1146 |
+ return PTR_ERR(chip->reset_gpio); |
1147 |
+ |
1148 |
+diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c |
1149 |
+index ed517985ca88e..80ef7ea779545 100644 |
1150 |
+--- a/drivers/net/dsa/lantiq_gswip.c |
1151 |
++++ b/drivers/net/dsa/lantiq_gswip.c |
1152 |
+@@ -2114,8 +2114,8 @@ static int gswip_remove(struct platform_device *pdev) |
1153 |
+ |
1154 |
+ if (priv->ds->slave_mii_bus) { |
1155 |
+ mdiobus_unregister(priv->ds->slave_mii_bus); |
1156 |
+- mdiobus_free(priv->ds->slave_mii_bus); |
1157 |
+ of_node_put(priv->ds->slave_mii_bus->dev.of_node); |
1158 |
++ mdiobus_free(priv->ds->slave_mii_bus); |
1159 |
+ } |
1160 |
+ |
1161 |
+ for (i = 0; i < priv->num_gphy_fw; i++) |
1162 |
+diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c |
1163 |
+index 1e8bf6b9834bb..2af464ac250ac 100644 |
1164 |
+--- a/drivers/net/ethernet/cadence/macb_main.c |
1165 |
++++ b/drivers/net/ethernet/cadence/macb_main.c |
1166 |
+@@ -4534,7 +4534,7 @@ static int macb_probe(struct platform_device *pdev) |
1167 |
+ |
1168 |
+ #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
1169 |
+ if (GEM_BFEXT(DAW64, gem_readl(bp, DCFG6))) { |
1170 |
+- dma_set_mask(&pdev->dev, DMA_BIT_MASK(44)); |
1171 |
++ dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(44)); |
1172 |
+ bp->hw_dma_cap |= HW_DMA_CAP_64B; |
1173 |
+ } |
1174 |
+ #endif |
1175 |
+diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
1176 |
+index f917bc9c87969..d89ddc165ec24 100644 |
1177 |
+--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
1178 |
++++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |
1179 |
+@@ -4225,7 +4225,7 @@ static int dpaa2_eth_probe(struct fsl_mc_device *dpni_dev) |
1180 |
+ } |
1181 |
+ |
1182 |
+ INIT_WORK(&priv->tx_onestep_tstamp, dpaa2_eth_tx_onestep_tstamp); |
1183 |
+- |
1184 |
++ mutex_init(&priv->onestep_tstamp_lock); |
1185 |
+ skb_queue_head_init(&priv->tx_skbs); |
1186 |
+ |
1187 |
+ /* Obtain a MC portal */ |
1188 |
+diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c |
1189 |
+index 7d67f41387f55..4f5ef8a9a9a87 100644 |
1190 |
+--- a/drivers/net/ieee802154/at86rf230.c |
1191 |
++++ b/drivers/net/ieee802154/at86rf230.c |
1192 |
+@@ -100,6 +100,7 @@ struct at86rf230_local { |
1193 |
+ unsigned long cal_timeout; |
1194 |
+ bool is_tx; |
1195 |
+ bool is_tx_from_off; |
1196 |
++ bool was_tx; |
1197 |
+ u8 tx_retry; |
1198 |
+ struct sk_buff *tx_skb; |
1199 |
+ struct at86rf230_state_change tx; |
1200 |
+@@ -343,7 +344,11 @@ at86rf230_async_error_recover_complete(void *context) |
1201 |
+ if (ctx->free) |
1202 |
+ kfree(ctx); |
1203 |
+ |
1204 |
+- ieee802154_wake_queue(lp->hw); |
1205 |
++ if (lp->was_tx) { |
1206 |
++ lp->was_tx = 0; |
1207 |
++ dev_kfree_skb_any(lp->tx_skb); |
1208 |
++ ieee802154_wake_queue(lp->hw); |
1209 |
++ } |
1210 |
+ } |
1211 |
+ |
1212 |
+ static void |
1213 |
+@@ -352,7 +357,11 @@ at86rf230_async_error_recover(void *context) |
1214 |
+ struct at86rf230_state_change *ctx = context; |
1215 |
+ struct at86rf230_local *lp = ctx->lp; |
1216 |
+ |
1217 |
+- lp->is_tx = 0; |
1218 |
++ if (lp->is_tx) { |
1219 |
++ lp->was_tx = 1; |
1220 |
++ lp->is_tx = 0; |
1221 |
++ } |
1222 |
++ |
1223 |
+ at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, |
1224 |
+ at86rf230_async_error_recover_complete); |
1225 |
+ } |
1226 |
+diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c |
1227 |
+index fea8b681f567c..fd9f33c833fa3 100644 |
1228 |
+--- a/drivers/net/ieee802154/ca8210.c |
1229 |
++++ b/drivers/net/ieee802154/ca8210.c |
1230 |
+@@ -2977,8 +2977,8 @@ static void ca8210_hw_setup(struct ieee802154_hw *ca8210_hw) |
1231 |
+ ca8210_hw->phy->cca.opt = NL802154_CCA_OPT_ENERGY_CARRIER_AND; |
1232 |
+ ca8210_hw->phy->cca_ed_level = -9800; |
1233 |
+ ca8210_hw->phy->symbol_duration = 16; |
1234 |
+- ca8210_hw->phy->lifs_period = 40; |
1235 |
+- ca8210_hw->phy->sifs_period = 12; |
1236 |
++ ca8210_hw->phy->lifs_period = 40 * ca8210_hw->phy->symbol_duration; |
1237 |
++ ca8210_hw->phy->sifs_period = 12 * ca8210_hw->phy->symbol_duration; |
1238 |
+ ca8210_hw->flags = |
1239 |
+ IEEE802154_HW_AFILT | |
1240 |
+ IEEE802154_HW_OMIT_CKSUM | |
1241 |
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c |
1242 |
+index 6e033ba717030..597766d14563e 100644 |
1243 |
+--- a/drivers/net/usb/qmi_wwan.c |
1244 |
++++ b/drivers/net/usb/qmi_wwan.c |
1245 |
+@@ -1333,6 +1333,8 @@ static const struct usb_device_id products[] = { |
1246 |
+ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ |
1247 |
+ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */ |
1248 |
+ {QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/ |
1249 |
++ {QMI_FIXED_INTF(0x413c, 0x81e4, 0)}, /* Dell Wireless 5829e with eSIM support*/ |
1250 |
++ {QMI_FIXED_INTF(0x413c, 0x81e6, 0)}, /* Dell Wireless 5829e */ |
1251 |
+ {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */ |
1252 |
+ {QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */ |
1253 |
+ {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */ |
1254 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
1255 |
+index 30c6d7b18599a..ab84ac3f8f03f 100644 |
1256 |
+--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
1257 |
++++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c |
1258 |
+@@ -1646,6 +1646,8 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context) |
1259 |
+ out_unbind: |
1260 |
+ complete(&drv->request_firmware_complete); |
1261 |
+ device_release_driver(drv->trans->dev); |
1262 |
++ /* drv has just been freed by the release */ |
1263 |
++ failure = false; |
1264 |
+ free: |
1265 |
+ if (failure) |
1266 |
+ iwl_dealloc_ucode(drv); |
1267 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
1268 |
+index b031e9304983c..b2991582189c2 100644 |
1269 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
1270 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans-gen2.c |
1271 |
+@@ -320,8 +320,7 @@ int iwl_trans_pcie_gen2_start_fw(struct iwl_trans *trans, |
1272 |
+ /* This may fail if AMT took ownership of the device */ |
1273 |
+ if (iwl_pcie_prepare_card_hw(trans)) { |
1274 |
+ IWL_WARN(trans, "Exit HW not ready\n"); |
1275 |
+- ret = -EIO; |
1276 |
+- goto out; |
1277 |
++ return -EIO; |
1278 |
+ } |
1279 |
+ |
1280 |
+ iwl_enable_rfkill_int(trans); |
1281 |
+diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
1282 |
+index 082768ec8aa80..daec61a60fec5 100644 |
1283 |
+--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
1284 |
++++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c |
1285 |
+@@ -1313,8 +1313,7 @@ static int iwl_trans_pcie_start_fw(struct iwl_trans *trans, |
1286 |
+ /* This may fail if AMT took ownership of the device */ |
1287 |
+ if (iwl_pcie_prepare_card_hw(trans)) { |
1288 |
+ IWL_WARN(trans, "Exit HW not ready\n"); |
1289 |
+- ret = -EIO; |
1290 |
+- goto out; |
1291 |
++ return -EIO; |
1292 |
+ } |
1293 |
+ |
1294 |
+ iwl_enable_rfkill_int(trans); |
1295 |
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c |
1296 |
+index 99b5152482fe4..71c85c99e86c6 100644 |
1297 |
+--- a/drivers/nvme/host/core.c |
1298 |
++++ b/drivers/nvme/host/core.c |
1299 |
+@@ -4259,7 +4259,14 @@ static void nvme_async_event_work(struct work_struct *work) |
1300 |
+ container_of(work, struct nvme_ctrl, async_event_work); |
1301 |
+ |
1302 |
+ nvme_aen_uevent(ctrl); |
1303 |
+- ctrl->ops->submit_async_event(ctrl); |
1304 |
++ |
1305 |
++ /* |
1306 |
++ * The transport drivers must guarantee AER submission here is safe by |
1307 |
++ * flushing ctrl async_event_work after changing the controller state |
1308 |
++ * from LIVE and before freeing the admin queue. |
1309 |
++ */ |
1310 |
++ if (ctrl->state == NVME_CTRL_LIVE) |
1311 |
++ ctrl->ops->submit_async_event(ctrl); |
1312 |
+ } |
1313 |
+ |
1314 |
+ static bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl) |
1315 |
+diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c |
1316 |
+index 1b90563818434..8eacc9bd58f5a 100644 |
1317 |
+--- a/drivers/nvme/host/rdma.c |
1318 |
++++ b/drivers/nvme/host/rdma.c |
1319 |
+@@ -1200,6 +1200,7 @@ static void nvme_rdma_error_recovery_work(struct work_struct *work) |
1320 |
+ struct nvme_rdma_ctrl, err_work); |
1321 |
+ |
1322 |
+ nvme_stop_keep_alive(&ctrl->ctrl); |
1323 |
++ flush_work(&ctrl->ctrl.async_event_work); |
1324 |
+ nvme_rdma_teardown_io_queues(ctrl, false); |
1325 |
+ nvme_start_queues(&ctrl->ctrl); |
1326 |
+ nvme_rdma_teardown_admin_queue(ctrl, false); |
1327 |
+diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c |
1328 |
+index 662028d7a1c6a..6105894a218a5 100644 |
1329 |
+--- a/drivers/nvme/host/tcp.c |
1330 |
++++ b/drivers/nvme/host/tcp.c |
1331 |
+@@ -2077,6 +2077,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work) |
1332 |
+ struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl; |
1333 |
+ |
1334 |
+ nvme_stop_keep_alive(ctrl); |
1335 |
++ flush_work(&ctrl->async_event_work); |
1336 |
+ nvme_tcp_teardown_io_queues(ctrl, false); |
1337 |
+ /* unquiesce to fail fast pending requests */ |
1338 |
+ nvme_start_queues(ctrl); |
1339 |
+diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c |
1340 |
+index b5f9ee81a46c1..b916fab9b1618 100644 |
1341 |
+--- a/drivers/parisc/ccio-dma.c |
1342 |
++++ b/drivers/parisc/ccio-dma.c |
1343 |
+@@ -1003,7 +1003,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, |
1344 |
+ ioc->usg_calls++; |
1345 |
+ #endif |
1346 |
+ |
1347 |
+- while(sg_dma_len(sglist) && nents--) { |
1348 |
++ while (nents && sg_dma_len(sglist)) { |
1349 |
+ |
1350 |
+ #ifdef CCIO_COLLECT_STATS |
1351 |
+ ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT; |
1352 |
+@@ -1011,6 +1011,7 @@ ccio_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, |
1353 |
+ ccio_unmap_page(dev, sg_dma_address(sglist), |
1354 |
+ sg_dma_len(sglist), direction, 0); |
1355 |
+ ++sglist; |
1356 |
++ nents--; |
1357 |
+ } |
1358 |
+ |
1359 |
+ DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1360 |
+diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c |
1361 |
+index dce4cdf786cdb..228c58060e9b3 100644 |
1362 |
+--- a/drivers/parisc/sba_iommu.c |
1363 |
++++ b/drivers/parisc/sba_iommu.c |
1364 |
+@@ -1047,7 +1047,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, |
1365 |
+ spin_unlock_irqrestore(&ioc->res_lock, flags); |
1366 |
+ #endif |
1367 |
+ |
1368 |
+- while (sg_dma_len(sglist) && nents--) { |
1369 |
++ while (nents && sg_dma_len(sglist)) { |
1370 |
+ |
1371 |
+ sba_unmap_page(dev, sg_dma_address(sglist), sg_dma_len(sglist), |
1372 |
+ direction, 0); |
1373 |
+@@ -1056,6 +1056,7 @@ sba_unmap_sg(struct device *dev, struct scatterlist *sglist, int nents, |
1374 |
+ ioc->usingle_calls--; /* kluge since call is unmap_sg() */ |
1375 |
+ #endif |
1376 |
+ ++sglist; |
1377 |
++ nents--; |
1378 |
+ } |
1379 |
+ |
1380 |
+ DBG_RUN_SG("%s() DONE (nents %d)\n", __func__, nents); |
1381 |
+diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c |
1382 |
+index ad3e3cde1c20d..a070e69bb49cd 100644 |
1383 |
+--- a/drivers/pci/controller/pci-hyperv.c |
1384 |
++++ b/drivers/pci/controller/pci-hyperv.c |
1385 |
+@@ -1841,8 +1841,17 @@ static void hv_pci_assign_numa_node(struct hv_pcibus_device *hbus) |
1386 |
+ if (!hv_dev) |
1387 |
+ continue; |
1388 |
+ |
1389 |
+- if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY) |
1390 |
+- set_dev_node(&dev->dev, hv_dev->desc.virtual_numa_node); |
1391 |
++ if (hv_dev->desc.flags & HV_PCI_DEVICE_FLAG_NUMA_AFFINITY && |
1392 |
++ hv_dev->desc.virtual_numa_node < num_possible_nodes()) |
1393 |
++ /* |
1394 |
++ * The kernel may boot with some NUMA nodes offline |
1395 |
++ * (e.g. in a KDUMP kernel) or with NUMA disabled via |
1396 |
++ * "numa=off". In those cases, adjust the host provided |
1397 |
++ * NUMA node to a valid NUMA node used by the kernel. |
1398 |
++ */ |
1399 |
++ set_dev_node(&dev->dev, |
1400 |
++ numa_map_to_online_node( |
1401 |
++ hv_dev->desc.virtual_numa_node)); |
1402 |
+ |
1403 |
+ put_pcichild(hv_dev); |
1404 |
+ } |
1405 |
+diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c |
1406 |
+index 99fbc7e4138be..b901a0d4e2a80 100644 |
1407 |
+--- a/drivers/phy/broadcom/phy-brcm-usb.c |
1408 |
++++ b/drivers/phy/broadcom/phy-brcm-usb.c |
1409 |
+@@ -17,6 +17,7 @@ |
1410 |
+ #include <linux/soc/brcmstb/brcmstb.h> |
1411 |
+ #include <dt-bindings/phy/phy.h> |
1412 |
+ #include <linux/mfd/syscon.h> |
1413 |
++#include <linux/suspend.h> |
1414 |
+ |
1415 |
+ #include "phy-brcm-usb-init.h" |
1416 |
+ |
1417 |
+@@ -69,12 +70,35 @@ struct brcm_usb_phy_data { |
1418 |
+ int init_count; |
1419 |
+ int wake_irq; |
1420 |
+ struct brcm_usb_phy phys[BRCM_USB_PHY_ID_MAX]; |
1421 |
++ struct notifier_block pm_notifier; |
1422 |
++ bool pm_active; |
1423 |
+ }; |
1424 |
+ |
1425 |
+ static s8 *node_reg_names[BRCM_REGS_MAX] = { |
1426 |
+ "crtl", "xhci_ec", "xhci_gbl", "usb_phy", "usb_mdio", "bdc_ec" |
1427 |
+ }; |
1428 |
+ |
1429 |
++static int brcm_pm_notifier(struct notifier_block *notifier, |
1430 |
++ unsigned long pm_event, |
1431 |
++ void *unused) |
1432 |
++{ |
1433 |
++ struct brcm_usb_phy_data *priv = |
1434 |
++ container_of(notifier, struct brcm_usb_phy_data, pm_notifier); |
1435 |
++ |
1436 |
++ switch (pm_event) { |
1437 |
++ case PM_HIBERNATION_PREPARE: |
1438 |
++ case PM_SUSPEND_PREPARE: |
1439 |
++ priv->pm_active = true; |
1440 |
++ break; |
1441 |
++ case PM_POST_RESTORE: |
1442 |
++ case PM_POST_HIBERNATION: |
1443 |
++ case PM_POST_SUSPEND: |
1444 |
++ priv->pm_active = false; |
1445 |
++ break; |
1446 |
++ } |
1447 |
++ return NOTIFY_DONE; |
1448 |
++} |
1449 |
++ |
1450 |
+ static irqreturn_t brcm_usb_phy_wake_isr(int irq, void *dev_id) |
1451 |
+ { |
1452 |
+ struct phy *gphy = dev_id; |
1453 |
+@@ -90,6 +114,9 @@ static int brcm_usb_phy_init(struct phy *gphy) |
1454 |
+ struct brcm_usb_phy_data *priv = |
1455 |
+ container_of(phy, struct brcm_usb_phy_data, phys[phy->id]); |
1456 |
+ |
1457 |
++ if (priv->pm_active) |
1458 |
++ return 0; |
1459 |
++ |
1460 |
+ /* |
1461 |
+ * Use a lock to make sure a second caller waits until |
1462 |
+ * the base phy is inited before using it. |
1463 |
+@@ -119,6 +146,9 @@ static int brcm_usb_phy_exit(struct phy *gphy) |
1464 |
+ struct brcm_usb_phy_data *priv = |
1465 |
+ container_of(phy, struct brcm_usb_phy_data, phys[phy->id]); |
1466 |
+ |
1467 |
++ if (priv->pm_active) |
1468 |
++ return 0; |
1469 |
++ |
1470 |
+ dev_dbg(&gphy->dev, "EXIT\n"); |
1471 |
+ if (phy->id == BRCM_USB_PHY_2_0) |
1472 |
+ brcm_usb_uninit_eohci(&priv->ini); |
1473 |
+@@ -484,6 +514,9 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) |
1474 |
+ if (err) |
1475 |
+ return err; |
1476 |
+ |
1477 |
++ priv->pm_notifier.notifier_call = brcm_pm_notifier; |
1478 |
++ register_pm_notifier(&priv->pm_notifier); |
1479 |
++ |
1480 |
+ mutex_init(&priv->mutex); |
1481 |
+ |
1482 |
+ /* make sure invert settings are correct */ |
1483 |
+@@ -524,7 +557,10 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) |
1484 |
+ |
1485 |
+ static int brcm_usb_phy_remove(struct platform_device *pdev) |
1486 |
+ { |
1487 |
++ struct brcm_usb_phy_data *priv = dev_get_drvdata(&pdev->dev); |
1488 |
++ |
1489 |
+ sysfs_remove_group(&pdev->dev.kobj, &brcm_usb_phy_group); |
1490 |
++ unregister_pm_notifier(&priv->pm_notifier); |
1491 |
+ |
1492 |
+ return 0; |
1493 |
+ } |
1494 |
+@@ -535,6 +571,7 @@ static int brcm_usb_phy_suspend(struct device *dev) |
1495 |
+ struct brcm_usb_phy_data *priv = dev_get_drvdata(dev); |
1496 |
+ |
1497 |
+ if (priv->init_count) { |
1498 |
++ dev_dbg(dev, "SUSPEND\n"); |
1499 |
+ priv->ini.wake_enabled = device_may_wakeup(dev); |
1500 |
+ if (priv->phys[BRCM_USB_PHY_3_0].inited) |
1501 |
+ brcm_usb_uninit_xhci(&priv->ini); |
1502 |
+@@ -574,6 +611,7 @@ static int brcm_usb_phy_resume(struct device *dev) |
1503 |
+ * Uninitialize anything that wasn't previously initialized. |
1504 |
+ */ |
1505 |
+ if (priv->init_count) { |
1506 |
++ dev_dbg(dev, "RESUME\n"); |
1507 |
+ if (priv->wake_irq >= 0) |
1508 |
+ disable_irq_wake(priv->wake_irq); |
1509 |
+ brcm_usb_init_common(&priv->ini); |
1510 |
+diff --git a/drivers/platform/x86/intel_speed_select_if/isst_if_common.c b/drivers/platform/x86/intel_speed_select_if/isst_if_common.c |
1511 |
+index 0c2aa22c7a12e..407afafc7e83f 100644 |
1512 |
+--- a/drivers/platform/x86/intel_speed_select_if/isst_if_common.c |
1513 |
++++ b/drivers/platform/x86/intel_speed_select_if/isst_if_common.c |
1514 |
+@@ -532,7 +532,10 @@ static long isst_if_def_ioctl(struct file *file, unsigned int cmd, |
1515 |
+ return ret; |
1516 |
+ } |
1517 |
+ |
1518 |
+-static DEFINE_MUTEX(punit_misc_dev_lock); |
1519 |
++/* Lock to prevent module registration when already opened by user space */ |
1520 |
++static DEFINE_MUTEX(punit_misc_dev_open_lock); |
1521 |
++/* Lock to allow one share misc device for all ISST interace */ |
1522 |
++static DEFINE_MUTEX(punit_misc_dev_reg_lock); |
1523 |
+ static int misc_usage_count; |
1524 |
+ static int misc_device_ret; |
1525 |
+ static int misc_device_open; |
1526 |
+@@ -542,7 +545,7 @@ static int isst_if_open(struct inode *inode, struct file *file) |
1527 |
+ int i, ret = 0; |
1528 |
+ |
1529 |
+ /* Fail open, if a module is going away */ |
1530 |
+- mutex_lock(&punit_misc_dev_lock); |
1531 |
++ mutex_lock(&punit_misc_dev_open_lock); |
1532 |
+ for (i = 0; i < ISST_IF_DEV_MAX; ++i) { |
1533 |
+ struct isst_if_cmd_cb *cb = &punit_callbacks[i]; |
1534 |
+ |
1535 |
+@@ -564,7 +567,7 @@ static int isst_if_open(struct inode *inode, struct file *file) |
1536 |
+ } else { |
1537 |
+ misc_device_open++; |
1538 |
+ } |
1539 |
+- mutex_unlock(&punit_misc_dev_lock); |
1540 |
++ mutex_unlock(&punit_misc_dev_open_lock); |
1541 |
+ |
1542 |
+ return ret; |
1543 |
+ } |
1544 |
+@@ -573,7 +576,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) |
1545 |
+ { |
1546 |
+ int i; |
1547 |
+ |
1548 |
+- mutex_lock(&punit_misc_dev_lock); |
1549 |
++ mutex_lock(&punit_misc_dev_open_lock); |
1550 |
+ misc_device_open--; |
1551 |
+ for (i = 0; i < ISST_IF_DEV_MAX; ++i) { |
1552 |
+ struct isst_if_cmd_cb *cb = &punit_callbacks[i]; |
1553 |
+@@ -581,7 +584,7 @@ static int isst_if_relase(struct inode *inode, struct file *f) |
1554 |
+ if (cb->registered) |
1555 |
+ module_put(cb->owner); |
1556 |
+ } |
1557 |
+- mutex_unlock(&punit_misc_dev_lock); |
1558 |
++ mutex_unlock(&punit_misc_dev_open_lock); |
1559 |
+ |
1560 |
+ return 0; |
1561 |
+ } |
1562 |
+@@ -598,6 +601,43 @@ static struct miscdevice isst_if_char_driver = { |
1563 |
+ .fops = &isst_if_char_driver_ops, |
1564 |
+ }; |
1565 |
+ |
1566 |
++static int isst_misc_reg(void) |
1567 |
++{ |
1568 |
++ mutex_lock(&punit_misc_dev_reg_lock); |
1569 |
++ if (misc_device_ret) |
1570 |
++ goto unlock_exit; |
1571 |
++ |
1572 |
++ if (!misc_usage_count) { |
1573 |
++ misc_device_ret = isst_if_cpu_info_init(); |
1574 |
++ if (misc_device_ret) |
1575 |
++ goto unlock_exit; |
1576 |
++ |
1577 |
++ misc_device_ret = misc_register(&isst_if_char_driver); |
1578 |
++ if (misc_device_ret) { |
1579 |
++ isst_if_cpu_info_exit(); |
1580 |
++ goto unlock_exit; |
1581 |
++ } |
1582 |
++ } |
1583 |
++ misc_usage_count++; |
1584 |
++ |
1585 |
++unlock_exit: |
1586 |
++ mutex_unlock(&punit_misc_dev_reg_lock); |
1587 |
++ |
1588 |
++ return misc_device_ret; |
1589 |
++} |
1590 |
++ |
1591 |
++static void isst_misc_unreg(void) |
1592 |
++{ |
1593 |
++ mutex_lock(&punit_misc_dev_reg_lock); |
1594 |
++ if (misc_usage_count) |
1595 |
++ misc_usage_count--; |
1596 |
++ if (!misc_usage_count && !misc_device_ret) { |
1597 |
++ misc_deregister(&isst_if_char_driver); |
1598 |
++ isst_if_cpu_info_exit(); |
1599 |
++ } |
1600 |
++ mutex_unlock(&punit_misc_dev_reg_lock); |
1601 |
++} |
1602 |
++ |
1603 |
+ /** |
1604 |
+ * isst_if_cdev_register() - Register callback for IOCTL |
1605 |
+ * @device_type: The device type this callback handling. |
1606 |
+@@ -615,38 +655,31 @@ static struct miscdevice isst_if_char_driver = { |
1607 |
+ */ |
1608 |
+ int isst_if_cdev_register(int device_type, struct isst_if_cmd_cb *cb) |
1609 |
+ { |
1610 |
+- if (misc_device_ret) |
1611 |
+- return misc_device_ret; |
1612 |
++ int ret; |
1613 |
+ |
1614 |
+ if (device_type >= ISST_IF_DEV_MAX) |
1615 |
+ return -EINVAL; |
1616 |
+ |
1617 |
+- mutex_lock(&punit_misc_dev_lock); |
1618 |
++ mutex_lock(&punit_misc_dev_open_lock); |
1619 |
++ /* Device is already open, we don't want to add new callbacks */ |
1620 |
+ if (misc_device_open) { |
1621 |
+- mutex_unlock(&punit_misc_dev_lock); |
1622 |
++ mutex_unlock(&punit_misc_dev_open_lock); |
1623 |
+ return -EAGAIN; |
1624 |
+ } |
1625 |
+- if (!misc_usage_count) { |
1626 |
+- int ret; |
1627 |
+- |
1628 |
+- misc_device_ret = misc_register(&isst_if_char_driver); |
1629 |
+- if (misc_device_ret) |
1630 |
+- goto unlock_exit; |
1631 |
+- |
1632 |
+- ret = isst_if_cpu_info_init(); |
1633 |
+- if (ret) { |
1634 |
+- misc_deregister(&isst_if_char_driver); |
1635 |
+- misc_device_ret = ret; |
1636 |
+- goto unlock_exit; |
1637 |
+- } |
1638 |
+- } |
1639 |
+ memcpy(&punit_callbacks[device_type], cb, sizeof(*cb)); |
1640 |
+ punit_callbacks[device_type].registered = 1; |
1641 |
+- misc_usage_count++; |
1642 |
+-unlock_exit: |
1643 |
+- mutex_unlock(&punit_misc_dev_lock); |
1644 |
++ mutex_unlock(&punit_misc_dev_open_lock); |
1645 |
+ |
1646 |
+- return misc_device_ret; |
1647 |
++ ret = isst_misc_reg(); |
1648 |
++ if (ret) { |
1649 |
++ /* |
1650 |
++ * No need of mutex as the misc device register failed |
1651 |
++ * as no one can open device yet. Hence no contention. |
1652 |
++ */ |
1653 |
++ punit_callbacks[device_type].registered = 0; |
1654 |
++ return ret; |
1655 |
++ } |
1656 |
++ return 0; |
1657 |
+ } |
1658 |
+ EXPORT_SYMBOL_GPL(isst_if_cdev_register); |
1659 |
+ |
1660 |
+@@ -661,16 +694,12 @@ EXPORT_SYMBOL_GPL(isst_if_cdev_register); |
1661 |
+ */ |
1662 |
+ void isst_if_cdev_unregister(int device_type) |
1663 |
+ { |
1664 |
+- mutex_lock(&punit_misc_dev_lock); |
1665 |
+- misc_usage_count--; |
1666 |
++ isst_misc_unreg(); |
1667 |
++ mutex_lock(&punit_misc_dev_open_lock); |
1668 |
+ punit_callbacks[device_type].registered = 0; |
1669 |
+ if (device_type == ISST_IF_DEV_MBOX) |
1670 |
+ isst_delete_hash(); |
1671 |
+- if (!misc_usage_count && !misc_device_ret) { |
1672 |
+- misc_deregister(&isst_if_char_driver); |
1673 |
+- isst_if_cpu_info_exit(); |
1674 |
+- } |
1675 |
+- mutex_unlock(&punit_misc_dev_lock); |
1676 |
++ mutex_unlock(&punit_misc_dev_open_lock); |
1677 |
+ } |
1678 |
+ EXPORT_SYMBOL_GPL(isst_if_cdev_unregister); |
1679 |
+ |
1680 |
+diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c |
1681 |
+index 59b7e90cd5875..ab6a9369649db 100644 |
1682 |
+--- a/drivers/platform/x86/touchscreen_dmi.c |
1683 |
++++ b/drivers/platform/x86/touchscreen_dmi.c |
1684 |
+@@ -756,6 +756,21 @@ static const struct ts_dmi_data predia_basic_data = { |
1685 |
+ .properties = predia_basic_props, |
1686 |
+ }; |
1687 |
+ |
1688 |
++static const struct property_entry rwc_nanote_p8_props[] = { |
1689 |
++ PROPERTY_ENTRY_U32("touchscreen-min-y", 46), |
1690 |
++ PROPERTY_ENTRY_U32("touchscreen-size-x", 1728), |
1691 |
++ PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), |
1692 |
++ PROPERTY_ENTRY_BOOL("touchscreen-inverted-y"), |
1693 |
++ PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-rwc-nanote-p8.fw"), |
1694 |
++ PROPERTY_ENTRY_U32("silead,max-fingers", 10), |
1695 |
++ { } |
1696 |
++}; |
1697 |
++ |
1698 |
++static const struct ts_dmi_data rwc_nanote_p8_data = { |
1699 |
++ .acpi_name = "MSSL1680:00", |
1700 |
++ .properties = rwc_nanote_p8_props, |
1701 |
++}; |
1702 |
++ |
1703 |
+ static const struct property_entry schneider_sct101ctm_props[] = { |
1704 |
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1715), |
1705 |
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1140), |
1706 |
+@@ -1326,6 +1341,15 @@ const struct dmi_system_id touchscreen_dmi_table[] = { |
1707 |
+ DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), |
1708 |
+ }, |
1709 |
+ }, |
1710 |
++ { |
1711 |
++ /* RWC NANOTE P8 */ |
1712 |
++ .driver_data = (void *)&rwc_nanote_p8_data, |
1713 |
++ .matches = { |
1714 |
++ DMI_MATCH(DMI_BOARD_VENDOR, "Default string"), |
1715 |
++ DMI_MATCH(DMI_PRODUCT_NAME, "AY07J"), |
1716 |
++ DMI_MATCH(DMI_PRODUCT_SKU, "0001") |
1717 |
++ }, |
1718 |
++ }, |
1719 |
+ { |
1720 |
+ /* Schneider SCT101CTM */ |
1721 |
+ .driver_data = (void *)&schneider_sct101ctm_data, |
1722 |
+diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h |
1723 |
+index d1894539efc30..03bc472f302a2 100644 |
1724 |
+--- a/drivers/scsi/lpfc/lpfc.h |
1725 |
++++ b/drivers/scsi/lpfc/lpfc.h |
1726 |
+@@ -374,6 +374,7 @@ struct lpfc_vport { |
1727 |
+ #define FC_VPORT_LOGO_RCVD 0x200 /* LOGO received on vport */ |
1728 |
+ #define FC_RSCN_DISCOVERY 0x400 /* Auth all devices after RSCN */ |
1729 |
+ #define FC_LOGO_RCVD_DID_CHNG 0x800 /* FDISC on phys port detect DID chng*/ |
1730 |
++#define FC_PT2PT_NO_NVME 0x1000 /* Don't send NVME PRLI */ |
1731 |
+ #define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */ |
1732 |
+ #define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */ |
1733 |
+ #define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */ |
1734 |
+diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c |
1735 |
+index b73d5d9494021..f0d1ced630162 100644 |
1736 |
+--- a/drivers/scsi/lpfc/lpfc_attr.c |
1737 |
++++ b/drivers/scsi/lpfc/lpfc_attr.c |
1738 |
+@@ -1142,6 +1142,9 @@ lpfc_issue_lip(struct Scsi_Host *shost) |
1739 |
+ pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; |
1740 |
+ pmboxq->u.mb.mbxOwner = OWN_HOST; |
1741 |
+ |
1742 |
++ if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME)) |
1743 |
++ vport->fc_flag &= ~FC_PT2PT_NO_NVME; |
1744 |
++ |
1745 |
+ mbxstatus = lpfc_sli_issue_mbox_wait(phba, pmboxq, LPFC_MBOX_TMO * 2); |
1746 |
+ |
1747 |
+ if ((mbxstatus == MBX_SUCCESS) && |
1748 |
+diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
1749 |
+index 3d9889b3d5c8a..387b0cd1ea18f 100644 |
1750 |
+--- a/drivers/scsi/lpfc/lpfc_els.c |
1751 |
++++ b/drivers/scsi/lpfc/lpfc_els.c |
1752 |
+@@ -1067,7 +1067,8 @@ stop_rr_fcf_flogi: |
1753 |
+ |
1754 |
+ /* FLOGI failed, so there is no fabric */ |
1755 |
+ spin_lock_irq(shost->host_lock); |
1756 |
+- vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); |
1757 |
++ vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP | |
1758 |
++ FC_PT2PT_NO_NVME); |
1759 |
+ spin_unlock_irq(shost->host_lock); |
1760 |
+ |
1761 |
+ /* If private loop, then allow max outstanding els to be |
1762 |
+@@ -3945,6 +3946,23 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
1763 |
+ /* Added for Vendor specifc support |
1764 |
+ * Just keep retrying for these Rsn / Exp codes |
1765 |
+ */ |
1766 |
++ if ((vport->fc_flag & FC_PT2PT) && |
1767 |
++ cmd == ELS_CMD_NVMEPRLI) { |
1768 |
++ switch (stat.un.b.lsRjtRsnCode) { |
1769 |
++ case LSRJT_UNABLE_TPC: |
1770 |
++ case LSRJT_INVALID_CMD: |
1771 |
++ case LSRJT_LOGICAL_ERR: |
1772 |
++ case LSRJT_CMD_UNSUPPORTED: |
1773 |
++ lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS, |
1774 |
++ "0168 NVME PRLI LS_RJT " |
1775 |
++ "reason %x port doesn't " |
1776 |
++ "support NVME, disabling NVME\n", |
1777 |
++ stat.un.b.lsRjtRsnCode); |
1778 |
++ retry = 0; |
1779 |
++ vport->fc_flag |= FC_PT2PT_NO_NVME; |
1780 |
++ goto out_retry; |
1781 |
++ } |
1782 |
++ } |
1783 |
+ switch (stat.un.b.lsRjtRsnCode) { |
1784 |
+ case LSRJT_UNABLE_TPC: |
1785 |
+ /* The driver has a VALID PLOGI but the rport has |
1786 |
+diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1787 |
+index 6afcb1426e357..e33f752318c19 100644 |
1788 |
+--- a/drivers/scsi/lpfc/lpfc_nportdisc.c |
1789 |
++++ b/drivers/scsi/lpfc/lpfc_nportdisc.c |
1790 |
+@@ -2010,8 +2010,9 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport, |
1791 |
+ * is configured try it. |
1792 |
+ */ |
1793 |
+ ndlp->nlp_fc4_type |= NLP_FC4_FCP; |
1794 |
+- if ((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || |
1795 |
+- (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { |
1796 |
++ if ((!(vport->fc_flag & FC_PT2PT_NO_NVME)) && |
1797 |
++ (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || |
1798 |
++ vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) { |
1799 |
+ ndlp->nlp_fc4_type |= NLP_FC4_NVME; |
1800 |
+ /* We need to update the localport also */ |
1801 |
+ lpfc_nvme_update_localport(vport); |
1802 |
+diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c |
1803 |
+index 4587127b67f7b..a50f870c5f725 100644 |
1804 |
+--- a/drivers/scsi/lpfc/lpfc_sli.c |
1805 |
++++ b/drivers/scsi/lpfc/lpfc_sli.c |
1806 |
+@@ -7372,6 +7372,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) |
1807 |
+ struct lpfc_vport *vport = phba->pport; |
1808 |
+ struct lpfc_dmabuf *mp; |
1809 |
+ struct lpfc_rqb *rqbp; |
1810 |
++ u32 flg; |
1811 |
+ |
1812 |
+ /* Perform a PCI function reset to start from clean */ |
1813 |
+ rc = lpfc_pci_function_reset(phba); |
1814 |
+@@ -7385,7 +7386,17 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) |
1815 |
+ else { |
1816 |
+ spin_lock_irq(&phba->hbalock); |
1817 |
+ phba->sli.sli_flag |= LPFC_SLI_ACTIVE; |
1818 |
++ flg = phba->sli.sli_flag; |
1819 |
+ spin_unlock_irq(&phba->hbalock); |
1820 |
++ /* Allow a little time after setting SLI_ACTIVE for any polled |
1821 |
++ * MBX commands to complete via BSG. |
1822 |
++ */ |
1823 |
++ for (i = 0; i < 50 && (flg & LPFC_SLI_MBOX_ACTIVE); i++) { |
1824 |
++ msleep(20); |
1825 |
++ spin_lock_irq(&phba->hbalock); |
1826 |
++ flg = phba->sli.sli_flag; |
1827 |
++ spin_unlock_irq(&phba->hbalock); |
1828 |
++ } |
1829 |
+ } |
1830 |
+ |
1831 |
+ lpfc_sli4_dip(phba); |
1832 |
+@@ -8922,7 +8933,7 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, |
1833 |
+ "(%d):2541 Mailbox command x%x " |
1834 |
+ "(x%x/x%x) failure: " |
1835 |
+ "mqe_sta: x%x mcqe_sta: x%x/x%x " |
1836 |
+- "Data: x%x x%x\n,", |
1837 |
++ "Data: x%x x%x\n", |
1838 |
+ mboxq->vport ? mboxq->vport->vpi : 0, |
1839 |
+ mboxq->u.mb.mbxCommand, |
1840 |
+ lpfc_sli_config_mbox_subsys_get(phba, |
1841 |
+@@ -8956,7 +8967,7 @@ lpfc_sli_issue_mbox_s4(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq, |
1842 |
+ "(%d):2597 Sync Mailbox command " |
1843 |
+ "x%x (x%x/x%x) failure: " |
1844 |
+ "mqe_sta: x%x mcqe_sta: x%x/x%x " |
1845 |
+- "Data: x%x x%x\n,", |
1846 |
++ "Data: x%x x%x\n", |
1847 |
+ mboxq->vport ? mboxq->vport->vpi : 0, |
1848 |
+ mboxq->u.mb.mbxCommand, |
1849 |
+ lpfc_sli_config_mbox_subsys_get(phba, |
1850 |
+diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c |
1851 |
+index c3bb58885033b..75ac4d86d9c4b 100644 |
1852 |
+--- a/drivers/scsi/pm8001/pm8001_sas.c |
1853 |
++++ b/drivers/scsi/pm8001/pm8001_sas.c |
1854 |
+@@ -753,8 +753,13 @@ static int pm8001_exec_internal_tmf_task(struct domain_device *dev, |
1855 |
+ res = -TMF_RESP_FUNC_FAILED; |
1856 |
+ /* Even TMF timed out, return direct. */ |
1857 |
+ if (task->task_state_flags & SAS_TASK_STATE_ABORTED) { |
1858 |
++ struct pm8001_ccb_info *ccb = task->lldd_task; |
1859 |
++ |
1860 |
+ pm8001_dbg(pm8001_ha, FAIL, "TMF task[%x]timeout.\n", |
1861 |
+ tmf->tmf); |
1862 |
++ |
1863 |
++ if (ccb) |
1864 |
++ ccb->task = NULL; |
1865 |
+ goto ex_err; |
1866 |
+ } |
1867 |
+ |
1868 |
+diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c |
1869 |
+index b22a8ab754faa..2a3ce4680734b 100644 |
1870 |
+--- a/drivers/scsi/pm8001/pm80xx_hwi.c |
1871 |
++++ b/drivers/scsi/pm8001/pm80xx_hwi.c |
1872 |
+@@ -2133,9 +2133,9 @@ mpi_ssp_completion(struct pm8001_hba_info *pm8001_ha , void *piomb) |
1873 |
+ pm8001_dbg(pm8001_ha, FAIL, |
1874 |
+ "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n", |
1875 |
+ t, status, ts->resp, ts->stat); |
1876 |
++ pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1877 |
+ if (t->slow_task) |
1878 |
+ complete(&t->slow_task->completion); |
1879 |
+- pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1880 |
+ } else { |
1881 |
+ spin_unlock_irqrestore(&t->task_state_lock, flags); |
1882 |
+ pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1883 |
+@@ -2726,9 +2726,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) |
1884 |
+ pm8001_dbg(pm8001_ha, FAIL, |
1885 |
+ "task 0x%p done with io_status 0x%x resp 0x%x stat 0x%x but aborted by upper layer!\n", |
1886 |
+ t, status, ts->resp, ts->stat); |
1887 |
++ pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1888 |
+ if (t->slow_task) |
1889 |
+ complete(&t->slow_task->completion); |
1890 |
+- pm8001_ccb_task_free(pm8001_ha, t, ccb, tag); |
1891 |
+ } else { |
1892 |
+ spin_unlock_irqrestore(&t->task_state_lock, flags); |
1893 |
+ pm8001_ccb_task_free_done(pm8001_ha, t, ccb, tag); |
1894 |
+diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c |
1895 |
+index 040c7dc1d4792..71b555c715d2e 100644 |
1896 |
+--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c |
1897 |
++++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c |
1898 |
+@@ -251,10 +251,9 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev) |
1899 |
+ } |
1900 |
+ |
1901 |
+ lpc_ctrl->clk = devm_clk_get(dev, NULL); |
1902 |
+- if (IS_ERR(lpc_ctrl->clk)) { |
1903 |
+- dev_err(dev, "couldn't get clock\n"); |
1904 |
+- return PTR_ERR(lpc_ctrl->clk); |
1905 |
+- } |
1906 |
++ if (IS_ERR(lpc_ctrl->clk)) |
1907 |
++ return dev_err_probe(dev, PTR_ERR(lpc_ctrl->clk), |
1908 |
++ "couldn't get clock\n"); |
1909 |
+ rc = clk_prepare_enable(lpc_ctrl->clk); |
1910 |
+ if (rc) { |
1911 |
+ dev_err(dev, "couldn't enable clock\n"); |
1912 |
+diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c |
1913 |
+index 128461bd04bb9..58190135efb7d 100644 |
1914 |
+--- a/drivers/tty/n_tty.c |
1915 |
++++ b/drivers/tty/n_tty.c |
1916 |
+@@ -2024,7 +2024,7 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, |
1917 |
+ return false; |
1918 |
+ |
1919 |
+ canon_head = smp_load_acquire(&ldata->canon_head); |
1920 |
+- n = min(*nr + 1, canon_head - ldata->read_tail); |
1921 |
++ n = min(*nr, canon_head - ldata->read_tail); |
1922 |
+ |
1923 |
+ tail = ldata->read_tail & (N_TTY_BUF_SIZE - 1); |
1924 |
+ size = min_t(size_t, tail + n, N_TTY_BUF_SIZE); |
1925 |
+@@ -2046,10 +2046,8 @@ static bool canon_copy_from_read_buf(struct tty_struct *tty, |
1926 |
+ n += N_TTY_BUF_SIZE; |
1927 |
+ c = n + found; |
1928 |
+ |
1929 |
+- if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) { |
1930 |
+- c = min(*nr, c); |
1931 |
++ if (!found || read_buf(ldata, eol) != __DISABLED_CHAR) |
1932 |
+ n = c; |
1933 |
+- } |
1934 |
+ |
1935 |
+ n_tty_trace("%s: eol:%zu found:%d n:%zu c:%zu tail:%zu more:%zu\n", |
1936 |
+ __func__, eol, found, n, c, tail, more); |
1937 |
+diff --git a/drivers/tty/serial/8250/8250_gsc.c b/drivers/tty/serial/8250/8250_gsc.c |
1938 |
+index 673cda3d011d0..948d0a1c6ae8e 100644 |
1939 |
+--- a/drivers/tty/serial/8250/8250_gsc.c |
1940 |
++++ b/drivers/tty/serial/8250/8250_gsc.c |
1941 |
+@@ -26,7 +26,7 @@ static int __init serial_init_chip(struct parisc_device *dev) |
1942 |
+ unsigned long address; |
1943 |
+ int err; |
1944 |
+ |
1945 |
+-#ifdef CONFIG_64BIT |
1946 |
++#if defined(CONFIG_64BIT) && defined(CONFIG_IOSAPIC) |
1947 |
+ if (!dev->irq && (dev->id.sversion == 0xad)) |
1948 |
+ dev->irq = iosapic_serial_irq(dev); |
1949 |
+ #endif |
1950 |
+diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c |
1951 |
+index 10f020ab1186f..6b80dee17f49d 100644 |
1952 |
+--- a/fs/btrfs/send.c |
1953 |
++++ b/fs/btrfs/send.c |
1954 |
+@@ -5006,6 +5006,10 @@ static int put_file_data(struct send_ctx *sctx, u64 offset, u32 len) |
1955 |
+ lock_page(page); |
1956 |
+ if (!PageUptodate(page)) { |
1957 |
+ unlock_page(page); |
1958 |
++ btrfs_err(fs_info, |
1959 |
++ "send: IO error at offset %llu for inode %llu root %llu", |
1960 |
++ page_offset(page), sctx->cur_ino, |
1961 |
++ sctx->send_root->root_key.objectid); |
1962 |
+ put_page(page); |
1963 |
+ ret = -EIO; |
1964 |
+ break; |
1965 |
+diff --git a/fs/file.c b/fs/file.c |
1966 |
+index 9d02352fa18c3..79a76d04c7c33 100644 |
1967 |
+--- a/fs/file.c |
1968 |
++++ b/fs/file.c |
1969 |
+@@ -817,28 +817,68 @@ void do_close_on_exec(struct files_struct *files) |
1970 |
+ spin_unlock(&files->file_lock); |
1971 |
+ } |
1972 |
+ |
1973 |
+-static struct file *__fget_files(struct files_struct *files, unsigned int fd, |
1974 |
+- fmode_t mask, unsigned int refs) |
1975 |
++static inline struct file *__fget_files_rcu(struct files_struct *files, |
1976 |
++ unsigned int fd, fmode_t mask, unsigned int refs) |
1977 |
+ { |
1978 |
+- struct file *file; |
1979 |
++ for (;;) { |
1980 |
++ struct file *file; |
1981 |
++ struct fdtable *fdt = rcu_dereference_raw(files->fdt); |
1982 |
++ struct file __rcu **fdentry; |
1983 |
+ |
1984 |
+- rcu_read_lock(); |
1985 |
+-loop: |
1986 |
+- file = fcheck_files(files, fd); |
1987 |
+- if (file) { |
1988 |
+- /* File object ref couldn't be taken. |
1989 |
+- * dup2() atomicity guarantee is the reason |
1990 |
+- * we loop to catch the new file (or NULL pointer) |
1991 |
++ if (unlikely(fd >= fdt->max_fds)) |
1992 |
++ return NULL; |
1993 |
++ |
1994 |
++ fdentry = fdt->fd + array_index_nospec(fd, fdt->max_fds); |
1995 |
++ file = rcu_dereference_raw(*fdentry); |
1996 |
++ if (unlikely(!file)) |
1997 |
++ return NULL; |
1998 |
++ |
1999 |
++ if (unlikely(file->f_mode & mask)) |
2000 |
++ return NULL; |
2001 |
++ |
2002 |
++ /* |
2003 |
++ * Ok, we have a file pointer. However, because we do |
2004 |
++ * this all locklessly under RCU, we may be racing with |
2005 |
++ * that file being closed. |
2006 |
++ * |
2007 |
++ * Such a race can take two forms: |
2008 |
++ * |
2009 |
++ * (a) the file ref already went down to zero, |
2010 |
++ * and get_file_rcu_many() fails. Just try |
2011 |
++ * again: |
2012 |
+ */ |
2013 |
+- if (file->f_mode & mask) |
2014 |
+- file = NULL; |
2015 |
+- else if (!get_file_rcu_many(file, refs)) |
2016 |
+- goto loop; |
2017 |
+- else if (__fcheck_files(files, fd) != file) { |
2018 |
++ if (unlikely(!get_file_rcu_many(file, refs))) |
2019 |
++ continue; |
2020 |
++ |
2021 |
++ /* |
2022 |
++ * (b) the file table entry has changed under us. |
2023 |
++ * Note that we don't need to re-check the 'fdt->fd' |
2024 |
++ * pointer having changed, because it always goes |
2025 |
++ * hand-in-hand with 'fdt'. |
2026 |
++ * |
2027 |
++ * If so, we need to put our refs and try again. |
2028 |
++ */ |
2029 |
++ if (unlikely(rcu_dereference_raw(files->fdt) != fdt) || |
2030 |
++ unlikely(rcu_dereference_raw(*fdentry) != file)) { |
2031 |
+ fput_many(file, refs); |
2032 |
+- goto loop; |
2033 |
++ continue; |
2034 |
+ } |
2035 |
++ |
2036 |
++ /* |
2037 |
++ * Ok, we have a ref to the file, and checked that it |
2038 |
++ * still exists. |
2039 |
++ */ |
2040 |
++ return file; |
2041 |
+ } |
2042 |
++} |
2043 |
++ |
2044 |
++static struct file *__fget_files(struct files_struct *files, unsigned int fd, |
2045 |
++ fmode_t mask, unsigned int refs) |
2046 |
++{ |
2047 |
++ struct file *file; |
2048 |
++ |
2049 |
++ rcu_read_lock(); |
2050 |
++ file = __fget_files_rcu(files, fd, mask, refs); |
2051 |
+ rcu_read_unlock(); |
2052 |
+ |
2053 |
+ return file; |
2054 |
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
2055 |
+index 682c7b45d8b71..2ad56ff4752c7 100644 |
2056 |
+--- a/fs/nfs/dir.c |
2057 |
++++ b/fs/nfs/dir.c |
2058 |
+@@ -1780,14 +1780,14 @@ no_open: |
2059 |
+ if (!res) { |
2060 |
+ inode = d_inode(dentry); |
2061 |
+ if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
2062 |
+- !S_ISDIR(inode->i_mode)) |
2063 |
++ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) |
2064 |
+ res = ERR_PTR(-ENOTDIR); |
2065 |
+ else if (inode && S_ISREG(inode->i_mode)) |
2066 |
+ res = ERR_PTR(-EOPENSTALE); |
2067 |
+ } else if (!IS_ERR(res)) { |
2068 |
+ inode = d_inode(res); |
2069 |
+ if ((lookup_flags & LOOKUP_DIRECTORY) && inode && |
2070 |
+- !S_ISDIR(inode->i_mode)) { |
2071 |
++ !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) { |
2072 |
+ dput(res); |
2073 |
+ res = ERR_PTR(-ENOTDIR); |
2074 |
+ } else if (inode && S_ISREG(inode->i_mode)) { |
2075 |
+diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c |
2076 |
+index 21addb78523d2..f27ecc2e490f2 100644 |
2077 |
+--- a/fs/nfs/inode.c |
2078 |
++++ b/fs/nfs/inode.c |
2079 |
+@@ -195,6 +195,18 @@ bool nfs_check_cache_invalid(struct inode *inode, unsigned long flags) |
2080 |
+ } |
2081 |
+ EXPORT_SYMBOL_GPL(nfs_check_cache_invalid); |
2082 |
+ |
2083 |
++#ifdef CONFIG_NFS_V4_2 |
2084 |
++static bool nfs_has_xattr_cache(const struct nfs_inode *nfsi) |
2085 |
++{ |
2086 |
++ return nfsi->xattr_cache != NULL; |
2087 |
++} |
2088 |
++#else |
2089 |
++static bool nfs_has_xattr_cache(const struct nfs_inode *nfsi) |
2090 |
++{ |
2091 |
++ return false; |
2092 |
++} |
2093 |
++#endif |
2094 |
++ |
2095 |
+ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) |
2096 |
+ { |
2097 |
+ struct nfs_inode *nfsi = NFS_I(inode); |
2098 |
+@@ -210,6 +222,8 @@ static void nfs_set_cache_invalid(struct inode *inode, unsigned long flags) |
2099 |
+ } else if (flags & NFS_INO_REVAL_PAGECACHE) |
2100 |
+ flags |= NFS_INO_INVALID_CHANGE | NFS_INO_INVALID_SIZE; |
2101 |
+ |
2102 |
++ if (!nfs_has_xattr_cache(nfsi)) |
2103 |
++ flags &= ~NFS_INO_INVALID_XATTR; |
2104 |
+ if (inode->i_mapping->nrpages == 0) |
2105 |
+ flags &= ~(NFS_INO_INVALID_DATA|NFS_INO_DATA_INVAL_DEFER); |
2106 |
+ nfsi->cache_validity |= flags; |
2107 |
+@@ -807,12 +821,9 @@ int nfs_getattr(const struct path *path, struct kstat *stat, |
2108 |
+ } |
2109 |
+ |
2110 |
+ /* Flush out writes to the server in order to update c/mtime. */ |
2111 |
+- if ((request_mask & (STATX_CTIME|STATX_MTIME)) && |
2112 |
+- S_ISREG(inode->i_mode)) { |
2113 |
+- err = filemap_write_and_wait(inode->i_mapping); |
2114 |
+- if (err) |
2115 |
+- goto out; |
2116 |
+- } |
2117 |
++ if ((request_mask & (STATX_CTIME | STATX_MTIME)) && |
2118 |
++ S_ISREG(inode->i_mode)) |
2119 |
++ filemap_write_and_wait(inode->i_mapping); |
2120 |
+ |
2121 |
+ /* |
2122 |
+ * We may force a getattr if the user cares about atime. |
2123 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
2124 |
+index 3931f60e421f7..ba98371e9d164 100644 |
2125 |
+--- a/fs/proc/task_mmu.c |
2126 |
++++ b/fs/proc/task_mmu.c |
2127 |
+@@ -430,7 +430,8 @@ static void smaps_page_accumulate(struct mem_size_stats *mss, |
2128 |
+ } |
2129 |
+ |
2130 |
+ static void smaps_account(struct mem_size_stats *mss, struct page *page, |
2131 |
+- bool compound, bool young, bool dirty, bool locked) |
2132 |
++ bool compound, bool young, bool dirty, bool locked, |
2133 |
++ bool migration) |
2134 |
+ { |
2135 |
+ int i, nr = compound ? compound_nr(page) : 1; |
2136 |
+ unsigned long size = nr * PAGE_SIZE; |
2137 |
+@@ -457,8 +458,15 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, |
2138 |
+ * page_count(page) == 1 guarantees the page is mapped exactly once. |
2139 |
+ * If any subpage of the compound page mapped with PTE it would elevate |
2140 |
+ * page_count(). |
2141 |
++ * |
2142 |
++ * The page_mapcount() is called to get a snapshot of the mapcount. |
2143 |
++ * Without holding the page lock this snapshot can be slightly wrong as |
2144 |
++ * we cannot always read the mapcount atomically. It is not safe to |
2145 |
++ * call page_mapcount() even with PTL held if the page is not mapped, |
2146 |
++ * especially for migration entries. Treat regular migration entries |
2147 |
++ * as mapcount == 1. |
2148 |
+ */ |
2149 |
+- if (page_count(page) == 1) { |
2150 |
++ if ((page_count(page) == 1) || migration) { |
2151 |
+ smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, |
2152 |
+ locked, true); |
2153 |
+ return; |
2154 |
+@@ -495,6 +503,7 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, |
2155 |
+ struct vm_area_struct *vma = walk->vma; |
2156 |
+ bool locked = !!(vma->vm_flags & VM_LOCKED); |
2157 |
+ struct page *page = NULL; |
2158 |
++ bool migration = false; |
2159 |
+ |
2160 |
+ if (pte_present(*pte)) { |
2161 |
+ page = vm_normal_page(vma, addr, *pte); |
2162 |
+@@ -514,9 +523,10 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, |
2163 |
+ } else { |
2164 |
+ mss->swap_pss += (u64)PAGE_SIZE << PSS_SHIFT; |
2165 |
+ } |
2166 |
+- } else if (is_migration_entry(swpent)) |
2167 |
++ } else if (is_migration_entry(swpent)) { |
2168 |
++ migration = true; |
2169 |
+ page = migration_entry_to_page(swpent); |
2170 |
+- else if (is_device_private_entry(swpent)) |
2171 |
++ } else if (is_device_private_entry(swpent)) |
2172 |
+ page = device_private_entry_to_page(swpent); |
2173 |
+ } else if (unlikely(IS_ENABLED(CONFIG_SHMEM) && mss->check_shmem_swap |
2174 |
+ && pte_none(*pte))) { |
2175 |
+@@ -530,7 +540,8 @@ static void smaps_pte_entry(pte_t *pte, unsigned long addr, |
2176 |
+ if (!page) |
2177 |
+ return; |
2178 |
+ |
2179 |
+- smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), locked); |
2180 |
++ smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), |
2181 |
++ locked, migration); |
2182 |
+ } |
2183 |
+ |
2184 |
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2185 |
+@@ -541,6 +552,7 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2186 |
+ struct vm_area_struct *vma = walk->vma; |
2187 |
+ bool locked = !!(vma->vm_flags & VM_LOCKED); |
2188 |
+ struct page *page = NULL; |
2189 |
++ bool migration = false; |
2190 |
+ |
2191 |
+ if (pmd_present(*pmd)) { |
2192 |
+ /* FOLL_DUMP will return -EFAULT on huge zero page */ |
2193 |
+@@ -548,8 +560,10 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2194 |
+ } else if (unlikely(thp_migration_supported() && is_swap_pmd(*pmd))) { |
2195 |
+ swp_entry_t entry = pmd_to_swp_entry(*pmd); |
2196 |
+ |
2197 |
+- if (is_migration_entry(entry)) |
2198 |
++ if (is_migration_entry(entry)) { |
2199 |
++ migration = true; |
2200 |
+ page = migration_entry_to_page(entry); |
2201 |
++ } |
2202 |
+ } |
2203 |
+ if (IS_ERR_OR_NULL(page)) |
2204 |
+ return; |
2205 |
+@@ -561,7 +575,9 @@ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2206 |
+ /* pass */; |
2207 |
+ else |
2208 |
+ mss->file_thp += HPAGE_PMD_SIZE; |
2209 |
+- smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked); |
2210 |
++ |
2211 |
++ smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), |
2212 |
++ locked, migration); |
2213 |
+ } |
2214 |
+ #else |
2215 |
+ static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, |
2216 |
+@@ -1366,6 +1382,7 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, |
2217 |
+ { |
2218 |
+ u64 frame = 0, flags = 0; |
2219 |
+ struct page *page = NULL; |
2220 |
++ bool migration = false; |
2221 |
+ |
2222 |
+ if (pte_present(pte)) { |
2223 |
+ if (pm->show_pfn) |
2224 |
+@@ -1383,8 +1400,10 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, |
2225 |
+ frame = swp_type(entry) | |
2226 |
+ (swp_offset(entry) << MAX_SWAPFILES_SHIFT); |
2227 |
+ flags |= PM_SWAP; |
2228 |
+- if (is_migration_entry(entry)) |
2229 |
++ if (is_migration_entry(entry)) { |
2230 |
++ migration = true; |
2231 |
+ page = migration_entry_to_page(entry); |
2232 |
++ } |
2233 |
+ |
2234 |
+ if (is_device_private_entry(entry)) |
2235 |
+ page = device_private_entry_to_page(entry); |
2236 |
+@@ -1392,7 +1411,7 @@ static pagemap_entry_t pte_to_pagemap_entry(struct pagemapread *pm, |
2237 |
+ |
2238 |
+ if (page && !PageAnon(page)) |
2239 |
+ flags |= PM_FILE; |
2240 |
+- if (page && page_mapcount(page) == 1) |
2241 |
++ if (page && !migration && page_mapcount(page) == 1) |
2242 |
+ flags |= PM_MMAP_EXCLUSIVE; |
2243 |
+ if (vma->vm_flags & VM_SOFTDIRTY) |
2244 |
+ flags |= PM_SOFT_DIRTY; |
2245 |
+@@ -1408,8 +1427,9 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, |
2246 |
+ spinlock_t *ptl; |
2247 |
+ pte_t *pte, *orig_pte; |
2248 |
+ int err = 0; |
2249 |
+- |
2250 |
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
2251 |
++ bool migration = false; |
2252 |
++ |
2253 |
+ ptl = pmd_trans_huge_lock(pmdp, vma); |
2254 |
+ if (ptl) { |
2255 |
+ u64 flags = 0, frame = 0; |
2256 |
+@@ -1444,11 +1464,12 @@ static int pagemap_pmd_range(pmd_t *pmdp, unsigned long addr, unsigned long end, |
2257 |
+ if (pmd_swp_soft_dirty(pmd)) |
2258 |
+ flags |= PM_SOFT_DIRTY; |
2259 |
+ VM_BUG_ON(!is_pmd_migration_entry(pmd)); |
2260 |
++ migration = is_migration_entry(entry); |
2261 |
+ page = migration_entry_to_page(entry); |
2262 |
+ } |
2263 |
+ #endif |
2264 |
+ |
2265 |
+- if (page && page_mapcount(page) == 1) |
2266 |
++ if (page && !migration && page_mapcount(page) == 1) |
2267 |
+ flags |= PM_MMAP_EXCLUSIVE; |
2268 |
+ |
2269 |
+ for (; addr != end; addr += PAGE_SIZE) { |
2270 |
+diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c |
2271 |
+index 4f13734637660..09fb8459bb5ce 100644 |
2272 |
+--- a/fs/quota/dquot.c |
2273 |
++++ b/fs/quota/dquot.c |
2274 |
+@@ -692,9 +692,14 @@ int dquot_quota_sync(struct super_block *sb, int type) |
2275 |
+ /* This is not very clever (and fast) but currently I don't know about |
2276 |
+ * any other simple way of getting quota data to disk and we must get |
2277 |
+ * them there for userspace to be visible... */ |
2278 |
+- if (sb->s_op->sync_fs) |
2279 |
+- sb->s_op->sync_fs(sb, 1); |
2280 |
+- sync_blockdev(sb->s_bdev); |
2281 |
++ if (sb->s_op->sync_fs) { |
2282 |
++ ret = sb->s_op->sync_fs(sb, 1); |
2283 |
++ if (ret) |
2284 |
++ return ret; |
2285 |
++ } |
2286 |
++ ret = sync_blockdev(sb->s_bdev); |
2287 |
++ if (ret) |
2288 |
++ return ret; |
2289 |
+ |
2290 |
+ /* |
2291 |
+ * Now when everything is written we can discard the pagecache so |
2292 |
+diff --git a/fs/super.c b/fs/super.c |
2293 |
+index 20f1707807bbd..bae3fe80f852e 100644 |
2294 |
+--- a/fs/super.c |
2295 |
++++ b/fs/super.c |
2296 |
+@@ -1667,11 +1667,9 @@ static void lockdep_sb_freeze_acquire(struct super_block *sb) |
2297 |
+ percpu_rwsem_acquire(sb->s_writers.rw_sem + level, 0, _THIS_IP_); |
2298 |
+ } |
2299 |
+ |
2300 |
+-static void sb_freeze_unlock(struct super_block *sb) |
2301 |
++static void sb_freeze_unlock(struct super_block *sb, int level) |
2302 |
+ { |
2303 |
+- int level; |
2304 |
+- |
2305 |
+- for (level = SB_FREEZE_LEVELS - 1; level >= 0; level--) |
2306 |
++ for (level--; level >= 0; level--) |
2307 |
+ percpu_up_write(sb->s_writers.rw_sem + level); |
2308 |
+ } |
2309 |
+ |
2310 |
+@@ -1742,7 +1740,14 @@ int freeze_super(struct super_block *sb) |
2311 |
+ sb_wait_write(sb, SB_FREEZE_PAGEFAULT); |
2312 |
+ |
2313 |
+ /* All writers are done so after syncing there won't be dirty data */ |
2314 |
+- sync_filesystem(sb); |
2315 |
++ ret = sync_filesystem(sb); |
2316 |
++ if (ret) { |
2317 |
++ sb->s_writers.frozen = SB_UNFROZEN; |
2318 |
++ sb_freeze_unlock(sb, SB_FREEZE_PAGEFAULT); |
2319 |
++ wake_up(&sb->s_writers.wait_unfrozen); |
2320 |
++ deactivate_locked_super(sb); |
2321 |
++ return ret; |
2322 |
++ } |
2323 |
+ |
2324 |
+ /* Now wait for internal filesystem counter */ |
2325 |
+ sb->s_writers.frozen = SB_FREEZE_FS; |
2326 |
+@@ -1754,7 +1759,7 @@ int freeze_super(struct super_block *sb) |
2327 |
+ printk(KERN_ERR |
2328 |
+ "VFS:Filesystem freeze failed\n"); |
2329 |
+ sb->s_writers.frozen = SB_UNFROZEN; |
2330 |
+- sb_freeze_unlock(sb); |
2331 |
++ sb_freeze_unlock(sb, SB_FREEZE_FS); |
2332 |
+ wake_up(&sb->s_writers.wait_unfrozen); |
2333 |
+ deactivate_locked_super(sb); |
2334 |
+ return ret; |
2335 |
+@@ -1805,7 +1810,7 @@ static int thaw_super_locked(struct super_block *sb) |
2336 |
+ } |
2337 |
+ |
2338 |
+ sb->s_writers.frozen = SB_UNFROZEN; |
2339 |
+- sb_freeze_unlock(sb); |
2340 |
++ sb_freeze_unlock(sb, SB_FREEZE_FS); |
2341 |
+ out: |
2342 |
+ wake_up(&sb->s_writers.wait_unfrozen); |
2343 |
+ deactivate_locked_super(sb); |
2344 |
+diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h |
2345 |
+index 4b975111b5361..1f467fb620fe1 100644 |
2346 |
+--- a/include/linux/memcontrol.h |
2347 |
++++ b/include/linux/memcontrol.h |
2348 |
+@@ -197,7 +197,7 @@ struct obj_cgroup { |
2349 |
+ struct mem_cgroup *memcg; |
2350 |
+ atomic_t nr_charged_bytes; |
2351 |
+ union { |
2352 |
+- struct list_head list; |
2353 |
++ struct list_head list; /* protected by objcg_lock */ |
2354 |
+ struct rcu_head rcu; |
2355 |
+ }; |
2356 |
+ }; |
2357 |
+@@ -300,7 +300,8 @@ struct mem_cgroup { |
2358 |
+ int kmemcg_id; |
2359 |
+ enum memcg_kmem_state kmem_state; |
2360 |
+ struct obj_cgroup __rcu *objcg; |
2361 |
+- struct list_head objcg_list; /* list of inherited objcgs */ |
2362 |
++ /* list of inherited objcgs, protected by objcg_lock */ |
2363 |
++ struct list_head objcg_list; |
2364 |
+ #endif |
2365 |
+ |
2366 |
+ MEMCG_PADDING(_pad2_); |
2367 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
2368 |
+index fe3155736d635..861f2480c4571 100644 |
2369 |
+--- a/include/linux/netdevice.h |
2370 |
++++ b/include/linux/netdevice.h |
2371 |
+@@ -2061,7 +2061,7 @@ struct net_device { |
2372 |
+ struct netdev_queue *_tx ____cacheline_aligned_in_smp; |
2373 |
+ unsigned int num_tx_queues; |
2374 |
+ unsigned int real_num_tx_queues; |
2375 |
+- struct Qdisc *qdisc; |
2376 |
++ struct Qdisc __rcu *qdisc; |
2377 |
+ unsigned int tx_queue_len; |
2378 |
+ spinlock_t tx_global_lock; |
2379 |
+ |
2380 |
+diff --git a/include/linux/sched.h b/include/linux/sched.h |
2381 |
+index b85b26d9ccefe..f996d1f343bb7 100644 |
2382 |
+--- a/include/linux/sched.h |
2383 |
++++ b/include/linux/sched.h |
2384 |
+@@ -1544,7 +1544,6 @@ extern struct pid *cad_pid; |
2385 |
+ #define PF_MEMALLOC 0x00000800 /* Allocating memory */ |
2386 |
+ #define PF_NPROC_EXCEEDED 0x00001000 /* set_user() noticed that RLIMIT_NPROC was exceeded */ |
2387 |
+ #define PF_USED_MATH 0x00002000 /* If unset the fpu must be initialized before use */ |
2388 |
+-#define PF_USED_ASYNC 0x00004000 /* Used async_schedule*(), used by module init */ |
2389 |
+ #define PF_NOFREEZE 0x00008000 /* This thread should not be frozen */ |
2390 |
+ #define PF_FROZEN 0x00010000 /* Frozen for system suspend */ |
2391 |
+ #define PF_KSWAPD 0x00020000 /* I am kswapd */ |
2392 |
+diff --git a/include/net/bond_3ad.h b/include/net/bond_3ad.h |
2393 |
+index c8696a230b7d9..1a28f299a4c61 100644 |
2394 |
+--- a/include/net/bond_3ad.h |
2395 |
++++ b/include/net/bond_3ad.h |
2396 |
+@@ -262,7 +262,7 @@ struct ad_system { |
2397 |
+ struct ad_bond_info { |
2398 |
+ struct ad_system system; /* 802.3ad system structure */ |
2399 |
+ struct bond_3ad_stats stats; |
2400 |
+- u32 agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */ |
2401 |
++ atomic_t agg_select_timer; /* Timer to select aggregator after all adapter's hand shakes */ |
2402 |
+ u16 aggregator_identifier; |
2403 |
+ }; |
2404 |
+ |
2405 |
+diff --git a/include/net/ipv6.h b/include/net/ipv6.h |
2406 |
+index bd1f396cc9c72..60601896d4747 100644 |
2407 |
+--- a/include/net/ipv6.h |
2408 |
++++ b/include/net/ipv6.h |
2409 |
+@@ -390,17 +390,20 @@ static inline void txopt_put(struct ipv6_txoptions *opt) |
2410 |
+ kfree_rcu(opt, rcu); |
2411 |
+ } |
2412 |
+ |
2413 |
++#if IS_ENABLED(CONFIG_IPV6) |
2414 |
+ struct ip6_flowlabel *__fl6_sock_lookup(struct sock *sk, __be32 label); |
2415 |
+ |
2416 |
+ extern struct static_key_false_deferred ipv6_flowlabel_exclusive; |
2417 |
+ static inline struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, |
2418 |
+ __be32 label) |
2419 |
+ { |
2420 |
+- if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key)) |
2421 |
++ if (static_branch_unlikely(&ipv6_flowlabel_exclusive.key) && |
2422 |
++ READ_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl)) |
2423 |
+ return __fl6_sock_lookup(sk, label) ? : ERR_PTR(-ENOENT); |
2424 |
+ |
2425 |
+ return NULL; |
2426 |
+ } |
2427 |
++#endif |
2428 |
+ |
2429 |
+ struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space, |
2430 |
+ struct ip6_flowlabel *fl, |
2431 |
+diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h |
2432 |
+index 5ec054473d81a..1c0fbe3abf247 100644 |
2433 |
+--- a/include/net/netns/ipv6.h |
2434 |
++++ b/include/net/netns/ipv6.h |
2435 |
+@@ -80,9 +80,10 @@ struct netns_ipv6 { |
2436 |
+ spinlock_t fib6_gc_lock; |
2437 |
+ unsigned int ip6_rt_gc_expire; |
2438 |
+ unsigned long ip6_rt_last_gc; |
2439 |
++ unsigned char flowlabel_has_excl; |
2440 |
+ #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
2441 |
+- unsigned int fib6_rules_require_fldissect; |
2442 |
+ bool fib6_has_custom_rules; |
2443 |
++ unsigned int fib6_rules_require_fldissect; |
2444 |
+ #ifdef CONFIG_IPV6_SUBTREES |
2445 |
+ unsigned int fib6_routes_require_src; |
2446 |
+ #endif |
2447 |
+diff --git a/include/uapi/linux/can/isotp.h b/include/uapi/linux/can/isotp.h |
2448 |
+index 7793b26aa154d..c55935b64ccc8 100644 |
2449 |
+--- a/include/uapi/linux/can/isotp.h |
2450 |
++++ b/include/uapi/linux/can/isotp.h |
2451 |
+@@ -135,7 +135,7 @@ struct can_isotp_ll_options { |
2452 |
+ #define CAN_ISOTP_FORCE_RXSTMIN 0x100 /* ignore CFs depending on rx stmin */ |
2453 |
+ #define CAN_ISOTP_RX_EXT_ADDR 0x200 /* different rx extended addressing */ |
2454 |
+ #define CAN_ISOTP_WAIT_TX_DONE 0x400 /* wait for tx completion */ |
2455 |
+- |
2456 |
++#define CAN_ISOTP_SF_BROADCAST 0x800 /* 1-to-N functional addressing */ |
2457 |
+ |
2458 |
+ /* default values */ |
2459 |
+ |
2460 |
+diff --git a/kernel/async.c b/kernel/async.c |
2461 |
+index 33258e6e20f83..1746cd65e271b 100644 |
2462 |
+--- a/kernel/async.c |
2463 |
++++ b/kernel/async.c |
2464 |
+@@ -205,9 +205,6 @@ async_cookie_t async_schedule_node_domain(async_func_t func, void *data, |
2465 |
+ atomic_inc(&entry_count); |
2466 |
+ spin_unlock_irqrestore(&async_lock, flags); |
2467 |
+ |
2468 |
+- /* mark that this task has queued an async job, used by module init */ |
2469 |
+- current->flags |= PF_USED_ASYNC; |
2470 |
+- |
2471 |
+ /* schedule for execution */ |
2472 |
+ queue_work_node(node, system_unbound_wq, &entry->work); |
2473 |
+ |
2474 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
2475 |
+index e465903abed9e..a78c0b02edd55 100644 |
2476 |
+--- a/kernel/fork.c |
2477 |
++++ b/kernel/fork.c |
2478 |
+@@ -2258,10 +2258,6 @@ static __latent_entropy struct task_struct *copy_process( |
2479 |
+ goto bad_fork_cancel_cgroup; |
2480 |
+ } |
2481 |
+ |
2482 |
+- /* past the last point of failure */ |
2483 |
+- if (pidfile) |
2484 |
+- fd_install(pidfd, pidfile); |
2485 |
+- |
2486 |
+ init_task_pid_links(p); |
2487 |
+ if (likely(p->pid)) { |
2488 |
+ ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); |
2489 |
+@@ -2310,6 +2306,9 @@ static __latent_entropy struct task_struct *copy_process( |
2490 |
+ syscall_tracepoint_update(p); |
2491 |
+ write_unlock_irq(&tasklist_lock); |
2492 |
+ |
2493 |
++ if (pidfile) |
2494 |
++ fd_install(pidfd, pidfile); |
2495 |
++ |
2496 |
+ proc_fork_connector(p); |
2497 |
+ sched_post_fork(p, args); |
2498 |
+ cgroup_post_fork(p, args); |
2499 |
+diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c |
2500 |
+index 1f6a2f1226fa9..af4b35450556f 100644 |
2501 |
+--- a/kernel/locking/lockdep.c |
2502 |
++++ b/kernel/locking/lockdep.c |
2503 |
+@@ -3387,7 +3387,7 @@ struct lock_class *lock_chain_get_class(struct lock_chain *chain, int i) |
2504 |
+ u16 chain_hlock = chain_hlocks[chain->base + i]; |
2505 |
+ unsigned int class_idx = chain_hlock_class_idx(chain_hlock); |
2506 |
+ |
2507 |
+- return lock_classes + class_idx - 1; |
2508 |
++ return lock_classes + class_idx; |
2509 |
+ } |
2510 |
+ |
2511 |
+ /* |
2512 |
+@@ -3455,7 +3455,7 @@ static void print_chain_keys_chain(struct lock_chain *chain) |
2513 |
+ hlock_id = chain_hlocks[chain->base + i]; |
2514 |
+ chain_key = print_chain_key_iteration(hlock_id, chain_key); |
2515 |
+ |
2516 |
+- print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id) - 1); |
2517 |
++ print_lock_name(lock_classes + chain_hlock_class_idx(hlock_id)); |
2518 |
+ printk("\n"); |
2519 |
+ } |
2520 |
+ } |
2521 |
+diff --git a/kernel/module.c b/kernel/module.c |
2522 |
+index 185b2655bc206..5f4403198f04b 100644 |
2523 |
+--- a/kernel/module.c |
2524 |
++++ b/kernel/module.c |
2525 |
+@@ -3714,12 +3714,6 @@ static noinline int do_init_module(struct module *mod) |
2526 |
+ } |
2527 |
+ freeinit->module_init = mod->init_layout.base; |
2528 |
+ |
2529 |
+- /* |
2530 |
+- * We want to find out whether @mod uses async during init. Clear |
2531 |
+- * PF_USED_ASYNC. async_schedule*() will set it. |
2532 |
+- */ |
2533 |
+- current->flags &= ~PF_USED_ASYNC; |
2534 |
+- |
2535 |
+ do_mod_ctors(mod); |
2536 |
+ /* Start the module */ |
2537 |
+ if (mod->init != NULL) |
2538 |
+@@ -3745,22 +3739,13 @@ static noinline int do_init_module(struct module *mod) |
2539 |
+ |
2540 |
+ /* |
2541 |
+ * We need to finish all async code before the module init sequence |
2542 |
+- * is done. This has potential to deadlock. For example, a newly |
2543 |
+- * detected block device can trigger request_module() of the |
2544 |
+- * default iosched from async probing task. Once userland helper |
2545 |
+- * reaches here, async_synchronize_full() will wait on the async |
2546 |
+- * task waiting on request_module() and deadlock. |
2547 |
+- * |
2548 |
+- * This deadlock is avoided by perfomring async_synchronize_full() |
2549 |
+- * iff module init queued any async jobs. This isn't a full |
2550 |
+- * solution as it will deadlock the same if module loading from |
2551 |
+- * async jobs nests more than once; however, due to the various |
2552 |
+- * constraints, this hack seems to be the best option for now. |
2553 |
+- * Please refer to the following thread for details. |
2554 |
++ * is done. This has potential to deadlock if synchronous module |
2555 |
++ * loading is requested from async (which is not allowed!). |
2556 |
+ * |
2557 |
+- * http://thread.gmane.org/gmane.linux.kernel/1420814 |
2558 |
++ * See commit 0fdff3ec6d87 ("async, kmod: warn on synchronous |
2559 |
++ * request_module() from async workers") for more details. |
2560 |
+ */ |
2561 |
+- if (!mod->async_probe_requested && (current->flags & PF_USED_ASYNC)) |
2562 |
++ if (!mod->async_probe_requested) |
2563 |
+ async_synchronize_full(); |
2564 |
+ |
2565 |
+ ftrace_free_mem(mod, mod->init_layout.base, mod->init_layout.base + |
2566 |
+diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h |
2567 |
+index 6ed153f226b39..244f32e98360f 100644 |
2568 |
+--- a/kernel/rcu/tree_plugin.h |
2569 |
++++ b/kernel/rcu/tree_plugin.h |
2570 |
+@@ -628,7 +628,7 @@ static void rcu_read_unlock_special(struct task_struct *t) |
2571 |
+ set_tsk_need_resched(current); |
2572 |
+ set_preempt_need_resched(); |
2573 |
+ if (IS_ENABLED(CONFIG_IRQ_WORK) && irqs_were_disabled && |
2574 |
+- !rdp->defer_qs_iw_pending && exp) { |
2575 |
++ !rdp->defer_qs_iw_pending && exp && cpu_online(rdp->cpu)) { |
2576 |
+ // Get scheduler to re-evaluate and call hooks. |
2577 |
+ // If !IRQ_WORK, FQS scan will eventually IPI. |
2578 |
+ init_irq_work(&rdp->defer_qs_iw, |
2579 |
+diff --git a/kernel/stackleak.c b/kernel/stackleak.c |
2580 |
+index ce161a8e8d975..dd07239ddff9f 100644 |
2581 |
+--- a/kernel/stackleak.c |
2582 |
++++ b/kernel/stackleak.c |
2583 |
+@@ -48,7 +48,7 @@ int stack_erasing_sysctl(struct ctl_table *table, int write, |
2584 |
+ #define skip_erasing() false |
2585 |
+ #endif /* CONFIG_STACKLEAK_RUNTIME_DISABLE */ |
2586 |
+ |
2587 |
+-asmlinkage void notrace stackleak_erase(void) |
2588 |
++asmlinkage void noinstr stackleak_erase(void) |
2589 |
+ { |
2590 |
+ /* It would be nice not to have 'kstack_ptr' and 'boundary' on stack */ |
2591 |
+ unsigned long kstack_ptr = current->lowest_stack; |
2592 |
+@@ -102,9 +102,8 @@ asmlinkage void notrace stackleak_erase(void) |
2593 |
+ /* Reset the 'lowest_stack' value for the next syscall */ |
2594 |
+ current->lowest_stack = current_top_of_stack() - THREAD_SIZE/64; |
2595 |
+ } |
2596 |
+-NOKPROBE_SYMBOL(stackleak_erase); |
2597 |
+ |
2598 |
+-void __used __no_caller_saved_registers notrace stackleak_track_stack(void) |
2599 |
++void __used __no_caller_saved_registers noinstr stackleak_track_stack(void) |
2600 |
+ { |
2601 |
+ unsigned long sp = current_stack_pointer; |
2602 |
+ |
2603 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2604 |
+index a0729213f37be..f9fad789321b0 100644 |
2605 |
+--- a/kernel/trace/trace.c |
2606 |
++++ b/kernel/trace/trace.c |
2607 |
+@@ -250,6 +250,10 @@ __setup("trace_clock=", set_trace_boot_clock); |
2608 |
+ |
2609 |
+ static int __init set_tracepoint_printk(char *str) |
2610 |
+ { |
2611 |
++ /* Ignore the "tp_printk_stop_on_boot" param */ |
2612 |
++ if (*str == '_') |
2613 |
++ return 0; |
2614 |
++ |
2615 |
+ if ((strcmp(str, "=0") != 0 && strcmp(str, "=off") != 0)) |
2616 |
+ tracepoint_printk = 1; |
2617 |
+ return 1; |
2618 |
+diff --git a/lib/iov_iter.c b/lib/iov_iter.c |
2619 |
+index b364231b5fc8c..1b0a349fbcd92 100644 |
2620 |
+--- a/lib/iov_iter.c |
2621 |
++++ b/lib/iov_iter.c |
2622 |
+@@ -407,6 +407,7 @@ static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, size_t by |
2623 |
+ return 0; |
2624 |
+ |
2625 |
+ buf->ops = &page_cache_pipe_buf_ops; |
2626 |
++ buf->flags = 0; |
2627 |
+ get_page(page); |
2628 |
+ buf->page = page; |
2629 |
+ buf->offset = offset; |
2630 |
+@@ -543,6 +544,7 @@ static size_t push_pipe(struct iov_iter *i, size_t size, |
2631 |
+ break; |
2632 |
+ |
2633 |
+ buf->ops = &default_pipe_buf_ops; |
2634 |
++ buf->flags = 0; |
2635 |
+ buf->page = page; |
2636 |
+ buf->offset = 0; |
2637 |
+ buf->len = min_t(ssize_t, left, PAGE_SIZE); |
2638 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
2639 |
+index 4bb2a4c593f73..dbe07fef26828 100644 |
2640 |
+--- a/mm/memcontrol.c |
2641 |
++++ b/mm/memcontrol.c |
2642 |
+@@ -250,7 +250,7 @@ struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr) |
2643 |
+ } |
2644 |
+ |
2645 |
+ #ifdef CONFIG_MEMCG_KMEM |
2646 |
+-extern spinlock_t css_set_lock; |
2647 |
++static DEFINE_SPINLOCK(objcg_lock); |
2648 |
+ |
2649 |
+ static void obj_cgroup_release(struct percpu_ref *ref) |
2650 |
+ { |
2651 |
+@@ -284,13 +284,13 @@ static void obj_cgroup_release(struct percpu_ref *ref) |
2652 |
+ WARN_ON_ONCE(nr_bytes & (PAGE_SIZE - 1)); |
2653 |
+ nr_pages = nr_bytes >> PAGE_SHIFT; |
2654 |
+ |
2655 |
+- spin_lock_irqsave(&css_set_lock, flags); |
2656 |
++ spin_lock_irqsave(&objcg_lock, flags); |
2657 |
+ memcg = obj_cgroup_memcg(objcg); |
2658 |
+ if (nr_pages) |
2659 |
+ __memcg_kmem_uncharge(memcg, nr_pages); |
2660 |
+ list_del(&objcg->list); |
2661 |
+ mem_cgroup_put(memcg); |
2662 |
+- spin_unlock_irqrestore(&css_set_lock, flags); |
2663 |
++ spin_unlock_irqrestore(&objcg_lock, flags); |
2664 |
+ |
2665 |
+ percpu_ref_exit(ref); |
2666 |
+ kfree_rcu(objcg, rcu); |
2667 |
+@@ -322,7 +322,7 @@ static void memcg_reparent_objcgs(struct mem_cgroup *memcg, |
2668 |
+ |
2669 |
+ objcg = rcu_replace_pointer(memcg->objcg, NULL, true); |
2670 |
+ |
2671 |
+- spin_lock_irq(&css_set_lock); |
2672 |
++ spin_lock_irq(&objcg_lock); |
2673 |
+ |
2674 |
+ /* Move active objcg to the parent's list */ |
2675 |
+ xchg(&objcg->memcg, parent); |
2676 |
+@@ -337,7 +337,7 @@ static void memcg_reparent_objcgs(struct mem_cgroup *memcg, |
2677 |
+ } |
2678 |
+ list_splice(&memcg->objcg_list, &parent->objcg_list); |
2679 |
+ |
2680 |
+- spin_unlock_irq(&css_set_lock); |
2681 |
++ spin_unlock_irq(&objcg_lock); |
2682 |
+ |
2683 |
+ percpu_ref_kill(&objcg->refcnt); |
2684 |
+ } |
2685 |
+diff --git a/mm/mprotect.c b/mm/mprotect.c |
2686 |
+index 56c02beb60414..7ea0aee0c08d9 100644 |
2687 |
+--- a/mm/mprotect.c |
2688 |
++++ b/mm/mprotect.c |
2689 |
+@@ -94,7 +94,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, |
2690 |
+ |
2691 |
+ /* Also skip shared copy-on-write pages */ |
2692 |
+ if (is_cow_mapping(vma->vm_flags) && |
2693 |
+- page_mapcount(page) != 1) |
2694 |
++ page_count(page) != 1) |
2695 |
+ continue; |
2696 |
+ |
2697 |
+ /* |
2698 |
+diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c |
2699 |
+index 5e84dce5ff7ae..23bd26057a828 100644 |
2700 |
+--- a/net/ax25/af_ax25.c |
2701 |
++++ b/net/ax25/af_ax25.c |
2702 |
+@@ -77,6 +77,7 @@ static void ax25_kill_by_device(struct net_device *dev) |
2703 |
+ { |
2704 |
+ ax25_dev *ax25_dev; |
2705 |
+ ax25_cb *s; |
2706 |
++ struct sock *sk; |
2707 |
+ |
2708 |
+ if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) |
2709 |
+ return; |
2710 |
+@@ -85,13 +86,15 @@ static void ax25_kill_by_device(struct net_device *dev) |
2711 |
+ again: |
2712 |
+ ax25_for_each(s, &ax25_list) { |
2713 |
+ if (s->ax25_dev == ax25_dev) { |
2714 |
++ sk = s->sk; |
2715 |
++ sock_hold(sk); |
2716 |
+ spin_unlock_bh(&ax25_list_lock); |
2717 |
+- lock_sock(s->sk); |
2718 |
++ lock_sock(sk); |
2719 |
+ s->ax25_dev = NULL; |
2720 |
+- release_sock(s->sk); |
2721 |
++ release_sock(sk); |
2722 |
+ ax25_disconnect(s, ENETUNREACH); |
2723 |
+ spin_lock_bh(&ax25_list_lock); |
2724 |
+- |
2725 |
++ sock_put(sk); |
2726 |
+ /* The entry could have been deleted from the |
2727 |
+ * list meanwhile and thus the next pointer is |
2728 |
+ * no longer valid. Play it safe and restart |
2729 |
+diff --git a/net/can/isotp.c b/net/can/isotp.c |
2730 |
+index 37db4d232313d..d0581dc6a65fd 100644 |
2731 |
+--- a/net/can/isotp.c |
2732 |
++++ b/net/can/isotp.c |
2733 |
+@@ -888,6 +888,16 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) |
2734 |
+ goto err_out_drop; |
2735 |
+ } |
2736 |
+ |
2737 |
++ /* take care of a potential SF_DL ESC offset for TX_DL > 8 */ |
2738 |
++ off = (so->tx.ll_dl > CAN_MAX_DLEN) ? 1 : 0; |
2739 |
++ |
2740 |
++ /* does the given data fit into a single frame for SF_BROADCAST? */ |
2741 |
++ if ((so->opt.flags & CAN_ISOTP_SF_BROADCAST) && |
2742 |
++ (size > so->tx.ll_dl - SF_PCI_SZ4 - ae - off)) { |
2743 |
++ err = -EINVAL; |
2744 |
++ goto err_out_drop; |
2745 |
++ } |
2746 |
++ |
2747 |
+ err = memcpy_from_msg(so->tx.buf, msg, size); |
2748 |
+ if (err < 0) |
2749 |
+ goto err_out_drop; |
2750 |
+@@ -915,9 +925,6 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size) |
2751 |
+ cf = (struct canfd_frame *)skb->data; |
2752 |
+ skb_put_zero(skb, so->ll.mtu); |
2753 |
+ |
2754 |
+- /* take care of a potential SF_DL ESC offset for TX_DL > 8 */ |
2755 |
+- off = (so->tx.ll_dl > CAN_MAX_DLEN) ? 1 : 0; |
2756 |
+- |
2757 |
+ /* check for single frame transmission depending on TX_DL */ |
2758 |
+ if (size <= so->tx.ll_dl - SF_PCI_SZ4 - ae - off) { |
2759 |
+ /* The message size generally fits into a SingleFrame - good. |
2760 |
+@@ -1057,7 +1064,7 @@ static int isotp_release(struct socket *sock) |
2761 |
+ lock_sock(sk); |
2762 |
+ |
2763 |
+ /* remove current filters & unregister */ |
2764 |
+- if (so->bound) { |
2765 |
++ if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) { |
2766 |
+ if (so->ifindex) { |
2767 |
+ struct net_device *dev; |
2768 |
+ |
2769 |
+@@ -1097,15 +1104,12 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
2770 |
+ struct net_device *dev; |
2771 |
+ int err = 0; |
2772 |
+ int notify_enetdown = 0; |
2773 |
++ int do_rx_reg = 1; |
2774 |
+ |
2775 |
+ if (len < ISOTP_MIN_NAMELEN) |
2776 |
+ return -EINVAL; |
2777 |
+ |
2778 |
+- if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) |
2779 |
+- return -EADDRNOTAVAIL; |
2780 |
+- |
2781 |
+- if ((addr->can_addr.tp.rx_id | addr->can_addr.tp.tx_id) & |
2782 |
+- (CAN_ERR_FLAG | CAN_RTR_FLAG)) |
2783 |
++ if (addr->can_addr.tp.tx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) |
2784 |
+ return -EADDRNOTAVAIL; |
2785 |
+ |
2786 |
+ if (!addr->can_ifindex) |
2787 |
+@@ -1113,6 +1117,23 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
2788 |
+ |
2789 |
+ lock_sock(sk); |
2790 |
+ |
2791 |
++ /* do not register frame reception for functional addressing */ |
2792 |
++ if (so->opt.flags & CAN_ISOTP_SF_BROADCAST) |
2793 |
++ do_rx_reg = 0; |
2794 |
++ |
2795 |
++ /* do not validate rx address for functional addressing */ |
2796 |
++ if (do_rx_reg) { |
2797 |
++ if (addr->can_addr.tp.rx_id == addr->can_addr.tp.tx_id) { |
2798 |
++ err = -EADDRNOTAVAIL; |
2799 |
++ goto out; |
2800 |
++ } |
2801 |
++ |
2802 |
++ if (addr->can_addr.tp.rx_id & (CAN_ERR_FLAG | CAN_RTR_FLAG)) { |
2803 |
++ err = -EADDRNOTAVAIL; |
2804 |
++ goto out; |
2805 |
++ } |
2806 |
++ } |
2807 |
++ |
2808 |
+ if (so->bound && addr->can_ifindex == so->ifindex && |
2809 |
+ addr->can_addr.tp.rx_id == so->rxid && |
2810 |
+ addr->can_addr.tp.tx_id == so->txid) |
2811 |
+@@ -1138,13 +1159,14 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len) |
2812 |
+ |
2813 |
+ ifindex = dev->ifindex; |
2814 |
+ |
2815 |
+- can_rx_register(net, dev, addr->can_addr.tp.rx_id, |
2816 |
+- SINGLE_MASK(addr->can_addr.tp.rx_id), isotp_rcv, sk, |
2817 |
+- "isotp", sk); |
2818 |
++ if (do_rx_reg) |
2819 |
++ can_rx_register(net, dev, addr->can_addr.tp.rx_id, |
2820 |
++ SINGLE_MASK(addr->can_addr.tp.rx_id), |
2821 |
++ isotp_rcv, sk, "isotp", sk); |
2822 |
+ |
2823 |
+ dev_put(dev); |
2824 |
+ |
2825 |
+- if (so->bound) { |
2826 |
++ if (so->bound && do_rx_reg) { |
2827 |
+ /* unregister old filter */ |
2828 |
+ if (so->ifindex) { |
2829 |
+ dev = dev_get_by_index(net, so->ifindex); |
2830 |
+@@ -1193,16 +1215,13 @@ static int isotp_getname(struct socket *sock, struct sockaddr *uaddr, int peer) |
2831 |
+ return ISOTP_MIN_NAMELEN; |
2832 |
+ } |
2833 |
+ |
2834 |
+-static int isotp_setsockopt(struct socket *sock, int level, int optname, |
2835 |
++static int isotp_setsockopt_locked(struct socket *sock, int level, int optname, |
2836 |
+ sockptr_t optval, unsigned int optlen) |
2837 |
+ { |
2838 |
+ struct sock *sk = sock->sk; |
2839 |
+ struct isotp_sock *so = isotp_sk(sk); |
2840 |
+ int ret = 0; |
2841 |
+ |
2842 |
+- if (level != SOL_CAN_ISOTP) |
2843 |
+- return -EINVAL; |
2844 |
+- |
2845 |
+ if (so->bound) |
2846 |
+ return -EISCONN; |
2847 |
+ |
2848 |
+@@ -1277,6 +1296,22 @@ static int isotp_setsockopt(struct socket *sock, int level, int optname, |
2849 |
+ return ret; |
2850 |
+ } |
2851 |
+ |
2852 |
++static int isotp_setsockopt(struct socket *sock, int level, int optname, |
2853 |
++ sockptr_t optval, unsigned int optlen) |
2854 |
++ |
2855 |
++{ |
2856 |
++ struct sock *sk = sock->sk; |
2857 |
++ int ret; |
2858 |
++ |
2859 |
++ if (level != SOL_CAN_ISOTP) |
2860 |
++ return -EINVAL; |
2861 |
++ |
2862 |
++ lock_sock(sk); |
2863 |
++ ret = isotp_setsockopt_locked(sock, level, optname, optval, optlen); |
2864 |
++ release_sock(sk); |
2865 |
++ return ret; |
2866 |
++} |
2867 |
++ |
2868 |
+ static int isotp_getsockopt(struct socket *sock, int level, int optname, |
2869 |
+ char __user *optval, int __user *optlen) |
2870 |
+ { |
2871 |
+@@ -1344,7 +1379,7 @@ static void isotp_notify(struct isotp_sock *so, unsigned long msg, |
2872 |
+ case NETDEV_UNREGISTER: |
2873 |
+ lock_sock(sk); |
2874 |
+ /* remove current filters & unregister */ |
2875 |
+- if (so->bound) |
2876 |
++ if (so->bound && (!(so->opt.flags & CAN_ISOTP_SF_BROADCAST))) |
2877 |
+ can_rx_unregister(dev_net(dev), dev, so->rxid, |
2878 |
+ SINGLE_MASK(so->rxid), |
2879 |
+ isotp_rcv, sk); |
2880 |
+diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c |
2881 |
+index db65ce62b625a..ed9dd17f9348c 100644 |
2882 |
+--- a/net/core/drop_monitor.c |
2883 |
++++ b/net/core/drop_monitor.c |
2884 |
+@@ -280,13 +280,17 @@ static void trace_napi_poll_hit(void *ignore, struct napi_struct *napi, |
2885 |
+ |
2886 |
+ rcu_read_lock(); |
2887 |
+ list_for_each_entry_rcu(new_stat, &hw_stats_list, list) { |
2888 |
++ struct net_device *dev; |
2889 |
++ |
2890 |
+ /* |
2891 |
+ * only add a note to our monitor buffer if: |
2892 |
+ * 1) this is the dev we received on |
2893 |
+ * 2) its after the last_rx delta |
2894 |
+ * 3) our rx_dropped count has gone up |
2895 |
+ */ |
2896 |
+- if ((new_stat->dev == napi->dev) && |
2897 |
++ /* Paired with WRITE_ONCE() in dropmon_net_event() */ |
2898 |
++ dev = READ_ONCE(new_stat->dev); |
2899 |
++ if ((dev == napi->dev) && |
2900 |
+ (time_after(jiffies, new_stat->last_rx + dm_hw_check_delta)) && |
2901 |
+ (napi->dev->stats.rx_dropped != new_stat->last_drop_val)) { |
2902 |
+ trace_drop_common(NULL, NULL); |
2903 |
+@@ -1574,7 +1578,10 @@ static int dropmon_net_event(struct notifier_block *ev_block, |
2904 |
+ mutex_lock(&net_dm_mutex); |
2905 |
+ list_for_each_entry_safe(new_stat, tmp, &hw_stats_list, list) { |
2906 |
+ if (new_stat->dev == dev) { |
2907 |
+- new_stat->dev = NULL; |
2908 |
++ |
2909 |
++ /* Paired with READ_ONCE() in trace_napi_poll_hit() */ |
2910 |
++ WRITE_ONCE(new_stat->dev, NULL); |
2911 |
++ |
2912 |
+ if (trace_state == TRACE_OFF) { |
2913 |
+ list_del_rcu(&new_stat->list); |
2914 |
+ kfree_rcu(new_stat, rcu); |
2915 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
2916 |
+index 373564bf57acb..9ff6d4160daba 100644 |
2917 |
+--- a/net/core/rtnetlink.c |
2918 |
++++ b/net/core/rtnetlink.c |
2919 |
+@@ -1705,6 +1705,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, |
2920 |
+ { |
2921 |
+ struct ifinfomsg *ifm; |
2922 |
+ struct nlmsghdr *nlh; |
2923 |
++ struct Qdisc *qdisc; |
2924 |
+ |
2925 |
+ ASSERT_RTNL(); |
2926 |
+ nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ifm), flags); |
2927 |
+@@ -1722,6 +1723,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, |
2928 |
+ if (tgt_netnsid >= 0 && nla_put_s32(skb, IFLA_TARGET_NETNSID, tgt_netnsid)) |
2929 |
+ goto nla_put_failure; |
2930 |
+ |
2931 |
++ qdisc = rtnl_dereference(dev->qdisc); |
2932 |
+ if (nla_put_string(skb, IFLA_IFNAME, dev->name) || |
2933 |
+ nla_put_u32(skb, IFLA_TXQLEN, dev->tx_queue_len) || |
2934 |
+ nla_put_u8(skb, IFLA_OPERSTATE, |
2935 |
+@@ -1740,8 +1742,8 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, |
2936 |
+ #endif |
2937 |
+ put_master_ifindex(skb, dev) || |
2938 |
+ nla_put_u8(skb, IFLA_CARRIER, netif_carrier_ok(dev)) || |
2939 |
+- (dev->qdisc && |
2940 |
+- nla_put_string(skb, IFLA_QDISC, dev->qdisc->ops->id)) || |
2941 |
++ (qdisc && |
2942 |
++ nla_put_string(skb, IFLA_QDISC, qdisc->ops->id)) || |
2943 |
+ nla_put_ifalias(skb, dev) || |
2944 |
+ nla_put_u32(skb, IFLA_CARRIER_CHANGES, |
2945 |
+ atomic_read(&dev->carrier_up_count) + |
2946 |
+diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c |
2947 |
+index a5722905456c2..323cb231cb580 100644 |
2948 |
+--- a/net/ipv4/ping.c |
2949 |
++++ b/net/ipv4/ping.c |
2950 |
+@@ -172,16 +172,23 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) |
2951 |
+ struct sock *sk = NULL; |
2952 |
+ struct inet_sock *isk; |
2953 |
+ struct hlist_nulls_node *hnode; |
2954 |
+- int dif = skb->dev->ifindex; |
2955 |
++ int dif, sdif; |
2956 |
+ |
2957 |
+ if (skb->protocol == htons(ETH_P_IP)) { |
2958 |
++ dif = inet_iif(skb); |
2959 |
++ sdif = inet_sdif(skb); |
2960 |
+ pr_debug("try to find: num = %d, daddr = %pI4, dif = %d\n", |
2961 |
+ (int)ident, &ip_hdr(skb)->daddr, dif); |
2962 |
+ #if IS_ENABLED(CONFIG_IPV6) |
2963 |
+ } else if (skb->protocol == htons(ETH_P_IPV6)) { |
2964 |
++ dif = inet6_iif(skb); |
2965 |
++ sdif = inet6_sdif(skb); |
2966 |
+ pr_debug("try to find: num = %d, daddr = %pI6c, dif = %d\n", |
2967 |
+ (int)ident, &ipv6_hdr(skb)->daddr, dif); |
2968 |
+ #endif |
2969 |
++ } else { |
2970 |
++ pr_err("ping: protocol(%x) is not supported\n", ntohs(skb->protocol)); |
2971 |
++ return NULL; |
2972 |
+ } |
2973 |
+ |
2974 |
+ read_lock_bh(&ping_table.lock); |
2975 |
+@@ -221,7 +228,7 @@ static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) |
2976 |
+ } |
2977 |
+ |
2978 |
+ if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif && |
2979 |
+- sk->sk_bound_dev_if != inet_sdif(skb)) |
2980 |
++ sk->sk_bound_dev_if != sdif) |
2981 |
+ continue; |
2982 |
+ |
2983 |
+ sock_hold(sk); |
2984 |
+diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c |
2985 |
+index aa673a6a7e432..ceb85c67ce395 100644 |
2986 |
+--- a/net/ipv6/ip6_flowlabel.c |
2987 |
++++ b/net/ipv6/ip6_flowlabel.c |
2988 |
+@@ -450,8 +450,10 @@ fl_create(struct net *net, struct sock *sk, struct in6_flowlabel_req *freq, |
2989 |
+ err = -EINVAL; |
2990 |
+ goto done; |
2991 |
+ } |
2992 |
+- if (fl_shared_exclusive(fl) || fl->opt) |
2993 |
++ if (fl_shared_exclusive(fl) || fl->opt) { |
2994 |
++ WRITE_ONCE(sock_net(sk)->ipv6.flowlabel_has_excl, 1); |
2995 |
+ static_branch_deferred_inc(&ipv6_flowlabel_exclusive); |
2996 |
++ } |
2997 |
+ return fl; |
2998 |
+ |
2999 |
+ done: |
3000 |
+diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c |
3001 |
+index 810cca24b3990..7626f3e1c70a7 100644 |
3002 |
+--- a/net/netfilter/nf_conntrack_proto_sctp.c |
3003 |
++++ b/net/netfilter/nf_conntrack_proto_sctp.c |
3004 |
+@@ -489,6 +489,15 @@ int nf_conntrack_sctp_packet(struct nf_conn *ct, |
3005 |
+ pr_debug("Setting vtag %x for dir %d\n", |
3006 |
+ ih->init_tag, !dir); |
3007 |
+ ct->proto.sctp.vtag[!dir] = ih->init_tag; |
3008 |
++ |
3009 |
++ /* don't renew timeout on init retransmit so |
3010 |
++ * port reuse by client or NAT middlebox cannot |
3011 |
++ * keep entry alive indefinitely (incl. nat info). |
3012 |
++ */ |
3013 |
++ if (new_state == SCTP_CONNTRACK_CLOSED && |
3014 |
++ old_state == SCTP_CONNTRACK_CLOSED && |
3015 |
++ nf_ct_is_confirmed(ct)) |
3016 |
++ ignore = true; |
3017 |
+ } |
3018 |
+ |
3019 |
+ ct->proto.sctp.state = new_state; |
3020 |
+diff --git a/net/netfilter/nft_synproxy.c b/net/netfilter/nft_synproxy.c |
3021 |
+index 4fda8b3f17626..59c4dfaf2ea1f 100644 |
3022 |
+--- a/net/netfilter/nft_synproxy.c |
3023 |
++++ b/net/netfilter/nft_synproxy.c |
3024 |
+@@ -191,8 +191,10 @@ static int nft_synproxy_do_init(const struct nft_ctx *ctx, |
3025 |
+ if (err) |
3026 |
+ goto nf_ct_failure; |
3027 |
+ err = nf_synproxy_ipv6_init(snet, ctx->net); |
3028 |
+- if (err) |
3029 |
++ if (err) { |
3030 |
++ nf_synproxy_ipv4_fini(snet, ctx->net); |
3031 |
+ goto nf_ct_failure; |
3032 |
++ } |
3033 |
+ break; |
3034 |
+ } |
3035 |
+ |
3036 |
+diff --git a/net/sched/act_api.c b/net/sched/act_api.c |
3037 |
+index f613299ca7f0a..7b29aa1a3ce9a 100644 |
3038 |
+--- a/net/sched/act_api.c |
3039 |
++++ b/net/sched/act_api.c |
3040 |
+@@ -680,15 +680,24 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, |
3041 |
+ restart_act_graph: |
3042 |
+ for (i = 0; i < nr_actions; i++) { |
3043 |
+ const struct tc_action *a = actions[i]; |
3044 |
++ int repeat_ttl; |
3045 |
+ |
3046 |
+ if (jmp_prgcnt > 0) { |
3047 |
+ jmp_prgcnt -= 1; |
3048 |
+ continue; |
3049 |
+ } |
3050 |
++ |
3051 |
++ repeat_ttl = 32; |
3052 |
+ repeat: |
3053 |
+ ret = a->ops->act(skb, a, res); |
3054 |
+- if (ret == TC_ACT_REPEAT) |
3055 |
+- goto repeat; /* we need a ttl - JHS */ |
3056 |
++ |
3057 |
++ if (unlikely(ret == TC_ACT_REPEAT)) { |
3058 |
++ if (--repeat_ttl != 0) |
3059 |
++ goto repeat; |
3060 |
++ /* suspicious opcode, stop pipeline */ |
3061 |
++ net_warn_ratelimited("TC_ACT_REPEAT abuse ?\n"); |
3062 |
++ return TC_ACT_OK; |
3063 |
++ } |
3064 |
+ |
3065 |
+ if (TC_ACT_EXT_CMP(ret, TC_ACT_JUMP)) { |
3066 |
+ jmp_prgcnt = ret & TCA_ACT_MAX_PRIO_MASK; |
3067 |
+diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c |
3068 |
+index 7993a692c7fda..9a789a057a741 100644 |
3069 |
+--- a/net/sched/cls_api.c |
3070 |
++++ b/net/sched/cls_api.c |
3071 |
+@@ -1045,7 +1045,7 @@ static int __tcf_qdisc_find(struct net *net, struct Qdisc **q, |
3072 |
+ |
3073 |
+ /* Find qdisc */ |
3074 |
+ if (!*parent) { |
3075 |
+- *q = dev->qdisc; |
3076 |
++ *q = rcu_dereference(dev->qdisc); |
3077 |
+ *parent = (*q)->handle; |
3078 |
+ } else { |
3079 |
+ *q = qdisc_lookup_rcu(dev, TC_H_MAJ(*parent)); |
3080 |
+@@ -2591,7 +2591,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) |
3081 |
+ |
3082 |
+ parent = tcm->tcm_parent; |
3083 |
+ if (!parent) |
3084 |
+- q = dev->qdisc; |
3085 |
++ q = rtnl_dereference(dev->qdisc); |
3086 |
+ else |
3087 |
+ q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); |
3088 |
+ if (!q) |
3089 |
+@@ -2977,7 +2977,7 @@ static int tc_dump_chain(struct sk_buff *skb, struct netlink_callback *cb) |
3090 |
+ |
3091 |
+ parent = tcm->tcm_parent; |
3092 |
+ if (!parent) { |
3093 |
+- q = dev->qdisc; |
3094 |
++ q = rtnl_dereference(dev->qdisc); |
3095 |
+ parent = q->handle; |
3096 |
+ } else { |
3097 |
+ q = qdisc_lookup(dev, TC_H_MAJ(tcm->tcm_parent)); |
3098 |
+diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c |
3099 |
+index 6758968e79327..6e18aa4177828 100644 |
3100 |
+--- a/net/sched/sch_api.c |
3101 |
++++ b/net/sched/sch_api.c |
3102 |
+@@ -301,7 +301,7 @@ struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle) |
3103 |
+ |
3104 |
+ if (!handle) |
3105 |
+ return NULL; |
3106 |
+- q = qdisc_match_from_root(dev->qdisc, handle); |
3107 |
++ q = qdisc_match_from_root(rtnl_dereference(dev->qdisc), handle); |
3108 |
+ if (q) |
3109 |
+ goto out; |
3110 |
+ |
3111 |
+@@ -320,7 +320,7 @@ struct Qdisc *qdisc_lookup_rcu(struct net_device *dev, u32 handle) |
3112 |
+ |
3113 |
+ if (!handle) |
3114 |
+ return NULL; |
3115 |
+- q = qdisc_match_from_root(dev->qdisc, handle); |
3116 |
++ q = qdisc_match_from_root(rcu_dereference(dev->qdisc), handle); |
3117 |
+ if (q) |
3118 |
+ goto out; |
3119 |
+ |
3120 |
+@@ -1082,10 +1082,10 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, |
3121 |
+ skip: |
3122 |
+ if (!ingress) { |
3123 |
+ notify_and_destroy(net, skb, n, classid, |
3124 |
+- dev->qdisc, new); |
3125 |
++ rtnl_dereference(dev->qdisc), new); |
3126 |
+ if (new && !new->ops->attach) |
3127 |
+ qdisc_refcount_inc(new); |
3128 |
+- dev->qdisc = new ? : &noop_qdisc; |
3129 |
++ rcu_assign_pointer(dev->qdisc, new ? : &noop_qdisc); |
3130 |
+ |
3131 |
+ if (new && new->ops->attach) |
3132 |
+ new->ops->attach(new); |
3133 |
+@@ -1460,7 +1460,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, |
3134 |
+ q = dev_ingress_queue(dev)->qdisc_sleeping; |
3135 |
+ } |
3136 |
+ } else { |
3137 |
+- q = dev->qdisc; |
3138 |
++ q = rtnl_dereference(dev->qdisc); |
3139 |
+ } |
3140 |
+ if (!q) { |
3141 |
+ NL_SET_ERR_MSG(extack, "Cannot find specified qdisc on specified device"); |
3142 |
+@@ -1549,7 +1549,7 @@ replay: |
3143 |
+ q = dev_ingress_queue(dev)->qdisc_sleeping; |
3144 |
+ } |
3145 |
+ } else { |
3146 |
+- q = dev->qdisc; |
3147 |
++ q = rtnl_dereference(dev->qdisc); |
3148 |
+ } |
3149 |
+ |
3150 |
+ /* It may be default qdisc, ignore it */ |
3151 |
+@@ -1771,7 +1771,8 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) |
3152 |
+ s_q_idx = 0; |
3153 |
+ q_idx = 0; |
3154 |
+ |
3155 |
+- if (tc_dump_qdisc_root(dev->qdisc, skb, cb, &q_idx, s_q_idx, |
3156 |
++ if (tc_dump_qdisc_root(rtnl_dereference(dev->qdisc), |
3157 |
++ skb, cb, &q_idx, s_q_idx, |
3158 |
+ true, tca[TCA_DUMP_INVISIBLE]) < 0) |
3159 |
+ goto done; |
3160 |
+ |
3161 |
+@@ -2047,7 +2048,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, |
3162 |
+ } else if (qid1) { |
3163 |
+ qid = qid1; |
3164 |
+ } else if (qid == 0) |
3165 |
+- qid = dev->qdisc->handle; |
3166 |
++ qid = rtnl_dereference(dev->qdisc)->handle; |
3167 |
+ |
3168 |
+ /* Now qid is genuine qdisc handle consistent |
3169 |
+ * both with parent and child. |
3170 |
+@@ -2058,7 +2059,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, |
3171 |
+ portid = TC_H_MAKE(qid, portid); |
3172 |
+ } else { |
3173 |
+ if (qid == 0) |
3174 |
+- qid = dev->qdisc->handle; |
3175 |
++ qid = rtnl_dereference(dev->qdisc)->handle; |
3176 |
+ } |
3177 |
+ |
3178 |
+ /* OK. Locate qdisc */ |
3179 |
+@@ -2219,7 +2220,8 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) |
3180 |
+ s_t = cb->args[0]; |
3181 |
+ t = 0; |
3182 |
+ |
3183 |
+- if (tc_dump_tclass_root(dev->qdisc, skb, tcm, cb, &t, s_t, true) < 0) |
3184 |
++ if (tc_dump_tclass_root(rtnl_dereference(dev->qdisc), |
3185 |
++ skb, tcm, cb, &t, s_t, true) < 0) |
3186 |
+ goto done; |
3187 |
+ |
3188 |
+ dev_queue = dev_ingress_queue(dev); |
3189 |
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c |
3190 |
+index b5005abc84ec2..5d5391adb667c 100644 |
3191 |
+--- a/net/sched/sch_generic.c |
3192 |
++++ b/net/sched/sch_generic.c |
3193 |
+@@ -1088,30 +1088,33 @@ static void attach_default_qdiscs(struct net_device *dev) |
3194 |
+ if (!netif_is_multiqueue(dev) || |
3195 |
+ dev->priv_flags & IFF_NO_QUEUE) { |
3196 |
+ netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); |
3197 |
+- dev->qdisc = txq->qdisc_sleeping; |
3198 |
+- qdisc_refcount_inc(dev->qdisc); |
3199 |
++ qdisc = txq->qdisc_sleeping; |
3200 |
++ rcu_assign_pointer(dev->qdisc, qdisc); |
3201 |
++ qdisc_refcount_inc(qdisc); |
3202 |
+ } else { |
3203 |
+ qdisc = qdisc_create_dflt(txq, &mq_qdisc_ops, TC_H_ROOT, NULL); |
3204 |
+ if (qdisc) { |
3205 |
+- dev->qdisc = qdisc; |
3206 |
++ rcu_assign_pointer(dev->qdisc, qdisc); |
3207 |
+ qdisc->ops->attach(qdisc); |
3208 |
+ } |
3209 |
+ } |
3210 |
++ qdisc = rtnl_dereference(dev->qdisc); |
3211 |
+ |
3212 |
+ /* Detect default qdisc setup/init failed and fallback to "noqueue" */ |
3213 |
+- if (dev->qdisc == &noop_qdisc) { |
3214 |
++ if (qdisc == &noop_qdisc) { |
3215 |
+ netdev_warn(dev, "default qdisc (%s) fail, fallback to %s\n", |
3216 |
+ default_qdisc_ops->id, noqueue_qdisc_ops.id); |
3217 |
+ dev->priv_flags |= IFF_NO_QUEUE; |
3218 |
+ netdev_for_each_tx_queue(dev, attach_one_default_qdisc, NULL); |
3219 |
+- dev->qdisc = txq->qdisc_sleeping; |
3220 |
+- qdisc_refcount_inc(dev->qdisc); |
3221 |
++ qdisc = txq->qdisc_sleeping; |
3222 |
++ rcu_assign_pointer(dev->qdisc, qdisc); |
3223 |
++ qdisc_refcount_inc(qdisc); |
3224 |
+ dev->priv_flags ^= IFF_NO_QUEUE; |
3225 |
+ } |
3226 |
+ |
3227 |
+ #ifdef CONFIG_NET_SCHED |
3228 |
+- if (dev->qdisc != &noop_qdisc) |
3229 |
+- qdisc_hash_add(dev->qdisc, false); |
3230 |
++ if (qdisc != &noop_qdisc) |
3231 |
++ qdisc_hash_add(qdisc, false); |
3232 |
+ #endif |
3233 |
+ } |
3234 |
+ |
3235 |
+@@ -1141,7 +1144,7 @@ void dev_activate(struct net_device *dev) |
3236 |
+ * and noqueue_qdisc for virtual interfaces |
3237 |
+ */ |
3238 |
+ |
3239 |
+- if (dev->qdisc == &noop_qdisc) |
3240 |
++ if (rtnl_dereference(dev->qdisc) == &noop_qdisc) |
3241 |
+ attach_default_qdiscs(dev); |
3242 |
+ |
3243 |
+ if (!netif_carrier_ok(dev)) |
3244 |
+@@ -1306,7 +1309,7 @@ static int qdisc_change_tx_queue_len(struct net_device *dev, |
3245 |
+ void dev_qdisc_change_real_num_tx(struct net_device *dev, |
3246 |
+ unsigned int new_real_tx) |
3247 |
+ { |
3248 |
+- struct Qdisc *qdisc = dev->qdisc; |
3249 |
++ struct Qdisc *qdisc = rtnl_dereference(dev->qdisc); |
3250 |
+ |
3251 |
+ if (qdisc->ops->change_real_num_tx) |
3252 |
+ qdisc->ops->change_real_num_tx(qdisc, new_real_tx); |
3253 |
+@@ -1346,7 +1349,7 @@ static void dev_init_scheduler_queue(struct net_device *dev, |
3254 |
+ |
3255 |
+ void dev_init_scheduler(struct net_device *dev) |
3256 |
+ { |
3257 |
+- dev->qdisc = &noop_qdisc; |
3258 |
++ rcu_assign_pointer(dev->qdisc, &noop_qdisc); |
3259 |
+ netdev_for_each_tx_queue(dev, dev_init_scheduler_queue, &noop_qdisc); |
3260 |
+ if (dev_ingress_queue(dev)) |
3261 |
+ dev_init_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc); |
3262 |
+@@ -1374,8 +1377,8 @@ void dev_shutdown(struct net_device *dev) |
3263 |
+ netdev_for_each_tx_queue(dev, shutdown_scheduler_queue, &noop_qdisc); |
3264 |
+ if (dev_ingress_queue(dev)) |
3265 |
+ shutdown_scheduler_queue(dev, dev_ingress_queue(dev), &noop_qdisc); |
3266 |
+- qdisc_put(dev->qdisc); |
3267 |
+- dev->qdisc = &noop_qdisc; |
3268 |
++ qdisc_put(rtnl_dereference(dev->qdisc)); |
3269 |
++ rcu_assign_pointer(dev->qdisc, &noop_qdisc); |
3270 |
+ |
3271 |
+ WARN_ON(timer_pending(&dev->watchdog_timer)); |
3272 |
+ } |
3273 |
+diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c |
3274 |
+index 25554260a5931..dcc1992b14d76 100644 |
3275 |
+--- a/net/sunrpc/xprtrdma/verbs.c |
3276 |
++++ b/net/sunrpc/xprtrdma/verbs.c |
3277 |
+@@ -449,6 +449,7 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) |
3278 |
+ IB_POLL_WORKQUEUE); |
3279 |
+ if (IS_ERR(ep->re_attr.send_cq)) { |
3280 |
+ rc = PTR_ERR(ep->re_attr.send_cq); |
3281 |
++ ep->re_attr.send_cq = NULL; |
3282 |
+ goto out_destroy; |
3283 |
+ } |
3284 |
+ |
3285 |
+@@ -457,6 +458,7 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) |
3286 |
+ IB_POLL_WORKQUEUE); |
3287 |
+ if (IS_ERR(ep->re_attr.recv_cq)) { |
3288 |
+ rc = PTR_ERR(ep->re_attr.recv_cq); |
3289 |
++ ep->re_attr.recv_cq = NULL; |
3290 |
+ goto out_destroy; |
3291 |
+ } |
3292 |
+ ep->re_receive_count = 0; |
3293 |
+@@ -495,6 +497,7 @@ static int rpcrdma_ep_create(struct rpcrdma_xprt *r_xprt) |
3294 |
+ ep->re_pd = ib_alloc_pd(device, 0); |
3295 |
+ if (IS_ERR(ep->re_pd)) { |
3296 |
+ rc = PTR_ERR(ep->re_pd); |
3297 |
++ ep->re_pd = NULL; |
3298 |
+ goto out_destroy; |
3299 |
+ } |
3300 |
+ |
3301 |
+diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c |
3302 |
+index 7fe36dbcbe187..005aa701f4d52 100644 |
3303 |
+--- a/net/vmw_vsock/af_vsock.c |
3304 |
++++ b/net/vmw_vsock/af_vsock.c |
3305 |
+@@ -1357,6 +1357,7 @@ static int vsock_stream_connect(struct socket *sock, struct sockaddr *addr, |
3306 |
+ sk->sk_state = sk->sk_state == TCP_ESTABLISHED ? TCP_CLOSING : TCP_CLOSE; |
3307 |
+ sock->state = SS_UNCONNECTED; |
3308 |
+ vsock_transport_cancel_pkt(vsk); |
3309 |
++ vsock_remove_connected(vsk); |
3310 |
+ goto out_wait; |
3311 |
+ } else if (timeout == 0) { |
3312 |
+ err = -ETIMEDOUT; |
3313 |
+diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c |
3314 |
+index a39d93e3c6ae8..867b06c6d2797 100644 |
3315 |
+--- a/scripts/kconfig/confdata.c |
3316 |
++++ b/scripts/kconfig/confdata.c |
3317 |
+@@ -968,14 +968,19 @@ static int conf_write_dep(const char *name) |
3318 |
+ |
3319 |
+ static int conf_touch_deps(void) |
3320 |
+ { |
3321 |
+- const char *name; |
3322 |
++ const char *name, *tmp; |
3323 |
+ struct symbol *sym; |
3324 |
+ int res, i; |
3325 |
+ |
3326 |
+- strcpy(depfile_path, "include/config/"); |
3327 |
+- depfile_prefix_len = strlen(depfile_path); |
3328 |
+- |
3329 |
+ name = conf_get_autoconfig_name(); |
3330 |
++ tmp = strrchr(name, '/'); |
3331 |
++ depfile_prefix_len = tmp ? tmp - name + 1 : 0; |
3332 |
++ if (depfile_prefix_len + 1 > sizeof(depfile_path)) |
3333 |
++ return -1; |
3334 |
++ |
3335 |
++ strncpy(depfile_path, name, depfile_prefix_len); |
3336 |
++ depfile_path[depfile_prefix_len] = 0; |
3337 |
++ |
3338 |
+ conf_read_simple(name, S_DEF_AUTO); |
3339 |
+ sym_calc_value(modules_sym); |
3340 |
+ |
3341 |
+diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c |
3342 |
+index 0590f86df6e40..748da578b418c 100644 |
3343 |
+--- a/scripts/kconfig/preprocess.c |
3344 |
++++ b/scripts/kconfig/preprocess.c |
3345 |
+@@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[]) |
3346 |
+ static char *do_shell(int argc, char *argv[]) |
3347 |
+ { |
3348 |
+ FILE *p; |
3349 |
+- char buf[256]; |
3350 |
++ char buf[4096]; |
3351 |
+ char *cmd; |
3352 |
+ size_t nread; |
3353 |
+ int i; |
3354 |
+diff --git a/scripts/module.lds.S b/scripts/module.lds.S |
3355 |
+index 69b9b71a6a473..c5f12195817bb 100644 |
3356 |
+--- a/scripts/module.lds.S |
3357 |
++++ b/scripts/module.lds.S |
3358 |
+@@ -23,6 +23,32 @@ SECTIONS { |
3359 |
+ .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } |
3360 |
+ |
3361 |
+ __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } |
3362 |
++ |
3363 |
++ __patchable_function_entries : { *(__patchable_function_entries) } |
3364 |
++ |
3365 |
++#ifdef CONFIG_LTO_CLANG |
3366 |
++ /* |
3367 |
++ * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and |
3368 |
++ * -ffunction-sections, which increases the size of the final module. |
3369 |
++ * Merge the split sections in the final binary. |
3370 |
++ */ |
3371 |
++ .bss : { |
3372 |
++ *(.bss .bss.[0-9a-zA-Z_]*) |
3373 |
++ *(.bss..L*) |
3374 |
++ } |
3375 |
++ |
3376 |
++ .data : { |
3377 |
++ *(.data .data.[0-9a-zA-Z_]*) |
3378 |
++ *(.data..L*) |
3379 |
++ } |
3380 |
++ |
3381 |
++ .rodata : { |
3382 |
++ *(.rodata .rodata.[0-9a-zA-Z_]*) |
3383 |
++ *(.rodata..L*) |
3384 |
++ } |
3385 |
++ |
3386 |
++ .text : { *(.text .text.[0-9a-zA-Z_]*) } |
3387 |
++#endif |
3388 |
+ } |
3389 |
+ |
3390 |
+ /* bring in arch-specific sections */ |
3391 |
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
3392 |
+index 3cc936f2cbf8d..600ea241ead79 100644 |
3393 |
+--- a/sound/pci/hda/hda_intel.c |
3394 |
++++ b/sound/pci/hda/hda_intel.c |
3395 |
+@@ -1652,6 +1652,7 @@ static const struct snd_pci_quirk probe_mask_list[] = { |
3396 |
+ /* forced codec slots */ |
3397 |
+ SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103), |
3398 |
+ SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), |
3399 |
++ SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105), |
3400 |
+ /* WinFast VP200 H (Teradici) user reported broken communication */ |
3401 |
+ SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101), |
3402 |
+ {} |
3403 |
+@@ -1837,8 +1838,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, |
3404 |
+ |
3405 |
+ assign_position_fix(chip, check_position_fix(chip, position_fix[dev])); |
3406 |
+ |
3407 |
+- check_probe_mask(chip, dev); |
3408 |
+- |
3409 |
+ if (single_cmd < 0) /* allow fallback to single_cmd at errors */ |
3410 |
+ chip->fallback_to_single_cmd = 1; |
3411 |
+ else /* explicitly set to single_cmd or not */ |
3412 |
+@@ -1866,6 +1865,8 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, |
3413 |
+ chip->bus.core.needs_damn_long_delay = 1; |
3414 |
+ } |
3415 |
+ |
3416 |
++ check_probe_mask(chip, dev); |
3417 |
++ |
3418 |
+ err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
3419 |
+ if (err < 0) { |
3420 |
+ dev_err(card->dev, "Error creating device [card]!\n"); |
3421 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
3422 |
+index aef017ba00708..ed0cfcb05ef0d 100644 |
3423 |
+--- a/sound/pci/hda/patch_realtek.c |
3424 |
++++ b/sound/pci/hda/patch_realtek.c |
3425 |
+@@ -134,6 +134,22 @@ struct alc_spec { |
3426 |
+ * COEF access helper functions |
3427 |
+ */ |
3428 |
+ |
3429 |
++static void coef_mutex_lock(struct hda_codec *codec) |
3430 |
++{ |
3431 |
++ struct alc_spec *spec = codec->spec; |
3432 |
++ |
3433 |
++ snd_hda_power_up_pm(codec); |
3434 |
++ mutex_lock(&spec->coef_mutex); |
3435 |
++} |
3436 |
++ |
3437 |
++static void coef_mutex_unlock(struct hda_codec *codec) |
3438 |
++{ |
3439 |
++ struct alc_spec *spec = codec->spec; |
3440 |
++ |
3441 |
++ mutex_unlock(&spec->coef_mutex); |
3442 |
++ snd_hda_power_down_pm(codec); |
3443 |
++} |
3444 |
++ |
3445 |
+ static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3446 |
+ unsigned int coef_idx) |
3447 |
+ { |
3448 |
+@@ -147,12 +163,11 @@ static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3449 |
+ static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3450 |
+ unsigned int coef_idx) |
3451 |
+ { |
3452 |
+- struct alc_spec *spec = codec->spec; |
3453 |
+ unsigned int val; |
3454 |
+ |
3455 |
+- mutex_lock(&spec->coef_mutex); |
3456 |
++ coef_mutex_lock(codec); |
3457 |
+ val = __alc_read_coefex_idx(codec, nid, coef_idx); |
3458 |
+- mutex_unlock(&spec->coef_mutex); |
3459 |
++ coef_mutex_unlock(codec); |
3460 |
+ return val; |
3461 |
+ } |
3462 |
+ |
3463 |
+@@ -169,11 +184,9 @@ static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3464 |
+ static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3465 |
+ unsigned int coef_idx, unsigned int coef_val) |
3466 |
+ { |
3467 |
+- struct alc_spec *spec = codec->spec; |
3468 |
+- |
3469 |
+- mutex_lock(&spec->coef_mutex); |
3470 |
++ coef_mutex_lock(codec); |
3471 |
+ __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); |
3472 |
+- mutex_unlock(&spec->coef_mutex); |
3473 |
++ coef_mutex_unlock(codec); |
3474 |
+ } |
3475 |
+ |
3476 |
+ #define alc_write_coef_idx(codec, coef_idx, coef_val) \ |
3477 |
+@@ -194,11 +207,9 @@ static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
3478 |
+ unsigned int coef_idx, unsigned int mask, |
3479 |
+ unsigned int bits_set) |
3480 |
+ { |
3481 |
+- struct alc_spec *spec = codec->spec; |
3482 |
+- |
3483 |
+- mutex_lock(&spec->coef_mutex); |
3484 |
++ coef_mutex_lock(codec); |
3485 |
+ __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); |
3486 |
+- mutex_unlock(&spec->coef_mutex); |
3487 |
++ coef_mutex_unlock(codec); |
3488 |
+ } |
3489 |
+ |
3490 |
+ #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ |
3491 |
+@@ -231,9 +242,7 @@ struct coef_fw { |
3492 |
+ static void alc_process_coef_fw(struct hda_codec *codec, |
3493 |
+ const struct coef_fw *fw) |
3494 |
+ { |
3495 |
+- struct alc_spec *spec = codec->spec; |
3496 |
+- |
3497 |
+- mutex_lock(&spec->coef_mutex); |
3498 |
++ coef_mutex_lock(codec); |
3499 |
+ for (; fw->nid; fw++) { |
3500 |
+ if (fw->mask == (unsigned short)-1) |
3501 |
+ __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); |
3502 |
+@@ -241,7 +250,7 @@ static void alc_process_coef_fw(struct hda_codec *codec, |
3503 |
+ __alc_update_coefex_idx(codec, fw->nid, fw->idx, |
3504 |
+ fw->mask, fw->val); |
3505 |
+ } |
3506 |
+- mutex_unlock(&spec->coef_mutex); |
3507 |
++ coef_mutex_unlock(codec); |
3508 |
+ } |
3509 |
+ |
3510 |
+ /* |
3511 |
+@@ -8948,6 +8957,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
3512 |
+ SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), |
3513 |
+ SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF), |
3514 |
+ SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
3515 |
++ SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS), |
3516 |
+ SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP), |
3517 |
+ SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
3518 |
+ SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS), |
3519 |
+diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c |
3520 |
+index 61c3238bc2656..315fd9d971c8c 100644 |
3521 |
+--- a/sound/soc/codecs/tas2770.c |
3522 |
++++ b/sound/soc/codecs/tas2770.c |
3523 |
+@@ -38,10 +38,12 @@ static void tas2770_reset(struct tas2770_priv *tas2770) |
3524 |
+ gpiod_set_value_cansleep(tas2770->reset_gpio, 0); |
3525 |
+ msleep(20); |
3526 |
+ gpiod_set_value_cansleep(tas2770->reset_gpio, 1); |
3527 |
++ usleep_range(1000, 2000); |
3528 |
+ } |
3529 |
+ |
3530 |
+ snd_soc_component_write(tas2770->component, TAS2770_SW_RST, |
3531 |
+ TAS2770_RST); |
3532 |
++ usleep_range(1000, 2000); |
3533 |
+ } |
3534 |
+ |
3535 |
+ static int tas2770_set_bias_level(struct snd_soc_component *component, |
3536 |
+@@ -110,6 +112,7 @@ static int tas2770_codec_resume(struct snd_soc_component *component) |
3537 |
+ |
3538 |
+ if (tas2770->sdz_gpio) { |
3539 |
+ gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); |
3540 |
++ usleep_range(1000, 2000); |
3541 |
+ } else { |
3542 |
+ ret = snd_soc_component_update_bits(component, TAS2770_PWR_CTRL, |
3543 |
+ TAS2770_PWR_CTRL_MASK, |
3544 |
+@@ -510,8 +513,10 @@ static int tas2770_codec_probe(struct snd_soc_component *component) |
3545 |
+ |
3546 |
+ tas2770->component = component; |
3547 |
+ |
3548 |
+- if (tas2770->sdz_gpio) |
3549 |
++ if (tas2770->sdz_gpio) { |
3550 |
+ gpiod_set_value_cansleep(tas2770->sdz_gpio, 1); |
3551 |
++ usleep_range(1000, 2000); |
3552 |
++ } |
3553 |
+ |
3554 |
+ tas2770_reset(tas2770); |
3555 |
+ |
3556 |
+diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c |
3557 |
+index f24f7354f46fe..caa8d45ebb209 100644 |
3558 |
+--- a/sound/soc/soc-ops.c |
3559 |
++++ b/sound/soc/soc-ops.c |
3560 |
+@@ -308,7 +308,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, |
3561 |
+ unsigned int sign_bit = mc->sign_bit; |
3562 |
+ unsigned int mask = (1 << fls(max)) - 1; |
3563 |
+ unsigned int invert = mc->invert; |
3564 |
+- int err; |
3565 |
++ int err, ret; |
3566 |
+ bool type_2r = false; |
3567 |
+ unsigned int val2 = 0; |
3568 |
+ unsigned int val, val_mask; |
3569 |
+@@ -350,12 +350,18 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, |
3570 |
+ err = snd_soc_component_update_bits(component, reg, val_mask, val); |
3571 |
+ if (err < 0) |
3572 |
+ return err; |
3573 |
++ ret = err; |
3574 |
+ |
3575 |
+- if (type_2r) |
3576 |
++ if (type_2r) { |
3577 |
+ err = snd_soc_component_update_bits(component, reg2, val_mask, |
3578 |
+- val2); |
3579 |
++ val2); |
3580 |
++ /* Don't discard any error code or drop change flag */ |
3581 |
++ if (ret == 0 || err < 0) { |
3582 |
++ ret = err; |
3583 |
++ } |
3584 |
++ } |
3585 |
+ |
3586 |
+- return err; |
3587 |
++ return ret; |
3588 |
+ } |
3589 |
+ EXPORT_SYMBOL_GPL(snd_soc_put_volsw); |
3590 |
+ |
3591 |
+@@ -504,7 +510,7 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, |
3592 |
+ unsigned int mask = (1 << fls(max)) - 1; |
3593 |
+ unsigned int invert = mc->invert; |
3594 |
+ unsigned int val, val_mask; |
3595 |
+- int ret; |
3596 |
++ int err, ret; |
3597 |
+ |
3598 |
+ if (invert) |
3599 |
+ val = (max - ucontrol->value.integer.value[0]) & mask; |
3600 |
+@@ -513,9 +519,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, |
3601 |
+ val_mask = mask << shift; |
3602 |
+ val = val << shift; |
3603 |
+ |
3604 |
+- ret = snd_soc_component_update_bits(component, reg, val_mask, val); |
3605 |
+- if (ret < 0) |
3606 |
+- return ret; |
3607 |
++ err = snd_soc_component_update_bits(component, reg, val_mask, val); |
3608 |
++ if (err < 0) |
3609 |
++ return err; |
3610 |
++ ret = err; |
3611 |
+ |
3612 |
+ if (snd_soc_volsw_is_stereo(mc)) { |
3613 |
+ if (invert) |
3614 |
+@@ -525,8 +532,12 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, |
3615 |
+ val_mask = mask << shift; |
3616 |
+ val = val << shift; |
3617 |
+ |
3618 |
+- ret = snd_soc_component_update_bits(component, rreg, val_mask, |
3619 |
++ err = snd_soc_component_update_bits(component, rreg, val_mask, |
3620 |
+ val); |
3621 |
++ /* Don't discard any error code or drop change flag */ |
3622 |
++ if (ret == 0 || err < 0) { |
3623 |
++ ret = err; |
3624 |
++ } |
3625 |
+ } |
3626 |
+ |
3627 |
+ return ret; |
3628 |
+diff --git a/tools/lib/subcmd/subcmd-util.h b/tools/lib/subcmd/subcmd-util.h |
3629 |
+index 794a375dad360..b2aec04fce8f6 100644 |
3630 |
+--- a/tools/lib/subcmd/subcmd-util.h |
3631 |
++++ b/tools/lib/subcmd/subcmd-util.h |
3632 |
+@@ -50,15 +50,8 @@ static NORETURN inline void die(const char *err, ...) |
3633 |
+ static inline void *xrealloc(void *ptr, size_t size) |
3634 |
+ { |
3635 |
+ void *ret = realloc(ptr, size); |
3636 |
+- if (!ret && !size) |
3637 |
+- ret = realloc(ptr, 1); |
3638 |
+- if (!ret) { |
3639 |
+- ret = realloc(ptr, size); |
3640 |
+- if (!ret && !size) |
3641 |
+- ret = realloc(ptr, 1); |
3642 |
+- if (!ret) |
3643 |
+- die("Out of memory, realloc failed"); |
3644 |
+- } |
3645 |
++ if (!ret) |
3646 |
++ die("Out of memory, realloc failed"); |
3647 |
+ return ret; |
3648 |
+ } |
3649 |
+ |
3650 |
+diff --git a/tools/perf/util/bpf-loader.c b/tools/perf/util/bpf-loader.c |
3651 |
+index 0374adcb223c7..ac99c0764bee8 100644 |
3652 |
+--- a/tools/perf/util/bpf-loader.c |
3653 |
++++ b/tools/perf/util/bpf-loader.c |
3654 |
+@@ -1215,9 +1215,10 @@ bpf__obj_config_map(struct bpf_object *obj, |
3655 |
+ pr_debug("ERROR: Invalid map config option '%s'\n", map_opt); |
3656 |
+ err = -BPF_LOADER_ERRNO__OBJCONF_MAP_OPT; |
3657 |
+ out: |
3658 |
+- free(map_name); |
3659 |
+ if (!err) |
3660 |
+ *key_scan_pos += strlen(map_opt); |
3661 |
++ |
3662 |
++ free(map_name); |
3663 |
+ return err; |
3664 |
+ } |
3665 |
+ |
3666 |
+diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c |
3667 |
+index 076cf4325f783..cd4582129c7d6 100644 |
3668 |
+--- a/tools/testing/selftests/clone3/clone3.c |
3669 |
++++ b/tools/testing/selftests/clone3/clone3.c |
3670 |
+@@ -126,8 +126,6 @@ static void test_clone3(uint64_t flags, size_t size, int expected, |
3671 |
+ |
3672 |
+ int main(int argc, char *argv[]) |
3673 |
+ { |
3674 |
+- pid_t pid; |
3675 |
+- |
3676 |
+ uid_t uid = getuid(); |
3677 |
+ |
3678 |
+ ksft_print_header(); |
3679 |
+diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile |
3680 |
+index 12c5e27d32c16..2d7fca446c7f7 100644 |
3681 |
+--- a/tools/testing/selftests/exec/Makefile |
3682 |
++++ b/tools/testing/selftests/exec/Makefile |
3683 |
+@@ -3,8 +3,8 @@ CFLAGS = -Wall |
3684 |
+ CFLAGS += -Wno-nonnull |
3685 |
+ CFLAGS += -D_GNU_SOURCE |
3686 |
+ |
3687 |
+-TEST_PROGS := binfmt_script non-regular |
3688 |
+-TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 |
3689 |
++TEST_PROGS := binfmt_script |
3690 |
++TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular |
3691 |
+ TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir |
3692 |
+ # Makefile is a run-time dependency, since it's accessed by the execveat test |
3693 |
+ TEST_FILES := Makefile |
3694 |
+diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h |
3695 |
+index 5ecb9718e1616..3e7b2e521cde4 100644 |
3696 |
+--- a/tools/testing/selftests/kselftest_harness.h |
3697 |
++++ b/tools/testing/selftests/kselftest_harness.h |
3698 |
+@@ -871,7 +871,8 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext) |
3699 |
+ } |
3700 |
+ |
3701 |
+ t->timed_out = true; |
3702 |
+- kill(t->pid, SIGKILL); |
3703 |
++ // signal process group |
3704 |
++ kill(-(t->pid), SIGKILL); |
3705 |
+ } |
3706 |
+ |
3707 |
+ void __wait_for_test(struct __test_metadata *t) |
3708 |
+@@ -981,6 +982,7 @@ void __run_test(struct __fixture_metadata *f, |
3709 |
+ ksft_print_msg("ERROR SPAWNING TEST CHILD\n"); |
3710 |
+ t->passed = 0; |
3711 |
+ } else if (t->pid == 0) { |
3712 |
++ setpgrp(); |
3713 |
+ t->fn(t, variant); |
3714 |
+ if (t->skip) |
3715 |
+ _exit(255); |
3716 |
+diff --git a/tools/testing/selftests/mincore/mincore_selftest.c b/tools/testing/selftests/mincore/mincore_selftest.c |
3717 |
+index 5a1e85ff5d32a..2cf6f2f277ab8 100644 |
3718 |
+--- a/tools/testing/selftests/mincore/mincore_selftest.c |
3719 |
++++ b/tools/testing/selftests/mincore/mincore_selftest.c |
3720 |
+@@ -208,15 +208,21 @@ TEST(check_file_mmap) |
3721 |
+ |
3722 |
+ errno = 0; |
3723 |
+ fd = open(".", O_TMPFILE | O_RDWR, 0600); |
3724 |
+- ASSERT_NE(-1, fd) { |
3725 |
+- TH_LOG("Can't create temporary file: %s", |
3726 |
+- strerror(errno)); |
3727 |
++ if (fd < 0) { |
3728 |
++ ASSERT_EQ(errno, EOPNOTSUPP) { |
3729 |
++ TH_LOG("Can't create temporary file: %s", |
3730 |
++ strerror(errno)); |
3731 |
++ } |
3732 |
++ SKIP(goto out_free, "O_TMPFILE not supported by filesystem."); |
3733 |
+ } |
3734 |
+ errno = 0; |
3735 |
+ retval = fallocate(fd, 0, 0, FILE_SIZE); |
3736 |
+- ASSERT_EQ(0, retval) { |
3737 |
+- TH_LOG("Error allocating space for the temporary file: %s", |
3738 |
+- strerror(errno)); |
3739 |
++ if (retval) { |
3740 |
++ ASSERT_EQ(errno, EOPNOTSUPP) { |
3741 |
++ TH_LOG("Error allocating space for the temporary file: %s", |
3742 |
++ strerror(errno)); |
3743 |
++ } |
3744 |
++ SKIP(goto out_close, "fallocate not supported by filesystem."); |
3745 |
+ } |
3746 |
+ |
3747 |
+ /* |
3748 |
+@@ -272,7 +278,9 @@ TEST(check_file_mmap) |
3749 |
+ } |
3750 |
+ |
3751 |
+ munmap(addr, FILE_SIZE); |
3752 |
++out_close: |
3753 |
+ close(fd); |
3754 |
++out_free: |
3755 |
+ free(vec); |
3756 |
+ } |
3757 |
+ |
3758 |
+diff --git a/tools/testing/selftests/netfilter/nft_concat_range.sh b/tools/testing/selftests/netfilter/nft_concat_range.sh |
3759 |
+index 9313fa32bef13..b5eef5ffb58e5 100755 |
3760 |
+--- a/tools/testing/selftests/netfilter/nft_concat_range.sh |
3761 |
++++ b/tools/testing/selftests/netfilter/nft_concat_range.sh |
3762 |
+@@ -1583,4 +1583,4 @@ for name in ${TESTS}; do |
3763 |
+ done |
3764 |
+ done |
3765 |
+ |
3766 |
+-[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP} |
3767 |
++[ ${passed} -eq 0 ] && exit ${KSELFTEST_SKIP} || exit 0 |
3768 |
+diff --git a/tools/testing/selftests/openat2/Makefile b/tools/testing/selftests/openat2/Makefile |
3769 |
+index 4b93b1417b862..843ba56d8e49e 100644 |
3770 |
+--- a/tools/testing/selftests/openat2/Makefile |
3771 |
++++ b/tools/testing/selftests/openat2/Makefile |
3772 |
+@@ -5,4 +5,4 @@ TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test |
3773 |
+ |
3774 |
+ include ../lib.mk |
3775 |
+ |
3776 |
+-$(TEST_GEN_PROGS): helpers.c |
3777 |
++$(TEST_GEN_PROGS): helpers.c helpers.h |
3778 |
+diff --git a/tools/testing/selftests/openat2/helpers.h b/tools/testing/selftests/openat2/helpers.h |
3779 |
+index a6ea27344db2d..7056340b9339e 100644 |
3780 |
+--- a/tools/testing/selftests/openat2/helpers.h |
3781 |
++++ b/tools/testing/selftests/openat2/helpers.h |
3782 |
+@@ -9,6 +9,7 @@ |
3783 |
+ |
3784 |
+ #define _GNU_SOURCE |
3785 |
+ #include <stdint.h> |
3786 |
++#include <stdbool.h> |
3787 |
+ #include <errno.h> |
3788 |
+ #include <linux/types.h> |
3789 |
+ #include "../kselftest.h" |
3790 |
+@@ -62,11 +63,12 @@ bool needs_openat2(const struct open_how *how); |
3791 |
+ (similar to chroot(2)). */ |
3792 |
+ #endif /* RESOLVE_IN_ROOT */ |
3793 |
+ |
3794 |
+-#define E_func(func, ...) \ |
3795 |
+- do { \ |
3796 |
+- if (func(__VA_ARGS__) < 0) \ |
3797 |
+- ksft_exit_fail_msg("%s:%d %s failed\n", \ |
3798 |
+- __FILE__, __LINE__, #func);\ |
3799 |
++#define E_func(func, ...) \ |
3800 |
++ do { \ |
3801 |
++ errno = 0; \ |
3802 |
++ if (func(__VA_ARGS__) < 0) \ |
3803 |
++ ksft_exit_fail_msg("%s:%d %s failed - errno:%d\n", \ |
3804 |
++ __FILE__, __LINE__, #func, errno); \ |
3805 |
+ } while (0) |
3806 |
+ |
3807 |
+ #define E_asprintf(...) E_func(asprintf, __VA_ARGS__) |
3808 |
+diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c |
3809 |
+index b386367c606b1..453152b58e7f0 100644 |
3810 |
+--- a/tools/testing/selftests/openat2/openat2_test.c |
3811 |
++++ b/tools/testing/selftests/openat2/openat2_test.c |
3812 |
+@@ -244,6 +244,16 @@ void test_openat2_flags(void) |
3813 |
+ unlink(path); |
3814 |
+ |
3815 |
+ fd = sys_openat2(AT_FDCWD, path, &test->how); |
3816 |
++ if (fd < 0 && fd == -EOPNOTSUPP) { |
3817 |
++ /* |
3818 |
++ * Skip the testcase if it failed because not supported |
3819 |
++ * by FS. (e.g. a valid O_TMPFILE combination on NFS) |
3820 |
++ */ |
3821 |
++ ksft_test_result_skip("openat2 with %s fails with %d (%s)\n", |
3822 |
++ test->name, fd, strerror(-fd)); |
3823 |
++ goto next; |
3824 |
++ } |
3825 |
++ |
3826 |
+ if (test->err >= 0) |
3827 |
+ failed = (fd < 0); |
3828 |
+ else |
3829 |
+@@ -288,7 +298,7 @@ skip: |
3830 |
+ else |
3831 |
+ resultfn("openat2 with %s fails with %d (%s)\n", |
3832 |
+ test->name, test->err, strerror(-test->err)); |
3833 |
+- |
3834 |
++next: |
3835 |
+ free(fdpath); |
3836 |
+ fflush(stdout); |
3837 |
+ } |
3838 |
+diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h |
3839 |
+index 01f8d3c0cf2cb..6922d6417e1cf 100644 |
3840 |
+--- a/tools/testing/selftests/pidfd/pidfd.h |
3841 |
++++ b/tools/testing/selftests/pidfd/pidfd.h |
3842 |
+@@ -68,7 +68,7 @@ |
3843 |
+ #define PIDFD_SKIP 3 |
3844 |
+ #define PIDFD_XFAIL 4 |
3845 |
+ |
3846 |
+-int wait_for_pid(pid_t pid) |
3847 |
++static inline int wait_for_pid(pid_t pid) |
3848 |
+ { |
3849 |
+ int status, ret; |
3850 |
+ |
3851 |
+@@ -78,13 +78,20 @@ again: |
3852 |
+ if (errno == EINTR) |
3853 |
+ goto again; |
3854 |
+ |
3855 |
++ ksft_print_msg("waitpid returned -1, errno=%d\n", errno); |
3856 |
+ return -1; |
3857 |
+ } |
3858 |
+ |
3859 |
+- if (!WIFEXITED(status)) |
3860 |
++ if (!WIFEXITED(status)) { |
3861 |
++ ksft_print_msg( |
3862 |
++ "waitpid !WIFEXITED, WIFSIGNALED=%d, WTERMSIG=%d\n", |
3863 |
++ WIFSIGNALED(status), WTERMSIG(status)); |
3864 |
+ return -1; |
3865 |
++ } |
3866 |
+ |
3867 |
+- return WEXITSTATUS(status); |
3868 |
++ ret = WEXITSTATUS(status); |
3869 |
++ ksft_print_msg("waitpid WEXITSTATUS=%d\n", ret); |
3870 |
++ return ret; |
3871 |
+ } |
3872 |
+ |
3873 |
+ static inline int sys_pidfd_open(pid_t pid, unsigned int flags) |
3874 |
+diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c |
3875 |
+index 22558524f71c3..3fd8e903118f5 100644 |
3876 |
+--- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c |
3877 |
++++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c |
3878 |
+@@ -12,6 +12,7 @@ |
3879 |
+ #include <string.h> |
3880 |
+ #include <syscall.h> |
3881 |
+ #include <sys/wait.h> |
3882 |
++#include <sys/mman.h> |
3883 |
+ |
3884 |
+ #include "pidfd.h" |
3885 |
+ #include "../kselftest.h" |
3886 |
+@@ -80,7 +81,10 @@ static inline int error_check(struct error *err, const char *test_name) |
3887 |
+ return err->code; |
3888 |
+ } |
3889 |
+ |
3890 |
++#define CHILD_STACK_SIZE 8192 |
3891 |
++ |
3892 |
+ struct child { |
3893 |
++ char *stack; |
3894 |
+ pid_t pid; |
3895 |
+ int fd; |
3896 |
+ }; |
3897 |
+@@ -89,17 +93,22 @@ static struct child clone_newns(int (*fn)(void *), void *args, |
3898 |
+ struct error *err) |
3899 |
+ { |
3900 |
+ static int flags = CLONE_PIDFD | CLONE_NEWPID | CLONE_NEWNS | SIGCHLD; |
3901 |
+- size_t stack_size = 1024; |
3902 |
+- char *stack[1024] = { 0 }; |
3903 |
+ struct child ret; |
3904 |
+ |
3905 |
+ if (!(flags & CLONE_NEWUSER) && geteuid() != 0) |
3906 |
+ flags |= CLONE_NEWUSER; |
3907 |
+ |
3908 |
++ ret.stack = mmap(NULL, CHILD_STACK_SIZE, PROT_READ | PROT_WRITE, |
3909 |
++ MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); |
3910 |
++ if (ret.stack == MAP_FAILED) { |
3911 |
++ error_set(err, -1, "mmap of stack failed (errno %d)", errno); |
3912 |
++ return ret; |
3913 |
++ } |
3914 |
++ |
3915 |
+ #ifdef __ia64__ |
3916 |
+- ret.pid = __clone2(fn, stack, stack_size, flags, args, &ret.fd); |
3917 |
++ ret.pid = __clone2(fn, ret.stack, CHILD_STACK_SIZE, flags, args, &ret.fd); |
3918 |
+ #else |
3919 |
+- ret.pid = clone(fn, stack + stack_size, flags, args, &ret.fd); |
3920 |
++ ret.pid = clone(fn, ret.stack + CHILD_STACK_SIZE, flags, args, &ret.fd); |
3921 |
+ #endif |
3922 |
+ |
3923 |
+ if (ret.pid < 0) { |
3924 |
+@@ -129,6 +138,11 @@ static inline int child_join(struct child *child, struct error *err) |
3925 |
+ else if (r > 0) |
3926 |
+ error_set(err, r, "child %d reported: %d", child->pid, r); |
3927 |
+ |
3928 |
++ if (munmap(child->stack, CHILD_STACK_SIZE)) { |
3929 |
++ error_set(err, -1, "munmap of child stack failed (errno %d)", errno); |
3930 |
++ r = -1; |
3931 |
++ } |
3932 |
++ |
3933 |
+ return r; |
3934 |
+ } |
3935 |
+ |
3936 |
+diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c |
3937 |
+index 529eb700ac26a..9a2d64901d591 100644 |
3938 |
+--- a/tools/testing/selftests/pidfd/pidfd_test.c |
3939 |
++++ b/tools/testing/selftests/pidfd/pidfd_test.c |
3940 |
+@@ -441,7 +441,6 @@ static void test_pidfd_poll_exec(int use_waitpid) |
3941 |
+ { |
3942 |
+ int pid, pidfd = 0; |
3943 |
+ int status, ret; |
3944 |
+- pthread_t t1; |
3945 |
+ time_t prog_start = time(NULL); |
3946 |
+ const char *test_name = "pidfd_poll check for premature notification on child thread exec"; |
3947 |
+ |
3948 |
+@@ -500,13 +499,14 @@ static int child_poll_leader_exit_test(void *args) |
3949 |
+ */ |
3950 |
+ *child_exit_secs = time(NULL); |
3951 |
+ syscall(SYS_exit, 0); |
3952 |
++ /* Never reached, but appeases compiler thinking we should return. */ |
3953 |
++ exit(0); |
3954 |
+ } |
3955 |
+ |
3956 |
+ static void test_pidfd_poll_leader_exit(int use_waitpid) |
3957 |
+ { |
3958 |
+ int pid, pidfd = 0; |
3959 |
+- int status, ret; |
3960 |
+- time_t prog_start = time(NULL); |
3961 |
++ int status, ret = 0; |
3962 |
+ const char *test_name = "pidfd_poll check for premature notification on non-empty" |
3963 |
+ "group leader exit"; |
3964 |
+ |
3965 |
+diff --git a/tools/testing/selftests/pidfd/pidfd_wait.c b/tools/testing/selftests/pidfd/pidfd_wait.c |
3966 |
+index be2943f072f60..17999e082aa71 100644 |
3967 |
+--- a/tools/testing/selftests/pidfd/pidfd_wait.c |
3968 |
++++ b/tools/testing/selftests/pidfd/pidfd_wait.c |
3969 |
+@@ -39,7 +39,7 @@ static int sys_waitid(int which, pid_t pid, siginfo_t *info, int options, |
3970 |
+ |
3971 |
+ TEST(wait_simple) |
3972 |
+ { |
3973 |
+- int pidfd = -1, status = 0; |
3974 |
++ int pidfd = -1; |
3975 |
+ pid_t parent_tid = -1; |
3976 |
+ struct clone_args args = { |
3977 |
+ .parent_tid = ptr_to_u64(&parent_tid), |
3978 |
+@@ -47,7 +47,6 @@ TEST(wait_simple) |
3979 |
+ .flags = CLONE_PIDFD | CLONE_PARENT_SETTID, |
3980 |
+ .exit_signal = SIGCHLD, |
3981 |
+ }; |
3982 |
+- int ret; |
3983 |
+ pid_t pid; |
3984 |
+ siginfo_t info = { |
3985 |
+ .si_signo = 0, |
3986 |
+@@ -88,7 +87,7 @@ TEST(wait_simple) |
3987 |
+ |
3988 |
+ TEST(wait_states) |
3989 |
+ { |
3990 |
+- int pidfd = -1, status = 0; |
3991 |
++ int pidfd = -1; |
3992 |
+ pid_t parent_tid = -1; |
3993 |
+ struct clone_args args = { |
3994 |
+ .parent_tid = ptr_to_u64(&parent_tid), |
3995 |
+diff --git a/tools/testing/selftests/rtc/settings b/tools/testing/selftests/rtc/settings |
3996 |
+index ba4d85f74cd6b..a953c96aa16e1 100644 |
3997 |
+--- a/tools/testing/selftests/rtc/settings |
3998 |
++++ b/tools/testing/selftests/rtc/settings |
3999 |
+@@ -1 +1 @@ |
4000 |
+-timeout=90 |
4001 |
++timeout=180 |
4002 |
+diff --git a/tools/testing/selftests/zram/zram.sh b/tools/testing/selftests/zram/zram.sh |
4003 |
+index 232e958ec4547..b0b91d9b0dc21 100755 |
4004 |
+--- a/tools/testing/selftests/zram/zram.sh |
4005 |
++++ b/tools/testing/selftests/zram/zram.sh |
4006 |
+@@ -2,9 +2,6 @@ |
4007 |
+ # SPDX-License-Identifier: GPL-2.0 |
4008 |
+ TCID="zram.sh" |
4009 |
+ |
4010 |
+-# Kselftest framework requirement - SKIP code is 4. |
4011 |
+-ksft_skip=4 |
4012 |
+- |
4013 |
+ . ./zram_lib.sh |
4014 |
+ |
4015 |
+ run_zram () { |
4016 |
+@@ -18,14 +15,4 @@ echo "" |
4017 |
+ |
4018 |
+ check_prereqs |
4019 |
+ |
4020 |
+-# check zram module exists |
4021 |
+-MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko |
4022 |
+-if [ -f $MODULE_PATH ]; then |
4023 |
+- run_zram |
4024 |
+-elif [ -b /dev/zram0 ]; then |
4025 |
+- run_zram |
4026 |
+-else |
4027 |
+- echo "$TCID : No zram.ko module or /dev/zram0 device file not found" |
4028 |
+- echo "$TCID : CONFIG_ZRAM is not set" |
4029 |
+- exit $ksft_skip |
4030 |
+-fi |
4031 |
++run_zram |
4032 |
+diff --git a/tools/testing/selftests/zram/zram01.sh b/tools/testing/selftests/zram/zram01.sh |
4033 |
+index 114863d9fb876..8f4affe34f3e4 100755 |
4034 |
+--- a/tools/testing/selftests/zram/zram01.sh |
4035 |
++++ b/tools/testing/selftests/zram/zram01.sh |
4036 |
+@@ -33,9 +33,7 @@ zram_algs="lzo" |
4037 |
+ |
4038 |
+ zram_fill_fs() |
4039 |
+ { |
4040 |
+- local mem_free0=$(free -m | awk 'NR==2 {print $4}') |
4041 |
+- |
4042 |
+- for i in $(seq 0 $(($dev_num - 1))); do |
4043 |
++ for i in $(seq $dev_start $dev_end); do |
4044 |
+ echo "fill zram$i..." |
4045 |
+ local b=0 |
4046 |
+ while [ true ]; do |
4047 |
+@@ -45,29 +43,17 @@ zram_fill_fs() |
4048 |
+ b=$(($b + 1)) |
4049 |
+ done |
4050 |
+ echo "zram$i can be filled with '$b' KB" |
4051 |
+- done |
4052 |
+ |
4053 |
+- local mem_free1=$(free -m | awk 'NR==2 {print $4}') |
4054 |
+- local used_mem=$(($mem_free0 - $mem_free1)) |
4055 |
++ local mem_used_total=`awk '{print $3}' "/sys/block/zram$i/mm_stat"` |
4056 |
++ local v=$((100 * 1024 * $b / $mem_used_total)) |
4057 |
++ if [ "$v" -lt 100 ]; then |
4058 |
++ echo "FAIL compression ratio: 0.$v:1" |
4059 |
++ ERR_CODE=-1 |
4060 |
++ return |
4061 |
++ fi |
4062 |
+ |
4063 |
+- local total_size=0 |
4064 |
+- for sm in $zram_sizes; do |
4065 |
+- local s=$(echo $sm | sed 's/M//') |
4066 |
+- total_size=$(($total_size + $s)) |
4067 |
++ echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" |
4068 |
+ done |
4069 |
+- |
4070 |
+- echo "zram used ${used_mem}M, zram disk sizes ${total_size}M" |
4071 |
+- |
4072 |
+- local v=$((100 * $total_size / $used_mem)) |
4073 |
+- |
4074 |
+- if [ "$v" -lt 100 ]; then |
4075 |
+- echo "FAIL compression ratio: 0.$v:1" |
4076 |
+- ERR_CODE=-1 |
4077 |
+- zram_cleanup |
4078 |
+- return |
4079 |
+- fi |
4080 |
+- |
4081 |
+- echo "zram compression ratio: $(echo "scale=2; $v / 100 " | bc):1: OK" |
4082 |
+ } |
4083 |
+ |
4084 |
+ check_prereqs |
4085 |
+@@ -81,7 +67,6 @@ zram_mount |
4086 |
+ |
4087 |
+ zram_fill_fs |
4088 |
+ zram_cleanup |
4089 |
+-zram_unload |
4090 |
+ |
4091 |
+ if [ $ERR_CODE -ne 0 ]; then |
4092 |
+ echo "$TCID : [FAIL]" |
4093 |
+diff --git a/tools/testing/selftests/zram/zram02.sh b/tools/testing/selftests/zram/zram02.sh |
4094 |
+index e83b404807c09..2418b0c4ed136 100755 |
4095 |
+--- a/tools/testing/selftests/zram/zram02.sh |
4096 |
++++ b/tools/testing/selftests/zram/zram02.sh |
4097 |
+@@ -36,7 +36,6 @@ zram_set_memlimit |
4098 |
+ zram_makeswap |
4099 |
+ zram_swapoff |
4100 |
+ zram_cleanup |
4101 |
+-zram_unload |
4102 |
+ |
4103 |
+ if [ $ERR_CODE -ne 0 ]; then |
4104 |
+ echo "$TCID : [FAIL]" |
4105 |
+diff --git a/tools/testing/selftests/zram/zram_lib.sh b/tools/testing/selftests/zram/zram_lib.sh |
4106 |
+index 6f872f266fd11..21ec1966de76c 100755 |
4107 |
+--- a/tools/testing/selftests/zram/zram_lib.sh |
4108 |
++++ b/tools/testing/selftests/zram/zram_lib.sh |
4109 |
+@@ -5,12 +5,17 @@ |
4110 |
+ # Author: Alexey Kodanev <alexey.kodanev@××××××.com> |
4111 |
+ # Modified: Naresh Kamboju <naresh.kamboju@××××××.org> |
4112 |
+ |
4113 |
+-MODULE=0 |
4114 |
+ dev_makeswap=-1 |
4115 |
+ dev_mounted=-1 |
4116 |
+- |
4117 |
++dev_start=0 |
4118 |
++dev_end=-1 |
4119 |
++module_load=-1 |
4120 |
++sys_control=-1 |
4121 |
+ # Kselftest framework requirement - SKIP code is 4. |
4122 |
+ ksft_skip=4 |
4123 |
++kernel_version=`uname -r | cut -d'.' -f1,2` |
4124 |
++kernel_major=${kernel_version%.*} |
4125 |
++kernel_minor=${kernel_version#*.} |
4126 |
+ |
4127 |
+ trap INT |
4128 |
+ |
4129 |
+@@ -25,68 +30,104 @@ check_prereqs() |
4130 |
+ fi |
4131 |
+ } |
4132 |
+ |
4133 |
++kernel_gte() |
4134 |
++{ |
4135 |
++ major=${1%.*} |
4136 |
++ minor=${1#*.} |
4137 |
++ |
4138 |
++ if [ $kernel_major -gt $major ]; then |
4139 |
++ return 0 |
4140 |
++ elif [[ $kernel_major -eq $major && $kernel_minor -ge $minor ]]; then |
4141 |
++ return 0 |
4142 |
++ fi |
4143 |
++ |
4144 |
++ return 1 |
4145 |
++} |
4146 |
++ |
4147 |
+ zram_cleanup() |
4148 |
+ { |
4149 |
+ echo "zram cleanup" |
4150 |
+ local i= |
4151 |
+- for i in $(seq 0 $dev_makeswap); do |
4152 |
++ for i in $(seq $dev_start $dev_makeswap); do |
4153 |
+ swapoff /dev/zram$i |
4154 |
+ done |
4155 |
+ |
4156 |
+- for i in $(seq 0 $dev_mounted); do |
4157 |
++ for i in $(seq $dev_start $dev_mounted); do |
4158 |
+ umount /dev/zram$i |
4159 |
+ done |
4160 |
+ |
4161 |
+- for i in $(seq 0 $(($dev_num - 1))); do |
4162 |
++ for i in $(seq $dev_start $dev_end); do |
4163 |
+ echo 1 > /sys/block/zram${i}/reset |
4164 |
+ rm -rf zram$i |
4165 |
+ done |
4166 |
+ |
4167 |
+-} |
4168 |
++ if [ $sys_control -eq 1 ]; then |
4169 |
++ for i in $(seq $dev_start $dev_end); do |
4170 |
++ echo $i > /sys/class/zram-control/hot_remove |
4171 |
++ done |
4172 |
++ fi |
4173 |
+ |
4174 |
+-zram_unload() |
4175 |
+-{ |
4176 |
+- if [ $MODULE -ne 0 ] ; then |
4177 |
+- echo "zram rmmod zram" |
4178 |
++ if [ $module_load -eq 1 ]; then |
4179 |
+ rmmod zram > /dev/null 2>&1 |
4180 |
+ fi |
4181 |
+ } |
4182 |
+ |
4183 |
+ zram_load() |
4184 |
+ { |
4185 |
+- # check zram module exists |
4186 |
+- MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko |
4187 |
+- if [ -f $MODULE_PATH ]; then |
4188 |
+- MODULE=1 |
4189 |
+- echo "create '$dev_num' zram device(s)" |
4190 |
+- modprobe zram num_devices=$dev_num |
4191 |
+- if [ $? -ne 0 ]; then |
4192 |
+- echo "failed to insert zram module" |
4193 |
+- exit 1 |
4194 |
+- fi |
4195 |
+- |
4196 |
+- dev_num_created=$(ls /dev/zram* | wc -w) |
4197 |
++ echo "create '$dev_num' zram device(s)" |
4198 |
++ |
4199 |
++ # zram module loaded, new kernel |
4200 |
++ if [ -d "/sys/class/zram-control" ]; then |
4201 |
++ echo "zram modules already loaded, kernel supports" \ |
4202 |
++ "zram-control interface" |
4203 |
++ dev_start=$(ls /dev/zram* | wc -w) |
4204 |
++ dev_end=$(($dev_start + $dev_num - 1)) |
4205 |
++ sys_control=1 |
4206 |
++ |
4207 |
++ for i in $(seq $dev_start $dev_end); do |
4208 |
++ cat /sys/class/zram-control/hot_add > /dev/null |
4209 |
++ done |
4210 |
++ |
4211 |
++ echo "all zram devices (/dev/zram$dev_start~$dev_end" \ |
4212 |
++ "successfully created" |
4213 |
++ return 0 |
4214 |
++ fi |
4215 |
+ |
4216 |
+- if [ "$dev_num_created" -ne "$dev_num" ]; then |
4217 |
+- echo "unexpected num of devices: $dev_num_created" |
4218 |
+- ERR_CODE=-1 |
4219 |
++ # detect old kernel or built-in |
4220 |
++ modprobe zram num_devices=$dev_num |
4221 |
++ if [ ! -d "/sys/class/zram-control" ]; then |
4222 |
++ if grep -q '^zram' /proc/modules; then |
4223 |
++ rmmod zram > /dev/null 2>&1 |
4224 |
++ if [ $? -ne 0 ]; then |
4225 |
++ echo "zram module is being used on old kernel" \ |
4226 |
++ "without zram-control interface" |
4227 |
++ exit $ksft_skip |
4228 |
++ fi |
4229 |
+ else |
4230 |
+- echo "zram load module successful" |
4231 |
++ echo "test needs CONFIG_ZRAM=m on old kernel without" \ |
4232 |
++ "zram-control interface" |
4233 |
++ exit $ksft_skip |
4234 |
+ fi |
4235 |
+- elif [ -b /dev/zram0 ]; then |
4236 |
+- echo "/dev/zram0 device file found: OK" |
4237 |
+- else |
4238 |
+- echo "ERROR: No zram.ko module or no /dev/zram0 device found" |
4239 |
+- echo "$TCID : CONFIG_ZRAM is not set" |
4240 |
+- exit 1 |
4241 |
++ modprobe zram num_devices=$dev_num |
4242 |
+ fi |
4243 |
++ |
4244 |
++ module_load=1 |
4245 |
++ dev_end=$(($dev_num - 1)) |
4246 |
++ echo "all zram devices (/dev/zram0~$dev_end) successfully created" |
4247 |
+ } |
4248 |
+ |
4249 |
+ zram_max_streams() |
4250 |
+ { |
4251 |
+ echo "set max_comp_streams to zram device(s)" |
4252 |
+ |
4253 |
+- local i=0 |
4254 |
++ kernel_gte 4.7 |
4255 |
++ if [ $? -eq 0 ]; then |
4256 |
++ echo "The device attribute max_comp_streams was"\ |
4257 |
++ "deprecated in 4.7" |
4258 |
++ return 0 |
4259 |
++ fi |
4260 |
++ |
4261 |
++ local i=$dev_start |
4262 |
+ for max_s in $zram_max_streams; do |
4263 |
+ local sys_path="/sys/block/zram${i}/max_comp_streams" |
4264 |
+ echo $max_s > $sys_path || \ |
4265 |
+@@ -98,7 +139,7 @@ zram_max_streams() |
4266 |
+ echo "FAIL can't set max_streams '$max_s', get $max_stream" |
4267 |
+ |
4268 |
+ i=$(($i + 1)) |
4269 |
+- echo "$sys_path = '$max_streams' ($i/$dev_num)" |
4270 |
++ echo "$sys_path = '$max_streams'" |
4271 |
+ done |
4272 |
+ |
4273 |
+ echo "zram max streams: OK" |
4274 |
+@@ -108,15 +149,16 @@ zram_compress_alg() |
4275 |
+ { |
4276 |
+ echo "test that we can set compression algorithm" |
4277 |
+ |
4278 |
+- local algs=$(cat /sys/block/zram0/comp_algorithm) |
4279 |
++ local i=$dev_start |
4280 |
++ local algs=$(cat /sys/block/zram${i}/comp_algorithm) |
4281 |
+ echo "supported algs: $algs" |
4282 |
+- local i=0 |
4283 |
++ |
4284 |
+ for alg in $zram_algs; do |
4285 |
+ local sys_path="/sys/block/zram${i}/comp_algorithm" |
4286 |
+ echo "$alg" > $sys_path || \ |
4287 |
+ echo "FAIL can't set '$alg' to $sys_path" |
4288 |
+ i=$(($i + 1)) |
4289 |
+- echo "$sys_path = '$alg' ($i/$dev_num)" |
4290 |
++ echo "$sys_path = '$alg'" |
4291 |
+ done |
4292 |
+ |
4293 |
+ echo "zram set compression algorithm: OK" |
4294 |
+@@ -125,14 +167,14 @@ zram_compress_alg() |
4295 |
+ zram_set_disksizes() |
4296 |
+ { |
4297 |
+ echo "set disk size to zram device(s)" |
4298 |
+- local i=0 |
4299 |
++ local i=$dev_start |
4300 |
+ for ds in $zram_sizes; do |
4301 |
+ local sys_path="/sys/block/zram${i}/disksize" |
4302 |
+ echo "$ds" > $sys_path || \ |
4303 |
+ echo "FAIL can't set '$ds' to $sys_path" |
4304 |
+ |
4305 |
+ i=$(($i + 1)) |
4306 |
+- echo "$sys_path = '$ds' ($i/$dev_num)" |
4307 |
++ echo "$sys_path = '$ds'" |
4308 |
+ done |
4309 |
+ |
4310 |
+ echo "zram set disksizes: OK" |
4311 |
+@@ -142,14 +184,14 @@ zram_set_memlimit() |
4312 |
+ { |
4313 |
+ echo "set memory limit to zram device(s)" |
4314 |
+ |
4315 |
+- local i=0 |
4316 |
++ local i=$dev_start |
4317 |
+ for ds in $zram_mem_limits; do |
4318 |
+ local sys_path="/sys/block/zram${i}/mem_limit" |
4319 |
+ echo "$ds" > $sys_path || \ |
4320 |
+ echo "FAIL can't set '$ds' to $sys_path" |
4321 |
+ |
4322 |
+ i=$(($i + 1)) |
4323 |
+- echo "$sys_path = '$ds' ($i/$dev_num)" |
4324 |
++ echo "$sys_path = '$ds'" |
4325 |
+ done |
4326 |
+ |
4327 |
+ echo "zram set memory limit: OK" |
4328 |
+@@ -158,8 +200,8 @@ zram_set_memlimit() |
4329 |
+ zram_makeswap() |
4330 |
+ { |
4331 |
+ echo "make swap with zram device(s)" |
4332 |
+- local i=0 |
4333 |
+- for i in $(seq 0 $(($dev_num - 1))); do |
4334 |
++ local i=$dev_start |
4335 |
++ for i in $(seq $dev_start $dev_end); do |
4336 |
+ mkswap /dev/zram$i > err.log 2>&1 |
4337 |
+ if [ $? -ne 0 ]; then |
4338 |
+ cat err.log |
4339 |
+@@ -182,7 +224,7 @@ zram_makeswap() |
4340 |
+ zram_swapoff() |
4341 |
+ { |
4342 |
+ local i= |
4343 |
+- for i in $(seq 0 $dev_makeswap); do |
4344 |
++ for i in $(seq $dev_start $dev_end); do |
4345 |
+ swapoff /dev/zram$i > err.log 2>&1 |
4346 |
+ if [ $? -ne 0 ]; then |
4347 |
+ cat err.log |
4348 |
+@@ -196,7 +238,7 @@ zram_swapoff() |
4349 |
+ |
4350 |
+ zram_makefs() |
4351 |
+ { |
4352 |
+- local i=0 |
4353 |
++ local i=$dev_start |
4354 |
+ for fs in $zram_filesystems; do |
4355 |
+ # if requested fs not supported default it to ext2 |
4356 |
+ which mkfs.$fs > /dev/null 2>&1 || fs=ext2 |
4357 |
+@@ -215,7 +257,7 @@ zram_makefs() |
4358 |
+ zram_mount() |
4359 |
+ { |
4360 |
+ local i=0 |
4361 |
+- for i in $(seq 0 $(($dev_num - 1))); do |
4362 |
++ for i in $(seq $dev_start $dev_end); do |
4363 |
+ echo "mount /dev/zram$i" |
4364 |
+ mkdir zram$i |
4365 |
+ mount /dev/zram$i zram$i > /dev/null || \ |