1 |
commit: 754b21641176c91012ec25b458b4d7d40efab80b |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jan 9 11:15:33 2020 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 9 11:15:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=754b2164 |
7 |
|
8 |
Linux patch 4.19.94 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1093_linux-4.19.94.patch | 4602 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4606 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index bedb928..a11cb8a 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -411,6 +411,10 @@ Patch: 1092_linux-4.19.93.patch |
21 |
From: https://www.kernel.org |
22 |
Desc: Linux 4.19.93 |
23 |
|
24 |
+Patch: 1093_linux-4.19.94.patch |
25 |
+From: https://www.kernel.org |
26 |
+Desc: Linux 4.19.94 |
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/1093_linux-4.19.94.patch b/1093_linux-4.19.94.patch |
33 |
new file mode 100644 |
34 |
index 0000000..34de981 |
35 |
--- /dev/null |
36 |
+++ b/1093_linux-4.19.94.patch |
37 |
@@ -0,0 +1,4602 @@ |
38 |
+diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt |
39 |
+index 2c0d6ae221a1..e6b6ec974eeb 100644 |
40 |
+--- a/Documentation/admin-guide/kernel-parameters.txt |
41 |
++++ b/Documentation/admin-guide/kernel-parameters.txt |
42 |
+@@ -113,7 +113,7 @@ |
43 |
+ the GPE dispatcher. |
44 |
+ This facility can be used to prevent such uncontrolled |
45 |
+ GPE floodings. |
46 |
+- Format: <int> |
47 |
++ Format: <byte> |
48 |
+ |
49 |
+ acpi_no_auto_serialize [HW,ACPI] |
50 |
+ Disable auto-serialization of AML methods |
51 |
+diff --git a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
52 |
+index e96e085271c1..83f6c6a7c41c 100644 |
53 |
+--- a/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
54 |
++++ b/Documentation/devicetree/bindings/clock/renesas,rcar-usb2-clock-sel.txt |
55 |
+@@ -46,7 +46,7 @@ Required properties: |
56 |
+ Example (R-Car H3): |
57 |
+ |
58 |
+ usb2_clksel: clock-controller@e6590630 { |
59 |
+- compatible = "renesas,r8a77950-rcar-usb2-clock-sel", |
60 |
++ compatible = "renesas,r8a7795-rcar-usb2-clock-sel", |
61 |
+ "renesas,rcar-gen3-usb2-clock-sel"; |
62 |
+ reg = <0 0xe6590630 0 0x02>; |
63 |
+ clocks = <&cpg CPG_MOD 703>, <&usb_extal>, <&usb_xtal>; |
64 |
+diff --git a/Makefile b/Makefile |
65 |
+index b3b166c93125..3c892a77194f 100644 |
66 |
+--- a/Makefile |
67 |
++++ b/Makefile |
68 |
+@@ -1,7 +1,7 @@ |
69 |
+ # SPDX-License-Identifier: GPL-2.0 |
70 |
+ VERSION = 4 |
71 |
+ PATCHLEVEL = 19 |
72 |
+-SUBLEVEL = 93 |
73 |
++SUBLEVEL = 94 |
74 |
+ EXTRAVERSION = |
75 |
+ NAME = "People's Front" |
76 |
+ |
77 |
+diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
78 |
+index 00f7be6d83f7..09a27e066d8e 100644 |
79 |
+--- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
80 |
++++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |
81 |
+@@ -293,7 +293,7 @@ |
82 |
+ }; |
83 |
+ |
84 |
+ &usb0_phy { |
85 |
+- status = "okay"; |
86 |
++ status = "disabled"; |
87 |
+ phy-supply = <&usb_otg_pwr>; |
88 |
+ }; |
89 |
+ |
90 |
+@@ -303,7 +303,7 @@ |
91 |
+ }; |
92 |
+ |
93 |
+ &usb0 { |
94 |
+- status = "okay"; |
95 |
++ status = "disabled"; |
96 |
+ }; |
97 |
+ |
98 |
+ &usb1 { |
99 |
+diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h |
100 |
+index e060c2746f36..5be015e2133a 100644 |
101 |
+--- a/arch/arm64/include/asm/pgtable-prot.h |
102 |
++++ b/arch/arm64/include/asm/pgtable-prot.h |
103 |
+@@ -96,13 +96,12 @@ |
104 |
+ #define PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_WRITE) |
105 |
+ #define PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN | PTE_UXN) |
106 |
+ #define PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_RDONLY | PTE_NG | PTE_PXN) |
107 |
+-#define PAGE_EXECONLY __pgprot(_PAGE_DEFAULT | PTE_RDONLY | PTE_NG | PTE_PXN) |
108 |
+ |
109 |
+ #define __P000 PAGE_NONE |
110 |
+ #define __P001 PAGE_READONLY |
111 |
+ #define __P010 PAGE_READONLY |
112 |
+ #define __P011 PAGE_READONLY |
113 |
+-#define __P100 PAGE_EXECONLY |
114 |
++#define __P100 PAGE_READONLY_EXEC |
115 |
+ #define __P101 PAGE_READONLY_EXEC |
116 |
+ #define __P110 PAGE_READONLY_EXEC |
117 |
+ #define __P111 PAGE_READONLY_EXEC |
118 |
+@@ -111,7 +110,7 @@ |
119 |
+ #define __S001 PAGE_READONLY |
120 |
+ #define __S010 PAGE_SHARED |
121 |
+ #define __S011 PAGE_SHARED |
122 |
+-#define __S100 PAGE_EXECONLY |
123 |
++#define __S100 PAGE_READONLY_EXEC |
124 |
+ #define __S101 PAGE_READONLY_EXEC |
125 |
+ #define __S110 PAGE_SHARED_EXEC |
126 |
+ #define __S111 PAGE_SHARED_EXEC |
127 |
+diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h |
128 |
+index 7ae553c15b9a..291fed0a9df8 100644 |
129 |
+--- a/arch/arm64/include/asm/pgtable.h |
130 |
++++ b/arch/arm64/include/asm/pgtable.h |
131 |
+@@ -105,12 +105,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
132 |
+ #define pte_dirty(pte) (pte_sw_dirty(pte) || pte_hw_dirty(pte)) |
133 |
+ |
134 |
+ #define pte_valid(pte) (!!(pte_val(pte) & PTE_VALID)) |
135 |
+-/* |
136 |
+- * Execute-only user mappings do not have the PTE_USER bit set. All valid |
137 |
+- * kernel mappings have the PTE_UXN bit set. |
138 |
+- */ |
139 |
+ #define pte_valid_not_user(pte) \ |
140 |
+- ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == (PTE_VALID | PTE_UXN)) |
141 |
++ ((pte_val(pte) & (PTE_VALID | PTE_USER)) == PTE_VALID) |
142 |
+ #define pte_valid_young(pte) \ |
143 |
+ ((pte_val(pte) & (PTE_VALID | PTE_AF)) == (PTE_VALID | PTE_AF)) |
144 |
+ #define pte_valid_user(pte) \ |
145 |
+@@ -126,8 +122,8 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; |
146 |
+ |
147 |
+ /* |
148 |
+ * p??_access_permitted() is true for valid user mappings (subject to the |
149 |
+- * write permission check) other than user execute-only which do not have the |
150 |
+- * PTE_USER bit set. PROT_NONE mappings do not have the PTE_VALID bit set. |
151 |
++ * write permission check). PROT_NONE mappings do not have the PTE_VALID bit |
152 |
++ * set. |
153 |
+ */ |
154 |
+ #define pte_access_permitted(pte, write) \ |
155 |
+ (pte_valid_user(pte) && (!(write) || pte_write(pte))) |
156 |
+diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c |
157 |
+index 88cf0a0cb616..b046006a387f 100644 |
158 |
+--- a/arch/arm64/mm/fault.c |
159 |
++++ b/arch/arm64/mm/fault.c |
160 |
+@@ -428,7 +428,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, |
161 |
+ struct mm_struct *mm; |
162 |
+ struct siginfo si; |
163 |
+ vm_fault_t fault, major = 0; |
164 |
+- unsigned long vm_flags = VM_READ | VM_WRITE; |
165 |
++ unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC; |
166 |
+ unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; |
167 |
+ |
168 |
+ if (notify_page_fault(regs, esr)) |
169 |
+diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h |
170 |
+index 4993db40482c..ee26f9a4575d 100644 |
171 |
+--- a/arch/mips/include/asm/thread_info.h |
172 |
++++ b/arch/mips/include/asm/thread_info.h |
173 |
+@@ -49,8 +49,26 @@ struct thread_info { |
174 |
+ .addr_limit = KERNEL_DS, \ |
175 |
+ } |
176 |
+ |
177 |
+-/* How to get the thread information struct from C. */ |
178 |
++/* |
179 |
++ * A pointer to the struct thread_info for the currently executing thread is |
180 |
++ * held in register $28/$gp. |
181 |
++ * |
182 |
++ * We declare __current_thread_info as a global register variable rather than a |
183 |
++ * local register variable within current_thread_info() because clang doesn't |
184 |
++ * support explicit local register variables. |
185 |
++ * |
186 |
++ * When building the VDSO we take care not to declare the global register |
187 |
++ * variable because this causes GCC to not preserve the value of $28/$gp in |
188 |
++ * functions that change its value (which is common in the PIC VDSO when |
189 |
++ * accessing the GOT). Since the VDSO shouldn't be accessing |
190 |
++ * __current_thread_info anyway we declare it extern in order to cause a link |
191 |
++ * failure if it's referenced. |
192 |
++ */ |
193 |
++#ifdef __VDSO__ |
194 |
++extern struct thread_info *__current_thread_info; |
195 |
++#else |
196 |
+ register struct thread_info *__current_thread_info __asm__("$28"); |
197 |
++#endif |
198 |
+ |
199 |
+ static inline struct thread_info *current_thread_info(void) |
200 |
+ { |
201 |
+diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h |
202 |
+index e991821dd7fa..a061c3d48c48 100644 |
203 |
+--- a/arch/powerpc/include/asm/kvm_ppc.h |
204 |
++++ b/arch/powerpc/include/asm/kvm_ppc.h |
205 |
+@@ -458,9 +458,100 @@ static inline u32 kvmppc_get_xics_latch(void) |
206 |
+ return xirr; |
207 |
+ } |
208 |
+ |
209 |
+-static inline void kvmppc_set_host_ipi(int cpu, u8 host_ipi) |
210 |
++/* |
211 |
++ * To avoid the need to unnecessarily exit fully to the host kernel, an IPI to |
212 |
++ * a CPU thread that's running/napping inside of a guest is by default regarded |
213 |
++ * as a request to wake the CPU (if needed) and continue execution within the |
214 |
++ * guest, potentially to process new state like externally-generated |
215 |
++ * interrupts or IPIs sent from within the guest itself (e.g. H_PROD/H_IPI). |
216 |
++ * |
217 |
++ * To force an exit to the host kernel, kvmppc_set_host_ipi() must be called |
218 |
++ * prior to issuing the IPI to set the corresponding 'host_ipi' flag in the |
219 |
++ * target CPU's PACA. To avoid unnecessary exits to the host, this flag should |
220 |
++ * be immediately cleared via kvmppc_clear_host_ipi() by the IPI handler on |
221 |
++ * the receiving side prior to processing the IPI work. |
222 |
++ * |
223 |
++ * NOTE: |
224 |
++ * |
225 |
++ * We currently issue an smp_mb() at the beginning of kvmppc_set_host_ipi(). |
226 |
++ * This is to guard against sequences such as the following: |
227 |
++ * |
228 |
++ * CPU |
229 |
++ * X: smp_muxed_ipi_set_message(): |
230 |
++ * X: smp_mb() |
231 |
++ * X: message[RESCHEDULE] = 1 |
232 |
++ * X: doorbell_global_ipi(42): |
233 |
++ * X: kvmppc_set_host_ipi(42) |
234 |
++ * X: ppc_msgsnd_sync()/smp_mb() |
235 |
++ * X: ppc_msgsnd() -> 42 |
236 |
++ * 42: doorbell_exception(): // from CPU X |
237 |
++ * 42: ppc_msgsync() |
238 |
++ * 105: smp_muxed_ipi_set_message(): |
239 |
++ * 105: smb_mb() |
240 |
++ * // STORE DEFERRED DUE TO RE-ORDERING |
241 |
++ * --105: message[CALL_FUNCTION] = 1 |
242 |
++ * | 105: doorbell_global_ipi(42): |
243 |
++ * | 105: kvmppc_set_host_ipi(42) |
244 |
++ * | 42: kvmppc_clear_host_ipi(42) |
245 |
++ * | 42: smp_ipi_demux_relaxed() |
246 |
++ * | 42: // returns to executing guest |
247 |
++ * | // RE-ORDERED STORE COMPLETES |
248 |
++ * ->105: message[CALL_FUNCTION] = 1 |
249 |
++ * 105: ppc_msgsnd_sync()/smp_mb() |
250 |
++ * 105: ppc_msgsnd() -> 42 |
251 |
++ * 42: local_paca->kvm_hstate.host_ipi == 0 // IPI ignored |
252 |
++ * 105: // hangs waiting on 42 to process messages/call_single_queue |
253 |
++ * |
254 |
++ * We also issue an smp_mb() at the end of kvmppc_clear_host_ipi(). This is |
255 |
++ * to guard against sequences such as the following (as well as to create |
256 |
++ * a read-side pairing with the barrier in kvmppc_set_host_ipi()): |
257 |
++ * |
258 |
++ * CPU |
259 |
++ * X: smp_muxed_ipi_set_message(): |
260 |
++ * X: smp_mb() |
261 |
++ * X: message[RESCHEDULE] = 1 |
262 |
++ * X: doorbell_global_ipi(42): |
263 |
++ * X: kvmppc_set_host_ipi(42) |
264 |
++ * X: ppc_msgsnd_sync()/smp_mb() |
265 |
++ * X: ppc_msgsnd() -> 42 |
266 |
++ * 42: doorbell_exception(): // from CPU X |
267 |
++ * 42: ppc_msgsync() |
268 |
++ * // STORE DEFERRED DUE TO RE-ORDERING |
269 |
++ * -- 42: kvmppc_clear_host_ipi(42) |
270 |
++ * | 42: smp_ipi_demux_relaxed() |
271 |
++ * | 105: smp_muxed_ipi_set_message(): |
272 |
++ * | 105: smb_mb() |
273 |
++ * | 105: message[CALL_FUNCTION] = 1 |
274 |
++ * | 105: doorbell_global_ipi(42): |
275 |
++ * | 105: kvmppc_set_host_ipi(42) |
276 |
++ * | // RE-ORDERED STORE COMPLETES |
277 |
++ * -> 42: kvmppc_clear_host_ipi(42) |
278 |
++ * 42: // returns to executing guest |
279 |
++ * 105: ppc_msgsnd_sync()/smp_mb() |
280 |
++ * 105: ppc_msgsnd() -> 42 |
281 |
++ * 42: local_paca->kvm_hstate.host_ipi == 0 // IPI ignored |
282 |
++ * 105: // hangs waiting on 42 to process messages/call_single_queue |
283 |
++ */ |
284 |
++static inline void kvmppc_set_host_ipi(int cpu) |
285 |
+ { |
286 |
+- paca_ptrs[cpu]->kvm_hstate.host_ipi = host_ipi; |
287 |
++ /* |
288 |
++ * order stores of IPI messages vs. setting of host_ipi flag |
289 |
++ * |
290 |
++ * pairs with the barrier in kvmppc_clear_host_ipi() |
291 |
++ */ |
292 |
++ smp_mb(); |
293 |
++ paca_ptrs[cpu]->kvm_hstate.host_ipi = 1; |
294 |
++} |
295 |
++ |
296 |
++static inline void kvmppc_clear_host_ipi(int cpu) |
297 |
++{ |
298 |
++ paca_ptrs[cpu]->kvm_hstate.host_ipi = 0; |
299 |
++ /* |
300 |
++ * order clearing of host_ipi flag vs. processing of IPI messages |
301 |
++ * |
302 |
++ * pairs with the barrier in kvmppc_set_host_ipi() |
303 |
++ */ |
304 |
++ smp_mb(); |
305 |
+ } |
306 |
+ |
307 |
+ static inline void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu) |
308 |
+@@ -489,7 +580,10 @@ static inline u32 kvmppc_get_xics_latch(void) |
309 |
+ return 0; |
310 |
+ } |
311 |
+ |
312 |
+-static inline void kvmppc_set_host_ipi(int cpu, u8 host_ipi) |
313 |
++static inline void kvmppc_set_host_ipi(int cpu) |
314 |
++{} |
315 |
++ |
316 |
++static inline void kvmppc_clear_host_ipi(int cpu) |
317 |
+ {} |
318 |
+ |
319 |
+ static inline void kvmppc_fast_vcpu_kick(struct kvm_vcpu *vcpu) |
320 |
+diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c |
321 |
+index b6fe883b1016..5828144555af 100644 |
322 |
+--- a/arch/powerpc/kernel/dbell.c |
323 |
++++ b/arch/powerpc/kernel/dbell.c |
324 |
+@@ -36,7 +36,7 @@ void doorbell_global_ipi(int cpu) |
325 |
+ { |
326 |
+ u32 tag = get_hard_smp_processor_id(cpu); |
327 |
+ |
328 |
+- kvmppc_set_host_ipi(cpu, 1); |
329 |
++ kvmppc_set_host_ipi(cpu); |
330 |
+ /* Order previous accesses vs. msgsnd, which is treated as a store */ |
331 |
+ ppc_msgsnd_sync(); |
332 |
+ ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, tag); |
333 |
+@@ -51,7 +51,7 @@ void doorbell_core_ipi(int cpu) |
334 |
+ { |
335 |
+ u32 tag = cpu_thread_in_core(cpu); |
336 |
+ |
337 |
+- kvmppc_set_host_ipi(cpu, 1); |
338 |
++ kvmppc_set_host_ipi(cpu); |
339 |
+ /* Order previous accesses vs. msgsnd, which is treated as a store */ |
340 |
+ ppc_msgsnd_sync(); |
341 |
+ ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, tag); |
342 |
+@@ -86,7 +86,7 @@ void doorbell_exception(struct pt_regs *regs) |
343 |
+ |
344 |
+ may_hard_irq_enable(); |
345 |
+ |
346 |
+- kvmppc_set_host_ipi(smp_processor_id(), 0); |
347 |
++ kvmppc_clear_host_ipi(smp_processor_id()); |
348 |
+ __this_cpu_inc(irq_stat.doorbell_irqs); |
349 |
+ |
350 |
+ smp_ipi_demux_relaxed(); /* already performed the barrier */ |
351 |
+diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c |
352 |
+index 758d1d23215e..aaafb9f080d5 100644 |
353 |
+--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c |
354 |
++++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c |
355 |
+@@ -61,7 +61,7 @@ static inline void icp_send_hcore_msg(int hcore, struct kvm_vcpu *vcpu) |
356 |
+ hcpu = hcore << threads_shift; |
357 |
+ kvmppc_host_rm_ops_hv->rm_core[hcore].rm_data = vcpu; |
358 |
+ smp_muxed_ipi_set_message(hcpu, PPC_MSG_RM_HOST_ACTION); |
359 |
+- kvmppc_set_host_ipi(hcpu, 1); |
360 |
++ kvmppc_set_host_ipi(hcpu); |
361 |
+ smp_mb(); |
362 |
+ kvmhv_rm_send_ipi(hcpu); |
363 |
+ } |
364 |
+diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c |
365 |
+index fdd9577d1798..3d3c989e44dd 100644 |
366 |
+--- a/arch/powerpc/platforms/powernv/smp.c |
367 |
++++ b/arch/powerpc/platforms/powernv/smp.c |
368 |
+@@ -223,7 +223,7 @@ static void pnv_smp_cpu_kill_self(void) |
369 |
+ * for coming online, which are handled via |
370 |
+ * generic_check_cpu_restart() calls. |
371 |
+ */ |
372 |
+- kvmppc_set_host_ipi(cpu, 0); |
373 |
++ kvmppc_clear_host_ipi(cpu); |
374 |
+ |
375 |
+ srr1 = pnv_cpu_offline(cpu); |
376 |
+ |
377 |
+diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c |
378 |
+index 74da18de853a..73ec15cd2708 100644 |
379 |
+--- a/arch/powerpc/platforms/pseries/hvconsole.c |
380 |
++++ b/arch/powerpc/platforms/pseries/hvconsole.c |
381 |
+@@ -62,7 +62,7 @@ EXPORT_SYMBOL(hvc_get_chars); |
382 |
+ * @vtermno: The vtermno or unit_address of the adapter from which the data |
383 |
+ * originated. |
384 |
+ * @buf: The character buffer that contains the character data to send to |
385 |
+- * firmware. |
386 |
++ * firmware. Must be at least 16 bytes, even if count is less than 16. |
387 |
+ * @count: Send this number of characters. |
388 |
+ */ |
389 |
+ int hvc_put_chars(uint32_t vtermno, const char *buf, int count) |
390 |
+diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c |
391 |
+index 37bfbc54aacb..340de58a15bd 100644 |
392 |
+--- a/arch/powerpc/sysdev/xics/icp-native.c |
393 |
++++ b/arch/powerpc/sysdev/xics/icp-native.c |
394 |
+@@ -145,7 +145,7 @@ static unsigned int icp_native_get_irq(void) |
395 |
+ |
396 |
+ static void icp_native_cause_ipi(int cpu) |
397 |
+ { |
398 |
+- kvmppc_set_host_ipi(cpu, 1); |
399 |
++ kvmppc_set_host_ipi(cpu); |
400 |
+ icp_native_set_qirr(cpu, IPI_PRIORITY); |
401 |
+ } |
402 |
+ |
403 |
+@@ -184,7 +184,7 @@ void icp_native_flush_interrupt(void) |
404 |
+ if (vec == XICS_IPI) { |
405 |
+ /* Clear pending IPI */ |
406 |
+ int cpu = smp_processor_id(); |
407 |
+- kvmppc_set_host_ipi(cpu, 0); |
408 |
++ kvmppc_clear_host_ipi(cpu); |
409 |
+ icp_native_set_qirr(cpu, 0xff); |
410 |
+ } else { |
411 |
+ pr_err("XICS: hw interrupt 0x%x to offline cpu, disabling\n", |
412 |
+@@ -205,7 +205,7 @@ static irqreturn_t icp_native_ipi_action(int irq, void *dev_id) |
413 |
+ { |
414 |
+ int cpu = smp_processor_id(); |
415 |
+ |
416 |
+- kvmppc_set_host_ipi(cpu, 0); |
417 |
++ kvmppc_clear_host_ipi(cpu); |
418 |
+ icp_native_set_qirr(cpu, 0xff); |
419 |
+ |
420 |
+ return smp_ipi_demux(); |
421 |
+diff --git a/arch/powerpc/sysdev/xics/icp-opal.c b/arch/powerpc/sysdev/xics/icp-opal.c |
422 |
+index c71d2ea42627..e3e52cf035a9 100644 |
423 |
+--- a/arch/powerpc/sysdev/xics/icp-opal.c |
424 |
++++ b/arch/powerpc/sysdev/xics/icp-opal.c |
425 |
+@@ -130,7 +130,7 @@ static void icp_opal_cause_ipi(int cpu) |
426 |
+ { |
427 |
+ int hw_cpu = get_hard_smp_processor_id(cpu); |
428 |
+ |
429 |
+- kvmppc_set_host_ipi(cpu, 1); |
430 |
++ kvmppc_set_host_ipi(cpu); |
431 |
+ opal_int_set_mfrr(hw_cpu, IPI_PRIORITY); |
432 |
+ } |
433 |
+ |
434 |
+@@ -138,7 +138,7 @@ static irqreturn_t icp_opal_ipi_action(int irq, void *dev_id) |
435 |
+ { |
436 |
+ int cpu = smp_processor_id(); |
437 |
+ |
438 |
+- kvmppc_set_host_ipi(cpu, 0); |
439 |
++ kvmppc_clear_host_ipi(cpu); |
440 |
+ opal_int_set_mfrr(get_hard_smp_processor_id(cpu), 0xff); |
441 |
+ |
442 |
+ return smp_ipi_demux(); |
443 |
+@@ -161,7 +161,7 @@ void icp_opal_flush_interrupt(void) |
444 |
+ if (vec == XICS_IPI) { |
445 |
+ /* Clear pending IPI */ |
446 |
+ int cpu = smp_processor_id(); |
447 |
+- kvmppc_set_host_ipi(cpu, 0); |
448 |
++ kvmppc_clear_host_ipi(cpu); |
449 |
+ opal_int_set_mfrr(get_hard_smp_processor_id(cpu), 0xff); |
450 |
+ } else { |
451 |
+ pr_err("XICS: hw interrupt 0x%x to offline cpu, " |
452 |
+diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c |
453 |
+index a840b7d074f7..6d39f64e4dce 100644 |
454 |
+--- a/arch/riscv/kernel/ftrace.c |
455 |
++++ b/arch/riscv/kernel/ftrace.c |
456 |
+@@ -142,7 +142,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, |
457 |
+ */ |
458 |
+ old = *parent; |
459 |
+ |
460 |
+- if (function_graph_enter(old, self_addr, frame_pointer, parent)) |
461 |
++ if (!function_graph_enter(old, self_addr, frame_pointer, parent)) |
462 |
+ *parent = return_hooker; |
463 |
+ } |
464 |
+ |
465 |
+diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c |
466 |
+index 5c3fd9032b74..5bfb1ce129f4 100644 |
467 |
+--- a/arch/s390/kernel/perf_cpum_sf.c |
468 |
++++ b/arch/s390/kernel/perf_cpum_sf.c |
469 |
+@@ -1261,18 +1261,28 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) |
470 |
+ */ |
471 |
+ if (flush_all && done) |
472 |
+ break; |
473 |
+- |
474 |
+- /* If an event overflow happened, discard samples by |
475 |
+- * processing any remaining sample-data-blocks. |
476 |
+- */ |
477 |
+- if (event_overflow) |
478 |
+- flush_all = 1; |
479 |
+ } |
480 |
+ |
481 |
+ /* Account sample overflows in the event hardware structure */ |
482 |
+ if (sampl_overflow) |
483 |
+ OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + |
484 |
+ sampl_overflow, 1 + num_sdb); |
485 |
++ |
486 |
++ /* Perf_event_overflow() and perf_event_account_interrupt() limit |
487 |
++ * the interrupt rate to an upper limit. Roughly 1000 samples per |
488 |
++ * task tick. |
489 |
++ * Hitting this limit results in a large number |
490 |
++ * of throttled REF_REPORT_THROTTLE entries and the samples |
491 |
++ * are dropped. |
492 |
++ * Slightly increase the interval to avoid hitting this limit. |
493 |
++ */ |
494 |
++ if (event_overflow) { |
495 |
++ SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); |
496 |
++ debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n", |
497 |
++ __func__, |
498 |
++ DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); |
499 |
++ } |
500 |
++ |
501 |
+ if (sampl_overflow || event_overflow) |
502 |
+ debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " |
503 |
+ "overflow stats: sample=%llu event=%llu\n", |
504 |
+diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c |
505 |
+index df2413f26a8f..ecd24711f3aa 100644 |
506 |
+--- a/arch/s390/kernel/smp.c |
507 |
++++ b/arch/s390/kernel/smp.c |
508 |
+@@ -715,39 +715,67 @@ static void __ref smp_get_core_info(struct sclp_core_info *info, int early) |
509 |
+ |
510 |
+ static int smp_add_present_cpu(int cpu); |
511 |
+ |
512 |
+-static int __smp_rescan_cpus(struct sclp_core_info *info, int sysfs_add) |
513 |
++static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail, |
514 |
++ bool configured, bool early) |
515 |
+ { |
516 |
+ struct pcpu *pcpu; |
517 |
+- cpumask_t avail; |
518 |
+- int cpu, nr, i, j; |
519 |
++ int cpu, nr, i; |
520 |
+ u16 address; |
521 |
+ |
522 |
+ nr = 0; |
523 |
+- cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); |
524 |
+- cpu = cpumask_first(&avail); |
525 |
+- for (i = 0; (i < info->combined) && (cpu < nr_cpu_ids); i++) { |
526 |
+- if (sclp.has_core_type && info->core[i].type != boot_core_type) |
527 |
++ if (sclp.has_core_type && core->type != boot_core_type) |
528 |
++ return nr; |
529 |
++ cpu = cpumask_first(avail); |
530 |
++ address = core->core_id << smp_cpu_mt_shift; |
531 |
++ for (i = 0; (i <= smp_cpu_mtid) && (cpu < nr_cpu_ids); i++) { |
532 |
++ if (pcpu_find_address(cpu_present_mask, address + i)) |
533 |
+ continue; |
534 |
+- address = info->core[i].core_id << smp_cpu_mt_shift; |
535 |
+- for (j = 0; j <= smp_cpu_mtid; j++) { |
536 |
+- if (pcpu_find_address(cpu_present_mask, address + j)) |
537 |
+- continue; |
538 |
+- pcpu = pcpu_devices + cpu; |
539 |
+- pcpu->address = address + j; |
540 |
+- pcpu->state = |
541 |
+- (cpu >= info->configured*(smp_cpu_mtid + 1)) ? |
542 |
+- CPU_STATE_STANDBY : CPU_STATE_CONFIGURED; |
543 |
+- smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); |
544 |
+- set_cpu_present(cpu, true); |
545 |
+- if (sysfs_add && smp_add_present_cpu(cpu) != 0) |
546 |
+- set_cpu_present(cpu, false); |
547 |
+- else |
548 |
+- nr++; |
549 |
+- cpu = cpumask_next(cpu, &avail); |
550 |
+- if (cpu >= nr_cpu_ids) |
551 |
++ pcpu = pcpu_devices + cpu; |
552 |
++ pcpu->address = address + i; |
553 |
++ if (configured) |
554 |
++ pcpu->state = CPU_STATE_CONFIGURED; |
555 |
++ else |
556 |
++ pcpu->state = CPU_STATE_STANDBY; |
557 |
++ smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); |
558 |
++ set_cpu_present(cpu, true); |
559 |
++ if (!early && smp_add_present_cpu(cpu) != 0) |
560 |
++ set_cpu_present(cpu, false); |
561 |
++ else |
562 |
++ nr++; |
563 |
++ cpumask_clear_cpu(cpu, avail); |
564 |
++ cpu = cpumask_next(cpu, avail); |
565 |
++ } |
566 |
++ return nr; |
567 |
++} |
568 |
++ |
569 |
++static int __smp_rescan_cpus(struct sclp_core_info *info, bool early) |
570 |
++{ |
571 |
++ struct sclp_core_entry *core; |
572 |
++ cpumask_t avail; |
573 |
++ bool configured; |
574 |
++ u16 core_id; |
575 |
++ int nr, i; |
576 |
++ |
577 |
++ nr = 0; |
578 |
++ cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask); |
579 |
++ /* |
580 |
++ * Add IPL core first (which got logical CPU number 0) to make sure |
581 |
++ * that all SMT threads get subsequent logical CPU numbers. |
582 |
++ */ |
583 |
++ if (early) { |
584 |
++ core_id = pcpu_devices[0].address >> smp_cpu_mt_shift; |
585 |
++ for (i = 0; i < info->configured; i++) { |
586 |
++ core = &info->core[i]; |
587 |
++ if (core->core_id == core_id) { |
588 |
++ nr += smp_add_core(core, &avail, true, early); |
589 |
+ break; |
590 |
++ } |
591 |
+ } |
592 |
+ } |
593 |
++ for (i = 0; i < info->combined; i++) { |
594 |
++ configured = i < info->configured; |
595 |
++ nr += smp_add_core(&info->core[i], &avail, configured, early); |
596 |
++ } |
597 |
+ return nr; |
598 |
+ } |
599 |
+ |
600 |
+@@ -793,7 +821,7 @@ void __init smp_detect_cpus(void) |
601 |
+ |
602 |
+ /* Add CPUs present at boot */ |
603 |
+ get_online_cpus(); |
604 |
+- __smp_rescan_cpus(info, 0); |
605 |
++ __smp_rescan_cpus(info, true); |
606 |
+ put_online_cpus(); |
607 |
+ memblock_free_early((unsigned long)info, sizeof(*info)); |
608 |
+ } |
609 |
+@@ -1145,7 +1173,7 @@ int __ref smp_rescan_cpus(void) |
610 |
+ smp_get_core_info(info, 0); |
611 |
+ get_online_cpus(); |
612 |
+ mutex_lock(&smp_cpu_state_mutex); |
613 |
+- nr = __smp_rescan_cpus(info, 1); |
614 |
++ nr = __smp_rescan_cpus(info, false); |
615 |
+ mutex_unlock(&smp_cpu_state_mutex); |
616 |
+ put_online_cpus(); |
617 |
+ kfree(info); |
618 |
+diff --git a/arch/x86/events/intel/bts.c b/arch/x86/events/intel/bts.c |
619 |
+index 7139f6bf27ad..510f9461407e 100644 |
620 |
+--- a/arch/x86/events/intel/bts.c |
621 |
++++ b/arch/x86/events/intel/bts.c |
622 |
+@@ -71,9 +71,17 @@ struct bts_buffer { |
623 |
+ |
624 |
+ static struct pmu bts_pmu; |
625 |
+ |
626 |
++static int buf_nr_pages(struct page *page) |
627 |
++{ |
628 |
++ if (!PagePrivate(page)) |
629 |
++ return 1; |
630 |
++ |
631 |
++ return 1 << page_private(page); |
632 |
++} |
633 |
++ |
634 |
+ static size_t buf_size(struct page *page) |
635 |
+ { |
636 |
+- return 1 << (PAGE_SHIFT + page_private(page)); |
637 |
++ return buf_nr_pages(page) * PAGE_SIZE; |
638 |
+ } |
639 |
+ |
640 |
+ static void * |
641 |
+@@ -91,9 +99,7 @@ bts_buffer_setup_aux(struct perf_event *event, void **pages, |
642 |
+ /* count all the high order buffers */ |
643 |
+ for (pg = 0, nbuf = 0; pg < nr_pages;) { |
644 |
+ page = virt_to_page(pages[pg]); |
645 |
+- if (WARN_ON_ONCE(!PagePrivate(page) && nr_pages > 1)) |
646 |
+- return NULL; |
647 |
+- pg += 1 << page_private(page); |
648 |
++ pg += buf_nr_pages(page); |
649 |
+ nbuf++; |
650 |
+ } |
651 |
+ |
652 |
+@@ -117,7 +123,7 @@ bts_buffer_setup_aux(struct perf_event *event, void **pages, |
653 |
+ unsigned int __nr_pages; |
654 |
+ |
655 |
+ page = virt_to_page(pages[pg]); |
656 |
+- __nr_pages = PagePrivate(page) ? 1 << page_private(page) : 1; |
657 |
++ __nr_pages = buf_nr_pages(page); |
658 |
+ buf->buf[nbuf].page = page; |
659 |
+ buf->buf[nbuf].offset = offset; |
660 |
+ buf->buf[nbuf].displacement = (pad ? BTS_RECORD_SIZE - pad : 0); |
661 |
+diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c |
662 |
+index 6ca015f92766..6490b2759bcb 100644 |
663 |
+--- a/block/compat_ioctl.c |
664 |
++++ b/block/compat_ioctl.c |
665 |
+@@ -6,6 +6,7 @@ |
666 |
+ #include <linux/compat.h> |
667 |
+ #include <linux/elevator.h> |
668 |
+ #include <linux/hdreg.h> |
669 |
++#include <linux/pr.h> |
670 |
+ #include <linux/slab.h> |
671 |
+ #include <linux/syscalls.h> |
672 |
+ #include <linux/types.h> |
673 |
+@@ -354,6 +355,8 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
674 |
+ * but we call blkdev_ioctl, which gets the lock for us |
675 |
+ */ |
676 |
+ case BLKRRPART: |
677 |
++ case BLKREPORTZONE: |
678 |
++ case BLKRESETZONE: |
679 |
+ return blkdev_ioctl(bdev, mode, cmd, |
680 |
+ (unsigned long)compat_ptr(arg)); |
681 |
+ case BLKBSZSET_32: |
682 |
+@@ -401,6 +404,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) |
683 |
+ case BLKTRACETEARDOWN: /* compatible */ |
684 |
+ ret = blk_trace_ioctl(bdev, cmd, compat_ptr(arg)); |
685 |
+ return ret; |
686 |
++ case IOC_PR_REGISTER: |
687 |
++ case IOC_PR_RESERVE: |
688 |
++ case IOC_PR_RELEASE: |
689 |
++ case IOC_PR_PREEMPT: |
690 |
++ case IOC_PR_PREEMPT_ABORT: |
691 |
++ case IOC_PR_CLEAR: |
692 |
++ return blkdev_ioctl(bdev, mode, cmd, |
693 |
++ (unsigned long)compat_ptr(arg)); |
694 |
+ default: |
695 |
+ if (disk->fops->compat_ioctl) |
696 |
+ ret = disk->fops->compat_ioctl(bdev, mode, cmd, arg); |
697 |
+diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c |
698 |
+index 41324f0b1bee..f8150c7bfe88 100644 |
699 |
+--- a/drivers/acpi/sysfs.c |
700 |
++++ b/drivers/acpi/sysfs.c |
701 |
+@@ -816,14 +816,14 @@ end: |
702 |
+ * interface: |
703 |
+ * echo unmask > /sys/firmware/acpi/interrupts/gpe00 |
704 |
+ */ |
705 |
+-#define ACPI_MASKABLE_GPE_MAX 0xFF |
706 |
++#define ACPI_MASKABLE_GPE_MAX 0x100 |
707 |
+ static DECLARE_BITMAP(acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) __initdata; |
708 |
+ |
709 |
+ static int __init acpi_gpe_set_masked_gpes(char *val) |
710 |
+ { |
711 |
+ u8 gpe; |
712 |
+ |
713 |
+- if (kstrtou8(val, 0, &gpe) || gpe > ACPI_MASKABLE_GPE_MAX) |
714 |
++ if (kstrtou8(val, 0, &gpe)) |
715 |
+ return -EINVAL; |
716 |
+ set_bit(gpe, acpi_masked_gpes_map); |
717 |
+ |
718 |
+@@ -835,7 +835,7 @@ void __init acpi_gpe_apply_masked_gpes(void) |
719 |
+ { |
720 |
+ acpi_handle handle; |
721 |
+ acpi_status status; |
722 |
+- u8 gpe; |
723 |
++ u16 gpe; |
724 |
+ |
725 |
+ for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) { |
726 |
+ status = acpi_get_gpe_device(gpe, &handle); |
727 |
+diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c |
728 |
+index f3d557777d82..0192cab1b862 100644 |
729 |
+--- a/drivers/ata/ahci_brcm.c |
730 |
++++ b/drivers/ata/ahci_brcm.c |
731 |
+@@ -25,6 +25,7 @@ |
732 |
+ #include <linux/module.h> |
733 |
+ #include <linux/of.h> |
734 |
+ #include <linux/platform_device.h> |
735 |
++#include <linux/reset.h> |
736 |
+ #include <linux/string.h> |
737 |
+ |
738 |
+ #include "ahci.h" |
739 |
+@@ -84,8 +85,7 @@ enum brcm_ahci_version { |
740 |
+ }; |
741 |
+ |
742 |
+ enum brcm_ahci_quirks { |
743 |
+- BRCM_AHCI_QUIRK_NO_NCQ = BIT(0), |
744 |
+- BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(1), |
745 |
++ BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE = BIT(0), |
746 |
+ }; |
747 |
+ |
748 |
+ struct brcm_ahci_priv { |
749 |
+@@ -94,6 +94,7 @@ struct brcm_ahci_priv { |
750 |
+ u32 port_mask; |
751 |
+ u32 quirks; |
752 |
+ enum brcm_ahci_version version; |
753 |
++ struct reset_control *rcdev; |
754 |
+ }; |
755 |
+ |
756 |
+ static inline u32 brcm_sata_readreg(void __iomem *addr) |
757 |
+@@ -220,19 +221,12 @@ static void brcm_sata_phys_disable(struct brcm_ahci_priv *priv) |
758 |
+ brcm_sata_phy_disable(priv, i); |
759 |
+ } |
760 |
+ |
761 |
+-static u32 brcm_ahci_get_portmask(struct platform_device *pdev, |
762 |
++static u32 brcm_ahci_get_portmask(struct ahci_host_priv *hpriv, |
763 |
+ struct brcm_ahci_priv *priv) |
764 |
+ { |
765 |
+- void __iomem *ahci; |
766 |
+- struct resource *res; |
767 |
+ u32 impl; |
768 |
+ |
769 |
+- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ahci"); |
770 |
+- ahci = devm_ioremap_resource(&pdev->dev, res); |
771 |
+- if (IS_ERR(ahci)) |
772 |
+- return 0; |
773 |
+- |
774 |
+- impl = readl(ahci + HOST_PORTS_IMPL); |
775 |
++ impl = readl(hpriv->mmio + HOST_PORTS_IMPL); |
776 |
+ |
777 |
+ if (fls(impl) > SATA_TOP_MAX_PHYS) |
778 |
+ dev_warn(priv->dev, "warning: more ports than PHYs (%#x)\n", |
779 |
+@@ -240,9 +234,6 @@ static u32 brcm_ahci_get_portmask(struct platform_device *pdev, |
780 |
+ else if (!impl) |
781 |
+ dev_info(priv->dev, "no ports found\n"); |
782 |
+ |
783 |
+- devm_iounmap(&pdev->dev, ahci); |
784 |
+- devm_release_mem_region(&pdev->dev, res->start, resource_size(res)); |
785 |
+- |
786 |
+ return impl; |
787 |
+ } |
788 |
+ |
789 |
+@@ -292,6 +283,13 @@ static unsigned int brcm_ahci_read_id(struct ata_device *dev, |
790 |
+ /* Perform the SATA PHY reset sequence */ |
791 |
+ brcm_sata_phy_disable(priv, ap->port_no); |
792 |
+ |
793 |
++ /* Reset the SATA clock */ |
794 |
++ ahci_platform_disable_clks(hpriv); |
795 |
++ msleep(10); |
796 |
++ |
797 |
++ ahci_platform_enable_clks(hpriv); |
798 |
++ msleep(10); |
799 |
++ |
800 |
+ /* Bring the PHY back on */ |
801 |
+ brcm_sata_phy_enable(priv, ap->port_no); |
802 |
+ |
803 |
+@@ -354,11 +352,10 @@ static int brcm_ahci_suspend(struct device *dev) |
804 |
+ struct ata_host *host = dev_get_drvdata(dev); |
805 |
+ struct ahci_host_priv *hpriv = host->private_data; |
806 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
807 |
+- int ret; |
808 |
+ |
809 |
+- ret = ahci_platform_suspend(dev); |
810 |
+ brcm_sata_phys_disable(priv); |
811 |
+- return ret; |
812 |
++ |
813 |
++ return ahci_platform_suspend(dev); |
814 |
+ } |
815 |
+ |
816 |
+ static int brcm_ahci_resume(struct device *dev) |
817 |
+@@ -366,11 +363,44 @@ static int brcm_ahci_resume(struct device *dev) |
818 |
+ struct ata_host *host = dev_get_drvdata(dev); |
819 |
+ struct ahci_host_priv *hpriv = host->private_data; |
820 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
821 |
++ int ret; |
822 |
++ |
823 |
++ /* Make sure clocks are turned on before re-configuration */ |
824 |
++ ret = ahci_platform_enable_clks(hpriv); |
825 |
++ if (ret) |
826 |
++ return ret; |
827 |
+ |
828 |
+ brcm_sata_init(priv); |
829 |
+ brcm_sata_phys_enable(priv); |
830 |
+ brcm_sata_alpm_init(hpriv); |
831 |
+- return ahci_platform_resume(dev); |
832 |
++ |
833 |
++ /* Since we had to enable clocks earlier on, we cannot use |
834 |
++ * ahci_platform_resume() as-is since a second call to |
835 |
++ * ahci_platform_enable_resources() would bump up the resources |
836 |
++ * (regulators, clocks, PHYs) count artificially so we copy the part |
837 |
++ * after ahci_platform_enable_resources(). |
838 |
++ */ |
839 |
++ ret = ahci_platform_enable_phys(hpriv); |
840 |
++ if (ret) |
841 |
++ goto out_disable_phys; |
842 |
++ |
843 |
++ ret = ahci_platform_resume_host(dev); |
844 |
++ if (ret) |
845 |
++ goto out_disable_platform_phys; |
846 |
++ |
847 |
++ /* We resumed so update PM runtime state */ |
848 |
++ pm_runtime_disable(dev); |
849 |
++ pm_runtime_set_active(dev); |
850 |
++ pm_runtime_enable(dev); |
851 |
++ |
852 |
++ return 0; |
853 |
++ |
854 |
++out_disable_platform_phys: |
855 |
++ ahci_platform_disable_phys(hpriv); |
856 |
++out_disable_phys: |
857 |
++ brcm_sata_phys_disable(priv); |
858 |
++ ahci_platform_disable_clks(hpriv); |
859 |
++ return ret; |
860 |
+ } |
861 |
+ #endif |
862 |
+ |
863 |
+@@ -411,44 +441,76 @@ static int brcm_ahci_probe(struct platform_device *pdev) |
864 |
+ if (IS_ERR(priv->top_ctrl)) |
865 |
+ return PTR_ERR(priv->top_ctrl); |
866 |
+ |
867 |
+- if ((priv->version == BRCM_SATA_BCM7425) || |
868 |
+- (priv->version == BRCM_SATA_NSP)) { |
869 |
+- priv->quirks |= BRCM_AHCI_QUIRK_NO_NCQ; |
870 |
++ /* Reset is optional depending on platform */ |
871 |
++ priv->rcdev = devm_reset_control_get(&pdev->dev, "ahci"); |
872 |
++ if (!IS_ERR_OR_NULL(priv->rcdev)) |
873 |
++ reset_control_deassert(priv->rcdev); |
874 |
++ |
875 |
++ hpriv = ahci_platform_get_resources(pdev, 0); |
876 |
++ if (IS_ERR(hpriv)) { |
877 |
++ ret = PTR_ERR(hpriv); |
878 |
++ goto out_reset; |
879 |
++ } |
880 |
++ |
881 |
++ hpriv->plat_data = priv; |
882 |
++ hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP | AHCI_HFLAG_NO_WRITE_TO_RO; |
883 |
++ |
884 |
++ switch (priv->version) { |
885 |
++ case BRCM_SATA_BCM7425: |
886 |
++ hpriv->flags |= AHCI_HFLAG_DELAY_ENGINE; |
887 |
++ /* fall through */ |
888 |
++ case BRCM_SATA_NSP: |
889 |
++ hpriv->flags |= AHCI_HFLAG_NO_NCQ; |
890 |
+ priv->quirks |= BRCM_AHCI_QUIRK_SKIP_PHY_ENABLE; |
891 |
++ break; |
892 |
++ default: |
893 |
++ break; |
894 |
+ } |
895 |
+ |
896 |
++ ret = ahci_platform_enable_clks(hpriv); |
897 |
++ if (ret) |
898 |
++ goto out_reset; |
899 |
++ |
900 |
++ /* Must be first so as to configure endianness including that |
901 |
++ * of the standard AHCI register space. |
902 |
++ */ |
903 |
+ brcm_sata_init(priv); |
904 |
+ |
905 |
+- priv->port_mask = brcm_ahci_get_portmask(pdev, priv); |
906 |
+- if (!priv->port_mask) |
907 |
+- return -ENODEV; |
908 |
++ /* Initializes priv->port_mask which is used below */ |
909 |
++ priv->port_mask = brcm_ahci_get_portmask(hpriv, priv); |
910 |
++ if (!priv->port_mask) { |
911 |
++ ret = -ENODEV; |
912 |
++ goto out_disable_clks; |
913 |
++ } |
914 |
+ |
915 |
++ /* Must be done before ahci_platform_enable_phys() */ |
916 |
+ brcm_sata_phys_enable(priv); |
917 |
+ |
918 |
+- hpriv = ahci_platform_get_resources(pdev, 0); |
919 |
+- if (IS_ERR(hpriv)) |
920 |
+- return PTR_ERR(hpriv); |
921 |
+- hpriv->plat_data = priv; |
922 |
+- hpriv->flags = AHCI_HFLAG_WAKE_BEFORE_STOP; |
923 |
+- |
924 |
+ brcm_sata_alpm_init(hpriv); |
925 |
+ |
926 |
+- ret = ahci_platform_enable_resources(hpriv); |
927 |
++ ret = ahci_platform_enable_phys(hpriv); |
928 |
+ if (ret) |
929 |
+- return ret; |
930 |
+- |
931 |
+- if (priv->quirks & BRCM_AHCI_QUIRK_NO_NCQ) |
932 |
+- hpriv->flags |= AHCI_HFLAG_NO_NCQ; |
933 |
+- hpriv->flags |= AHCI_HFLAG_NO_WRITE_TO_RO; |
934 |
++ goto out_disable_phys; |
935 |
+ |
936 |
+ ret = ahci_platform_init_host(pdev, hpriv, &ahci_brcm_port_info, |
937 |
+ &ahci_platform_sht); |
938 |
+ if (ret) |
939 |
+- return ret; |
940 |
++ goto out_disable_platform_phys; |
941 |
+ |
942 |
+ dev_info(dev, "Broadcom AHCI SATA3 registered\n"); |
943 |
+ |
944 |
+ return 0; |
945 |
++ |
946 |
++out_disable_platform_phys: |
947 |
++ ahci_platform_disable_phys(hpriv); |
948 |
++out_disable_phys: |
949 |
++ brcm_sata_phys_disable(priv); |
950 |
++out_disable_clks: |
951 |
++ ahci_platform_disable_clks(hpriv); |
952 |
++out_reset: |
953 |
++ if (!IS_ERR_OR_NULL(priv->rcdev)) |
954 |
++ reset_control_assert(priv->rcdev); |
955 |
++ return ret; |
956 |
+ } |
957 |
+ |
958 |
+ static int brcm_ahci_remove(struct platform_device *pdev) |
959 |
+@@ -458,12 +520,12 @@ static int brcm_ahci_remove(struct platform_device *pdev) |
960 |
+ struct brcm_ahci_priv *priv = hpriv->plat_data; |
961 |
+ int ret; |
962 |
+ |
963 |
++ brcm_sata_phys_disable(priv); |
964 |
++ |
965 |
+ ret = ata_platform_remove_one(pdev); |
966 |
+ if (ret) |
967 |
+ return ret; |
968 |
+ |
969 |
+- brcm_sata_phys_disable(priv); |
970 |
+- |
971 |
+ return 0; |
972 |
+ } |
973 |
+ |
974 |
+diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c |
975 |
+index 5bece9752ed6..522b543f718d 100644 |
976 |
+--- a/drivers/ata/libahci_platform.c |
977 |
++++ b/drivers/ata/libahci_platform.c |
978 |
+@@ -47,7 +47,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_ops); |
979 |
+ * RETURNS: |
980 |
+ * 0 on success otherwise a negative error code |
981 |
+ */ |
982 |
+-static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) |
983 |
++int ahci_platform_enable_phys(struct ahci_host_priv *hpriv) |
984 |
+ { |
985 |
+ int rc, i; |
986 |
+ |
987 |
+@@ -72,6 +72,7 @@ disable_phys: |
988 |
+ } |
989 |
+ return rc; |
990 |
+ } |
991 |
++EXPORT_SYMBOL_GPL(ahci_platform_enable_phys); |
992 |
+ |
993 |
+ /** |
994 |
+ * ahci_platform_disable_phys - Disable PHYs |
995 |
+@@ -79,7 +80,7 @@ disable_phys: |
996 |
+ * |
997 |
+ * This function disables all PHYs found in hpriv->phys. |
998 |
+ */ |
999 |
+-static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
1000 |
++void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
1001 |
+ { |
1002 |
+ int i; |
1003 |
+ |
1004 |
+@@ -88,6 +89,7 @@ static void ahci_platform_disable_phys(struct ahci_host_priv *hpriv) |
1005 |
+ phy_exit(hpriv->phys[i]); |
1006 |
+ } |
1007 |
+ } |
1008 |
++EXPORT_SYMBOL_GPL(ahci_platform_disable_phys); |
1009 |
+ |
1010 |
+ /** |
1011 |
+ * ahci_platform_enable_clks - Enable platform clocks |
1012 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
1013 |
+index 85ee6c35d8e0..b45b6f7722ce 100644 |
1014 |
+--- a/drivers/ata/libata-core.c |
1015 |
++++ b/drivers/ata/libata-core.c |
1016 |
+@@ -5343,6 +5343,30 @@ void ata_qc_complete(struct ata_queued_cmd *qc) |
1017 |
+ } |
1018 |
+ } |
1019 |
+ |
1020 |
++/** |
1021 |
++ * ata_qc_get_active - get bitmask of active qcs |
1022 |
++ * @ap: port in question |
1023 |
++ * |
1024 |
++ * LOCKING: |
1025 |
++ * spin_lock_irqsave(host lock) |
1026 |
++ * |
1027 |
++ * RETURNS: |
1028 |
++ * Bitmask of active qcs |
1029 |
++ */ |
1030 |
++u64 ata_qc_get_active(struct ata_port *ap) |
1031 |
++{ |
1032 |
++ u64 qc_active = ap->qc_active; |
1033 |
++ |
1034 |
++ /* ATA_TAG_INTERNAL is sent to hw as tag 0 */ |
1035 |
++ if (qc_active & (1ULL << ATA_TAG_INTERNAL)) { |
1036 |
++ qc_active |= (1 << 0); |
1037 |
++ qc_active &= ~(1ULL << ATA_TAG_INTERNAL); |
1038 |
++ } |
1039 |
++ |
1040 |
++ return qc_active; |
1041 |
++} |
1042 |
++EXPORT_SYMBOL_GPL(ata_qc_get_active); |
1043 |
++ |
1044 |
+ /** |
1045 |
+ * ata_qc_complete_multiple - Complete multiple qcs successfully |
1046 |
+ * @ap: port in question |
1047 |
+diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c |
1048 |
+index 4dc528bf8e85..ae52a45fab5f 100644 |
1049 |
+--- a/drivers/ata/sata_fsl.c |
1050 |
++++ b/drivers/ata/sata_fsl.c |
1051 |
+@@ -1283,7 +1283,7 @@ static void sata_fsl_host_intr(struct ata_port *ap) |
1052 |
+ i, ioread32(hcr_base + CC), |
1053 |
+ ioread32(hcr_base + CA)); |
1054 |
+ } |
1055 |
+- ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask); |
1056 |
++ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask); |
1057 |
+ return; |
1058 |
+ |
1059 |
+ } else if ((ap->qc_active & (1ULL << ATA_TAG_INTERNAL))) { |
1060 |
+diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c |
1061 |
+index 73ba8e134ca9..ab2e9f62ddc1 100644 |
1062 |
+--- a/drivers/ata/sata_mv.c |
1063 |
++++ b/drivers/ata/sata_mv.c |
1064 |
+@@ -2840,7 +2840,7 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp |
1065 |
+ } |
1066 |
+ |
1067 |
+ if (work_done) { |
1068 |
+- ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask); |
1069 |
++ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask); |
1070 |
+ |
1071 |
+ /* Update the software queue position index in hardware */ |
1072 |
+ writelfl((pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK) | |
1073 |
+diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c |
1074 |
+index 72c9b922a77b..761577d57ff3 100644 |
1075 |
+--- a/drivers/ata/sata_nv.c |
1076 |
++++ b/drivers/ata/sata_nv.c |
1077 |
+@@ -1000,7 +1000,7 @@ static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) |
1078 |
+ check_commands = 0; |
1079 |
+ check_commands &= ~(1 << pos); |
1080 |
+ } |
1081 |
+- ata_qc_complete_multiple(ap, ap->qc_active ^ done_mask); |
1082 |
++ ata_qc_complete_multiple(ap, ata_qc_get_active(ap) ^ done_mask); |
1083 |
+ } |
1084 |
+ } |
1085 |
+ |
1086 |
+diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c |
1087 |
+index fd1e19f1a49f..3666afa639d1 100644 |
1088 |
+--- a/drivers/block/xen-blkback/blkback.c |
1089 |
++++ b/drivers/block/xen-blkback/blkback.c |
1090 |
+@@ -936,6 +936,8 @@ next: |
1091 |
+ out_of_memory: |
1092 |
+ pr_alert("%s: out of memory\n", __func__); |
1093 |
+ put_free_pages(ring, pages_to_gnt, segs_to_map); |
1094 |
++ for (i = last_map; i < num; i++) |
1095 |
++ pages[i]->handle = BLKBACK_INVALID_HANDLE; |
1096 |
+ return -ENOMEM; |
1097 |
+ } |
1098 |
+ |
1099 |
+diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c |
1100 |
+index 55869b362fdf..25c41ce070a7 100644 |
1101 |
+--- a/drivers/block/xen-blkback/xenbus.c |
1102 |
++++ b/drivers/block/xen-blkback/xenbus.c |
1103 |
+@@ -179,6 +179,15 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) |
1104 |
+ blkif->domid = domid; |
1105 |
+ atomic_set(&blkif->refcnt, 1); |
1106 |
+ init_completion(&blkif->drain_complete); |
1107 |
++ |
1108 |
++ /* |
1109 |
++ * Because freeing back to the cache may be deferred, it is not |
1110 |
++ * safe to unload the module (and hence destroy the cache) until |
1111 |
++ * this has completed. To prevent premature unloading, take an |
1112 |
++ * extra module reference here and release only when the object |
1113 |
++ * has been freed back to the cache. |
1114 |
++ */ |
1115 |
++ __module_get(THIS_MODULE); |
1116 |
+ INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); |
1117 |
+ |
1118 |
+ return blkif; |
1119 |
+@@ -328,6 +337,7 @@ static void xen_blkif_free(struct xen_blkif *blkif) |
1120 |
+ |
1121 |
+ /* Make sure everything is drained before shutting down */ |
1122 |
+ kmem_cache_free(xen_blkif_cachep, blkif); |
1123 |
++ module_put(THIS_MODULE); |
1124 |
+ } |
1125 |
+ |
1126 |
+ int __init xen_blkif_interface_init(void) |
1127 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
1128 |
+index 08936bf696d3..1b0adf5c2376 100644 |
1129 |
+--- a/drivers/bluetooth/btusb.c |
1130 |
++++ b/drivers/bluetooth/btusb.c |
1131 |
+@@ -1138,7 +1138,7 @@ static int btusb_open(struct hci_dev *hdev) |
1132 |
+ if (data->setup_on_usb) { |
1133 |
+ err = data->setup_on_usb(hdev); |
1134 |
+ if (err < 0) |
1135 |
+- return err; |
1136 |
++ goto setup_fail; |
1137 |
+ } |
1138 |
+ |
1139 |
+ data->intf->needs_remote_wakeup = 1; |
1140 |
+@@ -1170,6 +1170,7 @@ done: |
1141 |
+ |
1142 |
+ failed: |
1143 |
+ clear_bit(BTUSB_INTR_RUNNING, &data->flags); |
1144 |
++setup_fail: |
1145 |
+ usb_autopm_put_interface(data->intf); |
1146 |
+ return err; |
1147 |
+ } |
1148 |
+diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c |
1149 |
+index 61fbaa89d7b4..1229bfb3180e 100644 |
1150 |
+--- a/drivers/devfreq/devfreq.c |
1151 |
++++ b/drivers/devfreq/devfreq.c |
1152 |
+@@ -538,26 +538,30 @@ static int devfreq_notifier_call(struct notifier_block *nb, unsigned long type, |
1153 |
+ void *devp) |
1154 |
+ { |
1155 |
+ struct devfreq *devfreq = container_of(nb, struct devfreq, nb); |
1156 |
+- int ret; |
1157 |
++ int err = -EINVAL; |
1158 |
+ |
1159 |
+ mutex_lock(&devfreq->lock); |
1160 |
+ |
1161 |
+ devfreq->scaling_min_freq = find_available_min_freq(devfreq); |
1162 |
+- if (!devfreq->scaling_min_freq) { |
1163 |
+- mutex_unlock(&devfreq->lock); |
1164 |
+- return -EINVAL; |
1165 |
+- } |
1166 |
++ if (!devfreq->scaling_min_freq) |
1167 |
++ goto out; |
1168 |
+ |
1169 |
+ devfreq->scaling_max_freq = find_available_max_freq(devfreq); |
1170 |
+ if (!devfreq->scaling_max_freq) { |
1171 |
+- mutex_unlock(&devfreq->lock); |
1172 |
+- return -EINVAL; |
1173 |
++ devfreq->scaling_max_freq = ULONG_MAX; |
1174 |
++ goto out; |
1175 |
+ } |
1176 |
+ |
1177 |
+- ret = update_devfreq(devfreq); |
1178 |
++ err = update_devfreq(devfreq); |
1179 |
++ |
1180 |
++out: |
1181 |
+ mutex_unlock(&devfreq->lock); |
1182 |
++ if (err) |
1183 |
++ dev_err(devfreq->dev.parent, |
1184 |
++ "failed to update frequency from OPP notifier (%d)\n", |
1185 |
++ err); |
1186 |
+ |
1187 |
+- return ret; |
1188 |
++ return NOTIFY_OK; |
1189 |
+ } |
1190 |
+ |
1191 |
+ /** |
1192 |
+@@ -571,11 +575,6 @@ static void devfreq_dev_release(struct device *dev) |
1193 |
+ struct devfreq *devfreq = to_devfreq(dev); |
1194 |
+ |
1195 |
+ mutex_lock(&devfreq_list_lock); |
1196 |
+- if (IS_ERR(find_device_devfreq(devfreq->dev.parent))) { |
1197 |
+- mutex_unlock(&devfreq_list_lock); |
1198 |
+- dev_warn(&devfreq->dev, "releasing devfreq which doesn't exist\n"); |
1199 |
+- return; |
1200 |
+- } |
1201 |
+ list_del(&devfreq->node); |
1202 |
+ mutex_unlock(&devfreq_list_lock); |
1203 |
+ |
1204 |
+@@ -630,6 +629,7 @@ struct devfreq *devfreq_add_device(struct device *dev, |
1205 |
+ devfreq->dev.parent = dev; |
1206 |
+ devfreq->dev.class = devfreq_class; |
1207 |
+ devfreq->dev.release = devfreq_dev_release; |
1208 |
++ INIT_LIST_HEAD(&devfreq->node); |
1209 |
+ devfreq->profile = profile; |
1210 |
+ strncpy(devfreq->governor_name, governor_name, DEVFREQ_NAME_LEN); |
1211 |
+ devfreq->previous_freq = profile->initial_freq; |
1212 |
+@@ -1086,7 +1086,7 @@ static ssize_t available_governors_show(struct device *d, |
1213 |
+ * The devfreq with immutable governor (e.g., passive) shows |
1214 |
+ * only own governor. |
1215 |
+ */ |
1216 |
+- if (df->governor->immutable) { |
1217 |
++ if (df->governor && df->governor->immutable) { |
1218 |
+ count = scnprintf(&buf[count], DEVFREQ_NAME_LEN, |
1219 |
+ "%s ", df->governor_name); |
1220 |
+ /* |
1221 |
+diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c |
1222 |
+index 82ba110d9d1a..bbabfca812bb 100644 |
1223 |
+--- a/drivers/firewire/net.c |
1224 |
++++ b/drivers/firewire/net.c |
1225 |
+@@ -249,7 +249,11 @@ static int fwnet_header_cache(const struct neighbour *neigh, |
1226 |
+ h = (struct fwnet_header *)((u8 *)hh->hh_data + HH_DATA_OFF(sizeof(*h))); |
1227 |
+ h->h_proto = type; |
1228 |
+ memcpy(h->h_dest, neigh->ha, net->addr_len); |
1229 |
+- hh->hh_len = FWNET_HLEN; |
1230 |
++ |
1231 |
++ /* Pairs with the READ_ONCE() in neigh_resolve_output(), |
1232 |
++ * neigh_hh_output() and neigh_update_hhs(). |
1233 |
++ */ |
1234 |
++ smp_store_release(&hh->hh_len, FWNET_HLEN); |
1235 |
+ |
1236 |
+ return 0; |
1237 |
+ } |
1238 |
+diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c |
1239 |
+index b81a27c7f89c..a24f13df42f4 100644 |
1240 |
+--- a/drivers/gpio/gpiolib.c |
1241 |
++++ b/drivers/gpio/gpiolib.c |
1242 |
+@@ -217,6 +217,14 @@ int gpiod_get_direction(struct gpio_desc *desc) |
1243 |
+ chip = gpiod_to_chip(desc); |
1244 |
+ offset = gpio_chip_hwgpio(desc); |
1245 |
+ |
1246 |
++ /* |
1247 |
++ * Open drain emulation using input mode may incorrectly report |
1248 |
++ * input here, fix that up. |
1249 |
++ */ |
1250 |
++ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) && |
1251 |
++ test_bit(FLAG_IS_OUT, &desc->flags)) |
1252 |
++ return 0; |
1253 |
++ |
1254 |
+ if (!chip->get_direction) |
1255 |
+ return status; |
1256 |
+ |
1257 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c |
1258 |
+index d5ebe566809b..a1c941229f4b 100644 |
1259 |
+--- a/drivers/gpu/drm/amd/amdgpu/df_v3_6.c |
1260 |
++++ b/drivers/gpu/drm/amd/amdgpu/df_v3_6.c |
1261 |
+@@ -75,23 +75,29 @@ static void df_v3_6_update_medium_grain_clock_gating(struct amdgpu_device *adev, |
1262 |
+ { |
1263 |
+ u32 tmp; |
1264 |
+ |
1265 |
+- /* Put DF on broadcast mode */ |
1266 |
+- adev->df_funcs->enable_broadcast_mode(adev, true); |
1267 |
+- |
1268 |
+- if (enable && (adev->cg_flags & AMD_CG_SUPPORT_DF_MGCG)) { |
1269 |
+- tmp = RREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater); |
1270 |
+- tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; |
1271 |
+- tmp |= DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY; |
1272 |
+- WREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater, tmp); |
1273 |
+- } else { |
1274 |
+- tmp = RREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater); |
1275 |
+- tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; |
1276 |
+- tmp |= DF_V3_6_MGCG_DISABLE; |
1277 |
+- WREG32_SOC15(DF, 0, mmDF_PIE_AON0_DfGlobalClkGater, tmp); |
1278 |
++ if (adev->cg_flags & AMD_CG_SUPPORT_DF_MGCG) { |
1279 |
++ /* Put DF on broadcast mode */ |
1280 |
++ adev->df_funcs->enable_broadcast_mode(adev, true); |
1281 |
++ |
1282 |
++ if (enable) { |
1283 |
++ tmp = RREG32_SOC15(DF, 0, |
1284 |
++ mmDF_PIE_AON0_DfGlobalClkGater); |
1285 |
++ tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; |
1286 |
++ tmp |= DF_V3_6_MGCG_ENABLE_15_CYCLE_DELAY; |
1287 |
++ WREG32_SOC15(DF, 0, |
1288 |
++ mmDF_PIE_AON0_DfGlobalClkGater, tmp); |
1289 |
++ } else { |
1290 |
++ tmp = RREG32_SOC15(DF, 0, |
1291 |
++ mmDF_PIE_AON0_DfGlobalClkGater); |
1292 |
++ tmp &= ~DF_PIE_AON0_DfGlobalClkGater__MGCGMode_MASK; |
1293 |
++ tmp |= DF_V3_6_MGCG_DISABLE; |
1294 |
++ WREG32_SOC15(DF, 0, |
1295 |
++ mmDF_PIE_AON0_DfGlobalClkGater, tmp); |
1296 |
++ } |
1297 |
++ |
1298 |
++ /* Exit broadcast mode */ |
1299 |
++ adev->df_funcs->enable_broadcast_mode(adev, false); |
1300 |
+ } |
1301 |
+- |
1302 |
+- /* Exit broadcast mode */ |
1303 |
+- adev->df_funcs->enable_broadcast_mode(adev, false); |
1304 |
+ } |
1305 |
+ |
1306 |
+ static void df_v3_6_get_clockgating_state(struct amdgpu_device *adev, |
1307 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1308 |
+index 5a9534a82d40..e1cb7fa89e4d 100644 |
1309 |
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1310 |
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |
1311 |
+@@ -6405,7 +6405,23 @@ static void gfx_v8_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr, |
1312 |
+ bool write64bit = flags & AMDGPU_FENCE_FLAG_64BIT; |
1313 |
+ bool int_sel = flags & AMDGPU_FENCE_FLAG_INT; |
1314 |
+ |
1315 |
+- /* EVENT_WRITE_EOP - flush caches, send int */ |
1316 |
++ /* Workaround for cache flush problems. First send a dummy EOP |
1317 |
++ * event down the pipe with seq one below. |
1318 |
++ */ |
1319 |
++ amdgpu_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); |
1320 |
++ amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN | |
1321 |
++ EOP_TC_ACTION_EN | |
1322 |
++ EOP_TC_WB_ACTION_EN | |
1323 |
++ EVENT_TYPE(CACHE_FLUSH_AND_INV_TS_EVENT) | |
1324 |
++ EVENT_INDEX(5))); |
1325 |
++ amdgpu_ring_write(ring, addr & 0xfffffffc); |
1326 |
++ amdgpu_ring_write(ring, (upper_32_bits(addr) & 0xffff) | |
1327 |
++ DATA_SEL(1) | INT_SEL(0)); |
1328 |
++ amdgpu_ring_write(ring, lower_32_bits(seq - 1)); |
1329 |
++ amdgpu_ring_write(ring, upper_32_bits(seq - 1)); |
1330 |
++ |
1331 |
++ /* Then send the real EOP event down the pipe: |
1332 |
++ * EVENT_WRITE_EOP - flush caches, send int */ |
1333 |
+ amdgpu_ring_write(ring, PACKET3(PACKET3_EVENT_WRITE_EOP, 4)); |
1334 |
+ amdgpu_ring_write(ring, (EOP_TCL1_ACTION_EN | |
1335 |
+ EOP_TC_ACTION_EN | |
1336 |
+@@ -7154,7 +7170,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { |
1337 |
+ 5 + /* COND_EXEC */ |
1338 |
+ 7 + /* PIPELINE_SYNC */ |
1339 |
+ VI_FLUSH_GPU_TLB_NUM_WREG * 5 + 9 + /* VM_FLUSH */ |
1340 |
+- 8 + /* FENCE for VM_FLUSH */ |
1341 |
++ 12 + /* FENCE for VM_FLUSH */ |
1342 |
+ 20 + /* GDS switch */ |
1343 |
+ 4 + /* double SWITCH_BUFFER, |
1344 |
+ the first COND_EXEC jump to the place just |
1345 |
+@@ -7166,7 +7182,7 @@ static const struct amdgpu_ring_funcs gfx_v8_0_ring_funcs_gfx = { |
1346 |
+ 31 + /* DE_META */ |
1347 |
+ 3 + /* CNTX_CTRL */ |
1348 |
+ 5 + /* HDP_INVL */ |
1349 |
+- 8 + 8 + /* FENCE x2 */ |
1350 |
++ 12 + 12 + /* FENCE x2 */ |
1351 |
+ 2, /* SWITCH_BUFFER */ |
1352 |
+ .emit_ib_size = 4, /* gfx_v8_0_ring_emit_ib_gfx */ |
1353 |
+ .emit_ib = gfx_v8_0_ring_emit_ib_gfx, |
1354 |
+diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1355 |
+index c6f7c1344a9b..2f42964fb9f4 100644 |
1356 |
+--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1357 |
++++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c |
1358 |
+@@ -348,7 +348,7 @@ bool dc_link_is_dp_sink_present(struct dc_link *link) |
1359 |
+ |
1360 |
+ if (GPIO_RESULT_OK != dal_ddc_open( |
1361 |
+ ddc, GPIO_MODE_INPUT, GPIO_DDC_CONFIG_TYPE_MODE_I2C)) { |
1362 |
+- dal_gpio_destroy_ddc(&ddc); |
1363 |
++ dal_ddc_close(ddc); |
1364 |
+ |
1365 |
+ return present; |
1366 |
+ } |
1367 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
1368 |
+index 65f58e23e03d..77347a258f6c 100644 |
1369 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
1370 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
1371 |
+@@ -1582,7 +1582,11 @@ static void process_single_up_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, |
1372 |
+ if (ret != 1) |
1373 |
+ DRM_DEBUG_KMS("failed to send msg in q %d\n", ret); |
1374 |
+ |
1375 |
+- txmsg->dst->tx_slots[txmsg->seqno] = NULL; |
1376 |
++ if (txmsg->seqno != -1) { |
1377 |
++ WARN_ON((unsigned int)txmsg->seqno > |
1378 |
++ ARRAY_SIZE(txmsg->dst->tx_slots)); |
1379 |
++ txmsg->dst->tx_slots[txmsg->seqno] = NULL; |
1380 |
++ } |
1381 |
+ } |
1382 |
+ |
1383 |
+ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, |
1384 |
+diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c |
1385 |
+index cdb10f885a4f..69dfed57c2f8 100644 |
1386 |
+--- a/drivers/gpu/drm/drm_property.c |
1387 |
++++ b/drivers/gpu/drm/drm_property.c |
1388 |
+@@ -556,7 +556,7 @@ drm_property_create_blob(struct drm_device *dev, size_t length, |
1389 |
+ struct drm_property_blob *blob; |
1390 |
+ int ret; |
1391 |
+ |
1392 |
+- if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob)) |
1393 |
++ if (!length || length > INT_MAX - sizeof(struct drm_property_blob)) |
1394 |
+ return ERR_PTR(-EINVAL); |
1395 |
+ |
1396 |
+ blob = kvzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); |
1397 |
+diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c |
1398 |
+index 52a2146dc1f2..5e6c78ea3a3f 100644 |
1399 |
+--- a/drivers/gpu/drm/msm/msm_gpu.c |
1400 |
++++ b/drivers/gpu/drm/msm/msm_gpu.c |
1401 |
+@@ -25,6 +25,7 @@ |
1402 |
+ #include <linux/pm_opp.h> |
1403 |
+ #include <linux/devfreq.h> |
1404 |
+ #include <linux/devcoredump.h> |
1405 |
++#include <linux/sched/task.h> |
1406 |
+ |
1407 |
+ /* |
1408 |
+ * Power Management: |
1409 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.h b/drivers/gpu/drm/nouveau/nouveau_connector.h |
1410 |
+index dc7454e7f19a..b46e99f7641e 100644 |
1411 |
+--- a/drivers/gpu/drm/nouveau/nouveau_connector.h |
1412 |
++++ b/drivers/gpu/drm/nouveau/nouveau_connector.h |
1413 |
+@@ -29,6 +29,7 @@ |
1414 |
+ |
1415 |
+ #include <nvif/notify.h> |
1416 |
+ |
1417 |
++#include <drm/drm_crtc.h> |
1418 |
+ #include <drm/drm_edid.h> |
1419 |
+ #include <drm/drm_encoder.h> |
1420 |
+ #include <drm/drm_dp_helper.h> |
1421 |
+@@ -37,6 +38,60 @@ |
1422 |
+ |
1423 |
+ struct nvkm_i2c_port; |
1424 |
+ |
1425 |
++#define nouveau_conn_atom(p) \ |
1426 |
++ container_of((p), struct nouveau_conn_atom, state) |
1427 |
++ |
1428 |
++struct nouveau_conn_atom { |
1429 |
++ struct drm_connector_state state; |
1430 |
++ |
1431 |
++ struct { |
1432 |
++ /* The enum values specifically defined here match nv50/gf119 |
1433 |
++ * hw values, and the code relies on this. |
1434 |
++ */ |
1435 |
++ enum { |
1436 |
++ DITHERING_MODE_OFF = 0x00, |
1437 |
++ DITHERING_MODE_ON = 0x01, |
1438 |
++ DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, |
1439 |
++ DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, |
1440 |
++ DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, |
1441 |
++ DITHERING_MODE_AUTO |
1442 |
++ } mode; |
1443 |
++ enum { |
1444 |
++ DITHERING_DEPTH_6BPC = 0x00, |
1445 |
++ DITHERING_DEPTH_8BPC = 0x02, |
1446 |
++ DITHERING_DEPTH_AUTO |
1447 |
++ } depth; |
1448 |
++ } dither; |
1449 |
++ |
1450 |
++ struct { |
1451 |
++ int mode; /* DRM_MODE_SCALE_* */ |
1452 |
++ struct { |
1453 |
++ enum { |
1454 |
++ UNDERSCAN_OFF, |
1455 |
++ UNDERSCAN_ON, |
1456 |
++ UNDERSCAN_AUTO, |
1457 |
++ } mode; |
1458 |
++ u32 hborder; |
1459 |
++ u32 vborder; |
1460 |
++ } underscan; |
1461 |
++ bool full; |
1462 |
++ } scaler; |
1463 |
++ |
1464 |
++ struct { |
1465 |
++ int color_vibrance; |
1466 |
++ int vibrant_hue; |
1467 |
++ } procamp; |
1468 |
++ |
1469 |
++ union { |
1470 |
++ struct { |
1471 |
++ bool dither:1; |
1472 |
++ bool scaler:1; |
1473 |
++ bool procamp:1; |
1474 |
++ }; |
1475 |
++ u8 mask; |
1476 |
++ } set; |
1477 |
++}; |
1478 |
++ |
1479 |
+ struct nouveau_connector { |
1480 |
+ struct drm_connector base; |
1481 |
+ enum dcb_connector_type type; |
1482 |
+@@ -111,61 +166,6 @@ extern int nouveau_ignorelid; |
1483 |
+ extern int nouveau_duallink; |
1484 |
+ extern int nouveau_hdmimhz; |
1485 |
+ |
1486 |
+-#include <drm/drm_crtc.h> |
1487 |
+-#define nouveau_conn_atom(p) \ |
1488 |
+- container_of((p), struct nouveau_conn_atom, state) |
1489 |
+- |
1490 |
+-struct nouveau_conn_atom { |
1491 |
+- struct drm_connector_state state; |
1492 |
+- |
1493 |
+- struct { |
1494 |
+- /* The enum values specifically defined here match nv50/gf119 |
1495 |
+- * hw values, and the code relies on this. |
1496 |
+- */ |
1497 |
+- enum { |
1498 |
+- DITHERING_MODE_OFF = 0x00, |
1499 |
+- DITHERING_MODE_ON = 0x01, |
1500 |
+- DITHERING_MODE_DYNAMIC2X2 = 0x10 | DITHERING_MODE_ON, |
1501 |
+- DITHERING_MODE_STATIC2X2 = 0x18 | DITHERING_MODE_ON, |
1502 |
+- DITHERING_MODE_TEMPORAL = 0x20 | DITHERING_MODE_ON, |
1503 |
+- DITHERING_MODE_AUTO |
1504 |
+- } mode; |
1505 |
+- enum { |
1506 |
+- DITHERING_DEPTH_6BPC = 0x00, |
1507 |
+- DITHERING_DEPTH_8BPC = 0x02, |
1508 |
+- DITHERING_DEPTH_AUTO |
1509 |
+- } depth; |
1510 |
+- } dither; |
1511 |
+- |
1512 |
+- struct { |
1513 |
+- int mode; /* DRM_MODE_SCALE_* */ |
1514 |
+- struct { |
1515 |
+- enum { |
1516 |
+- UNDERSCAN_OFF, |
1517 |
+- UNDERSCAN_ON, |
1518 |
+- UNDERSCAN_AUTO, |
1519 |
+- } mode; |
1520 |
+- u32 hborder; |
1521 |
+- u32 vborder; |
1522 |
+- } underscan; |
1523 |
+- bool full; |
1524 |
+- } scaler; |
1525 |
+- |
1526 |
+- struct { |
1527 |
+- int color_vibrance; |
1528 |
+- int vibrant_hue; |
1529 |
+- } procamp; |
1530 |
+- |
1531 |
+- union { |
1532 |
+- struct { |
1533 |
+- bool dither:1; |
1534 |
+- bool scaler:1; |
1535 |
+- bool procamp:1; |
1536 |
+- }; |
1537 |
+- u8 mask; |
1538 |
+- } set; |
1539 |
+-}; |
1540 |
+- |
1541 |
+ void nouveau_conn_attach_properties(struct drm_connector *); |
1542 |
+ void nouveau_conn_reset(struct drm_connector *); |
1543 |
+ struct drm_connector_state * |
1544 |
+diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
1545 |
+index 416da5376701..8ad36f574df8 100644 |
1546 |
+--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
1547 |
++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c |
1548 |
+@@ -651,8 +651,6 @@ static void sun4i_hdmi_unbind(struct device *dev, struct device *master, |
1549 |
+ struct sun4i_hdmi *hdmi = dev_get_drvdata(dev); |
1550 |
+ |
1551 |
+ cec_unregister_adapter(hdmi->cec_adap); |
1552 |
+- drm_connector_cleanup(&hdmi->connector); |
1553 |
+- drm_encoder_cleanup(&hdmi->encoder); |
1554 |
+ i2c_del_adapter(hdmi->i2c); |
1555 |
+ clk_disable_unprepare(hdmi->mod_clk); |
1556 |
+ clk_disable_unprepare(hdmi->bus_clk); |
1557 |
+diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c |
1558 |
+index 2f940c1de616..0a39e444e308 100644 |
1559 |
+--- a/drivers/hid/i2c-hid/i2c-hid-core.c |
1560 |
++++ b/drivers/hid/i2c-hid/i2c-hid-core.c |
1561 |
+@@ -51,6 +51,7 @@ |
1562 |
+ #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) |
1563 |
+ #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3) |
1564 |
+ #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4) |
1565 |
++#define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5) |
1566 |
+ |
1567 |
+ /* flags */ |
1568 |
+ #define I2C_HID_STARTED 0 |
1569 |
+@@ -182,6 +183,8 @@ static const struct i2c_hid_quirks { |
1570 |
+ I2C_HID_QUIRK_NO_RUNTIME_PM }, |
1571 |
+ { USB_VENDOR_ID_ELAN, HID_ANY_ID, |
1572 |
+ I2C_HID_QUIRK_BOGUS_IRQ }, |
1573 |
++ { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID, |
1574 |
++ I2C_HID_QUIRK_RESET_ON_RESUME }, |
1575 |
+ { 0, 0 } |
1576 |
+ }; |
1577 |
+ |
1578 |
+@@ -1290,8 +1293,15 @@ static int i2c_hid_resume(struct device *dev) |
1579 |
+ * solves "incomplete reports" on Raydium devices 2386:3118 and |
1580 |
+ * 2386:4B33 and fixes various SIS touchscreens no longer sending |
1581 |
+ * data after a suspend/resume. |
1582 |
++ * |
1583 |
++ * However some ALPS touchpads generate IRQ storm without reset, so |
1584 |
++ * let's still reset them here. |
1585 |
+ */ |
1586 |
+- ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); |
1587 |
++ if (ihid->quirks & I2C_HID_QUIRK_RESET_ON_RESUME) |
1588 |
++ ret = i2c_hid_hwreset(client); |
1589 |
++ else |
1590 |
++ ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); |
1591 |
++ |
1592 |
+ if (ret) |
1593 |
+ return ret; |
1594 |
+ |
1595 |
+diff --git a/drivers/iio/adc/max9611.c b/drivers/iio/adc/max9611.c |
1596 |
+index 0884435eec68..9f1a5ef0b444 100644 |
1597 |
+--- a/drivers/iio/adc/max9611.c |
1598 |
++++ b/drivers/iio/adc/max9611.c |
1599 |
+@@ -92,6 +92,12 @@ |
1600 |
+ #define MAX9611_TEMP_SCALE_NUM 1000000 |
1601 |
+ #define MAX9611_TEMP_SCALE_DIV 2083 |
1602 |
+ |
1603 |
++/* |
1604 |
++ * Conversion time is 2 ms (typically) at Ta=25 degreeC |
1605 |
++ * No maximum value is known, so play it safe. |
1606 |
++ */ |
1607 |
++#define MAX9611_CONV_TIME_US_RANGE 3000, 3300 |
1608 |
++ |
1609 |
+ struct max9611_dev { |
1610 |
+ struct device *dev; |
1611 |
+ struct i2c_client *i2c_client; |
1612 |
+@@ -239,11 +245,9 @@ static int max9611_read_single(struct max9611_dev *max9611, |
1613 |
+ return ret; |
1614 |
+ } |
1615 |
+ |
1616 |
+- /* |
1617 |
+- * need a delay here to make register configuration |
1618 |
+- * stabilize. 1 msec at least, from empirical testing. |
1619 |
+- */ |
1620 |
+- usleep_range(1000, 2000); |
1621 |
++ /* need a delay here to make register configuration stabilize. */ |
1622 |
++ |
1623 |
++ usleep_range(MAX9611_CONV_TIME_US_RANGE); |
1624 |
+ |
1625 |
+ ret = i2c_smbus_read_word_swapped(max9611->i2c_client, reg_addr); |
1626 |
+ if (ret < 0) { |
1627 |
+@@ -510,7 +514,7 @@ static int max9611_init(struct max9611_dev *max9611) |
1628 |
+ MAX9611_REG_CTRL2, 0); |
1629 |
+ return ret; |
1630 |
+ } |
1631 |
+- usleep_range(1000, 2000); |
1632 |
++ usleep_range(MAX9611_CONV_TIME_US_RANGE); |
1633 |
+ |
1634 |
+ return 0; |
1635 |
+ } |
1636 |
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c |
1637 |
+index 1f373ba573b6..319bfef00a4a 100644 |
1638 |
+--- a/drivers/infiniband/core/cma.c |
1639 |
++++ b/drivers/infiniband/core/cma.c |
1640 |
+@@ -4658,6 +4658,7 @@ static int __init cma_init(void) |
1641 |
+ err: |
1642 |
+ unregister_netdevice_notifier(&cma_nb); |
1643 |
+ ib_sa_unregister_client(&sa_client); |
1644 |
++ unregister_pernet_subsys(&cma_pernet_operations); |
1645 |
+ err_wq: |
1646 |
+ destroy_workqueue(cma_wq); |
1647 |
+ return ret; |
1648 |
+diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c |
1649 |
+index 0bbeaaae47e0..9386bb57b3d7 100644 |
1650 |
+--- a/drivers/infiniband/hw/mlx4/main.c |
1651 |
++++ b/drivers/infiniband/hw/mlx4/main.c |
1652 |
+@@ -3069,16 +3069,17 @@ static void mlx4_ib_remove(struct mlx4_dev *dev, void *ibdev_ptr) |
1653 |
+ ibdev->ib_active = false; |
1654 |
+ flush_workqueue(wq); |
1655 |
+ |
1656 |
+- mlx4_ib_close_sriov(ibdev); |
1657 |
+- mlx4_ib_mad_cleanup(ibdev); |
1658 |
+- ib_unregister_device(&ibdev->ib_dev); |
1659 |
+- mlx4_ib_diag_cleanup(ibdev); |
1660 |
+ if (ibdev->iboe.nb.notifier_call) { |
1661 |
+ if (unregister_netdevice_notifier(&ibdev->iboe.nb)) |
1662 |
+ pr_warn("failure unregistering notifier\n"); |
1663 |
+ ibdev->iboe.nb.notifier_call = NULL; |
1664 |
+ } |
1665 |
+ |
1666 |
++ mlx4_ib_close_sriov(ibdev); |
1667 |
++ mlx4_ib_mad_cleanup(ibdev); |
1668 |
++ ib_unregister_device(&ibdev->ib_dev); |
1669 |
++ mlx4_ib_diag_cleanup(ibdev); |
1670 |
++ |
1671 |
+ mlx4_qp_release_range(dev, ibdev->steer_qpn_base, |
1672 |
+ ibdev->steer_qpn_count); |
1673 |
+ kfree(ibdev->ib_uc_qpns_bitmap); |
1674 |
+diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1675 |
+index f4ffdc588ea0..df5be462dd28 100644 |
1676 |
+--- a/drivers/infiniband/hw/mlx5/main.c |
1677 |
++++ b/drivers/infiniband/hw/mlx5/main.c |
1678 |
+@@ -3286,10 +3286,6 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, |
1679 |
+ } |
1680 |
+ |
1681 |
+ INIT_LIST_HEAD(&handler->list); |
1682 |
+- if (dst) { |
1683 |
+- memcpy(&dest_arr[0], dst, sizeof(*dst)); |
1684 |
+- dest_num++; |
1685 |
+- } |
1686 |
+ |
1687 |
+ for (spec_index = 0; spec_index < flow_attr->num_of_specs; spec_index++) { |
1688 |
+ err = parse_flow_attr(dev->mdev, spec->match_criteria, |
1689 |
+@@ -3303,6 +3299,11 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, |
1690 |
+ ib_flow += ((union ib_flow_spec *)ib_flow)->size; |
1691 |
+ } |
1692 |
+ |
1693 |
++ if (dst && !(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP)) { |
1694 |
++ memcpy(&dest_arr[0], dst, sizeof(*dst)); |
1695 |
++ dest_num++; |
1696 |
++ } |
1697 |
++ |
1698 |
+ if (!flow_is_multicast_only(flow_attr)) |
1699 |
+ set_underlay_qp(dev, spec, underlay_qpn); |
1700 |
+ |
1701 |
+@@ -3340,10 +3341,8 @@ static struct mlx5_ib_flow_handler *_create_flow_rule(struct mlx5_ib_dev *dev, |
1702 |
+ } |
1703 |
+ |
1704 |
+ if (flow_act.action & MLX5_FLOW_CONTEXT_ACTION_DROP) { |
1705 |
+- if (!(flow_act.action & MLX5_FLOW_CONTEXT_ACTION_COUNT)) { |
1706 |
++ if (!dest_num) |
1707 |
+ rule_dst = NULL; |
1708 |
+- dest_num = 0; |
1709 |
+- } |
1710 |
+ } else { |
1711 |
+ if (is_egress) |
1712 |
+ flow_act.action |= MLX5_FLOW_CONTEXT_ACTION_ALLOW; |
1713 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_recv.c b/drivers/infiniband/sw/rxe/rxe_recv.c |
1714 |
+index d30dbac24583..695a607e2d14 100644 |
1715 |
+--- a/drivers/infiniband/sw/rxe/rxe_recv.c |
1716 |
++++ b/drivers/infiniband/sw/rxe/rxe_recv.c |
1717 |
+@@ -391,7 +391,7 @@ void rxe_rcv(struct sk_buff *skb) |
1718 |
+ |
1719 |
+ calc_icrc = rxe_icrc_hdr(pkt, skb); |
1720 |
+ calc_icrc = rxe_crc32(rxe, calc_icrc, (u8 *)payload_addr(pkt), |
1721 |
+- payload_size(pkt)); |
1722 |
++ payload_size(pkt) + bth_pad(pkt)); |
1723 |
+ calc_icrc = (__force u32)cpu_to_be32(~calc_icrc); |
1724 |
+ if (unlikely(calc_icrc != pack_icrc)) { |
1725 |
+ if (skb->protocol == htons(ETH_P_IPV6)) |
1726 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c |
1727 |
+index f7dd8de79941..1c1eae0ef8c2 100644 |
1728 |
+--- a/drivers/infiniband/sw/rxe/rxe_req.c |
1729 |
++++ b/drivers/infiniband/sw/rxe/rxe_req.c |
1730 |
+@@ -500,6 +500,12 @@ static int fill_packet(struct rxe_qp *qp, struct rxe_send_wqe *wqe, |
1731 |
+ if (err) |
1732 |
+ return err; |
1733 |
+ } |
1734 |
++ if (bth_pad(pkt)) { |
1735 |
++ u8 *pad = payload_addr(pkt) + paylen; |
1736 |
++ |
1737 |
++ memset(pad, 0, bth_pad(pkt)); |
1738 |
++ crc = rxe_crc32(rxe, crc, pad, bth_pad(pkt)); |
1739 |
++ } |
1740 |
+ } |
1741 |
+ p = payload_addr(pkt) + paylen + bth_pad(pkt); |
1742 |
+ |
1743 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c |
1744 |
+index 681d8e0913d0..9078cfd3b8bd 100644 |
1745 |
+--- a/drivers/infiniband/sw/rxe/rxe_resp.c |
1746 |
++++ b/drivers/infiniband/sw/rxe/rxe_resp.c |
1747 |
+@@ -737,6 +737,13 @@ static enum resp_states read_reply(struct rxe_qp *qp, |
1748 |
+ if (err) |
1749 |
+ pr_err("Failed copying memory\n"); |
1750 |
+ |
1751 |
++ if (bth_pad(&ack_pkt)) { |
1752 |
++ struct rxe_dev *rxe = to_rdev(qp->ibqp.device); |
1753 |
++ u8 *pad = payload_addr(&ack_pkt) + payload; |
1754 |
++ |
1755 |
++ memset(pad, 0, bth_pad(&ack_pkt)); |
1756 |
++ icrc = rxe_crc32(rxe, icrc, pad, bth_pad(&ack_pkt)); |
1757 |
++ } |
1758 |
+ p = payload_addr(&ack_pkt) + payload + bth_pad(&ack_pkt); |
1759 |
+ *p = ~icrc; |
1760 |
+ |
1761 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
1762 |
+index 6800dcd50a11..abcb4c3a76c1 100644 |
1763 |
+--- a/drivers/md/raid1.c |
1764 |
++++ b/drivers/md/raid1.c |
1765 |
+@@ -2756,7 +2756,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, |
1766 |
+ write_targets++; |
1767 |
+ } |
1768 |
+ } |
1769 |
+- if (bio->bi_end_io) { |
1770 |
++ if (rdev && bio->bi_end_io) { |
1771 |
+ atomic_inc(&rdev->nr_pending); |
1772 |
+ bio->bi_iter.bi_sector = sector_nr + rdev->data_offset; |
1773 |
+ bio_set_dev(bio, rdev->bdev); |
1774 |
+diff --git a/drivers/media/cec/cec-adap.c b/drivers/media/cec/cec-adap.c |
1775 |
+index dd6f3e6ce006..ba7e976bf6dc 100644 |
1776 |
+--- a/drivers/media/cec/cec-adap.c |
1777 |
++++ b/drivers/media/cec/cec-adap.c |
1778 |
+@@ -365,7 +365,8 @@ static void cec_data_cancel(struct cec_data *data, u8 tx_status) |
1779 |
+ } else { |
1780 |
+ list_del_init(&data->list); |
1781 |
+ if (!(data->msg.tx_status & CEC_TX_STATUS_OK)) |
1782 |
+- data->adap->transmit_queue_sz--; |
1783 |
++ if (!WARN_ON(!data->adap->transmit_queue_sz)) |
1784 |
++ data->adap->transmit_queue_sz--; |
1785 |
+ } |
1786 |
+ |
1787 |
+ if (data->msg.tx_status & CEC_TX_STATUS_OK) { |
1788 |
+@@ -417,6 +418,14 @@ static void cec_flush(struct cec_adapter *adap) |
1789 |
+ * need to do anything special in that case. |
1790 |
+ */ |
1791 |
+ } |
1792 |
++ /* |
1793 |
++ * If something went wrong and this counter isn't what it should |
1794 |
++ * be, then this will reset it back to 0. Warn if it is not 0, |
1795 |
++ * since it indicates a bug, either in this framework or in a |
1796 |
++ * CEC driver. |
1797 |
++ */ |
1798 |
++ if (WARN_ON(adap->transmit_queue_sz)) |
1799 |
++ adap->transmit_queue_sz = 0; |
1800 |
+ } |
1801 |
+ |
1802 |
+ /* |
1803 |
+@@ -441,7 +450,7 @@ int cec_thread_func(void *_adap) |
1804 |
+ bool timeout = false; |
1805 |
+ u8 attempts; |
1806 |
+ |
1807 |
+- if (adap->transmitting) { |
1808 |
++ if (adap->transmit_in_progress) { |
1809 |
+ int err; |
1810 |
+ |
1811 |
+ /* |
1812 |
+@@ -476,7 +485,7 @@ int cec_thread_func(void *_adap) |
1813 |
+ goto unlock; |
1814 |
+ } |
1815 |
+ |
1816 |
+- if (adap->transmitting && timeout) { |
1817 |
++ if (adap->transmit_in_progress && timeout) { |
1818 |
+ /* |
1819 |
+ * If we timeout, then log that. Normally this does |
1820 |
+ * not happen and it is an indication of a faulty CEC |
1821 |
+@@ -485,14 +494,18 @@ int cec_thread_func(void *_adap) |
1822 |
+ * so much traffic on the bus that the adapter was |
1823 |
+ * unable to transmit for CEC_XFER_TIMEOUT_MS (2.1s). |
1824 |
+ */ |
1825 |
+- pr_warn("cec-%s: message %*ph timed out\n", adap->name, |
1826 |
+- adap->transmitting->msg.len, |
1827 |
+- adap->transmitting->msg.msg); |
1828 |
++ if (adap->transmitting) { |
1829 |
++ pr_warn("cec-%s: message %*ph timed out\n", adap->name, |
1830 |
++ adap->transmitting->msg.len, |
1831 |
++ adap->transmitting->msg.msg); |
1832 |
++ /* Just give up on this. */ |
1833 |
++ cec_data_cancel(adap->transmitting, |
1834 |
++ CEC_TX_STATUS_TIMEOUT); |
1835 |
++ } else { |
1836 |
++ pr_warn("cec-%s: transmit timed out\n", adap->name); |
1837 |
++ } |
1838 |
+ adap->transmit_in_progress = false; |
1839 |
+ adap->tx_timeouts++; |
1840 |
+- /* Just give up on this. */ |
1841 |
+- cec_data_cancel(adap->transmitting, |
1842 |
+- CEC_TX_STATUS_TIMEOUT); |
1843 |
+ goto unlock; |
1844 |
+ } |
1845 |
+ |
1846 |
+@@ -507,7 +520,8 @@ int cec_thread_func(void *_adap) |
1847 |
+ data = list_first_entry(&adap->transmit_queue, |
1848 |
+ struct cec_data, list); |
1849 |
+ list_del_init(&data->list); |
1850 |
+- adap->transmit_queue_sz--; |
1851 |
++ if (!WARN_ON(!data->adap->transmit_queue_sz)) |
1852 |
++ adap->transmit_queue_sz--; |
1853 |
+ |
1854 |
+ /* Make this the current transmitting message */ |
1855 |
+ adap->transmitting = data; |
1856 |
+@@ -1038,11 +1052,11 @@ void cec_received_msg_ts(struct cec_adapter *adap, |
1857 |
+ valid_la = false; |
1858 |
+ else if (!cec_msg_is_broadcast(msg) && !(dir_fl & DIRECTED)) |
1859 |
+ valid_la = false; |
1860 |
+- else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST1_4)) |
1861 |
++ else if (cec_msg_is_broadcast(msg) && !(dir_fl & BCAST)) |
1862 |
+ valid_la = false; |
1863 |
+ else if (cec_msg_is_broadcast(msg) && |
1864 |
+- adap->log_addrs.cec_version >= CEC_OP_CEC_VERSION_2_0 && |
1865 |
+- !(dir_fl & BCAST2_0)) |
1866 |
++ adap->log_addrs.cec_version < CEC_OP_CEC_VERSION_2_0 && |
1867 |
++ !(dir_fl & BCAST1_4)) |
1868 |
+ valid_la = false; |
1869 |
+ } |
1870 |
+ if (valid_la && min_len) { |
1871 |
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c |
1872 |
+index f1807c16438d..427cda457af6 100644 |
1873 |
+--- a/drivers/media/usb/b2c2/flexcop-usb.c |
1874 |
++++ b/drivers/media/usb/b2c2/flexcop-usb.c |
1875 |
+@@ -294,7 +294,7 @@ static int flexcop_usb_i2c_req(struct flexcop_i2c_adapter *i2c, |
1876 |
+ |
1877 |
+ mutex_unlock(&fc_usb->data_mutex); |
1878 |
+ |
1879 |
+- return 0; |
1880 |
++ return ret; |
1881 |
+ } |
1882 |
+ |
1883 |
+ /* actual bus specific access functions, |
1884 |
+diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c |
1885 |
+index 16e946e01d2c..25871979123f 100644 |
1886 |
+--- a/drivers/media/usb/dvb-usb/af9005.c |
1887 |
++++ b/drivers/media/usb/dvb-usb/af9005.c |
1888 |
+@@ -985,8 +985,9 @@ static int af9005_identify_state(struct usb_device *udev, |
1889 |
+ else if (reply == 0x02) |
1890 |
+ *cold = 0; |
1891 |
+ else |
1892 |
+- return -EIO; |
1893 |
+- deb_info("Identify state cold = %d\n", *cold); |
1894 |
++ ret = -EIO; |
1895 |
++ if (!ret) |
1896 |
++ deb_info("Identify state cold = %d\n", *cold); |
1897 |
+ |
1898 |
+ err: |
1899 |
+ kfree(buf); |
1900 |
+diff --git a/drivers/media/usb/pulse8-cec/pulse8-cec.c b/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1901 |
+index 6e3bdd71e273..f5899321e5a3 100644 |
1902 |
+--- a/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1903 |
++++ b/drivers/media/usb/pulse8-cec/pulse8-cec.c |
1904 |
+@@ -121,6 +121,7 @@ struct pulse8 { |
1905 |
+ unsigned int vers; |
1906 |
+ struct completion cmd_done; |
1907 |
+ struct work_struct work; |
1908 |
++ u8 work_result; |
1909 |
+ struct delayed_work ping_eeprom_work; |
1910 |
+ struct cec_msg rx_msg; |
1911 |
+ u8 data[DATA_SIZE]; |
1912 |
+@@ -142,8 +143,10 @@ static void pulse8_irq_work_handler(struct work_struct *work) |
1913 |
+ { |
1914 |
+ struct pulse8 *pulse8 = |
1915 |
+ container_of(work, struct pulse8, work); |
1916 |
++ u8 result = pulse8->work_result; |
1917 |
+ |
1918 |
+- switch (pulse8->data[0] & 0x3f) { |
1919 |
++ pulse8->work_result = 0; |
1920 |
++ switch (result & 0x3f) { |
1921 |
+ case MSGCODE_FRAME_DATA: |
1922 |
+ cec_received_msg(pulse8->adap, &pulse8->rx_msg); |
1923 |
+ break; |
1924 |
+@@ -177,12 +180,12 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, |
1925 |
+ pulse8->escape = false; |
1926 |
+ } else if (data == MSGEND) { |
1927 |
+ struct cec_msg *msg = &pulse8->rx_msg; |
1928 |
++ u8 msgcode = pulse8->buf[0]; |
1929 |
+ |
1930 |
+ if (debug) |
1931 |
+ dev_info(pulse8->dev, "received: %*ph\n", |
1932 |
+ pulse8->idx, pulse8->buf); |
1933 |
+- pulse8->data[0] = pulse8->buf[0]; |
1934 |
+- switch (pulse8->buf[0] & 0x3f) { |
1935 |
++ switch (msgcode & 0x3f) { |
1936 |
+ case MSGCODE_FRAME_START: |
1937 |
+ msg->len = 1; |
1938 |
+ msg->msg[0] = pulse8->buf[1]; |
1939 |
+@@ -191,14 +194,20 @@ static irqreturn_t pulse8_interrupt(struct serio *serio, unsigned char data, |
1940 |
+ if (msg->len == CEC_MAX_MSG_SIZE) |
1941 |
+ break; |
1942 |
+ msg->msg[msg->len++] = pulse8->buf[1]; |
1943 |
+- if (pulse8->buf[0] & MSGCODE_FRAME_EOM) |
1944 |
++ if (msgcode & MSGCODE_FRAME_EOM) { |
1945 |
++ WARN_ON(pulse8->work_result); |
1946 |
++ pulse8->work_result = msgcode; |
1947 |
+ schedule_work(&pulse8->work); |
1948 |
++ break; |
1949 |
++ } |
1950 |
+ break; |
1951 |
+ case MSGCODE_TRANSMIT_SUCCEEDED: |
1952 |
+ case MSGCODE_TRANSMIT_FAILED_LINE: |
1953 |
+ case MSGCODE_TRANSMIT_FAILED_ACK: |
1954 |
+ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: |
1955 |
+ case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: |
1956 |
++ WARN_ON(pulse8->work_result); |
1957 |
++ pulse8->work_result = msgcode; |
1958 |
+ schedule_work(&pulse8->work); |
1959 |
+ break; |
1960 |
+ case MSGCODE_HIGH_ERROR: |
1961 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1962 |
+index 799010ed04e0..b5d7ef4da17f 100644 |
1963 |
+--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1964 |
++++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
1965 |
+@@ -973,6 +973,8 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
1966 |
+ struct ath_htc_rx_status *rxstatus; |
1967 |
+ struct ath_rx_status rx_stats; |
1968 |
+ bool decrypt_error = false; |
1969 |
++ __be16 rs_datalen; |
1970 |
++ bool is_phyerr; |
1971 |
+ |
1972 |
+ if (skb->len < HTC_RX_FRAME_HEADER_SIZE) { |
1973 |
+ ath_err(common, "Corrupted RX frame, dropping (len: %d)\n", |
1974 |
+@@ -982,11 +984,24 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
1975 |
+ |
1976 |
+ rxstatus = (struct ath_htc_rx_status *)skb->data; |
1977 |
+ |
1978 |
+- if (be16_to_cpu(rxstatus->rs_datalen) - |
1979 |
+- (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0) { |
1980 |
++ rs_datalen = be16_to_cpu(rxstatus->rs_datalen); |
1981 |
++ if (unlikely(rs_datalen - |
1982 |
++ (skb->len - HTC_RX_FRAME_HEADER_SIZE) != 0)) { |
1983 |
+ ath_err(common, |
1984 |
+ "Corrupted RX data len, dropping (dlen: %d, skblen: %d)\n", |
1985 |
+- rxstatus->rs_datalen, skb->len); |
1986 |
++ rs_datalen, skb->len); |
1987 |
++ goto rx_next; |
1988 |
++ } |
1989 |
++ |
1990 |
++ is_phyerr = rxstatus->rs_status & ATH9K_RXERR_PHY; |
1991 |
++ /* |
1992 |
++ * Discard zero-length packets and packets smaller than an ACK |
1993 |
++ * which are not PHY_ERROR (short radar pulses have a length of 3) |
1994 |
++ */ |
1995 |
++ if (unlikely(!rs_datalen || (rs_datalen < 10 && !is_phyerr))) { |
1996 |
++ ath_warn(common, |
1997 |
++ "Short RX data len, dropping (dlen: %d)\n", |
1998 |
++ rs_datalen); |
1999 |
+ goto rx_next; |
2000 |
+ } |
2001 |
+ |
2002 |
+@@ -1011,7 +1026,7 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv, |
2003 |
+ * Process PHY errors and return so that the packet |
2004 |
+ * can be dropped. |
2005 |
+ */ |
2006 |
+- if (rx_stats.rs_status & ATH9K_RXERR_PHY) { |
2007 |
++ if (unlikely(is_phyerr)) { |
2008 |
+ /* TODO: Not using DFS processing now. */ |
2009 |
+ if (ath_cmn_process_fft(&priv->spec_priv, hdr, |
2010 |
+ &rx_stats, rx_status->mactime)) { |
2011 |
+diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c |
2012 |
+index 565bddcfd130..1875f6b8a907 100644 |
2013 |
+--- a/drivers/nvme/host/fc.c |
2014 |
++++ b/drivers/nvme/host/fc.c |
2015 |
+@@ -342,7 +342,8 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, |
2016 |
+ !template->ls_req || !template->fcp_io || |
2017 |
+ !template->ls_abort || !template->fcp_abort || |
2018 |
+ !template->max_hw_queues || !template->max_sgl_segments || |
2019 |
+- !template->max_dif_sgl_segments || !template->dma_boundary) { |
2020 |
++ !template->max_dif_sgl_segments || !template->dma_boundary || |
2021 |
++ !template->module) { |
2022 |
+ ret = -EINVAL; |
2023 |
+ goto out_reghost_failed; |
2024 |
+ } |
2025 |
+@@ -1986,6 +1987,7 @@ nvme_fc_ctrl_free(struct kref *ref) |
2026 |
+ { |
2027 |
+ struct nvme_fc_ctrl *ctrl = |
2028 |
+ container_of(ref, struct nvme_fc_ctrl, ref); |
2029 |
++ struct nvme_fc_lport *lport = ctrl->lport; |
2030 |
+ unsigned long flags; |
2031 |
+ |
2032 |
+ if (ctrl->ctrl.tagset) { |
2033 |
+@@ -2011,6 +2013,7 @@ nvme_fc_ctrl_free(struct kref *ref) |
2034 |
+ if (ctrl->ctrl.opts) |
2035 |
+ nvmf_free_options(ctrl->ctrl.opts); |
2036 |
+ kfree(ctrl); |
2037 |
++ module_put(lport->ops->module); |
2038 |
+ } |
2039 |
+ |
2040 |
+ static void |
2041 |
+@@ -2891,10 +2894,22 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) |
2042 |
+ static void |
2043 |
+ __nvme_fc_terminate_io(struct nvme_fc_ctrl *ctrl) |
2044 |
+ { |
2045 |
+- nvme_stop_keep_alive(&ctrl->ctrl); |
2046 |
++ /* |
2047 |
++ * if state is connecting - the error occurred as part of a |
2048 |
++ * reconnect attempt. The create_association error paths will |
2049 |
++ * clean up any outstanding io. |
2050 |
++ * |
2051 |
++ * if it's a different state - ensure all pending io is |
2052 |
++ * terminated. Given this can delay while waiting for the |
2053 |
++ * aborted io to return, we recheck adapter state below |
2054 |
++ * before changing state. |
2055 |
++ */ |
2056 |
++ if (ctrl->ctrl.state != NVME_CTRL_CONNECTING) { |
2057 |
++ nvme_stop_keep_alive(&ctrl->ctrl); |
2058 |
+ |
2059 |
+- /* will block will waiting for io to terminate */ |
2060 |
+- nvme_fc_delete_association(ctrl); |
2061 |
++ /* will block will waiting for io to terminate */ |
2062 |
++ nvme_fc_delete_association(ctrl); |
2063 |
++ } |
2064 |
+ |
2065 |
+ if (ctrl->ctrl.state != NVME_CTRL_CONNECTING && |
2066 |
+ !nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING)) |
2067 |
+@@ -3040,10 +3055,15 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, |
2068 |
+ goto out_fail; |
2069 |
+ } |
2070 |
+ |
2071 |
++ if (!try_module_get(lport->ops->module)) { |
2072 |
++ ret = -EUNATCH; |
2073 |
++ goto out_free_ctrl; |
2074 |
++ } |
2075 |
++ |
2076 |
+ idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL); |
2077 |
+ if (idx < 0) { |
2078 |
+ ret = -ENOSPC; |
2079 |
+- goto out_free_ctrl; |
2080 |
++ goto out_mod_put; |
2081 |
+ } |
2082 |
+ |
2083 |
+ ctrl->ctrl.opts = opts; |
2084 |
+@@ -3185,6 +3205,8 @@ out_free_queues: |
2085 |
+ out_free_ida: |
2086 |
+ put_device(ctrl->dev); |
2087 |
+ ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum); |
2088 |
++out_mod_put: |
2089 |
++ module_put(lport->ops->module); |
2090 |
+ out_free_ctrl: |
2091 |
+ kfree(ctrl); |
2092 |
+ out_fail: |
2093 |
+diff --git a/drivers/nvme/target/fcloop.c b/drivers/nvme/target/fcloop.c |
2094 |
+index 291f4121f516..f0536d341f2f 100644 |
2095 |
+--- a/drivers/nvme/target/fcloop.c |
2096 |
++++ b/drivers/nvme/target/fcloop.c |
2097 |
+@@ -825,6 +825,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport) |
2098 |
+ #define FCLOOP_DMABOUND_4G 0xFFFFFFFF |
2099 |
+ |
2100 |
+ static struct nvme_fc_port_template fctemplate = { |
2101 |
++ .module = THIS_MODULE, |
2102 |
+ .localport_delete = fcloop_localport_delete, |
2103 |
+ .remoteport_delete = fcloop_remoteport_delete, |
2104 |
+ .create_queue = fcloop_create_queue, |
2105 |
+diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c |
2106 |
+index 429166e6ec9e..9c94ebb251cb 100644 |
2107 |
+--- a/drivers/platform/x86/pmc_atom.c |
2108 |
++++ b/drivers/platform/x86/pmc_atom.c |
2109 |
+@@ -452,6 +452,14 @@ static const struct dmi_system_id critclk_systems[] = { |
2110 |
+ DMI_MATCH(DMI_PRODUCT_VERSION, "6ES7647-8B"), |
2111 |
+ }, |
2112 |
+ }, |
2113 |
++ { |
2114 |
++ .ident = "CONNECT X300", |
2115 |
++ .matches = { |
2116 |
++ DMI_MATCH(DMI_SYS_VENDOR, "SIEMENS AG"), |
2117 |
++ DMI_MATCH(DMI_PRODUCT_VERSION, "A5E45074588"), |
2118 |
++ }, |
2119 |
++ }, |
2120 |
++ |
2121 |
+ { /*sentinel*/ } |
2122 |
+ }; |
2123 |
+ |
2124 |
+diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c |
2125 |
+index 83dba3fbfe0c..60578820432d 100644 |
2126 |
+--- a/drivers/regulator/ab8500.c |
2127 |
++++ b/drivers/regulator/ab8500.c |
2128 |
+@@ -956,23 +956,6 @@ static struct ab8500_regulator_info |
2129 |
+ .update_val_idle = 0x82, |
2130 |
+ .update_val_normal = 0x02, |
2131 |
+ }, |
2132 |
+- [AB8505_LDO_USB] = { |
2133 |
+- .desc = { |
2134 |
+- .name = "LDO-USB", |
2135 |
+- .ops = &ab8500_regulator_mode_ops, |
2136 |
+- .type = REGULATOR_VOLTAGE, |
2137 |
+- .id = AB8505_LDO_USB, |
2138 |
+- .owner = THIS_MODULE, |
2139 |
+- .n_voltages = 1, |
2140 |
+- .volt_table = fixed_3300000_voltage, |
2141 |
+- }, |
2142 |
+- .update_bank = 0x03, |
2143 |
+- .update_reg = 0x82, |
2144 |
+- .update_mask = 0x03, |
2145 |
+- .update_val = 0x01, |
2146 |
+- .update_val_idle = 0x03, |
2147 |
+- .update_val_normal = 0x01, |
2148 |
+- }, |
2149 |
+ [AB8505_LDO_AUDIO] = { |
2150 |
+ .desc = { |
2151 |
+ .name = "LDO-AUDIO", |
2152 |
+diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c |
2153 |
+index 0148ae62a52a..e320534310b1 100644 |
2154 |
+--- a/drivers/scsi/libsas/sas_discover.c |
2155 |
++++ b/drivers/scsi/libsas/sas_discover.c |
2156 |
+@@ -97,12 +97,21 @@ static int sas_get_port_device(struct asd_sas_port *port) |
2157 |
+ else |
2158 |
+ dev->dev_type = SAS_SATA_DEV; |
2159 |
+ dev->tproto = SAS_PROTOCOL_SATA; |
2160 |
+- } else { |
2161 |
++ } else if (port->oob_mode == SAS_OOB_MODE) { |
2162 |
+ struct sas_identify_frame *id = |
2163 |
+ (struct sas_identify_frame *) dev->frame_rcvd; |
2164 |
+ dev->dev_type = id->dev_type; |
2165 |
+ dev->iproto = id->initiator_bits; |
2166 |
+ dev->tproto = id->target_bits; |
2167 |
++ } else { |
2168 |
++ /* If the oob mode is OOB_NOT_CONNECTED, the port is |
2169 |
++ * disconnected due to race with PHY down. We cannot |
2170 |
++ * continue to discover this port |
2171 |
++ */ |
2172 |
++ sas_put_device(dev); |
2173 |
++ pr_warn("Port %016llx is disconnected when discovering\n", |
2174 |
++ SAS_ADDR(port->attached_sas_addr)); |
2175 |
++ return -ENODEV; |
2176 |
+ } |
2177 |
+ |
2178 |
+ sas_init_dev(dev); |
2179 |
+diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c |
2180 |
+index 99aea52e584b..21f104c5eab6 100644 |
2181 |
+--- a/drivers/scsi/lpfc/lpfc_bsg.c |
2182 |
++++ b/drivers/scsi/lpfc/lpfc_bsg.c |
2183 |
+@@ -4419,12 +4419,6 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
2184 |
+ phba->mbox_ext_buf_ctx.seqNum++; |
2185 |
+ nemb_tp = phba->mbox_ext_buf_ctx.nembType; |
2186 |
+ |
2187 |
+- dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); |
2188 |
+- if (!dd_data) { |
2189 |
+- rc = -ENOMEM; |
2190 |
+- goto job_error; |
2191 |
+- } |
2192 |
+- |
2193 |
+ pbuf = (uint8_t *)dmabuf->virt; |
2194 |
+ size = job->request_payload.payload_len; |
2195 |
+ sg_copy_to_buffer(job->request_payload.sg_list, |
2196 |
+@@ -4461,6 +4455,13 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
2197 |
+ "2968 SLI_CONFIG ext-buffer wr all %d " |
2198 |
+ "ebuffers received\n", |
2199 |
+ phba->mbox_ext_buf_ctx.numBuf); |
2200 |
++ |
2201 |
++ dd_data = kmalloc(sizeof(struct bsg_job_data), GFP_KERNEL); |
2202 |
++ if (!dd_data) { |
2203 |
++ rc = -ENOMEM; |
2204 |
++ goto job_error; |
2205 |
++ } |
2206 |
++ |
2207 |
+ /* mailbox command structure for base driver */ |
2208 |
+ pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
2209 |
+ if (!pmboxq) { |
2210 |
+@@ -4509,6 +4510,8 @@ lpfc_bsg_write_ebuf_set(struct lpfc_hba *phba, struct bsg_job *job, |
2211 |
+ return SLI_CONFIG_HANDLED; |
2212 |
+ |
2213 |
+ job_error: |
2214 |
++ if (pmboxq) |
2215 |
++ mempool_free(pmboxq, phba->mbox_mem_pool); |
2216 |
+ lpfc_bsg_dma_page_free(phba, dmabuf); |
2217 |
+ kfree(dd_data); |
2218 |
+ |
2219 |
+diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c |
2220 |
+index f73726e55e44..6c355d87c709 100644 |
2221 |
+--- a/drivers/scsi/lpfc/lpfc_nvme.c |
2222 |
++++ b/drivers/scsi/lpfc/lpfc_nvme.c |
2223 |
+@@ -1903,6 +1903,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport, |
2224 |
+ |
2225 |
+ /* Declare and initialization an instance of the FC NVME template. */ |
2226 |
+ static struct nvme_fc_port_template lpfc_nvme_template = { |
2227 |
++ .module = THIS_MODULE, |
2228 |
++ |
2229 |
+ /* initiator-based functions */ |
2230 |
+ .localport_delete = lpfc_nvme_localport_delete, |
2231 |
+ .remoteport_delete = lpfc_nvme_remoteport_delete, |
2232 |
+diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c |
2233 |
+index 04f0c4d2e256..5178cd03666a 100644 |
2234 |
+--- a/drivers/scsi/qedf/qedf_els.c |
2235 |
++++ b/drivers/scsi/qedf/qedf_els.c |
2236 |
+@@ -23,8 +23,6 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, |
2237 |
+ int rc = 0; |
2238 |
+ uint32_t did, sid; |
2239 |
+ uint16_t xid; |
2240 |
+- uint32_t start_time = jiffies / HZ; |
2241 |
+- uint32_t current_time; |
2242 |
+ struct fcoe_wqe *sqe; |
2243 |
+ unsigned long flags; |
2244 |
+ u16 sqe_idx; |
2245 |
+@@ -59,18 +57,12 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op, |
2246 |
+ goto els_err; |
2247 |
+ } |
2248 |
+ |
2249 |
+-retry_els: |
2250 |
+ els_req = qedf_alloc_cmd(fcport, QEDF_ELS); |
2251 |
+ if (!els_req) { |
2252 |
+- current_time = jiffies / HZ; |
2253 |
+- if ((current_time - start_time) > 10) { |
2254 |
+- QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, |
2255 |
+- "els: Failed els 0x%x\n", op); |
2256 |
+- rc = -ENOMEM; |
2257 |
+- goto els_err; |
2258 |
+- } |
2259 |
+- mdelay(20 * USEC_PER_MSEC); |
2260 |
+- goto retry_els; |
2261 |
++ QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS, |
2262 |
++ "Failed to alloc ELS request 0x%x\n", op); |
2263 |
++ rc = -ENOMEM; |
2264 |
++ goto els_err; |
2265 |
+ } |
2266 |
+ |
2267 |
+ QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = " |
2268 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
2269 |
+index 4512aaa16f78..851f75b12216 100644 |
2270 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
2271 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
2272 |
+@@ -4815,14 +4815,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) |
2273 |
+ set_bit(RSCN_UPDATE, &flags); |
2274 |
+ clear_bit(LOCAL_LOOP_UPDATE, &flags); |
2275 |
+ |
2276 |
+- } else if (ha->current_topology == ISP_CFG_N) { |
2277 |
+- clear_bit(RSCN_UPDATE, &flags); |
2278 |
+- if (qla_tgt_mode_enabled(vha)) { |
2279 |
+- /* allow the other side to start the login */ |
2280 |
+- clear_bit(LOCAL_LOOP_UPDATE, &flags); |
2281 |
+- set_bit(RELOGIN_NEEDED, &vha->dpc_flags); |
2282 |
+- } |
2283 |
+- } else if (ha->current_topology == ISP_CFG_NL) { |
2284 |
++ } else if (ha->current_topology == ISP_CFG_NL || |
2285 |
++ ha->current_topology == ISP_CFG_N) { |
2286 |
+ clear_bit(RSCN_UPDATE, &flags); |
2287 |
+ set_bit(LOCAL_LOOP_UPDATE, &flags); |
2288 |
+ } else if (!vha->flags.online || |
2289 |
+diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
2290 |
+index c699bbb8485b..7e47321e003c 100644 |
2291 |
+--- a/drivers/scsi/qla2xxx/qla_iocb.c |
2292 |
++++ b/drivers/scsi/qla2xxx/qla_iocb.c |
2293 |
+@@ -2537,7 +2537,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb) |
2294 |
+ ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3073, |
2295 |
+ "PLOGI ELS IOCB:\n"); |
2296 |
+ ql_dump_buffer(ql_log_info, vha, 0x0109, |
2297 |
+- (uint8_t *)els_iocb, 0x70); |
2298 |
++ (uint8_t *)els_iocb, |
2299 |
++ sizeof(*els_iocb)); |
2300 |
+ } else { |
2301 |
+ els_iocb->tx_byte_count = sizeof(struct els_logo_payload); |
2302 |
+ els_iocb->tx_address[0] = |
2303 |
+@@ -2703,7 +2704,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode, |
2304 |
+ |
2305 |
+ ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n"); |
2306 |
+ ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109, |
2307 |
+- (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 0x70); |
2308 |
++ (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, |
2309 |
++ sizeof(*elsio->u.els_plogi.els_plogi_pyld)); |
2310 |
+ |
2311 |
+ rval = qla2x00_start_sp(sp); |
2312 |
+ if (rval != QLA_SUCCESS) { |
2313 |
+diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c |
2314 |
+index afe15b3e45fb..e6d162945f5d 100644 |
2315 |
+--- a/drivers/scsi/qla2xxx/qla_isr.c |
2316 |
++++ b/drivers/scsi/qla2xxx/qla_isr.c |
2317 |
+@@ -1049,8 +1049,6 @@ global_port_update: |
2318 |
+ ql_dbg(ql_dbg_async, vha, 0x5011, |
2319 |
+ "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n", |
2320 |
+ mb[1], mb[2], mb[3]); |
2321 |
+- |
2322 |
+- qlt_async_event(mb[0], vha, mb); |
2323 |
+ break; |
2324 |
+ } |
2325 |
+ |
2326 |
+@@ -1067,8 +1065,6 @@ global_port_update: |
2327 |
+ set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); |
2328 |
+ set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); |
2329 |
+ set_bit(VP_CONFIG_OK, &vha->vp_flags); |
2330 |
+- |
2331 |
+- qlt_async_event(mb[0], vha, mb); |
2332 |
+ break; |
2333 |
+ |
2334 |
+ case MBA_RSCN_UPDATE: /* State Change Registration */ |
2335 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
2336 |
+index b01f69dd4b28..abef3b29fa10 100644 |
2337 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
2338 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
2339 |
+@@ -3871,6 +3871,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, |
2340 |
+ vha->d_id.b24 = 0; |
2341 |
+ vha->d_id.b.al_pa = 1; |
2342 |
+ ha->flags.n2n_bigger = 1; |
2343 |
++ ha->flags.n2n_ae = 0; |
2344 |
+ |
2345 |
+ id.b.al_pa = 2; |
2346 |
+ ql_dbg(ql_dbg_async, vha, 0x5075, |
2347 |
+@@ -3881,6 +3882,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, |
2348 |
+ "Format 1: Remote login - Waiting for WWPN %8phC.\n", |
2349 |
+ rptid_entry->u.f1.port_name); |
2350 |
+ ha->flags.n2n_bigger = 0; |
2351 |
++ ha->flags.n2n_ae = 1; |
2352 |
+ } |
2353 |
+ qla24xx_post_newsess_work(vha, &id, |
2354 |
+ rptid_entry->u.f1.port_name, |
2355 |
+@@ -3892,7 +3894,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha, |
2356 |
+ /* if our portname is higher then initiate N2N login */ |
2357 |
+ |
2358 |
+ set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags); |
2359 |
+- ha->flags.n2n_ae = 1; |
2360 |
+ return; |
2361 |
+ break; |
2362 |
+ case TOPO_FL: |
2363 |
+diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c |
2364 |
+index 5590d6e8b576..db367e428095 100644 |
2365 |
+--- a/drivers/scsi/qla2xxx/qla_nvme.c |
2366 |
++++ b/drivers/scsi/qla2xxx/qla_nvme.c |
2367 |
+@@ -560,6 +560,7 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) |
2368 |
+ } |
2369 |
+ |
2370 |
+ static struct nvme_fc_port_template qla_nvme_fc_transport = { |
2371 |
++ .module = THIS_MODULE, |
2372 |
+ .localport_delete = qla_nvme_localport_delete, |
2373 |
+ .remoteport_delete = qla_nvme_remoteport_delete, |
2374 |
+ .create_queue = qla_nvme_alloc_queue, |
2375 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
2376 |
+index 210ce294038d..e9545411ec5a 100644 |
2377 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
2378 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
2379 |
+@@ -1261,7 +1261,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess) |
2380 |
+ "Scheduling sess %p for deletion %8phC\n", |
2381 |
+ sess, sess->port_name); |
2382 |
+ |
2383 |
+- INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); |
2384 |
+ WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work)); |
2385 |
+ } |
2386 |
+ |
2387 |
+@@ -4780,6 +4779,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha, |
2388 |
+ |
2389 |
+ switch (sess->disc_state) { |
2390 |
+ case DSC_DELETED: |
2391 |
++ case DSC_LOGIN_PEND: |
2392 |
+ qlt_plogi_ack_unref(vha, pla); |
2393 |
+ break; |
2394 |
+ |
2395 |
+diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c |
2396 |
+index 25c8ce54a976..f8acf101af3d 100644 |
2397 |
+--- a/drivers/scsi/qla4xxx/ql4_os.c |
2398 |
++++ b/drivers/scsi/qla4xxx/ql4_os.c |
2399 |
+@@ -4280,7 +4280,6 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha) |
2400 |
+ return QLA_SUCCESS; |
2401 |
+ |
2402 |
+ mem_alloc_error_exit: |
2403 |
+- qla4xxx_mem_free(ha); |
2404 |
+ return QLA_ERROR; |
2405 |
+ } |
2406 |
+ |
2407 |
+diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c |
2408 |
+index 59eaa620bf13..80fd06fbd712 100644 |
2409 |
+--- a/drivers/tty/hvc/hvc_vio.c |
2410 |
++++ b/drivers/tty/hvc/hvc_vio.c |
2411 |
+@@ -107,6 +107,14 @@ static int hvterm_raw_get_chars(uint32_t vtermno, char *buf, int count) |
2412 |
+ return got; |
2413 |
+ } |
2414 |
+ |
2415 |
++/** |
2416 |
++ * hvterm_raw_put_chars: send characters to firmware for given vterm adapter |
2417 |
++ * @vtermno: The virtual terminal number. |
2418 |
++ * @buf: The characters to send. Because of the underlying hypercall in |
2419 |
++ * hvc_put_chars(), this buffer must be at least 16 bytes long, even if |
2420 |
++ * you are sending fewer chars. |
2421 |
++ * @count: number of chars to send. |
2422 |
++ */ |
2423 |
+ static int hvterm_raw_put_chars(uint32_t vtermno, const char *buf, int count) |
2424 |
+ { |
2425 |
+ struct hvterm_priv *pv = hvterm_privs[vtermno]; |
2426 |
+@@ -219,6 +227,7 @@ static const struct hv_ops hvterm_hvsi_ops = { |
2427 |
+ static void udbg_hvc_putc(char c) |
2428 |
+ { |
2429 |
+ int count = -1; |
2430 |
++ unsigned char bounce_buffer[16]; |
2431 |
+ |
2432 |
+ if (!hvterm_privs[0]) |
2433 |
+ return; |
2434 |
+@@ -229,7 +238,12 @@ static void udbg_hvc_putc(char c) |
2435 |
+ do { |
2436 |
+ switch(hvterm_privs[0]->proto) { |
2437 |
+ case HV_PROTOCOL_RAW: |
2438 |
+- count = hvterm_raw_put_chars(0, &c, 1); |
2439 |
++ /* |
2440 |
++ * hvterm_raw_put_chars requires at least a 16-byte |
2441 |
++ * buffer, so go via the bounce buffer |
2442 |
++ */ |
2443 |
++ bounce_buffer[0] = c; |
2444 |
++ count = hvterm_raw_put_chars(0, bounce_buffer, 1); |
2445 |
+ break; |
2446 |
+ case HV_PROTOCOL_HVSI: |
2447 |
+ count = hvterm_hvsi_put_chars(0, &c, 1); |
2448 |
+diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c |
2449 |
+index c10d9cc553c6..4caeca67fd14 100644 |
2450 |
+--- a/drivers/tty/serial/msm_serial.c |
2451 |
++++ b/drivers/tty/serial/msm_serial.c |
2452 |
+@@ -1580,6 +1580,7 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
2453 |
+ int num_newlines = 0; |
2454 |
+ bool replaced = false; |
2455 |
+ void __iomem *tf; |
2456 |
++ int locked = 1; |
2457 |
+ |
2458 |
+ if (is_uartdm) |
2459 |
+ tf = port->membase + UARTDM_TF; |
2460 |
+@@ -1592,7 +1593,13 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
2461 |
+ num_newlines++; |
2462 |
+ count += num_newlines; |
2463 |
+ |
2464 |
+- spin_lock(&port->lock); |
2465 |
++ if (port->sysrq) |
2466 |
++ locked = 0; |
2467 |
++ else if (oops_in_progress) |
2468 |
++ locked = spin_trylock(&port->lock); |
2469 |
++ else |
2470 |
++ spin_lock(&port->lock); |
2471 |
++ |
2472 |
+ if (is_uartdm) |
2473 |
+ msm_reset_dm_count(port, count); |
2474 |
+ |
2475 |
+@@ -1628,7 +1635,9 @@ static void __msm_console_write(struct uart_port *port, const char *s, |
2476 |
+ iowrite32_rep(tf, buf, 1); |
2477 |
+ i += num_chars; |
2478 |
+ } |
2479 |
+- spin_unlock(&port->lock); |
2480 |
++ |
2481 |
++ if (locked) |
2482 |
++ spin_unlock(&port->lock); |
2483 |
+ } |
2484 |
+ |
2485 |
+ static void msm_console_write(struct console *co, const char *s, |
2486 |
+diff --git a/drivers/usb/gadget/function/f_ecm.c b/drivers/usb/gadget/function/f_ecm.c |
2487 |
+index 6ce044008cf6..460d5d7c984f 100644 |
2488 |
+--- a/drivers/usb/gadget/function/f_ecm.c |
2489 |
++++ b/drivers/usb/gadget/function/f_ecm.c |
2490 |
+@@ -621,8 +621,12 @@ static void ecm_disable(struct usb_function *f) |
2491 |
+ |
2492 |
+ DBG(cdev, "ecm deactivated\n"); |
2493 |
+ |
2494 |
+- if (ecm->port.in_ep->enabled) |
2495 |
++ if (ecm->port.in_ep->enabled) { |
2496 |
+ gether_disconnect(&ecm->port); |
2497 |
++ } else { |
2498 |
++ ecm->port.in_ep->desc = NULL; |
2499 |
++ ecm->port.out_ep->desc = NULL; |
2500 |
++ } |
2501 |
+ |
2502 |
+ usb_ep_disable(ecm->notify); |
2503 |
+ ecm->notify->desc = NULL; |
2504 |
+diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c |
2505 |
+index d48df36622b7..0d8e4a364ca6 100644 |
2506 |
+--- a/drivers/usb/gadget/function/f_rndis.c |
2507 |
++++ b/drivers/usb/gadget/function/f_rndis.c |
2508 |
+@@ -618,6 +618,7 @@ static void rndis_disable(struct usb_function *f) |
2509 |
+ gether_disconnect(&rndis->port); |
2510 |
+ |
2511 |
+ usb_ep_disable(rndis->notify); |
2512 |
++ rndis->notify->desc = NULL; |
2513 |
+ } |
2514 |
+ |
2515 |
+ /*-------------------------------------------------------------------------*/ |
2516 |
+diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c |
2517 |
+index 747a15acbce3..6fa7209f24f4 100644 |
2518 |
+--- a/drivers/xen/balloon.c |
2519 |
++++ b/drivers/xen/balloon.c |
2520 |
+@@ -395,7 +395,8 @@ static struct notifier_block xen_memory_nb = { |
2521 |
+ #else |
2522 |
+ static enum bp_state reserve_additional_memory(void) |
2523 |
+ { |
2524 |
+- balloon_stats.target_pages = balloon_stats.current_pages; |
2525 |
++ balloon_stats.target_pages = balloon_stats.current_pages + |
2526 |
++ balloon_stats.target_unpopulated; |
2527 |
+ return BP_ECANCELED; |
2528 |
+ } |
2529 |
+ #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */ |
2530 |
+diff --git a/fs/afs/dynroot.c b/fs/afs/dynroot.c |
2531 |
+index f29c6dade7f6..069273a2483f 100644 |
2532 |
+--- a/fs/afs/dynroot.c |
2533 |
++++ b/fs/afs/dynroot.c |
2534 |
+@@ -145,6 +145,9 @@ static struct dentry *afs_dynroot_lookup(struct inode *dir, struct dentry *dentr |
2535 |
+ |
2536 |
+ ASSERTCMP(d_inode(dentry), ==, NULL); |
2537 |
+ |
2538 |
++ if (flags & LOOKUP_CREATE) |
2539 |
++ return ERR_PTR(-EOPNOTSUPP); |
2540 |
++ |
2541 |
+ if (dentry->d_name.len >= AFSNAMEMAX) { |
2542 |
+ _leave(" = -ENAMETOOLONG"); |
2543 |
+ return ERR_PTR(-ENAMETOOLONG); |
2544 |
+diff --git a/fs/afs/server.c b/fs/afs/server.c |
2545 |
+index 1d329e6981d5..2c7f6211c360 100644 |
2546 |
+--- a/fs/afs/server.c |
2547 |
++++ b/fs/afs/server.c |
2548 |
+@@ -34,18 +34,11 @@ static void afs_dec_servers_outstanding(struct afs_net *net) |
2549 |
+ struct afs_server *afs_find_server(struct afs_net *net, |
2550 |
+ const struct sockaddr_rxrpc *srx) |
2551 |
+ { |
2552 |
+- const struct sockaddr_in6 *a = &srx->transport.sin6, *b; |
2553 |
+ const struct afs_addr_list *alist; |
2554 |
+ struct afs_server *server = NULL; |
2555 |
+ unsigned int i; |
2556 |
+- bool ipv6 = true; |
2557 |
+ int seq = 0, diff; |
2558 |
+ |
2559 |
+- if (srx->transport.sin6.sin6_addr.s6_addr32[0] == 0 || |
2560 |
+- srx->transport.sin6.sin6_addr.s6_addr32[1] == 0 || |
2561 |
+- srx->transport.sin6.sin6_addr.s6_addr32[2] == htonl(0xffff)) |
2562 |
+- ipv6 = false; |
2563 |
+- |
2564 |
+ rcu_read_lock(); |
2565 |
+ |
2566 |
+ do { |
2567 |
+@@ -54,7 +47,8 @@ struct afs_server *afs_find_server(struct afs_net *net, |
2568 |
+ server = NULL; |
2569 |
+ read_seqbegin_or_lock(&net->fs_addr_lock, &seq); |
2570 |
+ |
2571 |
+- if (ipv6) { |
2572 |
++ if (srx->transport.family == AF_INET6) { |
2573 |
++ const struct sockaddr_in6 *a = &srx->transport.sin6, *b; |
2574 |
+ hlist_for_each_entry_rcu(server, &net->fs_addresses6, addr6_link) { |
2575 |
+ alist = rcu_dereference(server->addresses); |
2576 |
+ for (i = alist->nr_ipv4; i < alist->nr_addrs; i++) { |
2577 |
+@@ -70,15 +64,16 @@ struct afs_server *afs_find_server(struct afs_net *net, |
2578 |
+ } |
2579 |
+ } |
2580 |
+ } else { |
2581 |
++ const struct sockaddr_in *a = &srx->transport.sin, *b; |
2582 |
+ hlist_for_each_entry_rcu(server, &net->fs_addresses4, addr4_link) { |
2583 |
+ alist = rcu_dereference(server->addresses); |
2584 |
+ for (i = 0; i < alist->nr_ipv4; i++) { |
2585 |
+- b = &alist->addrs[i].transport.sin6; |
2586 |
+- diff = ((u16 __force)a->sin6_port - |
2587 |
+- (u16 __force)b->sin6_port); |
2588 |
++ b = &alist->addrs[i].transport.sin; |
2589 |
++ diff = ((u16 __force)a->sin_port - |
2590 |
++ (u16 __force)b->sin_port); |
2591 |
+ if (diff == 0) |
2592 |
+- diff = ((u32 __force)a->sin6_addr.s6_addr32[3] - |
2593 |
+- (u32 __force)b->sin6_addr.s6_addr32[3]); |
2594 |
++ diff = ((u32 __force)a->sin_addr.s_addr - |
2595 |
++ (u32 __force)b->sin_addr.s_addr); |
2596 |
+ if (diff == 0) |
2597 |
+ goto found; |
2598 |
+ } |
2599 |
+diff --git a/fs/afs/super.c b/fs/afs/super.c |
2600 |
+index 4d3e274207fb..bd2608297473 100644 |
2601 |
+--- a/fs/afs/super.c |
2602 |
++++ b/fs/afs/super.c |
2603 |
+@@ -404,7 +404,6 @@ static int afs_fill_super(struct super_block *sb, |
2604 |
+ /* allocate the root inode and dentry */ |
2605 |
+ if (as->dyn_root) { |
2606 |
+ inode = afs_iget_pseudo_dir(sb, true); |
2607 |
+- sb->s_flags |= SB_RDONLY; |
2608 |
+ } else { |
2609 |
+ sprintf(sb->s_id, "%u", as->volume->vid); |
2610 |
+ afs_activate_volume(as->volume); |
2611 |
+diff --git a/fs/block_dev.c b/fs/block_dev.c |
2612 |
+index 1c25dae083a8..c158bad9a075 100644 |
2613 |
+--- a/fs/block_dev.c |
2614 |
++++ b/fs/block_dev.c |
2615 |
+@@ -1328,11 +1328,7 @@ static void flush_disk(struct block_device *bdev, bool kill_dirty) |
2616 |
+ "resized disk %s\n", |
2617 |
+ bdev->bd_disk ? bdev->bd_disk->disk_name : ""); |
2618 |
+ } |
2619 |
+- |
2620 |
+- if (!bdev->bd_disk) |
2621 |
+- return; |
2622 |
+- if (disk_part_scan_enabled(bdev->bd_disk)) |
2623 |
+- bdev->bd_invalidated = 1; |
2624 |
++ bdev->bd_invalidated = 1; |
2625 |
+ } |
2626 |
+ |
2627 |
+ /** |
2628 |
+@@ -1430,6 +1426,19 @@ EXPORT_SYMBOL(bd_set_size); |
2629 |
+ |
2630 |
+ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part); |
2631 |
+ |
2632 |
++static void bdev_disk_changed(struct block_device *bdev, bool invalidate) |
2633 |
++{ |
2634 |
++ if (disk_part_scan_enabled(bdev->bd_disk)) { |
2635 |
++ if (invalidate) |
2636 |
++ invalidate_partitions(bdev->bd_disk, bdev); |
2637 |
++ else |
2638 |
++ rescan_partitions(bdev->bd_disk, bdev); |
2639 |
++ } else { |
2640 |
++ check_disk_size_change(bdev->bd_disk, bdev, !invalidate); |
2641 |
++ bdev->bd_invalidated = 0; |
2642 |
++ } |
2643 |
++} |
2644 |
++ |
2645 |
+ /* |
2646 |
+ * bd_mutex locking: |
2647 |
+ * |
2648 |
+@@ -1512,12 +1521,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
2649 |
+ * The latter is necessary to prevent ghost |
2650 |
+ * partitions on a removed medium. |
2651 |
+ */ |
2652 |
+- if (bdev->bd_invalidated) { |
2653 |
+- if (!ret) |
2654 |
+- rescan_partitions(disk, bdev); |
2655 |
+- else if (ret == -ENOMEDIUM) |
2656 |
+- invalidate_partitions(disk, bdev); |
2657 |
+- } |
2658 |
++ if (bdev->bd_invalidated && |
2659 |
++ (!ret || ret == -ENOMEDIUM)) |
2660 |
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM); |
2661 |
+ |
2662 |
+ if (ret) |
2663 |
+ goto out_clear; |
2664 |
+@@ -1550,12 +1556,9 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) |
2665 |
+ if (bdev->bd_disk->fops->open) |
2666 |
+ ret = bdev->bd_disk->fops->open(bdev, mode); |
2667 |
+ /* the same as first opener case, read comment there */ |
2668 |
+- if (bdev->bd_invalidated) { |
2669 |
+- if (!ret) |
2670 |
+- rescan_partitions(bdev->bd_disk, bdev); |
2671 |
+- else if (ret == -ENOMEDIUM) |
2672 |
+- invalidate_partitions(bdev->bd_disk, bdev); |
2673 |
+- } |
2674 |
++ if (bdev->bd_invalidated && |
2675 |
++ (!ret || ret == -ENOMEDIUM)) |
2676 |
++ bdev_disk_changed(bdev, ret == -ENOMEDIUM); |
2677 |
+ if (ret) |
2678 |
+ goto out_unlock_bdev; |
2679 |
+ } |
2680 |
+diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c |
2681 |
+index 3a03f74a8cc4..c6fe9914440e 100644 |
2682 |
+--- a/fs/compat_ioctl.c |
2683 |
++++ b/fs/compat_ioctl.c |
2684 |
+@@ -1401,10 +1401,11 @@ COMPAT_SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, |
2685 |
+ #endif |
2686 |
+ |
2687 |
+ case FICLONE: |
2688 |
++ goto do_ioctl; |
2689 |
+ case FICLONERANGE: |
2690 |
+ case FIDEDUPERANGE: |
2691 |
+ case FS_IOC_FIEMAP: |
2692 |
+- goto do_ioctl; |
2693 |
++ goto found_handler; |
2694 |
+ |
2695 |
+ case FIBMAP: |
2696 |
+ case FIGETBSZ: |
2697 |
+diff --git a/fs/locks.c b/fs/locks.c |
2698 |
+index 2ecb4db8c840..28270e74be34 100644 |
2699 |
+--- a/fs/locks.c |
2700 |
++++ b/fs/locks.c |
2701 |
+@@ -2678,7 +2678,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl, |
2702 |
+ } |
2703 |
+ if (inode) { |
2704 |
+ /* userspace relies on this representation of dev_t */ |
2705 |
+- seq_printf(f, "%d %02x:%02x:%ld ", fl_pid, |
2706 |
++ seq_printf(f, "%d %02x:%02x:%lu ", fl_pid, |
2707 |
+ MAJOR(inode->i_sb->s_dev), |
2708 |
+ MINOR(inode->i_sb->s_dev), inode->i_ino); |
2709 |
+ } else { |
2710 |
+diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c |
2711 |
+index 5f62007140cf..c8ce128e0054 100644 |
2712 |
+--- a/fs/nfsd/nfs4state.c |
2713 |
++++ b/fs/nfsd/nfs4state.c |
2714 |
+@@ -3072,12 +3072,17 @@ static bool replay_matches_cache(struct svc_rqst *rqstp, |
2715 |
+ (bool)seq->cachethis) |
2716 |
+ return false; |
2717 |
+ /* |
2718 |
+- * If there's an error than the reply can have fewer ops than |
2719 |
+- * the call. But if we cached a reply with *more* ops than the |
2720 |
+- * call you're sending us now, then this new call is clearly not |
2721 |
+- * really a replay of the old one: |
2722 |
++ * If there's an error then the reply can have fewer ops than |
2723 |
++ * the call. |
2724 |
+ */ |
2725 |
+- if (slot->sl_opcnt < argp->opcnt) |
2726 |
++ if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) |
2727 |
++ return false; |
2728 |
++ /* |
2729 |
++ * But if we cached a reply with *more* ops than the call you're |
2730 |
++ * sending us now, then this new call is clearly not really a |
2731 |
++ * replay of the old one: |
2732 |
++ */ |
2733 |
++ if (slot->sl_opcnt > argp->opcnt) |
2734 |
+ return false; |
2735 |
+ /* This is the only check explicitly called by spec: */ |
2736 |
+ if (!same_creds(&rqstp->rq_cred, &slot->sl_cred)) |
2737 |
+diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c |
2738 |
+index 631ae057ab53..bafbab2dd039 100644 |
2739 |
+--- a/fs/pstore/ram.c |
2740 |
++++ b/fs/pstore/ram.c |
2741 |
+@@ -437,6 +437,17 @@ static int notrace ramoops_pstore_write(struct pstore_record *record) |
2742 |
+ |
2743 |
+ prz = cxt->dprzs[cxt->dump_write_cnt]; |
2744 |
+ |
2745 |
++ /* |
2746 |
++ * Since this is a new crash dump, we need to reset the buffer in |
2747 |
++ * case it still has an old dump present. Without this, the new dump |
2748 |
++ * will get appended, which would seriously confuse anything trying |
2749 |
++ * to check dump file contents. Specifically, ramoops_read_kmsg_hdr() |
2750 |
++ * expects to find a dump header in the beginning of buffer data, so |
2751 |
++ * we must to reset the buffer values, in order to ensure that the |
2752 |
++ * header will be written to the beginning of the buffer. |
2753 |
++ */ |
2754 |
++ persistent_ram_zap(prz); |
2755 |
++ |
2756 |
+ /* Build header and append record contents. */ |
2757 |
+ hlen = ramoops_write_kmsg_hdr(prz, record); |
2758 |
+ size = record->size; |
2759 |
+diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c |
2760 |
+index dba87d09b989..95630f9f40dd 100644 |
2761 |
+--- a/fs/ubifs/tnc_commit.c |
2762 |
++++ b/fs/ubifs/tnc_commit.c |
2763 |
+@@ -219,7 +219,7 @@ static int is_idx_node_in_use(struct ubifs_info *c, union ubifs_key *key, |
2764 |
+ /** |
2765 |
+ * layout_leb_in_gaps - layout index nodes using in-the-gaps method. |
2766 |
+ * @c: UBIFS file-system description object |
2767 |
+- * @p: return LEB number here |
2768 |
++ * @p: return LEB number in @c->gap_lebs[p] |
2769 |
+ * |
2770 |
+ * This function lays out new index nodes for dirty znodes using in-the-gaps |
2771 |
+ * method of TNC commit. |
2772 |
+@@ -228,7 +228,7 @@ static int is_idx_node_in_use(struct ubifs_info *c, union ubifs_key *key, |
2773 |
+ * This function returns the number of index nodes written into the gaps, or a |
2774 |
+ * negative error code on failure. |
2775 |
+ */ |
2776 |
+-static int layout_leb_in_gaps(struct ubifs_info *c, int *p) |
2777 |
++static int layout_leb_in_gaps(struct ubifs_info *c, int p) |
2778 |
+ { |
2779 |
+ struct ubifs_scan_leb *sleb; |
2780 |
+ struct ubifs_scan_node *snod; |
2781 |
+@@ -243,7 +243,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p) |
2782 |
+ * filled, however we do not check there at present. |
2783 |
+ */ |
2784 |
+ return lnum; /* Error code */ |
2785 |
+- *p = lnum; |
2786 |
++ c->gap_lebs[p] = lnum; |
2787 |
+ dbg_gc("LEB %d", lnum); |
2788 |
+ /* |
2789 |
+ * Scan the index LEB. We use the generic scan for this even though |
2790 |
+@@ -362,7 +362,7 @@ static int get_leb_cnt(struct ubifs_info *c, int cnt) |
2791 |
+ */ |
2792 |
+ static int layout_in_gaps(struct ubifs_info *c, int cnt) |
2793 |
+ { |
2794 |
+- int err, leb_needed_cnt, written, *p; |
2795 |
++ int err, leb_needed_cnt, written, p = 0, old_idx_lebs, *gap_lebs; |
2796 |
+ |
2797 |
+ dbg_gc("%d znodes to write", cnt); |
2798 |
+ |
2799 |
+@@ -371,9 +371,9 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) |
2800 |
+ if (!c->gap_lebs) |
2801 |
+ return -ENOMEM; |
2802 |
+ |
2803 |
+- p = c->gap_lebs; |
2804 |
++ old_idx_lebs = c->lst.idx_lebs; |
2805 |
+ do { |
2806 |
+- ubifs_assert(c, p < c->gap_lebs + c->lst.idx_lebs); |
2807 |
++ ubifs_assert(c, p < c->lst.idx_lebs); |
2808 |
+ written = layout_leb_in_gaps(c, p); |
2809 |
+ if (written < 0) { |
2810 |
+ err = written; |
2811 |
+@@ -399,9 +399,29 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) |
2812 |
+ leb_needed_cnt = get_leb_cnt(c, cnt); |
2813 |
+ dbg_gc("%d znodes remaining, need %d LEBs, have %d", cnt, |
2814 |
+ leb_needed_cnt, c->ileb_cnt); |
2815 |
++ /* |
2816 |
++ * Dynamically change the size of @c->gap_lebs to prevent |
2817 |
++ * oob, because @c->lst.idx_lebs could be increased by |
2818 |
++ * function @get_idx_gc_leb (called by layout_leb_in_gaps-> |
2819 |
++ * ubifs_find_dirty_idx_leb) during loop. Only enlarge |
2820 |
++ * @c->gap_lebs when needed. |
2821 |
++ * |
2822 |
++ */ |
2823 |
++ if (leb_needed_cnt > c->ileb_cnt && p >= old_idx_lebs && |
2824 |
++ old_idx_lebs < c->lst.idx_lebs) { |
2825 |
++ old_idx_lebs = c->lst.idx_lebs; |
2826 |
++ gap_lebs = krealloc(c->gap_lebs, sizeof(int) * |
2827 |
++ (old_idx_lebs + 1), GFP_NOFS); |
2828 |
++ if (!gap_lebs) { |
2829 |
++ kfree(c->gap_lebs); |
2830 |
++ c->gap_lebs = NULL; |
2831 |
++ return -ENOMEM; |
2832 |
++ } |
2833 |
++ c->gap_lebs = gap_lebs; |
2834 |
++ } |
2835 |
+ } while (leb_needed_cnt > c->ileb_cnt); |
2836 |
+ |
2837 |
+- *p = -1; |
2838 |
++ c->gap_lebs[p] = -1; |
2839 |
+ return 0; |
2840 |
+ } |
2841 |
+ |
2842 |
+diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c |
2843 |
+index 38dc0b43c366..0b7145fdb8aa 100644 |
2844 |
+--- a/fs/xfs/libxfs/xfs_bmap.c |
2845 |
++++ b/fs/xfs/libxfs/xfs_bmap.c |
2846 |
+@@ -5239,7 +5239,7 @@ __xfs_bunmapi( |
2847 |
+ * Make sure we don't touch multiple AGF headers out of order |
2848 |
+ * in a single transaction, as that could cause AB-BA deadlocks. |
2849 |
+ */ |
2850 |
+- if (!wasdel) { |
2851 |
++ if (!wasdel && !isrt) { |
2852 |
+ agno = XFS_FSB_TO_AGNO(mp, del.br_startblock); |
2853 |
+ if (prev_agno != NULLAGNUMBER && prev_agno > agno) |
2854 |
+ break; |
2855 |
+diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h |
2856 |
+index 2d4324d12f9a..51ea2ab124b7 100644 |
2857 |
+--- a/fs/xfs/scrub/common.h |
2858 |
++++ b/fs/xfs/scrub/common.h |
2859 |
+@@ -14,8 +14,15 @@ |
2860 |
+ static inline bool |
2861 |
+ xchk_should_terminate( |
2862 |
+ struct xfs_scrub *sc, |
2863 |
+- int *error) |
2864 |
++ int *error) |
2865 |
+ { |
2866 |
++ /* |
2867 |
++ * If preemption is disabled, we need to yield to the scheduler every |
2868 |
++ * few seconds so that we don't run afoul of the soft lockup watchdog |
2869 |
++ * or RCU stall detector. |
2870 |
++ */ |
2871 |
++ cond_resched(); |
2872 |
++ |
2873 |
+ if (fatal_signal_pending(current)) { |
2874 |
+ if (*error == 0) |
2875 |
+ *error = -EAGAIN; |
2876 |
+diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c |
2877 |
+index c3b610b687d1..7bba551cbf90 100644 |
2878 |
+--- a/fs/xfs/xfs_log.c |
2879 |
++++ b/fs/xfs/xfs_log.c |
2880 |
+@@ -1578,6 +1578,8 @@ out_free_iclog: |
2881 |
+ if (iclog->ic_bp) |
2882 |
+ xfs_buf_free(iclog->ic_bp); |
2883 |
+ kmem_free(iclog); |
2884 |
++ if (prev_iclog == log->l_iclog) |
2885 |
++ break; |
2886 |
+ } |
2887 |
+ spinlock_destroy(&log->l_icloglock); |
2888 |
+ xfs_buf_free(log->l_xbuf); |
2889 |
+diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h |
2890 |
+index eaedca5fe6fc..345c3b510045 100644 |
2891 |
+--- a/include/linux/ahci_platform.h |
2892 |
++++ b/include/linux/ahci_platform.h |
2893 |
+@@ -23,6 +23,8 @@ struct ahci_host_priv; |
2894 |
+ struct platform_device; |
2895 |
+ struct scsi_host_template; |
2896 |
+ |
2897 |
++int ahci_platform_enable_phys(struct ahci_host_priv *hpriv); |
2898 |
++void ahci_platform_disable_phys(struct ahci_host_priv *hpriv); |
2899 |
+ int ahci_platform_enable_clks(struct ahci_host_priv *hpriv); |
2900 |
+ void ahci_platform_disable_clks(struct ahci_host_priv *hpriv); |
2901 |
+ int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv); |
2902 |
+diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h |
2903 |
+index d49ec5c31944..0647f436f88c 100644 |
2904 |
+--- a/include/linux/dmaengine.h |
2905 |
++++ b/include/linux/dmaengine.h |
2906 |
+@@ -1373,8 +1373,11 @@ static inline int dma_get_slave_caps(struct dma_chan *chan, |
2907 |
+ static inline int dmaengine_desc_set_reuse(struct dma_async_tx_descriptor *tx) |
2908 |
+ { |
2909 |
+ struct dma_slave_caps caps; |
2910 |
++ int ret; |
2911 |
+ |
2912 |
+- dma_get_slave_caps(tx->chan, &caps); |
2913 |
++ ret = dma_get_slave_caps(tx->chan, &caps); |
2914 |
++ if (ret) |
2915 |
++ return ret; |
2916 |
+ |
2917 |
+ if (caps.descriptor_reuse) { |
2918 |
+ tx->flags |= DMA_CTRL_REUSE; |
2919 |
+diff --git a/include/linux/libata.h b/include/linux/libata.h |
2920 |
+index 38c95d66ab12..aff09d0b3545 100644 |
2921 |
+--- a/include/linux/libata.h |
2922 |
++++ b/include/linux/libata.h |
2923 |
+@@ -1190,6 +1190,7 @@ extern unsigned int ata_do_dev_read_id(struct ata_device *dev, |
2924 |
+ struct ata_taskfile *tf, u16 *id); |
2925 |
+ extern void ata_qc_complete(struct ata_queued_cmd *qc); |
2926 |
+ extern int ata_qc_complete_multiple(struct ata_port *ap, u64 qc_active); |
2927 |
++extern u64 ata_qc_get_active(struct ata_port *ap); |
2928 |
+ extern void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd); |
2929 |
+ extern int ata_std_bios_param(struct scsi_device *sdev, |
2930 |
+ struct block_device *bdev, |
2931 |
+diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h |
2932 |
+index 9dfa0ae173ac..d5527e3828d1 100644 |
2933 |
+--- a/include/linux/netdevice.h |
2934 |
++++ b/include/linux/netdevice.h |
2935 |
+@@ -1619,6 +1619,8 @@ enum netdev_priv_flags { |
2936 |
+ * @perm_addr: Permanent hw address |
2937 |
+ * @addr_assign_type: Hw address assignment type |
2938 |
+ * @addr_len: Hardware address length |
2939 |
++ * @upper_level: Maximum depth level of upper devices. |
2940 |
++ * @lower_level: Maximum depth level of lower devices. |
2941 |
+ * @neigh_priv_len: Used in neigh_alloc() |
2942 |
+ * @dev_id: Used to differentiate devices that share |
2943 |
+ * the same link layer address |
2944 |
+@@ -1853,6 +1855,8 @@ struct net_device { |
2945 |
+ unsigned char perm_addr[MAX_ADDR_LEN]; |
2946 |
+ unsigned char addr_assign_type; |
2947 |
+ unsigned char addr_len; |
2948 |
++ unsigned char upper_level; |
2949 |
++ unsigned char lower_level; |
2950 |
+ unsigned short neigh_priv_len; |
2951 |
+ unsigned short dev_id; |
2952 |
+ unsigned short dev_port; |
2953 |
+diff --git a/include/linux/nvme-fc-driver.h b/include/linux/nvme-fc-driver.h |
2954 |
+index 496ff759f84c..2f3ae41c212d 100644 |
2955 |
+--- a/include/linux/nvme-fc-driver.h |
2956 |
++++ b/include/linux/nvme-fc-driver.h |
2957 |
+@@ -282,6 +282,8 @@ struct nvme_fc_remote_port { |
2958 |
+ * |
2959 |
+ * Host/Initiator Transport Entrypoints/Parameters: |
2960 |
+ * |
2961 |
++ * @module: The LLDD module using the interface |
2962 |
++ * |
2963 |
+ * @localport_delete: The LLDD initiates deletion of a localport via |
2964 |
+ * nvme_fc_deregister_localport(). However, the teardown is |
2965 |
+ * asynchronous. This routine is called upon the completion of the |
2966 |
+@@ -395,6 +397,8 @@ struct nvme_fc_remote_port { |
2967 |
+ * Value is Mandatory. Allowed to be zero. |
2968 |
+ */ |
2969 |
+ struct nvme_fc_port_template { |
2970 |
++ struct module *module; |
2971 |
++ |
2972 |
+ /* initiator-based functions */ |
2973 |
+ void (*localport_delete)(struct nvme_fc_local_port *); |
2974 |
+ void (*remoteport_delete)(struct nvme_fc_remote_port *); |
2975 |
+diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h |
2976 |
+index 6d46f962685d..06978ce01302 100644 |
2977 |
+--- a/include/linux/regulator/ab8500.h |
2978 |
++++ b/include/linux/regulator/ab8500.h |
2979 |
+@@ -38,7 +38,6 @@ enum ab8505_regulator_id { |
2980 |
+ AB8505_LDO_AUX6, |
2981 |
+ AB8505_LDO_INTCORE, |
2982 |
+ AB8505_LDO_ADC, |
2983 |
+- AB8505_LDO_USB, |
2984 |
+ AB8505_LDO_AUDIO, |
2985 |
+ AB8505_LDO_ANAMIC1, |
2986 |
+ AB8505_LDO_ANAMIC2, |
2987 |
+diff --git a/include/net/neighbour.h b/include/net/neighbour.h |
2988 |
+index c84807c1c5bd..5ce035984a4d 100644 |
2989 |
+--- a/include/net/neighbour.h |
2990 |
++++ b/include/net/neighbour.h |
2991 |
+@@ -459,7 +459,7 @@ static inline int neigh_hh_output(const struct hh_cache *hh, struct sk_buff *skb |
2992 |
+ |
2993 |
+ do { |
2994 |
+ seq = read_seqbegin(&hh->hh_lock); |
2995 |
+- hh_len = hh->hh_len; |
2996 |
++ hh_len = READ_ONCE(hh->hh_len); |
2997 |
+ if (likely(hh_len <= HH_DATA_MOD)) { |
2998 |
+ hh_alen = HH_DATA_MOD; |
2999 |
+ |
3000 |
+diff --git a/kernel/cred.c b/kernel/cred.c |
3001 |
+index 5ab1f7ec946e..a9f0f8b21d8c 100644 |
3002 |
+--- a/kernel/cred.c |
3003 |
++++ b/kernel/cred.c |
3004 |
+@@ -220,7 +220,7 @@ struct cred *cred_alloc_blank(void) |
3005 |
+ new->magic = CRED_MAGIC; |
3006 |
+ #endif |
3007 |
+ |
3008 |
+- if (security_cred_alloc_blank(new, GFP_KERNEL) < 0) |
3009 |
++ if (security_cred_alloc_blank(new, GFP_KERNEL_ACCOUNT) < 0) |
3010 |
+ goto error; |
3011 |
+ |
3012 |
+ return new; |
3013 |
+@@ -279,7 +279,7 @@ struct cred *prepare_creds(void) |
3014 |
+ new->security = NULL; |
3015 |
+ #endif |
3016 |
+ |
3017 |
+- if (security_prepare_creds(new, old, GFP_KERNEL) < 0) |
3018 |
++ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
3019 |
+ goto error; |
3020 |
+ validate_creds(new); |
3021 |
+ return new; |
3022 |
+@@ -654,7 +654,7 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon) |
3023 |
+ #ifdef CONFIG_SECURITY |
3024 |
+ new->security = NULL; |
3025 |
+ #endif |
3026 |
+- if (security_prepare_creds(new, old, GFP_KERNEL) < 0) |
3027 |
++ if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0) |
3028 |
+ goto error; |
3029 |
+ |
3030 |
+ put_cred(old); |
3031 |
+diff --git a/kernel/exit.c b/kernel/exit.c |
3032 |
+index e10de9836dd7..54c3269b8dda 100644 |
3033 |
+--- a/kernel/exit.c |
3034 |
++++ b/kernel/exit.c |
3035 |
+@@ -578,10 +578,6 @@ static struct task_struct *find_child_reaper(struct task_struct *father, |
3036 |
+ } |
3037 |
+ |
3038 |
+ write_unlock_irq(&tasklist_lock); |
3039 |
+- if (unlikely(pid_ns == &init_pid_ns)) { |
3040 |
+- panic("Attempted to kill init! exitcode=0x%08x\n", |
3041 |
+- father->signal->group_exit_code ?: father->exit_code); |
3042 |
+- } |
3043 |
+ |
3044 |
+ list_for_each_entry_safe(p, n, dead, ptrace_entry) { |
3045 |
+ list_del_init(&p->ptrace_entry); |
3046 |
+@@ -845,6 +841,14 @@ void __noreturn do_exit(long code) |
3047 |
+ acct_update_integrals(tsk); |
3048 |
+ group_dead = atomic_dec_and_test(&tsk->signal->live); |
3049 |
+ if (group_dead) { |
3050 |
++ /* |
3051 |
++ * If the last thread of global init has exited, panic |
3052 |
++ * immediately to get a useable coredump. |
3053 |
++ */ |
3054 |
++ if (unlikely(is_global_init(tsk))) |
3055 |
++ panic("Attempted to kill init! exitcode=0x%08x\n", |
3056 |
++ tsk->signal->group_exit_code ?: (int)code); |
3057 |
++ |
3058 |
+ #ifdef CONFIG_POSIX_TIMERS |
3059 |
+ hrtimer_cancel(&tsk->signal->real_timer); |
3060 |
+ exit_itimers(tsk->signal); |
3061 |
+diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c |
3062 |
+index 3d37c279c090..f2635fc751d9 100644 |
3063 |
+--- a/kernel/power/snapshot.c |
3064 |
++++ b/kernel/power/snapshot.c |
3065 |
+@@ -736,8 +736,15 @@ zone_found: |
3066 |
+ * We have found the zone. Now walk the radix tree to find the leaf node |
3067 |
+ * for our PFN. |
3068 |
+ */ |
3069 |
++ |
3070 |
++ /* |
3071 |
++ * If the zone we wish to scan is the the current zone and the |
3072 |
++ * pfn falls into the current node then we do not need to walk |
3073 |
++ * the tree. |
3074 |
++ */ |
3075 |
+ node = bm->cur.node; |
3076 |
+- if (((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) |
3077 |
++ if (zone == bm->cur.zone && |
3078 |
++ ((pfn - zone->start_pfn) & ~BM_BLOCK_MASK) == bm->cur.node_pfn) |
3079 |
+ goto node_found; |
3080 |
+ |
3081 |
+ node = zone->rtree; |
3082 |
+diff --git a/kernel/taskstats.c b/kernel/taskstats.c |
3083 |
+index 4e62a4a8fa91..82393952683c 100644 |
3084 |
+--- a/kernel/taskstats.c |
3085 |
++++ b/kernel/taskstats.c |
3086 |
+@@ -564,25 +564,33 @@ static int taskstats_user_cmd(struct sk_buff *skb, struct genl_info *info) |
3087 |
+ static struct taskstats *taskstats_tgid_alloc(struct task_struct *tsk) |
3088 |
+ { |
3089 |
+ struct signal_struct *sig = tsk->signal; |
3090 |
+- struct taskstats *stats; |
3091 |
++ struct taskstats *stats_new, *stats; |
3092 |
+ |
3093 |
+- if (sig->stats || thread_group_empty(tsk)) |
3094 |
+- goto ret; |
3095 |
++ /* Pairs with smp_store_release() below. */ |
3096 |
++ stats = smp_load_acquire(&sig->stats); |
3097 |
++ if (stats || thread_group_empty(tsk)) |
3098 |
++ return stats; |
3099 |
+ |
3100 |
+ /* No problem if kmem_cache_zalloc() fails */ |
3101 |
+- stats = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); |
3102 |
++ stats_new = kmem_cache_zalloc(taskstats_cache, GFP_KERNEL); |
3103 |
+ |
3104 |
+ spin_lock_irq(&tsk->sighand->siglock); |
3105 |
+- if (!sig->stats) { |
3106 |
+- sig->stats = stats; |
3107 |
+- stats = NULL; |
3108 |
++ stats = sig->stats; |
3109 |
++ if (!stats) { |
3110 |
++ /* |
3111 |
++ * Pairs with smp_store_release() above and order the |
3112 |
++ * kmem_cache_zalloc(). |
3113 |
++ */ |
3114 |
++ smp_store_release(&sig->stats, stats_new); |
3115 |
++ stats = stats_new; |
3116 |
++ stats_new = NULL; |
3117 |
+ } |
3118 |
+ spin_unlock_irq(&tsk->sighand->siglock); |
3119 |
+ |
3120 |
+- if (stats) |
3121 |
+- kmem_cache_free(taskstats_cache, stats); |
3122 |
+-ret: |
3123 |
+- return sig->stats; |
3124 |
++ if (stats_new) |
3125 |
++ kmem_cache_free(taskstats_cache, stats_new); |
3126 |
++ |
3127 |
++ return stats; |
3128 |
+ } |
3129 |
+ |
3130 |
+ /* Send pid data out on exit */ |
3131 |
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c |
3132 |
+index b84eb9659e95..37a435bac161 100644 |
3133 |
+--- a/kernel/trace/ftrace.c |
3134 |
++++ b/kernel/trace/ftrace.c |
3135 |
+@@ -554,8 +554,7 @@ static int function_stat_show(struct seq_file *m, void *v) |
3136 |
+ } |
3137 |
+ |
3138 |
+ #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
3139 |
+- avg = rec->time; |
3140 |
+- do_div(avg, rec->counter); |
3141 |
++ avg = div64_ul(rec->time, rec->counter); |
3142 |
+ if (tracing_thresh && (avg < tracing_thresh)) |
3143 |
+ goto out; |
3144 |
+ #endif |
3145 |
+@@ -581,7 +580,8 @@ static int function_stat_show(struct seq_file *m, void *v) |
3146 |
+ * Divide only 1000 for ns^2 -> us^2 conversion. |
3147 |
+ * trace_print_graph_duration will divide 1000 again. |
3148 |
+ */ |
3149 |
+- do_div(stddev, rec->counter * (rec->counter - 1) * 1000); |
3150 |
++ stddev = div64_ul(stddev, |
3151 |
++ rec->counter * (rec->counter - 1) * 1000); |
3152 |
+ } |
3153 |
+ |
3154 |
+ trace_seq_init(&s); |
3155 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
3156 |
+index b6ff2f84df17..e61aa1c68e99 100644 |
3157 |
+--- a/kernel/trace/trace.c |
3158 |
++++ b/kernel/trace/trace.c |
3159 |
+@@ -4370,6 +4370,10 @@ int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set) |
3160 |
+ |
3161 |
+ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled) |
3162 |
+ { |
3163 |
++ if ((mask == TRACE_ITER_RECORD_TGID) || |
3164 |
++ (mask == TRACE_ITER_RECORD_CMD)) |
3165 |
++ lockdep_assert_held(&event_mutex); |
3166 |
++ |
3167 |
+ /* do nothing if flag is already set */ |
3168 |
+ if (!!(tr->trace_flags & mask) == !!enabled) |
3169 |
+ return 0; |
3170 |
+@@ -4435,6 +4439,7 @@ static int trace_set_options(struct trace_array *tr, char *option) |
3171 |
+ cmp += 2; |
3172 |
+ } |
3173 |
+ |
3174 |
++ mutex_lock(&event_mutex); |
3175 |
+ mutex_lock(&trace_types_lock); |
3176 |
+ |
3177 |
+ ret = match_string(trace_options, -1, cmp); |
3178 |
+@@ -4445,6 +4450,7 @@ static int trace_set_options(struct trace_array *tr, char *option) |
3179 |
+ ret = set_tracer_flag(tr, 1 << ret, !neg); |
3180 |
+ |
3181 |
+ mutex_unlock(&trace_types_lock); |
3182 |
++ mutex_unlock(&event_mutex); |
3183 |
+ |
3184 |
+ /* |
3185 |
+ * If the first trailing whitespace is replaced with '\0' by strstrip, |
3186 |
+@@ -7457,9 +7463,11 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt, |
3187 |
+ if (val != 0 && val != 1) |
3188 |
+ return -EINVAL; |
3189 |
+ |
3190 |
++ mutex_lock(&event_mutex); |
3191 |
+ mutex_lock(&trace_types_lock); |
3192 |
+ ret = set_tracer_flag(tr, 1 << index, val); |
3193 |
+ mutex_unlock(&trace_types_lock); |
3194 |
++ mutex_unlock(&event_mutex); |
3195 |
+ |
3196 |
+ if (ret < 0) |
3197 |
+ return ret; |
3198 |
+diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c |
3199 |
+index 017f737237e6..ec340e1cbffc 100644 |
3200 |
+--- a/kernel/trace/trace_events.c |
3201 |
++++ b/kernel/trace/trace_events.c |
3202 |
+@@ -327,7 +327,8 @@ void trace_event_enable_cmd_record(bool enable) |
3203 |
+ struct trace_event_file *file; |
3204 |
+ struct trace_array *tr; |
3205 |
+ |
3206 |
+- mutex_lock(&event_mutex); |
3207 |
++ lockdep_assert_held(&event_mutex); |
3208 |
++ |
3209 |
+ do_for_each_event_file(tr, file) { |
3210 |
+ |
3211 |
+ if (!(file->flags & EVENT_FILE_FL_ENABLED)) |
3212 |
+@@ -341,7 +342,6 @@ void trace_event_enable_cmd_record(bool enable) |
3213 |
+ clear_bit(EVENT_FILE_FL_RECORDED_CMD_BIT, &file->flags); |
3214 |
+ } |
3215 |
+ } while_for_each_event_file(); |
3216 |
+- mutex_unlock(&event_mutex); |
3217 |
+ } |
3218 |
+ |
3219 |
+ void trace_event_enable_tgid_record(bool enable) |
3220 |
+@@ -349,7 +349,8 @@ void trace_event_enable_tgid_record(bool enable) |
3221 |
+ struct trace_event_file *file; |
3222 |
+ struct trace_array *tr; |
3223 |
+ |
3224 |
+- mutex_lock(&event_mutex); |
3225 |
++ lockdep_assert_held(&event_mutex); |
3226 |
++ |
3227 |
+ do_for_each_event_file(tr, file) { |
3228 |
+ if (!(file->flags & EVENT_FILE_FL_ENABLED)) |
3229 |
+ continue; |
3230 |
+@@ -363,7 +364,6 @@ void trace_event_enable_tgid_record(bool enable) |
3231 |
+ &file->flags); |
3232 |
+ } |
3233 |
+ } while_for_each_event_file(); |
3234 |
+- mutex_unlock(&event_mutex); |
3235 |
+ } |
3236 |
+ |
3237 |
+ static int __ftrace_event_enable_disable(struct trace_event_file *file, |
3238 |
+diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c |
3239 |
+index 2fb78467582b..b949c3917c67 100644 |
3240 |
+--- a/kernel/trace/trace_events_filter.c |
3241 |
++++ b/kernel/trace/trace_events_filter.c |
3242 |
+@@ -1642,7 +1642,7 @@ static int process_system_preds(struct trace_subsystem_dir *dir, |
3243 |
+ parse_error(pe, FILT_ERR_BAD_SUBSYS_FILTER, 0); |
3244 |
+ return -EINVAL; |
3245 |
+ fail_mem: |
3246 |
+- kfree(filter); |
3247 |
++ __free_filter(filter); |
3248 |
+ /* If any call succeeded, we still need to sync */ |
3249 |
+ if (!fail) |
3250 |
+ tracepoint_synchronize_unregister(); |
3251 |
+diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c |
3252 |
+index 11d952650fa7..0fb92d0c7b20 100644 |
3253 |
+--- a/kernel/trace/trace_events_hist.c |
3254 |
++++ b/kernel/trace/trace_events_hist.c |
3255 |
+@@ -665,7 +665,26 @@ static notrace void trace_event_raw_event_synth(void *__data, |
3256 |
+ strscpy(str_field, str_val, STR_VAR_LEN_MAX); |
3257 |
+ n_u64 += STR_VAR_LEN_MAX / sizeof(u64); |
3258 |
+ } else { |
3259 |
+- entry->fields[n_u64] = var_ref_vals[var_ref_idx + i]; |
3260 |
++ struct synth_field *field = event->fields[i]; |
3261 |
++ u64 val = var_ref_vals[var_ref_idx + i]; |
3262 |
++ |
3263 |
++ switch (field->size) { |
3264 |
++ case 1: |
3265 |
++ *(u8 *)&entry->fields[n_u64] = (u8)val; |
3266 |
++ break; |
3267 |
++ |
3268 |
++ case 2: |
3269 |
++ *(u16 *)&entry->fields[n_u64] = (u16)val; |
3270 |
++ break; |
3271 |
++ |
3272 |
++ case 4: |
3273 |
++ *(u32 *)&entry->fields[n_u64] = (u32)val; |
3274 |
++ break; |
3275 |
++ |
3276 |
++ default: |
3277 |
++ entry->fields[n_u64] = val; |
3278 |
++ break; |
3279 |
++ } |
3280 |
+ n_u64++; |
3281 |
+ } |
3282 |
+ } |
3283 |
+diff --git a/kernel/trace/tracing_map.c b/kernel/trace/tracing_map.c |
3284 |
+index 9a1c22310323..9e31bfc818ff 100644 |
3285 |
+--- a/kernel/trace/tracing_map.c |
3286 |
++++ b/kernel/trace/tracing_map.c |
3287 |
+@@ -148,8 +148,8 @@ static int tracing_map_cmp_atomic64(void *val_a, void *val_b) |
3288 |
+ #define DEFINE_TRACING_MAP_CMP_FN(type) \ |
3289 |
+ static int tracing_map_cmp_##type(void *val_a, void *val_b) \ |
3290 |
+ { \ |
3291 |
+- type a = *(type *)val_a; \ |
3292 |
+- type b = *(type *)val_b; \ |
3293 |
++ type a = (type)(*(u64 *)val_a); \ |
3294 |
++ type b = (type)(*(u64 *)val_b); \ |
3295 |
+ \ |
3296 |
+ return (a > b) ? 1 : ((a < b) ? -1 : 0); \ |
3297 |
+ } |
3298 |
+diff --git a/mm/migrate.c b/mm/migrate.c |
3299 |
+index 4d3588c01203..593557c107d2 100644 |
3300 |
+--- a/mm/migrate.c |
3301 |
++++ b/mm/migrate.c |
3302 |
+@@ -1508,9 +1508,11 @@ static int do_move_pages_to_node(struct mm_struct *mm, |
3303 |
+ /* |
3304 |
+ * Resolves the given address to a struct page, isolates it from the LRU and |
3305 |
+ * puts it to the given pagelist. |
3306 |
+- * Returns -errno if the page cannot be found/isolated or 0 when it has been |
3307 |
+- * queued or the page doesn't need to be migrated because it is already on |
3308 |
+- * the target node |
3309 |
++ * Returns: |
3310 |
++ * errno - if the page cannot be found/isolated |
3311 |
++ * 0 - when it doesn't have to be migrated because it is already on the |
3312 |
++ * target node |
3313 |
++ * 1 - when it has been queued |
3314 |
+ */ |
3315 |
+ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, |
3316 |
+ int node, struct list_head *pagelist, bool migrate_all) |
3317 |
+@@ -1549,7 +1551,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, |
3318 |
+ if (PageHuge(page)) { |
3319 |
+ if (PageHead(page)) { |
3320 |
+ isolate_huge_page(page, pagelist); |
3321 |
+- err = 0; |
3322 |
++ err = 1; |
3323 |
+ } |
3324 |
+ } else { |
3325 |
+ struct page *head; |
3326 |
+@@ -1559,7 +1561,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, |
3327 |
+ if (err) |
3328 |
+ goto out_putpage; |
3329 |
+ |
3330 |
+- err = 0; |
3331 |
++ err = 1; |
3332 |
+ list_add_tail(&head->lru, pagelist); |
3333 |
+ mod_node_page_state(page_pgdat(head), |
3334 |
+ NR_ISOLATED_ANON + page_is_file_cache(head), |
3335 |
+@@ -1636,8 +1638,17 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, |
3336 |
+ */ |
3337 |
+ err = add_page_for_migration(mm, addr, current_node, |
3338 |
+ &pagelist, flags & MPOL_MF_MOVE_ALL); |
3339 |
+- if (!err) |
3340 |
++ |
3341 |
++ if (!err) { |
3342 |
++ /* The page is already on the target node */ |
3343 |
++ err = store_status(status, i, current_node, 1); |
3344 |
++ if (err) |
3345 |
++ goto out_flush; |
3346 |
+ continue; |
3347 |
++ } else if (err > 0) { |
3348 |
++ /* The page is successfully queued for migration */ |
3349 |
++ continue; |
3350 |
++ } |
3351 |
+ |
3352 |
+ err = store_status(status, i, err, 1); |
3353 |
+ if (err) |
3354 |
+diff --git a/mm/mmap.c b/mm/mmap.c |
3355 |
+index 1480880ff814..a98f09b83019 100644 |
3356 |
+--- a/mm/mmap.c |
3357 |
++++ b/mm/mmap.c |
3358 |
+@@ -89,12 +89,6 @@ static void unmap_region(struct mm_struct *mm, |
3359 |
+ * MAP_PRIVATE r: (no) no r: (yes) yes r: (no) yes r: (no) yes |
3360 |
+ * w: (no) no w: (no) no w: (copy) copy w: (no) no |
3361 |
+ * x: (no) no x: (no) yes x: (no) yes x: (yes) yes |
3362 |
+- * |
3363 |
+- * On arm64, PROT_EXEC has the following behaviour for both MAP_SHARED and |
3364 |
+- * MAP_PRIVATE: |
3365 |
+- * r: (no) no |
3366 |
+- * w: (no) no |
3367 |
+- * x: (yes) yes |
3368 |
+ */ |
3369 |
+ pgprot_t protection_map[16] __ro_after_init = { |
3370 |
+ __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, |
3371 |
+diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c |
3372 |
+index 4b9063d12b93..85cc29c93d93 100644 |
3373 |
+--- a/mm/zsmalloc.c |
3374 |
++++ b/mm/zsmalloc.c |
3375 |
+@@ -2092,6 +2092,11 @@ static int zs_page_migrate(struct address_space *mapping, struct page *newpage, |
3376 |
+ zs_pool_dec_isolated(pool); |
3377 |
+ } |
3378 |
+ |
3379 |
++ if (page_zone(newpage) != page_zone(page)) { |
3380 |
++ dec_zone_page_state(page, NR_ZSPAGES); |
3381 |
++ inc_zone_page_state(newpage, NR_ZSPAGES); |
3382 |
++ } |
3383 |
++ |
3384 |
+ reset_page(page); |
3385 |
+ put_page(page); |
3386 |
+ page = newpage; |
3387 |
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c |
3388 |
+index f5c27065ad44..db735d0d931e 100644 |
3389 |
+--- a/net/bluetooth/hci_conn.c |
3390 |
++++ b/net/bluetooth/hci_conn.c |
3391 |
+@@ -1173,8 +1173,10 @@ struct hci_conn *hci_connect_le_scan(struct hci_dev *hdev, bdaddr_t *dst, |
3392 |
+ if (!conn) |
3393 |
+ return ERR_PTR(-ENOMEM); |
3394 |
+ |
3395 |
+- if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) |
3396 |
++ if (hci_explicit_conn_params_set(hdev, dst, dst_type) < 0) { |
3397 |
++ hci_conn_del(conn); |
3398 |
+ return ERR_PTR(-EBUSY); |
3399 |
++ } |
3400 |
+ |
3401 |
+ conn->state = BT_CONNECT; |
3402 |
+ set_bit(HCI_CONN_SCANNING, &conn->flags); |
3403 |
+diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c |
3404 |
+index 974c1b8a689c..0d84d1f820d4 100644 |
3405 |
+--- a/net/bluetooth/l2cap_core.c |
3406 |
++++ b/net/bluetooth/l2cap_core.c |
3407 |
+@@ -4918,10 +4918,8 @@ void __l2cap_physical_cfm(struct l2cap_chan *chan, int result) |
3408 |
+ BT_DBG("chan %p, result %d, local_amp_id %d, remote_amp_id %d", |
3409 |
+ chan, result, local_amp_id, remote_amp_id); |
3410 |
+ |
3411 |
+- if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) { |
3412 |
+- l2cap_chan_unlock(chan); |
3413 |
++ if (chan->state == BT_DISCONN || chan->state == BT_CLOSED) |
3414 |
+ return; |
3415 |
+- } |
3416 |
+ |
3417 |
+ if (chan->state != BT_CONNECTED) { |
3418 |
+ l2cap_do_create(chan, result, local_amp_id, remote_amp_id); |
3419 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
3420 |
+index 8ff21d461f08..a26d87073f71 100644 |
3421 |
+--- a/net/core/dev.c |
3422 |
++++ b/net/core/dev.c |
3423 |
+@@ -149,6 +149,7 @@ |
3424 |
+ #include "net-sysfs.h" |
3425 |
+ |
3426 |
+ #define MAX_GRO_SKBS 8 |
3427 |
++#define MAX_NEST_DEV 8 |
3428 |
+ |
3429 |
+ /* This should be increased if a protocol with a bigger head is added. */ |
3430 |
+ #define GRO_MAX_HEAD (MAX_HEADER + 128) |
3431 |
+@@ -6542,6 +6543,21 @@ struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev, |
3432 |
+ } |
3433 |
+ EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu); |
3434 |
+ |
3435 |
++static struct net_device *netdev_next_upper_dev(struct net_device *dev, |
3436 |
++ struct list_head **iter) |
3437 |
++{ |
3438 |
++ struct netdev_adjacent *upper; |
3439 |
++ |
3440 |
++ upper = list_entry((*iter)->next, struct netdev_adjacent, list); |
3441 |
++ |
3442 |
++ if (&upper->list == &dev->adj_list.upper) |
3443 |
++ return NULL; |
3444 |
++ |
3445 |
++ *iter = &upper->list; |
3446 |
++ |
3447 |
++ return upper->dev; |
3448 |
++} |
3449 |
++ |
3450 |
+ static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev, |
3451 |
+ struct list_head **iter) |
3452 |
+ { |
3453 |
+@@ -6559,28 +6575,93 @@ static struct net_device *netdev_next_upper_dev_rcu(struct net_device *dev, |
3454 |
+ return upper->dev; |
3455 |
+ } |
3456 |
+ |
3457 |
++static int netdev_walk_all_upper_dev(struct net_device *dev, |
3458 |
++ int (*fn)(struct net_device *dev, |
3459 |
++ void *data), |
3460 |
++ void *data) |
3461 |
++{ |
3462 |
++ struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; |
3463 |
++ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; |
3464 |
++ int ret, cur = 0; |
3465 |
++ |
3466 |
++ now = dev; |
3467 |
++ iter = &dev->adj_list.upper; |
3468 |
++ |
3469 |
++ while (1) { |
3470 |
++ if (now != dev) { |
3471 |
++ ret = fn(now, data); |
3472 |
++ if (ret) |
3473 |
++ return ret; |
3474 |
++ } |
3475 |
++ |
3476 |
++ next = NULL; |
3477 |
++ while (1) { |
3478 |
++ udev = netdev_next_upper_dev(now, &iter); |
3479 |
++ if (!udev) |
3480 |
++ break; |
3481 |
++ |
3482 |
++ next = udev; |
3483 |
++ niter = &udev->adj_list.upper; |
3484 |
++ dev_stack[cur] = now; |
3485 |
++ iter_stack[cur++] = iter; |
3486 |
++ break; |
3487 |
++ } |
3488 |
++ |
3489 |
++ if (!next) { |
3490 |
++ if (!cur) |
3491 |
++ return 0; |
3492 |
++ next = dev_stack[--cur]; |
3493 |
++ niter = iter_stack[cur]; |
3494 |
++ } |
3495 |
++ |
3496 |
++ now = next; |
3497 |
++ iter = niter; |
3498 |
++ } |
3499 |
++ |
3500 |
++ return 0; |
3501 |
++} |
3502 |
++ |
3503 |
+ int netdev_walk_all_upper_dev_rcu(struct net_device *dev, |
3504 |
+ int (*fn)(struct net_device *dev, |
3505 |
+ void *data), |
3506 |
+ void *data) |
3507 |
+ { |
3508 |
+- struct net_device *udev; |
3509 |
+- struct list_head *iter; |
3510 |
+- int ret; |
3511 |
++ struct net_device *udev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; |
3512 |
++ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; |
3513 |
++ int ret, cur = 0; |
3514 |
+ |
3515 |
+- for (iter = &dev->adj_list.upper, |
3516 |
+- udev = netdev_next_upper_dev_rcu(dev, &iter); |
3517 |
+- udev; |
3518 |
+- udev = netdev_next_upper_dev_rcu(dev, &iter)) { |
3519 |
+- /* first is the upper device itself */ |
3520 |
+- ret = fn(udev, data); |
3521 |
+- if (ret) |
3522 |
+- return ret; |
3523 |
++ now = dev; |
3524 |
++ iter = &dev->adj_list.upper; |
3525 |
+ |
3526 |
+- /* then look at all of its upper devices */ |
3527 |
+- ret = netdev_walk_all_upper_dev_rcu(udev, fn, data); |
3528 |
+- if (ret) |
3529 |
+- return ret; |
3530 |
++ while (1) { |
3531 |
++ if (now != dev) { |
3532 |
++ ret = fn(now, data); |
3533 |
++ if (ret) |
3534 |
++ return ret; |
3535 |
++ } |
3536 |
++ |
3537 |
++ next = NULL; |
3538 |
++ while (1) { |
3539 |
++ udev = netdev_next_upper_dev_rcu(now, &iter); |
3540 |
++ if (!udev) |
3541 |
++ break; |
3542 |
++ |
3543 |
++ next = udev; |
3544 |
++ niter = &udev->adj_list.upper; |
3545 |
++ dev_stack[cur] = now; |
3546 |
++ iter_stack[cur++] = iter; |
3547 |
++ break; |
3548 |
++ } |
3549 |
++ |
3550 |
++ if (!next) { |
3551 |
++ if (!cur) |
3552 |
++ return 0; |
3553 |
++ next = dev_stack[--cur]; |
3554 |
++ niter = iter_stack[cur]; |
3555 |
++ } |
3556 |
++ |
3557 |
++ now = next; |
3558 |
++ iter = niter; |
3559 |
+ } |
3560 |
+ |
3561 |
+ return 0; |
3562 |
+@@ -6688,23 +6769,42 @@ int netdev_walk_all_lower_dev(struct net_device *dev, |
3563 |
+ void *data), |
3564 |
+ void *data) |
3565 |
+ { |
3566 |
+- struct net_device *ldev; |
3567 |
+- struct list_head *iter; |
3568 |
+- int ret; |
3569 |
++ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; |
3570 |
++ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; |
3571 |
++ int ret, cur = 0; |
3572 |
+ |
3573 |
+- for (iter = &dev->adj_list.lower, |
3574 |
+- ldev = netdev_next_lower_dev(dev, &iter); |
3575 |
+- ldev; |
3576 |
+- ldev = netdev_next_lower_dev(dev, &iter)) { |
3577 |
+- /* first is the lower device itself */ |
3578 |
+- ret = fn(ldev, data); |
3579 |
+- if (ret) |
3580 |
+- return ret; |
3581 |
++ now = dev; |
3582 |
++ iter = &dev->adj_list.lower; |
3583 |
+ |
3584 |
+- /* then look at all of its lower devices */ |
3585 |
+- ret = netdev_walk_all_lower_dev(ldev, fn, data); |
3586 |
+- if (ret) |
3587 |
+- return ret; |
3588 |
++ while (1) { |
3589 |
++ if (now != dev) { |
3590 |
++ ret = fn(now, data); |
3591 |
++ if (ret) |
3592 |
++ return ret; |
3593 |
++ } |
3594 |
++ |
3595 |
++ next = NULL; |
3596 |
++ while (1) { |
3597 |
++ ldev = netdev_next_lower_dev(now, &iter); |
3598 |
++ if (!ldev) |
3599 |
++ break; |
3600 |
++ |
3601 |
++ next = ldev; |
3602 |
++ niter = &ldev->adj_list.lower; |
3603 |
++ dev_stack[cur] = now; |
3604 |
++ iter_stack[cur++] = iter; |
3605 |
++ break; |
3606 |
++ } |
3607 |
++ |
3608 |
++ if (!next) { |
3609 |
++ if (!cur) |
3610 |
++ return 0; |
3611 |
++ next = dev_stack[--cur]; |
3612 |
++ niter = iter_stack[cur]; |
3613 |
++ } |
3614 |
++ |
3615 |
++ now = next; |
3616 |
++ iter = niter; |
3617 |
+ } |
3618 |
+ |
3619 |
+ return 0; |
3620 |
+@@ -6725,28 +6825,93 @@ static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev, |
3621 |
+ return lower->dev; |
3622 |
+ } |
3623 |
+ |
3624 |
+-int netdev_walk_all_lower_dev_rcu(struct net_device *dev, |
3625 |
+- int (*fn)(struct net_device *dev, |
3626 |
+- void *data), |
3627 |
+- void *data) |
3628 |
++static u8 __netdev_upper_depth(struct net_device *dev) |
3629 |
++{ |
3630 |
++ struct net_device *udev; |
3631 |
++ struct list_head *iter; |
3632 |
++ u8 max_depth = 0; |
3633 |
++ |
3634 |
++ for (iter = &dev->adj_list.upper, |
3635 |
++ udev = netdev_next_upper_dev(dev, &iter); |
3636 |
++ udev; |
3637 |
++ udev = netdev_next_upper_dev(dev, &iter)) { |
3638 |
++ if (max_depth < udev->upper_level) |
3639 |
++ max_depth = udev->upper_level; |
3640 |
++ } |
3641 |
++ |
3642 |
++ return max_depth; |
3643 |
++} |
3644 |
++ |
3645 |
++static u8 __netdev_lower_depth(struct net_device *dev) |
3646 |
+ { |
3647 |
+ struct net_device *ldev; |
3648 |
+ struct list_head *iter; |
3649 |
+- int ret; |
3650 |
++ u8 max_depth = 0; |
3651 |
+ |
3652 |
+ for (iter = &dev->adj_list.lower, |
3653 |
+- ldev = netdev_next_lower_dev_rcu(dev, &iter); |
3654 |
++ ldev = netdev_next_lower_dev(dev, &iter); |
3655 |
+ ldev; |
3656 |
+- ldev = netdev_next_lower_dev_rcu(dev, &iter)) { |
3657 |
+- /* first is the lower device itself */ |
3658 |
+- ret = fn(ldev, data); |
3659 |
+- if (ret) |
3660 |
+- return ret; |
3661 |
++ ldev = netdev_next_lower_dev(dev, &iter)) { |
3662 |
++ if (max_depth < ldev->lower_level) |
3663 |
++ max_depth = ldev->lower_level; |
3664 |
++ } |
3665 |
+ |
3666 |
+- /* then look at all of its lower devices */ |
3667 |
+- ret = netdev_walk_all_lower_dev_rcu(ldev, fn, data); |
3668 |
+- if (ret) |
3669 |
+- return ret; |
3670 |
++ return max_depth; |
3671 |
++} |
3672 |
++ |
3673 |
++static int __netdev_update_upper_level(struct net_device *dev, void *data) |
3674 |
++{ |
3675 |
++ dev->upper_level = __netdev_upper_depth(dev) + 1; |
3676 |
++ return 0; |
3677 |
++} |
3678 |
++ |
3679 |
++static int __netdev_update_lower_level(struct net_device *dev, void *data) |
3680 |
++{ |
3681 |
++ dev->lower_level = __netdev_lower_depth(dev) + 1; |
3682 |
++ return 0; |
3683 |
++} |
3684 |
++ |
3685 |
++int netdev_walk_all_lower_dev_rcu(struct net_device *dev, |
3686 |
++ int (*fn)(struct net_device *dev, |
3687 |
++ void *data), |
3688 |
++ void *data) |
3689 |
++{ |
3690 |
++ struct net_device *ldev, *next, *now, *dev_stack[MAX_NEST_DEV + 1]; |
3691 |
++ struct list_head *niter, *iter, *iter_stack[MAX_NEST_DEV + 1]; |
3692 |
++ int ret, cur = 0; |
3693 |
++ |
3694 |
++ now = dev; |
3695 |
++ iter = &dev->adj_list.lower; |
3696 |
++ |
3697 |
++ while (1) { |
3698 |
++ if (now != dev) { |
3699 |
++ ret = fn(now, data); |
3700 |
++ if (ret) |
3701 |
++ return ret; |
3702 |
++ } |
3703 |
++ |
3704 |
++ next = NULL; |
3705 |
++ while (1) { |
3706 |
++ ldev = netdev_next_lower_dev_rcu(now, &iter); |
3707 |
++ if (!ldev) |
3708 |
++ break; |
3709 |
++ |
3710 |
++ next = ldev; |
3711 |
++ niter = &ldev->adj_list.lower; |
3712 |
++ dev_stack[cur] = now; |
3713 |
++ iter_stack[cur++] = iter; |
3714 |
++ break; |
3715 |
++ } |
3716 |
++ |
3717 |
++ if (!next) { |
3718 |
++ if (!cur) |
3719 |
++ return 0; |
3720 |
++ next = dev_stack[--cur]; |
3721 |
++ niter = iter_stack[cur]; |
3722 |
++ } |
3723 |
++ |
3724 |
++ now = next; |
3725 |
++ iter = niter; |
3726 |
+ } |
3727 |
+ |
3728 |
+ return 0; |
3729 |
+@@ -7003,6 +7168,9 @@ static int __netdev_upper_dev_link(struct net_device *dev, |
3730 |
+ if (netdev_has_upper_dev(upper_dev, dev)) |
3731 |
+ return -EBUSY; |
3732 |
+ |
3733 |
++ if ((dev->lower_level + upper_dev->upper_level) > MAX_NEST_DEV) |
3734 |
++ return -EMLINK; |
3735 |
++ |
3736 |
+ if (!master) { |
3737 |
+ if (netdev_has_upper_dev(dev, upper_dev)) |
3738 |
+ return -EEXIST; |
3739 |
+@@ -7029,6 +7197,12 @@ static int __netdev_upper_dev_link(struct net_device *dev, |
3740 |
+ if (ret) |
3741 |
+ goto rollback; |
3742 |
+ |
3743 |
++ __netdev_update_upper_level(dev, NULL); |
3744 |
++ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL); |
3745 |
++ |
3746 |
++ __netdev_update_lower_level(upper_dev, NULL); |
3747 |
++ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL); |
3748 |
++ |
3749 |
+ return 0; |
3750 |
+ |
3751 |
+ rollback: |
3752 |
+@@ -7111,6 +7285,12 @@ void netdev_upper_dev_unlink(struct net_device *dev, |
3753 |
+ |
3754 |
+ call_netdevice_notifiers_info(NETDEV_CHANGEUPPER, |
3755 |
+ &changeupper_info.info); |
3756 |
++ |
3757 |
++ __netdev_update_upper_level(dev, NULL); |
3758 |
++ netdev_walk_all_lower_dev(dev, __netdev_update_upper_level, NULL); |
3759 |
++ |
3760 |
++ __netdev_update_lower_level(upper_dev, NULL); |
3761 |
++ netdev_walk_all_upper_dev(upper_dev, __netdev_update_lower_level, NULL); |
3762 |
+ } |
3763 |
+ EXPORT_SYMBOL(netdev_upper_dev_unlink); |
3764 |
+ |
3765 |
+@@ -8978,6 +9158,8 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name, |
3766 |
+ |
3767 |
+ dev->gso_max_size = GSO_MAX_SIZE; |
3768 |
+ dev->gso_max_segs = GSO_MAX_SEGS; |
3769 |
++ dev->upper_level = 1; |
3770 |
++ dev->lower_level = 1; |
3771 |
+ |
3772 |
+ INIT_LIST_HEAD(&dev->napi_list); |
3773 |
+ INIT_LIST_HEAD(&dev->unreg_list); |
3774 |
+diff --git a/net/core/neighbour.c b/net/core/neighbour.c |
3775 |
+index 7597afee7068..e260d44ebdca 100644 |
3776 |
+--- a/net/core/neighbour.c |
3777 |
++++ b/net/core/neighbour.c |
3778 |
+@@ -1097,7 +1097,7 @@ static void neigh_update_hhs(struct neighbour *neigh) |
3779 |
+ |
3780 |
+ if (update) { |
3781 |
+ hh = &neigh->hh; |
3782 |
+- if (hh->hh_len) { |
3783 |
++ if (READ_ONCE(hh->hh_len)) { |
3784 |
+ write_seqlock_bh(&hh->hh_lock); |
3785 |
+ update(hh, neigh->dev, neigh->ha); |
3786 |
+ write_sequnlock_bh(&hh->hh_lock); |
3787 |
+@@ -1360,7 +1360,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb) |
3788 |
+ struct net_device *dev = neigh->dev; |
3789 |
+ unsigned int seq; |
3790 |
+ |
3791 |
+- if (dev->header_ops->cache && !neigh->hh.hh_len) |
3792 |
++ if (dev->header_ops->cache && !READ_ONCE(neigh->hh.hh_len)) |
3793 |
+ neigh_hh_init(neigh); |
3794 |
+ |
3795 |
+ do { |
3796 |
+diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c |
3797 |
+index fd8faa0dfa61..ca06e9a53d15 100644 |
3798 |
+--- a/net/ethernet/eth.c |
3799 |
++++ b/net/ethernet/eth.c |
3800 |
+@@ -239,7 +239,12 @@ int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 |
3801 |
+ eth->h_proto = type; |
3802 |
+ memcpy(eth->h_source, dev->dev_addr, ETH_ALEN); |
3803 |
+ memcpy(eth->h_dest, neigh->ha, ETH_ALEN); |
3804 |
+- hh->hh_len = ETH_HLEN; |
3805 |
++ |
3806 |
++ /* Pairs with READ_ONCE() in neigh_resolve_output(), |
3807 |
++ * neigh_hh_output() and neigh_update_hhs(). |
3808 |
++ */ |
3809 |
++ smp_store_release(&hh->hh_len, ETH_HLEN); |
3810 |
++ |
3811 |
+ return 0; |
3812 |
+ } |
3813 |
+ EXPORT_SYMBOL(eth_header_cache); |
3814 |
+diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c |
3815 |
+index a7a804bece7a..7561fa1bcc3e 100644 |
3816 |
+--- a/net/ipv4/tcp.c |
3817 |
++++ b/net/ipv4/tcp.c |
3818 |
+@@ -488,7 +488,7 @@ static void tcp_tx_timestamp(struct sock *sk, u16 tsflags) |
3819 |
+ static inline bool tcp_stream_is_readable(const struct tcp_sock *tp, |
3820 |
+ int target, struct sock *sk) |
3821 |
+ { |
3822 |
+- return (tp->rcv_nxt - tp->copied_seq >= target) || |
3823 |
++ return (READ_ONCE(tp->rcv_nxt) - tp->copied_seq >= target) || |
3824 |
+ (sk->sk_prot->stream_memory_read ? |
3825 |
+ sk->sk_prot->stream_memory_read(sk) : false); |
3826 |
+ } |
3827 |
+@@ -2866,7 +2866,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level, |
3828 |
+ else if (tp->repair_queue == TCP_SEND_QUEUE) |
3829 |
+ tp->write_seq = val; |
3830 |
+ else if (tp->repair_queue == TCP_RECV_QUEUE) |
3831 |
+- tp->rcv_nxt = val; |
3832 |
++ WRITE_ONCE(tp->rcv_nxt, val); |
3833 |
+ else |
3834 |
+ err = -EINVAL; |
3835 |
+ break; |
3836 |
+diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c |
3837 |
+index 81148f7a2323..c9e97f304f98 100644 |
3838 |
+--- a/net/ipv4/tcp_diag.c |
3839 |
++++ b/net/ipv4/tcp_diag.c |
3840 |
+@@ -30,7 +30,7 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, |
3841 |
+ } else if (sk->sk_type == SOCK_STREAM) { |
3842 |
+ const struct tcp_sock *tp = tcp_sk(sk); |
3843 |
+ |
3844 |
+- r->idiag_rqueue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); |
3845 |
++ r->idiag_rqueue = max_t(int, READ_ONCE(tp->rcv_nxt) - tp->copied_seq, 0); |
3846 |
+ r->idiag_wqueue = tp->write_seq - tp->snd_una; |
3847 |
+ } |
3848 |
+ if (info) |
3849 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
3850 |
+index 57e8dad956ec..3a08ee81cbc3 100644 |
3851 |
+--- a/net/ipv4/tcp_input.c |
3852 |
++++ b/net/ipv4/tcp_input.c |
3853 |
+@@ -3348,7 +3348,7 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) |
3854 |
+ |
3855 |
+ sock_owned_by_me((struct sock *)tp); |
3856 |
+ tp->bytes_received += delta; |
3857 |
+- tp->rcv_nxt = seq; |
3858 |
++ WRITE_ONCE(tp->rcv_nxt, seq); |
3859 |
+ } |
3860 |
+ |
3861 |
+ /* Update our send window. |
3862 |
+@@ -5829,7 +5829,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, |
3863 |
+ /* Ok.. it's good. Set up sequence numbers and |
3864 |
+ * move to established. |
3865 |
+ */ |
3866 |
+- tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; |
3867 |
++ WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); |
3868 |
+ tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; |
3869 |
+ |
3870 |
+ /* RFC1323: The window in SYN & SYN/ACK segments is |
3871 |
+@@ -5932,7 +5932,7 @@ discard: |
3872 |
+ tp->tcp_header_len = sizeof(struct tcphdr); |
3873 |
+ } |
3874 |
+ |
3875 |
+- tp->rcv_nxt = TCP_SKB_CB(skb)->seq + 1; |
3876 |
++ WRITE_ONCE(tp->rcv_nxt, TCP_SKB_CB(skb)->seq + 1); |
3877 |
+ tp->copied_seq = tp->rcv_nxt; |
3878 |
+ tp->rcv_wup = TCP_SKB_CB(skb)->seq + 1; |
3879 |
+ |
3880 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
3881 |
+index 5553f6a833f3..6da393016c11 100644 |
3882 |
+--- a/net/ipv4/tcp_ipv4.c |
3883 |
++++ b/net/ipv4/tcp_ipv4.c |
3884 |
+@@ -2330,7 +2330,8 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i) |
3885 |
+ /* Because we don't lock the socket, |
3886 |
+ * we might find a transient negative value. |
3887 |
+ */ |
3888 |
+- rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); |
3889 |
++ rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - |
3890 |
++ tp->copied_seq, 0); |
3891 |
+ |
3892 |
+ seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX " |
3893 |
+ "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d", |
3894 |
+diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c |
3895 |
+index 12affb7864d9..7ba8a90772b0 100644 |
3896 |
+--- a/net/ipv4/tcp_minisocks.c |
3897 |
++++ b/net/ipv4/tcp_minisocks.c |
3898 |
+@@ -454,6 +454,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, |
3899 |
+ struct tcp_request_sock *treq = tcp_rsk(req); |
3900 |
+ struct inet_connection_sock *newicsk; |
3901 |
+ struct tcp_sock *oldtp, *newtp; |
3902 |
++ u32 seq; |
3903 |
+ |
3904 |
+ if (!newsk) |
3905 |
+ return NULL; |
3906 |
+@@ -467,8 +468,10 @@ struct sock *tcp_create_openreq_child(const struct sock *sk, |
3907 |
+ /* Now setup tcp_sock */ |
3908 |
+ newtp->pred_flags = 0; |
3909 |
+ |
3910 |
+- newtp->rcv_wup = newtp->copied_seq = |
3911 |
+- newtp->rcv_nxt = treq->rcv_isn + 1; |
3912 |
++ seq = treq->rcv_isn + 1; |
3913 |
++ newtp->rcv_wup = seq; |
3914 |
++ newtp->copied_seq = seq; |
3915 |
++ WRITE_ONCE(newtp->rcv_nxt, seq); |
3916 |
+ newtp->segs_in = 1; |
3917 |
+ |
3918 |
+ newtp->snd_sml = newtp->snd_una = |
3919 |
+diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c |
3920 |
+index 9a117a79af65..c5f4e89b6ff3 100644 |
3921 |
+--- a/net/ipv6/tcp_ipv6.c |
3922 |
++++ b/net/ipv6/tcp_ipv6.c |
3923 |
+@@ -1839,7 +1839,8 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i) |
3924 |
+ /* Because we don't lock the socket, |
3925 |
+ * we might find a transient negative value. |
3926 |
+ */ |
3927 |
+- rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0); |
3928 |
++ rx_queue = max_t(int, READ_ONCE(tp->rcv_nxt) - |
3929 |
++ tp->copied_seq, 0); |
3930 |
+ |
3931 |
+ seq_printf(seq, |
3932 |
+ "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X " |
3933 |
+diff --git a/net/netfilter/nft_tproxy.c b/net/netfilter/nft_tproxy.c |
3934 |
+index f92a82c73880..95980154ef02 100644 |
3935 |
+--- a/net/netfilter/nft_tproxy.c |
3936 |
++++ b/net/netfilter/nft_tproxy.c |
3937 |
+@@ -50,7 +50,7 @@ static void nft_tproxy_eval_v4(const struct nft_expr *expr, |
3938 |
+ taddr = nf_tproxy_laddr4(skb, taddr, iph->daddr); |
3939 |
+ |
3940 |
+ if (priv->sreg_port) |
3941 |
+- tport = regs->data[priv->sreg_port]; |
3942 |
++ tport = nft_reg_load16(®s->data[priv->sreg_port]); |
3943 |
+ if (!tport) |
3944 |
+ tport = hp->dest; |
3945 |
+ |
3946 |
+@@ -117,7 +117,7 @@ static void nft_tproxy_eval_v6(const struct nft_expr *expr, |
3947 |
+ taddr = *nf_tproxy_laddr6(skb, &taddr, &iph->daddr); |
3948 |
+ |
3949 |
+ if (priv->sreg_port) |
3950 |
+- tport = regs->data[priv->sreg_port]; |
3951 |
++ tport = nft_reg_load16(®s->data[priv->sreg_port]); |
3952 |
+ if (!tport) |
3953 |
+ tport = hp->dest; |
3954 |
+ |
3955 |
+diff --git a/net/rxrpc/peer_event.c b/net/rxrpc/peer_event.c |
3956 |
+index dc7fdaf20445..42582a9ff81d 100644 |
3957 |
+--- a/net/rxrpc/peer_event.c |
3958 |
++++ b/net/rxrpc/peer_event.c |
3959 |
+@@ -153,6 +153,9 @@ void rxrpc_error_report(struct sock *sk) |
3960 |
+ struct rxrpc_peer *peer; |
3961 |
+ struct sk_buff *skb; |
3962 |
+ |
3963 |
++ if (unlikely(!local)) |
3964 |
++ return; |
3965 |
++ |
3966 |
+ _enter("%p{%d}", sk, local->debug_id); |
3967 |
+ |
3968 |
+ skb = sock_dequeue_err_skb(sk); |
3969 |
+diff --git a/net/socket.c b/net/socket.c |
3970 |
+index 18d27b8c2511..1290aad5d1c3 100644 |
3971 |
+--- a/net/socket.c |
3972 |
++++ b/net/socket.c |
3973 |
+@@ -867,7 +867,7 @@ static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) |
3974 |
+ .msg_iocb = iocb}; |
3975 |
+ ssize_t res; |
3976 |
+ |
3977 |
+- if (file->f_flags & O_NONBLOCK) |
3978 |
++ if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) |
3979 |
+ msg.msg_flags = MSG_DONTWAIT; |
3980 |
+ |
3981 |
+ if (iocb->ki_pos != 0) |
3982 |
+@@ -892,7 +892,7 @@ static ssize_t sock_write_iter(struct kiocb *iocb, struct iov_iter *from) |
3983 |
+ if (iocb->ki_pos != 0) |
3984 |
+ return -ESPIPE; |
3985 |
+ |
3986 |
+- if (file->f_flags & O_NONBLOCK) |
3987 |
++ if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) |
3988 |
+ msg.msg_flags = MSG_DONTWAIT; |
3989 |
+ |
3990 |
+ if (sock->type == SOCK_SEQPACKET) |
3991 |
+diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c |
3992 |
+index d95a7e41a29d..0a57d105cc5b 100644 |
3993 |
+--- a/security/apparmor/apparmorfs.c |
3994 |
++++ b/security/apparmor/apparmorfs.c |
3995 |
+@@ -593,7 +593,7 @@ static __poll_t ns_revision_poll(struct file *file, poll_table *pt) |
3996 |
+ |
3997 |
+ void __aa_bump_ns_revision(struct aa_ns *ns) |
3998 |
+ { |
3999 |
+- ns->revision++; |
4000 |
++ WRITE_ONCE(ns->revision, ns->revision + 1); |
4001 |
+ wake_up_interruptible(&ns->wait); |
4002 |
+ } |
4003 |
+ |
4004 |
+diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c |
4005 |
+index 11975ec8d566..bdf9e4cefe25 100644 |
4006 |
+--- a/security/apparmor/domain.c |
4007 |
++++ b/security/apparmor/domain.c |
4008 |
+@@ -321,6 +321,7 @@ static int aa_xattrs_match(const struct linux_binprm *bprm, |
4009 |
+ |
4010 |
+ if (!bprm || !profile->xattr_count) |
4011 |
+ return 0; |
4012 |
++ might_sleep(); |
4013 |
+ |
4014 |
+ /* transition from exec match to xattr set */ |
4015 |
+ state = aa_dfa_null_transition(profile->xmatch, state); |
4016 |
+@@ -365,10 +366,11 @@ out: |
4017 |
+ } |
4018 |
+ |
4019 |
+ /** |
4020 |
+- * __attach_match_ - find an attachment match |
4021 |
++ * find_attach - do attachment search for unconfined processes |
4022 |
+ * @bprm - binprm structure of transitioning task |
4023 |
+- * @name - to match against (NOT NULL) |
4024 |
++ * @ns: the current namespace (NOT NULL) |
4025 |
+ * @head - profile list to walk (NOT NULL) |
4026 |
++ * @name - to match against (NOT NULL) |
4027 |
+ * @info - info message if there was an error (NOT NULL) |
4028 |
+ * |
4029 |
+ * Do a linear search on the profiles in the list. There is a matching |
4030 |
+@@ -378,12 +380,11 @@ out: |
4031 |
+ * |
4032 |
+ * Requires: @head not be shared or have appropriate locks held |
4033 |
+ * |
4034 |
+- * Returns: profile or NULL if no match found |
4035 |
++ * Returns: label or NULL if no match found |
4036 |
+ */ |
4037 |
+-static struct aa_profile *__attach_match(const struct linux_binprm *bprm, |
4038 |
+- const char *name, |
4039 |
+- struct list_head *head, |
4040 |
+- const char **info) |
4041 |
++static struct aa_label *find_attach(const struct linux_binprm *bprm, |
4042 |
++ struct aa_ns *ns, struct list_head *head, |
4043 |
++ const char *name, const char **info) |
4044 |
+ { |
4045 |
+ int candidate_len = 0, candidate_xattrs = 0; |
4046 |
+ bool conflict = false; |
4047 |
+@@ -392,6 +393,8 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, |
4048 |
+ AA_BUG(!name); |
4049 |
+ AA_BUG(!head); |
4050 |
+ |
4051 |
++ rcu_read_lock(); |
4052 |
++restart: |
4053 |
+ list_for_each_entry_rcu(profile, head, base.list) { |
4054 |
+ if (profile->label.flags & FLAG_NULL && |
4055 |
+ &profile->label == ns_unconfined(profile->ns)) |
4056 |
+@@ -417,16 +420,32 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, |
4057 |
+ perm = dfa_user_allow(profile->xmatch, state); |
4058 |
+ /* any accepting state means a valid match. */ |
4059 |
+ if (perm & MAY_EXEC) { |
4060 |
+- int ret; |
4061 |
++ int ret = 0; |
4062 |
+ |
4063 |
+ if (count < candidate_len) |
4064 |
+ continue; |
4065 |
+ |
4066 |
+- ret = aa_xattrs_match(bprm, profile, state); |
4067 |
+- /* Fail matching if the xattrs don't match */ |
4068 |
+- if (ret < 0) |
4069 |
+- continue; |
4070 |
+- |
4071 |
++ if (bprm && profile->xattr_count) { |
4072 |
++ long rev = READ_ONCE(ns->revision); |
4073 |
++ |
4074 |
++ if (!aa_get_profile_not0(profile)) |
4075 |
++ goto restart; |
4076 |
++ rcu_read_unlock(); |
4077 |
++ ret = aa_xattrs_match(bprm, profile, |
4078 |
++ state); |
4079 |
++ rcu_read_lock(); |
4080 |
++ aa_put_profile(profile); |
4081 |
++ if (rev != |
4082 |
++ READ_ONCE(ns->revision)) |
4083 |
++ /* policy changed */ |
4084 |
++ goto restart; |
4085 |
++ /* |
4086 |
++ * Fail matching if the xattrs don't |
4087 |
++ * match |
4088 |
++ */ |
4089 |
++ if (ret < 0) |
4090 |
++ continue; |
4091 |
++ } |
4092 |
+ /* |
4093 |
+ * TODO: allow for more flexible best match |
4094 |
+ * |
4095 |
+@@ -449,43 +468,28 @@ static struct aa_profile *__attach_match(const struct linux_binprm *bprm, |
4096 |
+ candidate_xattrs = ret; |
4097 |
+ conflict = false; |
4098 |
+ } |
4099 |
+- } else if (!strcmp(profile->base.name, name)) |
4100 |
++ } else if (!strcmp(profile->base.name, name)) { |
4101 |
+ /* |
4102 |
+ * old exact non-re match, without conditionals such |
4103 |
+ * as xattrs. no more searching required |
4104 |
+ */ |
4105 |
+- return profile; |
4106 |
++ candidate = profile; |
4107 |
++ goto out; |
4108 |
++ } |
4109 |
+ } |
4110 |
+ |
4111 |
+- if (conflict) { |
4112 |
+- *info = "conflicting profile attachments"; |
4113 |
++ if (!candidate || conflict) { |
4114 |
++ if (conflict) |
4115 |
++ *info = "conflicting profile attachments"; |
4116 |
++ rcu_read_unlock(); |
4117 |
+ return NULL; |
4118 |
+ } |
4119 |
+ |
4120 |
+- return candidate; |
4121 |
+-} |
4122 |
+- |
4123 |
+-/** |
4124 |
+- * find_attach - do attachment search for unconfined processes |
4125 |
+- * @bprm - binprm structure of transitioning task |
4126 |
+- * @ns: the current namespace (NOT NULL) |
4127 |
+- * @list: list to search (NOT NULL) |
4128 |
+- * @name: the executable name to match against (NOT NULL) |
4129 |
+- * @info: info message if there was an error |
4130 |
+- * |
4131 |
+- * Returns: label or NULL if no match found |
4132 |
+- */ |
4133 |
+-static struct aa_label *find_attach(const struct linux_binprm *bprm, |
4134 |
+- struct aa_ns *ns, struct list_head *list, |
4135 |
+- const char *name, const char **info) |
4136 |
+-{ |
4137 |
+- struct aa_profile *profile; |
4138 |
+- |
4139 |
+- rcu_read_lock(); |
4140 |
+- profile = aa_get_profile(__attach_match(bprm, name, list, info)); |
4141 |
++out: |
4142 |
++ candidate = aa_get_newest_profile(candidate); |
4143 |
+ rcu_read_unlock(); |
4144 |
+ |
4145 |
+- return profile ? &profile->label : NULL; |
4146 |
++ return &candidate->label; |
4147 |
+ } |
4148 |
+ |
4149 |
+ static const char *next_name(int xtype, const char *name) |
4150 |
+diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c |
4151 |
+index 1590e2de4e84..3a4293c46ad5 100644 |
4152 |
+--- a/security/apparmor/policy.c |
4153 |
++++ b/security/apparmor/policy.c |
4154 |
+@@ -1126,8 +1126,8 @@ ssize_t aa_remove_profiles(struct aa_ns *policy_ns, struct aa_label *subj, |
4155 |
+ if (!name) { |
4156 |
+ /* remove namespace - can only happen if fqname[0] == ':' */ |
4157 |
+ mutex_lock_nested(&ns->parent->lock, ns->level); |
4158 |
+- __aa_remove_ns(ns); |
4159 |
+ __aa_bump_ns_revision(ns); |
4160 |
++ __aa_remove_ns(ns); |
4161 |
+ mutex_unlock(&ns->parent->lock); |
4162 |
+ } else { |
4163 |
+ /* remove profile */ |
4164 |
+@@ -1139,9 +1139,9 @@ ssize_t aa_remove_profiles(struct aa_ns *policy_ns, struct aa_label *subj, |
4165 |
+ goto fail_ns_lock; |
4166 |
+ } |
4167 |
+ name = profile->base.hname; |
4168 |
++ __aa_bump_ns_revision(ns); |
4169 |
+ __remove_profile(profile); |
4170 |
+ __aa_labelset_update_subtree(ns); |
4171 |
+- __aa_bump_ns_revision(ns); |
4172 |
+ mutex_unlock(&ns->lock); |
4173 |
+ } |
4174 |
+ |
4175 |
+diff --git a/sound/firewire/motu/motu-proc.c b/sound/firewire/motu/motu-proc.c |
4176 |
+index ab6830a6d242..015b4ec2763f 100644 |
4177 |
+--- a/sound/firewire/motu/motu-proc.c |
4178 |
++++ b/sound/firewire/motu/motu-proc.c |
4179 |
+@@ -17,7 +17,7 @@ static const char *const clock_names[] = { |
4180 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT] = "S/PDIF on optical interface", |
4181 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_A] = "S/PDIF on optical interface A", |
4182 |
+ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT_B] = "S/PDIF on optical interface B", |
4183 |
+- [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PCIF on coaxial interface", |
4184 |
++ [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", |
4185 |
+ [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", |
4186 |
+ [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", |
4187 |
+ }; |
4188 |
+diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c |
4189 |
+index 70559e59d18f..7d4e18cb6351 100644 |
4190 |
+--- a/sound/isa/cs423x/cs4236.c |
4191 |
++++ b/sound/isa/cs423x/cs4236.c |
4192 |
+@@ -293,7 +293,8 @@ static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) |
4193 |
+ } else { |
4194 |
+ mpu_port[dev] = pnp_port_start(pdev, 0); |
4195 |
+ if (mpu_irq[dev] >= 0 && |
4196 |
+- pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { |
4197 |
++ pnp_irq_valid(pdev, 0) && |
4198 |
++ pnp_irq(pdev, 0) != (resource_size_t)-1) { |
4199 |
+ mpu_irq[dev] = pnp_irq(pdev, 0); |
4200 |
+ } else { |
4201 |
+ mpu_irq[dev] = -1; /* disable interrupt */ |
4202 |
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
4203 |
+index 019dee96dbaa..1f6a036627e8 100644 |
4204 |
+--- a/sound/pci/hda/patch_realtek.c |
4205 |
++++ b/sound/pci/hda/patch_realtek.c |
4206 |
+@@ -513,6 +513,7 @@ static void alc_shutup_pins(struct hda_codec *codec) |
4207 |
+ struct alc_spec *spec = codec->spec; |
4208 |
+ |
4209 |
+ switch (codec->core.vendor_id) { |
4210 |
++ case 0x10ec0283: |
4211 |
+ case 0x10ec0286: |
4212 |
+ case 0x10ec0288: |
4213 |
+ case 0x10ec0298: |
4214 |
+@@ -5441,6 +5442,16 @@ static void alc295_fixup_disable_dac3(struct hda_codec *codec, |
4215 |
+ } |
4216 |
+ } |
4217 |
+ |
4218 |
++/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */ |
4219 |
++static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, |
4220 |
++ const struct hda_fixup *fix, int action) |
4221 |
++{ |
4222 |
++ if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
4223 |
++ hda_nid_t conn[1] = { 0x02 }; |
4224 |
++ snd_hda_override_conn_list(codec, 0x17, 1, conn); |
4225 |
++ } |
4226 |
++} |
4227 |
++ |
4228 |
+ /* Hook to update amp GPIO4 for automute */ |
4229 |
+ static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, |
4230 |
+ struct hda_jack_callback *jack) |
4231 |
+@@ -5661,6 +5672,7 @@ enum { |
4232 |
+ ALC225_FIXUP_DISABLE_MIC_VREF, |
4233 |
+ ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, |
4234 |
+ ALC295_FIXUP_DISABLE_DAC3, |
4235 |
++ ALC285_FIXUP_SPEAKER2_TO_DAC1, |
4236 |
+ ALC280_FIXUP_HP_HEADSET_MIC, |
4237 |
+ ALC221_FIXUP_HP_FRONT_MIC, |
4238 |
+ ALC292_FIXUP_TPT460, |
4239 |
+@@ -5702,9 +5714,12 @@ enum { |
4240 |
+ ALC256_FIXUP_ASUS_HEADSET_MIC, |
4241 |
+ ALC256_FIXUP_ASUS_MIC_NO_PRESENCE, |
4242 |
+ ALC299_FIXUP_PREDATOR_SPK, |
4243 |
+- ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC, |
4244 |
+ ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, |
4245 |
+- ALC294_FIXUP_ASUS_INTSPK_GPIO, |
4246 |
++ ALC289_FIXUP_DELL_SPK2, |
4247 |
++ ALC289_FIXUP_DUAL_SPK, |
4248 |
++ ALC294_FIXUP_SPK2_TO_DAC1, |
4249 |
++ ALC294_FIXUP_ASUS_DUAL_SPK, |
4250 |
++ |
4251 |
+ }; |
4252 |
+ |
4253 |
+ static const struct hda_fixup alc269_fixups[] = { |
4254 |
+@@ -6441,6 +6456,10 @@ static const struct hda_fixup alc269_fixups[] = { |
4255 |
+ .type = HDA_FIXUP_FUNC, |
4256 |
+ .v.func = alc295_fixup_disable_dac3, |
4257 |
+ }, |
4258 |
++ [ALC285_FIXUP_SPEAKER2_TO_DAC1] = { |
4259 |
++ .type = HDA_FIXUP_FUNC, |
4260 |
++ .v.func = alc285_fixup_speaker2_to_dac1, |
4261 |
++ }, |
4262 |
+ [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = { |
4263 |
+ .type = HDA_FIXUP_PINS, |
4264 |
+ .v.pins = (const struct hda_pintbl[]) { |
4265 |
+@@ -6748,33 +6767,45 @@ static const struct hda_fixup alc269_fixups[] = { |
4266 |
+ { } |
4267 |
+ } |
4268 |
+ }, |
4269 |
+- [ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC] = { |
4270 |
++ [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = { |
4271 |
+ .type = HDA_FIXUP_PINS, |
4272 |
+ .v.pins = (const struct hda_pintbl[]) { |
4273 |
+- { 0x14, 0x411111f0 }, /* disable confusing internal speaker */ |
4274 |
+- { 0x19, 0x04a11150 }, /* use as headset mic, without its own jack detect */ |
4275 |
++ { 0x19, 0x04a11040 }, |
4276 |
++ { 0x21, 0x04211020 }, |
4277 |
+ { } |
4278 |
+ }, |
4279 |
+ .chained = true, |
4280 |
+- .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC |
4281 |
++ .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE |
4282 |
+ }, |
4283 |
+- [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = { |
4284 |
++ [ALC289_FIXUP_DELL_SPK2] = { |
4285 |
+ .type = HDA_FIXUP_PINS, |
4286 |
+ .v.pins = (const struct hda_pintbl[]) { |
4287 |
+- { 0x19, 0x04a11040 }, |
4288 |
+- { 0x21, 0x04211020 }, |
4289 |
++ { 0x17, 0x90170130 }, /* bass spk */ |
4290 |
+ { } |
4291 |
+ }, |
4292 |
+ .chained = true, |
4293 |
+- .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE |
4294 |
++ .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE |
4295 |
+ }, |
4296 |
+- [ALC294_FIXUP_ASUS_INTSPK_GPIO] = { |
4297 |
++ [ALC289_FIXUP_DUAL_SPK] = { |
4298 |
++ .type = HDA_FIXUP_FUNC, |
4299 |
++ .v.func = alc285_fixup_speaker2_to_dac1, |
4300 |
++ .chained = true, |
4301 |
++ .chain_id = ALC289_FIXUP_DELL_SPK2 |
4302 |
++ }, |
4303 |
++ [ALC294_FIXUP_SPK2_TO_DAC1] = { |
4304 |
++ .type = HDA_FIXUP_FUNC, |
4305 |
++ .v.func = alc285_fixup_speaker2_to_dac1, |
4306 |
++ .chained = true, |
4307 |
++ .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC |
4308 |
++ }, |
4309 |
++ [ALC294_FIXUP_ASUS_DUAL_SPK] = { |
4310 |
+ .type = HDA_FIXUP_FUNC, |
4311 |
+ /* The GPIO must be pulled to initialize the AMP */ |
4312 |
+ .v.func = alc_fixup_gpio4, |
4313 |
+ .chained = true, |
4314 |
+- .chain_id = ALC294_FIXUP_ASUS_INTSPK_HEADSET_MIC |
4315 |
++ .chain_id = ALC294_FIXUP_SPK2_TO_DAC1 |
4316 |
+ }, |
4317 |
++ |
4318 |
+ }; |
4319 |
+ |
4320 |
+ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4321 |
+@@ -6847,6 +6878,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4322 |
+ SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE), |
4323 |
+ SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE), |
4324 |
+ SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB), |
4325 |
++ SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK), |
4326 |
++ SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK), |
4327 |
+ SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4328 |
+ SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4329 |
+ SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
4330 |
+@@ -6934,7 +6967,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4331 |
+ SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
4332 |
+ SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
4333 |
+ SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
4334 |
+- SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_INTSPK_GPIO), |
4335 |
++ SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK), |
4336 |
+ SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC), |
4337 |
+ SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
4338 |
+ SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC), |
4339 |
+@@ -7006,6 +7039,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
4340 |
+ SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), |
4341 |
+ SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK), |
4342 |
+ SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4343 |
++ SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1), |
4344 |
+ SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
4345 |
+ SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), |
4346 |
+ SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), |
4347 |
+@@ -7189,6 +7223,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { |
4348 |
+ {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"}, |
4349 |
+ {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"}, |
4350 |
+ {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"}, |
4351 |
++ {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"}, |
4352 |
+ {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"}, |
4353 |
+ {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"}, |
4354 |
+ {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"}, |
4355 |
+diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c |
4356 |
+index 057c2f394ea7..41ea8e7b389a 100644 |
4357 |
+--- a/sound/pci/ice1712/ice1724.c |
4358 |
++++ b/sound/pci/ice1712/ice1724.c |
4359 |
+@@ -661,6 +661,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
4360 |
+ unsigned long flags; |
4361 |
+ unsigned char mclk_change; |
4362 |
+ unsigned int i, old_rate; |
4363 |
++ bool call_set_rate = false; |
4364 |
+ |
4365 |
+ if (rate > ice->hw_rates->list[ice->hw_rates->count - 1]) |
4366 |
+ return -EINVAL; |
4367 |
+@@ -684,7 +685,7 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
4368 |
+ * setting clock rate for internal clock mode */ |
4369 |
+ old_rate = ice->get_rate(ice); |
4370 |
+ if (force || (old_rate != rate)) |
4371 |
+- ice->set_rate(ice, rate); |
4372 |
++ call_set_rate = true; |
4373 |
+ else if (rate == ice->cur_rate) { |
4374 |
+ spin_unlock_irqrestore(&ice->reg_lock, flags); |
4375 |
+ return 0; |
4376 |
+@@ -692,12 +693,14 @@ static int snd_vt1724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate, |
4377 |
+ } |
4378 |
+ |
4379 |
+ ice->cur_rate = rate; |
4380 |
++ spin_unlock_irqrestore(&ice->reg_lock, flags); |
4381 |
++ |
4382 |
++ if (call_set_rate) |
4383 |
++ ice->set_rate(ice, rate); |
4384 |
+ |
4385 |
+ /* setting master clock */ |
4386 |
+ mclk_change = ice->set_mclk(ice, rate); |
4387 |
+ |
4388 |
+- spin_unlock_irqrestore(&ice->reg_lock, flags); |
4389 |
+- |
4390 |
+ if (mclk_change && ice->gpio.i2s_mclk_changed) |
4391 |
+ ice->gpio.i2s_mclk_changed(ice); |
4392 |
+ if (ice->gpio.set_pro_rate) |
4393 |
+diff --git a/sound/usb/card.h b/sound/usb/card.h |
4394 |
+index ac785d15ced4..7f11655bde50 100644 |
4395 |
+--- a/sound/usb/card.h |
4396 |
++++ b/sound/usb/card.h |
4397 |
+@@ -142,6 +142,7 @@ struct snd_usb_substream { |
4398 |
+ struct snd_usb_endpoint *sync_endpoint; |
4399 |
+ unsigned long flags; |
4400 |
+ bool need_setup_ep; /* (re)configure EP at prepare? */ |
4401 |
++ bool need_setup_fmt; /* (re)configure fmt after resume? */ |
4402 |
+ unsigned int speed; /* USB_SPEED_XXX */ |
4403 |
+ |
4404 |
+ u64 formats; /* format bitmasks (all or'ed) */ |
4405 |
+diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c |
4406 |
+index 1828225ba882..9de4221de730 100644 |
4407 |
+--- a/sound/usb/pcm.c |
4408 |
++++ b/sound/usb/pcm.c |
4409 |
+@@ -513,15 +513,15 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) |
4410 |
+ if (WARN_ON(!iface)) |
4411 |
+ return -EINVAL; |
4412 |
+ alts = usb_altnum_to_altsetting(iface, fmt->altsetting); |
4413 |
+- altsd = get_iface_desc(alts); |
4414 |
+- if (WARN_ON(altsd->bAlternateSetting != fmt->altsetting)) |
4415 |
++ if (WARN_ON(!alts)) |
4416 |
+ return -EINVAL; |
4417 |
++ altsd = get_iface_desc(alts); |
4418 |
+ |
4419 |
+- if (fmt == subs->cur_audiofmt) |
4420 |
++ if (fmt == subs->cur_audiofmt && !subs->need_setup_fmt) |
4421 |
+ return 0; |
4422 |
+ |
4423 |
+ /* close the old interface */ |
4424 |
+- if (subs->interface >= 0 && subs->interface != fmt->iface) { |
4425 |
++ if (subs->interface >= 0 && (subs->interface != fmt->iface || subs->need_setup_fmt)) { |
4426 |
+ if (!subs->stream->chip->keep_iface) { |
4427 |
+ err = usb_set_interface(subs->dev, subs->interface, 0); |
4428 |
+ if (err < 0) { |
4429 |
+@@ -535,6 +535,9 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) |
4430 |
+ subs->altset_idx = 0; |
4431 |
+ } |
4432 |
+ |
4433 |
++ if (subs->need_setup_fmt) |
4434 |
++ subs->need_setup_fmt = false; |
4435 |
++ |
4436 |
+ /* set interface */ |
4437 |
+ if (iface->cur_altsetting != alts) { |
4438 |
+ err = snd_usb_select_mode_quirk(subs, fmt); |
4439 |
+@@ -1722,6 +1725,13 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea |
4440 |
+ subs->data_endpoint->retire_data_urb = retire_playback_urb; |
4441 |
+ subs->running = 0; |
4442 |
+ return 0; |
4443 |
++ case SNDRV_PCM_TRIGGER_SUSPEND: |
4444 |
++ if (subs->stream->chip->setup_fmt_after_resume_quirk) { |
4445 |
++ stop_endpoints(subs, true); |
4446 |
++ subs->need_setup_fmt = true; |
4447 |
++ return 0; |
4448 |
++ } |
4449 |
++ break; |
4450 |
+ } |
4451 |
+ |
4452 |
+ return -EINVAL; |
4453 |
+@@ -1754,6 +1764,13 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream |
4454 |
+ subs->data_endpoint->retire_data_urb = retire_capture_urb; |
4455 |
+ subs->running = 1; |
4456 |
+ return 0; |
4457 |
++ case SNDRV_PCM_TRIGGER_SUSPEND: |
4458 |
++ if (subs->stream->chip->setup_fmt_after_resume_quirk) { |
4459 |
++ stop_endpoints(subs, true); |
4460 |
++ subs->need_setup_fmt = true; |
4461 |
++ return 0; |
4462 |
++ } |
4463 |
++ break; |
4464 |
+ } |
4465 |
+ |
4466 |
+ return -EINVAL; |
4467 |
+diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h |
4468 |
+index 57c6209a4ccb..65f9c4ba62ee 100644 |
4469 |
+--- a/sound/usb/quirks-table.h |
4470 |
++++ b/sound/usb/quirks-table.h |
4471 |
+@@ -3400,7 +3400,8 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), |
4472 |
+ .vendor_name = "Dell", |
4473 |
+ .product_name = "WD19 Dock", |
4474 |
+ .profile_name = "Dell-WD15-Dock", |
4475 |
+- .ifnum = QUIRK_NO_INTERFACE |
4476 |
++ .ifnum = QUIRK_ANY_INTERFACE, |
4477 |
++ .type = QUIRK_SETUP_FMT_AFTER_RESUME |
4478 |
+ } |
4479 |
+ }, |
4480 |
+ |
4481 |
+diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c |
4482 |
+index 052b4ada2d05..bc70212031df 100644 |
4483 |
+--- a/sound/usb/quirks.c |
4484 |
++++ b/sound/usb/quirks.c |
4485 |
+@@ -519,6 +519,16 @@ static int create_standard_mixer_quirk(struct snd_usb_audio *chip, |
4486 |
+ return snd_usb_create_mixer(chip, quirk->ifnum, 0); |
4487 |
+ } |
4488 |
+ |
4489 |
++ |
4490 |
++static int setup_fmt_after_resume_quirk(struct snd_usb_audio *chip, |
4491 |
++ struct usb_interface *iface, |
4492 |
++ struct usb_driver *driver, |
4493 |
++ const struct snd_usb_audio_quirk *quirk) |
4494 |
++{ |
4495 |
++ chip->setup_fmt_after_resume_quirk = 1; |
4496 |
++ return 1; /* Continue with creating streams and mixer */ |
4497 |
++} |
4498 |
++ |
4499 |
+ /* |
4500 |
+ * audio-interface quirks |
4501 |
+ * |
4502 |
+@@ -557,6 +567,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, |
4503 |
+ [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, |
4504 |
+ [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, |
4505 |
+ [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, |
4506 |
++ [QUIRK_SETUP_FMT_AFTER_RESUME] = setup_fmt_after_resume_quirk, |
4507 |
+ }; |
4508 |
+ |
4509 |
+ if (quirk->type < QUIRK_TYPE_COUNT) { |
4510 |
+diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h |
4511 |
+index b9faeca645fd..4a0a5a071d51 100644 |
4512 |
+--- a/sound/usb/usbaudio.h |
4513 |
++++ b/sound/usb/usbaudio.h |
4514 |
+@@ -44,7 +44,7 @@ struct snd_usb_audio { |
4515 |
+ wait_queue_head_t shutdown_wait; |
4516 |
+ unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ |
4517 |
+ unsigned int tx_length_quirk:1; /* Put length specifier in transfers */ |
4518 |
+- |
4519 |
++ unsigned int setup_fmt_after_resume_quirk:1; /* setup the format to interface after resume */ |
4520 |
+ int num_interfaces; |
4521 |
+ int num_suspended_intf; |
4522 |
+ int sample_rate_read_error; |
4523 |
+@@ -107,6 +107,7 @@ enum quirk_type { |
4524 |
+ QUIRK_AUDIO_EDIROL_UAXX, |
4525 |
+ QUIRK_AUDIO_ALIGN_TRANSFER, |
4526 |
+ QUIRK_AUDIO_STANDARD_MIXER, |
4527 |
++ QUIRK_SETUP_FMT_AFTER_RESUME, |
4528 |
+ |
4529 |
+ QUIRK_TYPE_COUNT |
4530 |
+ }; |
4531 |
+diff --git a/tools/testing/selftests/net/rtnetlink.sh b/tools/testing/selftests/net/rtnetlink.sh |
4532 |
+index e101af52d1d6..ff665de788ef 100755 |
4533 |
+--- a/tools/testing/selftests/net/rtnetlink.sh |
4534 |
++++ b/tools/testing/selftests/net/rtnetlink.sh |
4535 |
+@@ -234,6 +234,26 @@ kci_test_route_get() |
4536 |
+ echo "PASS: route get" |
4537 |
+ } |
4538 |
+ |
4539 |
++kci_test_addrlft() |
4540 |
++{ |
4541 |
++ for i in $(seq 10 100) ;do |
4542 |
++ lft=$(((RANDOM%3) + 1)) |
4543 |
++ ip addr add 10.23.11.$i/32 dev "$devdummy" preferred_lft $lft valid_lft $((lft+1)) |
4544 |
++ check_err $? |
4545 |
++ done |
4546 |
++ |
4547 |
++ sleep 5 |
4548 |
++ |
4549 |
++ ip addr show dev "$devdummy" | grep "10.23.11." |
4550 |
++ if [ $? -eq 0 ]; then |
4551 |
++ echo "FAIL: preferred_lft addresses remaining" |
4552 |
++ check_err 1 |
4553 |
++ return |
4554 |
++ fi |
4555 |
++ |
4556 |
++ echo "PASS: preferred_lft addresses have expired" |
4557 |
++} |
4558 |
++ |
4559 |
+ kci_test_addrlabel() |
4560 |
+ { |
4561 |
+ ret=0 |
4562 |
+@@ -965,6 +985,7 @@ kci_test_rtnl() |
4563 |
+ |
4564 |
+ kci_test_polrouting |
4565 |
+ kci_test_route_get |
4566 |
++ kci_test_addrlft |
4567 |
+ kci_test_tc |
4568 |
+ kci_test_gre |
4569 |
+ kci_test_gretap |
4570 |
+diff --git a/tools/testing/selftests/rseq/param_test.c b/tools/testing/selftests/rseq/param_test.c |
4571 |
+index eec2663261f2..e8a657a5f48a 100644 |
4572 |
+--- a/tools/testing/selftests/rseq/param_test.c |
4573 |
++++ b/tools/testing/selftests/rseq/param_test.c |
4574 |
+@@ -15,7 +15,7 @@ |
4575 |
+ #include <errno.h> |
4576 |
+ #include <stddef.h> |
4577 |
+ |
4578 |
+-static inline pid_t gettid(void) |
4579 |
++static inline pid_t rseq_gettid(void) |
4580 |
+ { |
4581 |
+ return syscall(__NR_gettid); |
4582 |
+ } |
4583 |
+@@ -373,11 +373,12 @@ void *test_percpu_spinlock_thread(void *arg) |
4584 |
+ rseq_percpu_unlock(&data->lock, cpu); |
4585 |
+ #ifndef BENCHMARK |
4586 |
+ if (i != 0 && !(i % (reps / 10))) |
4587 |
+- printf_verbose("tid %d: count %lld\n", (int) gettid(), i); |
4588 |
++ printf_verbose("tid %d: count %lld\n", |
4589 |
++ (int) rseq_gettid(), i); |
4590 |
+ #endif |
4591 |
+ } |
4592 |
+ printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", |
4593 |
+- (int) gettid(), nr_abort, signals_delivered); |
4594 |
++ (int) rseq_gettid(), nr_abort, signals_delivered); |
4595 |
+ if (!opt_disable_rseq && thread_data->reg && |
4596 |
+ rseq_unregister_current_thread()) |
4597 |
+ abort(); |
4598 |
+@@ -454,11 +455,12 @@ void *test_percpu_inc_thread(void *arg) |
4599 |
+ } while (rseq_unlikely(ret)); |
4600 |
+ #ifndef BENCHMARK |
4601 |
+ if (i != 0 && !(i % (reps / 10))) |
4602 |
+- printf_verbose("tid %d: count %lld\n", (int) gettid(), i); |
4603 |
++ printf_verbose("tid %d: count %lld\n", |
4604 |
++ (int) rseq_gettid(), i); |
4605 |
+ #endif |
4606 |
+ } |
4607 |
+ printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", |
4608 |
+- (int) gettid(), nr_abort, signals_delivered); |
4609 |
++ (int) rseq_gettid(), nr_abort, signals_delivered); |
4610 |
+ if (!opt_disable_rseq && thread_data->reg && |
4611 |
+ rseq_unregister_current_thread()) |
4612 |
+ abort(); |
4613 |
+@@ -605,7 +607,7 @@ void *test_percpu_list_thread(void *arg) |
4614 |
+ } |
4615 |
+ |
4616 |
+ printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", |
4617 |
+- (int) gettid(), nr_abort, signals_delivered); |
4618 |
++ (int) rseq_gettid(), nr_abort, signals_delivered); |
4619 |
+ if (!opt_disable_rseq && rseq_unregister_current_thread()) |
4620 |
+ abort(); |
4621 |
+ |
4622 |
+@@ -796,7 +798,7 @@ void *test_percpu_buffer_thread(void *arg) |
4623 |
+ } |
4624 |
+ |
4625 |
+ printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", |
4626 |
+- (int) gettid(), nr_abort, signals_delivered); |
4627 |
++ (int) rseq_gettid(), nr_abort, signals_delivered); |
4628 |
+ if (!opt_disable_rseq && rseq_unregister_current_thread()) |
4629 |
+ abort(); |
4630 |
+ |
4631 |
+@@ -1011,7 +1013,7 @@ void *test_percpu_memcpy_buffer_thread(void *arg) |
4632 |
+ } |
4633 |
+ |
4634 |
+ printf_verbose("tid %d: number of rseq abort: %d, signals delivered: %u\n", |
4635 |
+- (int) gettid(), nr_abort, signals_delivered); |
4636 |
++ (int) rseq_gettid(), nr_abort, signals_delivered); |
4637 |
+ if (!opt_disable_rseq && rseq_unregister_current_thread()) |
4638 |
+ abort(); |
4639 |
+ |