1 |
commit: daab833868f848c96d0cab44ab916432aa75011f |
2 |
Author: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Dec 14 08:57:40 2017 +0000 |
4 |
Commit: Alice Ferrazzi <alicef <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Dec 14 08:57:40 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=daab8338 |
7 |
|
8 |
Added linux patch 4.9.69 |
9 |
|
10 |
0000_README | 4 + |
11 |
1068_linux-4.9.69.patch | 4127 +++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 4131 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 7f2750d..4f00249 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -315,6 +315,10 @@ Patch: 1067_linux-4.9.68.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.9.68 |
21 |
|
22 |
+Patch: 1068_linux-4.9.69.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.9.69 |
25 |
+ |
26 |
Patch: 1500_XATTR_USER_PREFIX.patch |
27 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
28 |
Desc: Support for namespace user.pax.* on tmpfs. |
29 |
|
30 |
diff --git a/1068_linux-4.9.69.patch b/1068_linux-4.9.69.patch |
31 |
new file mode 100644 |
32 |
index 0000000..8a9fa5e |
33 |
--- /dev/null |
34 |
+++ b/1068_linux-4.9.69.patch |
35 |
@@ -0,0 +1,4127 @@ |
36 |
+diff --git a/Documentation/devicetree/bindings/usb/usb-device.txt b/Documentation/devicetree/bindings/usb/usb-device.txt |
37 |
+index 1c35e7b665e1..03ab8f5eab40 100644 |
38 |
+--- a/Documentation/devicetree/bindings/usb/usb-device.txt |
39 |
++++ b/Documentation/devicetree/bindings/usb/usb-device.txt |
40 |
+@@ -11,7 +11,7 @@ Required properties: |
41 |
+ be used, but a device adhering to this binding may leave out all except |
42 |
+ for usbVID,PID. |
43 |
+ - reg: the port number which this device is connecting to, the range |
44 |
+- is 1-31. |
45 |
++ is 1-255. |
46 |
+ |
47 |
+ Example: |
48 |
+ |
49 |
+diff --git a/Makefile b/Makefile |
50 |
+index dfe17af517b2..8f2819bf8135 100644 |
51 |
+--- a/Makefile |
52 |
++++ b/Makefile |
53 |
+@@ -1,6 +1,6 @@ |
54 |
+ VERSION = 4 |
55 |
+ PATCHLEVEL = 9 |
56 |
+-SUBLEVEL = 68 |
57 |
++SUBLEVEL = 69 |
58 |
+ EXTRAVERSION = |
59 |
+ NAME = Roaring Lionus |
60 |
+ |
61 |
+diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
62 |
+index 68b06f9c65de..12f99fd2e3b2 100644 |
63 |
+--- a/arch/arm/include/asm/assembler.h |
64 |
++++ b/arch/arm/include/asm/assembler.h |
65 |
+@@ -516,4 +516,22 @@ THUMB( orr \reg , \reg , #PSR_T_BIT ) |
66 |
+ #endif |
67 |
+ .endm |
68 |
+ |
69 |
++ .macro bug, msg, line |
70 |
++#ifdef CONFIG_THUMB2_KERNEL |
71 |
++1: .inst 0xde02 |
72 |
++#else |
73 |
++1: .inst 0xe7f001f2 |
74 |
++#endif |
75 |
++#ifdef CONFIG_DEBUG_BUGVERBOSE |
76 |
++ .pushsection .rodata.str, "aMS", %progbits, 1 |
77 |
++2: .asciz "\msg" |
78 |
++ .popsection |
79 |
++ .pushsection __bug_table, "aw" |
80 |
++ .align 2 |
81 |
++ .word 1b, 2b |
82 |
++ .hword \line |
83 |
++ .popsection |
84 |
++#endif |
85 |
++ .endm |
86 |
++ |
87 |
+ #endif /* __ASM_ASSEMBLER_H__ */ |
88 |
+diff --git a/arch/arm/include/asm/kvm_arm.h b/arch/arm/include/asm/kvm_arm.h |
89 |
+index e22089fb44dc..98d6de177b7a 100644 |
90 |
+--- a/arch/arm/include/asm/kvm_arm.h |
91 |
++++ b/arch/arm/include/asm/kvm_arm.h |
92 |
+@@ -161,8 +161,7 @@ |
93 |
+ #else |
94 |
+ #define VTTBR_X (5 - KVM_T0SZ) |
95 |
+ #endif |
96 |
+-#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) |
97 |
+-#define VTTBR_BADDR_MASK (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) |
98 |
++#define VTTBR_BADDR_MASK (((_AC(1, ULL) << (40 - VTTBR_X)) - 1) << VTTBR_X) |
99 |
+ #define VTTBR_VMID_SHIFT _AC(48, ULL) |
100 |
+ #define VTTBR_VMID_MASK(size) (_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT) |
101 |
+ |
102 |
+@@ -209,6 +208,7 @@ |
103 |
+ #define HSR_EC_IABT_HYP (0x21) |
104 |
+ #define HSR_EC_DABT (0x24) |
105 |
+ #define HSR_EC_DABT_HYP (0x25) |
106 |
++#define HSR_EC_MAX (0x3f) |
107 |
+ |
108 |
+ #define HSR_WFI_IS_WFE (_AC(1, UL) << 0) |
109 |
+ |
110 |
+diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h |
111 |
+index 1f59ea051bab..b7e0125c0bbf 100644 |
112 |
+--- a/arch/arm/include/asm/uaccess.h |
113 |
++++ b/arch/arm/include/asm/uaccess.h |
114 |
+@@ -478,11 +478,10 @@ extern unsigned long __must_check |
115 |
+ arm_copy_from_user(void *to, const void __user *from, unsigned long n); |
116 |
+ |
117 |
+ static inline unsigned long __must_check |
118 |
+-__copy_from_user(void *to, const void __user *from, unsigned long n) |
119 |
++__arch_copy_from_user(void *to, const void __user *from, unsigned long n) |
120 |
+ { |
121 |
+ unsigned int __ua_flags; |
122 |
+ |
123 |
+- check_object_size(to, n, false); |
124 |
+ __ua_flags = uaccess_save_and_enable(); |
125 |
+ n = arm_copy_from_user(to, from, n); |
126 |
+ uaccess_restore(__ua_flags); |
127 |
+@@ -495,18 +494,15 @@ extern unsigned long __must_check |
128 |
+ __copy_to_user_std(void __user *to, const void *from, unsigned long n); |
129 |
+ |
130 |
+ static inline unsigned long __must_check |
131 |
+-__copy_to_user(void __user *to, const void *from, unsigned long n) |
132 |
++__arch_copy_to_user(void __user *to, const void *from, unsigned long n) |
133 |
+ { |
134 |
+ #ifndef CONFIG_UACCESS_WITH_MEMCPY |
135 |
+ unsigned int __ua_flags; |
136 |
+- |
137 |
+- check_object_size(from, n, true); |
138 |
+ __ua_flags = uaccess_save_and_enable(); |
139 |
+ n = arm_copy_to_user(to, from, n); |
140 |
+ uaccess_restore(__ua_flags); |
141 |
+ return n; |
142 |
+ #else |
143 |
+- check_object_size(from, n, true); |
144 |
+ return arm_copy_to_user(to, from, n); |
145 |
+ #endif |
146 |
+ } |
147 |
+@@ -526,25 +522,49 @@ __clear_user(void __user *addr, unsigned long n) |
148 |
+ } |
149 |
+ |
150 |
+ #else |
151 |
+-#define __copy_from_user(to, from, n) (memcpy(to, (void __force *)from, n), 0) |
152 |
+-#define __copy_to_user(to, from, n) (memcpy((void __force *)to, from, n), 0) |
153 |
++#define __arch_copy_from_user(to, from, n) \ |
154 |
++ (memcpy(to, (void __force *)from, n), 0) |
155 |
++#define __arch_copy_to_user(to, from, n) \ |
156 |
++ (memcpy((void __force *)to, from, n), 0) |
157 |
+ #define __clear_user(addr, n) (memset((void __force *)addr, 0, n), 0) |
158 |
+ #endif |
159 |
+ |
160 |
+-static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n) |
161 |
++static inline unsigned long __must_check |
162 |
++__copy_from_user(void *to, const void __user *from, unsigned long n) |
163 |
++{ |
164 |
++ check_object_size(to, n, false); |
165 |
++ return __arch_copy_from_user(to, from, n); |
166 |
++} |
167 |
++ |
168 |
++static inline unsigned long __must_check |
169 |
++copy_from_user(void *to, const void __user *from, unsigned long n) |
170 |
+ { |
171 |
+ unsigned long res = n; |
172 |
++ |
173 |
++ check_object_size(to, n, false); |
174 |
++ |
175 |
+ if (likely(access_ok(VERIFY_READ, from, n))) |
176 |
+- res = __copy_from_user(to, from, n); |
177 |
++ res = __arch_copy_from_user(to, from, n); |
178 |
+ if (unlikely(res)) |
179 |
+ memset(to + (n - res), 0, res); |
180 |
+ return res; |
181 |
+ } |
182 |
+ |
183 |
+-static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n) |
184 |
++static inline unsigned long __must_check |
185 |
++__copy_to_user(void __user *to, const void *from, unsigned long n) |
186 |
+ { |
187 |
++ check_object_size(from, n, true); |
188 |
++ |
189 |
++ return __arch_copy_to_user(to, from, n); |
190 |
++} |
191 |
++ |
192 |
++static inline unsigned long __must_check |
193 |
++copy_to_user(void __user *to, const void *from, unsigned long n) |
194 |
++{ |
195 |
++ check_object_size(from, n, true); |
196 |
++ |
197 |
+ if (access_ok(VERIFY_WRITE, to, n)) |
198 |
+- n = __copy_to_user(to, from, n); |
199 |
++ n = __arch_copy_to_user(to, from, n); |
200 |
+ return n; |
201 |
+ } |
202 |
+ |
203 |
+diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S |
204 |
+index 6391728c8f03..e056c9a9aa9d 100644 |
205 |
+--- a/arch/arm/kernel/entry-header.S |
206 |
++++ b/arch/arm/kernel/entry-header.S |
207 |
+@@ -299,6 +299,8 @@ |
208 |
+ mov r2, sp |
209 |
+ ldr r1, [r2, #\offset + S_PSR] @ get calling cpsr |
210 |
+ ldr lr, [r2, #\offset + S_PC]! @ get pc |
211 |
++ tst r1, #PSR_I_BIT | 0x0f |
212 |
++ bne 1f |
213 |
+ msr spsr_cxsf, r1 @ save in spsr_svc |
214 |
+ #if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_32v6K) |
215 |
+ @ We must avoid clrex due to Cortex-A15 erratum #830321 |
216 |
+@@ -313,6 +315,7 @@ |
217 |
+ @ after ldm {}^ |
218 |
+ add sp, sp, #\offset + PT_REGS_SIZE |
219 |
+ movs pc, lr @ return & move spsr_svc into cpsr |
220 |
++1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
221 |
+ #elif defined(CONFIG_CPU_V7M) |
222 |
+ @ V7M restore. |
223 |
+ @ Note that we don't need to do clrex here as clearing the local |
224 |
+@@ -328,6 +331,8 @@ |
225 |
+ ldr r1, [sp, #\offset + S_PSR] @ get calling cpsr |
226 |
+ ldr lr, [sp, #\offset + S_PC] @ get pc |
227 |
+ add sp, sp, #\offset + S_SP |
228 |
++ tst r1, #PSR_I_BIT | 0x0f |
229 |
++ bne 1f |
230 |
+ msr spsr_cxsf, r1 @ save in spsr_svc |
231 |
+ |
232 |
+ @ We must avoid clrex due to Cortex-A15 erratum #830321 |
233 |
+@@ -340,6 +345,7 @@ |
234 |
+ .endif |
235 |
+ add sp, sp, #PT_REGS_SIZE - S_SP |
236 |
+ movs pc, lr @ return & move spsr_svc into cpsr |
237 |
++1: bug "Returning to usermode but unexpected PSR bits set?", \@ |
238 |
+ #endif /* !CONFIG_THUMB2_KERNEL */ |
239 |
+ .endm |
240 |
+ |
241 |
+diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/kvm/handle_exit.c |
242 |
+index 066b6d4508ce..42f5daf715d0 100644 |
243 |
+--- a/arch/arm/kvm/handle_exit.c |
244 |
++++ b/arch/arm/kvm/handle_exit.c |
245 |
+@@ -79,7 +79,19 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) |
246 |
+ return 1; |
247 |
+ } |
248 |
+ |
249 |
++static int kvm_handle_unknown_ec(struct kvm_vcpu *vcpu, struct kvm_run *run) |
250 |
++{ |
251 |
++ u32 hsr = kvm_vcpu_get_hsr(vcpu); |
252 |
++ |
253 |
++ kvm_pr_unimpl("Unknown exception class: hsr: %#08x\n", |
254 |
++ hsr); |
255 |
++ |
256 |
++ kvm_inject_undefined(vcpu); |
257 |
++ return 1; |
258 |
++} |
259 |
++ |
260 |
+ static exit_handle_fn arm_exit_handlers[] = { |
261 |
++ [0 ... HSR_EC_MAX] = kvm_handle_unknown_ec, |
262 |
+ [HSR_EC_WFI] = kvm_handle_wfx, |
263 |
+ [HSR_EC_CP15_32] = kvm_handle_cp15_32, |
264 |
+ [HSR_EC_CP15_64] = kvm_handle_cp15_64, |
265 |
+@@ -98,13 +110,6 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) |
266 |
+ { |
267 |
+ u8 hsr_ec = kvm_vcpu_trap_get_class(vcpu); |
268 |
+ |
269 |
+- if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) || |
270 |
+- !arm_exit_handlers[hsr_ec]) { |
271 |
+- kvm_err("Unknown exception class: hsr: %#08x\n", |
272 |
+- (unsigned int)kvm_vcpu_get_hsr(vcpu)); |
273 |
+- BUG(); |
274 |
+- } |
275 |
+- |
276 |
+ return arm_exit_handlers[hsr_ec]; |
277 |
+ } |
278 |
+ |
279 |
+diff --git a/arch/arm/mach-omap2/gpmc-onenand.c b/arch/arm/mach-omap2/gpmc-onenand.c |
280 |
+index 8633c703546a..2944af820558 100644 |
281 |
+--- a/arch/arm/mach-omap2/gpmc-onenand.c |
282 |
++++ b/arch/arm/mach-omap2/gpmc-onenand.c |
283 |
+@@ -367,7 +367,7 @@ static int gpmc_onenand_setup(void __iomem *onenand_base, int *freq_ptr) |
284 |
+ return ret; |
285 |
+ } |
286 |
+ |
287 |
+-void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
288 |
++int gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
289 |
+ { |
290 |
+ int err; |
291 |
+ struct device *dev = &gpmc_onenand_device.dev; |
292 |
+@@ -393,15 +393,17 @@ void gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data) |
293 |
+ if (err < 0) { |
294 |
+ dev_err(dev, "Cannot request GPMC CS %d, error %d\n", |
295 |
+ gpmc_onenand_data->cs, err); |
296 |
+- return; |
297 |
++ return err; |
298 |
+ } |
299 |
+ |
300 |
+ gpmc_onenand_resource.end = gpmc_onenand_resource.start + |
301 |
+ ONENAND_IO_SIZE - 1; |
302 |
+ |
303 |
+- if (platform_device_register(&gpmc_onenand_device) < 0) { |
304 |
++ err = platform_device_register(&gpmc_onenand_device); |
305 |
++ if (err) { |
306 |
+ dev_err(dev, "Unable to register OneNAND device\n"); |
307 |
+ gpmc_cs_free(gpmc_onenand_data->cs); |
308 |
+- return; |
309 |
+ } |
310 |
++ |
311 |
++ return err; |
312 |
+ } |
313 |
+diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
314 |
+index 1cc4a6f3954e..bca54154e14f 100644 |
315 |
+--- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
316 |
++++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c |
317 |
+@@ -3828,16 +3828,20 @@ static struct omap_hwmod_ocp_if *omap3xxx_dss_hwmod_ocp_ifs[] __initdata = { |
318 |
+ * Return: 0 if device named @dev_name is not likely to be accessible, |
319 |
+ * or 1 if it is likely to be accessible. |
320 |
+ */ |
321 |
+-static int __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus, |
322 |
+- const char *dev_name) |
323 |
++static bool __init omap3xxx_hwmod_is_hs_ip_block_usable(struct device_node *bus, |
324 |
++ const char *dev_name) |
325 |
+ { |
326 |
++ struct device_node *node; |
327 |
++ bool available; |
328 |
++ |
329 |
+ if (!bus) |
330 |
+- return (omap_type() == OMAP2_DEVICE_TYPE_GP) ? 1 : 0; |
331 |
++ return omap_type() == OMAP2_DEVICE_TYPE_GP; |
332 |
+ |
333 |
+- if (of_device_is_available(of_find_node_by_name(bus, dev_name))) |
334 |
+- return 1; |
335 |
++ node = of_get_child_by_name(bus, dev_name); |
336 |
++ available = of_device_is_available(node); |
337 |
++ of_node_put(node); |
338 |
+ |
339 |
+- return 0; |
340 |
++ return available; |
341 |
+ } |
342 |
+ |
343 |
+ int __init omap3xxx_hwmod_init(void) |
344 |
+@@ -3906,15 +3910,20 @@ int __init omap3xxx_hwmod_init(void) |
345 |
+ |
346 |
+ if (h_sham && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "sham")) { |
347 |
+ r = omap_hwmod_register_links(h_sham); |
348 |
+- if (r < 0) |
349 |
++ if (r < 0) { |
350 |
++ of_node_put(bus); |
351 |
+ return r; |
352 |
++ } |
353 |
+ } |
354 |
+ |
355 |
+ if (h_aes && omap3xxx_hwmod_is_hs_ip_block_usable(bus, "aes")) { |
356 |
+ r = omap_hwmod_register_links(h_aes); |
357 |
+- if (r < 0) |
358 |
++ if (r < 0) { |
359 |
++ of_node_put(bus); |
360 |
+ return r; |
361 |
++ } |
362 |
+ } |
363 |
++ of_node_put(bus); |
364 |
+ |
365 |
+ /* |
366 |
+ * Register hwmod links specific to certain ES levels of a |
367 |
+diff --git a/arch/arm64/include/asm/kvm_arm.h b/arch/arm64/include/asm/kvm_arm.h |
368 |
+index 2a2752b5b6aa..0dbc1c6ab7dc 100644 |
369 |
+--- a/arch/arm64/include/asm/kvm_arm.h |
370 |
++++ b/arch/arm64/include/asm/kvm_arm.h |
371 |
+@@ -170,8 +170,7 @@ |
372 |
+ #define VTCR_EL2_FLAGS (VTCR_EL2_COMMON_BITS | VTCR_EL2_TGRAN_FLAGS) |
373 |
+ #define VTTBR_X (VTTBR_X_TGRAN_MAGIC - VTCR_EL2_T0SZ_IPA) |
374 |
+ |
375 |
+-#define VTTBR_BADDR_SHIFT (VTTBR_X - 1) |
376 |
+-#define VTTBR_BADDR_MASK (((UL(1) << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_BADDR_SHIFT) |
377 |
++#define VTTBR_BADDR_MASK (((UL(1) << (PHYS_MASK_SHIFT - VTTBR_X)) - 1) << VTTBR_X) |
378 |
+ #define VTTBR_VMID_SHIFT (UL(48)) |
379 |
+ #define VTTBR_VMID_MASK(size) (_AT(u64, (1 << size) - 1) << VTTBR_VMID_SHIFT) |
380 |
+ |
381 |
+diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c |
382 |
+index 01753cd7d3f0..0e7394915c70 100644 |
383 |
+--- a/arch/arm64/kernel/process.c |
384 |
++++ b/arch/arm64/kernel/process.c |
385 |
+@@ -255,6 +255,15 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, |
386 |
+ |
387 |
+ memset(&p->thread.cpu_context, 0, sizeof(struct cpu_context)); |
388 |
+ |
389 |
++ /* |
390 |
++ * In case p was allocated the same task_struct pointer as some |
391 |
++ * other recently-exited task, make sure p is disassociated from |
392 |
++ * any cpu that may have run that now-exited task recently. |
393 |
++ * Otherwise we could erroneously skip reloading the FPSIMD |
394 |
++ * registers for p. |
395 |
++ */ |
396 |
++ fpsimd_flush_task_state(p); |
397 |
++ |
398 |
+ if (likely(!(p->flags & PF_KTHREAD))) { |
399 |
+ *childregs = *current_pt_regs(); |
400 |
+ childregs->regs[0] = 0; |
401 |
+diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c |
402 |
+index a204adf29f0a..85baadab02d3 100644 |
403 |
+--- a/arch/arm64/kvm/handle_exit.c |
404 |
++++ b/arch/arm64/kvm/handle_exit.c |
405 |
+@@ -125,7 +125,19 @@ static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu, struct kvm_run *run) |
406 |
+ return ret; |
407 |
+ } |
408 |
+ |
409 |
++static int kvm_handle_unknown_ec(struct kvm_vcpu *vcpu, struct kvm_run *run) |
410 |
++{ |
411 |
++ u32 hsr = kvm_vcpu_get_hsr(vcpu); |
412 |
++ |
413 |
++ kvm_pr_unimpl("Unknown exception class: hsr: %#08x -- %s\n", |
414 |
++ hsr, esr_get_class_string(hsr)); |
415 |
++ |
416 |
++ kvm_inject_undefined(vcpu); |
417 |
++ return 1; |
418 |
++} |
419 |
++ |
420 |
+ static exit_handle_fn arm_exit_handlers[] = { |
421 |
++ [0 ... ESR_ELx_EC_MAX] = kvm_handle_unknown_ec, |
422 |
+ [ESR_ELx_EC_WFx] = kvm_handle_wfx, |
423 |
+ [ESR_ELx_EC_CP15_32] = kvm_handle_cp15_32, |
424 |
+ [ESR_ELx_EC_CP15_64] = kvm_handle_cp15_64, |
425 |
+@@ -151,13 +163,6 @@ static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu) |
426 |
+ u32 hsr = kvm_vcpu_get_hsr(vcpu); |
427 |
+ u8 hsr_ec = ESR_ELx_EC(hsr); |
428 |
+ |
429 |
+- if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) || |
430 |
+- !arm_exit_handlers[hsr_ec]) { |
431 |
+- kvm_err("Unknown exception class: hsr: %#08x -- %s\n", |
432 |
+- hsr, esr_get_class_string(hsr)); |
433 |
+- BUG(); |
434 |
+- } |
435 |
+- |
436 |
+ return arm_exit_handlers[hsr_ec]; |
437 |
+ } |
438 |
+ |
439 |
+diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile |
440 |
+index 617dece67924..a60c9c6e5cc1 100644 |
441 |
+--- a/arch/powerpc/Makefile |
442 |
++++ b/arch/powerpc/Makefile |
443 |
+@@ -72,8 +72,15 @@ GNUTARGET := powerpc |
444 |
+ MULTIPLEWORD := -mmultiple |
445 |
+ endif |
446 |
+ |
447 |
+-cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) |
448 |
++ifdef CONFIG_PPC64 |
449 |
++cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) |
450 |
++cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) |
451 |
++aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) |
452 |
++aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 |
453 |
++endif |
454 |
++ |
455 |
+ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian |
456 |
++cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) |
457 |
+ ifneq ($(cc-name),clang) |
458 |
+ cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align |
459 |
+ endif |
460 |
+@@ -113,7 +120,9 @@ ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y) |
461 |
+ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) |
462 |
+ AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) |
463 |
+ else |
464 |
++CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) |
465 |
+ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) |
466 |
++AFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) |
467 |
+ endif |
468 |
+ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) |
469 |
+ CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) |
470 |
+diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h |
471 |
+index 1e8fceb308a5..a67bb09585f4 100644 |
472 |
+--- a/arch/powerpc/include/asm/checksum.h |
473 |
++++ b/arch/powerpc/include/asm/checksum.h |
474 |
+@@ -100,7 +100,7 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) |
475 |
+ |
476 |
+ #ifdef __powerpc64__ |
477 |
+ res += (__force u64)addend; |
478 |
+- return (__force __wsum)((u32)res + (res >> 32)); |
479 |
++ return (__force __wsum) from64to32(res); |
480 |
+ #else |
481 |
+ asm("addc %0,%0,%1;" |
482 |
+ "addze %0,%0;" |
483 |
+diff --git a/arch/powerpc/kernel/cpu_setup_power.S b/arch/powerpc/kernel/cpu_setup_power.S |
484 |
+index 7803756998e2..9e05c8828ee2 100644 |
485 |
+--- a/arch/powerpc/kernel/cpu_setup_power.S |
486 |
++++ b/arch/powerpc/kernel/cpu_setup_power.S |
487 |
+@@ -97,6 +97,7 @@ _GLOBAL(__setup_cpu_power9) |
488 |
+ beqlr |
489 |
+ li r0,0 |
490 |
+ mtspr SPRN_LPID,r0 |
491 |
++ mtspr SPRN_PID,r0 |
492 |
+ mfspr r3,SPRN_LPCR |
493 |
+ LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) |
494 |
+ or r3, r3, r4 |
495 |
+@@ -119,6 +120,7 @@ _GLOBAL(__restore_cpu_power9) |
496 |
+ beqlr |
497 |
+ li r0,0 |
498 |
+ mtspr SPRN_LPID,r0 |
499 |
++ mtspr SPRN_PID,r0 |
500 |
+ mfspr r3,SPRN_LPCR |
501 |
+ LOAD_REG_IMMEDIATE(r4, LPCR_PECEDH | LPCR_PECE_HVEE | LPCR_HVICE) |
502 |
+ or r3, r3, r4 |
503 |
+diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c |
504 |
+index 9a25dce87875..44c33ee397a0 100644 |
505 |
+--- a/arch/powerpc/mm/pgtable-radix.c |
506 |
++++ b/arch/powerpc/mm/pgtable-radix.c |
507 |
+@@ -173,6 +173,10 @@ static void __init radix_init_pgtable(void) |
508 |
+ */ |
509 |
+ register_process_table(__pa(process_tb), 0, PRTB_SIZE_SHIFT - 12); |
510 |
+ pr_info("Process table %p and radix root for kernel: %p\n", process_tb, init_mm.pgd); |
511 |
++ asm volatile("ptesync" : : : "memory"); |
512 |
++ asm volatile(PPC_TLBIE_5(%0,%1,2,1,1) : : |
513 |
++ "r" (TLBIEL_INVAL_SET_LPID), "r" (0)); |
514 |
++ asm volatile("eieio; tlbsync; ptesync" : : : "memory"); |
515 |
+ } |
516 |
+ |
517 |
+ static void __init radix_init_partition_table(void) |
518 |
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c |
519 |
+index dcdfee0cd4f2..f602307a4386 100644 |
520 |
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c |
521 |
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c |
522 |
+@@ -2623,6 +2623,9 @@ static long pnv_pci_ioda2_table_alloc_pages(int nid, __u64 bus_offset, |
523 |
+ level_shift = entries_shift + 3; |
524 |
+ level_shift = max_t(unsigned, level_shift, PAGE_SHIFT); |
525 |
+ |
526 |
++ if ((level_shift - 3) * levels + page_shift >= 60) |
527 |
++ return -EINVAL; |
528 |
++ |
529 |
+ /* Allocate TCE table */ |
530 |
+ addr = pnv_pci_ioda2_table_do_alloc_pages(nid, level_shift, |
531 |
+ levels, tce_table_size, &offset, &total_allocated); |
532 |
+diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c |
533 |
+index ada29eaed6e2..f523ac883150 100644 |
534 |
+--- a/arch/powerpc/sysdev/axonram.c |
535 |
++++ b/arch/powerpc/sysdev/axonram.c |
536 |
+@@ -274,7 +274,9 @@ static int axon_ram_probe(struct platform_device *device) |
537 |
+ if (bank->disk->major > 0) |
538 |
+ unregister_blkdev(bank->disk->major, |
539 |
+ bank->disk->disk_name); |
540 |
+- del_gendisk(bank->disk); |
541 |
++ if (bank->disk->flags & GENHD_FL_UP) |
542 |
++ del_gendisk(bank->disk); |
543 |
++ put_disk(bank->disk); |
544 |
+ } |
545 |
+ device->dev.platform_data = NULL; |
546 |
+ if (bank->io_addr != 0) |
547 |
+@@ -299,6 +301,7 @@ axon_ram_remove(struct platform_device *device) |
548 |
+ device_remove_file(&device->dev, &dev_attr_ecc); |
549 |
+ free_irq(bank->irq_id, device); |
550 |
+ del_gendisk(bank->disk); |
551 |
++ put_disk(bank->disk); |
552 |
+ iounmap((void __iomem *) bank->io_addr); |
553 |
+ kfree(bank); |
554 |
+ |
555 |
+diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S |
556 |
+index 9b59e6212d8f..709da452413d 100644 |
557 |
+--- a/arch/s390/kernel/syscalls.S |
558 |
++++ b/arch/s390/kernel/syscalls.S |
559 |
+@@ -369,10 +369,10 @@ SYSCALL(sys_recvmmsg,compat_sys_recvmmsg) |
560 |
+ SYSCALL(sys_sendmmsg,compat_sys_sendmmsg) |
561 |
+ SYSCALL(sys_socket,sys_socket) |
562 |
+ SYSCALL(sys_socketpair,compat_sys_socketpair) /* 360 */ |
563 |
+-SYSCALL(sys_bind,sys_bind) |
564 |
+-SYSCALL(sys_connect,sys_connect) |
565 |
++SYSCALL(sys_bind,compat_sys_bind) |
566 |
++SYSCALL(sys_connect,compat_sys_connect) |
567 |
+ SYSCALL(sys_listen,sys_listen) |
568 |
+-SYSCALL(sys_accept4,sys_accept4) |
569 |
++SYSCALL(sys_accept4,compat_sys_accept4) |
570 |
+ SYSCALL(sys_getsockopt,compat_sys_getsockopt) /* 365 */ |
571 |
+ SYSCALL(sys_setsockopt,compat_sys_setsockopt) |
572 |
+ SYSCALL(sys_getsockname,compat_sys_getsockname) |
573 |
+diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c |
574 |
+index e18435355c16..c2905a10cb37 100644 |
575 |
+--- a/arch/s390/kvm/priv.c |
576 |
++++ b/arch/s390/kvm/priv.c |
577 |
+@@ -197,8 +197,6 @@ static int try_handle_skey(struct kvm_vcpu *vcpu) |
578 |
+ VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); |
579 |
+ return -EAGAIN; |
580 |
+ } |
581 |
+- if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
582 |
+- return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
583 |
+ return 0; |
584 |
+ } |
585 |
+ |
586 |
+@@ -209,6 +207,9 @@ static int handle_iske(struct kvm_vcpu *vcpu) |
587 |
+ int reg1, reg2; |
588 |
+ int rc; |
589 |
+ |
590 |
++ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
591 |
++ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
592 |
++ |
593 |
+ rc = try_handle_skey(vcpu); |
594 |
+ if (rc) |
595 |
+ return rc != -EAGAIN ? rc : 0; |
596 |
+@@ -238,6 +239,9 @@ static int handle_rrbe(struct kvm_vcpu *vcpu) |
597 |
+ int reg1, reg2; |
598 |
+ int rc; |
599 |
+ |
600 |
++ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
601 |
++ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
602 |
++ |
603 |
+ rc = try_handle_skey(vcpu); |
604 |
+ if (rc) |
605 |
+ return rc != -EAGAIN ? rc : 0; |
606 |
+@@ -273,6 +277,9 @@ static int handle_sske(struct kvm_vcpu *vcpu) |
607 |
+ int reg1, reg2; |
608 |
+ int rc; |
609 |
+ |
610 |
++ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) |
611 |
++ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); |
612 |
++ |
613 |
+ rc = try_handle_skey(vcpu); |
614 |
+ if (rc) |
615 |
+ return rc != -EAGAIN ? rc : 0; |
616 |
+diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c |
617 |
+index 57154c638e71..0f183ffe3416 100644 |
618 |
+--- a/arch/sparc/mm/init_64.c |
619 |
++++ b/arch/sparc/mm/init_64.c |
620 |
+@@ -2391,9 +2391,16 @@ void __init mem_init(void) |
621 |
+ { |
622 |
+ high_memory = __va(last_valid_pfn << PAGE_SHIFT); |
623 |
+ |
624 |
+- register_page_bootmem_info(); |
625 |
+ free_all_bootmem(); |
626 |
+ |
627 |
++ /* |
628 |
++ * Must be done after boot memory is put on freelist, because here we |
629 |
++ * might set fields in deferred struct pages that have not yet been |
630 |
++ * initialized, and free_all_bootmem() initializes all the reserved |
631 |
++ * deferred pages for us. |
632 |
++ */ |
633 |
++ register_page_bootmem_info(); |
634 |
++ |
635 |
+ /* |
636 |
+ * Set up the zero page, mark it reserved, so that page count |
637 |
+ * is not manipulated when freeing the page from user ptes. |
638 |
+diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h |
639 |
+index bdde80731f49..cbd1d44da2d3 100644 |
640 |
+--- a/arch/x86/include/asm/kvm_host.h |
641 |
++++ b/arch/x86/include/asm/kvm_host.h |
642 |
+@@ -1397,4 +1397,7 @@ static inline int kvm_cpu_get_apicid(int mps_cpu) |
643 |
+ #endif |
644 |
+ } |
645 |
+ |
646 |
++void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
647 |
++ unsigned long start, unsigned long end); |
648 |
++ |
649 |
+ #endif /* _ASM_X86_KVM_HOST_H */ |
650 |
+diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c |
651 |
+index 932348fbb6ea..9512529e8eab 100644 |
652 |
+--- a/arch/x86/kernel/hpet.c |
653 |
++++ b/arch/x86/kernel/hpet.c |
654 |
+@@ -354,7 +354,7 @@ static int hpet_resume(struct clock_event_device *evt, int timer) |
655 |
+ |
656 |
+ irq_domain_deactivate_irq(irq_get_irq_data(hdev->irq)); |
657 |
+ irq_domain_activate_irq(irq_get_irq_data(hdev->irq)); |
658 |
+- disable_irq(hdev->irq); |
659 |
++ disable_hardirq(hdev->irq); |
660 |
+ irq_set_affinity(hdev->irq, cpumask_of(hdev->cpu)); |
661 |
+ enable_irq(hdev->irq); |
662 |
+ } |
663 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
664 |
+index f0d3de153e29..9aa62ab13ae8 100644 |
665 |
+--- a/arch/x86/kvm/vmx.c |
666 |
++++ b/arch/x86/kvm/vmx.c |
667 |
+@@ -6413,12 +6413,7 @@ static __init int hardware_setup(void) |
668 |
+ memset(vmx_vmread_bitmap, 0xff, PAGE_SIZE); |
669 |
+ memset(vmx_vmwrite_bitmap, 0xff, PAGE_SIZE); |
670 |
+ |
671 |
+- /* |
672 |
+- * Allow direct access to the PC debug port (it is often used for I/O |
673 |
+- * delays, but the vmexits simply slow things down). |
674 |
+- */ |
675 |
+ memset(vmx_io_bitmap_a, 0xff, PAGE_SIZE); |
676 |
+- clear_bit(0x80, vmx_io_bitmap_a); |
677 |
+ |
678 |
+ memset(vmx_io_bitmap_b, 0xff, PAGE_SIZE); |
679 |
+ |
680 |
+@@ -7208,9 +7203,8 @@ static int handle_vmoff(struct kvm_vcpu *vcpu) |
681 |
+ static int handle_vmclear(struct kvm_vcpu *vcpu) |
682 |
+ { |
683 |
+ struct vcpu_vmx *vmx = to_vmx(vcpu); |
684 |
++ u32 zero = 0; |
685 |
+ gpa_t vmptr; |
686 |
+- struct vmcs12 *vmcs12; |
687 |
+- struct page *page; |
688 |
+ |
689 |
+ if (!nested_vmx_check_permission(vcpu)) |
690 |
+ return 1; |
691 |
+@@ -7221,22 +7215,9 @@ static int handle_vmclear(struct kvm_vcpu *vcpu) |
692 |
+ if (vmptr == vmx->nested.current_vmptr) |
693 |
+ nested_release_vmcs12(vmx); |
694 |
+ |
695 |
+- page = nested_get_page(vcpu, vmptr); |
696 |
+- if (page == NULL) { |
697 |
+- /* |
698 |
+- * For accurate processor emulation, VMCLEAR beyond available |
699 |
+- * physical memory should do nothing at all. However, it is |
700 |
+- * possible that a nested vmx bug, not a guest hypervisor bug, |
701 |
+- * resulted in this case, so let's shut down before doing any |
702 |
+- * more damage: |
703 |
+- */ |
704 |
+- kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); |
705 |
+- return 1; |
706 |
+- } |
707 |
+- vmcs12 = kmap(page); |
708 |
+- vmcs12->launch_state = 0; |
709 |
+- kunmap(page); |
710 |
+- nested_release_page(page); |
711 |
++ kvm_vcpu_write_guest(vcpu, |
712 |
++ vmptr + offsetof(struct vmcs12, launch_state), |
713 |
++ &zero, sizeof(zero)); |
714 |
+ |
715 |
+ nested_free_vmcs02(vmx, vmptr); |
716 |
+ |
717 |
+@@ -10903,8 +10884,10 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason, |
718 |
+ */ |
719 |
+ static void vmx_leave_nested(struct kvm_vcpu *vcpu) |
720 |
+ { |
721 |
+- if (is_guest_mode(vcpu)) |
722 |
++ if (is_guest_mode(vcpu)) { |
723 |
++ to_vmx(vcpu)->nested.nested_run_pending = 0; |
724 |
+ nested_vmx_vmexit(vcpu, -1, 0, 0); |
725 |
++ } |
726 |
+ free_nested(to_vmx(vcpu)); |
727 |
+ } |
728 |
+ |
729 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
730 |
+index 02d45296a97c..26b580ad268f 100644 |
731 |
+--- a/arch/x86/kvm/x86.c |
732 |
++++ b/arch/x86/kvm/x86.c |
733 |
+@@ -6526,6 +6526,20 @@ static void kvm_vcpu_flush_tlb(struct kvm_vcpu *vcpu) |
734 |
+ kvm_x86_ops->tlb_flush(vcpu); |
735 |
+ } |
736 |
+ |
737 |
++void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
738 |
++ unsigned long start, unsigned long end) |
739 |
++{ |
740 |
++ unsigned long apic_address; |
741 |
++ |
742 |
++ /* |
743 |
++ * The physical address of apic access page is stored in the VMCS. |
744 |
++ * Update it when it becomes invalid. |
745 |
++ */ |
746 |
++ apic_address = gfn_to_hva(kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); |
747 |
++ if (start <= apic_address && apic_address < end) |
748 |
++ kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD); |
749 |
++} |
750 |
++ |
751 |
+ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) |
752 |
+ { |
753 |
+ struct page *page = NULL; |
754 |
+diff --git a/arch/x86/pci/broadcom_bus.c b/arch/x86/pci/broadcom_bus.c |
755 |
+index bb461cfd01ab..526536c81ddc 100644 |
756 |
+--- a/arch/x86/pci/broadcom_bus.c |
757 |
++++ b/arch/x86/pci/broadcom_bus.c |
758 |
+@@ -97,7 +97,7 @@ static int __init broadcom_postcore_init(void) |
759 |
+ * We should get host bridge information from ACPI unless the BIOS |
760 |
+ * doesn't support it. |
761 |
+ */ |
762 |
+- if (acpi_os_get_root_pointer()) |
763 |
++ if (!acpi_disabled && acpi_os_get_root_pointer()) |
764 |
+ return 0; |
765 |
+ #endif |
766 |
+ |
767 |
+diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c |
768 |
+index 9e42842e924a..0f0175186f1b 100644 |
769 |
+--- a/arch/x86/platform/uv/tlb_uv.c |
770 |
++++ b/arch/x86/platform/uv/tlb_uv.c |
771 |
+@@ -1848,7 +1848,6 @@ static void pq_init(int node, int pnode) |
772 |
+ |
773 |
+ ops.write_payload_first(pnode, first); |
774 |
+ ops.write_payload_last(pnode, last); |
775 |
+- ops.write_g_sw_ack(pnode, 0xffffUL); |
776 |
+ |
777 |
+ /* in effect, all msg_type's are set to MSG_NOOP */ |
778 |
+ memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE); |
779 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
780 |
+index b1c76aa73492..23daf40be371 100644 |
781 |
+--- a/block/blk-core.c |
782 |
++++ b/block/blk-core.c |
783 |
+@@ -527,8 +527,8 @@ void blk_set_queue_dying(struct request_queue *q) |
784 |
+ |
785 |
+ blk_queue_for_each_rl(rl, q) { |
786 |
+ if (rl->rq_pool) { |
787 |
+- wake_up(&rl->wait[BLK_RW_SYNC]); |
788 |
+- wake_up(&rl->wait[BLK_RW_ASYNC]); |
789 |
++ wake_up_all(&rl->wait[BLK_RW_SYNC]); |
790 |
++ wake_up_all(&rl->wait[BLK_RW_ASYNC]); |
791 |
+ } |
792 |
+ } |
793 |
+ } |
794 |
+diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c |
795 |
+index 01fb455d3377..8c0894e0713b 100644 |
796 |
+--- a/block/blk-mq-sysfs.c |
797 |
++++ b/block/blk-mq-sysfs.c |
798 |
+@@ -429,7 +429,7 @@ void blk_mq_hctx_kobj_init(struct blk_mq_hw_ctx *hctx) |
799 |
+ kobject_init(&hctx->kobj, &blk_mq_hw_ktype); |
800 |
+ } |
801 |
+ |
802 |
+-static void blk_mq_sysfs_init(struct request_queue *q) |
803 |
++void blk_mq_sysfs_init(struct request_queue *q) |
804 |
+ { |
805 |
+ struct blk_mq_ctx *ctx; |
806 |
+ int cpu; |
807 |
+@@ -449,8 +449,6 @@ int blk_mq_register_dev(struct device *dev, struct request_queue *q) |
808 |
+ |
809 |
+ blk_mq_disable_hotplug(); |
810 |
+ |
811 |
+- blk_mq_sysfs_init(q); |
812 |
+- |
813 |
+ ret = kobject_add(&q->mq_kobj, kobject_get(&dev->kobj), "%s", "mq"); |
814 |
+ if (ret < 0) |
815 |
+ goto out; |
816 |
+diff --git a/block/blk-mq.c b/block/blk-mq.c |
817 |
+index 7b597ec4e9c5..10f8f94b7f20 100644 |
818 |
+--- a/block/blk-mq.c |
819 |
++++ b/block/blk-mq.c |
820 |
+@@ -1707,7 +1707,6 @@ static void blk_mq_init_cpu_queues(struct request_queue *q, |
821 |
+ struct blk_mq_ctx *__ctx = per_cpu_ptr(q->queue_ctx, i); |
822 |
+ struct blk_mq_hw_ctx *hctx; |
823 |
+ |
824 |
+- memset(__ctx, 0, sizeof(*__ctx)); |
825 |
+ __ctx->cpu = i; |
826 |
+ spin_lock_init(&__ctx->lock); |
827 |
+ INIT_LIST_HEAD(&__ctx->rq_list); |
828 |
+@@ -1970,6 +1969,9 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set, |
829 |
+ if (!q->queue_ctx) |
830 |
+ goto err_exit; |
831 |
+ |
832 |
++ /* init q->mq_kobj and sw queues' kobjects */ |
833 |
++ blk_mq_sysfs_init(q); |
834 |
++ |
835 |
+ q->queue_hw_ctx = kzalloc_node(nr_cpu_ids * sizeof(*(q->queue_hw_ctx)), |
836 |
+ GFP_KERNEL, set->numa_node); |
837 |
+ if (!q->queue_hw_ctx) |
838 |
+diff --git a/block/blk-mq.h b/block/blk-mq.h |
839 |
+index e5d25249028c..c55bcf67b956 100644 |
840 |
+--- a/block/blk-mq.h |
841 |
++++ b/block/blk-mq.h |
842 |
+@@ -50,6 +50,7 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q, |
843 |
+ /* |
844 |
+ * sysfs helpers |
845 |
+ */ |
846 |
++extern void blk_mq_sysfs_init(struct request_queue *q); |
847 |
+ extern int blk_mq_sysfs_register(struct request_queue *q); |
848 |
+ extern void blk_mq_sysfs_unregister(struct request_queue *q); |
849 |
+ extern void blk_mq_hctx_kobj_init(struct blk_mq_hw_ctx *hctx); |
850 |
+diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c |
851 |
+index 2ffd69769466..5a37962d2199 100644 |
852 |
+--- a/crypto/asymmetric_keys/pkcs7_verify.c |
853 |
++++ b/crypto/asymmetric_keys/pkcs7_verify.c |
854 |
+@@ -150,7 +150,7 @@ static int pkcs7_find_key(struct pkcs7_message *pkcs7, |
855 |
+ pr_devel("Sig %u: Found cert serial match X.509[%u]\n", |
856 |
+ sinfo->index, certix); |
857 |
+ |
858 |
+- if (x509->pub->pkey_algo != sinfo->sig->pkey_algo) { |
859 |
++ if (strcmp(x509->pub->pkey_algo, sinfo->sig->pkey_algo) != 0) { |
860 |
+ pr_warn("Sig %u: X.509 algo and PKCS#7 sig algo don't match\n", |
861 |
+ sinfo->index); |
862 |
+ continue; |
863 |
+diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c |
864 |
+index c80765b211cf..029f7051f2be 100644 |
865 |
+--- a/crypto/asymmetric_keys/x509_cert_parser.c |
866 |
++++ b/crypto/asymmetric_keys/x509_cert_parser.c |
867 |
+@@ -408,6 +408,8 @@ int x509_extract_key_data(void *context, size_t hdrlen, |
868 |
+ ctx->cert->pub->pkey_algo = "rsa"; |
869 |
+ |
870 |
+ /* Discard the BIT STRING metadata */ |
871 |
++ if (vlen < 1 || *(const u8 *)value != 0) |
872 |
++ return -EBADMSG; |
873 |
+ ctx->key = value + 1; |
874 |
+ ctx->key_size = vlen - 1; |
875 |
+ return 0; |
876 |
+diff --git a/crypto/asymmetric_keys/x509_public_key.c b/crypto/asymmetric_keys/x509_public_key.c |
877 |
+index fb732296cd36..e16009a8da9c 100644 |
878 |
+--- a/crypto/asymmetric_keys/x509_public_key.c |
879 |
++++ b/crypto/asymmetric_keys/x509_public_key.c |
880 |
+@@ -125,7 +125,7 @@ int x509_check_for_self_signed(struct x509_certificate *cert) |
881 |
+ } |
882 |
+ |
883 |
+ ret = -EKEYREJECTED; |
884 |
+- if (cert->pub->pkey_algo != cert->sig->pkey_algo) |
885 |
++ if (strcmp(cert->pub->pkey_algo, cert->sig->pkey_algo) != 0) |
886 |
+ goto out; |
887 |
+ |
888 |
+ ret = public_key_verify_signature(cert->pub, cert->sig); |
889 |
+diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c |
890 |
+index 051b6158d1b7..8d22acdf90f0 100644 |
891 |
+--- a/drivers/ata/libata-sff.c |
892 |
++++ b/drivers/ata/libata-sff.c |
893 |
+@@ -1481,7 +1481,6 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc) |
894 |
+ break; |
895 |
+ |
896 |
+ default: |
897 |
+- WARN_ON_ONCE(1); |
898 |
+ return AC_ERR_SYSTEM; |
899 |
+ } |
900 |
+ |
901 |
+diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c |
902 |
+index 5fc81e240c24..e55f418d6ab9 100644 |
903 |
+--- a/drivers/atm/horizon.c |
904 |
++++ b/drivers/atm/horizon.c |
905 |
+@@ -2802,7 +2802,7 @@ static int hrz_probe(struct pci_dev *pci_dev, |
906 |
+ return err; |
907 |
+ |
908 |
+ out_free_irq: |
909 |
+- free_irq(dev->irq, dev); |
910 |
++ free_irq(irq, dev); |
911 |
+ out_free: |
912 |
+ kfree(dev); |
913 |
+ out_release: |
914 |
+diff --git a/drivers/base/isa.c b/drivers/base/isa.c |
915 |
+index cd6ccdcf9df0..372d10af2600 100644 |
916 |
+--- a/drivers/base/isa.c |
917 |
++++ b/drivers/base/isa.c |
918 |
+@@ -39,7 +39,7 @@ static int isa_bus_probe(struct device *dev) |
919 |
+ { |
920 |
+ struct isa_driver *isa_driver = dev->platform_data; |
921 |
+ |
922 |
+- if (isa_driver->probe) |
923 |
++ if (isa_driver && isa_driver->probe) |
924 |
+ return isa_driver->probe(dev, to_isa_dev(dev)->id); |
925 |
+ |
926 |
+ return 0; |
927 |
+@@ -49,7 +49,7 @@ static int isa_bus_remove(struct device *dev) |
928 |
+ { |
929 |
+ struct isa_driver *isa_driver = dev->platform_data; |
930 |
+ |
931 |
+- if (isa_driver->remove) |
932 |
++ if (isa_driver && isa_driver->remove) |
933 |
+ return isa_driver->remove(dev, to_isa_dev(dev)->id); |
934 |
+ |
935 |
+ return 0; |
936 |
+@@ -59,7 +59,7 @@ static void isa_bus_shutdown(struct device *dev) |
937 |
+ { |
938 |
+ struct isa_driver *isa_driver = dev->platform_data; |
939 |
+ |
940 |
+- if (isa_driver->shutdown) |
941 |
++ if (isa_driver && isa_driver->shutdown) |
942 |
+ isa_driver->shutdown(dev, to_isa_dev(dev)->id); |
943 |
+ } |
944 |
+ |
945 |
+@@ -67,7 +67,7 @@ static int isa_bus_suspend(struct device *dev, pm_message_t state) |
946 |
+ { |
947 |
+ struct isa_driver *isa_driver = dev->platform_data; |
948 |
+ |
949 |
+- if (isa_driver->suspend) |
950 |
++ if (isa_driver && isa_driver->suspend) |
951 |
+ return isa_driver->suspend(dev, to_isa_dev(dev)->id, state); |
952 |
+ |
953 |
+ return 0; |
954 |
+@@ -77,7 +77,7 @@ static int isa_bus_resume(struct device *dev) |
955 |
+ { |
956 |
+ struct isa_driver *isa_driver = dev->platform_data; |
957 |
+ |
958 |
+- if (isa_driver->resume) |
959 |
++ if (isa_driver && isa_driver->resume) |
960 |
+ return isa_driver->resume(dev, to_isa_dev(dev)->id); |
961 |
+ |
962 |
+ return 0; |
963 |
+diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c |
964 |
+index c9914d653968..b7c0b69a02f5 100644 |
965 |
+--- a/drivers/block/zram/zram_drv.c |
966 |
++++ b/drivers/block/zram/zram_drv.c |
967 |
+@@ -1286,6 +1286,8 @@ static int zram_add(void) |
968 |
+ blk_queue_io_min(zram->disk->queue, PAGE_SIZE); |
969 |
+ blk_queue_io_opt(zram->disk->queue, PAGE_SIZE); |
970 |
+ zram->disk->queue->limits.discard_granularity = PAGE_SIZE; |
971 |
++ zram->disk->queue->limits.max_sectors = SECTORS_PER_PAGE; |
972 |
++ zram->disk->queue->limits.chunk_sectors = 0; |
973 |
+ blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX); |
974 |
+ /* |
975 |
+ * zram_bio_discard() will clear all logical blocks if logical block |
976 |
+diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c |
977 |
+index 890082315054..10f56133b281 100644 |
978 |
+--- a/drivers/bus/arm-cci.c |
979 |
++++ b/drivers/bus/arm-cci.c |
980 |
+@@ -1755,14 +1755,17 @@ static int cci_pmu_probe(struct platform_device *pdev) |
981 |
+ raw_spin_lock_init(&cci_pmu->hw_events.pmu_lock); |
982 |
+ mutex_init(&cci_pmu->reserve_mutex); |
983 |
+ atomic_set(&cci_pmu->active_events, 0); |
984 |
+- cpumask_set_cpu(smp_processor_id(), &cci_pmu->cpus); |
985 |
++ cpumask_set_cpu(get_cpu(), &cci_pmu->cpus); |
986 |
+ |
987 |
+ ret = cci_pmu_init(cci_pmu, pdev); |
988 |
+- if (ret) |
989 |
++ if (ret) { |
990 |
++ put_cpu(); |
991 |
+ return ret; |
992 |
++ } |
993 |
+ |
994 |
+ cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCI_ONLINE, |
995 |
+ &cci_pmu->node); |
996 |
++ put_cpu(); |
997 |
+ pr_info("ARM %s PMU driver probed", cci_pmu->model->name); |
998 |
+ return 0; |
999 |
+ } |
1000 |
+diff --git a/drivers/bus/arm-ccn.c b/drivers/bus/arm-ccn.c |
1001 |
+index aee83462b796..f0249899fc96 100644 |
1002 |
+--- a/drivers/bus/arm-ccn.c |
1003 |
++++ b/drivers/bus/arm-ccn.c |
1004 |
+@@ -1271,6 +1271,10 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
1005 |
+ int len = snprintf(NULL, 0, "ccn_%d", ccn->dt.id); |
1006 |
+ |
1007 |
+ name = devm_kzalloc(ccn->dev, len + 1, GFP_KERNEL); |
1008 |
++ if (!name) { |
1009 |
++ err = -ENOMEM; |
1010 |
++ goto error_choose_name; |
1011 |
++ } |
1012 |
+ snprintf(name, len + 1, "ccn_%d", ccn->dt.id); |
1013 |
+ } |
1014 |
+ |
1015 |
+@@ -1297,7 +1301,7 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
1016 |
+ } |
1017 |
+ |
1018 |
+ /* Pick one CPU which we will use to collect data from CCN... */ |
1019 |
+- cpumask_set_cpu(smp_processor_id(), &ccn->dt.cpu); |
1020 |
++ cpumask_set_cpu(get_cpu(), &ccn->dt.cpu); |
1021 |
+ |
1022 |
+ /* Also make sure that the overflow interrupt is handled by this CPU */ |
1023 |
+ if (ccn->irq) { |
1024 |
+@@ -1314,10 +1318,13 @@ static int arm_ccn_pmu_init(struct arm_ccn *ccn) |
1025 |
+ |
1026 |
+ cpuhp_state_add_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE, |
1027 |
+ &ccn->dt.node); |
1028 |
++ put_cpu(); |
1029 |
+ return 0; |
1030 |
+ |
1031 |
+ error_pmu_register: |
1032 |
+ error_set_affinity: |
1033 |
++ put_cpu(); |
1034 |
++error_choose_name: |
1035 |
+ ida_simple_remove(&arm_ccn_pmu_ida, ccn->dt.id); |
1036 |
+ for (i = 0; i < ccn->num_xps; i++) |
1037 |
+ writel(0, ccn->xp[i].base + CCN_XP_DT_CONTROL); |
1038 |
+@@ -1578,8 +1585,8 @@ static int __init arm_ccn_init(void) |
1039 |
+ |
1040 |
+ static void __exit arm_ccn_exit(void) |
1041 |
+ { |
1042 |
+- cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE); |
1043 |
+ platform_driver_unregister(&arm_ccn_driver); |
1044 |
++ cpuhp_remove_multi_state(CPUHP_AP_PERF_ARM_CCN_ONLINE); |
1045 |
+ } |
1046 |
+ |
1047 |
+ module_init(arm_ccn_init); |
1048 |
+diff --git a/drivers/clk/uniphier/clk-uniphier-sys.c b/drivers/clk/uniphier/clk-uniphier-sys.c |
1049 |
+index 5d029991047d..481225adef87 100644 |
1050 |
+--- a/drivers/clk/uniphier/clk-uniphier-sys.c |
1051 |
++++ b/drivers/clk/uniphier/clk-uniphier-sys.c |
1052 |
+@@ -98,7 +98,7 @@ const struct uniphier_clk_data uniphier_sld8_sys_clk_data[] = { |
1053 |
+ const struct uniphier_clk_data uniphier_pro5_sys_clk_data[] = { |
1054 |
+ UNIPHIER_CLK_FACTOR("spll", -1, "ref", 120, 1), /* 2400 MHz */ |
1055 |
+ UNIPHIER_CLK_FACTOR("dapll1", -1, "ref", 128, 1), /* 2560 MHz */ |
1056 |
+- UNIPHIER_CLK_FACTOR("dapll2", -1, "ref", 144, 125), /* 2949.12 MHz */ |
1057 |
++ UNIPHIER_CLK_FACTOR("dapll2", -1, "dapll1", 144, 125), /* 2949.12 MHz */ |
1058 |
+ UNIPHIER_CLK_FACTOR("uart", 0, "dapll2", 1, 40), |
1059 |
+ UNIPHIER_CLK_FACTOR("i2c", 1, "spll", 1, 48), |
1060 |
+ UNIPHIER_PRO5_SYS_CLK_SD, |
1061 |
+diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c |
1062 |
+index dce1af0ce85c..a668286d62cb 100644 |
1063 |
+--- a/drivers/crypto/s5p-sss.c |
1064 |
++++ b/drivers/crypto/s5p-sss.c |
1065 |
+@@ -805,8 +805,9 @@ static int s5p_aes_probe(struct platform_device *pdev) |
1066 |
+ dev_warn(dev, "feed control interrupt is not available.\n"); |
1067 |
+ goto err_irq; |
1068 |
+ } |
1069 |
+- err = devm_request_irq(dev, pdata->irq_fc, s5p_aes_interrupt, |
1070 |
+- IRQF_SHARED, pdev->name, pdev); |
1071 |
++ err = devm_request_threaded_irq(dev, pdata->irq_fc, NULL, |
1072 |
++ s5p_aes_interrupt, IRQF_ONESHOT, |
1073 |
++ pdev->name, pdev); |
1074 |
+ if (err < 0) { |
1075 |
+ dev_warn(dev, "feed control interrupt is not available.\n"); |
1076 |
+ goto err_irq; |
1077 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
1078 |
+index e2d323fa2437..1c8d79d93098 100644 |
1079 |
+--- a/drivers/crypto/talitos.c |
1080 |
++++ b/drivers/crypto/talitos.c |
1081 |
+@@ -1232,12 +1232,11 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1082 |
+ sg_link_tbl_len += authsize; |
1083 |
+ } |
1084 |
+ |
1085 |
+- sg_count = talitos_sg_map(dev, areq->src, cryptlen, edesc, |
1086 |
+- &desc->ptr[4], sg_count, areq->assoclen, |
1087 |
+- tbl_off); |
1088 |
++ ret = talitos_sg_map(dev, areq->src, sg_link_tbl_len, edesc, |
1089 |
++ &desc->ptr[4], sg_count, areq->assoclen, tbl_off); |
1090 |
+ |
1091 |
+- if (sg_count > 1) { |
1092 |
+- tbl_off += sg_count; |
1093 |
++ if (ret > 1) { |
1094 |
++ tbl_off += ret; |
1095 |
+ sync_needed = true; |
1096 |
+ } |
1097 |
+ |
1098 |
+@@ -1248,14 +1247,15 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1099 |
+ dma_map_sg(dev, areq->dst, sg_count, DMA_FROM_DEVICE); |
1100 |
+ } |
1101 |
+ |
1102 |
+- sg_count = talitos_sg_map(dev, areq->dst, cryptlen, edesc, |
1103 |
+- &desc->ptr[5], sg_count, areq->assoclen, |
1104 |
+- tbl_off); |
1105 |
++ ret = talitos_sg_map(dev, areq->dst, cryptlen, edesc, &desc->ptr[5], |
1106 |
++ sg_count, areq->assoclen, tbl_off); |
1107 |
+ |
1108 |
+ if (desc->hdr & DESC_HDR_TYPE_IPSEC_ESP) |
1109 |
+ to_talitos_ptr_ext_or(&desc->ptr[5], authsize, is_sec1); |
1110 |
+ |
1111 |
+- if (sg_count > 1) { |
1112 |
++ /* ICV data */ |
1113 |
++ if (ret > 1) { |
1114 |
++ tbl_off += ret; |
1115 |
+ edesc->icv_ool = true; |
1116 |
+ sync_needed = true; |
1117 |
+ |
1118 |
+@@ -1265,9 +1265,7 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1119 |
+ sizeof(struct talitos_ptr) + authsize; |
1120 |
+ |
1121 |
+ /* Add an entry to the link table for ICV data */ |
1122 |
+- tbl_ptr += sg_count - 1; |
1123 |
+- to_talitos_ptr_ext_set(tbl_ptr, 0, is_sec1); |
1124 |
+- tbl_ptr++; |
1125 |
++ to_talitos_ptr_ext_set(tbl_ptr - 1, 0, is_sec1); |
1126 |
+ to_talitos_ptr_ext_set(tbl_ptr, DESC_PTR_LNKTBL_RETURN, |
1127 |
+ is_sec1); |
1128 |
+ to_talitos_ptr_len(tbl_ptr, authsize, is_sec1); |
1129 |
+@@ -1275,18 +1273,33 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, |
1130 |
+ /* icv data follows link tables */ |
1131 |
+ to_talitos_ptr(tbl_ptr, edesc->dma_link_tbl + offset, |
1132 |
+ is_sec1); |
1133 |
++ } else { |
1134 |
++ dma_addr_t addr = edesc->dma_link_tbl; |
1135 |
++ |
1136 |
++ if (is_sec1) |
1137 |
++ addr += areq->assoclen + cryptlen; |
1138 |
++ else |
1139 |
++ addr += sizeof(struct talitos_ptr) * tbl_off; |
1140 |
++ |
1141 |
++ to_talitos_ptr(&desc->ptr[6], addr, is_sec1); |
1142 |
++ to_talitos_ptr_len(&desc->ptr[6], authsize, is_sec1); |
1143 |
++ } |
1144 |
++ } else if (!(desc->hdr & DESC_HDR_TYPE_IPSEC_ESP)) { |
1145 |
++ ret = talitos_sg_map(dev, areq->dst, authsize, edesc, |
1146 |
++ &desc->ptr[6], sg_count, areq->assoclen + |
1147 |
++ cryptlen, |
1148 |
++ tbl_off); |
1149 |
++ if (ret > 1) { |
1150 |
++ tbl_off += ret; |
1151 |
++ edesc->icv_ool = true; |
1152 |
++ sync_needed = true; |
1153 |
++ } else { |
1154 |
++ edesc->icv_ool = false; |
1155 |
+ } |
1156 |
+ } else { |
1157 |
+ edesc->icv_ool = false; |
1158 |
+ } |
1159 |
+ |
1160 |
+- /* ICV data */ |
1161 |
+- if (!(desc->hdr & DESC_HDR_TYPE_IPSEC_ESP)) { |
1162 |
+- to_talitos_ptr_len(&desc->ptr[6], authsize, is_sec1); |
1163 |
+- to_talitos_ptr(&desc->ptr[6], edesc->dma_link_tbl + |
1164 |
+- areq->assoclen + cryptlen, is_sec1); |
1165 |
+- } |
1166 |
+- |
1167 |
+ /* iv out */ |
1168 |
+ if (desc->hdr & DESC_HDR_TYPE_IPSEC_ESP) |
1169 |
+ map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv, |
1170 |
+@@ -1494,12 +1507,20 @@ static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, |
1171 |
+ const u8 *key, unsigned int keylen) |
1172 |
+ { |
1173 |
+ struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); |
1174 |
++ u32 tmp[DES_EXPKEY_WORDS]; |
1175 |
+ |
1176 |
+ if (keylen > TALITOS_MAX_KEY_SIZE) { |
1177 |
+ crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); |
1178 |
+ return -EINVAL; |
1179 |
+ } |
1180 |
+ |
1181 |
++ if (unlikely(crypto_ablkcipher_get_flags(cipher) & |
1182 |
++ CRYPTO_TFM_REQ_WEAK_KEY) && |
1183 |
++ !des_ekey(tmp, key)) { |
1184 |
++ crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_WEAK_KEY); |
1185 |
++ return -EINVAL; |
1186 |
++ } |
1187 |
++ |
1188 |
+ memcpy(&ctx->key, key, keylen); |
1189 |
+ ctx->keylen = keylen; |
1190 |
+ |
1191 |
+@@ -2614,7 +2635,7 @@ static struct talitos_alg_template driver_algs[] = { |
1192 |
+ .ivsize = AES_BLOCK_SIZE, |
1193 |
+ } |
1194 |
+ }, |
1195 |
+- .desc_hdr_template = DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU | |
1196 |
++ .desc_hdr_template = DESC_HDR_TYPE_AESU_CTR_NONSNOOP | |
1197 |
+ DESC_HDR_SEL0_AESU | |
1198 |
+ DESC_HDR_MODE0_AESU_CTR, |
1199 |
+ }, |
1200 |
+@@ -3047,6 +3068,11 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev, |
1201 |
+ t_alg->algt.alg.aead.setkey = aead_setkey; |
1202 |
+ t_alg->algt.alg.aead.encrypt = aead_encrypt; |
1203 |
+ t_alg->algt.alg.aead.decrypt = aead_decrypt; |
1204 |
++ if (!(priv->features & TALITOS_FTR_SHA224_HWINIT) && |
1205 |
++ !strncmp(alg->cra_name, "authenc(hmac(sha224)", 20)) { |
1206 |
++ kfree(t_alg); |
1207 |
++ return ERR_PTR(-ENOTSUPP); |
1208 |
++ } |
1209 |
+ break; |
1210 |
+ case CRYPTO_ALG_TYPE_AHASH: |
1211 |
+ alg = &t_alg->algt.alg.hash.halg.base; |
1212 |
+diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c |
1213 |
+index 72e07e3cf718..16e0eb523439 100644 |
1214 |
+--- a/drivers/edac/i5000_edac.c |
1215 |
++++ b/drivers/edac/i5000_edac.c |
1216 |
+@@ -227,7 +227,7 @@ |
1217 |
+ #define NREC_RDWR(x) (((x)>>11) & 1) |
1218 |
+ #define NREC_RANK(x) (((x)>>8) & 0x7) |
1219 |
+ #define NRECMEMB 0xC0 |
1220 |
+-#define NREC_CAS(x) (((x)>>16) & 0xFFFFFF) |
1221 |
++#define NREC_CAS(x) (((x)>>16) & 0xFFF) |
1222 |
+ #define NREC_RAS(x) ((x) & 0x7FFF) |
1223 |
+ #define NRECFGLOG 0xC4 |
1224 |
+ #define NREEECFBDA 0xC8 |
1225 |
+@@ -371,7 +371,7 @@ struct i5000_error_info { |
1226 |
+ /* These registers are input ONLY if there was a |
1227 |
+ * Non-Recoverable Error */ |
1228 |
+ u16 nrecmema; /* Non-Recoverable Mem log A */ |
1229 |
+- u16 nrecmemb; /* Non-Recoverable Mem log B */ |
1230 |
++ u32 nrecmemb; /* Non-Recoverable Mem log B */ |
1231 |
+ |
1232 |
+ }; |
1233 |
+ |
1234 |
+@@ -407,7 +407,7 @@ static void i5000_get_error_info(struct mem_ctl_info *mci, |
1235 |
+ NERR_FAT_FBD, &info->nerr_fat_fbd); |
1236 |
+ pci_read_config_word(pvt->branchmap_werrors, |
1237 |
+ NRECMEMA, &info->nrecmema); |
1238 |
+- pci_read_config_word(pvt->branchmap_werrors, |
1239 |
++ pci_read_config_dword(pvt->branchmap_werrors, |
1240 |
+ NRECMEMB, &info->nrecmemb); |
1241 |
+ |
1242 |
+ /* Clear the error bits, by writing them back */ |
1243 |
+@@ -1293,7 +1293,7 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) |
1244 |
+ dimm->mtype = MEM_FB_DDR2; |
1245 |
+ |
1246 |
+ /* ask what device type on this row */ |
1247 |
+- if (MTR_DRAM_WIDTH(mtr)) |
1248 |
++ if (MTR_DRAM_WIDTH(mtr) == 8) |
1249 |
+ dimm->dtype = DEV_X8; |
1250 |
+ else |
1251 |
+ dimm->dtype = DEV_X4; |
1252 |
+diff --git a/drivers/edac/i5400_edac.c b/drivers/edac/i5400_edac.c |
1253 |
+index 6ef6ad1ba16e..2ea2f32e608b 100644 |
1254 |
+--- a/drivers/edac/i5400_edac.c |
1255 |
++++ b/drivers/edac/i5400_edac.c |
1256 |
+@@ -368,7 +368,7 @@ struct i5400_error_info { |
1257 |
+ |
1258 |
+ /* These registers are input ONLY if there was a Non-Rec Error */ |
1259 |
+ u16 nrecmema; /* Non-Recoverable Mem log A */ |
1260 |
+- u16 nrecmemb; /* Non-Recoverable Mem log B */ |
1261 |
++ u32 nrecmemb; /* Non-Recoverable Mem log B */ |
1262 |
+ |
1263 |
+ }; |
1264 |
+ |
1265 |
+@@ -458,7 +458,7 @@ static void i5400_get_error_info(struct mem_ctl_info *mci, |
1266 |
+ NERR_FAT_FBD, &info->nerr_fat_fbd); |
1267 |
+ pci_read_config_word(pvt->branchmap_werrors, |
1268 |
+ NRECMEMA, &info->nrecmema); |
1269 |
+- pci_read_config_word(pvt->branchmap_werrors, |
1270 |
++ pci_read_config_dword(pvt->branchmap_werrors, |
1271 |
+ NRECMEMB, &info->nrecmemb); |
1272 |
+ |
1273 |
+ /* Clear the error bits, by writing them back */ |
1274 |
+@@ -1207,13 +1207,14 @@ static int i5400_init_dimms(struct mem_ctl_info *mci) |
1275 |
+ |
1276 |
+ dimm->nr_pages = size_mb << 8; |
1277 |
+ dimm->grain = 8; |
1278 |
+- dimm->dtype = MTR_DRAM_WIDTH(mtr) ? DEV_X8 : DEV_X4; |
1279 |
++ dimm->dtype = MTR_DRAM_WIDTH(mtr) == 8 ? |
1280 |
++ DEV_X8 : DEV_X4; |
1281 |
+ dimm->mtype = MEM_FB_DDR2; |
1282 |
+ /* |
1283 |
+ * The eccc mechanism is SDDC (aka SECC), with |
1284 |
+ * is similar to Chipkill. |
1285 |
+ */ |
1286 |
+- dimm->edac_mode = MTR_DRAM_WIDTH(mtr) ? |
1287 |
++ dimm->edac_mode = MTR_DRAM_WIDTH(mtr) == 8 ? |
1288 |
+ EDAC_S8ECD8ED : EDAC_S4ECD4ED; |
1289 |
+ ndimms++; |
1290 |
+ } |
1291 |
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c |
1292 |
+index a4944e22f294..2f48f848865f 100644 |
1293 |
+--- a/drivers/firmware/efi/efi.c |
1294 |
++++ b/drivers/firmware/efi/efi.c |
1295 |
+@@ -120,8 +120,7 @@ static ssize_t systab_show(struct kobject *kobj, |
1296 |
+ return str - buf; |
1297 |
+ } |
1298 |
+ |
1299 |
+-static struct kobj_attribute efi_attr_systab = |
1300 |
+- __ATTR(systab, 0400, systab_show, NULL); |
1301 |
++static struct kobj_attribute efi_attr_systab = __ATTR_RO_MODE(systab, 0400); |
1302 |
+ |
1303 |
+ #define EFI_FIELD(var) efi.var |
1304 |
+ |
1305 |
+diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c |
1306 |
+index 14914074f716..307ec1c11276 100644 |
1307 |
+--- a/drivers/firmware/efi/esrt.c |
1308 |
++++ b/drivers/firmware/efi/esrt.c |
1309 |
+@@ -106,7 +106,7 @@ static const struct sysfs_ops esre_attr_ops = { |
1310 |
+ }; |
1311 |
+ |
1312 |
+ /* Generic ESRT Entry ("ESRE") support. */ |
1313 |
+-static ssize_t esre_fw_class_show(struct esre_entry *entry, char *buf) |
1314 |
++static ssize_t fw_class_show(struct esre_entry *entry, char *buf) |
1315 |
+ { |
1316 |
+ char *str = buf; |
1317 |
+ |
1318 |
+@@ -117,18 +117,16 @@ static ssize_t esre_fw_class_show(struct esre_entry *entry, char *buf) |
1319 |
+ return str - buf; |
1320 |
+ } |
1321 |
+ |
1322 |
+-static struct esre_attribute esre_fw_class = __ATTR(fw_class, 0400, |
1323 |
+- esre_fw_class_show, NULL); |
1324 |
++static struct esre_attribute esre_fw_class = __ATTR_RO_MODE(fw_class, 0400); |
1325 |
+ |
1326 |
+ #define esre_attr_decl(name, size, fmt) \ |
1327 |
+-static ssize_t esre_##name##_show(struct esre_entry *entry, char *buf) \ |
1328 |
++static ssize_t name##_show(struct esre_entry *entry, char *buf) \ |
1329 |
+ { \ |
1330 |
+ return sprintf(buf, fmt "\n", \ |
1331 |
+ le##size##_to_cpu(entry->esre.esre1->name)); \ |
1332 |
+ } \ |
1333 |
+ \ |
1334 |
+-static struct esre_attribute esre_##name = __ATTR(name, 0400, \ |
1335 |
+- esre_##name##_show, NULL) |
1336 |
++static struct esre_attribute esre_##name = __ATTR_RO_MODE(name, 0400) |
1337 |
+ |
1338 |
+ esre_attr_decl(fw_type, 32, "%u"); |
1339 |
+ esre_attr_decl(fw_version, 32, "%u"); |
1340 |
+@@ -193,14 +191,13 @@ static int esre_create_sysfs_entry(void *esre, int entry_num) |
1341 |
+ |
1342 |
+ /* support for displaying ESRT fields at the top level */ |
1343 |
+ #define esrt_attr_decl(name, size, fmt) \ |
1344 |
+-static ssize_t esrt_##name##_show(struct kobject *kobj, \ |
1345 |
++static ssize_t name##_show(struct kobject *kobj, \ |
1346 |
+ struct kobj_attribute *attr, char *buf)\ |
1347 |
+ { \ |
1348 |
+ return sprintf(buf, fmt "\n", le##size##_to_cpu(esrt->name)); \ |
1349 |
+ } \ |
1350 |
+ \ |
1351 |
+-static struct kobj_attribute esrt_##name = __ATTR(name, 0400, \ |
1352 |
+- esrt_##name##_show, NULL) |
1353 |
++static struct kobj_attribute esrt_##name = __ATTR_RO_MODE(name, 0400) |
1354 |
+ |
1355 |
+ esrt_attr_decl(fw_resource_count, 32, "%u"); |
1356 |
+ esrt_attr_decl(fw_resource_count_max, 32, "%u"); |
1357 |
+@@ -431,7 +428,7 @@ static int __init esrt_sysfs_init(void) |
1358 |
+ err_remove_esrt: |
1359 |
+ kobject_put(esrt_kobj); |
1360 |
+ err: |
1361 |
+- kfree(esrt); |
1362 |
++ memunmap(esrt); |
1363 |
+ esrt = NULL; |
1364 |
+ return error; |
1365 |
+ } |
1366 |
+diff --git a/drivers/firmware/efi/runtime-map.c b/drivers/firmware/efi/runtime-map.c |
1367 |
+index 8e64b77aeac9..f377609ff141 100644 |
1368 |
+--- a/drivers/firmware/efi/runtime-map.c |
1369 |
++++ b/drivers/firmware/efi/runtime-map.c |
1370 |
+@@ -63,11 +63,11 @@ static ssize_t map_attr_show(struct kobject *kobj, struct attribute *attr, |
1371 |
+ return map_attr->show(entry, buf); |
1372 |
+ } |
1373 |
+ |
1374 |
+-static struct map_attribute map_type_attr = __ATTR_RO(type); |
1375 |
+-static struct map_attribute map_phys_addr_attr = __ATTR_RO(phys_addr); |
1376 |
+-static struct map_attribute map_virt_addr_attr = __ATTR_RO(virt_addr); |
1377 |
+-static struct map_attribute map_num_pages_attr = __ATTR_RO(num_pages); |
1378 |
+-static struct map_attribute map_attribute_attr = __ATTR_RO(attribute); |
1379 |
++static struct map_attribute map_type_attr = __ATTR_RO_MODE(type, 0400); |
1380 |
++static struct map_attribute map_phys_addr_attr = __ATTR_RO_MODE(phys_addr, 0400); |
1381 |
++static struct map_attribute map_virt_addr_attr = __ATTR_RO_MODE(virt_addr, 0400); |
1382 |
++static struct map_attribute map_num_pages_attr = __ATTR_RO_MODE(num_pages, 0400); |
1383 |
++static struct map_attribute map_attribute_attr = __ATTR_RO_MODE(attribute, 0400); |
1384 |
+ |
1385 |
+ /* |
1386 |
+ * These are default attributes that are added for every memmap entry. |
1387 |
+diff --git a/drivers/gpio/gpio-altera.c b/drivers/gpio/gpio-altera.c |
1388 |
+index 5bddbd507ca9..3fe6a21e05a5 100644 |
1389 |
+--- a/drivers/gpio/gpio-altera.c |
1390 |
++++ b/drivers/gpio/gpio-altera.c |
1391 |
+@@ -90,21 +90,18 @@ static int altera_gpio_irq_set_type(struct irq_data *d, |
1392 |
+ |
1393 |
+ altera_gc = gpiochip_get_data(irq_data_get_irq_chip_data(d)); |
1394 |
+ |
1395 |
+- if (type == IRQ_TYPE_NONE) |
1396 |
++ if (type == IRQ_TYPE_NONE) { |
1397 |
++ irq_set_handler_locked(d, handle_bad_irq); |
1398 |
+ return 0; |
1399 |
+- if (type == IRQ_TYPE_LEVEL_HIGH && |
1400 |
+- altera_gc->interrupt_trigger == IRQ_TYPE_LEVEL_HIGH) |
1401 |
+- return 0; |
1402 |
+- if (type == IRQ_TYPE_EDGE_RISING && |
1403 |
+- altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_RISING) |
1404 |
+- return 0; |
1405 |
+- if (type == IRQ_TYPE_EDGE_FALLING && |
1406 |
+- altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_FALLING) |
1407 |
+- return 0; |
1408 |
+- if (type == IRQ_TYPE_EDGE_BOTH && |
1409 |
+- altera_gc->interrupt_trigger == IRQ_TYPE_EDGE_BOTH) |
1410 |
++ } |
1411 |
++ if (type == altera_gc->interrupt_trigger) { |
1412 |
++ if (type == IRQ_TYPE_LEVEL_HIGH) |
1413 |
++ irq_set_handler_locked(d, handle_level_irq); |
1414 |
++ else |
1415 |
++ irq_set_handler_locked(d, handle_simple_irq); |
1416 |
+ return 0; |
1417 |
+- |
1418 |
++ } |
1419 |
++ irq_set_handler_locked(d, handle_bad_irq); |
1420 |
+ return -EINVAL; |
1421 |
+ } |
1422 |
+ |
1423 |
+@@ -230,7 +227,6 @@ static void altera_gpio_irq_edge_handler(struct irq_desc *desc) |
1424 |
+ chained_irq_exit(chip, desc); |
1425 |
+ } |
1426 |
+ |
1427 |
+- |
1428 |
+ static void altera_gpio_irq_leveL_high_handler(struct irq_desc *desc) |
1429 |
+ { |
1430 |
+ struct altera_gpio_chip *altera_gc; |
1431 |
+@@ -310,7 +306,7 @@ static int altera_gpio_probe(struct platform_device *pdev) |
1432 |
+ altera_gc->interrupt_trigger = reg; |
1433 |
+ |
1434 |
+ ret = gpiochip_irqchip_add(&altera_gc->mmchip.gc, &altera_irq_chip, 0, |
1435 |
+- handle_simple_irq, IRQ_TYPE_NONE); |
1436 |
++ handle_bad_irq, IRQ_TYPE_NONE); |
1437 |
+ |
1438 |
+ if (ret) { |
1439 |
+ dev_err(&pdev->dev, "could not add irqchip\n"); |
1440 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1441 |
+index e41d4baebf86..ce9797b6f9c7 100644 |
1442 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1443 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |
1444 |
+@@ -2020,8 +2020,11 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon) |
1445 |
+ } |
1446 |
+ |
1447 |
+ r = amdgpu_late_init(adev); |
1448 |
+- if (r) |
1449 |
++ if (r) { |
1450 |
++ if (fbcon) |
1451 |
++ console_unlock(); |
1452 |
+ return r; |
1453 |
++ } |
1454 |
+ |
1455 |
+ /* pin cursors */ |
1456 |
+ list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
1457 |
+diff --git a/drivers/gpu/drm/armada/Makefile b/drivers/gpu/drm/armada/Makefile |
1458 |
+index 26412d2f8c98..ffd673615772 100644 |
1459 |
+--- a/drivers/gpu/drm/armada/Makefile |
1460 |
++++ b/drivers/gpu/drm/armada/Makefile |
1461 |
+@@ -4,5 +4,3 @@ armada-y += armada_510.o |
1462 |
+ armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o |
1463 |
+ |
1464 |
+ obj-$(CONFIG_DRM_ARMADA) := armada.o |
1465 |
+- |
1466 |
+-CFLAGS_armada_trace.o := -I$(src) |
1467 |
+diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1468 |
+index f2ae72ba7d5a..2abc47b554ab 100644 |
1469 |
+--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1470 |
++++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c |
1471 |
+@@ -246,6 +246,15 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, |
1472 |
+ if (IS_ERR(exynos_gem)) |
1473 |
+ return exynos_gem; |
1474 |
+ |
1475 |
++ if (!is_drm_iommu_supported(dev) && (flags & EXYNOS_BO_NONCONTIG)) { |
1476 |
++ /* |
1477 |
++ * when no IOMMU is available, all allocated buffers are |
1478 |
++ * contiguous anyway, so drop EXYNOS_BO_NONCONTIG flag |
1479 |
++ */ |
1480 |
++ flags &= ~EXYNOS_BO_NONCONTIG; |
1481 |
++ DRM_WARN("Non-contiguous allocation is not supported without IOMMU, falling back to contiguous buffer\n"); |
1482 |
++ } |
1483 |
++ |
1484 |
+ /* set memory type and cache attribute from user side. */ |
1485 |
+ exynos_gem->flags = flags; |
1486 |
+ |
1487 |
+diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig |
1488 |
+index cd4599c0523b..db607d51ee2b 100644 |
1489 |
+--- a/drivers/hid/Kconfig |
1490 |
++++ b/drivers/hid/Kconfig |
1491 |
+@@ -175,11 +175,11 @@ config HID_CHERRY |
1492 |
+ Support for Cherry Cymotion keyboard. |
1493 |
+ |
1494 |
+ config HID_CHICONY |
1495 |
+- tristate "Chicony Tactical pad" |
1496 |
++ tristate "Chicony devices" |
1497 |
+ depends on HID |
1498 |
+ default !EXPERT |
1499 |
+ ---help--- |
1500 |
+- Support for Chicony Tactical pad. |
1501 |
++ Support for Chicony Tactical pad and special keys on Chicony keyboards. |
1502 |
+ |
1503 |
+ config HID_CORSAIR |
1504 |
+ tristate "Corsair devices" |
1505 |
+diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c |
1506 |
+index bc3cec199fee..f04ed9aabc3f 100644 |
1507 |
+--- a/drivers/hid/hid-chicony.c |
1508 |
++++ b/drivers/hid/hid-chicony.c |
1509 |
+@@ -86,6 +86,7 @@ static const struct hid_device_id ch_devices[] = { |
1510 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
1511 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, |
1512 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, |
1513 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, |
1514 |
+ { } |
1515 |
+ }; |
1516 |
+ MODULE_DEVICE_TABLE(hid, ch_devices); |
1517 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
1518 |
+index 4f3f5749b0c1..bdde8859e191 100644 |
1519 |
+--- a/drivers/hid/hid-core.c |
1520 |
++++ b/drivers/hid/hid-core.c |
1521 |
+@@ -1906,6 +1906,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
1522 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A081) }, |
1523 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A0C2) }, |
1524 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION, USB_DEVICE_ID_HUION_TABLET) }, |
1525 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_ZEN_AIO_KBD) }, |
1526 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_JESS2, USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD) }, |
1527 |
+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) }, |
1528 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) }, |
1529 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
1530 |
+index 08fd3f831d62..433d5f675c03 100644 |
1531 |
+--- a/drivers/hid/hid-ids.h |
1532 |
++++ b/drivers/hid/hid-ids.h |
1533 |
+@@ -558,6 +558,7 @@ |
1534 |
+ |
1535 |
+ #define USB_VENDOR_ID_JESS 0x0c45 |
1536 |
+ #define USB_DEVICE_ID_JESS_YUREX 0x1010 |
1537 |
++#define USB_DEVICE_ID_JESS_ZEN_AIO_KBD 0x5112 |
1538 |
+ |
1539 |
+ #define USB_VENDOR_ID_JESS2 0x0f30 |
1540 |
+ #define USB_DEVICE_ID_JESS2_COLOR_RUMBLE_PAD 0x0111 |
1541 |
+diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c |
1542 |
+index 8f11d347b3ec..c811af4c8d81 100644 |
1543 |
+--- a/drivers/i2c/busses/i2c-riic.c |
1544 |
++++ b/drivers/i2c/busses/i2c-riic.c |
1545 |
+@@ -218,8 +218,12 @@ static irqreturn_t riic_tend_isr(int irq, void *data) |
1546 |
+ } |
1547 |
+ |
1548 |
+ if (riic->is_last || riic->err) { |
1549 |
+- riic_clear_set_bit(riic, 0, ICIER_SPIE, RIIC_ICIER); |
1550 |
++ riic_clear_set_bit(riic, ICIER_TEIE, ICIER_SPIE, RIIC_ICIER); |
1551 |
+ writeb(ICCR2_SP, riic->base + RIIC_ICCR2); |
1552 |
++ } else { |
1553 |
++ /* Transfer is complete, but do not send STOP */ |
1554 |
++ riic_clear_set_bit(riic, ICIER_TEIE, 0, RIIC_ICIER); |
1555 |
++ complete(&riic->msg_done); |
1556 |
+ } |
1557 |
+ |
1558 |
+ return IRQ_HANDLED; |
1559 |
+diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c |
1560 |
+index c22454383976..709d6491d243 100644 |
1561 |
+--- a/drivers/infiniband/hw/mlx4/qp.c |
1562 |
++++ b/drivers/infiniband/hw/mlx4/qp.c |
1563 |
+@@ -1669,7 +1669,7 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp, |
1564 |
+ context->mtu_msgmax = (IB_MTU_4096 << 5) | |
1565 |
+ ilog2(dev->dev->caps.max_gso_sz); |
1566 |
+ else |
1567 |
+- context->mtu_msgmax = (IB_MTU_4096 << 5) | 12; |
1568 |
++ context->mtu_msgmax = (IB_MTU_4096 << 5) | 13; |
1569 |
+ } else if (attr_mask & IB_QP_PATH_MTU) { |
1570 |
+ if (attr->path_mtu < IB_MTU_256 || attr->path_mtu > IB_MTU_4096) { |
1571 |
+ pr_err("path MTU (%u) is invalid\n", |
1572 |
+diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c |
1573 |
+index 786f640fc462..a2120ff0ef4c 100644 |
1574 |
+--- a/drivers/infiniband/hw/mlx5/main.c |
1575 |
++++ b/drivers/infiniband/hw/mlx5/main.c |
1576 |
+@@ -2514,6 +2514,8 @@ static int create_umr_res(struct mlx5_ib_dev *dev) |
1577 |
+ qp->real_qp = qp; |
1578 |
+ qp->uobject = NULL; |
1579 |
+ qp->qp_type = MLX5_IB_QPT_REG_UMR; |
1580 |
++ qp->send_cq = init_attr->send_cq; |
1581 |
++ qp->recv_cq = init_attr->recv_cq; |
1582 |
+ |
1583 |
+ attr->qp_state = IB_QPS_INIT; |
1584 |
+ attr->port_num = 1; |
1585 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
1586 |
+index 002f8a421efa..88bbc8ccc5e3 100644 |
1587 |
+--- a/drivers/iommu/intel-iommu.c |
1588 |
++++ b/drivers/iommu/intel-iommu.c |
1589 |
+@@ -2245,10 +2245,12 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
1590 |
+ uint64_t tmp; |
1591 |
+ |
1592 |
+ if (!sg_res) { |
1593 |
++ unsigned int pgoff = sg->offset & ~PAGE_MASK; |
1594 |
++ |
1595 |
+ sg_res = aligned_nrpages(sg->offset, sg->length); |
1596 |
+- sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
1597 |
++ sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + pgoff; |
1598 |
+ sg->dma_length = sg->length; |
1599 |
+- pteval = page_to_phys(sg_page(sg)) | prot; |
1600 |
++ pteval = (sg_phys(sg) - pgoff) | prot; |
1601 |
+ phys_pfn = pteval >> VTD_PAGE_SHIFT; |
1602 |
+ } |
1603 |
+ |
1604 |
+@@ -3894,7 +3896,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, |
1605 |
+ |
1606 |
+ for_each_sg(sglist, sg, nelems, i) { |
1607 |
+ BUG_ON(!sg_page(sg)); |
1608 |
+- sg->dma_address = page_to_phys(sg_page(sg)) + sg->offset; |
1609 |
++ sg->dma_address = sg_phys(sg); |
1610 |
+ sg->dma_length = sg->length; |
1611 |
+ } |
1612 |
+ return nelems; |
1613 |
+diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c |
1614 |
+index 05bbf171df37..1070b7b959f2 100644 |
1615 |
+--- a/drivers/irqchip/irq-crossbar.c |
1616 |
++++ b/drivers/irqchip/irq-crossbar.c |
1617 |
+@@ -199,7 +199,7 @@ static const struct irq_domain_ops crossbar_domain_ops = { |
1618 |
+ static int __init crossbar_of_init(struct device_node *node) |
1619 |
+ { |
1620 |
+ int i, size, reserved = 0; |
1621 |
+- u32 max = 0, entry; |
1622 |
++ u32 max = 0, entry, reg_size; |
1623 |
+ const __be32 *irqsr; |
1624 |
+ int ret = -ENOMEM; |
1625 |
+ |
1626 |
+@@ -276,9 +276,9 @@ static int __init crossbar_of_init(struct device_node *node) |
1627 |
+ if (!cb->register_offsets) |
1628 |
+ goto err_irq_map; |
1629 |
+ |
1630 |
+- of_property_read_u32(node, "ti,reg-size", &size); |
1631 |
++ of_property_read_u32(node, "ti,reg-size", ®_size); |
1632 |
+ |
1633 |
+- switch (size) { |
1634 |
++ switch (reg_size) { |
1635 |
+ case 1: |
1636 |
+ cb->write = crossbar_writeb; |
1637 |
+ break; |
1638 |
+@@ -304,7 +304,7 @@ static int __init crossbar_of_init(struct device_node *node) |
1639 |
+ continue; |
1640 |
+ |
1641 |
+ cb->register_offsets[i] = reserved; |
1642 |
+- reserved += size; |
1643 |
++ reserved += reg_size; |
1644 |
+ } |
1645 |
+ |
1646 |
+ of_property_read_u32(node, "ti,irqs-safe-map", &cb->safe_map); |
1647 |
+diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c |
1648 |
+index 6ebe89551961..f4509ef9922b 100644 |
1649 |
+--- a/drivers/media/rc/lirc_dev.c |
1650 |
++++ b/drivers/media/rc/lirc_dev.c |
1651 |
+@@ -446,6 +446,8 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) |
1652 |
+ return -ERESTARTSYS; |
1653 |
+ |
1654 |
+ ir = irctls[iminor(inode)]; |
1655 |
++ mutex_unlock(&lirc_dev_lock); |
1656 |
++ |
1657 |
+ if (!ir) { |
1658 |
+ retval = -ENODEV; |
1659 |
+ goto error; |
1660 |
+@@ -486,8 +488,6 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file) |
1661 |
+ } |
1662 |
+ |
1663 |
+ error: |
1664 |
+- mutex_unlock(&lirc_dev_lock); |
1665 |
+- |
1666 |
+ nonseekable_open(inode, file); |
1667 |
+ |
1668 |
+ return retval; |
1669 |
+diff --git a/drivers/media/usb/dvb-usb/dibusb-common.c b/drivers/media/usb/dvb-usb/dibusb-common.c |
1670 |
+index 8207e6900656..bcacb0f22028 100644 |
1671 |
+--- a/drivers/media/usb/dvb-usb/dibusb-common.c |
1672 |
++++ b/drivers/media/usb/dvb-usb/dibusb-common.c |
1673 |
+@@ -223,8 +223,20 @@ EXPORT_SYMBOL(dibusb_i2c_algo); |
1674 |
+ |
1675 |
+ int dibusb_read_eeprom_byte(struct dvb_usb_device *d, u8 offs, u8 *val) |
1676 |
+ { |
1677 |
+- u8 wbuf[1] = { offs }; |
1678 |
+- return dibusb_i2c_msg(d, 0x50, wbuf, 1, val, 1); |
1679 |
++ u8 *buf; |
1680 |
++ int rc; |
1681 |
++ |
1682 |
++ buf = kmalloc(2, GFP_KERNEL); |
1683 |
++ if (!buf) |
1684 |
++ return -ENOMEM; |
1685 |
++ |
1686 |
++ buf[0] = offs; |
1687 |
++ |
1688 |
++ rc = dibusb_i2c_msg(d, 0x50, &buf[0], 1, &buf[1], 1); |
1689 |
++ *val = buf[1]; |
1690 |
++ kfree(buf); |
1691 |
++ |
1692 |
++ return rc; |
1693 |
+ } |
1694 |
+ EXPORT_SYMBOL(dibusb_read_eeprom_byte); |
1695 |
+ |
1696 |
+diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c |
1697 |
+index 5457c361ad58..bf0fe0137dfe 100644 |
1698 |
+--- a/drivers/memory/omap-gpmc.c |
1699 |
++++ b/drivers/memory/omap-gpmc.c |
1700 |
+@@ -1947,9 +1947,7 @@ static int gpmc_probe_onenand_child(struct platform_device *pdev, |
1701 |
+ if (!of_property_read_u32(child, "dma-channel", &val)) |
1702 |
+ gpmc_onenand_data->dma_channel = val; |
1703 |
+ |
1704 |
+- gpmc_onenand_init(gpmc_onenand_data); |
1705 |
+- |
1706 |
+- return 0; |
1707 |
++ return gpmc_onenand_init(gpmc_onenand_data); |
1708 |
+ } |
1709 |
+ #else |
1710 |
+ static int gpmc_probe_onenand_child(struct platform_device *pdev, |
1711 |
+diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c |
1712 |
+index 6749b1829469..4d01d7bc24ef 100644 |
1713 |
+--- a/drivers/net/can/ti_hecc.c |
1714 |
++++ b/drivers/net/can/ti_hecc.c |
1715 |
+@@ -652,6 +652,9 @@ static int ti_hecc_rx_poll(struct napi_struct *napi, int quota) |
1716 |
+ mbx_mask = hecc_read(priv, HECC_CANMIM); |
1717 |
+ mbx_mask |= HECC_TX_MBOX_MASK; |
1718 |
+ hecc_write(priv, HECC_CANMIM, mbx_mask); |
1719 |
++ } else { |
1720 |
++ /* repoll is done only if whole budget is used */ |
1721 |
++ num_pkts = quota; |
1722 |
+ } |
1723 |
+ |
1724 |
+ return num_pkts; |
1725 |
+diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c |
1726 |
+index b3d02759c226..b00358297424 100644 |
1727 |
+--- a/drivers/net/can/usb/ems_usb.c |
1728 |
++++ b/drivers/net/can/usb/ems_usb.c |
1729 |
+@@ -288,6 +288,8 @@ static void ems_usb_read_interrupt_callback(struct urb *urb) |
1730 |
+ |
1731 |
+ case -ECONNRESET: /* unlink */ |
1732 |
+ case -ENOENT: |
1733 |
++ case -EPIPE: |
1734 |
++ case -EPROTO: |
1735 |
+ case -ESHUTDOWN: |
1736 |
+ return; |
1737 |
+ |
1738 |
+diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c |
1739 |
+index 9fdb0f0bfa06..c6dcf93675c0 100644 |
1740 |
+--- a/drivers/net/can/usb/esd_usb2.c |
1741 |
++++ b/drivers/net/can/usb/esd_usb2.c |
1742 |
+@@ -393,6 +393,8 @@ static void esd_usb2_read_bulk_callback(struct urb *urb) |
1743 |
+ break; |
1744 |
+ |
1745 |
+ case -ENOENT: |
1746 |
++ case -EPIPE: |
1747 |
++ case -EPROTO: |
1748 |
+ case -ESHUTDOWN: |
1749 |
+ return; |
1750 |
+ |
1751 |
+diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c |
1752 |
+index 4224e066cb16..c9d61a6dfb7a 100644 |
1753 |
+--- a/drivers/net/can/usb/kvaser_usb.c |
1754 |
++++ b/drivers/net/can/usb/kvaser_usb.c |
1755 |
+@@ -609,8 +609,8 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb *dev, u8 id, |
1756 |
+ } |
1757 |
+ |
1758 |
+ if (pos + tmp->len > actual_len) { |
1759 |
+- dev_err(dev->udev->dev.parent, |
1760 |
+- "Format error\n"); |
1761 |
++ dev_err_ratelimited(dev->udev->dev.parent, |
1762 |
++ "Format error\n"); |
1763 |
+ break; |
1764 |
+ } |
1765 |
+ |
1766 |
+@@ -813,6 +813,7 @@ static int kvaser_usb_simple_msg_async(struct kvaser_usb_net_priv *priv, |
1767 |
+ if (err) { |
1768 |
+ netdev_err(netdev, "Error transmitting URB\n"); |
1769 |
+ usb_unanchor_urb(urb); |
1770 |
++ kfree(buf); |
1771 |
+ usb_free_urb(urb); |
1772 |
+ return err; |
1773 |
+ } |
1774 |
+@@ -1325,6 +1326,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
1775 |
+ case 0: |
1776 |
+ break; |
1777 |
+ case -ENOENT: |
1778 |
++ case -EPIPE: |
1779 |
++ case -EPROTO: |
1780 |
+ case -ESHUTDOWN: |
1781 |
+ return; |
1782 |
+ default: |
1783 |
+@@ -1333,7 +1336,7 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
1784 |
+ goto resubmit_urb; |
1785 |
+ } |
1786 |
+ |
1787 |
+- while (pos <= urb->actual_length - MSG_HEADER_LEN) { |
1788 |
++ while (pos <= (int)(urb->actual_length - MSG_HEADER_LEN)) { |
1789 |
+ msg = urb->transfer_buffer + pos; |
1790 |
+ |
1791 |
+ /* The Kvaser firmware can only read and write messages that |
1792 |
+@@ -1352,7 +1355,8 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb) |
1793 |
+ } |
1794 |
+ |
1795 |
+ if (pos + msg->len > urb->actual_length) { |
1796 |
+- dev_err(dev->udev->dev.parent, "Format error\n"); |
1797 |
++ dev_err_ratelimited(dev->udev->dev.parent, |
1798 |
++ "Format error\n"); |
1799 |
+ break; |
1800 |
+ } |
1801 |
+ |
1802 |
+@@ -1768,6 +1772,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff *skb, |
1803 |
+ spin_unlock_irqrestore(&priv->tx_contexts_lock, flags); |
1804 |
+ |
1805 |
+ usb_unanchor_urb(urb); |
1806 |
++ kfree(buf); |
1807 |
+ |
1808 |
+ stats->tx_dropped++; |
1809 |
+ |
1810 |
+diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c |
1811 |
+index d000cb62d6ae..27861c417c94 100644 |
1812 |
+--- a/drivers/net/can/usb/usb_8dev.c |
1813 |
++++ b/drivers/net/can/usb/usb_8dev.c |
1814 |
+@@ -524,6 +524,8 @@ static void usb_8dev_read_bulk_callback(struct urb *urb) |
1815 |
+ break; |
1816 |
+ |
1817 |
+ case -ENOENT: |
1818 |
++ case -EPIPE: |
1819 |
++ case -EPROTO: |
1820 |
+ case -ESHUTDOWN: |
1821 |
+ return; |
1822 |
+ |
1823 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1824 |
+index 4febe60eadc2..5d958b5bb8b1 100644 |
1825 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1826 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c |
1827 |
+@@ -13293,17 +13293,15 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev, |
1828 |
+ dev->vlan_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
1829 |
+ NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_HIGHDMA; |
1830 |
+ |
1831 |
+- /* VF with OLD Hypervisor or old PF do not support filtering */ |
1832 |
+ if (IS_PF(bp)) { |
1833 |
+ if (chip_is_e1x) |
1834 |
+ bp->accept_any_vlan = true; |
1835 |
+ else |
1836 |
+ dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
1837 |
+-#ifdef CONFIG_BNX2X_SRIOV |
1838 |
+- } else if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) { |
1839 |
+- dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
1840 |
+-#endif |
1841 |
+ } |
1842 |
++ /* For VF we'll know whether to enable VLAN filtering after |
1843 |
++ * getting a response to CHANNEL_TLV_ACQUIRE from PF. |
1844 |
++ */ |
1845 |
+ |
1846 |
+ dev->features |= dev->hw_features | NETIF_F_HW_VLAN_CTAG_RX; |
1847 |
+ dev->features |= NETIF_F_HIGHDMA; |
1848 |
+@@ -13735,7 +13733,7 @@ static int bnx2x_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb) |
1849 |
+ if (!netif_running(bp->dev)) { |
1850 |
+ DP(BNX2X_MSG_PTP, |
1851 |
+ "PTP adjfreq called while the interface is down\n"); |
1852 |
+- return -EFAULT; |
1853 |
++ return -ENETDOWN; |
1854 |
+ } |
1855 |
+ |
1856 |
+ if (ppb < 0) { |
1857 |
+@@ -13794,6 +13792,12 @@ static int bnx2x_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) |
1858 |
+ { |
1859 |
+ struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
1860 |
+ |
1861 |
++ if (!netif_running(bp->dev)) { |
1862 |
++ DP(BNX2X_MSG_PTP, |
1863 |
++ "PTP adjtime called while the interface is down\n"); |
1864 |
++ return -ENETDOWN; |
1865 |
++ } |
1866 |
++ |
1867 |
+ DP(BNX2X_MSG_PTP, "PTP adjtime called, delta = %llx\n", delta); |
1868 |
+ |
1869 |
+ timecounter_adjtime(&bp->timecounter, delta); |
1870 |
+@@ -13806,6 +13810,12 @@ static int bnx2x_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts) |
1871 |
+ struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
1872 |
+ u64 ns; |
1873 |
+ |
1874 |
++ if (!netif_running(bp->dev)) { |
1875 |
++ DP(BNX2X_MSG_PTP, |
1876 |
++ "PTP gettime called while the interface is down\n"); |
1877 |
++ return -ENETDOWN; |
1878 |
++ } |
1879 |
++ |
1880 |
+ ns = timecounter_read(&bp->timecounter); |
1881 |
+ |
1882 |
+ DP(BNX2X_MSG_PTP, "PTP gettime called, ns = %llu\n", ns); |
1883 |
+@@ -13821,6 +13831,12 @@ static int bnx2x_ptp_settime(struct ptp_clock_info *ptp, |
1884 |
+ struct bnx2x *bp = container_of(ptp, struct bnx2x, ptp_clock_info); |
1885 |
+ u64 ns; |
1886 |
+ |
1887 |
++ if (!netif_running(bp->dev)) { |
1888 |
++ DP(BNX2X_MSG_PTP, |
1889 |
++ "PTP settime called while the interface is down\n"); |
1890 |
++ return -ENETDOWN; |
1891 |
++ } |
1892 |
++ |
1893 |
+ ns = timespec64_to_ns(ts); |
1894 |
+ |
1895 |
+ DP(BNX2X_MSG_PTP, "PTP settime called, ns = %llu\n", ns); |
1896 |
+@@ -13988,6 +14004,14 @@ static int bnx2x_init_one(struct pci_dev *pdev, |
1897 |
+ rc = bnx2x_vfpf_acquire(bp, tx_count, rx_count); |
1898 |
+ if (rc) |
1899 |
+ goto init_one_freemem; |
1900 |
++ |
1901 |
++#ifdef CONFIG_BNX2X_SRIOV |
1902 |
++ /* VF with OLD Hypervisor or old PF do not support filtering */ |
1903 |
++ if (bp->acquire_resp.pfdev_info.pf_cap & PFVF_CAP_VLAN_FILTER) { |
1904 |
++ dev->hw_features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
1905 |
++ dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; |
1906 |
++ } |
1907 |
++#endif |
1908 |
+ } |
1909 |
+ |
1910 |
+ /* Enable SRIOV if capability found in configuration space */ |
1911 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1912 |
+index 3f77d0863543..c6e059119b22 100644 |
1913 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1914 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1915 |
+@@ -434,7 +434,9 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, |
1916 |
+ |
1917 |
+ /* Add/Remove the filter */ |
1918 |
+ rc = bnx2x_config_vlan_mac(bp, &ramrod); |
1919 |
+- if (rc && rc != -EEXIST) { |
1920 |
++ if (rc == -EEXIST) |
1921 |
++ return 0; |
1922 |
++ if (rc) { |
1923 |
+ BNX2X_ERR("Failed to %s %s\n", |
1924 |
+ filter->add ? "add" : "delete", |
1925 |
+ (filter->type == BNX2X_VF_FILTER_VLAN_MAC) ? |
1926 |
+@@ -444,6 +446,8 @@ static int bnx2x_vf_mac_vlan_config(struct bnx2x *bp, |
1927 |
+ return rc; |
1928 |
+ } |
1929 |
+ |
1930 |
++ filter->applied = true; |
1931 |
++ |
1932 |
+ return 0; |
1933 |
+ } |
1934 |
+ |
1935 |
+@@ -471,6 +475,8 @@ int bnx2x_vf_mac_vlan_config_list(struct bnx2x *bp, struct bnx2x_virtf *vf, |
1936 |
+ BNX2X_ERR("Managed only %d/%d filters - rolling back\n", |
1937 |
+ i, filters->count + 1); |
1938 |
+ while (--i >= 0) { |
1939 |
++ if (!filters->filters[i].applied) |
1940 |
++ continue; |
1941 |
+ filters->filters[i].add = !filters->filters[i].add; |
1942 |
+ bnx2x_vf_mac_vlan_config(bp, vf, qid, |
1943 |
+ &filters->filters[i], |
1944 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1945 |
+index 7a6d406f4c11..888d0b6632e8 100644 |
1946 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1947 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h |
1948 |
+@@ -114,6 +114,7 @@ struct bnx2x_vf_mac_vlan_filter { |
1949 |
+ (BNX2X_VF_FILTER_MAC | BNX2X_VF_FILTER_VLAN) /*shortcut*/ |
1950 |
+ |
1951 |
+ bool add; |
1952 |
++ bool applied; |
1953 |
+ u8 *mac; |
1954 |
+ u16 vid; |
1955 |
+ }; |
1956 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1957 |
+index bfae300cf25f..c2d327d9dff0 100644 |
1958 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1959 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c |
1960 |
+@@ -868,7 +868,7 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) |
1961 |
+ struct bnx2x *bp = netdev_priv(dev); |
1962 |
+ struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters; |
1963 |
+ struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; |
1964 |
+- int rc, i = 0; |
1965 |
++ int rc = 0, i = 0; |
1966 |
+ struct netdev_hw_addr *ha; |
1967 |
+ |
1968 |
+ if (bp->state != BNX2X_STATE_OPEN) { |
1969 |
+@@ -883,6 +883,15 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) |
1970 |
+ /* Get Rx mode requested */ |
1971 |
+ DP(NETIF_MSG_IFUP, "dev->flags = %x\n", dev->flags); |
1972 |
+ |
1973 |
++ /* We support PFVF_MAX_MULTICAST_PER_VF mcast addresses tops */ |
1974 |
++ if (netdev_mc_count(dev) > PFVF_MAX_MULTICAST_PER_VF) { |
1975 |
++ DP(NETIF_MSG_IFUP, |
1976 |
++ "VF supports not more than %d multicast MAC addresses\n", |
1977 |
++ PFVF_MAX_MULTICAST_PER_VF); |
1978 |
++ rc = -EINVAL; |
1979 |
++ goto out; |
1980 |
++ } |
1981 |
++ |
1982 |
+ netdev_for_each_mc_addr(ha, dev) { |
1983 |
+ DP(NETIF_MSG_IFUP, "Adding mcast MAC: %pM\n", |
1984 |
+ bnx2x_mc_addr(ha)); |
1985 |
+@@ -890,16 +899,6 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) |
1986 |
+ i++; |
1987 |
+ } |
1988 |
+ |
1989 |
+- /* We support four PFVF_MAX_MULTICAST_PER_VF mcast |
1990 |
+- * addresses tops |
1991 |
+- */ |
1992 |
+- if (i >= PFVF_MAX_MULTICAST_PER_VF) { |
1993 |
+- DP(NETIF_MSG_IFUP, |
1994 |
+- "VF supports not more than %d multicast MAC addresses\n", |
1995 |
+- PFVF_MAX_MULTICAST_PER_VF); |
1996 |
+- return -EINVAL; |
1997 |
+- } |
1998 |
+- |
1999 |
+ req->n_multicast = i; |
2000 |
+ req->flags |= VFPF_SET_Q_FILTERS_MULTICAST_CHANGED; |
2001 |
+ req->vf_qid = 0; |
2002 |
+@@ -924,7 +923,7 @@ int bnx2x_vfpf_set_mcast(struct net_device *dev) |
2003 |
+ out: |
2004 |
+ bnx2x_vfpf_finalize(bp, &req->first_tlv); |
2005 |
+ |
2006 |
+- return 0; |
2007 |
++ return rc; |
2008 |
+ } |
2009 |
+ |
2010 |
+ /* request pf to add a vlan for the vf */ |
2011 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c |
2012 |
+index b8778e7b1f79..7c6c1468628b 100644 |
2013 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.c |
2014 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.c |
2015 |
+@@ -404,7 +404,7 @@ static int ibmvnic_open(struct net_device *netdev) |
2016 |
+ send_map_query(adapter); |
2017 |
+ for (i = 0; i < rxadd_subcrqs; i++) { |
2018 |
+ init_rx_pool(adapter, &adapter->rx_pool[i], |
2019 |
+- IBMVNIC_BUFFS_PER_POOL, i, |
2020 |
++ adapter->req_rx_add_entries_per_subcrq, i, |
2021 |
+ be64_to_cpu(size_array[i]), 1); |
2022 |
+ if (alloc_rx_pool(adapter, &adapter->rx_pool[i])) { |
2023 |
+ dev_err(dev, "Couldn't alloc rx pool\n"); |
2024 |
+@@ -419,23 +419,23 @@ static int ibmvnic_open(struct net_device *netdev) |
2025 |
+ for (i = 0; i < tx_subcrqs; i++) { |
2026 |
+ tx_pool = &adapter->tx_pool[i]; |
2027 |
+ tx_pool->tx_buff = |
2028 |
+- kcalloc(adapter->max_tx_entries_per_subcrq, |
2029 |
++ kcalloc(adapter->req_tx_entries_per_subcrq, |
2030 |
+ sizeof(struct ibmvnic_tx_buff), GFP_KERNEL); |
2031 |
+ if (!tx_pool->tx_buff) |
2032 |
+ goto tx_pool_alloc_failed; |
2033 |
+ |
2034 |
+ if (alloc_long_term_buff(adapter, &tx_pool->long_term_buff, |
2035 |
+- adapter->max_tx_entries_per_subcrq * |
2036 |
++ adapter->req_tx_entries_per_subcrq * |
2037 |
+ adapter->req_mtu)) |
2038 |
+ goto tx_ltb_alloc_failed; |
2039 |
+ |
2040 |
+ tx_pool->free_map = |
2041 |
+- kcalloc(adapter->max_tx_entries_per_subcrq, |
2042 |
++ kcalloc(adapter->req_tx_entries_per_subcrq, |
2043 |
+ sizeof(int), GFP_KERNEL); |
2044 |
+ if (!tx_pool->free_map) |
2045 |
+ goto tx_fm_alloc_failed; |
2046 |
+ |
2047 |
+- for (j = 0; j < adapter->max_tx_entries_per_subcrq; j++) |
2048 |
++ for (j = 0; j < adapter->req_tx_entries_per_subcrq; j++) |
2049 |
+ tx_pool->free_map[j] = j; |
2050 |
+ |
2051 |
+ tx_pool->consumer_index = 0; |
2052 |
+@@ -705,6 +705,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) |
2053 |
+ u8 *hdrs = (u8 *)&adapter->tx_rx_desc_req; |
2054 |
+ struct device *dev = &adapter->vdev->dev; |
2055 |
+ struct ibmvnic_tx_buff *tx_buff = NULL; |
2056 |
++ struct ibmvnic_sub_crq_queue *tx_scrq; |
2057 |
+ struct ibmvnic_tx_pool *tx_pool; |
2058 |
+ unsigned int tx_send_failed = 0; |
2059 |
+ unsigned int tx_map_failed = 0; |
2060 |
+@@ -724,6 +725,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) |
2061 |
+ int ret = 0; |
2062 |
+ |
2063 |
+ tx_pool = &adapter->tx_pool[queue_num]; |
2064 |
++ tx_scrq = adapter->tx_scrq[queue_num]; |
2065 |
+ txq = netdev_get_tx_queue(netdev, skb_get_queue_mapping(skb)); |
2066 |
+ handle_array = (u64 *)((u8 *)(adapter->login_rsp_buf) + |
2067 |
+ be32_to_cpu(adapter->login_rsp_buf-> |
2068 |
+@@ -744,7 +746,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) |
2069 |
+ |
2070 |
+ tx_pool->consumer_index = |
2071 |
+ (tx_pool->consumer_index + 1) % |
2072 |
+- adapter->max_tx_entries_per_subcrq; |
2073 |
++ adapter->req_tx_entries_per_subcrq; |
2074 |
+ |
2075 |
+ tx_buff = &tx_pool->tx_buff[index]; |
2076 |
+ tx_buff->skb = skb; |
2077 |
+@@ -817,7 +819,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) |
2078 |
+ |
2079 |
+ if (tx_pool->consumer_index == 0) |
2080 |
+ tx_pool->consumer_index = |
2081 |
+- adapter->max_tx_entries_per_subcrq - 1; |
2082 |
++ adapter->req_tx_entries_per_subcrq - 1; |
2083 |
+ else |
2084 |
+ tx_pool->consumer_index--; |
2085 |
+ |
2086 |
+@@ -826,6 +828,14 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) |
2087 |
+ ret = NETDEV_TX_BUSY; |
2088 |
+ goto out; |
2089 |
+ } |
2090 |
++ |
2091 |
++ atomic_inc(&tx_scrq->used); |
2092 |
++ |
2093 |
++ if (atomic_read(&tx_scrq->used) >= adapter->req_tx_entries_per_subcrq) { |
2094 |
++ netdev_info(netdev, "Stopping queue %d\n", queue_num); |
2095 |
++ netif_stop_subqueue(netdev, queue_num); |
2096 |
++ } |
2097 |
++ |
2098 |
+ tx_packets++; |
2099 |
+ tx_bytes += skb->len; |
2100 |
+ txq->trans_start = jiffies; |
2101 |
+@@ -1220,6 +1230,7 @@ static struct ibmvnic_sub_crq_queue *init_sub_crq_queue(struct ibmvnic_adapter |
2102 |
+ scrq->adapter = adapter; |
2103 |
+ scrq->size = 4 * PAGE_SIZE / sizeof(*scrq->msgs); |
2104 |
+ scrq->cur = 0; |
2105 |
++ atomic_set(&scrq->used, 0); |
2106 |
+ scrq->rx_skb_top = NULL; |
2107 |
+ spin_lock_init(&scrq->lock); |
2108 |
+ |
2109 |
+@@ -1368,14 +1379,28 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, |
2110 |
+ DMA_TO_DEVICE); |
2111 |
+ } |
2112 |
+ |
2113 |
+- if (txbuff->last_frag) |
2114 |
++ if (txbuff->last_frag) { |
2115 |
++ atomic_dec(&scrq->used); |
2116 |
++ |
2117 |
++ if (atomic_read(&scrq->used) <= |
2118 |
++ (adapter->req_tx_entries_per_subcrq / 2) && |
2119 |
++ netif_subqueue_stopped(adapter->netdev, |
2120 |
++ txbuff->skb)) { |
2121 |
++ netif_wake_subqueue(adapter->netdev, |
2122 |
++ scrq->pool_index); |
2123 |
++ netdev_dbg(adapter->netdev, |
2124 |
++ "Started queue %d\n", |
2125 |
++ scrq->pool_index); |
2126 |
++ } |
2127 |
++ |
2128 |
+ dev_kfree_skb_any(txbuff->skb); |
2129 |
++ } |
2130 |
+ |
2131 |
+ adapter->tx_pool[pool].free_map[adapter->tx_pool[pool]. |
2132 |
+ producer_index] = index; |
2133 |
+ adapter->tx_pool[pool].producer_index = |
2134 |
+ (adapter->tx_pool[pool].producer_index + 1) % |
2135 |
+- adapter->max_tx_entries_per_subcrq; |
2136 |
++ adapter->req_tx_entries_per_subcrq; |
2137 |
+ } |
2138 |
+ /* remove tx_comp scrq*/ |
2139 |
+ next->tx_comp.first = 0; |
2140 |
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.h b/drivers/net/ethernet/ibm/ibmvnic.h |
2141 |
+index dd775d951b73..892eda346e54 100644 |
2142 |
+--- a/drivers/net/ethernet/ibm/ibmvnic.h |
2143 |
++++ b/drivers/net/ethernet/ibm/ibmvnic.h |
2144 |
+@@ -863,6 +863,7 @@ struct ibmvnic_sub_crq_queue { |
2145 |
+ spinlock_t lock; |
2146 |
+ struct sk_buff *rx_skb_top; |
2147 |
+ struct ibmvnic_adapter *adapter; |
2148 |
++ atomic_t used; |
2149 |
+ }; |
2150 |
+ |
2151 |
+ struct ibmvnic_long_term_buff { |
2152 |
+diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c |
2153 |
+index 93ffedfa2994..1e2d4f1179da 100644 |
2154 |
+--- a/drivers/net/phy/spi_ks8995.c |
2155 |
++++ b/drivers/net/phy/spi_ks8995.c |
2156 |
+@@ -491,13 +491,14 @@ static int ks8995_probe(struct spi_device *spi) |
2157 |
+ if (err) |
2158 |
+ return err; |
2159 |
+ |
2160 |
+- ks->regs_attr.size = ks->chip->regs_size; |
2161 |
+ memcpy(&ks->regs_attr, &ks8995_registers_attr, sizeof(ks->regs_attr)); |
2162 |
++ ks->regs_attr.size = ks->chip->regs_size; |
2163 |
+ |
2164 |
+ err = ks8995_reset(ks); |
2165 |
+ if (err) |
2166 |
+ return err; |
2167 |
+ |
2168 |
++ sysfs_attr_init(&ks->regs_attr.attr); |
2169 |
+ err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr); |
2170 |
+ if (err) { |
2171 |
+ dev_err(&spi->dev, "unable to create sysfs file, err=%d\n", |
2172 |
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2173 |
+index 8e3c6f4bdaa0..edffe5aeeeb1 100644 |
2174 |
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2175 |
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c |
2176 |
+@@ -4080,8 +4080,8 @@ static void brcmf_sdio_firmware_callback(struct device *dev, int err, |
2177 |
+ sdio_release_host(sdiodev->func[1]); |
2178 |
+ fail: |
2179 |
+ brcmf_dbg(TRACE, "failed: dev=%s, err=%d\n", dev_name(dev), err); |
2180 |
+- device_release_driver(dev); |
2181 |
+ device_release_driver(&sdiodev->func[2]->dev); |
2182 |
++ device_release_driver(dev); |
2183 |
+ } |
2184 |
+ |
2185 |
+ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev) |
2186 |
+diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c |
2187 |
+index d2a28a9d3209..4b462dc21c41 100644 |
2188 |
+--- a/drivers/net/wireless/mac80211_hwsim.c |
2189 |
++++ b/drivers/net/wireless/mac80211_hwsim.c |
2190 |
+@@ -3047,6 +3047,7 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2191 |
+ { |
2192 |
+ struct hwsim_new_radio_params param = { 0 }; |
2193 |
+ const char *hwname = NULL; |
2194 |
++ int ret; |
2195 |
+ |
2196 |
+ param.reg_strict = info->attrs[HWSIM_ATTR_REG_STRICT_REG]; |
2197 |
+ param.p2p_device = info->attrs[HWSIM_ATTR_SUPPORT_P2P_DEVICE]; |
2198 |
+@@ -3086,7 +3087,9 @@ static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2199 |
+ param.regd = hwsim_world_regdom_custom[idx]; |
2200 |
+ } |
2201 |
+ |
2202 |
+- return mac80211_hwsim_new_radio(info, ¶m); |
2203 |
++ ret = mac80211_hwsim_new_radio(info, ¶m); |
2204 |
++ kfree(hwname); |
2205 |
++ return ret; |
2206 |
+ } |
2207 |
+ |
2208 |
+ static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info) |
2209 |
+diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c |
2210 |
+index 9013a585507e..f32fc704cb7e 100644 |
2211 |
+--- a/drivers/rapidio/devices/rio_mport_cdev.c |
2212 |
++++ b/drivers/rapidio/devices/rio_mport_cdev.c |
2213 |
+@@ -964,7 +964,8 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, |
2214 |
+ req->sgt.sgl, req->sgt.nents, dir); |
2215 |
+ if (nents == -EFAULT) { |
2216 |
+ rmcd_error("Failed to map SG list"); |
2217 |
+- return -EFAULT; |
2218 |
++ ret = -EFAULT; |
2219 |
++ goto err_pg; |
2220 |
+ } |
2221 |
+ |
2222 |
+ ret = do_dma_request(req, xfer, sync, nents); |
2223 |
+diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c |
2224 |
+index 4df3cdcf88ce..9c9563312a3d 100644 |
2225 |
+--- a/drivers/scsi/lpfc/lpfc_els.c |
2226 |
++++ b/drivers/scsi/lpfc/lpfc_els.c |
2227 |
+@@ -8185,11 +8185,17 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
2228 |
+ spin_lock_irq(shost->host_lock); |
2229 |
+ vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; |
2230 |
+ spin_unlock_irq(shost->host_lock); |
2231 |
+- if (vport->port_type == LPFC_PHYSICAL_PORT |
2232 |
+- && !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) |
2233 |
+- lpfc_issue_init_vfi(vport); |
2234 |
+- else |
2235 |
++ if (mb->mbxStatus == MBX_NOT_FINISHED) |
2236 |
++ break; |
2237 |
++ if ((vport->port_type == LPFC_PHYSICAL_PORT) && |
2238 |
++ !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) { |
2239 |
++ if (phba->sli_rev == LPFC_SLI_REV4) |
2240 |
++ lpfc_issue_init_vfi(vport); |
2241 |
++ else |
2242 |
++ lpfc_initial_flogi(vport); |
2243 |
++ } else { |
2244 |
+ lpfc_initial_fdisc(vport); |
2245 |
++ } |
2246 |
+ break; |
2247 |
+ } |
2248 |
+ } else { |
2249 |
+diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c |
2250 |
+index 658e4d15cb71..ce4ac769a9a2 100644 |
2251 |
+--- a/drivers/scsi/qla2xxx/qla_dbg.c |
2252 |
++++ b/drivers/scsi/qla2xxx/qla_dbg.c |
2253 |
+@@ -2707,13 +2707,9 @@ ql_dump_buffer(uint32_t level, scsi_qla_host_t *vha, int32_t id, |
2254 |
+ "%-+5d 0 1 2 3 4 5 6 7 8 9 A B C D E F\n", size); |
2255 |
+ ql_dbg(level, vha, id, |
2256 |
+ "----- -----------------------------------------------\n"); |
2257 |
+- for (cnt = 0; cnt < size; cnt++, buf++) { |
2258 |
+- if (cnt % 16 == 0) |
2259 |
+- ql_dbg(level, vha, id, "%04x:", cnt & ~0xFU); |
2260 |
+- printk(" %02x", *buf); |
2261 |
+- if (cnt % 16 == 15) |
2262 |
+- printk("\n"); |
2263 |
++ for (cnt = 0; cnt < size; cnt += 16) { |
2264 |
++ ql_dbg(level, vha, id, "%04x: ", cnt); |
2265 |
++ print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
2266 |
++ buf + cnt, min(16U, size - cnt), false); |
2267 |
+ } |
2268 |
+- if (cnt % 16 != 0) |
2269 |
+- printk("\n"); |
2270 |
+ } |
2271 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
2272 |
+index d8099c7cab00..c7b770075caa 100644 |
2273 |
+--- a/drivers/scsi/scsi_lib.c |
2274 |
++++ b/drivers/scsi/scsi_lib.c |
2275 |
+@@ -2041,11 +2041,13 @@ static void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q) |
2276 |
+ q->limits.cluster = 0; |
2277 |
+ |
2278 |
+ /* |
2279 |
+- * set a reasonable default alignment on word boundaries: the |
2280 |
+- * host and device may alter it using |
2281 |
+- * blk_queue_update_dma_alignment() later. |
2282 |
++ * Set a reasonable default alignment: The larger of 32-byte (dword), |
2283 |
++ * which is a common minimum for HBAs, and the minimum DMA alignment, |
2284 |
++ * which is set by the platform. |
2285 |
++ * |
2286 |
++ * Devices that require a bigger alignment can increase it later. |
2287 |
+ */ |
2288 |
+- blk_queue_dma_alignment(q, 0x03); |
2289 |
++ blk_queue_dma_alignment(q, max(4, dma_get_cache_alignment()) - 1); |
2290 |
+ } |
2291 |
+ |
2292 |
+ struct request_queue *__scsi_alloc_queue(struct Scsi_Host *shost, |
2293 |
+diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig |
2294 |
+index 8e281e47afec..b7995474148c 100644 |
2295 |
+--- a/drivers/spi/Kconfig |
2296 |
++++ b/drivers/spi/Kconfig |
2297 |
+@@ -365,7 +365,6 @@ config SPI_FSL_SPI |
2298 |
+ config SPI_FSL_DSPI |
2299 |
+ tristate "Freescale DSPI controller" |
2300 |
+ select REGMAP_MMIO |
2301 |
+- depends on HAS_DMA |
2302 |
+ depends on SOC_VF610 || SOC_LS1021A || ARCH_LAYERSCAPE || COMPILE_TEST |
2303 |
+ help |
2304 |
+ This enables support for the Freescale DSPI controller in master |
2305 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
2306 |
+index c61ddbf94bc7..16c67120d72b 100644 |
2307 |
+--- a/drivers/usb/dwc3/gadget.c |
2308 |
++++ b/drivers/usb/dwc3/gadget.c |
2309 |
+@@ -3092,15 +3092,10 @@ void dwc3_gadget_exit(struct dwc3 *dwc) |
2310 |
+ |
2311 |
+ int dwc3_gadget_suspend(struct dwc3 *dwc) |
2312 |
+ { |
2313 |
+- int ret; |
2314 |
+- |
2315 |
+ if (!dwc->gadget_driver) |
2316 |
+ return 0; |
2317 |
+ |
2318 |
+- ret = dwc3_gadget_run_stop(dwc, false, false); |
2319 |
+- if (ret < 0) |
2320 |
+- return ret; |
2321 |
+- |
2322 |
++ dwc3_gadget_run_stop(dwc, false, false); |
2323 |
+ dwc3_disconnect_gadget(dwc); |
2324 |
+ __dwc3_gadget_stop(dwc); |
2325 |
+ |
2326 |
+diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c |
2327 |
+index 502a096fc380..a5ca409dc97e 100644 |
2328 |
+--- a/drivers/usb/gadget/configfs.c |
2329 |
++++ b/drivers/usb/gadget/configfs.c |
2330 |
+@@ -269,6 +269,7 @@ static ssize_t gadget_dev_desc_UDC_store(struct config_item *item, |
2331 |
+ ret = unregister_gadget(gi); |
2332 |
+ if (ret) |
2333 |
+ goto err; |
2334 |
++ kfree(name); |
2335 |
+ } else { |
2336 |
+ if (gi->composite.gadget_driver.udc_name) { |
2337 |
+ ret = -EBUSY; |
2338 |
+diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c |
2339 |
+index 4fce83266926..346a630cebd5 100644 |
2340 |
+--- a/drivers/usb/gadget/function/f_fs.c |
2341 |
++++ b/drivers/usb/gadget/function/f_fs.c |
2342 |
+@@ -2262,9 +2262,18 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type, |
2343 |
+ int i; |
2344 |
+ |
2345 |
+ if (len < sizeof(*d) || |
2346 |
+- d->bFirstInterfaceNumber >= ffs->interfaces_count || |
2347 |
+- d->Reserved1) |
2348 |
++ d->bFirstInterfaceNumber >= ffs->interfaces_count) |
2349 |
+ return -EINVAL; |
2350 |
++ if (d->Reserved1 != 1) { |
2351 |
++ /* |
2352 |
++ * According to the spec, Reserved1 must be set to 1 |
2353 |
++ * but older kernels incorrectly rejected non-zero |
2354 |
++ * values. We fix it here to avoid returning EINVAL |
2355 |
++ * in response to values we used to accept. |
2356 |
++ */ |
2357 |
++ pr_debug("usb_ext_compat_desc::Reserved1 forced to 1\n"); |
2358 |
++ d->Reserved1 = 1; |
2359 |
++ } |
2360 |
+ for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i) |
2361 |
+ if (d->Reserved2[i]) |
2362 |
+ return -EINVAL; |
2363 |
+diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c |
2364 |
+index f69dbd4bcd18..b8534d3f8bb0 100644 |
2365 |
+--- a/drivers/usb/gadget/legacy/inode.c |
2366 |
++++ b/drivers/usb/gadget/legacy/inode.c |
2367 |
+@@ -1819,8 +1819,10 @@ dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) |
2368 |
+ |
2369 |
+ spin_lock_irq (&dev->lock); |
2370 |
+ value = -EINVAL; |
2371 |
+- if (dev->buf) |
2372 |
++ if (dev->buf) { |
2373 |
++ kfree(kbuf); |
2374 |
+ goto fail; |
2375 |
++ } |
2376 |
+ dev->buf = kbuf; |
2377 |
+ |
2378 |
+ /* full or low speed config */ |
2379 |
+diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c |
2380 |
+index 33f3987218f7..d133252ef2c3 100644 |
2381 |
+--- a/drivers/usb/gadget/udc/net2280.c |
2382 |
++++ b/drivers/usb/gadget/udc/net2280.c |
2383 |
+@@ -1146,15 +1146,15 @@ static int scan_dma_completions(struct net2280_ep *ep) |
2384 |
+ */ |
2385 |
+ while (!list_empty(&ep->queue)) { |
2386 |
+ struct net2280_request *req; |
2387 |
+- u32 tmp; |
2388 |
++ u32 req_dma_count; |
2389 |
+ |
2390 |
+ req = list_entry(ep->queue.next, |
2391 |
+ struct net2280_request, queue); |
2392 |
+ if (!req->valid) |
2393 |
+ break; |
2394 |
+ rmb(); |
2395 |
+- tmp = le32_to_cpup(&req->td->dmacount); |
2396 |
+- if ((tmp & BIT(VALID_BIT)) != 0) |
2397 |
++ req_dma_count = le32_to_cpup(&req->td->dmacount); |
2398 |
++ if ((req_dma_count & BIT(VALID_BIT)) != 0) |
2399 |
+ break; |
2400 |
+ |
2401 |
+ /* SHORT_PACKET_TRANSFERRED_INTERRUPT handles "usb-short" |
2402 |
+@@ -1163,40 +1163,41 @@ static int scan_dma_completions(struct net2280_ep *ep) |
2403 |
+ */ |
2404 |
+ if (unlikely(req->td->dmadesc == 0)) { |
2405 |
+ /* paranoia */ |
2406 |
+- tmp = readl(&ep->dma->dmacount); |
2407 |
+- if (tmp & DMA_BYTE_COUNT_MASK) |
2408 |
++ u32 const ep_dmacount = readl(&ep->dma->dmacount); |
2409 |
++ |
2410 |
++ if (ep_dmacount & DMA_BYTE_COUNT_MASK) |
2411 |
+ break; |
2412 |
+ /* single transfer mode */ |
2413 |
+- dma_done(ep, req, tmp, 0); |
2414 |
++ dma_done(ep, req, req_dma_count, 0); |
2415 |
+ num_completed++; |
2416 |
+ break; |
2417 |
+ } else if (!ep->is_in && |
2418 |
+ (req->req.length % ep->ep.maxpacket) && |
2419 |
+ !(ep->dev->quirks & PLX_PCIE)) { |
2420 |
+ |
2421 |
+- tmp = readl(&ep->regs->ep_stat); |
2422 |
++ u32 const ep_stat = readl(&ep->regs->ep_stat); |
2423 |
+ /* AVOID TROUBLE HERE by not issuing short reads from |
2424 |
+ * your gadget driver. That helps avoids errata 0121, |
2425 |
+ * 0122, and 0124; not all cases trigger the warning. |
2426 |
+ */ |
2427 |
+- if ((tmp & BIT(NAK_OUT_PACKETS)) == 0) { |
2428 |
++ if ((ep_stat & BIT(NAK_OUT_PACKETS)) == 0) { |
2429 |
+ ep_warn(ep->dev, "%s lost packet sync!\n", |
2430 |
+ ep->ep.name); |
2431 |
+ req->req.status = -EOVERFLOW; |
2432 |
+ } else { |
2433 |
+- tmp = readl(&ep->regs->ep_avail); |
2434 |
+- if (tmp) { |
2435 |
++ u32 const ep_avail = readl(&ep->regs->ep_avail); |
2436 |
++ if (ep_avail) { |
2437 |
+ /* fifo gets flushed later */ |
2438 |
+ ep->out_overflow = 1; |
2439 |
+ ep_dbg(ep->dev, |
2440 |
+ "%s dma, discard %d len %d\n", |
2441 |
+- ep->ep.name, tmp, |
2442 |
++ ep->ep.name, ep_avail, |
2443 |
+ req->req.length); |
2444 |
+ req->req.status = -EOVERFLOW; |
2445 |
+ } |
2446 |
+ } |
2447 |
+ } |
2448 |
+- dma_done(ep, req, tmp, 0); |
2449 |
++ dma_done(ep, req, req_dma_count, 0); |
2450 |
+ num_completed++; |
2451 |
+ } |
2452 |
+ |
2453 |
+diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c |
2454 |
+index 7fa60f5b7ae4..afd6b86458c5 100644 |
2455 |
+--- a/drivers/usb/gadget/udc/pxa27x_udc.c |
2456 |
++++ b/drivers/usb/gadget/udc/pxa27x_udc.c |
2457 |
+@@ -2534,9 +2534,10 @@ static int pxa_udc_remove(struct platform_device *_dev) |
2458 |
+ usb_del_gadget_udc(&udc->gadget); |
2459 |
+ pxa_cleanup_debugfs(udc); |
2460 |
+ |
2461 |
+- if (!IS_ERR_OR_NULL(udc->transceiver)) |
2462 |
++ if (!IS_ERR_OR_NULL(udc->transceiver)) { |
2463 |
+ usb_unregister_notifier(udc->transceiver, &pxa27x_udc_phy); |
2464 |
+- usb_put_phy(udc->transceiver); |
2465 |
++ usb_put_phy(udc->transceiver); |
2466 |
++ } |
2467 |
+ |
2468 |
+ udc->transceiver = NULL; |
2469 |
+ the_controller = NULL; |
2470 |
+diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c |
2471 |
+index bb89e24c48b4..2197a50ed2ab 100644 |
2472 |
+--- a/drivers/usb/gadget/udc/renesas_usb3.c |
2473 |
++++ b/drivers/usb/gadget/udc/renesas_usb3.c |
2474 |
+@@ -222,7 +222,7 @@ |
2475 |
+ #define USB3_EP0_SS_MAX_PACKET_SIZE 512 |
2476 |
+ #define USB3_EP0_HSFS_MAX_PACKET_SIZE 64 |
2477 |
+ #define USB3_EP0_BUF_SIZE 8 |
2478 |
+-#define USB3_MAX_NUM_PIPES 30 |
2479 |
++#define USB3_MAX_NUM_PIPES 6 /* This includes PIPE 0 */ |
2480 |
+ #define USB3_WAIT_US 3 |
2481 |
+ |
2482 |
+ struct renesas_usb3; |
2483 |
+diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c |
2484 |
+index 7062bb0975a5..462e183609b6 100644 |
2485 |
+--- a/drivers/virtio/virtio.c |
2486 |
++++ b/drivers/virtio/virtio.c |
2487 |
+@@ -323,6 +323,8 @@ int register_virtio_device(struct virtio_device *dev) |
2488 |
+ /* device_register() causes the bus infrastructure to look for a |
2489 |
+ * matching driver. */ |
2490 |
+ err = device_register(&dev->dev); |
2491 |
++ if (err) |
2492 |
++ ida_simple_remove(&virtio_index_ida, dev->index); |
2493 |
+ out: |
2494 |
+ if (err) |
2495 |
+ add_status(dev, VIRTIO_CONFIG_S_FAILED); |
2496 |
+diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c |
2497 |
+index d764236072b1..8d2c5180e015 100644 |
2498 |
+--- a/fs/afs/cmservice.c |
2499 |
++++ b/fs/afs/cmservice.c |
2500 |
+@@ -106,6 +106,9 @@ bool afs_cm_incoming_call(struct afs_call *call) |
2501 |
+ case CBProbe: |
2502 |
+ call->type = &afs_SRXCBProbe; |
2503 |
+ return true; |
2504 |
++ case CBProbeUuid: |
2505 |
++ call->type = &afs_SRXCBProbeUuid; |
2506 |
++ return true; |
2507 |
+ case CBTellMeAboutYourself: |
2508 |
+ call->type = &afs_SRXCBTellMeAboutYourself; |
2509 |
+ return true; |
2510 |
+diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c |
2511 |
+index c4cff5cc9c93..a29730c44850 100644 |
2512 |
+--- a/fs/btrfs/extent-tree.c |
2513 |
++++ b/fs/btrfs/extent-tree.c |
2514 |
+@@ -9362,6 +9362,7 @@ int btrfs_drop_snapshot(struct btrfs_root *root, |
2515 |
+ ret = btrfs_del_root(trans, tree_root, &root->root_key); |
2516 |
+ if (ret) { |
2517 |
+ btrfs_abort_transaction(trans, ret); |
2518 |
++ err = ret; |
2519 |
+ goto out_end_trans; |
2520 |
+ } |
2521 |
+ |
2522 |
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c |
2523 |
+index 65566d5fcf39..1e5321d1ed22 100644 |
2524 |
+--- a/fs/nfs/dir.c |
2525 |
++++ b/fs/nfs/dir.c |
2526 |
+@@ -2098,7 +2098,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, |
2527 |
+ if (new_inode != NULL) |
2528 |
+ nfs_drop_nlink(new_inode); |
2529 |
+ d_move(old_dentry, new_dentry); |
2530 |
+- nfs_set_verifier(new_dentry, |
2531 |
++ nfs_set_verifier(old_dentry, |
2532 |
+ nfs_save_change_attribute(new_dir)); |
2533 |
+ } else if (error == -ENOENT) |
2534 |
+ nfs_dentry_handle_enoent(old_dentry); |
2535 |
+diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c |
2536 |
+index fe9a9a183b2d..98ca9f1b6a07 100644 |
2537 |
+--- a/fs/xfs/xfs_inode.c |
2538 |
++++ b/fs/xfs/xfs_inode.c |
2539 |
+@@ -2386,6 +2386,7 @@ xfs_ifree_cluster( |
2540 |
+ */ |
2541 |
+ if (ip->i_ino != inum + i) { |
2542 |
+ xfs_iunlock(ip, XFS_ILOCK_EXCL); |
2543 |
++ rcu_read_unlock(); |
2544 |
+ continue; |
2545 |
+ } |
2546 |
+ } |
2547 |
+diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h |
2548 |
+index 08528afdf58b..704caae69c42 100644 |
2549 |
+--- a/include/linux/dma-mapping.h |
2550 |
++++ b/include/linux/dma-mapping.h |
2551 |
+@@ -659,7 +659,6 @@ static inline void *dma_zalloc_coherent(struct device *dev, size_t size, |
2552 |
+ return ret; |
2553 |
+ } |
2554 |
+ |
2555 |
+-#ifdef CONFIG_HAS_DMA |
2556 |
+ static inline int dma_get_cache_alignment(void) |
2557 |
+ { |
2558 |
+ #ifdef ARCH_DMA_MINALIGN |
2559 |
+@@ -667,7 +666,6 @@ static inline int dma_get_cache_alignment(void) |
2560 |
+ #endif |
2561 |
+ return 1; |
2562 |
+ } |
2563 |
+-#endif |
2564 |
+ |
2565 |
+ /* flags for the coherent memory api */ |
2566 |
+ #define DMA_MEMORY_MAP 0x01 |
2567 |
+diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h |
2568 |
+index 29d4385903d4..206fe3bccccc 100644 |
2569 |
+--- a/include/linux/genalloc.h |
2570 |
++++ b/include/linux/genalloc.h |
2571 |
+@@ -32,6 +32,7 @@ |
2572 |
+ |
2573 |
+ #include <linux/types.h> |
2574 |
+ #include <linux/spinlock_types.h> |
2575 |
++#include <linux/atomic.h> |
2576 |
+ |
2577 |
+ struct device; |
2578 |
+ struct device_node; |
2579 |
+@@ -70,7 +71,7 @@ struct gen_pool { |
2580 |
+ */ |
2581 |
+ struct gen_pool_chunk { |
2582 |
+ struct list_head next_chunk; /* next chunk in pool */ |
2583 |
+- atomic_t avail; |
2584 |
++ atomic_long_t avail; |
2585 |
+ phys_addr_t phys_addr; /* physical starting address of memory chunk */ |
2586 |
+ unsigned long start_addr; /* start address of memory chunk */ |
2587 |
+ unsigned long end_addr; /* end address of memory chunk (inclusive) */ |
2588 |
+diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h |
2589 |
+index 25c0dc31f084..854dfa6fa6e3 100644 |
2590 |
+--- a/include/linux/mmu_notifier.h |
2591 |
++++ b/include/linux/mmu_notifier.h |
2592 |
+@@ -381,18 +381,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) |
2593 |
+ ___pmd; \ |
2594 |
+ }) |
2595 |
+ |
2596 |
+-#define pmdp_huge_get_and_clear_notify(__mm, __haddr, __pmd) \ |
2597 |
+-({ \ |
2598 |
+- unsigned long ___haddr = __haddr & HPAGE_PMD_MASK; \ |
2599 |
+- pmd_t ___pmd; \ |
2600 |
+- \ |
2601 |
+- ___pmd = pmdp_huge_get_and_clear(__mm, __haddr, __pmd); \ |
2602 |
+- mmu_notifier_invalidate_range(__mm, ___haddr, \ |
2603 |
+- ___haddr + HPAGE_PMD_SIZE); \ |
2604 |
+- \ |
2605 |
+- ___pmd; \ |
2606 |
+-}) |
2607 |
+- |
2608 |
+ /* |
2609 |
+ * set_pte_at_notify() sets the pte _after_ running the notifier. |
2610 |
+ * This is safe to start by updating the secondary MMUs, because the primary MMU |
2611 |
+@@ -480,7 +468,6 @@ static inline void mmu_notifier_mm_destroy(struct mm_struct *mm) |
2612 |
+ #define pmdp_clear_young_notify pmdp_test_and_clear_young |
2613 |
+ #define ptep_clear_flush_notify ptep_clear_flush |
2614 |
+ #define pmdp_huge_clear_flush_notify pmdp_huge_clear_flush |
2615 |
+-#define pmdp_huge_get_and_clear_notify pmdp_huge_get_and_clear |
2616 |
+ #define set_pte_at_notify set_pte_at |
2617 |
+ |
2618 |
+ #endif /* CONFIG_MMU_NOTIFIER */ |
2619 |
+diff --git a/include/linux/omap-gpmc.h b/include/linux/omap-gpmc.h |
2620 |
+index 35d0fd7a4948..e821a3132a3e 100644 |
2621 |
+--- a/include/linux/omap-gpmc.h |
2622 |
++++ b/include/linux/omap-gpmc.h |
2623 |
+@@ -88,10 +88,11 @@ static inline int gpmc_nand_init(struct omap_nand_platform_data *d, |
2624 |
+ #endif |
2625 |
+ |
2626 |
+ #if IS_ENABLED(CONFIG_MTD_ONENAND_OMAP2) |
2627 |
+-extern void gpmc_onenand_init(struct omap_onenand_platform_data *d); |
2628 |
++extern int gpmc_onenand_init(struct omap_onenand_platform_data *d); |
2629 |
+ #else |
2630 |
+ #define board_onenand_data NULL |
2631 |
+-static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d) |
2632 |
++static inline int gpmc_onenand_init(struct omap_onenand_platform_data *d) |
2633 |
+ { |
2634 |
++ return 0; |
2635 |
+ } |
2636 |
+ #endif |
2637 |
+diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h |
2638 |
+index c6f0f0d0e17e..00a1f330f93a 100644 |
2639 |
+--- a/include/linux/sysfs.h |
2640 |
++++ b/include/linux/sysfs.h |
2641 |
+@@ -116,6 +116,12 @@ struct attribute_group { |
2642 |
+ .show = _name##_show, \ |
2643 |
+ } |
2644 |
+ |
2645 |
++#define __ATTR_RO_MODE(_name, _mode) { \ |
2646 |
++ .attr = { .name = __stringify(_name), \ |
2647 |
++ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ |
2648 |
++ .show = _name##_show, \ |
2649 |
++} |
2650 |
++ |
2651 |
+ #define __ATTR_WO(_name) { \ |
2652 |
+ .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \ |
2653 |
+ .store = _name##_store, \ |
2654 |
+diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h |
2655 |
+index dae99d7d2bc0..706a7017885c 100644 |
2656 |
+--- a/include/scsi/libsas.h |
2657 |
++++ b/include/scsi/libsas.h |
2658 |
+@@ -165,11 +165,11 @@ struct expander_device { |
2659 |
+ |
2660 |
+ struct sata_device { |
2661 |
+ unsigned int class; |
2662 |
+- struct smp_resp rps_resp; /* report_phy_sata_resp */ |
2663 |
+ u8 port_no; /* port number, if this is a PM (Port) */ |
2664 |
+ |
2665 |
+ struct ata_port *ap; |
2666 |
+ struct ata_host ata_host; |
2667 |
++ struct smp_resp rps_resp ____cacheline_aligned; /* report_phy_sata_resp */ |
2668 |
+ u8 fis[ATA_RESP_FIS_SIZE]; |
2669 |
+ }; |
2670 |
+ |
2671 |
+diff --git a/kernel/bpf/percpu_freelist.c b/kernel/bpf/percpu_freelist.c |
2672 |
+index 5c51d1985b51..673fa6fe2d73 100644 |
2673 |
+--- a/kernel/bpf/percpu_freelist.c |
2674 |
++++ b/kernel/bpf/percpu_freelist.c |
2675 |
+@@ -78,8 +78,10 @@ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
2676 |
+ { |
2677 |
+ struct pcpu_freelist_head *head; |
2678 |
+ struct pcpu_freelist_node *node; |
2679 |
++ unsigned long flags; |
2680 |
+ int orig_cpu, cpu; |
2681 |
+ |
2682 |
++ local_irq_save(flags); |
2683 |
+ orig_cpu = cpu = raw_smp_processor_id(); |
2684 |
+ while (1) { |
2685 |
+ head = per_cpu_ptr(s->freelist, cpu); |
2686 |
+@@ -87,14 +89,16 @@ struct pcpu_freelist_node *pcpu_freelist_pop(struct pcpu_freelist *s) |
2687 |
+ node = head->first; |
2688 |
+ if (node) { |
2689 |
+ head->first = node->next; |
2690 |
+- raw_spin_unlock(&head->lock); |
2691 |
++ raw_spin_unlock_irqrestore(&head->lock, flags); |
2692 |
+ return node; |
2693 |
+ } |
2694 |
+ raw_spin_unlock(&head->lock); |
2695 |
+ cpu = cpumask_next(cpu, cpu_possible_mask); |
2696 |
+ if (cpu >= nr_cpu_ids) |
2697 |
+ cpu = 0; |
2698 |
+- if (cpu == orig_cpu) |
2699 |
++ if (cpu == orig_cpu) { |
2700 |
++ local_irq_restore(flags); |
2701 |
+ return NULL; |
2702 |
++ } |
2703 |
+ } |
2704 |
+ } |
2705 |
+diff --git a/kernel/cpu.c b/kernel/cpu.c |
2706 |
+index 26a4f74bff83..e1436ca4aed0 100644 |
2707 |
+--- a/kernel/cpu.c |
2708 |
++++ b/kernel/cpu.c |
2709 |
+@@ -1321,11 +1321,6 @@ static struct cpuhp_step cpuhp_bp_states[] = { |
2710 |
+ .teardown.single = NULL, |
2711 |
+ .cant_stop = true, |
2712 |
+ }, |
2713 |
+- [CPUHP_AP_SMPCFD_DYING] = { |
2714 |
+- .name = "smpcfd:dying", |
2715 |
+- .startup.single = NULL, |
2716 |
+- .teardown.single = smpcfd_dying_cpu, |
2717 |
+- }, |
2718 |
+ /* |
2719 |
+ * Handled on controll processor until the plugged processor manages |
2720 |
+ * this itself. |
2721 |
+@@ -1367,6 +1362,11 @@ static struct cpuhp_step cpuhp_ap_states[] = { |
2722 |
+ .startup.single = NULL, |
2723 |
+ .teardown.single = rcutree_dying_cpu, |
2724 |
+ }, |
2725 |
++ [CPUHP_AP_SMPCFD_DYING] = { |
2726 |
++ .name = "smpcfd:dying", |
2727 |
++ .startup.single = NULL, |
2728 |
++ .teardown.single = smpcfd_dying_cpu, |
2729 |
++ }, |
2730 |
+ /* Entry state on starting. Interrupts enabled from here on. Transient |
2731 |
+ * state for synchronsization */ |
2732 |
+ [CPUHP_AP_ONLINE] = { |
2733 |
+diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c |
2734 |
+index fc1ef736253c..77777d918676 100644 |
2735 |
+--- a/kernel/debug/kdb/kdb_io.c |
2736 |
++++ b/kernel/debug/kdb/kdb_io.c |
2737 |
+@@ -349,7 +349,7 @@ static char *kdb_read(char *buffer, size_t bufsize) |
2738 |
+ } |
2739 |
+ kdb_printf("\n"); |
2740 |
+ for (i = 0; i < count; i++) { |
2741 |
+- if (kallsyms_symbol_next(p_tmp, i) < 0) |
2742 |
++ if (WARN_ON(!kallsyms_symbol_next(p_tmp, i))) |
2743 |
+ break; |
2744 |
+ kdb_printf("%s ", p_tmp); |
2745 |
+ *(p_tmp + len) = '\0'; |
2746 |
+diff --git a/kernel/jump_label.c b/kernel/jump_label.c |
2747 |
+index a9b8cf500591..def4548ea40c 100644 |
2748 |
+--- a/kernel/jump_label.c |
2749 |
++++ b/kernel/jump_label.c |
2750 |
+@@ -612,7 +612,7 @@ static __init int jump_label_test(void) |
2751 |
+ |
2752 |
+ return 0; |
2753 |
+ } |
2754 |
+-late_initcall(jump_label_test); |
2755 |
++early_initcall(jump_label_test); |
2756 |
+ #endif /* STATIC_KEYS_SELFTEST */ |
2757 |
+ |
2758 |
+ #endif /* HAVE_JUMP_LABEL */ |
2759 |
+diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c |
2760 |
+index 7a68c631d5b5..3d862f5b0331 100644 |
2761 |
+--- a/kernel/sched/fair.c |
2762 |
++++ b/kernel/sched/fair.c |
2763 |
+@@ -5451,7 +5451,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t |
2764 |
+ * Due to large variance we need a large fuzz factor; hackbench in |
2765 |
+ * particularly is sensitive here. |
2766 |
+ */ |
2767 |
+- if ((avg_idle / 512) < avg_cost) |
2768 |
++ if (sched_feat(SIS_AVG_CPU) && (avg_idle / 512) < avg_cost) |
2769 |
+ return -1; |
2770 |
+ |
2771 |
+ time = local_clock(); |
2772 |
+diff --git a/kernel/sched/features.h b/kernel/sched/features.h |
2773 |
+index 69631fa46c2f..1b3c8189b286 100644 |
2774 |
+--- a/kernel/sched/features.h |
2775 |
++++ b/kernel/sched/features.h |
2776 |
+@@ -51,6 +51,11 @@ SCHED_FEAT(NONTASK_CAPACITY, true) |
2777 |
+ */ |
2778 |
+ SCHED_FEAT(TTWU_QUEUE, true) |
2779 |
+ |
2780 |
++/* |
2781 |
++ * When doing wakeups, attempt to limit superfluous scans of the LLC domain. |
2782 |
++ */ |
2783 |
++SCHED_FEAT(SIS_AVG_CPU, false) |
2784 |
++ |
2785 |
+ #ifdef HAVE_RT_PUSH_IPI |
2786 |
+ /* |
2787 |
+ * In order to avoid a thundering herd attack of CPUs that are |
2788 |
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c |
2789 |
+index 296dcca77f33..181c2ad0cb54 100644 |
2790 |
+--- a/kernel/workqueue.c |
2791 |
++++ b/kernel/workqueue.c |
2792 |
+@@ -1506,6 +1506,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq, |
2793 |
+ struct timer_list *timer = &dwork->timer; |
2794 |
+ struct work_struct *work = &dwork->work; |
2795 |
+ |
2796 |
++ WARN_ON_ONCE(!wq); |
2797 |
+ WARN_ON_ONCE(timer->function != delayed_work_timer_fn || |
2798 |
+ timer->data != (unsigned long)dwork); |
2799 |
+ WARN_ON_ONCE(timer_pending(timer)); |
2800 |
+diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c |
2801 |
+index 1ef0cec38d78..dc14beae2c9a 100644 |
2802 |
+--- a/lib/asn1_decoder.c |
2803 |
++++ b/lib/asn1_decoder.c |
2804 |
+@@ -313,42 +313,47 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder, |
2805 |
+ |
2806 |
+ /* Decide how to handle the operation */ |
2807 |
+ switch (op) { |
2808 |
+- case ASN1_OP_MATCH_ANY_ACT: |
2809 |
+- case ASN1_OP_MATCH_ANY_ACT_OR_SKIP: |
2810 |
+- case ASN1_OP_COND_MATCH_ANY_ACT: |
2811 |
+- case ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP: |
2812 |
+- ret = actions[machine[pc + 1]](context, hdr, tag, data + dp, len); |
2813 |
+- if (ret < 0) |
2814 |
+- return ret; |
2815 |
+- goto skip_data; |
2816 |
+- |
2817 |
+- case ASN1_OP_MATCH_ACT: |
2818 |
+- case ASN1_OP_MATCH_ACT_OR_SKIP: |
2819 |
+- case ASN1_OP_COND_MATCH_ACT_OR_SKIP: |
2820 |
+- ret = actions[machine[pc + 2]](context, hdr, tag, data + dp, len); |
2821 |
+- if (ret < 0) |
2822 |
+- return ret; |
2823 |
+- goto skip_data; |
2824 |
+- |
2825 |
+ case ASN1_OP_MATCH: |
2826 |
+ case ASN1_OP_MATCH_OR_SKIP: |
2827 |
++ case ASN1_OP_MATCH_ACT: |
2828 |
++ case ASN1_OP_MATCH_ACT_OR_SKIP: |
2829 |
+ case ASN1_OP_MATCH_ANY: |
2830 |
+ case ASN1_OP_MATCH_ANY_OR_SKIP: |
2831 |
++ case ASN1_OP_MATCH_ANY_ACT: |
2832 |
++ case ASN1_OP_MATCH_ANY_ACT_OR_SKIP: |
2833 |
+ case ASN1_OP_COND_MATCH_OR_SKIP: |
2834 |
++ case ASN1_OP_COND_MATCH_ACT_OR_SKIP: |
2835 |
+ case ASN1_OP_COND_MATCH_ANY: |
2836 |
+ case ASN1_OP_COND_MATCH_ANY_OR_SKIP: |
2837 |
+- skip_data: |
2838 |
++ case ASN1_OP_COND_MATCH_ANY_ACT: |
2839 |
++ case ASN1_OP_COND_MATCH_ANY_ACT_OR_SKIP: |
2840 |
++ |
2841 |
+ if (!(flags & FLAG_CONS)) { |
2842 |
+ if (flags & FLAG_INDEFINITE_LENGTH) { |
2843 |
++ size_t tmp = dp; |
2844 |
++ |
2845 |
+ ret = asn1_find_indefinite_length( |
2846 |
+- data, datalen, &dp, &len, &errmsg); |
2847 |
++ data, datalen, &tmp, &len, &errmsg); |
2848 |
+ if (ret < 0) |
2849 |
+ goto error; |
2850 |
+- } else { |
2851 |
+- dp += len; |
2852 |
+ } |
2853 |
+ pr_debug("- LEAF: %zu\n", len); |
2854 |
+ } |
2855 |
++ |
2856 |
++ if (op & ASN1_OP_MATCH__ACT) { |
2857 |
++ unsigned char act; |
2858 |
++ |
2859 |
++ if (op & ASN1_OP_MATCH__ANY) |
2860 |
++ act = machine[pc + 1]; |
2861 |
++ else |
2862 |
++ act = machine[pc + 2]; |
2863 |
++ ret = actions[act](context, hdr, tag, data + dp, len); |
2864 |
++ if (ret < 0) |
2865 |
++ return ret; |
2866 |
++ } |
2867 |
++ |
2868 |
++ if (!(flags & FLAG_CONS)) |
2869 |
++ dp += len; |
2870 |
+ pc += asn1_op_lengths[op]; |
2871 |
+ goto next_op; |
2872 |
+ |
2873 |
+@@ -434,6 +439,8 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder, |
2874 |
+ else |
2875 |
+ act = machine[pc + 1]; |
2876 |
+ ret = actions[act](context, hdr, 0, data + tdp, len); |
2877 |
++ if (ret < 0) |
2878 |
++ return ret; |
2879 |
+ } |
2880 |
+ pc += asn1_op_lengths[op]; |
2881 |
+ goto next_op; |
2882 |
+diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c |
2883 |
+index da796e2dc4f5..c7c96bc7654a 100644 |
2884 |
+--- a/lib/dynamic_debug.c |
2885 |
++++ b/lib/dynamic_debug.c |
2886 |
+@@ -360,6 +360,10 @@ static int ddebug_parse_query(char *words[], int nwords, |
2887 |
+ if (parse_lineno(last, &query->last_lineno) < 0) |
2888 |
+ return -EINVAL; |
2889 |
+ |
2890 |
++ /* special case for last lineno not specified */ |
2891 |
++ if (query->last_lineno == 0) |
2892 |
++ query->last_lineno = UINT_MAX; |
2893 |
++ |
2894 |
+ if (query->last_lineno < query->first_lineno) { |
2895 |
+ pr_err("last-line:%d < 1st-line:%d\n", |
2896 |
+ query->last_lineno, |
2897 |
+diff --git a/lib/genalloc.c b/lib/genalloc.c |
2898 |
+index 144fe6b1a03e..ca06adc4f445 100644 |
2899 |
+--- a/lib/genalloc.c |
2900 |
++++ b/lib/genalloc.c |
2901 |
+@@ -194,7 +194,7 @@ int gen_pool_add_virt(struct gen_pool *pool, unsigned long virt, phys_addr_t phy |
2902 |
+ chunk->phys_addr = phys; |
2903 |
+ chunk->start_addr = virt; |
2904 |
+ chunk->end_addr = virt + size - 1; |
2905 |
+- atomic_set(&chunk->avail, size); |
2906 |
++ atomic_long_set(&chunk->avail, size); |
2907 |
+ |
2908 |
+ spin_lock(&pool->lock); |
2909 |
+ list_add_rcu(&chunk->next_chunk, &pool->chunks); |
2910 |
+@@ -304,7 +304,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, |
2911 |
+ nbits = (size + (1UL << order) - 1) >> order; |
2912 |
+ rcu_read_lock(); |
2913 |
+ list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) { |
2914 |
+- if (size > atomic_read(&chunk->avail)) |
2915 |
++ if (size > atomic_long_read(&chunk->avail)) |
2916 |
+ continue; |
2917 |
+ |
2918 |
+ start_bit = 0; |
2919 |
+@@ -324,7 +324,7 @@ unsigned long gen_pool_alloc_algo(struct gen_pool *pool, size_t size, |
2920 |
+ |
2921 |
+ addr = chunk->start_addr + ((unsigned long)start_bit << order); |
2922 |
+ size = nbits << order; |
2923 |
+- atomic_sub(size, &chunk->avail); |
2924 |
++ atomic_long_sub(size, &chunk->avail); |
2925 |
+ break; |
2926 |
+ } |
2927 |
+ rcu_read_unlock(); |
2928 |
+@@ -390,7 +390,7 @@ void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size) |
2929 |
+ remain = bitmap_clear_ll(chunk->bits, start_bit, nbits); |
2930 |
+ BUG_ON(remain); |
2931 |
+ size = nbits << order; |
2932 |
+- atomic_add(size, &chunk->avail); |
2933 |
++ atomic_long_add(size, &chunk->avail); |
2934 |
+ rcu_read_unlock(); |
2935 |
+ return; |
2936 |
+ } |
2937 |
+@@ -464,7 +464,7 @@ size_t gen_pool_avail(struct gen_pool *pool) |
2938 |
+ |
2939 |
+ rcu_read_lock(); |
2940 |
+ list_for_each_entry_rcu(chunk, &pool->chunks, next_chunk) |
2941 |
+- avail += atomic_read(&chunk->avail); |
2942 |
++ avail += atomic_long_read(&chunk->avail); |
2943 |
+ rcu_read_unlock(); |
2944 |
+ return avail; |
2945 |
+ } |
2946 |
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c |
2947 |
+index 3cae1dcf069c..c234c078693c 100644 |
2948 |
+--- a/mm/huge_memory.c |
2949 |
++++ b/mm/huge_memory.c |
2950 |
+@@ -1509,37 +1509,69 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
2951 |
+ { |
2952 |
+ struct mm_struct *mm = vma->vm_mm; |
2953 |
+ spinlock_t *ptl; |
2954 |
+- int ret = 0; |
2955 |
++ pmd_t entry; |
2956 |
++ bool preserve_write; |
2957 |
++ int ret; |
2958 |
+ |
2959 |
+ ptl = __pmd_trans_huge_lock(pmd, vma); |
2960 |
+- if (ptl) { |
2961 |
+- pmd_t entry; |
2962 |
+- bool preserve_write = prot_numa && pmd_write(*pmd); |
2963 |
+- ret = 1; |
2964 |
++ if (!ptl) |
2965 |
++ return 0; |
2966 |
+ |
2967 |
+- /* |
2968 |
+- * Avoid trapping faults against the zero page. The read-only |
2969 |
+- * data is likely to be read-cached on the local CPU and |
2970 |
+- * local/remote hits to the zero page are not interesting. |
2971 |
+- */ |
2972 |
+- if (prot_numa && is_huge_zero_pmd(*pmd)) { |
2973 |
+- spin_unlock(ptl); |
2974 |
+- return ret; |
2975 |
+- } |
2976 |
++ preserve_write = prot_numa && pmd_write(*pmd); |
2977 |
++ ret = 1; |
2978 |
+ |
2979 |
+- if (!prot_numa || !pmd_protnone(*pmd)) { |
2980 |
+- entry = pmdp_huge_get_and_clear_notify(mm, addr, pmd); |
2981 |
+- entry = pmd_modify(entry, newprot); |
2982 |
+- if (preserve_write) |
2983 |
+- entry = pmd_mkwrite(entry); |
2984 |
+- ret = HPAGE_PMD_NR; |
2985 |
+- set_pmd_at(mm, addr, pmd, entry); |
2986 |
+- BUG_ON(vma_is_anonymous(vma) && !preserve_write && |
2987 |
+- pmd_write(entry)); |
2988 |
+- } |
2989 |
+- spin_unlock(ptl); |
2990 |
+- } |
2991 |
++ /* |
2992 |
++ * Avoid trapping faults against the zero page. The read-only |
2993 |
++ * data is likely to be read-cached on the local CPU and |
2994 |
++ * local/remote hits to the zero page are not interesting. |
2995 |
++ */ |
2996 |
++ if (prot_numa && is_huge_zero_pmd(*pmd)) |
2997 |
++ goto unlock; |
2998 |
++ |
2999 |
++ if (prot_numa && pmd_protnone(*pmd)) |
3000 |
++ goto unlock; |
3001 |
++ |
3002 |
++ /* |
3003 |
++ * In case prot_numa, we are under down_read(mmap_sem). It's critical |
3004 |
++ * to not clear pmd intermittently to avoid race with MADV_DONTNEED |
3005 |
++ * which is also under down_read(mmap_sem): |
3006 |
++ * |
3007 |
++ * CPU0: CPU1: |
3008 |
++ * change_huge_pmd(prot_numa=1) |
3009 |
++ * pmdp_huge_get_and_clear_notify() |
3010 |
++ * madvise_dontneed() |
3011 |
++ * zap_pmd_range() |
3012 |
++ * pmd_trans_huge(*pmd) == 0 (without ptl) |
3013 |
++ * // skip the pmd |
3014 |
++ * set_pmd_at(); |
3015 |
++ * // pmd is re-established |
3016 |
++ * |
3017 |
++ * The race makes MADV_DONTNEED miss the huge pmd and don't clear it |
3018 |
++ * which may break userspace. |
3019 |
++ * |
3020 |
++ * pmdp_invalidate() is required to make sure we don't miss |
3021 |
++ * dirty/young flags set by hardware. |
3022 |
++ */ |
3023 |
++ entry = *pmd; |
3024 |
++ pmdp_invalidate(vma, addr, pmd); |
3025 |
+ |
3026 |
++ /* |
3027 |
++ * Recover dirty/young flags. It relies on pmdp_invalidate to not |
3028 |
++ * corrupt them. |
3029 |
++ */ |
3030 |
++ if (pmd_dirty(*pmd)) |
3031 |
++ entry = pmd_mkdirty(entry); |
3032 |
++ if (pmd_young(*pmd)) |
3033 |
++ entry = pmd_mkyoung(entry); |
3034 |
++ |
3035 |
++ entry = pmd_modify(entry, newprot); |
3036 |
++ if (preserve_write) |
3037 |
++ entry = pmd_mkwrite(entry); |
3038 |
++ ret = HPAGE_PMD_NR; |
3039 |
++ set_pmd_at(mm, addr, pmd, entry); |
3040 |
++ BUG_ON(vma_is_anonymous(vma) && !preserve_write && pmd_write(entry)); |
3041 |
++unlock: |
3042 |
++ spin_unlock(ptl); |
3043 |
+ return ret; |
3044 |
+ } |
3045 |
+ |
3046 |
+diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c |
3047 |
+index 1689bb58e0d1..d3548c48369f 100644 |
3048 |
+--- a/mm/zsmalloc.c |
3049 |
++++ b/mm/zsmalloc.c |
3050 |
+@@ -1407,7 +1407,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, |
3051 |
+ * pools/users, we can't allow mapping in interrupt context |
3052 |
+ * because it can corrupt another users mappings. |
3053 |
+ */ |
3054 |
+- WARN_ON_ONCE(in_interrupt()); |
3055 |
++ BUG_ON(in_interrupt()); |
3056 |
+ |
3057 |
+ /* From now on, migration cannot move the object */ |
3058 |
+ pin_tag(handle); |
3059 |
+diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
3060 |
+index 713c09a74b90..0c9ded247ebb 100644 |
3061 |
+--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
3062 |
++++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
3063 |
+@@ -158,6 +158,10 @@ static unsigned int ipv4_conntrack_local(void *priv, |
3064 |
+ if (skb->len < sizeof(struct iphdr) || |
3065 |
+ ip_hdrlen(skb) < sizeof(struct iphdr)) |
3066 |
+ return NF_ACCEPT; |
3067 |
++ |
3068 |
++ if (ip_is_fragment(ip_hdr(skb))) /* IP_NODEFRAG setsockopt set */ |
3069 |
++ return NF_ACCEPT; |
3070 |
++ |
3071 |
+ return nf_conntrack_in(state->net, PF_INET, state->hook, skb); |
3072 |
+ } |
3073 |
+ |
3074 |
+diff --git a/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c |
3075 |
+index f8aad03d674b..6f5e8d01b876 100644 |
3076 |
+--- a/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c |
3077 |
++++ b/net/ipv4/netfilter/nf_nat_l3proto_ipv4.c |
3078 |
+@@ -255,11 +255,6 @@ nf_nat_ipv4_fn(void *priv, struct sk_buff *skb, |
3079 |
+ /* maniptype == SRC for postrouting. */ |
3080 |
+ enum nf_nat_manip_type maniptype = HOOK2MANIP(state->hook); |
3081 |
+ |
3082 |
+- /* We never see fragments: conntrack defrags on pre-routing |
3083 |
+- * and local-out, and nf_nat_out protects post-routing. |
3084 |
+- */ |
3085 |
+- NF_CT_ASSERT(!ip_is_fragment(ip_hdr(skb))); |
3086 |
+- |
3087 |
+ ct = nf_ct_get(skb, &ctinfo); |
3088 |
+ /* Can't track? It's not due to stress, or conntrack would |
3089 |
+ * have dropped it. Hence it's the user's responsibilty to |
3090 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
3091 |
+index 6a5b7783932e..7ac319222558 100644 |
3092 |
+--- a/net/ipv4/route.c |
3093 |
++++ b/net/ipv4/route.c |
3094 |
+@@ -630,9 +630,12 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3095 |
+ struct fnhe_hash_bucket *hash; |
3096 |
+ struct fib_nh_exception *fnhe; |
3097 |
+ struct rtable *rt; |
3098 |
++ u32 genid, hval; |
3099 |
+ unsigned int i; |
3100 |
+ int depth; |
3101 |
+- u32 hval = fnhe_hashfun(daddr); |
3102 |
++ |
3103 |
++ genid = fnhe_genid(dev_net(nh->nh_dev)); |
3104 |
++ hval = fnhe_hashfun(daddr); |
3105 |
+ |
3106 |
+ spin_lock_bh(&fnhe_lock); |
3107 |
+ |
3108 |
+@@ -655,12 +658,13 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3109 |
+ } |
3110 |
+ |
3111 |
+ if (fnhe) { |
3112 |
++ if (fnhe->fnhe_genid != genid) |
3113 |
++ fnhe->fnhe_genid = genid; |
3114 |
+ if (gw) |
3115 |
+ fnhe->fnhe_gw = gw; |
3116 |
+- if (pmtu) { |
3117 |
++ if (pmtu) |
3118 |
+ fnhe->fnhe_pmtu = pmtu; |
3119 |
+- fnhe->fnhe_expires = max(1UL, expires); |
3120 |
+- } |
3121 |
++ fnhe->fnhe_expires = max(1UL, expires); |
3122 |
+ /* Update all cached dsts too */ |
3123 |
+ rt = rcu_dereference(fnhe->fnhe_rth_input); |
3124 |
+ if (rt) |
3125 |
+@@ -679,7 +683,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
3126 |
+ fnhe->fnhe_next = hash->chain; |
3127 |
+ rcu_assign_pointer(hash->chain, fnhe); |
3128 |
+ } |
3129 |
+- fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev)); |
3130 |
++ fnhe->fnhe_genid = genid; |
3131 |
+ fnhe->fnhe_daddr = daddr; |
3132 |
+ fnhe->fnhe_gw = gw; |
3133 |
+ fnhe->fnhe_pmtu = pmtu; |
3134 |
+diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c |
3135 |
+index 46ad699937fd..8285a1c108c9 100644 |
3136 |
+--- a/net/ipv6/af_inet6.c |
3137 |
++++ b/net/ipv6/af_inet6.c |
3138 |
+@@ -909,12 +909,12 @@ static int __init inet6_init(void) |
3139 |
+ err = register_pernet_subsys(&inet6_net_ops); |
3140 |
+ if (err) |
3141 |
+ goto register_pernet_fail; |
3142 |
+- err = icmpv6_init(); |
3143 |
+- if (err) |
3144 |
+- goto icmp_fail; |
3145 |
+ err = ip6_mr_init(); |
3146 |
+ if (err) |
3147 |
+ goto ipmr_fail; |
3148 |
++ err = icmpv6_init(); |
3149 |
++ if (err) |
3150 |
++ goto icmp_fail; |
3151 |
+ err = ndisc_init(); |
3152 |
+ if (err) |
3153 |
+ goto ndisc_fail; |
3154 |
+@@ -1044,10 +1044,10 @@ static int __init inet6_init(void) |
3155 |
+ ndisc_cleanup(); |
3156 |
+ ndisc_fail: |
3157 |
+ ip6_mr_cleanup(); |
3158 |
+-ipmr_fail: |
3159 |
+- icmpv6_cleanup(); |
3160 |
+ icmp_fail: |
3161 |
+ unregister_pernet_subsys(&inet6_net_ops); |
3162 |
++ipmr_fail: |
3163 |
++ icmpv6_cleanup(); |
3164 |
+ register_pernet_fail: |
3165 |
+ sock_unregister(PF_INET6); |
3166 |
+ rtnl_unregister_all(PF_INET6); |
3167 |
+diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c |
3168 |
+index e9b14e3493f2..c46066c5dc27 100644 |
3169 |
+--- a/net/ipv6/ip6_gre.c |
3170 |
++++ b/net/ipv6/ip6_gre.c |
3171 |
+@@ -461,7 +461,7 @@ static int ip6gre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi) |
3172 |
+ &ipv6h->saddr, &ipv6h->daddr, tpi->key, |
3173 |
+ tpi->proto); |
3174 |
+ if (tunnel) { |
3175 |
+- ip6_tnl_rcv(tunnel, skb, tpi, NULL, false); |
3176 |
++ ip6_tnl_rcv(tunnel, skb, tpi, NULL, log_ecn_error); |
3177 |
+ |
3178 |
+ return PACKET_RCVD; |
3179 |
+ } |
3180 |
+diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c |
3181 |
+index 67e882d49195..912333586de6 100644 |
3182 |
+--- a/net/ipv6/ip6_vti.c |
3183 |
++++ b/net/ipv6/ip6_vti.c |
3184 |
+@@ -485,11 +485,15 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl) |
3185 |
+ if (!skb->ignore_df && skb->len > mtu) { |
3186 |
+ skb_dst(skb)->ops->update_pmtu(dst, NULL, skb, mtu); |
3187 |
+ |
3188 |
+- if (skb->protocol == htons(ETH_P_IPV6)) |
3189 |
++ if (skb->protocol == htons(ETH_P_IPV6)) { |
3190 |
++ if (mtu < IPV6_MIN_MTU) |
3191 |
++ mtu = IPV6_MIN_MTU; |
3192 |
++ |
3193 |
+ icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
3194 |
+- else |
3195 |
++ } else { |
3196 |
+ icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, |
3197 |
+ htonl(mtu)); |
3198 |
++ } |
3199 |
+ |
3200 |
+ return -EMSGSIZE; |
3201 |
+ } |
3202 |
+diff --git a/net/rds/tcp.c b/net/rds/tcp.c |
3203 |
+index 20e2923dc827..78f976d32018 100644 |
3204 |
+--- a/net/rds/tcp.c |
3205 |
++++ b/net/rds/tcp.c |
3206 |
+@@ -478,9 +478,10 @@ static void __net_exit rds_tcp_exit_net(struct net *net) |
3207 |
+ * we do need to clean up the listen socket here. |
3208 |
+ */ |
3209 |
+ if (rtn->rds_tcp_listen_sock) { |
3210 |
+- rds_tcp_listen_stop(rtn->rds_tcp_listen_sock); |
3211 |
++ struct socket *lsock = rtn->rds_tcp_listen_sock; |
3212 |
++ |
3213 |
+ rtn->rds_tcp_listen_sock = NULL; |
3214 |
+- flush_work(&rtn->rds_tcp_accept_w); |
3215 |
++ rds_tcp_listen_stop(lsock, &rtn->rds_tcp_accept_w); |
3216 |
+ } |
3217 |
+ } |
3218 |
+ |
3219 |
+@@ -517,10 +518,10 @@ static void rds_tcp_kill_sock(struct net *net) |
3220 |
+ struct rds_tcp_connection *tc, *_tc; |
3221 |
+ LIST_HEAD(tmp_list); |
3222 |
+ struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid); |
3223 |
++ struct socket *lsock = rtn->rds_tcp_listen_sock; |
3224 |
+ |
3225 |
+- rds_tcp_listen_stop(rtn->rds_tcp_listen_sock); |
3226 |
+ rtn->rds_tcp_listen_sock = NULL; |
3227 |
+- flush_work(&rtn->rds_tcp_accept_w); |
3228 |
++ rds_tcp_listen_stop(lsock, &rtn->rds_tcp_accept_w); |
3229 |
+ spin_lock_irq(&rds_tcp_conn_lock); |
3230 |
+ list_for_each_entry_safe(tc, _tc, &rds_tcp_conn_list, t_tcp_node) { |
3231 |
+ struct net *c_net = read_pnet(&tc->t_cpath->cp_conn->c_net); |
3232 |
+@@ -540,8 +541,12 @@ static void rds_tcp_kill_sock(struct net *net) |
3233 |
+ void *rds_tcp_listen_sock_def_readable(struct net *net) |
3234 |
+ { |
3235 |
+ struct rds_tcp_net *rtn = net_generic(net, rds_tcp_netid); |
3236 |
++ struct socket *lsock = rtn->rds_tcp_listen_sock; |
3237 |
++ |
3238 |
++ if (!lsock) |
3239 |
++ return NULL; |
3240 |
+ |
3241 |
+- return rtn->rds_tcp_listen_sock->sk->sk_user_data; |
3242 |
++ return lsock->sk->sk_user_data; |
3243 |
+ } |
3244 |
+ |
3245 |
+ static int rds_tcp_dev_event(struct notifier_block *this, |
3246 |
+diff --git a/net/rds/tcp.h b/net/rds/tcp.h |
3247 |
+index 9a1cc8906576..56ea6620fcf9 100644 |
3248 |
+--- a/net/rds/tcp.h |
3249 |
++++ b/net/rds/tcp.h |
3250 |
+@@ -66,7 +66,7 @@ void rds_tcp_state_change(struct sock *sk); |
3251 |
+ |
3252 |
+ /* tcp_listen.c */ |
3253 |
+ struct socket *rds_tcp_listen_init(struct net *); |
3254 |
+-void rds_tcp_listen_stop(struct socket *); |
3255 |
++void rds_tcp_listen_stop(struct socket *sock, struct work_struct *acceptor); |
3256 |
+ void rds_tcp_listen_data_ready(struct sock *sk); |
3257 |
+ int rds_tcp_accept_one(struct socket *sock); |
3258 |
+ int rds_tcp_keepalive(struct socket *sock); |
3259 |
+diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c |
3260 |
+index 525b624fec8b..185a56b1e29c 100644 |
3261 |
+--- a/net/rds/tcp_listen.c |
3262 |
++++ b/net/rds/tcp_listen.c |
3263 |
+@@ -227,6 +227,9 @@ void rds_tcp_listen_data_ready(struct sock *sk) |
3264 |
+ * before it has been accepted and the accepter has set up their |
3265 |
+ * data_ready.. we only want to queue listen work for our listening |
3266 |
+ * socket |
3267 |
++ * |
3268 |
++ * (*ready)() may be null if we are racing with netns delete, and |
3269 |
++ * the listen socket is being torn down. |
3270 |
+ */ |
3271 |
+ if (sk->sk_state == TCP_LISTEN) |
3272 |
+ rds_tcp_accept_work(sk); |
3273 |
+@@ -235,7 +238,8 @@ void rds_tcp_listen_data_ready(struct sock *sk) |
3274 |
+ |
3275 |
+ out: |
3276 |
+ read_unlock_bh(&sk->sk_callback_lock); |
3277 |
+- ready(sk); |
3278 |
++ if (ready) |
3279 |
++ ready(sk); |
3280 |
+ } |
3281 |
+ |
3282 |
+ struct socket *rds_tcp_listen_init(struct net *net) |
3283 |
+@@ -275,7 +279,7 @@ struct socket *rds_tcp_listen_init(struct net *net) |
3284 |
+ return NULL; |
3285 |
+ } |
3286 |
+ |
3287 |
+-void rds_tcp_listen_stop(struct socket *sock) |
3288 |
++void rds_tcp_listen_stop(struct socket *sock, struct work_struct *acceptor) |
3289 |
+ { |
3290 |
+ struct sock *sk; |
3291 |
+ |
3292 |
+@@ -296,5 +300,6 @@ void rds_tcp_listen_stop(struct socket *sock) |
3293 |
+ |
3294 |
+ /* wait for accepts to stop and close the socket */ |
3295 |
+ flush_workqueue(rds_wq); |
3296 |
++ flush_work(acceptor); |
3297 |
+ sock_release(sock); |
3298 |
+ } |
3299 |
+diff --git a/net/sctp/socket.c b/net/sctp/socket.c |
3300 |
+index c062ceae19e6..c2ab864da50d 100644 |
3301 |
+--- a/net/sctp/socket.c |
3302 |
++++ b/net/sctp/socket.c |
3303 |
+@@ -82,8 +82,8 @@ |
3304 |
+ /* Forward declarations for internal helper functions. */ |
3305 |
+ static int sctp_writeable(struct sock *sk); |
3306 |
+ static void sctp_wfree(struct sk_buff *skb); |
3307 |
+-static int sctp_wait_for_sndbuf(struct sctp_association *, long *timeo_p, |
3308 |
+- size_t msg_len); |
3309 |
++static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3310 |
++ size_t msg_len, struct sock **orig_sk); |
3311 |
+ static int sctp_wait_for_packet(struct sock *sk, int *err, long *timeo_p); |
3312 |
+ static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p); |
3313 |
+ static int sctp_wait_for_accept(struct sock *sk, long timeo); |
3314 |
+@@ -1957,9 +1957,16 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) |
3315 |
+ |
3316 |
+ timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); |
3317 |
+ if (!sctp_wspace(asoc)) { |
3318 |
+- err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); |
3319 |
+- if (err) |
3320 |
++ /* sk can be changed by peel off when waiting for buf. */ |
3321 |
++ err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len, &sk); |
3322 |
++ if (err) { |
3323 |
++ if (err == -ESRCH) { |
3324 |
++ /* asoc is already dead. */ |
3325 |
++ new_asoc = NULL; |
3326 |
++ err = -EPIPE; |
3327 |
++ } |
3328 |
+ goto out_free; |
3329 |
++ } |
3330 |
+ } |
3331 |
+ |
3332 |
+ /* If an address is passed with the sendto/sendmsg call, it is used |
3333 |
+@@ -4771,12 +4778,6 @@ int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) |
3334 |
+ if (!asoc) |
3335 |
+ return -EINVAL; |
3336 |
+ |
3337 |
+- /* If there is a thread waiting on more sndbuf space for |
3338 |
+- * sending on this asoc, it cannot be peeled. |
3339 |
+- */ |
3340 |
+- if (waitqueue_active(&asoc->wait)) |
3341 |
+- return -EBUSY; |
3342 |
+- |
3343 |
+ /* An association cannot be branched off from an already peeled-off |
3344 |
+ * socket, nor is this supported for tcp style sockets. |
3345 |
+ */ |
3346 |
+@@ -7440,7 +7441,7 @@ void sctp_sock_rfree(struct sk_buff *skb) |
3347 |
+ |
3348 |
+ /* Helper function to wait for space in the sndbuf. */ |
3349 |
+ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3350 |
+- size_t msg_len) |
3351 |
++ size_t msg_len, struct sock **orig_sk) |
3352 |
+ { |
3353 |
+ struct sock *sk = asoc->base.sk; |
3354 |
+ int err = 0; |
3355 |
+@@ -7457,10 +7458,11 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3356 |
+ for (;;) { |
3357 |
+ prepare_to_wait_exclusive(&asoc->wait, &wait, |
3358 |
+ TASK_INTERRUPTIBLE); |
3359 |
++ if (asoc->base.dead) |
3360 |
++ goto do_dead; |
3361 |
+ if (!*timeo_p) |
3362 |
+ goto do_nonblock; |
3363 |
+- if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING || |
3364 |
+- asoc->base.dead) |
3365 |
++ if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING) |
3366 |
+ goto do_error; |
3367 |
+ if (signal_pending(current)) |
3368 |
+ goto do_interrupted; |
3369 |
+@@ -7473,11 +7475,17 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3370 |
+ release_sock(sk); |
3371 |
+ current_timeo = schedule_timeout(current_timeo); |
3372 |
+ lock_sock(sk); |
3373 |
++ if (sk != asoc->base.sk) { |
3374 |
++ release_sock(sk); |
3375 |
++ sk = asoc->base.sk; |
3376 |
++ lock_sock(sk); |
3377 |
++ } |
3378 |
+ |
3379 |
+ *timeo_p = current_timeo; |
3380 |
+ } |
3381 |
+ |
3382 |
+ out: |
3383 |
++ *orig_sk = sk; |
3384 |
+ finish_wait(&asoc->wait, &wait); |
3385 |
+ |
3386 |
+ /* Release the association's refcnt. */ |
3387 |
+@@ -7485,6 +7493,10 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, |
3388 |
+ |
3389 |
+ return err; |
3390 |
+ |
3391 |
++do_dead: |
3392 |
++ err = -ESRCH; |
3393 |
++ goto out; |
3394 |
++ |
3395 |
+ do_error: |
3396 |
+ err = -EPIPE; |
3397 |
+ goto out; |
3398 |
+diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
3399 |
+index 5db68b371db2..600eacce653a 100644 |
3400 |
+--- a/net/sunrpc/sched.c |
3401 |
++++ b/net/sunrpc/sched.c |
3402 |
+@@ -274,10 +274,9 @@ static inline void rpc_task_set_debuginfo(struct rpc_task *task) |
3403 |
+ |
3404 |
+ static void rpc_set_active(struct rpc_task *task) |
3405 |
+ { |
3406 |
+- trace_rpc_task_begin(task->tk_client, task, NULL); |
3407 |
+- |
3408 |
+ rpc_task_set_debuginfo(task); |
3409 |
+ set_bit(RPC_TASK_ACTIVE, &task->tk_runstate); |
3410 |
++ trace_rpc_task_begin(task->tk_client, task, NULL); |
3411 |
+ } |
3412 |
+ |
3413 |
+ /* |
3414 |
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c |
3415 |
+index 8ce5711ea21b..f19e6a57e118 100644 |
3416 |
+--- a/net/xfrm/xfrm_policy.c |
3417 |
++++ b/net/xfrm/xfrm_policy.c |
3418 |
+@@ -1393,6 +1393,7 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir) |
3419 |
+ newp->xfrm_nr = old->xfrm_nr; |
3420 |
+ newp->index = old->index; |
3421 |
+ newp->type = old->type; |
3422 |
++ newp->family = old->family; |
3423 |
+ memcpy(newp->xfrm_vec, old->xfrm_vec, |
3424 |
+ newp->xfrm_nr*sizeof(struct xfrm_tmpl)); |
3425 |
+ spin_lock_bh(&net->xfrm.xfrm_policy_lock); |
3426 |
+diff --git a/scripts/coccicheck b/scripts/coccicheck |
3427 |
+index ec487b8e7051..c36b04b41686 100755 |
3428 |
+--- a/scripts/coccicheck |
3429 |
++++ b/scripts/coccicheck |
3430 |
+@@ -29,12 +29,6 @@ else |
3431 |
+ VERBOSE=0 |
3432 |
+ fi |
3433 |
+ |
3434 |
+-if [ -z "$J" ]; then |
3435 |
+- NPROC=$(getconf _NPROCESSORS_ONLN) |
3436 |
+-else |
3437 |
+- NPROC="$J" |
3438 |
+-fi |
3439 |
+- |
3440 |
+ FLAGS="--very-quiet" |
3441 |
+ |
3442 |
+ # You can use SPFLAGS to append extra arguments to coccicheck or override any |
3443 |
+@@ -69,6 +63,9 @@ if [ "$C" = "1" -o "$C" = "2" ]; then |
3444 |
+ # Take only the last argument, which is the C file to test |
3445 |
+ shift $(( $# - 1 )) |
3446 |
+ OPTIONS="$COCCIINCLUDE $1" |
3447 |
++ |
3448 |
++ # No need to parallelize Coccinelle since this mode takes one input file. |
3449 |
++ NPROC=1 |
3450 |
+ else |
3451 |
+ ONLINE=0 |
3452 |
+ if [ "$KBUILD_EXTMOD" = "" ] ; then |
3453 |
+@@ -76,6 +73,12 @@ else |
3454 |
+ else |
3455 |
+ OPTIONS="--dir $KBUILD_EXTMOD $COCCIINCLUDE" |
3456 |
+ fi |
3457 |
++ |
3458 |
++ if [ -z "$J" ]; then |
3459 |
++ NPROC=$(getconf _NPROCESSORS_ONLN) |
3460 |
++ else |
3461 |
++ NPROC="$J" |
3462 |
++ fi |
3463 |
+ fi |
3464 |
+ |
3465 |
+ if [ "$KBUILD_EXTMOD" != "" ] ; then |
3466 |
+diff --git a/scripts/module-common.lds b/scripts/module-common.lds |
3467 |
+index 73a2c7da0e55..53234e85192a 100644 |
3468 |
+--- a/scripts/module-common.lds |
3469 |
++++ b/scripts/module-common.lds |
3470 |
+@@ -19,4 +19,6 @@ SECTIONS { |
3471 |
+ |
3472 |
+ . = ALIGN(8); |
3473 |
+ .init_array 0 : { *(SORT(.init_array.*)) *(.init_array) } |
3474 |
++ |
3475 |
++ __jump_table 0 : ALIGN(8) { KEEP(*(__jump_table)) } |
3476 |
+ } |
3477 |
+diff --git a/scripts/package/Makefile b/scripts/package/Makefile |
3478 |
+index 71b4a8af9d4d..7badec3498b8 100644 |
3479 |
+--- a/scripts/package/Makefile |
3480 |
++++ b/scripts/package/Makefile |
3481 |
+@@ -39,10 +39,9 @@ if test "$(objtree)" != "$(srctree)"; then \ |
3482 |
+ false; \ |
3483 |
+ fi ; \ |
3484 |
+ $(srctree)/scripts/setlocalversion --save-scmversion; \ |
3485 |
+-ln -sf $(srctree) $(2); \ |
3486 |
+ tar -cz $(RCS_TAR_IGNORE) -f $(2).tar.gz \ |
3487 |
+- $(addprefix $(2)/,$(TAR_CONTENT) $(3)); \ |
3488 |
+-rm -f $(2) $(objtree)/.scmversion |
3489 |
++ --transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3); \ |
3490 |
++rm -f $(objtree)/.scmversion |
3491 |
+ |
3492 |
+ # rpm-pkg |
3493 |
+ # --------------------------------------------------------------------------- |
3494 |
+diff --git a/security/keys/request_key.c b/security/keys/request_key.c |
3495 |
+index 5030fcf23681..cb7f8f730c6d 100644 |
3496 |
+--- a/security/keys/request_key.c |
3497 |
++++ b/security/keys/request_key.c |
3498 |
+@@ -250,11 +250,12 @@ static int construct_key(struct key *key, const void *callout_info, |
3499 |
+ * The keyring selected is returned with an extra reference upon it which the |
3500 |
+ * caller must release. |
3501 |
+ */ |
3502 |
+-static void construct_get_dest_keyring(struct key **_dest_keyring) |
3503 |
++static int construct_get_dest_keyring(struct key **_dest_keyring) |
3504 |
+ { |
3505 |
+ struct request_key_auth *rka; |
3506 |
+ const struct cred *cred = current_cred(); |
3507 |
+ struct key *dest_keyring = *_dest_keyring, *authkey; |
3508 |
++ int ret; |
3509 |
+ |
3510 |
+ kenter("%p", dest_keyring); |
3511 |
+ |
3512 |
+@@ -263,6 +264,8 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
3513 |
+ /* the caller supplied one */ |
3514 |
+ key_get(dest_keyring); |
3515 |
+ } else { |
3516 |
++ bool do_perm_check = true; |
3517 |
++ |
3518 |
+ /* use a default keyring; falling through the cases until we |
3519 |
+ * find one that we actually have */ |
3520 |
+ switch (cred->jit_keyring) { |
3521 |
+@@ -277,8 +280,10 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
3522 |
+ dest_keyring = |
3523 |
+ key_get(rka->dest_keyring); |
3524 |
+ up_read(&authkey->sem); |
3525 |
+- if (dest_keyring) |
3526 |
++ if (dest_keyring) { |
3527 |
++ do_perm_check = false; |
3528 |
+ break; |
3529 |
++ } |
3530 |
+ } |
3531 |
+ |
3532 |
+ case KEY_REQKEY_DEFL_THREAD_KEYRING: |
3533 |
+@@ -313,11 +318,29 @@ static void construct_get_dest_keyring(struct key **_dest_keyring) |
3534 |
+ default: |
3535 |
+ BUG(); |
3536 |
+ } |
3537 |
++ |
3538 |
++ /* |
3539 |
++ * Require Write permission on the keyring. This is essential |
3540 |
++ * because the default keyring may be the session keyring, and |
3541 |
++ * joining a keyring only requires Search permission. |
3542 |
++ * |
3543 |
++ * However, this check is skipped for the "requestor keyring" so |
3544 |
++ * that /sbin/request-key can itself use request_key() to add |
3545 |
++ * keys to the original requestor's destination keyring. |
3546 |
++ */ |
3547 |
++ if (dest_keyring && do_perm_check) { |
3548 |
++ ret = key_permission(make_key_ref(dest_keyring, 1), |
3549 |
++ KEY_NEED_WRITE); |
3550 |
++ if (ret) { |
3551 |
++ key_put(dest_keyring); |
3552 |
++ return ret; |
3553 |
++ } |
3554 |
++ } |
3555 |
+ } |
3556 |
+ |
3557 |
+ *_dest_keyring = dest_keyring; |
3558 |
+ kleave(" [dk %d]", key_serial(dest_keyring)); |
3559 |
+- return; |
3560 |
++ return 0; |
3561 |
+ } |
3562 |
+ |
3563 |
+ /* |
3564 |
+@@ -443,11 +466,15 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
3565 |
+ if (ctx->index_key.type == &key_type_keyring) |
3566 |
+ return ERR_PTR(-EPERM); |
3567 |
+ |
3568 |
+- user = key_user_lookup(current_fsuid()); |
3569 |
+- if (!user) |
3570 |
+- return ERR_PTR(-ENOMEM); |
3571 |
++ ret = construct_get_dest_keyring(&dest_keyring); |
3572 |
++ if (ret) |
3573 |
++ goto error; |
3574 |
+ |
3575 |
+- construct_get_dest_keyring(&dest_keyring); |
3576 |
++ user = key_user_lookup(current_fsuid()); |
3577 |
++ if (!user) { |
3578 |
++ ret = -ENOMEM; |
3579 |
++ goto error_put_dest_keyring; |
3580 |
++ } |
3581 |
+ |
3582 |
+ ret = construct_alloc_key(ctx, dest_keyring, flags, user, &key); |
3583 |
+ key_user_put(user); |
3584 |
+@@ -462,7 +489,7 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
3585 |
+ } else if (ret == -EINPROGRESS) { |
3586 |
+ ret = 0; |
3587 |
+ } else { |
3588 |
+- goto couldnt_alloc_key; |
3589 |
++ goto error_put_dest_keyring; |
3590 |
+ } |
3591 |
+ |
3592 |
+ key_put(dest_keyring); |
3593 |
+@@ -472,8 +499,9 @@ static struct key *construct_key_and_link(struct keyring_search_context *ctx, |
3594 |
+ construction_failed: |
3595 |
+ key_negate_and_link(key, key_negative_timeout, NULL, NULL); |
3596 |
+ key_put(key); |
3597 |
+-couldnt_alloc_key: |
3598 |
++error_put_dest_keyring: |
3599 |
+ key_put(dest_keyring); |
3600 |
++error: |
3601 |
+ kleave(" = %d", ret); |
3602 |
+ return ERR_PTR(ret); |
3603 |
+ } |
3604 |
+diff --git a/sound/core/pcm.c b/sound/core/pcm.c |
3605 |
+index 8e980aa678d0..074363b63cc4 100644 |
3606 |
+--- a/sound/core/pcm.c |
3607 |
++++ b/sound/core/pcm.c |
3608 |
+@@ -149,7 +149,9 @@ static int snd_pcm_control_ioctl(struct snd_card *card, |
3609 |
+ err = -ENXIO; |
3610 |
+ goto _error; |
3611 |
+ } |
3612 |
++ mutex_lock(&pcm->open_mutex); |
3613 |
+ err = snd_pcm_info_user(substream, info); |
3614 |
++ mutex_unlock(&pcm->open_mutex); |
3615 |
+ _error: |
3616 |
+ mutex_unlock(®ister_mutex); |
3617 |
+ return err; |
3618 |
+diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c |
3619 |
+index 37d9cfbc29f9..b80985fbc334 100644 |
3620 |
+--- a/sound/core/seq/seq_timer.c |
3621 |
++++ b/sound/core/seq/seq_timer.c |
3622 |
+@@ -355,7 +355,7 @@ static int initialize_timer(struct snd_seq_timer *tmr) |
3623 |
+ unsigned long freq; |
3624 |
+ |
3625 |
+ t = tmr->timeri->timer; |
3626 |
+- if (snd_BUG_ON(!t)) |
3627 |
++ if (!t) |
3628 |
+ return -EINVAL; |
3629 |
+ |
3630 |
+ freq = tmr->preferred_resolution; |
3631 |
+diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c |
3632 |
+index 6f9b388ec5a8..3f95d6b88f8c 100644 |
3633 |
+--- a/sound/soc/sh/rcar/ssiu.c |
3634 |
++++ b/sound/soc/sh/rcar/ssiu.c |
3635 |
+@@ -44,7 +44,11 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, |
3636 |
+ mask1 = (1 << 4) | (1 << 20); /* mask sync bit */ |
3637 |
+ mask2 = (1 << 4); /* mask sync bit */ |
3638 |
+ val1 = val2 = 0; |
3639 |
+- if (rsnd_ssi_is_pin_sharing(io)) { |
3640 |
++ if (id == 8) { |
3641 |
++ /* |
3642 |
++ * SSI8 pin is sharing with SSI7, nothing to do. |
3643 |
++ */ |
3644 |
++ } else if (rsnd_ssi_is_pin_sharing(io)) { |
3645 |
+ int shift = -1; |
3646 |
+ |
3647 |
+ switch (id) { |
3648 |
+diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c |
3649 |
+index 9133d3e53d9d..24c897f0b571 100644 |
3650 |
+--- a/sound/usb/mixer.c |
3651 |
++++ b/sound/usb/mixer.c |
3652 |
+@@ -204,6 +204,10 @@ static int snd_usb_copy_string_desc(struct mixer_build *state, |
3653 |
+ int index, char *buf, int maxlen) |
3654 |
+ { |
3655 |
+ int len = usb_string(state->chip->dev, index, buf, maxlen - 1); |
3656 |
++ |
3657 |
++ if (len < 0) |
3658 |
++ return 0; |
3659 |
++ |
3660 |
+ buf[len] = 0; |
3661 |
+ return len; |
3662 |
+ } |
3663 |
+@@ -2168,13 +2172,14 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, |
3664 |
+ if (len) |
3665 |
+ ; |
3666 |
+ else if (nameid) |
3667 |
+- snd_usb_copy_string_desc(state, nameid, kctl->id.name, |
3668 |
++ len = snd_usb_copy_string_desc(state, nameid, kctl->id.name, |
3669 |
+ sizeof(kctl->id.name)); |
3670 |
+- else { |
3671 |
++ else |
3672 |
+ len = get_term_name(state, &state->oterm, |
3673 |
+ kctl->id.name, sizeof(kctl->id.name), 0); |
3674 |
+- if (!len) |
3675 |
+- strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); |
3676 |
++ |
3677 |
++ if (!len) { |
3678 |
++ strlcpy(kctl->id.name, "USB", sizeof(kctl->id.name)); |
3679 |
+ |
3680 |
+ if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) |
3681 |
+ append_ctl_name(kctl, " Clock Source"); |
3682 |
+diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c |
3683 |
+index bc7adb84e679..60a94b3e532e 100644 |
3684 |
+--- a/tools/hv/hv_kvp_daemon.c |
3685 |
++++ b/tools/hv/hv_kvp_daemon.c |
3686 |
+@@ -193,11 +193,14 @@ static void kvp_update_mem_state(int pool) |
3687 |
+ for (;;) { |
3688 |
+ readp = &record[records_read]; |
3689 |
+ records_read += fread(readp, sizeof(struct kvp_record), |
3690 |
+- ENTRIES_PER_BLOCK * num_blocks, |
3691 |
+- filep); |
3692 |
++ ENTRIES_PER_BLOCK * num_blocks - records_read, |
3693 |
++ filep); |
3694 |
+ |
3695 |
+ if (ferror(filep)) { |
3696 |
+- syslog(LOG_ERR, "Failed to read file, pool: %d", pool); |
3697 |
++ syslog(LOG_ERR, |
3698 |
++ "Failed to read file, pool: %d; error: %d %s", |
3699 |
++ pool, errno, strerror(errno)); |
3700 |
++ kvp_release_lock(pool); |
3701 |
+ exit(EXIT_FAILURE); |
3702 |
+ } |
3703 |
+ |
3704 |
+@@ -210,6 +213,7 @@ static void kvp_update_mem_state(int pool) |
3705 |
+ |
3706 |
+ if (record == NULL) { |
3707 |
+ syslog(LOG_ERR, "malloc failed"); |
3708 |
++ kvp_release_lock(pool); |
3709 |
+ exit(EXIT_FAILURE); |
3710 |
+ } |
3711 |
+ continue; |
3712 |
+@@ -224,15 +228,11 @@ static void kvp_update_mem_state(int pool) |
3713 |
+ fclose(filep); |
3714 |
+ kvp_release_lock(pool); |
3715 |
+ } |
3716 |
++ |
3717 |
+ static int kvp_file_init(void) |
3718 |
+ { |
3719 |
+ int fd; |
3720 |
+- FILE *filep; |
3721 |
+- size_t records_read; |
3722 |
+ char *fname; |
3723 |
+- struct kvp_record *record; |
3724 |
+- struct kvp_record *readp; |
3725 |
+- int num_blocks; |
3726 |
+ int i; |
3727 |
+ int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; |
3728 |
+ |
3729 |
+@@ -246,61 +246,19 @@ static int kvp_file_init(void) |
3730 |
+ |
3731 |
+ for (i = 0; i < KVP_POOL_COUNT; i++) { |
3732 |
+ fname = kvp_file_info[i].fname; |
3733 |
+- records_read = 0; |
3734 |
+- num_blocks = 1; |
3735 |
+ sprintf(fname, "%s/.kvp_pool_%d", KVP_CONFIG_LOC, i); |
3736 |
+ fd = open(fname, O_RDWR | O_CREAT | O_CLOEXEC, 0644 /* rw-r--r-- */); |
3737 |
+ |
3738 |
+ if (fd == -1) |
3739 |
+ return 1; |
3740 |
+ |
3741 |
+- |
3742 |
+- filep = fopen(fname, "re"); |
3743 |
+- if (!filep) { |
3744 |
+- close(fd); |
3745 |
+- return 1; |
3746 |
+- } |
3747 |
+- |
3748 |
+- record = malloc(alloc_unit * num_blocks); |
3749 |
+- if (record == NULL) { |
3750 |
+- fclose(filep); |
3751 |
+- close(fd); |
3752 |
+- return 1; |
3753 |
+- } |
3754 |
+- for (;;) { |
3755 |
+- readp = &record[records_read]; |
3756 |
+- records_read += fread(readp, sizeof(struct kvp_record), |
3757 |
+- ENTRIES_PER_BLOCK, |
3758 |
+- filep); |
3759 |
+- |
3760 |
+- if (ferror(filep)) { |
3761 |
+- syslog(LOG_ERR, "Failed to read file, pool: %d", |
3762 |
+- i); |
3763 |
+- exit(EXIT_FAILURE); |
3764 |
+- } |
3765 |
+- |
3766 |
+- if (!feof(filep)) { |
3767 |
+- /* |
3768 |
+- * We have more data to read. |
3769 |
+- */ |
3770 |
+- num_blocks++; |
3771 |
+- record = realloc(record, alloc_unit * |
3772 |
+- num_blocks); |
3773 |
+- if (record == NULL) { |
3774 |
+- fclose(filep); |
3775 |
+- close(fd); |
3776 |
+- return 1; |
3777 |
+- } |
3778 |
+- continue; |
3779 |
+- } |
3780 |
+- break; |
3781 |
+- } |
3782 |
+ kvp_file_info[i].fd = fd; |
3783 |
+- kvp_file_info[i].num_blocks = num_blocks; |
3784 |
+- kvp_file_info[i].records = record; |
3785 |
+- kvp_file_info[i].num_records = records_read; |
3786 |
+- fclose(filep); |
3787 |
+- |
3788 |
++ kvp_file_info[i].num_blocks = 1; |
3789 |
++ kvp_file_info[i].records = malloc(alloc_unit); |
3790 |
++ if (kvp_file_info[i].records == NULL) |
3791 |
++ return 1; |
3792 |
++ kvp_file_info[i].num_records = 0; |
3793 |
++ kvp_update_mem_state(i); |
3794 |
+ } |
3795 |
+ |
3796 |
+ return 0; |
3797 |
+diff --git a/tools/testing/selftests/powerpc/harness.c b/tools/testing/selftests/powerpc/harness.c |
3798 |
+index 248a820048df..66d31de60b9a 100644 |
3799 |
+--- a/tools/testing/selftests/powerpc/harness.c |
3800 |
++++ b/tools/testing/selftests/powerpc/harness.c |
3801 |
+@@ -114,9 +114,11 @@ int test_harness(int (test_function)(void), char *name) |
3802 |
+ |
3803 |
+ rc = run_test(test_function, name); |
3804 |
+ |
3805 |
+- if (rc == MAGIC_SKIP_RETURN_VALUE) |
3806 |
++ if (rc == MAGIC_SKIP_RETURN_VALUE) { |
3807 |
+ test_skip(name); |
3808 |
+- else |
3809 |
++ /* so that skipped test is not marked as failed */ |
3810 |
++ rc = 0; |
3811 |
++ } else |
3812 |
+ test_finish(name, rc); |
3813 |
+ |
3814 |
+ return rc; |
3815 |
+diff --git a/tools/testing/selftests/x86/fsgsbase.c b/tools/testing/selftests/x86/fsgsbase.c |
3816 |
+index 9b4610c6d3fb..f249e042b3b5 100644 |
3817 |
+--- a/tools/testing/selftests/x86/fsgsbase.c |
3818 |
++++ b/tools/testing/selftests/x86/fsgsbase.c |
3819 |
+@@ -245,7 +245,7 @@ void do_unexpected_base(void) |
3820 |
+ long ret; |
3821 |
+ asm volatile ("int $0x80" |
3822 |
+ : "=a" (ret) : "a" (243), "b" (low_desc) |
3823 |
+- : "flags"); |
3824 |
++ : "r8", "r9", "r10", "r11"); |
3825 |
+ memcpy(&desc, low_desc, sizeof(desc)); |
3826 |
+ munmap(low_desc, sizeof(desc)); |
3827 |
+ |
3828 |
+diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c |
3829 |
+index f936a3cd3e35..ac1a7a3f87b2 100644 |
3830 |
+--- a/tools/testing/selftests/x86/ldt_gdt.c |
3831 |
++++ b/tools/testing/selftests/x86/ldt_gdt.c |
3832 |
+@@ -45,6 +45,12 @@ |
3833 |
+ #define AR_DB (1 << 22) |
3834 |
+ #define AR_G (1 << 23) |
3835 |
+ |
3836 |
++#ifdef __x86_64__ |
3837 |
++# define INT80_CLOBBERS "r8", "r9", "r10", "r11" |
3838 |
++#else |
3839 |
++# define INT80_CLOBBERS |
3840 |
++#endif |
3841 |
++ |
3842 |
+ static int nerrs; |
3843 |
+ |
3844 |
+ /* Points to an array of 1024 ints, each holding its own index. */ |
3845 |
+@@ -649,7 +655,7 @@ static int invoke_set_thread_area(void) |
3846 |
+ asm volatile ("int $0x80" |
3847 |
+ : "=a" (ret), "+m" (low_user_desc) : |
3848 |
+ "a" (243), "b" (low_user_desc) |
3849 |
+- : "flags"); |
3850 |
++ : INT80_CLOBBERS); |
3851 |
+ return ret; |
3852 |
+ } |
3853 |
+ |
3854 |
+@@ -718,7 +724,7 @@ static void test_gdt_invalidation(void) |
3855 |
+ "+a" (eax) |
3856 |
+ : "m" (low_user_desc_clear), |
3857 |
+ [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
3858 |
+- : "flags"); |
3859 |
++ : INT80_CLOBBERS); |
3860 |
+ |
3861 |
+ if (sel != 0) { |
3862 |
+ result = "FAIL"; |
3863 |
+@@ -749,7 +755,7 @@ static void test_gdt_invalidation(void) |
3864 |
+ "+a" (eax) |
3865 |
+ : "m" (low_user_desc_clear), |
3866 |
+ [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
3867 |
+- : "flags"); |
3868 |
++ : INT80_CLOBBERS); |
3869 |
+ |
3870 |
+ if (sel != 0) { |
3871 |
+ result = "FAIL"; |
3872 |
+@@ -782,7 +788,7 @@ static void test_gdt_invalidation(void) |
3873 |
+ "+a" (eax) |
3874 |
+ : "m" (low_user_desc_clear), |
3875 |
+ [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
3876 |
+- : "flags"); |
3877 |
++ : INT80_CLOBBERS); |
3878 |
+ |
3879 |
+ #ifdef __x86_64__ |
3880 |
+ syscall(SYS_arch_prctl, ARCH_GET_FS, &new_base); |
3881 |
+@@ -835,7 +841,7 @@ static void test_gdt_invalidation(void) |
3882 |
+ "+a" (eax) |
3883 |
+ : "m" (low_user_desc_clear), |
3884 |
+ [arg1] "r" ((unsigned int)(unsigned long)low_user_desc_clear) |
3885 |
+- : "flags"); |
3886 |
++ : INT80_CLOBBERS); |
3887 |
+ |
3888 |
+ #ifdef __x86_64__ |
3889 |
+ syscall(SYS_arch_prctl, ARCH_GET_GS, &new_base); |
3890 |
+diff --git a/tools/testing/selftests/x86/mpx-hw.h b/tools/testing/selftests/x86/mpx-hw.h |
3891 |
+index 093c190178a9..28b3c7c553a4 100644 |
3892 |
+--- a/tools/testing/selftests/x86/mpx-hw.h |
3893 |
++++ b/tools/testing/selftests/x86/mpx-hw.h |
3894 |
+@@ -51,14 +51,14 @@ |
3895 |
+ struct mpx_bd_entry { |
3896 |
+ union { |
3897 |
+ char x[MPX_BOUNDS_DIR_ENTRY_SIZE_BYTES]; |
3898 |
+- void *contents[1]; |
3899 |
++ void *contents[0]; |
3900 |
+ }; |
3901 |
+ } __attribute__((packed)); |
3902 |
+ |
3903 |
+ struct mpx_bt_entry { |
3904 |
+ union { |
3905 |
+ char x[MPX_BOUNDS_TABLE_ENTRY_SIZE_BYTES]; |
3906 |
+- unsigned long contents[1]; |
3907 |
++ unsigned long contents[0]; |
3908 |
+ }; |
3909 |
+ } __attribute__((packed)); |
3910 |
+ |
3911 |
+diff --git a/tools/testing/selftests/x86/ptrace_syscall.c b/tools/testing/selftests/x86/ptrace_syscall.c |
3912 |
+index b037ce9cf116..eaea92439708 100644 |
3913 |
+--- a/tools/testing/selftests/x86/ptrace_syscall.c |
3914 |
++++ b/tools/testing/selftests/x86/ptrace_syscall.c |
3915 |
+@@ -58,7 +58,8 @@ static void do_full_int80(struct syscall_args32 *args) |
3916 |
+ asm volatile ("int $0x80" |
3917 |
+ : "+a" (args->nr), |
3918 |
+ "+b" (args->arg0), "+c" (args->arg1), "+d" (args->arg2), |
3919 |
+- "+S" (args->arg3), "+D" (args->arg4), "+r" (bp)); |
3920 |
++ "+S" (args->arg3), "+D" (args->arg4), "+r" (bp) |
3921 |
++ : : "r8", "r9", "r10", "r11"); |
3922 |
+ args->arg5 = bp; |
3923 |
+ #else |
3924 |
+ sys32_helper(args, int80_and_ret); |
3925 |
+diff --git a/tools/testing/selftests/x86/single_step_syscall.c b/tools/testing/selftests/x86/single_step_syscall.c |
3926 |
+index 50c26358e8b7..a48da95c18fd 100644 |
3927 |
+--- a/tools/testing/selftests/x86/single_step_syscall.c |
3928 |
++++ b/tools/testing/selftests/x86/single_step_syscall.c |
3929 |
+@@ -56,9 +56,11 @@ static volatile sig_atomic_t sig_traps; |
3930 |
+ #ifdef __x86_64__ |
3931 |
+ # define REG_IP REG_RIP |
3932 |
+ # define WIDTH "q" |
3933 |
++# define INT80_CLOBBERS "r8", "r9", "r10", "r11" |
3934 |
+ #else |
3935 |
+ # define REG_IP REG_EIP |
3936 |
+ # define WIDTH "l" |
3937 |
++# define INT80_CLOBBERS |
3938 |
+ #endif |
3939 |
+ |
3940 |
+ static unsigned long get_eflags(void) |
3941 |
+@@ -140,7 +142,8 @@ int main() |
3942 |
+ |
3943 |
+ printf("[RUN]\tSet TF and check int80\n"); |
3944 |
+ set_eflags(get_eflags() | X86_EFLAGS_TF); |
3945 |
+- asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid)); |
3946 |
++ asm volatile ("int $0x80" : "=a" (tmp) : "a" (SYS_getpid) |
3947 |
++ : INT80_CLOBBERS); |
3948 |
+ check_result(); |
3949 |
+ |
3950 |
+ /* |
3951 |
+diff --git a/virt/kvm/arm/hyp/vgic-v2-sr.c b/virt/kvm/arm/hyp/vgic-v2-sr.c |
3952 |
+index c8aeb7b91ec8..95021246ee26 100644 |
3953 |
+--- a/virt/kvm/arm/hyp/vgic-v2-sr.c |
3954 |
++++ b/virt/kvm/arm/hyp/vgic-v2-sr.c |
3955 |
+@@ -77,11 +77,7 @@ static void __hyp_text save_elrsr(struct kvm_vcpu *vcpu, void __iomem *base) |
3956 |
+ else |
3957 |
+ elrsr1 = 0; |
3958 |
+ |
3959 |
+-#ifdef CONFIG_CPU_BIG_ENDIAN |
3960 |
+- cpu_if->vgic_elrsr = ((u64)elrsr0 << 32) | elrsr1; |
3961 |
+-#else |
3962 |
+ cpu_if->vgic_elrsr = ((u64)elrsr1 << 32) | elrsr0; |
3963 |
+-#endif |
3964 |
+ } |
3965 |
+ |
3966 |
+ static void __hyp_text save_lrs(struct kvm_vcpu *vcpu, void __iomem *base) |
3967 |
+diff --git a/virt/kvm/arm/vgic/vgic-irqfd.c b/virt/kvm/arm/vgic/vgic-irqfd.c |
3968 |
+index f138ed2e9c63..a26c6773d6df 100644 |
3969 |
+--- a/virt/kvm/arm/vgic/vgic-irqfd.c |
3970 |
++++ b/virt/kvm/arm/vgic/vgic-irqfd.c |
3971 |
+@@ -112,8 +112,7 @@ int kvm_vgic_setup_default_irq_routing(struct kvm *kvm) |
3972 |
+ u32 nr = dist->nr_spis; |
3973 |
+ int i, ret; |
3974 |
+ |
3975 |
+- entries = kcalloc(nr, sizeof(struct kvm_kernel_irq_routing_entry), |
3976 |
+- GFP_KERNEL); |
3977 |
++ entries = kcalloc(nr, sizeof(*entries), GFP_KERNEL); |
3978 |
+ if (!entries) |
3979 |
+ return -ENOMEM; |
3980 |
+ |
3981 |
+diff --git a/virt/kvm/arm/vgic/vgic-its.c b/virt/kvm/arm/vgic/vgic-its.c |
3982 |
+index 4660a7d04eea..ebcaf4641d2b 100644 |
3983 |
+--- a/virt/kvm/arm/vgic/vgic-its.c |
3984 |
++++ b/virt/kvm/arm/vgic/vgic-its.c |
3985 |
+@@ -360,29 +360,6 @@ static int its_sync_lpi_pending_table(struct kvm_vcpu *vcpu) |
3986 |
+ return ret; |
3987 |
+ } |
3988 |
+ |
3989 |
+-static unsigned long vgic_mmio_read_its_ctlr(struct kvm *vcpu, |
3990 |
+- struct vgic_its *its, |
3991 |
+- gpa_t addr, unsigned int len) |
3992 |
+-{ |
3993 |
+- u32 reg = 0; |
3994 |
+- |
3995 |
+- mutex_lock(&its->cmd_lock); |
3996 |
+- if (its->creadr == its->cwriter) |
3997 |
+- reg |= GITS_CTLR_QUIESCENT; |
3998 |
+- if (its->enabled) |
3999 |
+- reg |= GITS_CTLR_ENABLE; |
4000 |
+- mutex_unlock(&its->cmd_lock); |
4001 |
+- |
4002 |
+- return reg; |
4003 |
+-} |
4004 |
+- |
4005 |
+-static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, |
4006 |
+- gpa_t addr, unsigned int len, |
4007 |
+- unsigned long val) |
4008 |
+-{ |
4009 |
+- its->enabled = !!(val & GITS_CTLR_ENABLE); |
4010 |
+-} |
4011 |
+- |
4012 |
+ static unsigned long vgic_mmio_read_its_typer(struct kvm *kvm, |
4013 |
+ struct vgic_its *its, |
4014 |
+ gpa_t addr, unsigned int len) |
4015 |
+@@ -687,6 +664,8 @@ static int vgic_its_alloc_collection(struct vgic_its *its, |
4016 |
+ return E_ITS_MAPC_COLLECTION_OOR; |
4017 |
+ |
4018 |
+ collection = kzalloc(sizeof(*collection), GFP_KERNEL); |
4019 |
++ if (!collection) |
4020 |
++ return -ENOMEM; |
4021 |
+ |
4022 |
+ collection->collection_id = coll_id; |
4023 |
+ collection->target_addr = COLLECTION_NOT_MAPPED; |
4024 |
+@@ -1160,33 +1139,16 @@ static void vgic_mmio_write_its_cbaser(struct kvm *kvm, struct vgic_its *its, |
4025 |
+ #define ITS_CMD_SIZE 32 |
4026 |
+ #define ITS_CMD_OFFSET(reg) ((reg) & GENMASK(19, 5)) |
4027 |
+ |
4028 |
+-/* |
4029 |
+- * By writing to CWRITER the guest announces new commands to be processed. |
4030 |
+- * To avoid any races in the first place, we take the its_cmd lock, which |
4031 |
+- * protects our ring buffer variables, so that there is only one user |
4032 |
+- * per ITS handling commands at a given time. |
4033 |
+- */ |
4034 |
+-static void vgic_mmio_write_its_cwriter(struct kvm *kvm, struct vgic_its *its, |
4035 |
+- gpa_t addr, unsigned int len, |
4036 |
+- unsigned long val) |
4037 |
++/* Must be called with the cmd_lock held. */ |
4038 |
++static void vgic_its_process_commands(struct kvm *kvm, struct vgic_its *its) |
4039 |
+ { |
4040 |
+ gpa_t cbaser; |
4041 |
+ u64 cmd_buf[4]; |
4042 |
+- u32 reg; |
4043 |
+- |
4044 |
+- if (!its) |
4045 |
+- return; |
4046 |
+- |
4047 |
+- mutex_lock(&its->cmd_lock); |
4048 |
+ |
4049 |
+- reg = update_64bit_reg(its->cwriter, addr & 7, len, val); |
4050 |
+- reg = ITS_CMD_OFFSET(reg); |
4051 |
+- if (reg >= ITS_CMD_BUFFER_SIZE(its->cbaser)) { |
4052 |
+- mutex_unlock(&its->cmd_lock); |
4053 |
++ /* Commands are only processed when the ITS is enabled. */ |
4054 |
++ if (!its->enabled) |
4055 |
+ return; |
4056 |
+- } |
4057 |
+ |
4058 |
+- its->cwriter = reg; |
4059 |
+ cbaser = CBASER_ADDRESS(its->cbaser); |
4060 |
+ |
4061 |
+ while (its->cwriter != its->creadr) { |
4062 |
+@@ -1206,6 +1168,34 @@ static void vgic_mmio_write_its_cwriter(struct kvm *kvm, struct vgic_its *its, |
4063 |
+ if (its->creadr == ITS_CMD_BUFFER_SIZE(its->cbaser)) |
4064 |
+ its->creadr = 0; |
4065 |
+ } |
4066 |
++} |
4067 |
++ |
4068 |
++/* |
4069 |
++ * By writing to CWRITER the guest announces new commands to be processed. |
4070 |
++ * To avoid any races in the first place, we take the its_cmd lock, which |
4071 |
++ * protects our ring buffer variables, so that there is only one user |
4072 |
++ * per ITS handling commands at a given time. |
4073 |
++ */ |
4074 |
++static void vgic_mmio_write_its_cwriter(struct kvm *kvm, struct vgic_its *its, |
4075 |
++ gpa_t addr, unsigned int len, |
4076 |
++ unsigned long val) |
4077 |
++{ |
4078 |
++ u64 reg; |
4079 |
++ |
4080 |
++ if (!its) |
4081 |
++ return; |
4082 |
++ |
4083 |
++ mutex_lock(&its->cmd_lock); |
4084 |
++ |
4085 |
++ reg = update_64bit_reg(its->cwriter, addr & 7, len, val); |
4086 |
++ reg = ITS_CMD_OFFSET(reg); |
4087 |
++ if (reg >= ITS_CMD_BUFFER_SIZE(its->cbaser)) { |
4088 |
++ mutex_unlock(&its->cmd_lock); |
4089 |
++ return; |
4090 |
++ } |
4091 |
++ its->cwriter = reg; |
4092 |
++ |
4093 |
++ vgic_its_process_commands(kvm, its); |
4094 |
+ |
4095 |
+ mutex_unlock(&its->cmd_lock); |
4096 |
+ } |
4097 |
+@@ -1286,6 +1276,39 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, |
4098 |
+ *regptr = reg; |
4099 |
+ } |
4100 |
+ |
4101 |
++static unsigned long vgic_mmio_read_its_ctlr(struct kvm *vcpu, |
4102 |
++ struct vgic_its *its, |
4103 |
++ gpa_t addr, unsigned int len) |
4104 |
++{ |
4105 |
++ u32 reg = 0; |
4106 |
++ |
4107 |
++ mutex_lock(&its->cmd_lock); |
4108 |
++ if (its->creadr == its->cwriter) |
4109 |
++ reg |= GITS_CTLR_QUIESCENT; |
4110 |
++ if (its->enabled) |
4111 |
++ reg |= GITS_CTLR_ENABLE; |
4112 |
++ mutex_unlock(&its->cmd_lock); |
4113 |
++ |
4114 |
++ return reg; |
4115 |
++} |
4116 |
++ |
4117 |
++static void vgic_mmio_write_its_ctlr(struct kvm *kvm, struct vgic_its *its, |
4118 |
++ gpa_t addr, unsigned int len, |
4119 |
++ unsigned long val) |
4120 |
++{ |
4121 |
++ mutex_lock(&its->cmd_lock); |
4122 |
++ |
4123 |
++ its->enabled = !!(val & GITS_CTLR_ENABLE); |
4124 |
++ |
4125 |
++ /* |
4126 |
++ * Try to process any pending commands. This function bails out early |
4127 |
++ * if the ITS is disabled or no commands have been queued. |
4128 |
++ */ |
4129 |
++ vgic_its_process_commands(kvm, its); |
4130 |
++ |
4131 |
++ mutex_unlock(&its->cmd_lock); |
4132 |
++} |
4133 |
++ |
4134 |
+ #define REGISTER_ITS_DESC(off, rd, wr, length, acc) \ |
4135 |
+ { \ |
4136 |
+ .reg_offset = off, \ |
4137 |
+diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c |
4138 |
+index f4c6d4f6d2e8..4569fdcab701 100644 |
4139 |
+--- a/virt/kvm/kvm_main.c |
4140 |
++++ b/virt/kvm/kvm_main.c |
4141 |
+@@ -125,6 +125,11 @@ EXPORT_SYMBOL_GPL(kvm_rebooting); |
4142 |
+ |
4143 |
+ static bool largepages_enabled = true; |
4144 |
+ |
4145 |
++__weak void kvm_arch_mmu_notifier_invalidate_range(struct kvm *kvm, |
4146 |
++ unsigned long start, unsigned long end) |
4147 |
++{ |
4148 |
++} |
4149 |
++ |
4150 |
+ bool kvm_is_reserved_pfn(kvm_pfn_t pfn) |
4151 |
+ { |
4152 |
+ if (pfn_valid(pfn)) |
4153 |
+@@ -361,6 +366,9 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, |
4154 |
+ kvm_flush_remote_tlbs(kvm); |
4155 |
+ |
4156 |
+ spin_unlock(&kvm->mmu_lock); |
4157 |
++ |
4158 |
++ kvm_arch_mmu_notifier_invalidate_range(kvm, start, end); |
4159 |
++ |
4160 |
+ srcu_read_unlock(&kvm->srcu, idx); |
4161 |
+ } |
4162 |
+ |