1 |
commit: 5b51b820cc8b40d5a3bf3e14a0f812dbc17f1dba |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 9 23:27:36 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 9 23:27:36 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=5b51b820 |
7 |
|
8 |
Linux patch 4.9.126 |
9 |
|
10 |
0000_README | 4 + |
11 |
1125_linux-4.9.126.patch | 2477 ++++++++++++++++++++++++++++++++++++++++++++++ |
12 |
2 files changed, 2481 insertions(+) |
13 |
|
14 |
diff --git a/0000_README b/0000_README |
15 |
index 98d9f5d..eaa2495 100644 |
16 |
--- a/0000_README |
17 |
+++ b/0000_README |
18 |
@@ -543,6 +543,10 @@ Patch: 1124_linux-4.9.125.patch |
19 |
From: http://www.kernel.org |
20 |
Desc: Linux 4.9.125 |
21 |
|
22 |
+Patch: 1125_linux-4.9.126.patch |
23 |
+From: http://www.kernel.org |
24 |
+Desc: Linux 4.9.126 |
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/1125_linux-4.9.126.patch b/1125_linux-4.9.126.patch |
31 |
new file mode 100644 |
32 |
index 0000000..7ee413d |
33 |
--- /dev/null |
34 |
+++ b/1125_linux-4.9.126.patch |
35 |
@@ -0,0 +1,2477 @@ |
36 |
+diff --git a/Makefile b/Makefile |
37 |
+index aef09ca7a924..b26481fef3f0 100644 |
38 |
+--- a/Makefile |
39 |
++++ b/Makefile |
40 |
+@@ -1,6 +1,6 @@ |
41 |
+ VERSION = 4 |
42 |
+ PATCHLEVEL = 9 |
43 |
+-SUBLEVEL = 125 |
44 |
++SUBLEVEL = 126 |
45 |
+ EXTRAVERSION = |
46 |
+ NAME = Roaring Lionus |
47 |
+ |
48 |
+diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c |
49 |
+index 4f95577b0180..6e0d549eb3bb 100644 |
50 |
+--- a/arch/alpha/kernel/osf_sys.c |
51 |
++++ b/arch/alpha/kernel/osf_sys.c |
52 |
+@@ -526,24 +526,19 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const char __user *, path, |
53 |
+ SYSCALL_DEFINE1(osf_utsname, char __user *, name) |
54 |
+ { |
55 |
+ int error; |
56 |
++ char tmp[5 * 32]; |
57 |
+ |
58 |
+ down_read(&uts_sem); |
59 |
+- error = -EFAULT; |
60 |
+- if (copy_to_user(name + 0, utsname()->sysname, 32)) |
61 |
+- goto out; |
62 |
+- if (copy_to_user(name + 32, utsname()->nodename, 32)) |
63 |
+- goto out; |
64 |
+- if (copy_to_user(name + 64, utsname()->release, 32)) |
65 |
+- goto out; |
66 |
+- if (copy_to_user(name + 96, utsname()->version, 32)) |
67 |
+- goto out; |
68 |
+- if (copy_to_user(name + 128, utsname()->machine, 32)) |
69 |
+- goto out; |
70 |
++ memcpy(tmp + 0 * 32, utsname()->sysname, 32); |
71 |
++ memcpy(tmp + 1 * 32, utsname()->nodename, 32); |
72 |
++ memcpy(tmp + 2 * 32, utsname()->release, 32); |
73 |
++ memcpy(tmp + 3 * 32, utsname()->version, 32); |
74 |
++ memcpy(tmp + 4 * 32, utsname()->machine, 32); |
75 |
++ up_read(&uts_sem); |
76 |
+ |
77 |
+- error = 0; |
78 |
+- out: |
79 |
+- up_read(&uts_sem); |
80 |
+- return error; |
81 |
++ if (copy_to_user(name, tmp, sizeof(tmp))) |
82 |
++ return -EFAULT; |
83 |
++ return 0; |
84 |
+ } |
85 |
+ |
86 |
+ SYSCALL_DEFINE0(getpagesize) |
87 |
+@@ -561,24 +556,22 @@ SYSCALL_DEFINE0(getdtablesize) |
88 |
+ */ |
89 |
+ SYSCALL_DEFINE2(osf_getdomainname, char __user *, name, int, namelen) |
90 |
+ { |
91 |
+- unsigned len; |
92 |
+- int i; |
93 |
++ int len, err = 0; |
94 |
++ char *kname; |
95 |
++ char tmp[32]; |
96 |
+ |
97 |
+- if (!access_ok(VERIFY_WRITE, name, namelen)) |
98 |
+- return -EFAULT; |
99 |
+- |
100 |
+- len = namelen; |
101 |
+- if (len > 32) |
102 |
+- len = 32; |
103 |
++ if (namelen < 0 || namelen > 32) |
104 |
++ namelen = 32; |
105 |
+ |
106 |
+ down_read(&uts_sem); |
107 |
+- for (i = 0; i < len; ++i) { |
108 |
+- __put_user(utsname()->domainname[i], name + i); |
109 |
+- if (utsname()->domainname[i] == '\0') |
110 |
+- break; |
111 |
+- } |
112 |
++ kname = utsname()->domainname; |
113 |
++ len = strnlen(kname, namelen); |
114 |
++ len = min(len + 1, namelen); |
115 |
++ memcpy(tmp, kname, len); |
116 |
+ up_read(&uts_sem); |
117 |
+ |
118 |
++ if (copy_to_user(name, tmp, len)) |
119 |
++ return -EFAULT; |
120 |
+ return 0; |
121 |
+ } |
122 |
+ |
123 |
+@@ -741,13 +734,14 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) |
124 |
+ }; |
125 |
+ unsigned long offset; |
126 |
+ const char *res; |
127 |
+- long len, err = -EINVAL; |
128 |
++ long len; |
129 |
++ char tmp[__NEW_UTS_LEN + 1]; |
130 |
+ |
131 |
+ offset = command-1; |
132 |
+ if (offset >= ARRAY_SIZE(sysinfo_table)) { |
133 |
+ /* Digital UNIX has a few unpublished interfaces here */ |
134 |
+ printk("sysinfo(%d)", command); |
135 |
+- goto out; |
136 |
++ return -EINVAL; |
137 |
+ } |
138 |
+ |
139 |
+ down_read(&uts_sem); |
140 |
+@@ -755,13 +749,11 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) |
141 |
+ len = strlen(res)+1; |
142 |
+ if ((unsigned long)len > (unsigned long)count) |
143 |
+ len = count; |
144 |
+- if (copy_to_user(buf, res, len)) |
145 |
+- err = -EFAULT; |
146 |
+- else |
147 |
+- err = 0; |
148 |
++ memcpy(tmp, res, len); |
149 |
+ up_read(&uts_sem); |
150 |
+- out: |
151 |
+- return err; |
152 |
++ if (copy_to_user(buf, tmp, len)) |
153 |
++ return -EFAULT; |
154 |
++ return 0; |
155 |
+ } |
156 |
+ |
157 |
+ SYSCALL_DEFINE5(osf_getsysinfo, unsigned long, op, void __user *, buffer, |
158 |
+diff --git a/arch/arm/boot/dts/tegra30-cardhu.dtsi b/arch/arm/boot/dts/tegra30-cardhu.dtsi |
159 |
+index f11012bb58cc..cfcf5dcb51a8 100644 |
160 |
+--- a/arch/arm/boot/dts/tegra30-cardhu.dtsi |
161 |
++++ b/arch/arm/boot/dts/tegra30-cardhu.dtsi |
162 |
+@@ -205,6 +205,7 @@ |
163 |
+ #address-cells = <1>; |
164 |
+ #size-cells = <0>; |
165 |
+ reg = <0x70>; |
166 |
++ reset-gpio = <&gpio TEGRA_GPIO(BB, 0) GPIO_ACTIVE_LOW>; |
167 |
+ }; |
168 |
+ }; |
169 |
+ |
170 |
+diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h |
171 |
+index 0031806475f0..f93238ad06bd 100644 |
172 |
+--- a/arch/powerpc/include/asm/fadump.h |
173 |
++++ b/arch/powerpc/include/asm/fadump.h |
174 |
+@@ -190,9 +190,6 @@ struct fadump_crash_info_header { |
175 |
+ struct cpumask online_mask; |
176 |
+ }; |
177 |
+ |
178 |
+-/* Crash memory ranges */ |
179 |
+-#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2) |
180 |
+- |
181 |
+ struct fad_crash_memory_ranges { |
182 |
+ unsigned long long base; |
183 |
+ unsigned long long size; |
184 |
+diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c |
185 |
+index 93a6eeba3ace..e3acf5c3480e 100644 |
186 |
+--- a/arch/powerpc/kernel/fadump.c |
187 |
++++ b/arch/powerpc/kernel/fadump.c |
188 |
+@@ -35,6 +35,7 @@ |
189 |
+ #include <linux/crash_dump.h> |
190 |
+ #include <linux/kobject.h> |
191 |
+ #include <linux/sysfs.h> |
192 |
++#include <linux/slab.h> |
193 |
+ |
194 |
+ #include <asm/page.h> |
195 |
+ #include <asm/prom.h> |
196 |
+@@ -48,8 +49,10 @@ static struct fadump_mem_struct fdm; |
197 |
+ static const struct fadump_mem_struct *fdm_active; |
198 |
+ |
199 |
+ static DEFINE_MUTEX(fadump_mutex); |
200 |
+-struct fad_crash_memory_ranges crash_memory_ranges[INIT_CRASHMEM_RANGES]; |
201 |
++struct fad_crash_memory_ranges *crash_memory_ranges; |
202 |
++int crash_memory_ranges_size; |
203 |
+ int crash_mem_ranges; |
204 |
++int max_crash_mem_ranges; |
205 |
+ |
206 |
+ /* Scan the Firmware Assisted dump configuration details. */ |
207 |
+ int __init early_init_dt_scan_fw_dump(unsigned long node, |
208 |
+@@ -731,38 +734,88 @@ static int __init process_fadump(const struct fadump_mem_struct *fdm_active) |
209 |
+ return 0; |
210 |
+ } |
211 |
+ |
212 |
+-static inline void fadump_add_crash_memory(unsigned long long base, |
213 |
+- unsigned long long end) |
214 |
++static void free_crash_memory_ranges(void) |
215 |
++{ |
216 |
++ kfree(crash_memory_ranges); |
217 |
++ crash_memory_ranges = NULL; |
218 |
++ crash_memory_ranges_size = 0; |
219 |
++ max_crash_mem_ranges = 0; |
220 |
++} |
221 |
++ |
222 |
++/* |
223 |
++ * Allocate or reallocate crash memory ranges array in incremental units |
224 |
++ * of PAGE_SIZE. |
225 |
++ */ |
226 |
++static int allocate_crash_memory_ranges(void) |
227 |
++{ |
228 |
++ struct fad_crash_memory_ranges *new_array; |
229 |
++ u64 new_size; |
230 |
++ |
231 |
++ new_size = crash_memory_ranges_size + PAGE_SIZE; |
232 |
++ pr_debug("Allocating %llu bytes of memory for crash memory ranges\n", |
233 |
++ new_size); |
234 |
++ |
235 |
++ new_array = krealloc(crash_memory_ranges, new_size, GFP_KERNEL); |
236 |
++ if (new_array == NULL) { |
237 |
++ pr_err("Insufficient memory for setting up crash memory ranges\n"); |
238 |
++ free_crash_memory_ranges(); |
239 |
++ return -ENOMEM; |
240 |
++ } |
241 |
++ |
242 |
++ crash_memory_ranges = new_array; |
243 |
++ crash_memory_ranges_size = new_size; |
244 |
++ max_crash_mem_ranges = (new_size / |
245 |
++ sizeof(struct fad_crash_memory_ranges)); |
246 |
++ return 0; |
247 |
++} |
248 |
++ |
249 |
++static inline int fadump_add_crash_memory(unsigned long long base, |
250 |
++ unsigned long long end) |
251 |
+ { |
252 |
+ if (base == end) |
253 |
+- return; |
254 |
++ return 0; |
255 |
++ |
256 |
++ if (crash_mem_ranges == max_crash_mem_ranges) { |
257 |
++ int ret; |
258 |
++ |
259 |
++ ret = allocate_crash_memory_ranges(); |
260 |
++ if (ret) |
261 |
++ return ret; |
262 |
++ } |
263 |
+ |
264 |
+ pr_debug("crash_memory_range[%d] [%#016llx-%#016llx], %#llx bytes\n", |
265 |
+ crash_mem_ranges, base, end - 1, (end - base)); |
266 |
+ crash_memory_ranges[crash_mem_ranges].base = base; |
267 |
+ crash_memory_ranges[crash_mem_ranges].size = end - base; |
268 |
+ crash_mem_ranges++; |
269 |
++ return 0; |
270 |
+ } |
271 |
+ |
272 |
+-static void fadump_exclude_reserved_area(unsigned long long start, |
273 |
++static int fadump_exclude_reserved_area(unsigned long long start, |
274 |
+ unsigned long long end) |
275 |
+ { |
276 |
+ unsigned long long ra_start, ra_end; |
277 |
++ int ret = 0; |
278 |
+ |
279 |
+ ra_start = fw_dump.reserve_dump_area_start; |
280 |
+ ra_end = ra_start + fw_dump.reserve_dump_area_size; |
281 |
+ |
282 |
+ if ((ra_start < end) && (ra_end > start)) { |
283 |
+ if ((start < ra_start) && (end > ra_end)) { |
284 |
+- fadump_add_crash_memory(start, ra_start); |
285 |
+- fadump_add_crash_memory(ra_end, end); |
286 |
++ ret = fadump_add_crash_memory(start, ra_start); |
287 |
++ if (ret) |
288 |
++ return ret; |
289 |
++ |
290 |
++ ret = fadump_add_crash_memory(ra_end, end); |
291 |
+ } else if (start < ra_start) { |
292 |
+- fadump_add_crash_memory(start, ra_start); |
293 |
++ ret = fadump_add_crash_memory(start, ra_start); |
294 |
+ } else if (ra_end < end) { |
295 |
+- fadump_add_crash_memory(ra_end, end); |
296 |
++ ret = fadump_add_crash_memory(ra_end, end); |
297 |
+ } |
298 |
+ } else |
299 |
+- fadump_add_crash_memory(start, end); |
300 |
++ ret = fadump_add_crash_memory(start, end); |
301 |
++ |
302 |
++ return ret; |
303 |
+ } |
304 |
+ |
305 |
+ static int fadump_init_elfcore_header(char *bufp) |
306 |
+@@ -802,10 +855,11 @@ static int fadump_init_elfcore_header(char *bufp) |
307 |
+ * Traverse through memblock structure and setup crash memory ranges. These |
308 |
+ * ranges will be used create PT_LOAD program headers in elfcore header. |
309 |
+ */ |
310 |
+-static void fadump_setup_crash_memory_ranges(void) |
311 |
++static int fadump_setup_crash_memory_ranges(void) |
312 |
+ { |
313 |
+ struct memblock_region *reg; |
314 |
+ unsigned long long start, end; |
315 |
++ int ret; |
316 |
+ |
317 |
+ pr_debug("Setup crash memory ranges.\n"); |
318 |
+ crash_mem_ranges = 0; |
319 |
+@@ -816,7 +870,9 @@ static void fadump_setup_crash_memory_ranges(void) |
320 |
+ * specified during fadump registration. We need to create a separate |
321 |
+ * program header for this chunk with the correct offset. |
322 |
+ */ |
323 |
+- fadump_add_crash_memory(RMA_START, fw_dump.boot_memory_size); |
324 |
++ ret = fadump_add_crash_memory(RMA_START, fw_dump.boot_memory_size); |
325 |
++ if (ret) |
326 |
++ return ret; |
327 |
+ |
328 |
+ for_each_memblock(memory, reg) { |
329 |
+ start = (unsigned long long)reg->base; |
330 |
+@@ -825,8 +881,12 @@ static void fadump_setup_crash_memory_ranges(void) |
331 |
+ start = fw_dump.boot_memory_size; |
332 |
+ |
333 |
+ /* add this range excluding the reserved dump area. */ |
334 |
+- fadump_exclude_reserved_area(start, end); |
335 |
++ ret = fadump_exclude_reserved_area(start, end); |
336 |
++ if (ret) |
337 |
++ return ret; |
338 |
+ } |
339 |
++ |
340 |
++ return 0; |
341 |
+ } |
342 |
+ |
343 |
+ /* |
344 |
+@@ -950,6 +1010,7 @@ static void register_fadump(void) |
345 |
+ { |
346 |
+ unsigned long addr; |
347 |
+ void *vaddr; |
348 |
++ int ret; |
349 |
+ |
350 |
+ /* |
351 |
+ * If no memory is reserved then we can not register for firmware- |
352 |
+@@ -958,7 +1019,9 @@ static void register_fadump(void) |
353 |
+ if (!fw_dump.reserve_dump_area_size) |
354 |
+ return; |
355 |
+ |
356 |
+- fadump_setup_crash_memory_ranges(); |
357 |
++ ret = fadump_setup_crash_memory_ranges(); |
358 |
++ if (ret) |
359 |
++ return ret; |
360 |
+ |
361 |
+ addr = be64_to_cpu(fdm.rmr_region.destination_address) + be64_to_cpu(fdm.rmr_region.source_len); |
362 |
+ /* Initialize fadump crash info header. */ |
363 |
+@@ -1036,6 +1099,7 @@ void fadump_cleanup(void) |
364 |
+ } else if (fw_dump.dump_registered) { |
365 |
+ /* Un-register Firmware-assisted dump if it was registered. */ |
366 |
+ fadump_unregister_dump(&fdm); |
367 |
++ free_crash_memory_ranges(); |
368 |
+ } |
369 |
+ } |
370 |
+ |
371 |
+diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c |
372 |
+index 9ed90c502005..f52cc6fd4290 100644 |
373 |
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c |
374 |
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c |
375 |
+@@ -3124,12 +3124,49 @@ static void pnv_pci_ioda_create_dbgfs(void) |
376 |
+ #endif /* CONFIG_DEBUG_FS */ |
377 |
+ } |
378 |
+ |
379 |
++static void pnv_pci_enable_bridge(struct pci_bus *bus) |
380 |
++{ |
381 |
++ struct pci_dev *dev = bus->self; |
382 |
++ struct pci_bus *child; |
383 |
++ |
384 |
++ /* Empty bus ? bail */ |
385 |
++ if (list_empty(&bus->devices)) |
386 |
++ return; |
387 |
++ |
388 |
++ /* |
389 |
++ * If there's a bridge associated with that bus enable it. This works |
390 |
++ * around races in the generic code if the enabling is done during |
391 |
++ * parallel probing. This can be removed once those races have been |
392 |
++ * fixed. |
393 |
++ */ |
394 |
++ if (dev) { |
395 |
++ int rc = pci_enable_device(dev); |
396 |
++ if (rc) |
397 |
++ pci_err(dev, "Error enabling bridge (%d)\n", rc); |
398 |
++ pci_set_master(dev); |
399 |
++ } |
400 |
++ |
401 |
++ /* Perform the same to child busses */ |
402 |
++ list_for_each_entry(child, &bus->children, node) |
403 |
++ pnv_pci_enable_bridge(child); |
404 |
++} |
405 |
++ |
406 |
++static void pnv_pci_enable_bridges(void) |
407 |
++{ |
408 |
++ struct pci_controller *hose; |
409 |
++ |
410 |
++ list_for_each_entry(hose, &hose_list, list_node) |
411 |
++ pnv_pci_enable_bridge(hose->bus); |
412 |
++} |
413 |
++ |
414 |
+ static void pnv_pci_ioda_fixup(void) |
415 |
+ { |
416 |
+ pnv_pci_ioda_setup_PEs(); |
417 |
+ pnv_pci_ioda_setup_iommu_api(); |
418 |
+ pnv_pci_ioda_create_dbgfs(); |
419 |
+ |
420 |
++ pnv_pci_enable_bridges(); |
421 |
++ |
422 |
+ #ifdef CONFIG_EEH |
423 |
+ eeh_init(); |
424 |
+ eeh_addr_cache_build(); |
425 |
+diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c |
426 |
+index 904a677208d1..34989ce43147 100644 |
427 |
+--- a/arch/powerpc/platforms/pseries/ras.c |
428 |
++++ b/arch/powerpc/platforms/pseries/ras.c |
429 |
+@@ -346,7 +346,7 @@ static struct rtas_error_log *fwnmi_get_errinfo(struct pt_regs *regs) |
430 |
+ } |
431 |
+ |
432 |
+ savep = __va(regs->gpr[3]); |
433 |
+- regs->gpr[3] = savep[0]; /* restore original r3 */ |
434 |
++ regs->gpr[3] = be64_to_cpu(savep[0]); /* restore original r3 */ |
435 |
+ |
436 |
+ /* If it isn't an extended log we can use the per cpu 64bit buffer */ |
437 |
+ h = (struct rtas_error_log *)&savep[1]; |
438 |
+diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c |
439 |
+index 646988d4c1a3..740f43b9b541 100644 |
440 |
+--- a/arch/sparc/kernel/sys_sparc_32.c |
441 |
++++ b/arch/sparc/kernel/sys_sparc_32.c |
442 |
+@@ -201,23 +201,27 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, |
443 |
+ |
444 |
+ asmlinkage long sys_getdomainname(char __user *name, int len) |
445 |
+ { |
446 |
+- int nlen, err; |
447 |
+- |
448 |
++ int nlen, err; |
449 |
++ char tmp[__NEW_UTS_LEN + 1]; |
450 |
++ |
451 |
+ if (len < 0) |
452 |
+ return -EINVAL; |
453 |
+ |
454 |
+- down_read(&uts_sem); |
455 |
+- |
456 |
++ down_read(&uts_sem); |
457 |
++ |
458 |
+ nlen = strlen(utsname()->domainname) + 1; |
459 |
+ err = -EINVAL; |
460 |
+ if (nlen > len) |
461 |
+- goto out; |
462 |
++ goto out_unlock; |
463 |
++ memcpy(tmp, utsname()->domainname, nlen); |
464 |
+ |
465 |
+- err = -EFAULT; |
466 |
+- if (!copy_to_user(name, utsname()->domainname, nlen)) |
467 |
+- err = 0; |
468 |
++ up_read(&uts_sem); |
469 |
+ |
470 |
+-out: |
471 |
++ if (copy_to_user(name, tmp, nlen)) |
472 |
++ return -EFAULT; |
473 |
++ return 0; |
474 |
++ |
475 |
++out_unlock: |
476 |
+ up_read(&uts_sem); |
477 |
+ return err; |
478 |
+ } |
479 |
+diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c |
480 |
+index 02e05e221b94..ebecbc927460 100644 |
481 |
+--- a/arch/sparc/kernel/sys_sparc_64.c |
482 |
++++ b/arch/sparc/kernel/sys_sparc_64.c |
483 |
+@@ -524,23 +524,27 @@ extern void check_pending(int signum); |
484 |
+ |
485 |
+ SYSCALL_DEFINE2(getdomainname, char __user *, name, int, len) |
486 |
+ { |
487 |
+- int nlen, err; |
488 |
++ int nlen, err; |
489 |
++ char tmp[__NEW_UTS_LEN + 1]; |
490 |
+ |
491 |
+ if (len < 0) |
492 |
+ return -EINVAL; |
493 |
+ |
494 |
+- down_read(&uts_sem); |
495 |
+- |
496 |
++ down_read(&uts_sem); |
497 |
++ |
498 |
+ nlen = strlen(utsname()->domainname) + 1; |
499 |
+ err = -EINVAL; |
500 |
+ if (nlen > len) |
501 |
+- goto out; |
502 |
++ goto out_unlock; |
503 |
++ memcpy(tmp, utsname()->domainname, nlen); |
504 |
++ |
505 |
++ up_read(&uts_sem); |
506 |
+ |
507 |
+- err = -EFAULT; |
508 |
+- if (!copy_to_user(name, utsname()->domainname, nlen)) |
509 |
+- err = 0; |
510 |
++ if (copy_to_user(name, tmp, nlen)) |
511 |
++ return -EFAULT; |
512 |
++ return 0; |
513 |
+ |
514 |
+-out: |
515 |
++out_unlock: |
516 |
+ up_read(&uts_sem); |
517 |
+ return err; |
518 |
+ } |
519 |
+diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c |
520 |
+index 3407b148c240..490f9be3fda2 100644 |
521 |
+--- a/arch/x86/kernel/kexec-bzimage64.c |
522 |
++++ b/arch/x86/kernel/kexec-bzimage64.c |
523 |
+@@ -529,7 +529,7 @@ static int bzImage64_cleanup(void *loader_data) |
524 |
+ static int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len) |
525 |
+ { |
526 |
+ return verify_pefile_signature(kernel, kernel_len, |
527 |
+- NULL, |
528 |
++ VERIFY_USE_SECONDARY_KEYRING, |
529 |
+ VERIFYING_KEXEC_PE_SIGNATURE); |
530 |
+ } |
531 |
+ #endif |
532 |
+diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
533 |
+index 8e4ac0a91309..8888d894bf39 100644 |
534 |
+--- a/arch/x86/kvm/vmx.c |
535 |
++++ b/arch/x86/kvm/vmx.c |
536 |
+@@ -198,12 +198,14 @@ static enum vmx_l1d_flush_state __read_mostly vmentry_l1d_flush_param = VMENTER_ |
537 |
+ |
538 |
+ static const struct { |
539 |
+ const char *option; |
540 |
+- enum vmx_l1d_flush_state cmd; |
541 |
++ bool for_parse; |
542 |
+ } vmentry_l1d_param[] = { |
543 |
+- {"auto", VMENTER_L1D_FLUSH_AUTO}, |
544 |
+- {"never", VMENTER_L1D_FLUSH_NEVER}, |
545 |
+- {"cond", VMENTER_L1D_FLUSH_COND}, |
546 |
+- {"always", VMENTER_L1D_FLUSH_ALWAYS}, |
547 |
++ [VMENTER_L1D_FLUSH_AUTO] = {"auto", true}, |
548 |
++ [VMENTER_L1D_FLUSH_NEVER] = {"never", true}, |
549 |
++ [VMENTER_L1D_FLUSH_COND] = {"cond", true}, |
550 |
++ [VMENTER_L1D_FLUSH_ALWAYS] = {"always", true}, |
551 |
++ [VMENTER_L1D_FLUSH_EPT_DISABLED] = {"EPT disabled", false}, |
552 |
++ [VMENTER_L1D_FLUSH_NOT_REQUIRED] = {"not required", false}, |
553 |
+ }; |
554 |
+ |
555 |
+ #define L1D_CACHE_ORDER 4 |
556 |
+@@ -287,8 +289,9 @@ static int vmentry_l1d_flush_parse(const char *s) |
557 |
+ |
558 |
+ if (s) { |
559 |
+ for (i = 0; i < ARRAY_SIZE(vmentry_l1d_param); i++) { |
560 |
+- if (sysfs_streq(s, vmentry_l1d_param[i].option)) |
561 |
+- return vmentry_l1d_param[i].cmd; |
562 |
++ if (vmentry_l1d_param[i].for_parse && |
563 |
++ sysfs_streq(s, vmentry_l1d_param[i].option)) |
564 |
++ return i; |
565 |
+ } |
566 |
+ } |
567 |
+ return -EINVAL; |
568 |
+@@ -298,13 +301,13 @@ static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp) |
569 |
+ { |
570 |
+ int l1tf, ret; |
571 |
+ |
572 |
+- if (!boot_cpu_has(X86_BUG_L1TF)) |
573 |
+- return 0; |
574 |
+- |
575 |
+ l1tf = vmentry_l1d_flush_parse(s); |
576 |
+ if (l1tf < 0) |
577 |
+ return l1tf; |
578 |
+ |
579 |
++ if (!boot_cpu_has(X86_BUG_L1TF)) |
580 |
++ return 0; |
581 |
++ |
582 |
+ /* |
583 |
+ * Has vmx_init() run already? If not then this is the pre init |
584 |
+ * parameter parsing. In that case just store the value and let |
585 |
+@@ -324,6 +327,9 @@ static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp) |
586 |
+ |
587 |
+ static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp) |
588 |
+ { |
589 |
++ if (WARN_ON_ONCE(l1tf_vmx_mitigation >= ARRAY_SIZE(vmentry_l1d_param))) |
590 |
++ return sprintf(s, "???\n"); |
591 |
++ |
592 |
+ return sprintf(s, "%s\n", vmentry_l1d_param[l1tf_vmx_mitigation].option); |
593 |
+ } |
594 |
+ |
595 |
+diff --git a/arch/xtensa/include/asm/cacheasm.h b/arch/xtensa/include/asm/cacheasm.h |
596 |
+index 2041abb10a23..34545ecfdd6b 100644 |
597 |
+--- a/arch/xtensa/include/asm/cacheasm.h |
598 |
++++ b/arch/xtensa/include/asm/cacheasm.h |
599 |
+@@ -31,16 +31,32 @@ |
600 |
+ * |
601 |
+ */ |
602 |
+ |
603 |
+- .macro __loop_cache_all ar at insn size line_width |
604 |
+ |
605 |
+- movi \ar, 0 |
606 |
++ .macro __loop_cache_unroll ar at insn size line_width max_immed |
607 |
++ |
608 |
++ .if (1 << (\line_width)) > (\max_immed) |
609 |
++ .set _reps, 1 |
610 |
++ .elseif (2 << (\line_width)) > (\max_immed) |
611 |
++ .set _reps, 2 |
612 |
++ .else |
613 |
++ .set _reps, 4 |
614 |
++ .endif |
615 |
++ |
616 |
++ __loopi \ar, \at, \size, (_reps << (\line_width)) |
617 |
++ .set _index, 0 |
618 |
++ .rep _reps |
619 |
++ \insn \ar, _index << (\line_width) |
620 |
++ .set _index, _index + 1 |
621 |
++ .endr |
622 |
++ __endla \ar, \at, _reps << (\line_width) |
623 |
++ |
624 |
++ .endm |
625 |
++ |
626 |
+ |
627 |
+- __loopi \ar, \at, \size, (4 << (\line_width)) |
628 |
+- \insn \ar, 0 << (\line_width) |
629 |
+- \insn \ar, 1 << (\line_width) |
630 |
+- \insn \ar, 2 << (\line_width) |
631 |
+- \insn \ar, 3 << (\line_width) |
632 |
+- __endla \ar, \at, 4 << (\line_width) |
633 |
++ .macro __loop_cache_all ar at insn size line_width max_immed |
634 |
++ |
635 |
++ movi \ar, 0 |
636 |
++ __loop_cache_unroll \ar, \at, \insn, \size, \line_width, \max_immed |
637 |
+ |
638 |
+ .endm |
639 |
+ |
640 |
+@@ -57,14 +73,9 @@ |
641 |
+ .endm |
642 |
+ |
643 |
+ |
644 |
+- .macro __loop_cache_page ar at insn line_width |
645 |
++ .macro __loop_cache_page ar at insn line_width max_immed |
646 |
+ |
647 |
+- __loopi \ar, \at, PAGE_SIZE, 4 << (\line_width) |
648 |
+- \insn \ar, 0 << (\line_width) |
649 |
+- \insn \ar, 1 << (\line_width) |
650 |
+- \insn \ar, 2 << (\line_width) |
651 |
+- \insn \ar, 3 << (\line_width) |
652 |
+- __endla \ar, \at, 4 << (\line_width) |
653 |
++ __loop_cache_unroll \ar, \at, \insn, PAGE_SIZE, \line_width, \max_immed |
654 |
+ |
655 |
+ .endm |
656 |
+ |
657 |
+@@ -72,7 +83,8 @@ |
658 |
+ .macro ___unlock_dcache_all ar at |
659 |
+ |
660 |
+ #if XCHAL_DCACHE_LINE_LOCKABLE && XCHAL_DCACHE_SIZE |
661 |
+- __loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH |
662 |
++ __loop_cache_all \ar \at diu XCHAL_DCACHE_SIZE \ |
663 |
++ XCHAL_DCACHE_LINEWIDTH 240 |
664 |
+ #endif |
665 |
+ |
666 |
+ .endm |
667 |
+@@ -81,7 +93,8 @@ |
668 |
+ .macro ___unlock_icache_all ar at |
669 |
+ |
670 |
+ #if XCHAL_ICACHE_LINE_LOCKABLE && XCHAL_ICACHE_SIZE |
671 |
+- __loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE XCHAL_ICACHE_LINEWIDTH |
672 |
++ __loop_cache_all \ar \at iiu XCHAL_ICACHE_SIZE \ |
673 |
++ XCHAL_ICACHE_LINEWIDTH 240 |
674 |
+ #endif |
675 |
+ |
676 |
+ .endm |
677 |
+@@ -90,7 +103,8 @@ |
678 |
+ .macro ___flush_invalidate_dcache_all ar at |
679 |
+ |
680 |
+ #if XCHAL_DCACHE_SIZE |
681 |
+- __loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH |
682 |
++ __loop_cache_all \ar \at diwbi XCHAL_DCACHE_SIZE \ |
683 |
++ XCHAL_DCACHE_LINEWIDTH 240 |
684 |
+ #endif |
685 |
+ |
686 |
+ .endm |
687 |
+@@ -99,7 +113,8 @@ |
688 |
+ .macro ___flush_dcache_all ar at |
689 |
+ |
690 |
+ #if XCHAL_DCACHE_SIZE |
691 |
+- __loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE XCHAL_DCACHE_LINEWIDTH |
692 |
++ __loop_cache_all \ar \at diwb XCHAL_DCACHE_SIZE \ |
693 |
++ XCHAL_DCACHE_LINEWIDTH 240 |
694 |
+ #endif |
695 |
+ |
696 |
+ .endm |
697 |
+@@ -108,8 +123,8 @@ |
698 |
+ .macro ___invalidate_dcache_all ar at |
699 |
+ |
700 |
+ #if XCHAL_DCACHE_SIZE |
701 |
+- __loop_cache_all \ar \at dii __stringify(DCACHE_WAY_SIZE) \ |
702 |
+- XCHAL_DCACHE_LINEWIDTH |
703 |
++ __loop_cache_all \ar \at dii XCHAL_DCACHE_SIZE \ |
704 |
++ XCHAL_DCACHE_LINEWIDTH 1020 |
705 |
+ #endif |
706 |
+ |
707 |
+ .endm |
708 |
+@@ -118,8 +133,8 @@ |
709 |
+ .macro ___invalidate_icache_all ar at |
710 |
+ |
711 |
+ #if XCHAL_ICACHE_SIZE |
712 |
+- __loop_cache_all \ar \at iii __stringify(ICACHE_WAY_SIZE) \ |
713 |
+- XCHAL_ICACHE_LINEWIDTH |
714 |
++ __loop_cache_all \ar \at iii XCHAL_ICACHE_SIZE \ |
715 |
++ XCHAL_ICACHE_LINEWIDTH 1020 |
716 |
+ #endif |
717 |
+ |
718 |
+ .endm |
719 |
+@@ -166,7 +181,7 @@ |
720 |
+ .macro ___flush_invalidate_dcache_page ar as |
721 |
+ |
722 |
+ #if XCHAL_DCACHE_SIZE |
723 |
+- __loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH |
724 |
++ __loop_cache_page \ar \as dhwbi XCHAL_DCACHE_LINEWIDTH 1020 |
725 |
+ #endif |
726 |
+ |
727 |
+ .endm |
728 |
+@@ -175,7 +190,7 @@ |
729 |
+ .macro ___flush_dcache_page ar as |
730 |
+ |
731 |
+ #if XCHAL_DCACHE_SIZE |
732 |
+- __loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH |
733 |
++ __loop_cache_page \ar \as dhwb XCHAL_DCACHE_LINEWIDTH 1020 |
734 |
+ #endif |
735 |
+ |
736 |
+ .endm |
737 |
+@@ -184,7 +199,7 @@ |
738 |
+ .macro ___invalidate_dcache_page ar as |
739 |
+ |
740 |
+ #if XCHAL_DCACHE_SIZE |
741 |
+- __loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH |
742 |
++ __loop_cache_page \ar \as dhi XCHAL_DCACHE_LINEWIDTH 1020 |
743 |
+ #endif |
744 |
+ |
745 |
+ .endm |
746 |
+@@ -193,7 +208,7 @@ |
747 |
+ .macro ___invalidate_icache_page ar as |
748 |
+ |
749 |
+ #if XCHAL_ICACHE_SIZE |
750 |
+- __loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH |
751 |
++ __loop_cache_page \ar \as ihi XCHAL_ICACHE_LINEWIDTH 1020 |
752 |
+ #endif |
753 |
+ |
754 |
+ .endm |
755 |
+diff --git a/certs/system_keyring.c b/certs/system_keyring.c |
756 |
+index 50979d6dcecd..247665054691 100644 |
757 |
+--- a/certs/system_keyring.c |
758 |
++++ b/certs/system_keyring.c |
759 |
+@@ -14,6 +14,7 @@ |
760 |
+ #include <linux/sched.h> |
761 |
+ #include <linux/cred.h> |
762 |
+ #include <linux/err.h> |
763 |
++#include <linux/verification.h> |
764 |
+ #include <keys/asymmetric-type.h> |
765 |
+ #include <keys/system_keyring.h> |
766 |
+ #include <crypto/pkcs7.h> |
767 |
+@@ -207,7 +208,7 @@ int verify_pkcs7_signature(const void *data, size_t len, |
768 |
+ |
769 |
+ if (!trusted_keys) { |
770 |
+ trusted_keys = builtin_trusted_keys; |
771 |
+- } else if (trusted_keys == (void *)1UL) { |
772 |
++ } else if (trusted_keys == VERIFY_USE_SECONDARY_KEYRING) { |
773 |
+ #ifdef CONFIG_SECONDARY_TRUSTED_KEYRING |
774 |
+ trusted_keys = secondary_trusted_keys; |
775 |
+ #else |
776 |
+diff --git a/crypto/asymmetric_keys/pkcs7_key_type.c b/crypto/asymmetric_keys/pkcs7_key_type.c |
777 |
+index 1063b644efcd..b2aa925a84bc 100644 |
778 |
+--- a/crypto/asymmetric_keys/pkcs7_key_type.c |
779 |
++++ b/crypto/asymmetric_keys/pkcs7_key_type.c |
780 |
+@@ -62,7 +62,7 @@ static int pkcs7_preparse(struct key_preparsed_payload *prep) |
781 |
+ |
782 |
+ return verify_pkcs7_signature(NULL, 0, |
783 |
+ prep->data, prep->datalen, |
784 |
+- (void *)1UL, usage, |
785 |
++ VERIFY_USE_SECONDARY_KEYRING, usage, |
786 |
+ pkcs7_view_content, prep); |
787 |
+ } |
788 |
+ |
789 |
+diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c |
790 |
+index 9e7f28122bb7..6d475a2e298c 100644 |
791 |
+--- a/drivers/crypto/caam/jr.c |
792 |
++++ b/drivers/crypto/caam/jr.c |
793 |
+@@ -189,7 +189,8 @@ static void caam_jr_dequeue(unsigned long devarg) |
794 |
+ BUG_ON(CIRC_CNT(head, tail + i, JOBR_DEPTH) <= 0); |
795 |
+ |
796 |
+ /* Unmap just-run descriptor so we can post-process */ |
797 |
+- dma_unmap_single(dev, jrp->outring[hw_idx].desc, |
798 |
++ dma_unmap_single(dev, |
799 |
++ caam_dma_to_cpu(jrp->outring[hw_idx].desc), |
800 |
+ jrp->entinfo[sw_idx].desc_size, |
801 |
+ DMA_TO_DEVICE); |
802 |
+ |
803 |
+diff --git a/drivers/crypto/vmx/aes_cbc.c b/drivers/crypto/vmx/aes_cbc.c |
804 |
+index 46131701c378..92e116365272 100644 |
805 |
+--- a/drivers/crypto/vmx/aes_cbc.c |
806 |
++++ b/drivers/crypto/vmx/aes_cbc.c |
807 |
+@@ -111,24 +111,23 @@ static int p8_aes_cbc_encrypt(struct blkcipher_desc *desc, |
808 |
+ ret = crypto_blkcipher_encrypt(&fallback_desc, dst, src, |
809 |
+ nbytes); |
810 |
+ } else { |
811 |
+- preempt_disable(); |
812 |
+- pagefault_disable(); |
813 |
+- enable_kernel_vsx(); |
814 |
+- |
815 |
+ blkcipher_walk_init(&walk, dst, src, nbytes); |
816 |
+ ret = blkcipher_walk_virt(desc, &walk); |
817 |
+ while ((nbytes = walk.nbytes)) { |
818 |
++ preempt_disable(); |
819 |
++ pagefault_disable(); |
820 |
++ enable_kernel_vsx(); |
821 |
+ aes_p8_cbc_encrypt(walk.src.virt.addr, |
822 |
+ walk.dst.virt.addr, |
823 |
+ nbytes & AES_BLOCK_MASK, |
824 |
+ &ctx->enc_key, walk.iv, 1); |
825 |
++ disable_kernel_vsx(); |
826 |
++ pagefault_enable(); |
827 |
++ preempt_enable(); |
828 |
++ |
829 |
+ nbytes &= AES_BLOCK_SIZE - 1; |
830 |
+ ret = blkcipher_walk_done(desc, &walk, nbytes); |
831 |
+ } |
832 |
+- |
833 |
+- disable_kernel_vsx(); |
834 |
+- pagefault_enable(); |
835 |
+- preempt_enable(); |
836 |
+ } |
837 |
+ |
838 |
+ return ret; |
839 |
+@@ -152,24 +151,23 @@ static int p8_aes_cbc_decrypt(struct blkcipher_desc *desc, |
840 |
+ ret = crypto_blkcipher_decrypt(&fallback_desc, dst, src, |
841 |
+ nbytes); |
842 |
+ } else { |
843 |
+- preempt_disable(); |
844 |
+- pagefault_disable(); |
845 |
+- enable_kernel_vsx(); |
846 |
+- |
847 |
+ blkcipher_walk_init(&walk, dst, src, nbytes); |
848 |
+ ret = blkcipher_walk_virt(desc, &walk); |
849 |
+ while ((nbytes = walk.nbytes)) { |
850 |
++ preempt_disable(); |
851 |
++ pagefault_disable(); |
852 |
++ enable_kernel_vsx(); |
853 |
+ aes_p8_cbc_encrypt(walk.src.virt.addr, |
854 |
+ walk.dst.virt.addr, |
855 |
+ nbytes & AES_BLOCK_MASK, |
856 |
+ &ctx->dec_key, walk.iv, 0); |
857 |
++ disable_kernel_vsx(); |
858 |
++ pagefault_enable(); |
859 |
++ preempt_enable(); |
860 |
++ |
861 |
+ nbytes &= AES_BLOCK_SIZE - 1; |
862 |
+ ret = blkcipher_walk_done(desc, &walk, nbytes); |
863 |
+ } |
864 |
+- |
865 |
+- disable_kernel_vsx(); |
866 |
+- pagefault_enable(); |
867 |
+- preempt_enable(); |
868 |
+ } |
869 |
+ |
870 |
+ return ret; |
871 |
+diff --git a/drivers/crypto/vmx/aes_xts.c b/drivers/crypto/vmx/aes_xts.c |
872 |
+index 24353ec336c5..52e7ae05ae1f 100644 |
873 |
+--- a/drivers/crypto/vmx/aes_xts.c |
874 |
++++ b/drivers/crypto/vmx/aes_xts.c |
875 |
+@@ -123,32 +123,39 @@ static int p8_aes_xts_crypt(struct blkcipher_desc *desc, |
876 |
+ ret = enc ? crypto_blkcipher_encrypt(&fallback_desc, dst, src, nbytes) : |
877 |
+ crypto_blkcipher_decrypt(&fallback_desc, dst, src, nbytes); |
878 |
+ } else { |
879 |
++ blkcipher_walk_init(&walk, dst, src, nbytes); |
880 |
++ |
881 |
++ ret = blkcipher_walk_virt(desc, &walk); |
882 |
++ |
883 |
+ preempt_disable(); |
884 |
+ pagefault_disable(); |
885 |
+ enable_kernel_vsx(); |
886 |
+ |
887 |
+- blkcipher_walk_init(&walk, dst, src, nbytes); |
888 |
+- |
889 |
+- ret = blkcipher_walk_virt(desc, &walk); |
890 |
+ iv = walk.iv; |
891 |
+ memset(tweak, 0, AES_BLOCK_SIZE); |
892 |
+ aes_p8_encrypt(iv, tweak, &ctx->tweak_key); |
893 |
+ |
894 |
++ disable_kernel_vsx(); |
895 |
++ pagefault_enable(); |
896 |
++ preempt_enable(); |
897 |
++ |
898 |
+ while ((nbytes = walk.nbytes)) { |
899 |
++ preempt_disable(); |
900 |
++ pagefault_disable(); |
901 |
++ enable_kernel_vsx(); |
902 |
+ if (enc) |
903 |
+ aes_p8_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr, |
904 |
+ nbytes & AES_BLOCK_MASK, &ctx->enc_key, NULL, tweak); |
905 |
+ else |
906 |
+ aes_p8_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr, |
907 |
+ nbytes & AES_BLOCK_MASK, &ctx->dec_key, NULL, tweak); |
908 |
++ disable_kernel_vsx(); |
909 |
++ pagefault_enable(); |
910 |
++ preempt_enable(); |
911 |
+ |
912 |
+ nbytes &= AES_BLOCK_SIZE - 1; |
913 |
+ ret = blkcipher_walk_done(desc, &walk, nbytes); |
914 |
+ } |
915 |
+- |
916 |
+- disable_kernel_vsx(); |
917 |
+- pagefault_enable(); |
918 |
+- preempt_enable(); |
919 |
+ } |
920 |
+ return ret; |
921 |
+ } |
922 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c |
923 |
+index c6f780f5abc9..555fd47c1831 100644 |
924 |
+--- a/drivers/gpu/drm/i915/i915_gem_userptr.c |
925 |
++++ b/drivers/gpu/drm/i915/i915_gem_userptr.c |
926 |
+@@ -778,6 +778,9 @@ i915_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *file |
927 |
+ I915_USERPTR_UNSYNCHRONIZED)) |
928 |
+ return -EINVAL; |
929 |
+ |
930 |
++ if (!args->user_size) |
931 |
++ return -EINVAL; |
932 |
++ |
933 |
+ if (offset_in_page(args->user_ptr | args->user_size)) |
934 |
+ return -EINVAL; |
935 |
+ |
936 |
+diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c |
937 |
+index 99eba524f6dd..1642b55f70da 100644 |
938 |
+--- a/drivers/iio/frequency/ad9523.c |
939 |
++++ b/drivers/iio/frequency/ad9523.c |
940 |
+@@ -508,7 +508,7 @@ static ssize_t ad9523_store(struct device *dev, |
941 |
+ return ret; |
942 |
+ |
943 |
+ if (!state) |
944 |
+- return 0; |
945 |
++ return len; |
946 |
+ |
947 |
+ mutex_lock(&indio_dev->mlock); |
948 |
+ switch ((u32)this_attr->address) { |
949 |
+@@ -642,7 +642,7 @@ static int ad9523_read_raw(struct iio_dev *indio_dev, |
950 |
+ code = (AD9523_CLK_DIST_DIV_PHASE_REV(ret) * 3141592) / |
951 |
+ AD9523_CLK_DIST_DIV_REV(ret); |
952 |
+ *val = code / 1000000; |
953 |
+- *val2 = (code % 1000000) * 10; |
954 |
++ *val2 = code % 1000000; |
955 |
+ return IIO_VAL_INT_PLUS_MICRO; |
956 |
+ default: |
957 |
+ return -EINVAL; |
958 |
+diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c |
959 |
+index 6c5e29db88e3..df15b6d7b645 100644 |
960 |
+--- a/drivers/infiniband/sw/rxe/rxe_comp.c |
961 |
++++ b/drivers/infiniband/sw/rxe/rxe_comp.c |
962 |
+@@ -273,6 +273,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp, |
963 |
+ case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE: |
964 |
+ if (wqe->wr.opcode != IB_WR_RDMA_READ && |
965 |
+ wqe->wr.opcode != IB_WR_RDMA_READ_WITH_INV) { |
966 |
++ wqe->status = IB_WC_FATAL_ERR; |
967 |
+ return COMPST_ERROR; |
968 |
+ } |
969 |
+ reset_retry_counters(qp); |
970 |
+diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c |
971 |
+index 876f438aa048..fe7c6ec67d98 100644 |
972 |
+--- a/drivers/infiniband/ulp/srpt/ib_srpt.c |
973 |
++++ b/drivers/infiniband/ulp/srpt/ib_srpt.c |
974 |
+@@ -1701,8 +1701,7 @@ static bool srpt_close_ch(struct srpt_rdma_ch *ch) |
975 |
+ int ret; |
976 |
+ |
977 |
+ if (!srpt_set_ch_state(ch, CH_DRAINING)) { |
978 |
+- pr_debug("%s-%d: already closed\n", ch->sess_name, |
979 |
+- ch->qp->qp_num); |
980 |
++ pr_debug("%s: already closed\n", ch->sess_name); |
981 |
+ return false; |
982 |
+ } |
983 |
+ |
984 |
+diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c |
985 |
+index 8c53748a769d..63110fbbb410 100644 |
986 |
+--- a/drivers/iommu/dmar.c |
987 |
++++ b/drivers/iommu/dmar.c |
988 |
+@@ -1328,8 +1328,8 @@ void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, |
989 |
+ qi_submit_sync(&desc, iommu); |
990 |
+ } |
991 |
+ |
992 |
+-void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, |
993 |
+- u64 addr, unsigned mask) |
994 |
++void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid, |
995 |
++ u16 qdep, u64 addr, unsigned mask) |
996 |
+ { |
997 |
+ struct qi_desc desc; |
998 |
+ |
999 |
+@@ -1344,7 +1344,7 @@ void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, |
1000 |
+ qdep = 0; |
1001 |
+ |
1002 |
+ desc.low = QI_DEV_IOTLB_SID(sid) | QI_DEV_IOTLB_QDEP(qdep) | |
1003 |
+- QI_DIOTLB_TYPE; |
1004 |
++ QI_DIOTLB_TYPE | QI_DEV_IOTLB_PFSID(pfsid); |
1005 |
+ |
1006 |
+ qi_submit_sync(&desc, iommu); |
1007 |
+ } |
1008 |
+diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c |
1009 |
+index 1612d3a22d42..2558a381e118 100644 |
1010 |
+--- a/drivers/iommu/intel-iommu.c |
1011 |
++++ b/drivers/iommu/intel-iommu.c |
1012 |
+@@ -421,6 +421,7 @@ struct device_domain_info { |
1013 |
+ struct list_head global; /* link to global list */ |
1014 |
+ u8 bus; /* PCI bus number */ |
1015 |
+ u8 devfn; /* PCI devfn number */ |
1016 |
++ u16 pfsid; /* SRIOV physical function source ID */ |
1017 |
+ u8 pasid_supported:3; |
1018 |
+ u8 pasid_enabled:1; |
1019 |
+ u8 pri_supported:1; |
1020 |
+@@ -1511,6 +1512,20 @@ static void iommu_enable_dev_iotlb(struct device_domain_info *info) |
1021 |
+ return; |
1022 |
+ |
1023 |
+ pdev = to_pci_dev(info->dev); |
1024 |
++ /* For IOMMU that supports device IOTLB throttling (DIT), we assign |
1025 |
++ * PFSID to the invalidation desc of a VF such that IOMMU HW can gauge |
1026 |
++ * queue depth at PF level. If DIT is not set, PFSID will be treated as |
1027 |
++ * reserved, which should be set to 0. |
1028 |
++ */ |
1029 |
++ if (!ecap_dit(info->iommu->ecap)) |
1030 |
++ info->pfsid = 0; |
1031 |
++ else { |
1032 |
++ struct pci_dev *pf_pdev; |
1033 |
++ |
1034 |
++ /* pdev will be returned if device is not a vf */ |
1035 |
++ pf_pdev = pci_physfn(pdev); |
1036 |
++ info->pfsid = PCI_DEVID(pf_pdev->bus->number, pf_pdev->devfn); |
1037 |
++ } |
1038 |
+ |
1039 |
+ #ifdef CONFIG_INTEL_IOMMU_SVM |
1040 |
+ /* The PCIe spec, in its wisdom, declares that the behaviour of |
1041 |
+@@ -1576,7 +1591,8 @@ static void iommu_flush_dev_iotlb(struct dmar_domain *domain, |
1042 |
+ |
1043 |
+ sid = info->bus << 8 | info->devfn; |
1044 |
+ qdep = info->ats_qdep; |
1045 |
+- qi_flush_dev_iotlb(info->iommu, sid, qdep, addr, mask); |
1046 |
++ qi_flush_dev_iotlb(info->iommu, sid, info->pfsid, |
1047 |
++ qdep, addr, mask); |
1048 |
+ } |
1049 |
+ spin_unlock_irqrestore(&device_domain_lock, flags); |
1050 |
+ } |
1051 |
+diff --git a/drivers/mailbox/mailbox-xgene-slimpro.c b/drivers/mailbox/mailbox-xgene-slimpro.c |
1052 |
+index dd2afbca51c9..26d2f89db4d9 100644 |
1053 |
+--- a/drivers/mailbox/mailbox-xgene-slimpro.c |
1054 |
++++ b/drivers/mailbox/mailbox-xgene-slimpro.c |
1055 |
+@@ -195,9 +195,9 @@ static int slimpro_mbox_probe(struct platform_device *pdev) |
1056 |
+ platform_set_drvdata(pdev, ctx); |
1057 |
+ |
1058 |
+ regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1059 |
+- mb_base = devm_ioremap(&pdev->dev, regs->start, resource_size(regs)); |
1060 |
+- if (!mb_base) |
1061 |
+- return -ENOMEM; |
1062 |
++ mb_base = devm_ioremap_resource(&pdev->dev, regs); |
1063 |
++ if (IS_ERR(mb_base)) |
1064 |
++ return PTR_ERR(mb_base); |
1065 |
+ |
1066 |
+ /* Setup mailbox links */ |
1067 |
+ for (i = 0; i < MBOX_CNT; i++) { |
1068 |
+diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c |
1069 |
+index bb7aa31c2a08..cdf388d40274 100644 |
1070 |
+--- a/drivers/md/bcache/writeback.c |
1071 |
++++ b/drivers/md/bcache/writeback.c |
1072 |
+@@ -456,8 +456,10 @@ static int bch_writeback_thread(void *arg) |
1073 |
+ * data on cache. BCACHE_DEV_DETACHING flag is set in |
1074 |
+ * bch_cached_dev_detach(). |
1075 |
+ */ |
1076 |
+- if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) |
1077 |
++ if (test_bit(BCACHE_DEV_DETACHING, &dc->disk.flags)) { |
1078 |
++ up_write(&dc->writeback_lock); |
1079 |
+ break; |
1080 |
++ } |
1081 |
+ } |
1082 |
+ |
1083 |
+ up_write(&dc->writeback_lock); |
1084 |
+diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c |
1085 |
+index 6937ca42be8c..a184c9830ca5 100644 |
1086 |
+--- a/drivers/md/dm-cache-metadata.c |
1087 |
++++ b/drivers/md/dm-cache-metadata.c |
1088 |
+@@ -344,7 +344,7 @@ static int __write_initial_superblock(struct dm_cache_metadata *cmd) |
1089 |
+ disk_super->version = cpu_to_le32(MAX_CACHE_VERSION); |
1090 |
+ memset(disk_super->policy_name, 0, sizeof(disk_super->policy_name)); |
1091 |
+ memset(disk_super->policy_version, 0, sizeof(disk_super->policy_version)); |
1092 |
+- disk_super->policy_hint_size = 0; |
1093 |
++ disk_super->policy_hint_size = cpu_to_le32(0); |
1094 |
+ |
1095 |
+ __copy_sm_root(cmd, disk_super); |
1096 |
+ |
1097 |
+@@ -659,6 +659,7 @@ static int __commit_transaction(struct dm_cache_metadata *cmd, |
1098 |
+ disk_super->policy_version[0] = cpu_to_le32(cmd->policy_version[0]); |
1099 |
+ disk_super->policy_version[1] = cpu_to_le32(cmd->policy_version[1]); |
1100 |
+ disk_super->policy_version[2] = cpu_to_le32(cmd->policy_version[2]); |
1101 |
++ disk_super->policy_hint_size = cpu_to_le32(cmd->policy_hint_size); |
1102 |
+ |
1103 |
+ disk_super->read_hits = cpu_to_le32(cmd->stats.read_hits); |
1104 |
+ disk_super->read_misses = cpu_to_le32(cmd->stats.read_misses); |
1105 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
1106 |
+index 0f0374a4ac6e..a952ad890f32 100644 |
1107 |
+--- a/drivers/md/dm-thin.c |
1108 |
++++ b/drivers/md/dm-thin.c |
1109 |
+@@ -2518,6 +2518,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) |
1110 |
+ case PM_WRITE: |
1111 |
+ if (old_mode != new_mode) |
1112 |
+ notify_of_pool_mode_change(pool, "write"); |
1113 |
++ if (old_mode == PM_OUT_OF_DATA_SPACE) |
1114 |
++ cancel_delayed_work_sync(&pool->no_space_timeout); |
1115 |
+ pool->out_of_data_space = false; |
1116 |
+ pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space; |
1117 |
+ dm_pool_metadata_read_write(pool->pmd); |
1118 |
+diff --git a/drivers/mfd/hi655x-pmic.c b/drivers/mfd/hi655x-pmic.c |
1119 |
+index 0fc62995695b..11347a3e6d40 100644 |
1120 |
+--- a/drivers/mfd/hi655x-pmic.c |
1121 |
++++ b/drivers/mfd/hi655x-pmic.c |
1122 |
+@@ -49,7 +49,7 @@ static struct regmap_config hi655x_regmap_config = { |
1123 |
+ .reg_bits = 32, |
1124 |
+ .reg_stride = HI655X_STRIDE, |
1125 |
+ .val_bits = 8, |
1126 |
+- .max_register = HI655X_BUS_ADDR(0xFFF), |
1127 |
++ .max_register = HI655X_BUS_ADDR(0x400) - HI655X_STRIDE, |
1128 |
+ }; |
1129 |
+ |
1130 |
+ static struct resource pwrkey_resources[] = { |
1131 |
+diff --git a/drivers/misc/cxl/main.c b/drivers/misc/cxl/main.c |
1132 |
+index cc1706a92ace..a078d49485d8 100644 |
1133 |
+--- a/drivers/misc/cxl/main.c |
1134 |
++++ b/drivers/misc/cxl/main.c |
1135 |
+@@ -293,7 +293,7 @@ int cxl_adapter_context_get(struct cxl *adapter) |
1136 |
+ int rc; |
1137 |
+ |
1138 |
+ rc = atomic_inc_unless_negative(&adapter->contexts_num); |
1139 |
+- return rc >= 0 ? 0 : -EBUSY; |
1140 |
++ return rc ? 0 : -EBUSY; |
1141 |
+ } |
1142 |
+ |
1143 |
+ void cxl_adapter_context_put(struct cxl *adapter) |
1144 |
+diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c |
1145 |
+index 5e047bfc0cc4..518e2dec2aa2 100644 |
1146 |
+--- a/drivers/misc/vmw_balloon.c |
1147 |
++++ b/drivers/misc/vmw_balloon.c |
1148 |
+@@ -341,7 +341,13 @@ static bool vmballoon_send_start(struct vmballoon *b, unsigned long req_caps) |
1149 |
+ success = false; |
1150 |
+ } |
1151 |
+ |
1152 |
+- if (b->capabilities & VMW_BALLOON_BATCHED_2M_CMDS) |
1153 |
++ /* |
1154 |
++ * 2MB pages are only supported with batching. If batching is for some |
1155 |
++ * reason disabled, do not use 2MB pages, since otherwise the legacy |
1156 |
++ * mechanism is used with 2MB pages, causing a failure. |
1157 |
++ */ |
1158 |
++ if ((b->capabilities & VMW_BALLOON_BATCHED_2M_CMDS) && |
1159 |
++ (b->capabilities & VMW_BALLOON_BATCHED_CMDS)) |
1160 |
+ b->supported_page_sizes = 2; |
1161 |
+ else |
1162 |
+ b->supported_page_sizes = 1; |
1163 |
+@@ -450,7 +456,7 @@ static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, |
1164 |
+ |
1165 |
+ pfn32 = (u32)pfn; |
1166 |
+ if (pfn32 != pfn) |
1167 |
+- return -1; |
1168 |
++ return -EINVAL; |
1169 |
+ |
1170 |
+ STATS_INC(b->stats.lock[false]); |
1171 |
+ |
1172 |
+@@ -460,7 +466,7 @@ static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, |
1173 |
+ |
1174 |
+ pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status); |
1175 |
+ STATS_INC(b->stats.lock_fail[false]); |
1176 |
+- return 1; |
1177 |
++ return -EIO; |
1178 |
+ } |
1179 |
+ |
1180 |
+ static int vmballoon_send_batched_lock(struct vmballoon *b, |
1181 |
+@@ -597,11 +603,12 @@ static int vmballoon_lock_page(struct vmballoon *b, unsigned int num_pages, |
1182 |
+ |
1183 |
+ locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status, |
1184 |
+ target); |
1185 |
+- if (locked > 0) { |
1186 |
++ if (locked) { |
1187 |
+ STATS_INC(b->stats.refused_alloc[false]); |
1188 |
+ |
1189 |
+- if (hv_status == VMW_BALLOON_ERROR_RESET || |
1190 |
+- hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED) { |
1191 |
++ if (locked == -EIO && |
1192 |
++ (hv_status == VMW_BALLOON_ERROR_RESET || |
1193 |
++ hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED)) { |
1194 |
+ vmballoon_free_page(page, false); |
1195 |
+ return -EIO; |
1196 |
+ } |
1197 |
+@@ -617,7 +624,7 @@ static int vmballoon_lock_page(struct vmballoon *b, unsigned int num_pages, |
1198 |
+ } else { |
1199 |
+ vmballoon_free_page(page, false); |
1200 |
+ } |
1201 |
+- return -EIO; |
1202 |
++ return locked; |
1203 |
+ } |
1204 |
+ |
1205 |
+ /* track allocated page */ |
1206 |
+@@ -1029,29 +1036,30 @@ static void vmballoon_vmci_cleanup(struct vmballoon *b) |
1207 |
+ */ |
1208 |
+ static int vmballoon_vmci_init(struct vmballoon *b) |
1209 |
+ { |
1210 |
+- int error = 0; |
1211 |
++ unsigned long error, dummy; |
1212 |
+ |
1213 |
+- if ((b->capabilities & VMW_BALLOON_SIGNALLED_WAKEUP_CMD) != 0) { |
1214 |
+- error = vmci_doorbell_create(&b->vmci_doorbell, |
1215 |
+- VMCI_FLAG_DELAYED_CB, |
1216 |
+- VMCI_PRIVILEGE_FLAG_RESTRICTED, |
1217 |
+- vmballoon_doorbell, b); |
1218 |
+- |
1219 |
+- if (error == VMCI_SUCCESS) { |
1220 |
+- VMWARE_BALLOON_CMD(VMCI_DOORBELL_SET, |
1221 |
+- b->vmci_doorbell.context, |
1222 |
+- b->vmci_doorbell.resource, error); |
1223 |
+- STATS_INC(b->stats.doorbell_set); |
1224 |
+- } |
1225 |
+- } |
1226 |
++ if ((b->capabilities & VMW_BALLOON_SIGNALLED_WAKEUP_CMD) == 0) |
1227 |
++ return 0; |
1228 |
+ |
1229 |
+- if (error != 0) { |
1230 |
+- vmballoon_vmci_cleanup(b); |
1231 |
++ error = vmci_doorbell_create(&b->vmci_doorbell, VMCI_FLAG_DELAYED_CB, |
1232 |
++ VMCI_PRIVILEGE_FLAG_RESTRICTED, |
1233 |
++ vmballoon_doorbell, b); |
1234 |
+ |
1235 |
+- return -EIO; |
1236 |
+- } |
1237 |
++ if (error != VMCI_SUCCESS) |
1238 |
++ goto fail; |
1239 |
++ |
1240 |
++ error = VMWARE_BALLOON_CMD(VMCI_DOORBELL_SET, b->vmci_doorbell.context, |
1241 |
++ b->vmci_doorbell.resource, dummy); |
1242 |
++ |
1243 |
++ STATS_INC(b->stats.doorbell_set); |
1244 |
++ |
1245 |
++ if (error != VMW_BALLOON_SUCCESS) |
1246 |
++ goto fail; |
1247 |
+ |
1248 |
+ return 0; |
1249 |
++fail: |
1250 |
++ vmballoon_vmci_cleanup(b); |
1251 |
++ return -EIO; |
1252 |
+ } |
1253 |
+ |
1254 |
+ /* |
1255 |
+@@ -1289,7 +1297,14 @@ static int __init vmballoon_init(void) |
1256 |
+ |
1257 |
+ return 0; |
1258 |
+ } |
1259 |
+-module_init(vmballoon_init); |
1260 |
++ |
1261 |
++/* |
1262 |
++ * Using late_initcall() instead of module_init() allows the balloon to use the |
1263 |
++ * VMCI doorbell even when the balloon is built into the kernel. Otherwise the |
1264 |
++ * VMCI is probed only after the balloon is initialized. If the balloon is used |
1265 |
++ * as a module, late_initcall() is equivalent to module_init(). |
1266 |
++ */ |
1267 |
++late_initcall(vmballoon_init); |
1268 |
+ |
1269 |
+ static void __exit vmballoon_exit(void) |
1270 |
+ { |
1271 |
+diff --git a/drivers/net/wireless/marvell/libertas/dev.h b/drivers/net/wireless/marvell/libertas/dev.h |
1272 |
+index edf710bc5e77..3de1457ad3a7 100644 |
1273 |
+--- a/drivers/net/wireless/marvell/libertas/dev.h |
1274 |
++++ b/drivers/net/wireless/marvell/libertas/dev.h |
1275 |
+@@ -103,6 +103,7 @@ struct lbs_private { |
1276 |
+ u8 fw_ready; |
1277 |
+ u8 surpriseremoved; |
1278 |
+ u8 setup_fw_on_resume; |
1279 |
++ u8 power_up_on_resume; |
1280 |
+ int (*hw_host_to_card) (struct lbs_private *priv, u8 type, u8 *payload, u16 nb); |
1281 |
+ void (*reset_card) (struct lbs_private *priv); |
1282 |
+ int (*power_save) (struct lbs_private *priv); |
1283 |
+diff --git a/drivers/net/wireless/marvell/libertas/if_sdio.c b/drivers/net/wireless/marvell/libertas/if_sdio.c |
1284 |
+index 47f4a14c84fe..a0ae8d8763bb 100644 |
1285 |
+--- a/drivers/net/wireless/marvell/libertas/if_sdio.c |
1286 |
++++ b/drivers/net/wireless/marvell/libertas/if_sdio.c |
1287 |
+@@ -1341,15 +1341,23 @@ static void if_sdio_remove(struct sdio_func *func) |
1288 |
+ static int if_sdio_suspend(struct device *dev) |
1289 |
+ { |
1290 |
+ struct sdio_func *func = dev_to_sdio_func(dev); |
1291 |
+- int ret; |
1292 |
+ struct if_sdio_card *card = sdio_get_drvdata(func); |
1293 |
++ struct lbs_private *priv = card->priv; |
1294 |
++ int ret; |
1295 |
+ |
1296 |
+ mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); |
1297 |
++ priv->power_up_on_resume = false; |
1298 |
+ |
1299 |
+ /* If we're powered off anyway, just let the mmc layer remove the |
1300 |
+ * card. */ |
1301 |
+- if (!lbs_iface_active(card->priv)) |
1302 |
+- return -ENOSYS; |
1303 |
++ if (!lbs_iface_active(priv)) { |
1304 |
++ if (priv->fw_ready) { |
1305 |
++ priv->power_up_on_resume = true; |
1306 |
++ if_sdio_power_off(card); |
1307 |
++ } |
1308 |
++ |
1309 |
++ return 0; |
1310 |
++ } |
1311 |
+ |
1312 |
+ dev_info(dev, "%s: suspend: PM flags = 0x%x\n", |
1313 |
+ sdio_func_id(func), flags); |
1314 |
+@@ -1357,9 +1365,14 @@ static int if_sdio_suspend(struct device *dev) |
1315 |
+ /* If we aren't being asked to wake on anything, we should bail out |
1316 |
+ * and let the SD stack power down the card. |
1317 |
+ */ |
1318 |
+- if (card->priv->wol_criteria == EHS_REMOVE_WAKEUP) { |
1319 |
++ if (priv->wol_criteria == EHS_REMOVE_WAKEUP) { |
1320 |
+ dev_info(dev, "Suspend without wake params -- powering down card\n"); |
1321 |
+- return -ENOSYS; |
1322 |
++ if (priv->fw_ready) { |
1323 |
++ priv->power_up_on_resume = true; |
1324 |
++ if_sdio_power_off(card); |
1325 |
++ } |
1326 |
++ |
1327 |
++ return 0; |
1328 |
+ } |
1329 |
+ |
1330 |
+ if (!(flags & MMC_PM_KEEP_POWER)) { |
1331 |
+@@ -1372,7 +1385,7 @@ static int if_sdio_suspend(struct device *dev) |
1332 |
+ if (ret) |
1333 |
+ return ret; |
1334 |
+ |
1335 |
+- ret = lbs_suspend(card->priv); |
1336 |
++ ret = lbs_suspend(priv); |
1337 |
+ if (ret) |
1338 |
+ return ret; |
1339 |
+ |
1340 |
+@@ -1387,6 +1400,11 @@ static int if_sdio_resume(struct device *dev) |
1341 |
+ |
1342 |
+ dev_info(dev, "%s: resume: we're back\n", sdio_func_id(func)); |
1343 |
+ |
1344 |
++ if (card->priv->power_up_on_resume) { |
1345 |
++ if_sdio_power_on(card); |
1346 |
++ wait_event(card->pwron_waitq, card->priv->fw_ready); |
1347 |
++ } |
1348 |
++ |
1349 |
+ ret = lbs_resume(card->priv); |
1350 |
+ |
1351 |
+ return ret; |
1352 |
+diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c |
1353 |
+index c1a65ce31243..de6d3b749c60 100644 |
1354 |
+--- a/drivers/nvdimm/bus.c |
1355 |
++++ b/drivers/nvdimm/bus.c |
1356 |
+@@ -748,9 +748,9 @@ u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd, |
1357 |
+ * overshoots the remainder by 4 bytes, assume it was |
1358 |
+ * including 'status'. |
1359 |
+ */ |
1360 |
+- if (out_field[1] - 8 == remainder) |
1361 |
++ if (out_field[1] - 4 == remainder) |
1362 |
+ return remainder; |
1363 |
+- return out_field[1] - 4; |
1364 |
++ return out_field[1] - 8; |
1365 |
+ } else if (cmd == ND_CMD_CALL) { |
1366 |
+ struct nd_cmd_pkg *pkg = (struct nd_cmd_pkg *) in_field; |
1367 |
+ |
1368 |
+diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c |
1369 |
+index b5c6b0636893..c0e06f0c19d1 100644 |
1370 |
+--- a/drivers/pwm/pwm-tiehrpwm.c |
1371 |
++++ b/drivers/pwm/pwm-tiehrpwm.c |
1372 |
+@@ -382,6 +382,8 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) |
1373 |
+ aqcsfrc_mask = AQCSFRC_CSFA_MASK; |
1374 |
+ } |
1375 |
+ |
1376 |
++ /* Update shadow register first before modifying active register */ |
1377 |
++ ehrpwm_modify(pc->mmio_base, AQCSFRC, aqcsfrc_mask, aqcsfrc_val); |
1378 |
+ /* |
1379 |
+ * Changes to immediate action on Action Qualifier. This puts |
1380 |
+ * Action Qualifier control on PWM output from next TBCLK |
1381 |
+diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c |
1382 |
+index 51e52446eacb..bd5ca548c265 100644 |
1383 |
+--- a/drivers/rtc/rtc-omap.c |
1384 |
++++ b/drivers/rtc/rtc-omap.c |
1385 |
+@@ -817,13 +817,6 @@ static int omap_rtc_probe(struct platform_device *pdev) |
1386 |
+ goto err; |
1387 |
+ } |
1388 |
+ |
1389 |
+- if (rtc->is_pmic_controller) { |
1390 |
+- if (!pm_power_off) { |
1391 |
+- omap_rtc_power_off_rtc = rtc; |
1392 |
+- pm_power_off = omap_rtc_power_off; |
1393 |
+- } |
1394 |
+- } |
1395 |
+- |
1396 |
+ /* Support ext_wakeup pinconf */ |
1397 |
+ rtc_pinctrl_desc.name = dev_name(&pdev->dev); |
1398 |
+ |
1399 |
+@@ -833,6 +826,13 @@ static int omap_rtc_probe(struct platform_device *pdev) |
1400 |
+ return PTR_ERR(rtc->pctldev); |
1401 |
+ } |
1402 |
+ |
1403 |
++ if (rtc->is_pmic_controller) { |
1404 |
++ if (!pm_power_off) { |
1405 |
++ omap_rtc_power_off_rtc = rtc; |
1406 |
++ pm_power_off = omap_rtc_power_off; |
1407 |
++ } |
1408 |
++ } |
1409 |
++ |
1410 |
+ return 0; |
1411 |
+ |
1412 |
+ err: |
1413 |
+diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c |
1414 |
+index 0d8f43a17edb..1905d20c229f 100644 |
1415 |
+--- a/drivers/spi/spi-davinci.c |
1416 |
++++ b/drivers/spi/spi-davinci.c |
1417 |
+@@ -215,7 +215,7 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) |
1418 |
+ pdata = &dspi->pdata; |
1419 |
+ |
1420 |
+ /* program delay transfers if tx_delay is non zero */ |
1421 |
+- if (spicfg->wdelay) |
1422 |
++ if (spicfg && spicfg->wdelay) |
1423 |
+ spidat1 |= SPIDAT1_WDEL; |
1424 |
+ |
1425 |
+ /* |
1426 |
+diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c |
1427 |
+index a67b0ff6a362..db3b6e9151a8 100644 |
1428 |
+--- a/drivers/spi/spi-fsl-dspi.c |
1429 |
++++ b/drivers/spi/spi-fsl-dspi.c |
1430 |
+@@ -715,30 +715,30 @@ static int dspi_probe(struct platform_device *pdev) |
1431 |
+ return PTR_ERR(dspi->regmap); |
1432 |
+ } |
1433 |
+ |
1434 |
++ dspi->clk = devm_clk_get(&pdev->dev, "dspi"); |
1435 |
++ if (IS_ERR(dspi->clk)) { |
1436 |
++ ret = PTR_ERR(dspi->clk); |
1437 |
++ dev_err(&pdev->dev, "unable to get clock\n"); |
1438 |
++ goto out_master_put; |
1439 |
++ } |
1440 |
++ ret = clk_prepare_enable(dspi->clk); |
1441 |
++ if (ret) |
1442 |
++ goto out_master_put; |
1443 |
++ |
1444 |
+ dspi_init(dspi); |
1445 |
+ dspi->irq = platform_get_irq(pdev, 0); |
1446 |
+ if (dspi->irq < 0) { |
1447 |
+ dev_err(&pdev->dev, "can't get platform irq\n"); |
1448 |
+ ret = dspi->irq; |
1449 |
+- goto out_master_put; |
1450 |
++ goto out_clk_put; |
1451 |
+ } |
1452 |
+ |
1453 |
+ ret = devm_request_irq(&pdev->dev, dspi->irq, dspi_interrupt, 0, |
1454 |
+ pdev->name, dspi); |
1455 |
+ if (ret < 0) { |
1456 |
+ dev_err(&pdev->dev, "Unable to attach DSPI interrupt\n"); |
1457 |
+- goto out_master_put; |
1458 |
+- } |
1459 |
+- |
1460 |
+- dspi->clk = devm_clk_get(&pdev->dev, "dspi"); |
1461 |
+- if (IS_ERR(dspi->clk)) { |
1462 |
+- ret = PTR_ERR(dspi->clk); |
1463 |
+- dev_err(&pdev->dev, "unable to get clock\n"); |
1464 |
+- goto out_master_put; |
1465 |
++ goto out_clk_put; |
1466 |
+ } |
1467 |
+- ret = clk_prepare_enable(dspi->clk); |
1468 |
+- if (ret) |
1469 |
+- goto out_master_put; |
1470 |
+ |
1471 |
+ master->max_speed_hz = |
1472 |
+ clk_get_rate(dspi->clk) / dspi->devtype_data->max_clock_factor; |
1473 |
+diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c |
1474 |
+index 6cbd46c565f8..53e6db8b0330 100644 |
1475 |
+--- a/drivers/tty/serial/serial_core.c |
1476 |
++++ b/drivers/tty/serial/serial_core.c |
1477 |
+@@ -172,6 +172,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, |
1478 |
+ { |
1479 |
+ struct uart_port *uport = uart_port_check(state); |
1480 |
+ unsigned long page; |
1481 |
++ unsigned long flags = 0; |
1482 |
+ int retval = 0; |
1483 |
+ |
1484 |
+ if (uport->type == PORT_UNKNOWN) |
1485 |
+@@ -186,15 +187,18 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, |
1486 |
+ * Initialise and allocate the transmit and temporary |
1487 |
+ * buffer. |
1488 |
+ */ |
1489 |
+- if (!state->xmit.buf) { |
1490 |
+- /* This is protected by the per port mutex */ |
1491 |
+- page = get_zeroed_page(GFP_KERNEL); |
1492 |
+- if (!page) |
1493 |
+- return -ENOMEM; |
1494 |
++ page = get_zeroed_page(GFP_KERNEL); |
1495 |
++ if (!page) |
1496 |
++ return -ENOMEM; |
1497 |
+ |
1498 |
++ uart_port_lock(state, flags); |
1499 |
++ if (!state->xmit.buf) { |
1500 |
+ state->xmit.buf = (unsigned char *) page; |
1501 |
+ uart_circ_clear(&state->xmit); |
1502 |
++ } else { |
1503 |
++ free_page(page); |
1504 |
+ } |
1505 |
++ uart_port_unlock(uport, flags); |
1506 |
+ |
1507 |
+ retval = uport->ops->startup(uport); |
1508 |
+ if (retval == 0) { |
1509 |
+@@ -253,6 +257,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) |
1510 |
+ { |
1511 |
+ struct uart_port *uport = uart_port_check(state); |
1512 |
+ struct tty_port *port = &state->port; |
1513 |
++ unsigned long flags = 0; |
1514 |
+ |
1515 |
+ /* |
1516 |
+ * Set the TTY IO error marker |
1517 |
+@@ -285,10 +290,12 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) |
1518 |
+ /* |
1519 |
+ * Free the transmit buffer page. |
1520 |
+ */ |
1521 |
++ uart_port_lock(state, flags); |
1522 |
+ if (state->xmit.buf) { |
1523 |
+ free_page((unsigned long)state->xmit.buf); |
1524 |
+ state->xmit.buf = NULL; |
1525 |
+ } |
1526 |
++ uart_port_unlock(uport, flags); |
1527 |
+ } |
1528 |
+ |
1529 |
+ /** |
1530 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
1531 |
+index 76c1ad96fb37..74273bc7ca9a 100644 |
1532 |
+--- a/drivers/video/fbdev/core/fbmem.c |
1533 |
++++ b/drivers/video/fbdev/core/fbmem.c |
1534 |
+@@ -1695,12 +1695,12 @@ static int do_register_framebuffer(struct fb_info *fb_info) |
1535 |
+ return 0; |
1536 |
+ } |
1537 |
+ |
1538 |
+-static int do_unregister_framebuffer(struct fb_info *fb_info) |
1539 |
++static int unbind_console(struct fb_info *fb_info) |
1540 |
+ { |
1541 |
+ struct fb_event event; |
1542 |
+- int i, ret = 0; |
1543 |
++ int ret; |
1544 |
++ int i = fb_info->node; |
1545 |
+ |
1546 |
+- i = fb_info->node; |
1547 |
+ if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) |
1548 |
+ return -EINVAL; |
1549 |
+ |
1550 |
+@@ -1715,17 +1715,29 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
1551 |
+ unlock_fb_info(fb_info); |
1552 |
+ console_unlock(); |
1553 |
+ |
1554 |
++ return ret; |
1555 |
++} |
1556 |
++ |
1557 |
++static int __unlink_framebuffer(struct fb_info *fb_info); |
1558 |
++ |
1559 |
++static int do_unregister_framebuffer(struct fb_info *fb_info) |
1560 |
++{ |
1561 |
++ struct fb_event event; |
1562 |
++ int ret; |
1563 |
++ |
1564 |
++ ret = unbind_console(fb_info); |
1565 |
++ |
1566 |
+ if (ret) |
1567 |
+ return -EINVAL; |
1568 |
+ |
1569 |
+ pm_vt_switch_unregister(fb_info->dev); |
1570 |
+ |
1571 |
+- unlink_framebuffer(fb_info); |
1572 |
++ __unlink_framebuffer(fb_info); |
1573 |
+ if (fb_info->pixmap.addr && |
1574 |
+ (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) |
1575 |
+ kfree(fb_info->pixmap.addr); |
1576 |
+ fb_destroy_modelist(&fb_info->modelist); |
1577 |
+- registered_fb[i] = NULL; |
1578 |
++ registered_fb[fb_info->node] = NULL; |
1579 |
+ num_registered_fb--; |
1580 |
+ fb_cleanup_device(fb_info); |
1581 |
+ event.info = fb_info; |
1582 |
+@@ -1738,7 +1750,7 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
1583 |
+ return 0; |
1584 |
+ } |
1585 |
+ |
1586 |
+-int unlink_framebuffer(struct fb_info *fb_info) |
1587 |
++static int __unlink_framebuffer(struct fb_info *fb_info) |
1588 |
+ { |
1589 |
+ int i; |
1590 |
+ |
1591 |
+@@ -1750,6 +1762,20 @@ int unlink_framebuffer(struct fb_info *fb_info) |
1592 |
+ device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
1593 |
+ fb_info->dev = NULL; |
1594 |
+ } |
1595 |
++ |
1596 |
++ return 0; |
1597 |
++} |
1598 |
++ |
1599 |
++int unlink_framebuffer(struct fb_info *fb_info) |
1600 |
++{ |
1601 |
++ int ret; |
1602 |
++ |
1603 |
++ ret = __unlink_framebuffer(fb_info); |
1604 |
++ if (ret) |
1605 |
++ return ret; |
1606 |
++ |
1607 |
++ unbind_console(fb_info); |
1608 |
++ |
1609 |
+ return 0; |
1610 |
+ } |
1611 |
+ EXPORT_SYMBOL(unlink_framebuffer); |
1612 |
+diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c |
1613 |
+index f329eee6dc93..352abc39e891 100644 |
1614 |
+--- a/fs/9p/xattr.c |
1615 |
++++ b/fs/9p/xattr.c |
1616 |
+@@ -105,7 +105,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, |
1617 |
+ { |
1618 |
+ struct kvec kvec = {.iov_base = (void *)value, .iov_len = value_len}; |
1619 |
+ struct iov_iter from; |
1620 |
+- int retval; |
1621 |
++ int retval, err; |
1622 |
+ |
1623 |
+ iov_iter_kvec(&from, WRITE | ITER_KVEC, &kvec, 1, value_len); |
1624 |
+ |
1625 |
+@@ -126,7 +126,9 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, |
1626 |
+ retval); |
1627 |
+ else |
1628 |
+ p9_client_write(fid, 0, &from, &retval); |
1629 |
+- p9_client_clunk(fid); |
1630 |
++ err = p9_client_clunk(fid); |
1631 |
++ if (!retval && err) |
1632 |
++ retval = err; |
1633 |
+ return retval; |
1634 |
+ } |
1635 |
+ |
1636 |
+diff --git a/fs/nfs/blocklayout/dev.c b/fs/nfs/blocklayout/dev.c |
1637 |
+index a69ef4e9c24c..d6e4191276c0 100644 |
1638 |
+--- a/fs/nfs/blocklayout/dev.c |
1639 |
++++ b/fs/nfs/blocklayout/dev.c |
1640 |
+@@ -203,7 +203,7 @@ static bool bl_map_stripe(struct pnfs_block_dev *dev, u64 offset, |
1641 |
+ chunk = div_u64(offset, dev->chunk_size); |
1642 |
+ div_u64_rem(chunk, dev->nr_children, &chunk_idx); |
1643 |
+ |
1644 |
+- if (chunk_idx > dev->nr_children) { |
1645 |
++ if (chunk_idx >= dev->nr_children) { |
1646 |
+ dprintk("%s: invalid chunk idx %d (%lld/%lld)\n", |
1647 |
+ __func__, chunk_idx, offset, dev->chunk_size); |
1648 |
+ /* error, should not happen */ |
1649 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
1650 |
+index cf5fdc25289a..e7ca62a86dab 100644 |
1651 |
+--- a/fs/nfs/nfs4proc.c |
1652 |
++++ b/fs/nfs/nfs4proc.c |
1653 |
+@@ -541,8 +541,15 @@ nfs4_async_handle_exception(struct rpc_task *task, struct nfs_server *server, |
1654 |
+ ret = -EIO; |
1655 |
+ return ret; |
1656 |
+ out_retry: |
1657 |
+- if (ret == 0) |
1658 |
++ if (ret == 0) { |
1659 |
+ exception->retry = 1; |
1660 |
++ /* |
1661 |
++ * For NFS4ERR_MOVED, the client transport will need to |
1662 |
++ * be recomputed after migration recovery has completed. |
1663 |
++ */ |
1664 |
++ if (errorcode == -NFS4ERR_MOVED) |
1665 |
++ rpc_task_release_transport(task); |
1666 |
++ } |
1667 |
+ return ret; |
1668 |
+ } |
1669 |
+ |
1670 |
+diff --git a/fs/quota/quota.c b/fs/quota/quota.c |
1671 |
+index 2d445425aad7..a2329f7ec638 100644 |
1672 |
+--- a/fs/quota/quota.c |
1673 |
++++ b/fs/quota/quota.c |
1674 |
+@@ -17,6 +17,7 @@ |
1675 |
+ #include <linux/quotaops.h> |
1676 |
+ #include <linux/types.h> |
1677 |
+ #include <linux/writeback.h> |
1678 |
++#include <linux/nospec.h> |
1679 |
+ |
1680 |
+ static int check_quotactl_permission(struct super_block *sb, int type, int cmd, |
1681 |
+ qid_t id) |
1682 |
+@@ -706,6 +707,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, |
1683 |
+ |
1684 |
+ if (type >= (XQM_COMMAND(cmd) ? XQM_MAXQUOTAS : MAXQUOTAS)) |
1685 |
+ return -EINVAL; |
1686 |
++ type = array_index_nospec(type, MAXQUOTAS); |
1687 |
+ /* |
1688 |
+ * Quota not supported on this fs? Check this before s_quota_types |
1689 |
+ * since they needn't be set if quota is not supported at all. |
1690 |
+diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c |
1691 |
+index 504658fd0d08..f8ce849e90d1 100644 |
1692 |
+--- a/fs/ubifs/journal.c |
1693 |
++++ b/fs/ubifs/journal.c |
1694 |
+@@ -661,6 +661,11 @@ int ubifs_jnl_update(struct ubifs_info *c, const struct inode *dir, |
1695 |
+ spin_lock(&ui->ui_lock); |
1696 |
+ ui->synced_i_size = ui->ui_size; |
1697 |
+ spin_unlock(&ui->ui_lock); |
1698 |
++ if (xent) { |
1699 |
++ spin_lock(&host_ui->ui_lock); |
1700 |
++ host_ui->synced_i_size = host_ui->ui_size; |
1701 |
++ spin_unlock(&host_ui->ui_lock); |
1702 |
++ } |
1703 |
+ mark_inode_clean(c, ui); |
1704 |
+ mark_inode_clean(c, host_ui); |
1705 |
+ return 0; |
1706 |
+@@ -1265,7 +1270,7 @@ static int recomp_data_node(const struct ubifs_info *c, |
1707 |
+ int err, len, compr_type, out_len; |
1708 |
+ |
1709 |
+ out_len = le32_to_cpu(dn->size); |
1710 |
+- buf = kmalloc_array(out_len, WORST_COMPR_FACTOR, GFP_NOFS); |
1711 |
++ buf = kmalloc(out_len * WORST_COMPR_FACTOR, GFP_NOFS); |
1712 |
+ if (!buf) |
1713 |
+ return -ENOMEM; |
1714 |
+ |
1715 |
+@@ -1344,7 +1349,16 @@ int ubifs_jnl_truncate(struct ubifs_info *c, const struct inode *inode, |
1716 |
+ else if (err) |
1717 |
+ goto out_free; |
1718 |
+ else { |
1719 |
+- if (le32_to_cpu(dn->size) <= dlen) |
1720 |
++ int dn_len = le32_to_cpu(dn->size); |
1721 |
++ |
1722 |
++ if (dn_len <= 0 || dn_len > UBIFS_BLOCK_SIZE) { |
1723 |
++ ubifs_err(c, "bad data node (block %u, inode %lu)", |
1724 |
++ blk, inode->i_ino); |
1725 |
++ ubifs_dump_node(c, dn); |
1726 |
++ goto out_free; |
1727 |
++ } |
1728 |
++ |
1729 |
++ if (dn_len <= dlen) |
1730 |
+ dlen = 0; /* Nothing to do */ |
1731 |
+ else { |
1732 |
+ int compr_type = le16_to_cpu(dn->compr_type); |
1733 |
+diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c |
1734 |
+index 6c3a1abd0e22..780a436d8c45 100644 |
1735 |
+--- a/fs/ubifs/lprops.c |
1736 |
++++ b/fs/ubifs/lprops.c |
1737 |
+@@ -1091,10 +1091,6 @@ static int scan_check_cb(struct ubifs_info *c, |
1738 |
+ } |
1739 |
+ } |
1740 |
+ |
1741 |
+- buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
1742 |
+- if (!buf) |
1743 |
+- return -ENOMEM; |
1744 |
+- |
1745 |
+ /* |
1746 |
+ * After an unclean unmount, empty and freeable LEBs |
1747 |
+ * may contain garbage - do not scan them. |
1748 |
+@@ -1113,6 +1109,10 @@ static int scan_check_cb(struct ubifs_info *c, |
1749 |
+ return LPT_SCAN_CONTINUE; |
1750 |
+ } |
1751 |
+ |
1752 |
++ buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
1753 |
++ if (!buf) |
1754 |
++ return -ENOMEM; |
1755 |
++ |
1756 |
+ sleb = ubifs_scan(c, lnum, 0, buf, 0); |
1757 |
+ if (IS_ERR(sleb)) { |
1758 |
+ ret = PTR_ERR(sleb); |
1759 |
+diff --git a/fs/xattr.c b/fs/xattr.c |
1760 |
+index 932b9061a3a2..093998872329 100644 |
1761 |
+--- a/fs/xattr.c |
1762 |
++++ b/fs/xattr.c |
1763 |
+@@ -540,7 +540,7 @@ getxattr(struct dentry *d, const char __user *name, void __user *value, |
1764 |
+ if (error > 0) { |
1765 |
+ if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) || |
1766 |
+ (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0)) |
1767 |
+- posix_acl_fix_xattr_to_user(kvalue, size); |
1768 |
++ posix_acl_fix_xattr_to_user(kvalue, error); |
1769 |
+ if (size && copy_to_user(value, kvalue, error)) |
1770 |
+ error = -EFAULT; |
1771 |
+ } else if (error == -ERANGE && size >= XATTR_SIZE_MAX) { |
1772 |
+diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h |
1773 |
+index 23e129ef6726..e353f6600b0b 100644 |
1774 |
+--- a/include/linux/intel-iommu.h |
1775 |
++++ b/include/linux/intel-iommu.h |
1776 |
+@@ -125,6 +125,7 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) |
1777 |
+ * Extended Capability Register |
1778 |
+ */ |
1779 |
+ |
1780 |
++#define ecap_dit(e) ((e >> 41) & 0x1) |
1781 |
+ #define ecap_pasid(e) ((e >> 40) & 0x1) |
1782 |
+ #define ecap_pss(e) ((e >> 35) & 0x1f) |
1783 |
+ #define ecap_eafs(e) ((e >> 34) & 0x1) |
1784 |
+@@ -294,6 +295,7 @@ enum { |
1785 |
+ #define QI_DEV_IOTLB_SID(sid) ((u64)((sid) & 0xffff) << 32) |
1786 |
+ #define QI_DEV_IOTLB_QDEP(qdep) (((qdep) & 0x1f) << 16) |
1787 |
+ #define QI_DEV_IOTLB_ADDR(addr) ((u64)(addr) & VTD_PAGE_MASK) |
1788 |
++#define QI_DEV_IOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) |
1789 |
+ #define QI_DEV_IOTLB_SIZE 1 |
1790 |
+ #define QI_DEV_IOTLB_MAX_INVS 32 |
1791 |
+ |
1792 |
+@@ -318,6 +320,7 @@ enum { |
1793 |
+ #define QI_DEV_EIOTLB_PASID(p) (((u64)p) << 32) |
1794 |
+ #define QI_DEV_EIOTLB_SID(sid) ((u64)((sid) & 0xffff) << 16) |
1795 |
+ #define QI_DEV_EIOTLB_QDEP(qd) ((u64)((qd) & 0x1f) << 4) |
1796 |
++#define QI_DEV_EIOTLB_PFSID(pfsid) (((u64)(pfsid & 0xf) << 12) | ((u64)(pfsid & 0xfff) << 52)) |
1797 |
+ #define QI_DEV_EIOTLB_MAX_INVS 32 |
1798 |
+ |
1799 |
+ #define QI_PGRP_IDX(idx) (((u64)(idx)) << 55) |
1800 |
+@@ -463,9 +466,8 @@ extern void qi_flush_context(struct intel_iommu *iommu, u16 did, u16 sid, |
1801 |
+ u8 fm, u64 type); |
1802 |
+ extern void qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, |
1803 |
+ unsigned int size_order, u64 type); |
1804 |
+-extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep, |
1805 |
+- u64 addr, unsigned mask); |
1806 |
+- |
1807 |
++extern void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 pfsid, |
1808 |
++ u16 qdep, u64 addr, unsigned mask); |
1809 |
+ extern int qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); |
1810 |
+ |
1811 |
+ extern int dmar_ir_support(void); |
1812 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
1813 |
+index 78c9f4a91d94..534cb43e8635 100644 |
1814 |
+--- a/include/linux/pci.h |
1815 |
++++ b/include/linux/pci.h |
1816 |
+@@ -2151,4 +2151,16 @@ static inline bool pci_ari_enabled(struct pci_bus *bus) |
1817 |
+ /* provide the legacy pci_dma_* API */ |
1818 |
+ #include <linux/pci-dma-compat.h> |
1819 |
+ |
1820 |
++#define pci_printk(level, pdev, fmt, arg...) \ |
1821 |
++ dev_printk(level, &(pdev)->dev, fmt, ##arg) |
1822 |
++ |
1823 |
++#define pci_emerg(pdev, fmt, arg...) dev_emerg(&(pdev)->dev, fmt, ##arg) |
1824 |
++#define pci_alert(pdev, fmt, arg...) dev_alert(&(pdev)->dev, fmt, ##arg) |
1825 |
++#define pci_crit(pdev, fmt, arg...) dev_crit(&(pdev)->dev, fmt, ##arg) |
1826 |
++#define pci_err(pdev, fmt, arg...) dev_err(&(pdev)->dev, fmt, ##arg) |
1827 |
++#define pci_warn(pdev, fmt, arg...) dev_warn(&(pdev)->dev, fmt, ##arg) |
1828 |
++#define pci_notice(pdev, fmt, arg...) dev_notice(&(pdev)->dev, fmt, ##arg) |
1829 |
++#define pci_info(pdev, fmt, arg...) dev_info(&(pdev)->dev, fmt, ##arg) |
1830 |
++#define pci_dbg(pdev, fmt, arg...) dev_dbg(&(pdev)->dev, fmt, ##arg) |
1831 |
++ |
1832 |
+ #endif /* LINUX_PCI_H */ |
1833 |
+diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h |
1834 |
+index 333ad11b3dd9..44161a4c124c 100644 |
1835 |
+--- a/include/linux/sunrpc/clnt.h |
1836 |
++++ b/include/linux/sunrpc/clnt.h |
1837 |
+@@ -155,6 +155,7 @@ int rpc_switch_client_transport(struct rpc_clnt *, |
1838 |
+ |
1839 |
+ void rpc_shutdown_client(struct rpc_clnt *); |
1840 |
+ void rpc_release_client(struct rpc_clnt *); |
1841 |
++void rpc_task_release_transport(struct rpc_task *); |
1842 |
+ void rpc_task_release_client(struct rpc_task *); |
1843 |
+ |
1844 |
+ int rpcb_create_local(struct net *); |
1845 |
+diff --git a/include/linux/verification.h b/include/linux/verification.h |
1846 |
+index a10549a6c7cd..cfa4730d607a 100644 |
1847 |
+--- a/include/linux/verification.h |
1848 |
++++ b/include/linux/verification.h |
1849 |
+@@ -12,6 +12,12 @@ |
1850 |
+ #ifndef _LINUX_VERIFICATION_H |
1851 |
+ #define _LINUX_VERIFICATION_H |
1852 |
+ |
1853 |
++/* |
1854 |
++ * Indicate that both builtin trusted keys and secondary trusted keys |
1855 |
++ * should be used. |
1856 |
++ */ |
1857 |
++#define VERIFY_USE_SECONDARY_KEYRING ((struct key *)1UL) |
1858 |
++ |
1859 |
+ /* |
1860 |
+ * The use to which an asymmetric key is being put. |
1861 |
+ */ |
1862 |
+diff --git a/include/video/udlfb.h b/include/video/udlfb.h |
1863 |
+index f9466fa54ba4..2ad9a6d37ff4 100644 |
1864 |
+--- a/include/video/udlfb.h |
1865 |
++++ b/include/video/udlfb.h |
1866 |
+@@ -87,7 +87,7 @@ struct dlfb_data { |
1867 |
+ #define MIN_RAW_PIX_BYTES 2 |
1868 |
+ #define MIN_RAW_CMD_BYTES (RAW_HEADER_BYTES + MIN_RAW_PIX_BYTES) |
1869 |
+ |
1870 |
+-#define DL_DEFIO_WRITE_DELAY 5 /* fb_deferred_io.delay in jiffies */ |
1871 |
++#define DL_DEFIO_WRITE_DELAY msecs_to_jiffies(HZ <= 300 ? 4 : 10) /* optimal value for 720p video */ |
1872 |
+ #define DL_DEFIO_WRITE_DISABLE (HZ*60) /* "disable" with long delay */ |
1873 |
+ |
1874 |
+ /* remove these once align.h patch is taken into kernel */ |
1875 |
+diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig |
1876 |
+index e8517b63eb37..dd2b5a4d89a5 100644 |
1877 |
+--- a/kernel/power/Kconfig |
1878 |
++++ b/kernel/power/Kconfig |
1879 |
+@@ -105,6 +105,7 @@ config PM_SLEEP |
1880 |
+ def_bool y |
1881 |
+ depends on SUSPEND || HIBERNATE_CALLBACKS |
1882 |
+ select PM |
1883 |
++ select SRCU |
1884 |
+ |
1885 |
+ config PM_SLEEP_SMP |
1886 |
+ def_bool y |
1887 |
+diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c |
1888 |
+index 5fa65aa904d3..2c3e7f024c15 100644 |
1889 |
+--- a/kernel/printk/nmi.c |
1890 |
++++ b/kernel/printk/nmi.c |
1891 |
+@@ -260,12 +260,12 @@ void __init printk_nmi_init(void) |
1892 |
+ printk_nmi_flush(); |
1893 |
+ } |
1894 |
+ |
1895 |
+-void printk_nmi_enter(void) |
1896 |
++void notrace printk_nmi_enter(void) |
1897 |
+ { |
1898 |
+ this_cpu_write(printk_func, vprintk_nmi); |
1899 |
+ } |
1900 |
+ |
1901 |
+-void printk_nmi_exit(void) |
1902 |
++void notrace printk_nmi_exit(void) |
1903 |
+ { |
1904 |
+ this_cpu_write(printk_func, vprintk_default); |
1905 |
+ } |
1906 |
+diff --git a/kernel/sys.c b/kernel/sys.c |
1907 |
+index b13b530b5e0f..6c4e9b533258 100644 |
1908 |
+--- a/kernel/sys.c |
1909 |
++++ b/kernel/sys.c |
1910 |
+@@ -1142,18 +1142,19 @@ static int override_release(char __user *release, size_t len) |
1911 |
+ |
1912 |
+ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) |
1913 |
+ { |
1914 |
+- int errno = 0; |
1915 |
++ struct new_utsname tmp; |
1916 |
+ |
1917 |
+ down_read(&uts_sem); |
1918 |
+- if (copy_to_user(name, utsname(), sizeof *name)) |
1919 |
+- errno = -EFAULT; |
1920 |
++ memcpy(&tmp, utsname(), sizeof(tmp)); |
1921 |
+ up_read(&uts_sem); |
1922 |
++ if (copy_to_user(name, &tmp, sizeof(tmp))) |
1923 |
++ return -EFAULT; |
1924 |
+ |
1925 |
+- if (!errno && override_release(name->release, sizeof(name->release))) |
1926 |
+- errno = -EFAULT; |
1927 |
+- if (!errno && override_architecture(name)) |
1928 |
+- errno = -EFAULT; |
1929 |
+- return errno; |
1930 |
++ if (override_release(name->release, sizeof(name->release))) |
1931 |
++ return -EFAULT; |
1932 |
++ if (override_architecture(name)) |
1933 |
++ return -EFAULT; |
1934 |
++ return 0; |
1935 |
+ } |
1936 |
+ |
1937 |
+ #ifdef __ARCH_WANT_SYS_OLD_UNAME |
1938 |
+@@ -1162,55 +1163,46 @@ SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name) |
1939 |
+ */ |
1940 |
+ SYSCALL_DEFINE1(uname, struct old_utsname __user *, name) |
1941 |
+ { |
1942 |
+- int error = 0; |
1943 |
++ struct old_utsname tmp; |
1944 |
+ |
1945 |
+ if (!name) |
1946 |
+ return -EFAULT; |
1947 |
+ |
1948 |
+ down_read(&uts_sem); |
1949 |
+- if (copy_to_user(name, utsname(), sizeof(*name))) |
1950 |
+- error = -EFAULT; |
1951 |
++ memcpy(&tmp, utsname(), sizeof(tmp)); |
1952 |
+ up_read(&uts_sem); |
1953 |
++ if (copy_to_user(name, &tmp, sizeof(tmp))) |
1954 |
++ return -EFAULT; |
1955 |
+ |
1956 |
+- if (!error && override_release(name->release, sizeof(name->release))) |
1957 |
+- error = -EFAULT; |
1958 |
+- if (!error && override_architecture(name)) |
1959 |
+- error = -EFAULT; |
1960 |
+- return error; |
1961 |
++ if (override_release(name->release, sizeof(name->release))) |
1962 |
++ return -EFAULT; |
1963 |
++ if (override_architecture(name)) |
1964 |
++ return -EFAULT; |
1965 |
++ return 0; |
1966 |
+ } |
1967 |
+ |
1968 |
+ SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name) |
1969 |
+ { |
1970 |
+- int error; |
1971 |
++ struct oldold_utsname tmp = {}; |
1972 |
+ |
1973 |
+ if (!name) |
1974 |
+ return -EFAULT; |
1975 |
+- if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname))) |
1976 |
+- return -EFAULT; |
1977 |
+ |
1978 |
+ down_read(&uts_sem); |
1979 |
+- error = __copy_to_user(&name->sysname, &utsname()->sysname, |
1980 |
+- __OLD_UTS_LEN); |
1981 |
+- error |= __put_user(0, name->sysname + __OLD_UTS_LEN); |
1982 |
+- error |= __copy_to_user(&name->nodename, &utsname()->nodename, |
1983 |
+- __OLD_UTS_LEN); |
1984 |
+- error |= __put_user(0, name->nodename + __OLD_UTS_LEN); |
1985 |
+- error |= __copy_to_user(&name->release, &utsname()->release, |
1986 |
+- __OLD_UTS_LEN); |
1987 |
+- error |= __put_user(0, name->release + __OLD_UTS_LEN); |
1988 |
+- error |= __copy_to_user(&name->version, &utsname()->version, |
1989 |
+- __OLD_UTS_LEN); |
1990 |
+- error |= __put_user(0, name->version + __OLD_UTS_LEN); |
1991 |
+- error |= __copy_to_user(&name->machine, &utsname()->machine, |
1992 |
+- __OLD_UTS_LEN); |
1993 |
+- error |= __put_user(0, name->machine + __OLD_UTS_LEN); |
1994 |
++ memcpy(&tmp.sysname, &utsname()->sysname, __OLD_UTS_LEN); |
1995 |
++ memcpy(&tmp.nodename, &utsname()->nodename, __OLD_UTS_LEN); |
1996 |
++ memcpy(&tmp.release, &utsname()->release, __OLD_UTS_LEN); |
1997 |
++ memcpy(&tmp.version, &utsname()->version, __OLD_UTS_LEN); |
1998 |
++ memcpy(&tmp.machine, &utsname()->machine, __OLD_UTS_LEN); |
1999 |
+ up_read(&uts_sem); |
2000 |
++ if (copy_to_user(name, &tmp, sizeof(tmp))) |
2001 |
++ return -EFAULT; |
2002 |
+ |
2003 |
+- if (!error && override_architecture(name)) |
2004 |
+- error = -EFAULT; |
2005 |
+- if (!error && override_release(name->release, sizeof(name->release))) |
2006 |
+- error = -EFAULT; |
2007 |
+- return error ? -EFAULT : 0; |
2008 |
++ if (override_architecture(name)) |
2009 |
++ return -EFAULT; |
2010 |
++ if (override_release(name->release, sizeof(name->release))) |
2011 |
++ return -EFAULT; |
2012 |
++ return 0; |
2013 |
+ } |
2014 |
+ #endif |
2015 |
+ |
2016 |
+@@ -1224,17 +1216,18 @@ SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) |
2017 |
+ |
2018 |
+ if (len < 0 || len > __NEW_UTS_LEN) |
2019 |
+ return -EINVAL; |
2020 |
+- down_write(&uts_sem); |
2021 |
+ errno = -EFAULT; |
2022 |
+ if (!copy_from_user(tmp, name, len)) { |
2023 |
+- struct new_utsname *u = utsname(); |
2024 |
++ struct new_utsname *u; |
2025 |
+ |
2026 |
++ down_write(&uts_sem); |
2027 |
++ u = utsname(); |
2028 |
+ memcpy(u->nodename, tmp, len); |
2029 |
+ memset(u->nodename + len, 0, sizeof(u->nodename) - len); |
2030 |
+ errno = 0; |
2031 |
+ uts_proc_notify(UTS_PROC_HOSTNAME); |
2032 |
++ up_write(&uts_sem); |
2033 |
+ } |
2034 |
+- up_write(&uts_sem); |
2035 |
+ return errno; |
2036 |
+ } |
2037 |
+ |
2038 |
+@@ -1242,8 +1235,9 @@ SYSCALL_DEFINE2(sethostname, char __user *, name, int, len) |
2039 |
+ |
2040 |
+ SYSCALL_DEFINE2(gethostname, char __user *, name, int, len) |
2041 |
+ { |
2042 |
+- int i, errno; |
2043 |
++ int i; |
2044 |
+ struct new_utsname *u; |
2045 |
++ char tmp[__NEW_UTS_LEN + 1]; |
2046 |
+ |
2047 |
+ if (len < 0) |
2048 |
+ return -EINVAL; |
2049 |
+@@ -1252,11 +1246,11 @@ SYSCALL_DEFINE2(gethostname, char __user *, name, int, len) |
2050 |
+ i = 1 + strlen(u->nodename); |
2051 |
+ if (i > len) |
2052 |
+ i = len; |
2053 |
+- errno = 0; |
2054 |
+- if (copy_to_user(name, u->nodename, i)) |
2055 |
+- errno = -EFAULT; |
2056 |
++ memcpy(tmp, u->nodename, i); |
2057 |
+ up_read(&uts_sem); |
2058 |
+- return errno; |
2059 |
++ if (copy_to_user(name, tmp, i)) |
2060 |
++ return -EFAULT; |
2061 |
++ return 0; |
2062 |
+ } |
2063 |
+ |
2064 |
+ #endif |
2065 |
+@@ -1275,17 +1269,18 @@ SYSCALL_DEFINE2(setdomainname, char __user *, name, int, len) |
2066 |
+ if (len < 0 || len > __NEW_UTS_LEN) |
2067 |
+ return -EINVAL; |
2068 |
+ |
2069 |
+- down_write(&uts_sem); |
2070 |
+ errno = -EFAULT; |
2071 |
+ if (!copy_from_user(tmp, name, len)) { |
2072 |
+- struct new_utsname *u = utsname(); |
2073 |
++ struct new_utsname *u; |
2074 |
+ |
2075 |
++ down_write(&uts_sem); |
2076 |
++ u = utsname(); |
2077 |
+ memcpy(u->domainname, tmp, len); |
2078 |
+ memset(u->domainname + len, 0, sizeof(u->domainname) - len); |
2079 |
+ errno = 0; |
2080 |
+ uts_proc_notify(UTS_PROC_DOMAINNAME); |
2081 |
++ up_write(&uts_sem); |
2082 |
+ } |
2083 |
+- up_write(&uts_sem); |
2084 |
+ return errno; |
2085 |
+ } |
2086 |
+ |
2087 |
+diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c |
2088 |
+index 4e17d55ba127..bfa8bb3a6e19 100644 |
2089 |
+--- a/kernel/trace/blktrace.c |
2090 |
++++ b/kernel/trace/blktrace.c |
2091 |
+@@ -1720,6 +1720,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev, |
2092 |
+ mutex_lock(&bdev->bd_mutex); |
2093 |
+ |
2094 |
+ if (attr == &dev_attr_enable) { |
2095 |
++ if (!!value == !!q->blk_trace) { |
2096 |
++ ret = 0; |
2097 |
++ goto out_unlock_bdev; |
2098 |
++ } |
2099 |
+ if (value) |
2100 |
+ ret = blk_trace_setup_queue(q, bdev); |
2101 |
+ else |
2102 |
+diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c |
2103 |
+index 148c2210a2b8..a47339b156ce 100644 |
2104 |
+--- a/kernel/trace/trace.c |
2105 |
++++ b/kernel/trace/trace.c |
2106 |
+@@ -6920,7 +6920,9 @@ rb_simple_write(struct file *filp, const char __user *ubuf, |
2107 |
+ |
2108 |
+ if (buffer) { |
2109 |
+ mutex_lock(&trace_types_lock); |
2110 |
+- if (val) { |
2111 |
++ if (!!val == tracer_tracing_is_on(tr)) { |
2112 |
++ val = 0; /* do nothing */ |
2113 |
++ } else if (val) { |
2114 |
+ tracer_tracing_on(tr); |
2115 |
+ if (tr->current_trace->start) |
2116 |
+ tr->current_trace->start(tr); |
2117 |
+diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c |
2118 |
+index 788262984818..f0ab801a6437 100644 |
2119 |
+--- a/kernel/trace/trace_uprobe.c |
2120 |
++++ b/kernel/trace/trace_uprobe.c |
2121 |
+@@ -969,7 +969,7 @@ probe_event_disable(struct trace_uprobe *tu, struct trace_event_file *file) |
2122 |
+ |
2123 |
+ list_del_rcu(&link->list); |
2124 |
+ /* synchronize with u{,ret}probe_trace_func */ |
2125 |
+- synchronize_sched(); |
2126 |
++ synchronize_rcu(); |
2127 |
+ kfree(link); |
2128 |
+ |
2129 |
+ if (!list_empty(&tu->tp.files)) |
2130 |
+diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c |
2131 |
+index 86b7854fec8e..f789bbba9b8e 100644 |
2132 |
+--- a/kernel/user_namespace.c |
2133 |
++++ b/kernel/user_namespace.c |
2134 |
+@@ -649,7 +649,16 @@ static ssize_t map_write(struct file *file, const char __user *buf, |
2135 |
+ unsigned idx; |
2136 |
+ struct uid_gid_extent *extent = NULL; |
2137 |
+ char *kbuf = NULL, *pos, *next_line; |
2138 |
+- ssize_t ret = -EINVAL; |
2139 |
++ ssize_t ret; |
2140 |
++ |
2141 |
++ /* Only allow < page size writes at the beginning of the file */ |
2142 |
++ if ((*ppos != 0) || (count >= PAGE_SIZE)) |
2143 |
++ return -EINVAL; |
2144 |
++ |
2145 |
++ /* Slurp in the user data */ |
2146 |
++ kbuf = memdup_user_nul(buf, count); |
2147 |
++ if (IS_ERR(kbuf)) |
2148 |
++ return PTR_ERR(kbuf); |
2149 |
+ |
2150 |
+ /* |
2151 |
+ * The userns_state_mutex serializes all writes to any given map. |
2152 |
+@@ -683,19 +692,6 @@ static ssize_t map_write(struct file *file, const char __user *buf, |
2153 |
+ if (cap_valid(cap_setid) && !file_ns_capable(file, ns, CAP_SYS_ADMIN)) |
2154 |
+ goto out; |
2155 |
+ |
2156 |
+- /* Only allow < page size writes at the beginning of the file */ |
2157 |
+- ret = -EINVAL; |
2158 |
+- if ((*ppos != 0) || (count >= PAGE_SIZE)) |
2159 |
+- goto out; |
2160 |
+- |
2161 |
+- /* Slurp in the user data */ |
2162 |
+- kbuf = memdup_user_nul(buf, count); |
2163 |
+- if (IS_ERR(kbuf)) { |
2164 |
+- ret = PTR_ERR(kbuf); |
2165 |
+- kbuf = NULL; |
2166 |
+- goto out; |
2167 |
+- } |
2168 |
+- |
2169 |
+ /* Parse the user data */ |
2170 |
+ ret = -EINVAL; |
2171 |
+ pos = kbuf; |
2172 |
+diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c |
2173 |
+index c8eac43267e9..d2b3b2973456 100644 |
2174 |
+--- a/kernel/utsname_sysctl.c |
2175 |
++++ b/kernel/utsname_sysctl.c |
2176 |
+@@ -17,7 +17,7 @@ |
2177 |
+ |
2178 |
+ #ifdef CONFIG_PROC_SYSCTL |
2179 |
+ |
2180 |
+-static void *get_uts(struct ctl_table *table, int write) |
2181 |
++static void *get_uts(struct ctl_table *table) |
2182 |
+ { |
2183 |
+ char *which = table->data; |
2184 |
+ struct uts_namespace *uts_ns; |
2185 |
+@@ -25,21 +25,9 @@ static void *get_uts(struct ctl_table *table, int write) |
2186 |
+ uts_ns = current->nsproxy->uts_ns; |
2187 |
+ which = (which - (char *)&init_uts_ns) + (char *)uts_ns; |
2188 |
+ |
2189 |
+- if (!write) |
2190 |
+- down_read(&uts_sem); |
2191 |
+- else |
2192 |
+- down_write(&uts_sem); |
2193 |
+ return which; |
2194 |
+ } |
2195 |
+ |
2196 |
+-static void put_uts(struct ctl_table *table, int write, void *which) |
2197 |
+-{ |
2198 |
+- if (!write) |
2199 |
+- up_read(&uts_sem); |
2200 |
+- else |
2201 |
+- up_write(&uts_sem); |
2202 |
+-} |
2203 |
+- |
2204 |
+ /* |
2205 |
+ * Special case of dostring for the UTS structure. This has locks |
2206 |
+ * to observe. Should this be in kernel/sys.c ???? |
2207 |
+@@ -49,13 +37,34 @@ static int proc_do_uts_string(struct ctl_table *table, int write, |
2208 |
+ { |
2209 |
+ struct ctl_table uts_table; |
2210 |
+ int r; |
2211 |
++ char tmp_data[__NEW_UTS_LEN + 1]; |
2212 |
++ |
2213 |
+ memcpy(&uts_table, table, sizeof(uts_table)); |
2214 |
+- uts_table.data = get_uts(table, write); |
2215 |
++ uts_table.data = tmp_data; |
2216 |
++ |
2217 |
++ /* |
2218 |
++ * Buffer the value in tmp_data so that proc_dostring() can be called |
2219 |
++ * without holding any locks. |
2220 |
++ * We also need to read the original value in the write==1 case to |
2221 |
++ * support partial writes. |
2222 |
++ */ |
2223 |
++ down_read(&uts_sem); |
2224 |
++ memcpy(tmp_data, get_uts(table), sizeof(tmp_data)); |
2225 |
++ up_read(&uts_sem); |
2226 |
+ r = proc_dostring(&uts_table, write, buffer, lenp, ppos); |
2227 |
+- put_uts(table, write, uts_table.data); |
2228 |
+ |
2229 |
+- if (write) |
2230 |
++ if (write) { |
2231 |
++ /* |
2232 |
++ * Write back the new value. |
2233 |
++ * Note that, since we dropped uts_sem, the result can |
2234 |
++ * theoretically be incorrect if there are two parallel writes |
2235 |
++ * at non-zero offsets to the same sysctl. |
2236 |
++ */ |
2237 |
++ down_write(&uts_sem); |
2238 |
++ memcpy(get_uts(table), tmp_data, sizeof(tmp_data)); |
2239 |
++ up_write(&uts_sem); |
2240 |
+ proc_sys_poll_notify(table->poll); |
2241 |
++ } |
2242 |
+ |
2243 |
+ return r; |
2244 |
+ } |
2245 |
+diff --git a/mm/memory.c b/mm/memory.c |
2246 |
+index 0ff735601654..f3fef1df7402 100644 |
2247 |
+--- a/mm/memory.c |
2248 |
++++ b/mm/memory.c |
2249 |
+@@ -373,15 +373,6 @@ void tlb_remove_table(struct mmu_gather *tlb, void *table) |
2250 |
+ { |
2251 |
+ struct mmu_table_batch **batch = &tlb->batch; |
2252 |
+ |
2253 |
+- /* |
2254 |
+- * When there's less then two users of this mm there cannot be a |
2255 |
+- * concurrent page-table walk. |
2256 |
+- */ |
2257 |
+- if (atomic_read(&tlb->mm->mm_users) < 2) { |
2258 |
+- __tlb_remove_table(table); |
2259 |
+- return; |
2260 |
+- } |
2261 |
+- |
2262 |
+ if (*batch == NULL) { |
2263 |
+ *batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN); |
2264 |
+ if (*batch == NULL) { |
2265 |
+diff --git a/net/9p/client.c b/net/9p/client.c |
2266 |
+index 1fd60190177e..98d299ea52ee 100644 |
2267 |
+--- a/net/9p/client.c |
2268 |
++++ b/net/9p/client.c |
2269 |
+@@ -931,7 +931,7 @@ static int p9_client_version(struct p9_client *c) |
2270 |
+ { |
2271 |
+ int err = 0; |
2272 |
+ struct p9_req_t *req; |
2273 |
+- char *version; |
2274 |
++ char *version = NULL; |
2275 |
+ int msize; |
2276 |
+ |
2277 |
+ p9_debug(P9_DEBUG_9P, ">>> TVERSION msize %d protocol %d\n", |
2278 |
+diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c |
2279 |
+index 7bc2208b6cc4..2b543532e2f1 100644 |
2280 |
+--- a/net/9p/trans_fd.c |
2281 |
++++ b/net/9p/trans_fd.c |
2282 |
+@@ -181,6 +181,8 @@ static void p9_mux_poll_stop(struct p9_conn *m) |
2283 |
+ spin_lock_irqsave(&p9_poll_lock, flags); |
2284 |
+ list_del_init(&m->poll_pending_link); |
2285 |
+ spin_unlock_irqrestore(&p9_poll_lock, flags); |
2286 |
++ |
2287 |
++ flush_work(&p9_poll_work); |
2288 |
+ } |
2289 |
+ |
2290 |
+ /** |
2291 |
+@@ -937,7 +939,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) |
2292 |
+ if (err < 0) |
2293 |
+ return err; |
2294 |
+ |
2295 |
+- if (valid_ipaddr4(addr) < 0) |
2296 |
++ if (addr == NULL || valid_ipaddr4(addr) < 0) |
2297 |
+ return -EINVAL; |
2298 |
+ |
2299 |
+ csocket = NULL; |
2300 |
+@@ -985,6 +987,9 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) |
2301 |
+ |
2302 |
+ csocket = NULL; |
2303 |
+ |
2304 |
++ if (addr == NULL) |
2305 |
++ return -EINVAL; |
2306 |
++ |
2307 |
+ if (strlen(addr) >= UNIX_PATH_MAX) { |
2308 |
+ pr_err("%s (%d): address too long: %s\n", |
2309 |
+ __func__, task_pid_nr(current), addr); |
2310 |
+diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c |
2311 |
+index 553ed4ecb6a0..5a2ad4707463 100644 |
2312 |
+--- a/net/9p/trans_rdma.c |
2313 |
++++ b/net/9p/trans_rdma.c |
2314 |
+@@ -622,6 +622,9 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args) |
2315 |
+ struct rdma_conn_param conn_param; |
2316 |
+ struct ib_qp_init_attr qp_attr; |
2317 |
+ |
2318 |
++ if (addr == NULL) |
2319 |
++ return -EINVAL; |
2320 |
++ |
2321 |
+ /* Parse the transport specific mount options */ |
2322 |
+ err = parse_opts(args, &opts); |
2323 |
+ if (err < 0) |
2324 |
+diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c |
2325 |
+index 3aa5a93ad107..da0d3b257459 100644 |
2326 |
+--- a/net/9p/trans_virtio.c |
2327 |
++++ b/net/9p/trans_virtio.c |
2328 |
+@@ -189,7 +189,7 @@ static int pack_sg_list(struct scatterlist *sg, int start, |
2329 |
+ s = rest_of_page(data); |
2330 |
+ if (s > count) |
2331 |
+ s = count; |
2332 |
+- BUG_ON(index > limit); |
2333 |
++ BUG_ON(index >= limit); |
2334 |
+ /* Make sure we don't terminate early. */ |
2335 |
+ sg_unmark_end(&sg[index]); |
2336 |
+ sg_set_buf(&sg[index++], data, s); |
2337 |
+@@ -234,6 +234,7 @@ pack_sg_list_p(struct scatterlist *sg, int start, int limit, |
2338 |
+ s = PAGE_SIZE - data_off; |
2339 |
+ if (s > count) |
2340 |
+ s = count; |
2341 |
++ BUG_ON(index >= limit); |
2342 |
+ /* Make sure we don't terminate early. */ |
2343 |
+ sg_unmark_end(&sg[index]); |
2344 |
+ sg_set_page(&sg[index++], pdata[i++], s, data_off); |
2345 |
+@@ -406,6 +407,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, |
2346 |
+ p9_debug(P9_DEBUG_TRANS, "virtio request\n"); |
2347 |
+ |
2348 |
+ if (uodata) { |
2349 |
++ __le32 sz; |
2350 |
+ int n = p9_get_mapped_pages(chan, &out_pages, uodata, |
2351 |
+ outlen, &offs, &need_drop); |
2352 |
+ if (n < 0) |
2353 |
+@@ -416,6 +418,12 @@ p9_virtio_zc_request(struct p9_client *client, struct p9_req_t *req, |
2354 |
+ memcpy(&req->tc->sdata[req->tc->size - 4], &v, 4); |
2355 |
+ outlen = n; |
2356 |
+ } |
2357 |
++ /* The size field of the message must include the length of the |
2358 |
++ * header and the length of the data. We didn't actually know |
2359 |
++ * the length of the data until this point so add it in now. |
2360 |
++ */ |
2361 |
++ sz = cpu_to_le32(req->tc->size + outlen); |
2362 |
++ memcpy(&req->tc->sdata[0], &sz, sizeof(sz)); |
2363 |
+ } else if (uidata) { |
2364 |
+ int n = p9_get_mapped_pages(chan, &in_pages, uidata, |
2365 |
+ inlen, &offs, &need_drop); |
2366 |
+@@ -643,6 +651,9 @@ p9_virtio_create(struct p9_client *client, const char *devname, char *args) |
2367 |
+ int ret = -ENOENT; |
2368 |
+ int found = 0; |
2369 |
+ |
2370 |
++ if (devname == NULL) |
2371 |
++ return -EINVAL; |
2372 |
++ |
2373 |
+ mutex_lock(&virtio_9p_lock); |
2374 |
+ list_for_each_entry(chan, &virtio_chan_list, chan_list) { |
2375 |
+ if (!strncmp(devname, chan->tag, chan->tag_len) && |
2376 |
+diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c |
2377 |
+index dbb476d7d38f..50ed47559bb7 100644 |
2378 |
+--- a/net/ieee802154/6lowpan/tx.c |
2379 |
++++ b/net/ieee802154/6lowpan/tx.c |
2380 |
+@@ -266,9 +266,24 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev) |
2381 |
+ /* We must take a copy of the skb before we modify/replace the ipv6 |
2382 |
+ * header as the header could be used elsewhere |
2383 |
+ */ |
2384 |
+- skb = skb_unshare(skb, GFP_ATOMIC); |
2385 |
+- if (!skb) |
2386 |
+- return NET_XMIT_DROP; |
2387 |
++ if (unlikely(skb_headroom(skb) < ldev->needed_headroom || |
2388 |
++ skb_tailroom(skb) < ldev->needed_tailroom)) { |
2389 |
++ struct sk_buff *nskb; |
2390 |
++ |
2391 |
++ nskb = skb_copy_expand(skb, ldev->needed_headroom, |
2392 |
++ ldev->needed_tailroom, GFP_ATOMIC); |
2393 |
++ if (likely(nskb)) { |
2394 |
++ consume_skb(skb); |
2395 |
++ skb = nskb; |
2396 |
++ } else { |
2397 |
++ kfree_skb(skb); |
2398 |
++ return NET_XMIT_DROP; |
2399 |
++ } |
2400 |
++ } else { |
2401 |
++ skb = skb_unshare(skb, GFP_ATOMIC); |
2402 |
++ if (!skb) |
2403 |
++ return NET_XMIT_DROP; |
2404 |
++ } |
2405 |
+ |
2406 |
+ ret = lowpan_header(skb, ldev, &dgram_size, &dgram_offset); |
2407 |
+ if (ret < 0) { |
2408 |
+diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c |
2409 |
+index 7e253455f9dd..bcd1a5e6ebf4 100644 |
2410 |
+--- a/net/mac802154/tx.c |
2411 |
++++ b/net/mac802154/tx.c |
2412 |
+@@ -63,8 +63,21 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb) |
2413 |
+ int ret; |
2414 |
+ |
2415 |
+ if (!(local->hw.flags & IEEE802154_HW_TX_OMIT_CKSUM)) { |
2416 |
+- u16 crc = crc_ccitt(0, skb->data, skb->len); |
2417 |
++ struct sk_buff *nskb; |
2418 |
++ u16 crc; |
2419 |
++ |
2420 |
++ if (unlikely(skb_tailroom(skb) < IEEE802154_FCS_LEN)) { |
2421 |
++ nskb = skb_copy_expand(skb, 0, IEEE802154_FCS_LEN, |
2422 |
++ GFP_ATOMIC); |
2423 |
++ if (likely(nskb)) { |
2424 |
++ consume_skb(skb); |
2425 |
++ skb = nskb; |
2426 |
++ } else { |
2427 |
++ goto err_tx; |
2428 |
++ } |
2429 |
++ } |
2430 |
+ |
2431 |
++ crc = crc_ccitt(0, skb->data, skb->len); |
2432 |
+ put_unaligned_le16(crc, skb_put(skb, 2)); |
2433 |
+ } |
2434 |
+ |
2435 |
+diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c |
2436 |
+index b2ae4f150ec6..244eac1bd648 100644 |
2437 |
+--- a/net/sunrpc/clnt.c |
2438 |
++++ b/net/sunrpc/clnt.c |
2439 |
+@@ -965,10 +965,20 @@ out: |
2440 |
+ } |
2441 |
+ EXPORT_SYMBOL_GPL(rpc_bind_new_program); |
2442 |
+ |
2443 |
++void rpc_task_release_transport(struct rpc_task *task) |
2444 |
++{ |
2445 |
++ struct rpc_xprt *xprt = task->tk_xprt; |
2446 |
++ |
2447 |
++ if (xprt) { |
2448 |
++ task->tk_xprt = NULL; |
2449 |
++ xprt_put(xprt); |
2450 |
++ } |
2451 |
++} |
2452 |
++EXPORT_SYMBOL_GPL(rpc_task_release_transport); |
2453 |
++ |
2454 |
+ void rpc_task_release_client(struct rpc_task *task) |
2455 |
+ { |
2456 |
+ struct rpc_clnt *clnt = task->tk_client; |
2457 |
+- struct rpc_xprt *xprt = task->tk_xprt; |
2458 |
+ |
2459 |
+ if (clnt != NULL) { |
2460 |
+ /* Remove from client task list */ |
2461 |
+@@ -979,12 +989,14 @@ void rpc_task_release_client(struct rpc_task *task) |
2462 |
+ |
2463 |
+ rpc_release_client(clnt); |
2464 |
+ } |
2465 |
++ rpc_task_release_transport(task); |
2466 |
++} |
2467 |
+ |
2468 |
+- if (xprt != NULL) { |
2469 |
+- task->tk_xprt = NULL; |
2470 |
+- |
2471 |
+- xprt_put(xprt); |
2472 |
+- } |
2473 |
++static |
2474 |
++void rpc_task_set_transport(struct rpc_task *task, struct rpc_clnt *clnt) |
2475 |
++{ |
2476 |
++ if (!task->tk_xprt) |
2477 |
++ task->tk_xprt = xprt_iter_get_next(&clnt->cl_xpi); |
2478 |
+ } |
2479 |
+ |
2480 |
+ static |
2481 |
+@@ -992,8 +1004,7 @@ void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt) |
2482 |
+ { |
2483 |
+ |
2484 |
+ if (clnt != NULL) { |
2485 |
+- if (task->tk_xprt == NULL) |
2486 |
+- task->tk_xprt = xprt_iter_get_next(&clnt->cl_xpi); |
2487 |
++ rpc_task_set_transport(task, clnt); |
2488 |
+ task->tk_client = clnt; |
2489 |
+ atomic_inc(&clnt->cl_count); |
2490 |
+ if (clnt->cl_softrtry) |
2491 |
+@@ -1550,6 +1561,7 @@ call_start(struct rpc_task *task) |
2492 |
+ task->tk_msg.rpc_proc->p_count++; |
2493 |
+ clnt->cl_stats->rpccnt++; |
2494 |
+ task->tk_action = call_reserve; |
2495 |
++ rpc_task_set_transport(task, clnt); |
2496 |
+ } |
2497 |
+ |
2498 |
+ /* |
2499 |
+diff --git a/tools/perf/util/auxtrace.c b/tools/perf/util/auxtrace.c |
2500 |
+index 78bd632f144d..29d015e2d900 100644 |
2501 |
+--- a/tools/perf/util/auxtrace.c |
2502 |
++++ b/tools/perf/util/auxtrace.c |
2503 |
+@@ -195,6 +195,9 @@ static int auxtrace_queues__grow(struct auxtrace_queues *queues, |
2504 |
+ for (i = 0; i < queues->nr_queues; i++) { |
2505 |
+ list_splice_tail(&queues->queue_array[i].head, |
2506 |
+ &queue_array[i].head); |
2507 |
++ queue_array[i].tid = queues->queue_array[i].tid; |
2508 |
++ queue_array[i].cpu = queues->queue_array[i].cpu; |
2509 |
++ queue_array[i].set = queues->queue_array[i].set; |
2510 |
+ queue_array[i].priv = queues->queue_array[i].priv; |
2511 |
+ } |
2512 |
+ |