1 |
commit: 55556458720a655972433c367328b0cb918faebe |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Nov 21 12:26:45 2018 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 21 12:26:45 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=55556458 |
7 |
|
8 |
proj/linux-patches: Linux patch 4.14.82 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 + |
13 |
1081_linux-4.14.82.patch | 3276 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 3280 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 70ae288..b8ff7e8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -367,6 +367,10 @@ Patch: 1080-4.14.81.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.14.81 |
23 |
|
24 |
+Patch: 1081-4.14.82.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.14.82 |
27 |
+ |
28 |
Patch: 1500_XATTR_USER_PREFIX.patch |
29 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
30 |
Desc: Support for namespace user.pax.* on tmpfs. |
31 |
|
32 |
diff --git a/1081_linux-4.14.82.patch b/1081_linux-4.14.82.patch |
33 |
new file mode 100644 |
34 |
index 0000000..d95f88b |
35 |
--- /dev/null |
36 |
+++ b/1081_linux-4.14.82.patch |
37 |
@@ -0,0 +1,3276 @@ |
38 |
+diff --git a/Makefile b/Makefile |
39 |
+index 2fe1424d61d2..cac5323bc95d 100644 |
40 |
+--- a/Makefile |
41 |
++++ b/Makefile |
42 |
+@@ -1,7 +1,7 @@ |
43 |
+ # SPDX-License-Identifier: GPL-2.0 |
44 |
+ VERSION = 4 |
45 |
+ PATCHLEVEL = 14 |
46 |
+-SUBLEVEL = 81 |
47 |
++SUBLEVEL = 82 |
48 |
+ EXTRAVERSION = |
49 |
+ NAME = Petit Gorille |
50 |
+ |
51 |
+diff --git a/arch/alpha/include/asm/termios.h b/arch/alpha/include/asm/termios.h |
52 |
+index 6a8c53dec57e..b7c77bb1bfd2 100644 |
53 |
+--- a/arch/alpha/include/asm/termios.h |
54 |
++++ b/arch/alpha/include/asm/termios.h |
55 |
+@@ -73,9 +73,15 @@ |
56 |
+ }) |
57 |
+ |
58 |
+ #define user_termios_to_kernel_termios(k, u) \ |
59 |
+- copy_from_user(k, u, sizeof(struct termios)) |
60 |
++ copy_from_user(k, u, sizeof(struct termios2)) |
61 |
+ |
62 |
+ #define kernel_termios_to_user_termios(u, k) \ |
63 |
++ copy_to_user(u, k, sizeof(struct termios2)) |
64 |
++ |
65 |
++#define user_termios_to_kernel_termios_1(k, u) \ |
66 |
++ copy_from_user(k, u, sizeof(struct termios)) |
67 |
++ |
68 |
++#define kernel_termios_to_user_termios_1(u, k) \ |
69 |
+ copy_to_user(u, k, sizeof(struct termios)) |
70 |
+ |
71 |
+ #endif /* _ALPHA_TERMIOS_H */ |
72 |
+diff --git a/arch/alpha/include/uapi/asm/ioctls.h b/arch/alpha/include/uapi/asm/ioctls.h |
73 |
+index 3729d92d3fa8..dc8c20ac7191 100644 |
74 |
+--- a/arch/alpha/include/uapi/asm/ioctls.h |
75 |
++++ b/arch/alpha/include/uapi/asm/ioctls.h |
76 |
+@@ -32,6 +32,11 @@ |
77 |
+ #define TCXONC _IO('t', 30) |
78 |
+ #define TCFLSH _IO('t', 31) |
79 |
+ |
80 |
++#define TCGETS2 _IOR('T', 42, struct termios2) |
81 |
++#define TCSETS2 _IOW('T', 43, struct termios2) |
82 |
++#define TCSETSW2 _IOW('T', 44, struct termios2) |
83 |
++#define TCSETSF2 _IOW('T', 45, struct termios2) |
84 |
++ |
85 |
+ #define TIOCSWINSZ _IOW('t', 103, struct winsize) |
86 |
+ #define TIOCGWINSZ _IOR('t', 104, struct winsize) |
87 |
+ #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ |
88 |
+diff --git a/arch/alpha/include/uapi/asm/termbits.h b/arch/alpha/include/uapi/asm/termbits.h |
89 |
+index 05e0398a83a6..53b3ecff2f50 100644 |
90 |
+--- a/arch/alpha/include/uapi/asm/termbits.h |
91 |
++++ b/arch/alpha/include/uapi/asm/termbits.h |
92 |
+@@ -26,6 +26,19 @@ struct termios { |
93 |
+ speed_t c_ospeed; /* output speed */ |
94 |
+ }; |
95 |
+ |
96 |
++/* Alpha has identical termios and termios2 */ |
97 |
++ |
98 |
++struct termios2 { |
99 |
++ tcflag_t c_iflag; /* input mode flags */ |
100 |
++ tcflag_t c_oflag; /* output mode flags */ |
101 |
++ tcflag_t c_cflag; /* control mode flags */ |
102 |
++ tcflag_t c_lflag; /* local mode flags */ |
103 |
++ cc_t c_cc[NCCS]; /* control characters */ |
104 |
++ cc_t c_line; /* line discipline (== c_cc[19]) */ |
105 |
++ speed_t c_ispeed; /* input speed */ |
106 |
++ speed_t c_ospeed; /* output speed */ |
107 |
++}; |
108 |
++ |
109 |
+ /* Alpha has matching termios and ktermios */ |
110 |
+ |
111 |
+ struct ktermios { |
112 |
+@@ -148,6 +161,7 @@ struct ktermios { |
113 |
+ #define B3000000 00034 |
114 |
+ #define B3500000 00035 |
115 |
+ #define B4000000 00036 |
116 |
++#define BOTHER 00037 |
117 |
+ |
118 |
+ #define CSIZE 00001400 |
119 |
+ #define CS5 00000000 |
120 |
+@@ -165,6 +179,9 @@ struct ktermios { |
121 |
+ #define CMSPAR 010000000000 /* mark or space (stick) parity */ |
122 |
+ #define CRTSCTS 020000000000 /* flow control */ |
123 |
+ |
124 |
++#define CIBAUD 07600000 |
125 |
++#define IBSHIFT 16 |
126 |
++ |
127 |
+ /* c_lflag bits */ |
128 |
+ #define ISIG 0x00000080 |
129 |
+ #define ICANON 0x00000100 |
130 |
+diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig |
131 |
+index 32acac9ab81a..9c795ceedd5b 100644 |
132 |
+--- a/arch/arm/configs/imx_v6_v7_defconfig |
133 |
++++ b/arch/arm/configs/imx_v6_v7_defconfig |
134 |
+@@ -383,6 +383,7 @@ CONFIG_ZISOFS=y |
135 |
+ CONFIG_UDF_FS=m |
136 |
+ CONFIG_MSDOS_FS=m |
137 |
+ CONFIG_VFAT_FS=y |
138 |
++CONFIG_TMPFS_POSIX_ACL=y |
139 |
+ CONFIG_JFFS2_FS=y |
140 |
+ CONFIG_UBIFS_FS=y |
141 |
+ CONFIG_NFS_FS=y |
142 |
+diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S |
143 |
+index 12468d9378d8..d8d90cf65b39 100644 |
144 |
+--- a/arch/arm/mm/proc-v7.S |
145 |
++++ b/arch/arm/mm/proc-v7.S |
146 |
+@@ -112,7 +112,7 @@ ENTRY(cpu_v7_hvc_switch_mm) |
147 |
+ hvc #0 |
148 |
+ ldmfd sp!, {r0 - r3} |
149 |
+ b cpu_v7_switch_mm |
150 |
+-ENDPROC(cpu_v7_smc_switch_mm) |
151 |
++ENDPROC(cpu_v7_hvc_switch_mm) |
152 |
+ #endif |
153 |
+ ENTRY(cpu_v7_iciallu_switch_mm) |
154 |
+ mov r3, #0 |
155 |
+diff --git a/arch/mips/include/asm/mach-loongson64/irq.h b/arch/mips/include/asm/mach-loongson64/irq.h |
156 |
+index 3644b68c0ccc..be9f727a9328 100644 |
157 |
+--- a/arch/mips/include/asm/mach-loongson64/irq.h |
158 |
++++ b/arch/mips/include/asm/mach-loongson64/irq.h |
159 |
+@@ -10,7 +10,7 @@ |
160 |
+ #define MIPS_CPU_IRQ_BASE 56 |
161 |
+ |
162 |
+ #define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 2) /* UART */ |
163 |
+-#define LOONGSON_HT1_IRQ (MIPS_CPU_IRQ_BASE + 3) /* HT1 */ |
164 |
++#define LOONGSON_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 3) /* CASCADE */ |
165 |
+ #define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* CPU Timer */ |
166 |
+ |
167 |
+ #define LOONGSON_HT1_CFG_BASE loongson_sysconf.ht_control_base |
168 |
+diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c |
169 |
+index d455363d51c3..4c07a43a3242 100644 |
170 |
+--- a/arch/mips/kernel/crash.c |
171 |
++++ b/arch/mips/kernel/crash.c |
172 |
+@@ -36,6 +36,9 @@ static void crash_shutdown_secondary(void *passed_regs) |
173 |
+ if (!cpu_online(cpu)) |
174 |
+ return; |
175 |
+ |
176 |
++ /* We won't be sent IPIs any more. */ |
177 |
++ set_cpu_online(cpu, false); |
178 |
++ |
179 |
+ local_irq_disable(); |
180 |
+ if (!cpumask_test_cpu(cpu, &cpus_in_crash)) |
181 |
+ crash_save_cpu(regs, cpu); |
182 |
+diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c |
183 |
+index 8b574bcd39ba..4b3726e4fe3a 100644 |
184 |
+--- a/arch/mips/kernel/machine_kexec.c |
185 |
++++ b/arch/mips/kernel/machine_kexec.c |
186 |
+@@ -118,6 +118,9 @@ machine_kexec(struct kimage *image) |
187 |
+ *ptr = (unsigned long) phys_to_virt(*ptr); |
188 |
+ } |
189 |
+ |
190 |
++ /* Mark offline BEFORE disabling local irq. */ |
191 |
++ set_cpu_online(smp_processor_id(), false); |
192 |
++ |
193 |
+ /* |
194 |
+ * we do not want to be bothered. |
195 |
+ */ |
196 |
+diff --git a/arch/mips/loongson64/loongson-3/irq.c b/arch/mips/loongson64/loongson-3/irq.c |
197 |
+index cbeb20f9fc95..5605061f5f98 100644 |
198 |
+--- a/arch/mips/loongson64/loongson-3/irq.c |
199 |
++++ b/arch/mips/loongson64/loongson-3/irq.c |
200 |
+@@ -96,51 +96,8 @@ void mach_irq_dispatch(unsigned int pending) |
201 |
+ } |
202 |
+ } |
203 |
+ |
204 |
+-static struct irqaction cascade_irqaction = { |
205 |
+- .handler = no_action, |
206 |
+- .flags = IRQF_NO_SUSPEND, |
207 |
+- .name = "cascade", |
208 |
+-}; |
209 |
+- |
210 |
+-static inline void mask_loongson_irq(struct irq_data *d) |
211 |
+-{ |
212 |
+- clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); |
213 |
+- irq_disable_hazard(); |
214 |
+- |
215 |
+- /* Workaround: UART IRQ may deliver to any core */ |
216 |
+- if (d->irq == LOONGSON_UART_IRQ) { |
217 |
+- int cpu = smp_processor_id(); |
218 |
+- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; |
219 |
+- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; |
220 |
+- u64 intenclr_addr = smp_group[node_id] | |
221 |
+- (u64)(&LOONGSON_INT_ROUTER_INTENCLR); |
222 |
+- u64 introuter_lpc_addr = smp_group[node_id] | |
223 |
+- (u64)(&LOONGSON_INT_ROUTER_LPC); |
224 |
+- |
225 |
+- *(volatile u32 *)intenclr_addr = 1 << 10; |
226 |
+- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); |
227 |
+- } |
228 |
+-} |
229 |
+- |
230 |
+-static inline void unmask_loongson_irq(struct irq_data *d) |
231 |
+-{ |
232 |
+- /* Workaround: UART IRQ may deliver to any core */ |
233 |
+- if (d->irq == LOONGSON_UART_IRQ) { |
234 |
+- int cpu = smp_processor_id(); |
235 |
+- int node_id = cpu_logical_map(cpu) / loongson_sysconf.cores_per_node; |
236 |
+- int core_id = cpu_logical_map(cpu) % loongson_sysconf.cores_per_node; |
237 |
+- u64 intenset_addr = smp_group[node_id] | |
238 |
+- (u64)(&LOONGSON_INT_ROUTER_INTENSET); |
239 |
+- u64 introuter_lpc_addr = smp_group[node_id] | |
240 |
+- (u64)(&LOONGSON_INT_ROUTER_LPC); |
241 |
+- |
242 |
+- *(volatile u32 *)intenset_addr = 1 << 10; |
243 |
+- *(volatile u8 *)introuter_lpc_addr = 0x10 + (1<<core_id); |
244 |
+- } |
245 |
+- |
246 |
+- set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); |
247 |
+- irq_enable_hazard(); |
248 |
+-} |
249 |
++static inline void mask_loongson_irq(struct irq_data *d) { } |
250 |
++static inline void unmask_loongson_irq(struct irq_data *d) { } |
251 |
+ |
252 |
+ /* For MIPS IRQs which shared by all cores */ |
253 |
+ static struct irq_chip loongson_irq_chip = { |
254 |
+@@ -183,12 +140,11 @@ void __init mach_init_irq(void) |
255 |
+ chip->irq_set_affinity = plat_set_irq_affinity; |
256 |
+ |
257 |
+ irq_set_chip_and_handler(LOONGSON_UART_IRQ, |
258 |
+- &loongson_irq_chip, handle_level_irq); |
259 |
+- |
260 |
+- /* setup HT1 irq */ |
261 |
+- setup_irq(LOONGSON_HT1_IRQ, &cascade_irqaction); |
262 |
++ &loongson_irq_chip, handle_percpu_irq); |
263 |
++ irq_set_chip_and_handler(LOONGSON_BRIDGE_IRQ, |
264 |
++ &loongson_irq_chip, handle_percpu_irq); |
265 |
+ |
266 |
+- set_c0_status(STATUSF_IP2 | STATUSF_IP6); |
267 |
++ set_c0_status(STATUSF_IP2 | STATUSF_IP3 | STATUSF_IP6); |
268 |
+ } |
269 |
+ |
270 |
+ #ifdef CONFIG_HOTPLUG_CPU |
271 |
+diff --git a/arch/mips/pci/pci-legacy.c b/arch/mips/pci/pci-legacy.c |
272 |
+index 0c65c38e05d6..1ae6bc414e2b 100644 |
273 |
+--- a/arch/mips/pci/pci-legacy.c |
274 |
++++ b/arch/mips/pci/pci-legacy.c |
275 |
+@@ -127,8 +127,12 @@ static void pcibios_scanbus(struct pci_controller *hose) |
276 |
+ if (pci_has_flag(PCI_PROBE_ONLY)) { |
277 |
+ pci_bus_claim_resources(bus); |
278 |
+ } else { |
279 |
++ struct pci_bus *child; |
280 |
++ |
281 |
+ pci_bus_size_bridges(bus); |
282 |
+ pci_bus_assign_resources(bus); |
283 |
++ list_for_each_entry(child, &bus->children, node) |
284 |
++ pcie_bus_configure_settings(child); |
285 |
+ } |
286 |
+ pci_bus_add_devices(bus); |
287 |
+ } |
288 |
+diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S |
289 |
+index dcf2f15e6797..32dfe6d083f3 100644 |
290 |
+--- a/arch/powerpc/boot/crt0.S |
291 |
++++ b/arch/powerpc/boot/crt0.S |
292 |
+@@ -47,8 +47,10 @@ p_end: .long _end |
293 |
+ p_pstack: .long _platform_stack_top |
294 |
+ #endif |
295 |
+ |
296 |
+- .weak _zimage_start |
297 |
+ .globl _zimage_start |
298 |
++ /* Clang appears to require the .weak directive to be after the symbol |
299 |
++ * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ |
300 |
++ .weak _zimage_start |
301 |
+ _zimage_start: |
302 |
+ .globl _zimage_start_lib |
303 |
+ _zimage_start_lib: |
304 |
+diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c |
305 |
+index 116000b45531..45322b37669a 100644 |
306 |
+--- a/arch/powerpc/kernel/eeh.c |
307 |
++++ b/arch/powerpc/kernel/eeh.c |
308 |
+@@ -169,6 +169,11 @@ static size_t eeh_dump_dev_log(struct eeh_dev *edev, char *buf, size_t len) |
309 |
+ int n = 0, l = 0; |
310 |
+ char buffer[128]; |
311 |
+ |
312 |
++ if (!pdn) { |
313 |
++ pr_warn("EEH: Note: No error log for absent device.\n"); |
314 |
++ return 0; |
315 |
++ } |
316 |
++ |
317 |
+ n += scnprintf(buf+n, len-n, "%04x:%02x:%02x.%01x\n", |
318 |
+ pdn->phb->global_number, pdn->busno, |
319 |
+ PCI_SLOT(pdn->devfn), PCI_FUNC(pdn->devfn)); |
320 |
+diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c |
321 |
+index 2a1b1273a312..4d8f6291b766 100644 |
322 |
+--- a/arch/powerpc/kernel/module_64.c |
323 |
++++ b/arch/powerpc/kernel/module_64.c |
324 |
+@@ -656,7 +656,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, |
325 |
+ |
326 |
+ case R_PPC64_REL32: |
327 |
+ /* 32 bits relative (used by relative exception tables) */ |
328 |
+- *(u32 *)location = value - (unsigned long)location; |
329 |
++ /* Convert value to relative */ |
330 |
++ value -= (unsigned long)location; |
331 |
++ if (value + 0x80000000 > 0xffffffff) { |
332 |
++ pr_err("%s: REL32 %li out of range!\n", |
333 |
++ me->name, (long int)value); |
334 |
++ return -ENOEXEC; |
335 |
++ } |
336 |
++ *(u32 *)location = value; |
337 |
+ break; |
338 |
+ |
339 |
+ case R_PPC64_TOCSAVE: |
340 |
+diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c |
341 |
+index ac2e5e56a9f0..a5f2b7593976 100644 |
342 |
+--- a/arch/powerpc/kernel/traps.c |
343 |
++++ b/arch/powerpc/kernel/traps.c |
344 |
+@@ -694,12 +694,17 @@ void machine_check_exception(struct pt_regs *regs) |
345 |
+ if (check_io_access(regs)) |
346 |
+ goto bail; |
347 |
+ |
348 |
+- die("Machine check", regs, SIGBUS); |
349 |
+- |
350 |
+ /* Must die if the interrupt is not recoverable */ |
351 |
+ if (!(regs->msr & MSR_RI)) |
352 |
+ nmi_panic(regs, "Unrecoverable Machine check"); |
353 |
+ |
354 |
++ if (!nested) |
355 |
++ nmi_exit(); |
356 |
++ |
357 |
++ die("Machine check", regs, SIGBUS); |
358 |
++ |
359 |
++ return; |
360 |
++ |
361 |
+ bail: |
362 |
+ if (!nested) |
363 |
+ nmi_exit(); |
364 |
+diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c |
365 |
+index c9282d27b203..31c1c61afaa4 100644 |
366 |
+--- a/arch/powerpc/mm/dump_linuxpagetables.c |
367 |
++++ b/arch/powerpc/mm/dump_linuxpagetables.c |
368 |
+@@ -422,12 +422,13 @@ static void walk_pagetables(struct pg_state *st) |
369 |
+ unsigned int i; |
370 |
+ unsigned long addr; |
371 |
+ |
372 |
++ addr = st->start_address; |
373 |
++ |
374 |
+ /* |
375 |
+ * Traverse the linux pagetable structure and dump pages that are in |
376 |
+ * the hash pagetable. |
377 |
+ */ |
378 |
+- for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { |
379 |
+- addr = KERN_VIRT_START + i * PGDIR_SIZE; |
380 |
++ for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) { |
381 |
+ if (!pgd_none(*pgd) && !pgd_huge(*pgd)) |
382 |
+ /* pgd exists */ |
383 |
+ walk_pud(st, pgd, addr); |
384 |
+@@ -476,9 +477,14 @@ static int ptdump_show(struct seq_file *m, void *v) |
385 |
+ { |
386 |
+ struct pg_state st = { |
387 |
+ .seq = m, |
388 |
+- .start_address = KERN_VIRT_START, |
389 |
+ .marker = address_markers, |
390 |
+ }; |
391 |
++ |
392 |
++ if (radix_enabled()) |
393 |
++ st.start_address = PAGE_OFFSET; |
394 |
++ else |
395 |
++ st.start_address = KERN_VIRT_START; |
396 |
++ |
397 |
+ /* Traverse kernel page tables */ |
398 |
+ walk_pagetables(&st); |
399 |
+ note_page(&st, 0, 0, 0); |
400 |
+diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c |
401 |
+index 4c9e5f9c7a44..e2d929ddad7f 100644 |
402 |
+--- a/arch/powerpc/mm/hugetlbpage.c |
403 |
++++ b/arch/powerpc/mm/hugetlbpage.c |
404 |
+@@ -19,6 +19,7 @@ |
405 |
+ #include <linux/moduleparam.h> |
406 |
+ #include <linux/swap.h> |
407 |
+ #include <linux/swapops.h> |
408 |
++#include <linux/kmemleak.h> |
409 |
+ #include <asm/pgtable.h> |
410 |
+ #include <asm/pgalloc.h> |
411 |
+ #include <asm/tlb.h> |
412 |
+@@ -110,6 +111,8 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, |
413 |
+ for (i = i - 1 ; i >= 0; i--, hpdp--) |
414 |
+ *hpdp = __hugepd(0); |
415 |
+ kmem_cache_free(cachep, new); |
416 |
++ } else { |
417 |
++ kmemleak_ignore(new); |
418 |
+ } |
419 |
+ spin_unlock(&mm->page_table_lock); |
420 |
+ return 0; |
421 |
+diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c |
422 |
+index bfc4a0869609..2ae18e90e0ba 100644 |
423 |
+--- a/arch/powerpc/mm/tlb_nohash.c |
424 |
++++ b/arch/powerpc/mm/tlb_nohash.c |
425 |
+@@ -500,6 +500,9 @@ static void setup_page_sizes(void) |
426 |
+ for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { |
427 |
+ struct mmu_psize_def *def = &mmu_psize_defs[psize]; |
428 |
+ |
429 |
++ if (!def->shift) |
430 |
++ continue; |
431 |
++ |
432 |
+ if (tlb1ps & (1U << (def->shift - 10))) { |
433 |
+ def->flags |= MMU_PAGE_SIZE_DIRECT; |
434 |
+ |
435 |
+diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c |
436 |
+index fc222a0c2ac4..c9a6d4f3403c 100644 |
437 |
+--- a/arch/powerpc/platforms/powernv/memtrace.c |
438 |
++++ b/arch/powerpc/platforms/powernv/memtrace.c |
439 |
+@@ -119,17 +119,15 @@ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) |
440 |
+ walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, |
441 |
+ change_memblock_state); |
442 |
+ |
443 |
+- lock_device_hotplug(); |
444 |
+- remove_memory(nid, start_pfn << PAGE_SHIFT, nr_pages << PAGE_SHIFT); |
445 |
+- unlock_device_hotplug(); |
446 |
+ |
447 |
+ return true; |
448 |
+ } |
449 |
+ |
450 |
+ static u64 memtrace_alloc_node(u32 nid, u64 size) |
451 |
+ { |
452 |
+- u64 start_pfn, end_pfn, nr_pages; |
453 |
++ u64 start_pfn, end_pfn, nr_pages, pfn; |
454 |
+ u64 base_pfn; |
455 |
++ u64 bytes = memory_block_size_bytes(); |
456 |
+ |
457 |
+ if (!NODE_DATA(nid) || !node_spanned_pages(nid)) |
458 |
+ return 0; |
459 |
+@@ -142,8 +140,21 @@ static u64 memtrace_alloc_node(u32 nid, u64 size) |
460 |
+ end_pfn = round_down(end_pfn - nr_pages, nr_pages); |
461 |
+ |
462 |
+ for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { |
463 |
+- if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) |
464 |
++ if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { |
465 |
++ /* |
466 |
++ * Remove memory in memory block size chunks so that |
467 |
++ * iomem resources are always split to the same size and |
468 |
++ * we never try to remove memory that spans two iomem |
469 |
++ * resources. |
470 |
++ */ |
471 |
++ lock_device_hotplug(); |
472 |
++ end_pfn = base_pfn + nr_pages; |
473 |
++ for (pfn = base_pfn; pfn < end_pfn; pfn += bytes>> PAGE_SHIFT) { |
474 |
++ remove_memory(nid, pfn << PAGE_SHIFT, bytes); |
475 |
++ } |
476 |
++ unlock_device_hotplug(); |
477 |
+ return base_pfn << PAGE_SHIFT; |
478 |
++ } |
479 |
+ } |
480 |
+ |
481 |
+ return 0; |
482 |
+diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c |
483 |
+index 85eb5fc180c8..c0201b11e9e2 100644 |
484 |
+--- a/arch/x86/kernel/cpu/mshyperv.c |
485 |
++++ b/arch/x86/kernel/cpu/mshyperv.c |
486 |
+@@ -20,6 +20,7 @@ |
487 |
+ #include <linux/interrupt.h> |
488 |
+ #include <linux/irq.h> |
489 |
+ #include <linux/kexec.h> |
490 |
++#include <linux/i8253.h> |
491 |
+ #include <asm/processor.h> |
492 |
+ #include <asm/hypervisor.h> |
493 |
+ #include <asm/hyperv.h> |
494 |
+@@ -243,6 +244,16 @@ static void __init ms_hyperv_init_platform(void) |
495 |
+ if (efi_enabled(EFI_BOOT)) |
496 |
+ x86_platform.get_nmi_reason = hv_get_nmi_reason; |
497 |
+ |
498 |
++ /* |
499 |
++ * Hyper-V VMs have a PIT emulation quirk such that zeroing the |
500 |
++ * counter register during PIT shutdown restarts the PIT. So it |
501 |
++ * continues to interrupt @18.2 HZ. Setting i8253_clear_counter |
502 |
++ * to false tells pit_shutdown() not to zero the counter so that |
503 |
++ * the PIT really is shutdown. Generation 2 VMs don't have a PIT, |
504 |
++ * and setting this value has no effect. |
505 |
++ */ |
506 |
++ i8253_clear_counter_on_shutdown = false; |
507 |
++ |
508 |
+ #if IS_ENABLED(CONFIG_HYPERV) |
509 |
+ /* |
510 |
+ * Setup the hook to get control post apic initialization. |
511 |
+diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c |
512 |
+index 8e005329648b..d805202c63cd 100644 |
513 |
+--- a/arch/x86/kernel/cpu/vmware.c |
514 |
++++ b/arch/x86/kernel/cpu/vmware.c |
515 |
+@@ -77,7 +77,7 @@ static __init int setup_vmw_sched_clock(char *s) |
516 |
+ } |
517 |
+ early_param("no-vmw-sched-clock", setup_vmw_sched_clock); |
518 |
+ |
519 |
+-static unsigned long long vmware_sched_clock(void) |
520 |
++static unsigned long long notrace vmware_sched_clock(void) |
521 |
+ { |
522 |
+ unsigned long long ns; |
523 |
+ |
524 |
+diff --git a/arch/x86/um/shared/sysdep/ptrace_32.h b/arch/x86/um/shared/sysdep/ptrace_32.h |
525 |
+index b94a108de1dc..ae00d22bce02 100644 |
526 |
+--- a/arch/x86/um/shared/sysdep/ptrace_32.h |
527 |
++++ b/arch/x86/um/shared/sysdep/ptrace_32.h |
528 |
+@@ -10,20 +10,10 @@ |
529 |
+ |
530 |
+ static inline void update_debugregs(int seq) {} |
531 |
+ |
532 |
+-/* syscall emulation path in ptrace */ |
533 |
+- |
534 |
+-#ifndef PTRACE_SYSEMU |
535 |
+-#define PTRACE_SYSEMU 31 |
536 |
+-#endif |
537 |
+- |
538 |
+ void set_using_sysemu(int value); |
539 |
+ int get_using_sysemu(void); |
540 |
+ extern int sysemu_supported; |
541 |
+ |
542 |
+-#ifndef PTRACE_SYSEMU_SINGLESTEP |
543 |
+-#define PTRACE_SYSEMU_SINGLESTEP 32 |
544 |
+-#endif |
545 |
+- |
546 |
+ #define UPT_SYSCALL_ARG1(r) UPT_BX(r) |
547 |
+ #define UPT_SYSCALL_ARG2(r) UPT_CX(r) |
548 |
+ #define UPT_SYSCALL_ARG3(r) UPT_DX(r) |
549 |
+diff --git a/arch/xtensa/boot/Makefile b/arch/xtensa/boot/Makefile |
550 |
+index 53e4178711e6..8c20a7965bda 100644 |
551 |
+--- a/arch/xtensa/boot/Makefile |
552 |
++++ b/arch/xtensa/boot/Makefile |
553 |
+@@ -34,7 +34,7 @@ boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y)) \ |
554 |
+ $(addprefix $(obj)/,$(host-progs)) |
555 |
+ $(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS) |
556 |
+ |
557 |
+-OBJCOPYFLAGS = --strip-all -R .comment -R .note.gnu.build-id -O binary |
558 |
++OBJCOPYFLAGS = --strip-all -R .comment -R .notes -O binary |
559 |
+ |
560 |
+ vmlinux.bin: vmlinux FORCE |
561 |
+ $(call if_changed,objcopy) |
562 |
+diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h |
563 |
+index 5b0027d4ecc0..a39cd81b741a 100644 |
564 |
+--- a/arch/xtensa/include/asm/processor.h |
565 |
++++ b/arch/xtensa/include/asm/processor.h |
566 |
+@@ -24,7 +24,11 @@ |
567 |
+ # error Linux requires the Xtensa Windowed Registers Option. |
568 |
+ #endif |
569 |
+ |
570 |
+-#define ARCH_SLAB_MINALIGN XCHAL_DATA_WIDTH |
571 |
++/* Xtensa ABI requires stack alignment to be at least 16 */ |
572 |
++ |
573 |
++#define STACK_ALIGN (XCHAL_DATA_WIDTH > 16 ? XCHAL_DATA_WIDTH : 16) |
574 |
++ |
575 |
++#define ARCH_SLAB_MINALIGN STACK_ALIGN |
576 |
+ |
577 |
+ /* |
578 |
+ * User space process size: 1 GB. |
579 |
+diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S |
580 |
+index 23ce62e60435..27c8e07ace43 100644 |
581 |
+--- a/arch/xtensa/kernel/head.S |
582 |
++++ b/arch/xtensa/kernel/head.S |
583 |
+@@ -88,9 +88,12 @@ _SetupMMU: |
584 |
+ initialize_mmu |
585 |
+ #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY |
586 |
+ rsr a2, excsave1 |
587 |
+- movi a3, 0x08000000 |
588 |
++ movi a3, XCHAL_KSEG_PADDR |
589 |
++ bltu a2, a3, 1f |
590 |
++ sub a2, a2, a3 |
591 |
++ movi a3, XCHAL_KSEG_SIZE |
592 |
+ bgeu a2, a3, 1f |
593 |
+- movi a3, 0xd0000000 |
594 |
++ movi a3, XCHAL_KSEG_CACHED_VADDR |
595 |
+ add a2, a2, a3 |
596 |
+ wsr a2, excsave1 |
597 |
+ 1: |
598 |
+diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S |
599 |
+index 162c77e53ca8..3e04845a15e6 100644 |
600 |
+--- a/arch/xtensa/kernel/vmlinux.lds.S |
601 |
++++ b/arch/xtensa/kernel/vmlinux.lds.S |
602 |
+@@ -146,6 +146,7 @@ SECTIONS |
603 |
+ .fixup : { *(.fixup) } |
604 |
+ |
605 |
+ EXCEPTION_TABLE(16) |
606 |
++ NOTES |
607 |
+ /* Data section */ |
608 |
+ |
609 |
+ _sdata = .; |
610 |
+diff --git a/block/blk-core.c b/block/blk-core.c |
611 |
+index 6aa2bc4e9652..0b14aebfd1a8 100644 |
612 |
+--- a/block/blk-core.c |
613 |
++++ b/block/blk-core.c |
614 |
+@@ -671,9 +671,8 @@ void blk_cleanup_queue(struct request_queue *q) |
615 |
+ * dispatch may still be in-progress since we dispatch requests |
616 |
+ * from more than one contexts. |
617 |
+ * |
618 |
+- * No need to quiesce queue if it isn't initialized yet since |
619 |
+- * blk_freeze_queue() should be enough for cases of passthrough |
620 |
+- * request. |
621 |
++ * We rely on driver to deal with the race in case that queue |
622 |
++ * initialization isn't done. |
623 |
+ */ |
624 |
+ if (q->mq_ops && blk_queue_init_done(q)) |
625 |
+ blk_mq_quiesce_queue(q); |
626 |
+diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c |
627 |
+index 0dbe2be7f783..b5758768920b 100644 |
628 |
+--- a/crypto/crypto_user.c |
629 |
++++ b/crypto/crypto_user.c |
630 |
+@@ -83,7 +83,7 @@ static int crypto_report_cipher(struct sk_buff *skb, struct crypto_alg *alg) |
631 |
+ { |
632 |
+ struct crypto_report_cipher rcipher; |
633 |
+ |
634 |
+- strlcpy(rcipher.type, "cipher", sizeof(rcipher.type)); |
635 |
++ strncpy(rcipher.type, "cipher", sizeof(rcipher.type)); |
636 |
+ |
637 |
+ rcipher.blocksize = alg->cra_blocksize; |
638 |
+ rcipher.min_keysize = alg->cra_cipher.cia_min_keysize; |
639 |
+@@ -102,7 +102,7 @@ static int crypto_report_comp(struct sk_buff *skb, struct crypto_alg *alg) |
640 |
+ { |
641 |
+ struct crypto_report_comp rcomp; |
642 |
+ |
643 |
+- strlcpy(rcomp.type, "compression", sizeof(rcomp.type)); |
644 |
++ strncpy(rcomp.type, "compression", sizeof(rcomp.type)); |
645 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_COMPRESS, |
646 |
+ sizeof(struct crypto_report_comp), &rcomp)) |
647 |
+ goto nla_put_failure; |
648 |
+@@ -116,7 +116,7 @@ static int crypto_report_acomp(struct sk_buff *skb, struct crypto_alg *alg) |
649 |
+ { |
650 |
+ struct crypto_report_acomp racomp; |
651 |
+ |
652 |
+- strlcpy(racomp.type, "acomp", sizeof(racomp.type)); |
653 |
++ strncpy(racomp.type, "acomp", sizeof(racomp.type)); |
654 |
+ |
655 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_ACOMP, |
656 |
+ sizeof(struct crypto_report_acomp), &racomp)) |
657 |
+@@ -131,7 +131,7 @@ static int crypto_report_akcipher(struct sk_buff *skb, struct crypto_alg *alg) |
658 |
+ { |
659 |
+ struct crypto_report_akcipher rakcipher; |
660 |
+ |
661 |
+- strlcpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); |
662 |
++ strncpy(rakcipher.type, "akcipher", sizeof(rakcipher.type)); |
663 |
+ |
664 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_AKCIPHER, |
665 |
+ sizeof(struct crypto_report_akcipher), &rakcipher)) |
666 |
+@@ -146,7 +146,7 @@ static int crypto_report_kpp(struct sk_buff *skb, struct crypto_alg *alg) |
667 |
+ { |
668 |
+ struct crypto_report_kpp rkpp; |
669 |
+ |
670 |
+- strlcpy(rkpp.type, "kpp", sizeof(rkpp.type)); |
671 |
++ strncpy(rkpp.type, "kpp", sizeof(rkpp.type)); |
672 |
+ |
673 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_KPP, |
674 |
+ sizeof(struct crypto_report_kpp), &rkpp)) |
675 |
+@@ -160,10 +160,10 @@ nla_put_failure: |
676 |
+ static int crypto_report_one(struct crypto_alg *alg, |
677 |
+ struct crypto_user_alg *ualg, struct sk_buff *skb) |
678 |
+ { |
679 |
+- strlcpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); |
680 |
+- strlcpy(ualg->cru_driver_name, alg->cra_driver_name, |
681 |
++ strncpy(ualg->cru_name, alg->cra_name, sizeof(ualg->cru_name)); |
682 |
++ strncpy(ualg->cru_driver_name, alg->cra_driver_name, |
683 |
+ sizeof(ualg->cru_driver_name)); |
684 |
+- strlcpy(ualg->cru_module_name, module_name(alg->cra_module), |
685 |
++ strncpy(ualg->cru_module_name, module_name(alg->cra_module), |
686 |
+ sizeof(ualg->cru_module_name)); |
687 |
+ |
688 |
+ ualg->cru_type = 0; |
689 |
+@@ -176,7 +176,7 @@ static int crypto_report_one(struct crypto_alg *alg, |
690 |
+ if (alg->cra_flags & CRYPTO_ALG_LARVAL) { |
691 |
+ struct crypto_report_larval rl; |
692 |
+ |
693 |
+- strlcpy(rl.type, "larval", sizeof(rl.type)); |
694 |
++ strncpy(rl.type, "larval", sizeof(rl.type)); |
695 |
+ if (nla_put(skb, CRYPTOCFGA_REPORT_LARVAL, |
696 |
+ sizeof(struct crypto_report_larval), &rl)) |
697 |
+ goto nla_put_failure; |
698 |
+diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c |
699 |
+index 8cfa10ab7abc..930b49606a8c 100644 |
700 |
+--- a/drivers/cdrom/cdrom.c |
701 |
++++ b/drivers/cdrom/cdrom.c |
702 |
+@@ -2441,7 +2441,7 @@ static int cdrom_ioctl_select_disc(struct cdrom_device_info *cdi, |
703 |
+ return -ENOSYS; |
704 |
+ |
705 |
+ if (arg != CDSL_CURRENT && arg != CDSL_NONE) { |
706 |
+- if ((int)arg >= cdi->capacity) |
707 |
++ if (arg >= cdi->capacity) |
708 |
+ return -EINVAL; |
709 |
+ } |
710 |
+ |
711 |
+diff --git a/drivers/clk/at91/clk-pll.c b/drivers/clk/at91/clk-pll.c |
712 |
+index 72b6091eb7b9..dc7fbc796cb6 100644 |
713 |
+--- a/drivers/clk/at91/clk-pll.c |
714 |
++++ b/drivers/clk/at91/clk-pll.c |
715 |
+@@ -133,6 +133,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, |
716 |
+ { |
717 |
+ struct clk_pll *pll = to_clk_pll(hw); |
718 |
+ |
719 |
++ if (!pll->div || !pll->mul) |
720 |
++ return 0; |
721 |
++ |
722 |
+ return (parent_rate / pll->div) * (pll->mul + 1); |
723 |
+ } |
724 |
+ |
725 |
+diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c |
726 |
+index fbaa84a33c46..14071a57c926 100644 |
727 |
+--- a/drivers/clk/clk-s2mps11.c |
728 |
++++ b/drivers/clk/clk-s2mps11.c |
729 |
+@@ -245,6 +245,36 @@ static const struct platform_device_id s2mps11_clk_id[] = { |
730 |
+ }; |
731 |
+ MODULE_DEVICE_TABLE(platform, s2mps11_clk_id); |
732 |
+ |
733 |
++#ifdef CONFIG_OF |
734 |
++/* |
735 |
++ * Device is instantiated through parent MFD device and device matching is done |
736 |
++ * through platform_device_id. |
737 |
++ * |
738 |
++ * However if device's DT node contains proper clock compatible and driver is |
739 |
++ * built as a module, then the *module* matching will be done trough DT aliases. |
740 |
++ * This requires of_device_id table. In the same time this will not change the |
741 |
++ * actual *device* matching so do not add .of_match_table. |
742 |
++ */ |
743 |
++static const struct of_device_id s2mps11_dt_match[] = { |
744 |
++ { |
745 |
++ .compatible = "samsung,s2mps11-clk", |
746 |
++ .data = (void *)S2MPS11X, |
747 |
++ }, { |
748 |
++ .compatible = "samsung,s2mps13-clk", |
749 |
++ .data = (void *)S2MPS13X, |
750 |
++ }, { |
751 |
++ .compatible = "samsung,s2mps14-clk", |
752 |
++ .data = (void *)S2MPS14X, |
753 |
++ }, { |
754 |
++ .compatible = "samsung,s5m8767-clk", |
755 |
++ .data = (void *)S5M8767X, |
756 |
++ }, { |
757 |
++ /* Sentinel */ |
758 |
++ }, |
759 |
++}; |
760 |
++MODULE_DEVICE_TABLE(of, s2mps11_dt_match); |
761 |
++#endif |
762 |
++ |
763 |
+ static struct platform_driver s2mps11_clk_driver = { |
764 |
+ .driver = { |
765 |
+ .name = "s2mps11-clk", |
766 |
+diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c |
767 |
+index 2a5015c736ce..43e82fa64422 100644 |
768 |
+--- a/drivers/clk/hisilicon/reset.c |
769 |
++++ b/drivers/clk/hisilicon/reset.c |
770 |
+@@ -109,9 +109,8 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev) |
771 |
+ return NULL; |
772 |
+ |
773 |
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
774 |
+- rstc->membase = devm_ioremap(&pdev->dev, |
775 |
+- res->start, resource_size(res)); |
776 |
+- if (!rstc->membase) |
777 |
++ rstc->membase = devm_ioremap_resource(&pdev->dev, res); |
778 |
++ if (IS_ERR(rstc->membase)) |
779 |
+ return NULL; |
780 |
+ |
781 |
+ spin_lock_init(&rstc->lock); |
782 |
+diff --git a/drivers/clk/mvebu/clk-corediv.c b/drivers/clk/mvebu/clk-corediv.c |
783 |
+index 8491979f4096..68f05c53d40e 100644 |
784 |
+--- a/drivers/clk/mvebu/clk-corediv.c |
785 |
++++ b/drivers/clk/mvebu/clk-corediv.c |
786 |
+@@ -72,7 +72,7 @@ static const struct clk_corediv_desc mvebu_corediv_desc[] = { |
787 |
+ }; |
788 |
+ |
789 |
+ static const struct clk_corediv_desc mv98dx3236_corediv_desc[] = { |
790 |
+- { .mask = 0x0f, .offset = 6, .fieldbit = 26 }, /* NAND clock */ |
791 |
++ { .mask = 0x0f, .offset = 6, .fieldbit = 27 }, /* NAND clock */ |
792 |
+ }; |
793 |
+ |
794 |
+ #define to_corediv_clk(p) container_of(p, struct clk_corediv, hw) |
795 |
+diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c |
796 |
+index e8075359366b..ebce5260068b 100644 |
797 |
+--- a/drivers/clk/rockchip/clk-ddr.c |
798 |
++++ b/drivers/clk/rockchip/clk-ddr.c |
799 |
+@@ -80,16 +80,12 @@ static long rockchip_ddrclk_sip_round_rate(struct clk_hw *hw, |
800 |
+ static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw) |
801 |
+ { |
802 |
+ struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw); |
803 |
+- int num_parents = clk_hw_get_num_parents(hw); |
804 |
+ u32 val; |
805 |
+ |
806 |
+ val = clk_readl(ddrclk->reg_base + |
807 |
+ ddrclk->mux_offset) >> ddrclk->mux_shift; |
808 |
+ val &= GENMASK(ddrclk->mux_width - 1, 0); |
809 |
+ |
810 |
+- if (val >= num_parents) |
811 |
+- return -EINVAL; |
812 |
+- |
813 |
+ return val; |
814 |
+ } |
815 |
+ |
816 |
+diff --git a/drivers/clocksource/i8253.c b/drivers/clocksource/i8253.c |
817 |
+index 9c38895542f4..d4350bb10b83 100644 |
818 |
+--- a/drivers/clocksource/i8253.c |
819 |
++++ b/drivers/clocksource/i8253.c |
820 |
+@@ -20,6 +20,13 @@ |
821 |
+ DEFINE_RAW_SPINLOCK(i8253_lock); |
822 |
+ EXPORT_SYMBOL(i8253_lock); |
823 |
+ |
824 |
++/* |
825 |
++ * Handle PIT quirk in pit_shutdown() where zeroing the counter register |
826 |
++ * restarts the PIT, negating the shutdown. On platforms with the quirk, |
827 |
++ * platform specific code can set this to false. |
828 |
++ */ |
829 |
++bool i8253_clear_counter_on_shutdown __ro_after_init = true; |
830 |
++ |
831 |
+ #ifdef CONFIG_CLKSRC_I8253 |
832 |
+ /* |
833 |
+ * Since the PIT overflows every tick, its not very useful |
834 |
+@@ -109,8 +116,11 @@ static int pit_shutdown(struct clock_event_device *evt) |
835 |
+ raw_spin_lock(&i8253_lock); |
836 |
+ |
837 |
+ outb_p(0x30, PIT_MODE); |
838 |
+- outb_p(0, PIT_CH0); |
839 |
+- outb_p(0, PIT_CH0); |
840 |
++ |
841 |
++ if (i8253_clear_counter_on_shutdown) { |
842 |
++ outb_p(0, PIT_CH0); |
843 |
++ outb_p(0, PIT_CH0); |
844 |
++ } |
845 |
+ |
846 |
+ raw_spin_unlock(&i8253_lock); |
847 |
+ return 0; |
848 |
+diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c |
849 |
+index 8830fa601e45..0c0d2312f4a8 100644 |
850 |
+--- a/drivers/firmware/efi/libstub/fdt.c |
851 |
++++ b/drivers/firmware/efi/libstub/fdt.c |
852 |
+@@ -158,6 +158,10 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, |
853 |
+ return efi_status; |
854 |
+ } |
855 |
+ } |
856 |
++ |
857 |
++ /* shrink the FDT back to its minimum size */ |
858 |
++ fdt_pack(fdt); |
859 |
++ |
860 |
+ return EFI_SUCCESS; |
861 |
+ |
862 |
+ fdt_set_fail: |
863 |
+diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c |
864 |
+index dd0308cc8bb0..bfc9b1afa388 100644 |
865 |
+--- a/drivers/gpio/gpio-brcmstb.c |
866 |
++++ b/drivers/gpio/gpio-brcmstb.c |
867 |
+@@ -63,6 +63,21 @@ brcmstb_gpio_gc_to_priv(struct gpio_chip *gc) |
868 |
+ return bank->parent_priv; |
869 |
+ } |
870 |
+ |
871 |
++static unsigned long |
872 |
++brcmstb_gpio_get_active_irqs(struct brcmstb_gpio_bank *bank) |
873 |
++{ |
874 |
++ void __iomem *reg_base = bank->parent_priv->reg_base; |
875 |
++ unsigned long status; |
876 |
++ unsigned long flags; |
877 |
++ |
878 |
++ spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
879 |
++ status = bank->gc.read_reg(reg_base + GIO_STAT(bank->id)) & |
880 |
++ bank->gc.read_reg(reg_base + GIO_MASK(bank->id)); |
881 |
++ spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
882 |
++ |
883 |
++ return status; |
884 |
++} |
885 |
++ |
886 |
+ static void brcmstb_gpio_set_imask(struct brcmstb_gpio_bank *bank, |
887 |
+ unsigned int offset, bool enable) |
888 |
+ { |
889 |
+@@ -205,11 +220,8 @@ static void brcmstb_gpio_irq_bank_handler(struct brcmstb_gpio_bank *bank) |
890 |
+ struct irq_domain *irq_domain = bank->gc.irqdomain; |
891 |
+ void __iomem *reg_base = priv->reg_base; |
892 |
+ unsigned long status; |
893 |
+- unsigned long flags; |
894 |
+ |
895 |
+- spin_lock_irqsave(&bank->gc.bgpio_lock, flags); |
896 |
+- while ((status = bank->gc.read_reg(reg_base + GIO_STAT(bank->id)) & |
897 |
+- bank->gc.read_reg(reg_base + GIO_MASK(bank->id)))) { |
898 |
++ while ((status = brcmstb_gpio_get_active_irqs(bank))) { |
899 |
+ int bit; |
900 |
+ |
901 |
+ for_each_set_bit(bit, &status, 32) { |
902 |
+@@ -224,7 +236,6 @@ static void brcmstb_gpio_irq_bank_handler(struct brcmstb_gpio_bank *bank) |
903 |
+ generic_handle_irq(irq_find_mapping(irq_domain, bit)); |
904 |
+ } |
905 |
+ } |
906 |
+- spin_unlock_irqrestore(&bank->gc.bgpio_lock, flags); |
907 |
+ } |
908 |
+ |
909 |
+ /* Each UPG GIO block has one IRQ for all banks */ |
910 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
911 |
+index 36c763310df5..684769c9a48e 100644 |
912 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
913 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c |
914 |
+@@ -247,6 +247,7 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type) |
915 |
+ case CHIP_PITCAIRN: |
916 |
+ case CHIP_VERDE: |
917 |
+ case CHIP_OLAND: |
918 |
++ case CHIP_HAINAN: |
919 |
+ return AMDGPU_FW_LOAD_DIRECT; |
920 |
+ #endif |
921 |
+ #ifdef CONFIG_DRM_AMDGPU_CIK |
922 |
+diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c |
923 |
+index c022ab6e84bd..2a4cf6837324 100644 |
924 |
+--- a/drivers/gpu/drm/drm_dp_mst_topology.c |
925 |
++++ b/drivers/gpu/drm/drm_dp_mst_topology.c |
926 |
+@@ -1232,6 +1232,9 @@ static struct drm_dp_mst_branch *drm_dp_get_mst_branch_device(struct drm_dp_mst_ |
927 |
+ mutex_lock(&mgr->lock); |
928 |
+ mstb = mgr->mst_primary; |
929 |
+ |
930 |
++ if (!mstb) |
931 |
++ goto out; |
932 |
++ |
933 |
+ for (i = 0; i < lct - 1; i++) { |
934 |
+ int shift = (i % 2) ? 0 : 4; |
935 |
+ int port_num = (rad[i / 2] >> shift) & 0xf; |
936 |
+diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
937 |
+index b92595c477ef..8bd29075ae4e 100644 |
938 |
+--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
939 |
++++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c |
940 |
+@@ -122,6 +122,7 @@ static int hibmc_drm_fb_create(struct drm_fb_helper *helper, |
941 |
+ hi_fbdev->fb = hibmc_framebuffer_init(priv->dev, &mode_cmd, gobj); |
942 |
+ if (IS_ERR(hi_fbdev->fb)) { |
943 |
+ ret = PTR_ERR(hi_fbdev->fb); |
944 |
++ hi_fbdev->fb = NULL; |
945 |
+ DRM_ERROR("failed to initialize framebuffer: %d\n", ret); |
946 |
+ goto out_release_fbi; |
947 |
+ } |
948 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
949 |
+index f354cfe63f7b..1f19e6d9a717 100644 |
950 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
951 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
952 |
+@@ -980,11 +980,7 @@ i915_gem_shmem_pread(struct drm_i915_gem_object *obj, |
953 |
+ offset = offset_in_page(args->offset); |
954 |
+ for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { |
955 |
+ struct page *page = i915_gem_object_get_page(obj, idx); |
956 |
+- int length; |
957 |
+- |
958 |
+- length = remain; |
959 |
+- if (offset + length > PAGE_SIZE) |
960 |
+- length = PAGE_SIZE - offset; |
961 |
++ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); |
962 |
+ |
963 |
+ ret = shmem_pread(page, offset, length, user_data, |
964 |
+ page_to_phys(page) & obj_do_bit17_swizzling, |
965 |
+@@ -1406,11 +1402,7 @@ i915_gem_shmem_pwrite(struct drm_i915_gem_object *obj, |
966 |
+ offset = offset_in_page(args->offset); |
967 |
+ for (idx = args->offset >> PAGE_SHIFT; remain; idx++) { |
968 |
+ struct page *page = i915_gem_object_get_page(obj, idx); |
969 |
+- int length; |
970 |
+- |
971 |
+- length = remain; |
972 |
+- if (offset + length > PAGE_SIZE) |
973 |
+- length = PAGE_SIZE - offset; |
974 |
++ unsigned int length = min_t(u64, remain, PAGE_SIZE - offset); |
975 |
+ |
976 |
+ ret = shmem_pwrite(page, offset, length, user_data, |
977 |
+ page_to_phys(page) & obj_do_bit17_swizzling, |
978 |
+diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h |
979 |
+index b4e3aa7c0ce1..0dbbe840f5f0 100644 |
980 |
+--- a/drivers/gpu/drm/i915/i915_gem_gtt.h |
981 |
++++ b/drivers/gpu/drm/i915/i915_gem_gtt.h |
982 |
+@@ -584,20 +584,20 @@ int i915_gem_gtt_insert(struct i915_address_space *vm, |
983 |
+ u64 start, u64 end, unsigned int flags); |
984 |
+ |
985 |
+ /* Flags used by pin/bind&friends. */ |
986 |
+-#define PIN_NONBLOCK BIT(0) |
987 |
+-#define PIN_MAPPABLE BIT(1) |
988 |
+-#define PIN_ZONE_4G BIT(2) |
989 |
+-#define PIN_NONFAULT BIT(3) |
990 |
+-#define PIN_NOEVICT BIT(4) |
991 |
+- |
992 |
+-#define PIN_MBZ BIT(5) /* I915_VMA_PIN_OVERFLOW */ |
993 |
+-#define PIN_GLOBAL BIT(6) /* I915_VMA_GLOBAL_BIND */ |
994 |
+-#define PIN_USER BIT(7) /* I915_VMA_LOCAL_BIND */ |
995 |
+-#define PIN_UPDATE BIT(8) |
996 |
+- |
997 |
+-#define PIN_HIGH BIT(9) |
998 |
+-#define PIN_OFFSET_BIAS BIT(10) |
999 |
+-#define PIN_OFFSET_FIXED BIT(11) |
1000 |
++#define PIN_NONBLOCK BIT_ULL(0) |
1001 |
++#define PIN_MAPPABLE BIT_ULL(1) |
1002 |
++#define PIN_ZONE_4G BIT_ULL(2) |
1003 |
++#define PIN_NONFAULT BIT_ULL(3) |
1004 |
++#define PIN_NOEVICT BIT_ULL(4) |
1005 |
++ |
1006 |
++#define PIN_MBZ BIT_ULL(5) /* I915_VMA_PIN_OVERFLOW */ |
1007 |
++#define PIN_GLOBAL BIT_ULL(6) /* I915_VMA_GLOBAL_BIND */ |
1008 |
++#define PIN_USER BIT_ULL(7) /* I915_VMA_LOCAL_BIND */ |
1009 |
++#define PIN_UPDATE BIT_ULL(8) |
1010 |
++ |
1011 |
++#define PIN_HIGH BIT_ULL(9) |
1012 |
++#define PIN_OFFSET_BIAS BIT_ULL(10) |
1013 |
++#define PIN_OFFSET_FIXED BIT_ULL(11) |
1014 |
+ #define PIN_OFFSET_MASK (-I915_GTT_PAGE_SIZE) |
1015 |
+ |
1016 |
+ #endif |
1017 |
+diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c |
1018 |
+index 9240fa79de7c..bc9f735395bc 100644 |
1019 |
+--- a/drivers/gpu/drm/i915/intel_audio.c |
1020 |
++++ b/drivers/gpu/drm/i915/intel_audio.c |
1021 |
+@@ -134,6 +134,9 @@ static const struct { |
1022 |
+ /* HDMI N/CTS table */ |
1023 |
+ #define TMDS_297M 297000 |
1024 |
+ #define TMDS_296M 296703 |
1025 |
++#define TMDS_594M 594000 |
1026 |
++#define TMDS_593M 593407 |
1027 |
++ |
1028 |
+ static const struct { |
1029 |
+ int sample_rate; |
1030 |
+ int clock; |
1031 |
+@@ -154,6 +157,20 @@ static const struct { |
1032 |
+ { 176400, TMDS_297M, 18816, 247500 }, |
1033 |
+ { 192000, TMDS_296M, 23296, 281250 }, |
1034 |
+ { 192000, TMDS_297M, 20480, 247500 }, |
1035 |
++ { 44100, TMDS_593M, 8918, 937500 }, |
1036 |
++ { 44100, TMDS_594M, 9408, 990000 }, |
1037 |
++ { 48000, TMDS_593M, 5824, 562500 }, |
1038 |
++ { 48000, TMDS_594M, 6144, 594000 }, |
1039 |
++ { 32000, TMDS_593M, 5824, 843750 }, |
1040 |
++ { 32000, TMDS_594M, 3072, 445500 }, |
1041 |
++ { 88200, TMDS_593M, 17836, 937500 }, |
1042 |
++ { 88200, TMDS_594M, 18816, 990000 }, |
1043 |
++ { 96000, TMDS_593M, 11648, 562500 }, |
1044 |
++ { 96000, TMDS_594M, 12288, 594000 }, |
1045 |
++ { 176400, TMDS_593M, 35672, 937500 }, |
1046 |
++ { 176400, TMDS_594M, 37632, 990000 }, |
1047 |
++ { 192000, TMDS_593M, 23296, 562500 }, |
1048 |
++ { 192000, TMDS_594M, 24576, 594000 }, |
1049 |
+ }; |
1050 |
+ |
1051 |
+ /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ |
1052 |
+diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1053 |
+index 2006ab44fbf9..944cb3c2ba5c 100644 |
1054 |
+--- a/drivers/gpu/drm/i915/intel_display.c |
1055 |
++++ b/drivers/gpu/drm/i915/intel_display.c |
1056 |
+@@ -14829,13 +14829,9 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, |
1057 |
+ I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK); |
1058 |
+ } |
1059 |
+ |
1060 |
+- /* restore vblank interrupts to correct state */ |
1061 |
+- drm_crtc_vblank_reset(&crtc->base); |
1062 |
+ if (crtc->active) { |
1063 |
+ struct intel_plane *plane; |
1064 |
+ |
1065 |
+- drm_crtc_vblank_on(&crtc->base); |
1066 |
+- |
1067 |
+ /* Disable everything but the primary plane */ |
1068 |
+ for_each_intel_plane_on_crtc(dev, crtc, plane) { |
1069 |
+ const struct intel_plane_state *plane_state = |
1070 |
+@@ -15148,7 +15144,6 @@ intel_modeset_setup_hw_state(struct drm_device *dev, |
1071 |
+ struct drm_modeset_acquire_ctx *ctx) |
1072 |
+ { |
1073 |
+ struct drm_i915_private *dev_priv = to_i915(dev); |
1074 |
+- enum pipe pipe; |
1075 |
+ struct intel_crtc *crtc; |
1076 |
+ struct intel_encoder *encoder; |
1077 |
+ int i; |
1078 |
+@@ -15167,15 +15162,23 @@ intel_modeset_setup_hw_state(struct drm_device *dev, |
1079 |
+ /* HW state is read out, now we need to sanitize this mess. */ |
1080 |
+ get_encoder_power_domains(dev_priv); |
1081 |
+ |
1082 |
+- intel_sanitize_plane_mapping(dev_priv); |
1083 |
++ /* |
1084 |
++ * intel_sanitize_plane_mapping() may need to do vblank |
1085 |
++ * waits, so we need vblank interrupts restored beforehand. |
1086 |
++ */ |
1087 |
++ for_each_intel_crtc(&dev_priv->drm, crtc) { |
1088 |
++ drm_crtc_vblank_reset(&crtc->base); |
1089 |
+ |
1090 |
+- for_each_intel_encoder(dev, encoder) { |
1091 |
+- intel_sanitize_encoder(encoder); |
1092 |
++ if (crtc->active) |
1093 |
++ drm_crtc_vblank_on(&crtc->base); |
1094 |
+ } |
1095 |
+ |
1096 |
+- for_each_pipe(dev_priv, pipe) { |
1097 |
+- crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
1098 |
++ intel_sanitize_plane_mapping(dev_priv); |
1099 |
+ |
1100 |
++ for_each_intel_encoder(dev, encoder) |
1101 |
++ intel_sanitize_encoder(encoder); |
1102 |
++ |
1103 |
++ for_each_intel_crtc(&dev_priv->drm, crtc) { |
1104 |
+ intel_sanitize_crtc(crtc, ctx); |
1105 |
+ intel_dump_pipe_config(crtc, crtc->config, |
1106 |
+ "[setup_hw_state]"); |
1107 |
+diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c |
1108 |
+index 93fc8ab9bb31..b83a8f2b2a3a 100644 |
1109 |
+--- a/drivers/gpu/drm/i915/intel_dp_mst.c |
1110 |
++++ b/drivers/gpu/drm/i915/intel_dp_mst.c |
1111 |
+@@ -37,11 +37,11 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
1112 |
+ struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base); |
1113 |
+ struct intel_digital_port *intel_dig_port = intel_mst->primary; |
1114 |
+ struct intel_dp *intel_dp = &intel_dig_port->dp; |
1115 |
+- struct intel_connector *connector = |
1116 |
+- to_intel_connector(conn_state->connector); |
1117 |
++ struct drm_connector *connector = conn_state->connector; |
1118 |
++ void *port = to_intel_connector(connector)->port; |
1119 |
+ struct drm_atomic_state *state = pipe_config->base.state; |
1120 |
+ int bpp; |
1121 |
+- int lane_count, slots; |
1122 |
++ int lane_count, slots = 0; |
1123 |
+ const struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; |
1124 |
+ int mst_pbn; |
1125 |
+ bool reduce_m_n = drm_dp_has_quirk(&intel_dp->desc, |
1126 |
+@@ -66,17 +66,23 @@ static bool intel_dp_mst_compute_config(struct intel_encoder *encoder, |
1127 |
+ |
1128 |
+ pipe_config->port_clock = intel_dp_max_link_rate(intel_dp); |
1129 |
+ |
1130 |
+- if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, connector->port)) |
1131 |
++ if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, port)) |
1132 |
+ pipe_config->has_audio = true; |
1133 |
+ |
1134 |
+ mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp); |
1135 |
+ pipe_config->pbn = mst_pbn; |
1136 |
+ |
1137 |
+- slots = drm_dp_atomic_find_vcpi_slots(state, &intel_dp->mst_mgr, |
1138 |
+- connector->port, mst_pbn); |
1139 |
+- if (slots < 0) { |
1140 |
+- DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", slots); |
1141 |
+- return false; |
1142 |
++ /* Zombie connectors can't have VCPI slots */ |
1143 |
++ if (READ_ONCE(connector->registered)) { |
1144 |
++ slots = drm_dp_atomic_find_vcpi_slots(state, |
1145 |
++ &intel_dp->mst_mgr, |
1146 |
++ port, |
1147 |
++ mst_pbn); |
1148 |
++ if (slots < 0) { |
1149 |
++ DRM_DEBUG_KMS("failed finding vcpi slots:%d\n", |
1150 |
++ slots); |
1151 |
++ return false; |
1152 |
++ } |
1153 |
+ } |
1154 |
+ |
1155 |
+ intel_link_compute_m_n(bpp, lane_count, |
1156 |
+@@ -311,9 +317,8 @@ static int intel_dp_mst_get_ddc_modes(struct drm_connector *connector) |
1157 |
+ struct edid *edid; |
1158 |
+ int ret; |
1159 |
+ |
1160 |
+- if (!intel_dp) { |
1161 |
++ if (!READ_ONCE(connector->registered)) |
1162 |
+ return intel_connector_update_modes(connector, NULL); |
1163 |
+- } |
1164 |
+ |
1165 |
+ edid = drm_dp_mst_get_edid(connector, &intel_dp->mst_mgr, intel_connector->port); |
1166 |
+ ret = intel_connector_update_modes(connector, edid); |
1167 |
+@@ -328,9 +333,10 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) |
1168 |
+ struct intel_connector *intel_connector = to_intel_connector(connector); |
1169 |
+ struct intel_dp *intel_dp = intel_connector->mst_port; |
1170 |
+ |
1171 |
+- if (!intel_dp) |
1172 |
++ if (!READ_ONCE(connector->registered)) |
1173 |
+ return connector_status_disconnected; |
1174 |
+- return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, intel_connector->port); |
1175 |
++ return drm_dp_mst_detect_port(connector, &intel_dp->mst_mgr, |
1176 |
++ intel_connector->port); |
1177 |
+ } |
1178 |
+ |
1179 |
+ static void |
1180 |
+@@ -370,7 +376,7 @@ intel_dp_mst_mode_valid(struct drm_connector *connector, |
1181 |
+ int bpp = 24; /* MST uses fixed bpp */ |
1182 |
+ int max_rate, mode_rate, max_lanes, max_link_clock; |
1183 |
+ |
1184 |
+- if (!intel_dp) |
1185 |
++ if (!READ_ONCE(connector->registered)) |
1186 |
+ return MODE_ERROR; |
1187 |
+ |
1188 |
+ max_link_clock = intel_dp_max_link_rate(intel_dp); |
1189 |
+@@ -399,7 +405,7 @@ static struct drm_encoder *intel_mst_atomic_best_encoder(struct drm_connector *c |
1190 |
+ struct intel_dp *intel_dp = intel_connector->mst_port; |
1191 |
+ struct intel_crtc *crtc = to_intel_crtc(state->crtc); |
1192 |
+ |
1193 |
+- if (!intel_dp) |
1194 |
++ if (!READ_ONCE(connector->registered)) |
1195 |
+ return NULL; |
1196 |
+ return &intel_dp->mst_encoders[crtc->pipe]->base.base; |
1197 |
+ } |
1198 |
+@@ -491,7 +497,6 @@ static void intel_dp_register_mst_connector(struct drm_connector *connector) |
1199 |
+ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
1200 |
+ struct drm_connector *connector) |
1201 |
+ { |
1202 |
+- struct intel_connector *intel_connector = to_intel_connector(connector); |
1203 |
+ struct drm_i915_private *dev_priv = to_i915(connector->dev); |
1204 |
+ |
1205 |
+ drm_connector_unregister(connector); |
1206 |
+@@ -499,10 +504,6 @@ static void intel_dp_destroy_mst_connector(struct drm_dp_mst_topology_mgr *mgr, |
1207 |
+ if (dev_priv->fbdev) |
1208 |
+ drm_fb_helper_remove_one_connector(&dev_priv->fbdev->helper, |
1209 |
+ connector); |
1210 |
+- /* prevent race with the check in ->detect */ |
1211 |
+- drm_modeset_lock(&connector->dev->mode_config.connection_mutex, NULL); |
1212 |
+- intel_connector->mst_port = NULL; |
1213 |
+- drm_modeset_unlock(&connector->dev->mode_config.connection_mutex); |
1214 |
+ |
1215 |
+ drm_connector_unreference(connector); |
1216 |
+ DRM_DEBUG_KMS("\n"); |
1217 |
+diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c |
1218 |
+index 8a541d0e3e80..30280323e1d8 100644 |
1219 |
+--- a/drivers/gpu/drm/i915/intel_lpe_audio.c |
1220 |
++++ b/drivers/gpu/drm/i915/intel_lpe_audio.c |
1221 |
+@@ -303,8 +303,10 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) |
1222 |
+ lpe_audio_platdev_destroy(dev_priv); |
1223 |
+ |
1224 |
+ irq_free_desc(dev_priv->lpe_audio.irq); |
1225 |
+-} |
1226 |
+ |
1227 |
++ dev_priv->lpe_audio.irq = -1; |
1228 |
++ dev_priv->lpe_audio.platdev = NULL; |
1229 |
++} |
1230 |
+ |
1231 |
+ /** |
1232 |
+ * intel_lpe_audio_notify() - notify lpe audio event |
1233 |
+diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c |
1234 |
+index d638b641b760..0775e71ea95b 100644 |
1235 |
+--- a/drivers/gpu/drm/i915/intel_lrc.c |
1236 |
++++ b/drivers/gpu/drm/i915/intel_lrc.c |
1237 |
+@@ -325,7 +325,8 @@ static u64 execlists_update_context(struct drm_i915_gem_request *rq) |
1238 |
+ |
1239 |
+ reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); |
1240 |
+ |
1241 |
+- /* True 32b PPGTT with dynamic page allocation: update PDP |
1242 |
++ /* |
1243 |
++ * True 32b PPGTT with dynamic page allocation: update PDP |
1244 |
+ * registers and point the unallocated PDPs to scratch page. |
1245 |
+ * PML4 is allocated during ppgtt init, so this is not needed |
1246 |
+ * in 48-bit mode. |
1247 |
+@@ -333,6 +334,17 @@ static u64 execlists_update_context(struct drm_i915_gem_request *rq) |
1248 |
+ if (ppgtt && !i915_vm_is_48bit(&ppgtt->base)) |
1249 |
+ execlists_update_context_pdps(ppgtt, reg_state); |
1250 |
+ |
1251 |
++ /* |
1252 |
++ * Make sure the context image is complete before we submit it to HW. |
1253 |
++ * |
1254 |
++ * Ostensibly, writes (including the WCB) should be flushed prior to |
1255 |
++ * an uncached write such as our mmio register access, the empirical |
1256 |
++ * evidence (esp. on Braswell) suggests that the WC write into memory |
1257 |
++ * may not be visible to the HW prior to the completion of the UC |
1258 |
++ * register write and that we may begin execution from the context |
1259 |
++ * before its image is complete leading to invalid PD chasing. |
1260 |
++ */ |
1261 |
++ wmb(); |
1262 |
+ return ce->lrc_desc; |
1263 |
+ } |
1264 |
+ |
1265 |
+diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c |
1266 |
+index 408b955e5c39..6dd72bc32897 100644 |
1267 |
+--- a/drivers/gpu/drm/nouveau/nouveau_backlight.c |
1268 |
++++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c |
1269 |
+@@ -116,7 +116,7 @@ nv40_backlight_init(struct drm_connector *connector) |
1270 |
+ &nv40_bl_ops, &props); |
1271 |
+ |
1272 |
+ if (IS_ERR(bd)) { |
1273 |
+- if (bl_connector.id > 0) |
1274 |
++ if (bl_connector.id >= 0) |
1275 |
+ ida_simple_remove(&bl_ida, bl_connector.id); |
1276 |
+ return PTR_ERR(bd); |
1277 |
+ } |
1278 |
+@@ -249,7 +249,7 @@ nv50_backlight_init(struct drm_connector *connector) |
1279 |
+ nv_encoder, ops, &props); |
1280 |
+ |
1281 |
+ if (IS_ERR(bd)) { |
1282 |
+- if (bl_connector.id > 0) |
1283 |
++ if (bl_connector.id >= 0) |
1284 |
+ ida_simple_remove(&bl_ida, bl_connector.id); |
1285 |
+ return PTR_ERR(bd); |
1286 |
+ } |
1287 |
+diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1288 |
+index df05fe53c399..32901c6fe3df 100644 |
1289 |
+--- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1290 |
++++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c |
1291 |
+@@ -273,6 +273,17 @@ static int dmm_txn_commit(struct dmm_txn *txn, bool wait) |
1292 |
+ } |
1293 |
+ |
1294 |
+ txn->last_pat->next_pa = 0; |
1295 |
++ /* ensure that the written descriptors are visible to DMM */ |
1296 |
++ wmb(); |
1297 |
++ |
1298 |
++ /* |
1299 |
++ * NOTE: the wmb() above should be enough, but there seems to be a bug |
1300 |
++ * in OMAP's memory barrier implementation, which in some rare cases may |
1301 |
++ * cause the writes not to be observable after wmb(). |
1302 |
++ */ |
1303 |
++ |
1304 |
++ /* read back to ensure the data is in RAM */ |
1305 |
++ readl(&txn->last_pat->next_pa); |
1306 |
+ |
1307 |
+ /* write to PAT_DESCR to clear out any pending transaction */ |
1308 |
+ dmm_write(dmm, 0x0, reg[PAT_DESCR][engine->id]); |
1309 |
+diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
1310 |
+index ff3d0f5efbb1..4cacb03f6733 100644 |
1311 |
+--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
1312 |
++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c |
1313 |
+@@ -425,6 +425,11 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev) |
1314 |
+ return 0; |
1315 |
+ } |
1316 |
+ |
1317 |
++static void rockchip_drm_platform_shutdown(struct platform_device *pdev) |
1318 |
++{ |
1319 |
++ rockchip_drm_platform_remove(pdev); |
1320 |
++} |
1321 |
++ |
1322 |
+ static const struct of_device_id rockchip_drm_dt_ids[] = { |
1323 |
+ { .compatible = "rockchip,display-subsystem", }, |
1324 |
+ { /* sentinel */ }, |
1325 |
+@@ -434,6 +439,7 @@ MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); |
1326 |
+ static struct platform_driver rockchip_drm_platform_driver = { |
1327 |
+ .probe = rockchip_drm_platform_probe, |
1328 |
+ .remove = rockchip_drm_platform_remove, |
1329 |
++ .shutdown = rockchip_drm_platform_shutdown, |
1330 |
+ .driver = { |
1331 |
+ .name = "rockchip-drm", |
1332 |
+ .of_match_table = rockchip_drm_dt_ids, |
1333 |
+diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c |
1334 |
+index e88549f0e704..39ff73a6a807 100644 |
1335 |
+--- a/drivers/media/i2c/ov7670.c |
1336 |
++++ b/drivers/media/i2c/ov7670.c |
1337 |
+@@ -1612,23 +1612,29 @@ static int ov7670_probe(struct i2c_client *client, |
1338 |
+ info->pclk_hb_disable = true; |
1339 |
+ } |
1340 |
+ |
1341 |
+- info->clk = devm_clk_get(&client->dev, "xclk"); |
1342 |
+- if (IS_ERR(info->clk)) |
1343 |
+- return PTR_ERR(info->clk); |
1344 |
+- ret = clk_prepare_enable(info->clk); |
1345 |
+- if (ret) |
1346 |
+- return ret; |
1347 |
++ info->clk = devm_clk_get(&client->dev, "xclk"); /* optional */ |
1348 |
++ if (IS_ERR(info->clk)) { |
1349 |
++ ret = PTR_ERR(info->clk); |
1350 |
++ if (ret == -ENOENT) |
1351 |
++ info->clk = NULL; |
1352 |
++ else |
1353 |
++ return ret; |
1354 |
++ } |
1355 |
++ if (info->clk) { |
1356 |
++ ret = clk_prepare_enable(info->clk); |
1357 |
++ if (ret) |
1358 |
++ return ret; |
1359 |
++ info->clock_speed = clk_get_rate(info->clk) / 1000000; |
1360 |
++ if (info->clock_speed < 10 || info->clock_speed > 48) { |
1361 |
++ ret = -EINVAL; |
1362 |
++ goto clk_disable; |
1363 |
++ } |
1364 |
++ } |
1365 |
+ |
1366 |
+ ret = ov7670_init_gpio(client, info); |
1367 |
+ if (ret) |
1368 |
+ goto clk_disable; |
1369 |
+ |
1370 |
+- info->clock_speed = clk_get_rate(info->clk) / 1000000; |
1371 |
+- if (info->clock_speed < 10 || info->clock_speed > 48) { |
1372 |
+- ret = -EINVAL; |
1373 |
+- goto clk_disable; |
1374 |
+- } |
1375 |
+- |
1376 |
+ /* Make sure it's an ov7670 */ |
1377 |
+ ret = ov7670_detect(sd); |
1378 |
+ if (ret) { |
1379 |
+diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c |
1380 |
+index 4d3e97f97c76..b41f7fafb731 100644 |
1381 |
+--- a/drivers/media/i2c/tvp5150.c |
1382 |
++++ b/drivers/media/i2c/tvp5150.c |
1383 |
+@@ -900,9 +900,6 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, |
1384 |
+ |
1385 |
+ /* tvp5150 has some special limits */ |
1386 |
+ rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); |
1387 |
+- rect.width = clamp_t(unsigned int, rect.width, |
1388 |
+- TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, |
1389 |
+- TVP5150_H_MAX - rect.left); |
1390 |
+ rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); |
1391 |
+ |
1392 |
+ /* Calculate height based on current standard */ |
1393 |
+@@ -916,9 +913,16 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, |
1394 |
+ else |
1395 |
+ hmax = TVP5150_V_MAX_OTHERS; |
1396 |
+ |
1397 |
+- rect.height = clamp_t(unsigned int, rect.height, |
1398 |
++ /* |
1399 |
++ * alignments: |
1400 |
++ * - width = 2 due to UYVY colorspace |
1401 |
++ * - height, image = no special alignment |
1402 |
++ */ |
1403 |
++ v4l_bound_align_image(&rect.width, |
1404 |
++ TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, |
1405 |
++ TVP5150_H_MAX - rect.left, 1, &rect.height, |
1406 |
+ hmax - TVP5150_MAX_CROP_TOP - rect.top, |
1407 |
+- hmax - rect.top); |
1408 |
++ hmax - rect.top, 0, 0); |
1409 |
+ |
1410 |
+ tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); |
1411 |
+ tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, |
1412 |
+diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c |
1413 |
+index 5c94e312cba3..f77254cc16bf 100644 |
1414 |
+--- a/drivers/media/pci/cx23885/altera-ci.c |
1415 |
++++ b/drivers/media/pci/cx23885/altera-ci.c |
1416 |
+@@ -665,6 +665,10 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) |
1417 |
+ } |
1418 |
+ |
1419 |
+ temp_int = append_internal(inter); |
1420 |
++ if (!temp_int) { |
1421 |
++ ret = -ENOMEM; |
1422 |
++ goto err; |
1423 |
++ } |
1424 |
+ inter->filts_used = 1; |
1425 |
+ inter->dev = config->dev; |
1426 |
+ inter->fpga_rw = config->fpga_rw; |
1427 |
+@@ -699,6 +703,7 @@ err: |
1428 |
+ __func__, ret); |
1429 |
+ |
1430 |
+ kfree(pid_filt); |
1431 |
++ kfree(inter); |
1432 |
+ |
1433 |
+ return ret; |
1434 |
+ } |
1435 |
+@@ -733,6 +738,10 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) |
1436 |
+ } |
1437 |
+ |
1438 |
+ temp_int = append_internal(inter); |
1439 |
++ if (!temp_int) { |
1440 |
++ ret = -ENOMEM; |
1441 |
++ goto err; |
1442 |
++ } |
1443 |
+ inter->cis_used = 1; |
1444 |
+ inter->dev = config->dev; |
1445 |
+ inter->fpga_rw = config->fpga_rw; |
1446 |
+@@ -801,6 +810,7 @@ err: |
1447 |
+ ci_dbg_print("%s: Cannot initialize CI: Error %d.\n", __func__, ret); |
1448 |
+ |
1449 |
+ kfree(state); |
1450 |
++ kfree(inter); |
1451 |
+ |
1452 |
+ return ret; |
1453 |
+ } |
1454 |
+diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c |
1455 |
+index 15eb5dc4dff9..99d138d3f87f 100644 |
1456 |
+--- a/drivers/media/platform/coda/coda-common.c |
1457 |
++++ b/drivers/media/platform/coda/coda-common.c |
1458 |
+@@ -1686,7 +1686,8 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl) |
1459 |
+ break; |
1460 |
+ case V4L2_CID_MPEG_VIDEO_H264_PROFILE: |
1461 |
+ /* TODO: switch between baseline and constrained baseline */ |
1462 |
+- ctx->params.h264_profile_idc = 66; |
1463 |
++ if (ctx->inst_type == CODA_INST_ENCODER) |
1464 |
++ ctx->params.h264_profile_idc = 66; |
1465 |
+ break; |
1466 |
+ case V4L2_CID_MPEG_VIDEO_H264_LEVEL: |
1467 |
+ /* nothing to do, this is set by the encoder */ |
1468 |
+diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig |
1469 |
+index 6def5445e03e..64731e3221ef 100644 |
1470 |
+--- a/drivers/mtd/devices/Kconfig |
1471 |
++++ b/drivers/mtd/devices/Kconfig |
1472 |
+@@ -206,7 +206,7 @@ comment "Disk-On-Chip Device Drivers" |
1473 |
+ config MTD_DOCG3 |
1474 |
+ tristate "M-Systems Disk-On-Chip G3" |
1475 |
+ select BCH |
1476 |
+- select BCH_CONST_PARAMS |
1477 |
++ select BCH_CONST_PARAMS if !MTD_NAND_BCH |
1478 |
+ select BITREVERSE |
1479 |
+ ---help--- |
1480 |
+ This provides an MTD device driver for the M-Systems DiskOnChip |
1481 |
+diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c |
1482 |
+index 02aff5cc48bf..3388d2788fe0 100644 |
1483 |
+--- a/drivers/nvme/target/loop.c |
1484 |
++++ b/drivers/nvme/target/loop.c |
1485 |
+@@ -183,15 +183,12 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, |
1486 |
+ if (ret) |
1487 |
+ return ret; |
1488 |
+ |
1489 |
++ blk_mq_start_request(req); |
1490 |
+ iod->cmd.common.flags |= NVME_CMD_SGL_METABUF; |
1491 |
+ iod->req.port = nvmet_loop_port; |
1492 |
+ if (!nvmet_req_init(&iod->req, &queue->nvme_cq, |
1493 |
+- &queue->nvme_sq, &nvme_loop_ops)) { |
1494 |
+- nvme_cleanup_cmd(req); |
1495 |
+- blk_mq_start_request(req); |
1496 |
+- nvme_loop_queue_response(&iod->req); |
1497 |
++ &queue->nvme_sq, &nvme_loop_ops)) |
1498 |
+ return BLK_STS_OK; |
1499 |
+- } |
1500 |
+ |
1501 |
+ if (blk_rq_bytes(req)) { |
1502 |
+ iod->sg_table.sgl = iod->first_sgl; |
1503 |
+@@ -204,8 +201,6 @@ static blk_status_t nvme_loop_queue_rq(struct blk_mq_hw_ctx *hctx, |
1504 |
+ iod->req.sg_cnt = blk_rq_map_sg(req->q, req, iod->sg_table.sgl); |
1505 |
+ } |
1506 |
+ |
1507 |
+- blk_mq_start_request(req); |
1508 |
+- |
1509 |
+ schedule_work(&iod->work); |
1510 |
+ return BLK_STS_OK; |
1511 |
+ } |
1512 |
+diff --git a/drivers/of/of_numa.c b/drivers/of/of_numa.c |
1513 |
+index 2db1f7a04baf..0b29ee9ee8c3 100644 |
1514 |
+--- a/drivers/of/of_numa.c |
1515 |
++++ b/drivers/of/of_numa.c |
1516 |
+@@ -126,9 +126,14 @@ static int __init of_numa_parse_distance_map_v1(struct device_node *map) |
1517 |
+ distance = of_read_number(matrix, 1); |
1518 |
+ matrix++; |
1519 |
+ |
1520 |
++ if ((nodea == nodeb && distance != LOCAL_DISTANCE) || |
1521 |
++ (nodea != nodeb && distance <= LOCAL_DISTANCE)) { |
1522 |
++ pr_err("Invalid distance[node%d -> node%d] = %d\n", |
1523 |
++ nodea, nodeb, distance); |
1524 |
++ return -EINVAL; |
1525 |
++ } |
1526 |
++ |
1527 |
+ numa_set_distance(nodea, nodeb, distance); |
1528 |
+- pr_debug("distance[node%d -> node%d] = %d\n", |
1529 |
+- nodea, nodeb, distance); |
1530 |
+ |
1531 |
+ /* Set default distance of node B->A same as A->B */ |
1532 |
+ if (nodeb > nodea) |
1533 |
+diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c |
1534 |
+index e79f2a181ad2..b9ec4a16db1f 100644 |
1535 |
+--- a/drivers/rtc/hctosys.c |
1536 |
++++ b/drivers/rtc/hctosys.c |
1537 |
+@@ -50,8 +50,10 @@ static int __init rtc_hctosys(void) |
1538 |
+ tv64.tv_sec = rtc_tm_to_time64(&tm); |
1539 |
+ |
1540 |
+ #if BITS_PER_LONG == 32 |
1541 |
+- if (tv64.tv_sec > INT_MAX) |
1542 |
++ if (tv64.tv_sec > INT_MAX) { |
1543 |
++ err = -ERANGE; |
1544 |
+ goto err_read; |
1545 |
++ } |
1546 |
+ #endif |
1547 |
+ |
1548 |
+ err = do_settimeofday64(&tv64); |
1549 |
+diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
1550 |
+index 0e19f6bc24ff..aef1e1a55535 100644 |
1551 |
+--- a/drivers/scsi/qla2xxx/qla_init.c |
1552 |
++++ b/drivers/scsi/qla2xxx/qla_init.c |
1553 |
+@@ -1511,25 +1511,15 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea) |
1554 |
+ cid.b.rsvd_1 = 0; |
1555 |
+ |
1556 |
+ ql_dbg(ql_dbg_disc, vha, 0x20ec, |
1557 |
+- "%s %d %8phC LoopID 0x%x in use post gnl\n", |
1558 |
++ "%s %d %8phC lid %#x in use with pid %06x post gnl\n", |
1559 |
+ __func__, __LINE__, ea->fcport->port_name, |
1560 |
+- ea->fcport->loop_id); |
1561 |
++ ea->fcport->loop_id, cid.b24); |
1562 |
+ |
1563 |
+- if (IS_SW_RESV_ADDR(cid)) { |
1564 |
+- set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); |
1565 |
+- ea->fcport->loop_id = FC_NO_LOOP_ID; |
1566 |
+- } else { |
1567 |
+- qla2x00_clear_loop_id(ea->fcport); |
1568 |
+- } |
1569 |
++ set_bit(ea->fcport->loop_id, vha->hw->loop_id_map); |
1570 |
++ ea->fcport->loop_id = FC_NO_LOOP_ID; |
1571 |
+ qla24xx_post_gnl_work(vha, ea->fcport); |
1572 |
+ break; |
1573 |
+ case MBS_PORT_ID_USED: |
1574 |
+- ql_dbg(ql_dbg_disc, vha, 0x20ed, |
1575 |
+- "%s %d %8phC NPortId %02x%02x%02x inuse post gidpn\n", |
1576 |
+- __func__, __LINE__, ea->fcport->port_name, |
1577 |
+- ea->fcport->d_id.b.domain, ea->fcport->d_id.b.area, |
1578 |
+- ea->fcport->d_id.b.al_pa); |
1579 |
+- |
1580 |
+ lid = ea->iop[1] & 0xffff; |
1581 |
+ qlt_find_sess_invalidate_other(vha, |
1582 |
+ wwn_to_u64(ea->fcport->port_name), |
1583 |
+@@ -4246,6 +4236,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags) |
1584 |
+ fcport->loop_id = FC_NO_LOOP_ID; |
1585 |
+ qla2x00_set_fcport_state(fcport, FCS_UNCONFIGURED); |
1586 |
+ fcport->supported_classes = FC_COS_UNSPECIFIED; |
1587 |
++ fcport->fp_speed = PORT_SPEED_UNKNOWN; |
1588 |
+ |
1589 |
+ fcport->ct_desc.ct_sns = dma_alloc_coherent(&vha->hw->pdev->dev, |
1590 |
+ sizeof(struct ct_sns_pkt), &fcport->ct_desc.ct_sns_dma, |
1591 |
+@@ -6077,7 +6068,7 @@ qla2x00_abort_isp(scsi_qla_host_t *vha) |
1592 |
+ * The next call disables the board |
1593 |
+ * completely. |
1594 |
+ */ |
1595 |
+- ha->isp_ops->reset_adapter(vha); |
1596 |
++ qla2x00_abort_isp_cleanup(vha); |
1597 |
+ vha->flags.online = 0; |
1598 |
+ clear_bit(ISP_ABORT_RETRY, |
1599 |
+ &vha->dpc_flags); |
1600 |
+@@ -7591,7 +7582,6 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) |
1601 |
+ } |
1602 |
+ icb->firmware_options_2 &= cpu_to_le32( |
1603 |
+ ~(BIT_3 | BIT_2 | BIT_1 | BIT_0)); |
1604 |
+- vha->flags.process_response_queue = 0; |
1605 |
+ if (ha->zio_mode != QLA_ZIO_DISABLED) { |
1606 |
+ ha->zio_mode = QLA_ZIO_MODE_6; |
1607 |
+ |
1608 |
+@@ -7603,7 +7593,6 @@ qla81xx_nvram_config(scsi_qla_host_t *vha) |
1609 |
+ icb->firmware_options_2 |= cpu_to_le32( |
1610 |
+ (uint32_t)ha->zio_mode); |
1611 |
+ icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer); |
1612 |
+- vha->flags.process_response_queue = 1; |
1613 |
+ } |
1614 |
+ |
1615 |
+ /* enable RIDA Format2 */ |
1616 |
+diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c |
1617 |
+index 8d579bf0fc81..85cb4e30f742 100644 |
1618 |
+--- a/drivers/scsi/qla2xxx/qla_iocb.c |
1619 |
++++ b/drivers/scsi/qla2xxx/qla_iocb.c |
1620 |
+@@ -1524,12 +1524,6 @@ qla24xx_start_scsi(srb_t *sp) |
1621 |
+ |
1622 |
+ /* Set chip new ring index. */ |
1623 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
1624 |
+- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); |
1625 |
+- |
1626 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
1627 |
+- if (vha->flags.process_response_queue && |
1628 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
1629 |
+- qla24xx_process_response_queue(vha, rsp); |
1630 |
+ |
1631 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1632 |
+ return QLA_SUCCESS; |
1633 |
+@@ -1723,12 +1717,6 @@ qla24xx_dif_start_scsi(srb_t *sp) |
1634 |
+ |
1635 |
+ /* Set chip new ring index. */ |
1636 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
1637 |
+- RD_REG_DWORD_RELAXED(&ha->iobase->isp24.hccr); |
1638 |
+- |
1639 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
1640 |
+- if (vha->flags.process_response_queue && |
1641 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
1642 |
+- qla24xx_process_response_queue(vha, rsp); |
1643 |
+ |
1644 |
+ spin_unlock_irqrestore(&ha->hardware_lock, flags); |
1645 |
+ |
1646 |
+@@ -1878,11 +1866,6 @@ qla2xxx_start_scsi_mq(srb_t *sp) |
1647 |
+ /* Set chip new ring index. */ |
1648 |
+ WRT_REG_DWORD(req->req_q_in, req->ring_index); |
1649 |
+ |
1650 |
+- /* Manage unprocessed RIO/ZIO commands in response queue. */ |
1651 |
+- if (vha->flags.process_response_queue && |
1652 |
+- rsp->ring_ptr->signature != RESPONSE_PROCESSED) |
1653 |
+- qla24xx_process_response_queue(vha, rsp); |
1654 |
+- |
1655 |
+ spin_unlock_irqrestore(&qpair->qp_lock, flags); |
1656 |
+ return QLA_SUCCESS; |
1657 |
+ |
1658 |
+diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c |
1659 |
+index 2d909e12e23a..929ec087b8eb 100644 |
1660 |
+--- a/drivers/scsi/qla2xxx/qla_mbx.c |
1661 |
++++ b/drivers/scsi/qla2xxx/qla_mbx.c |
1662 |
+@@ -3682,10 +3682,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t loop_id, |
1663 |
+ mcp->mb[0] = MBC_PORT_PARAMS; |
1664 |
+ mcp->mb[1] = loop_id; |
1665 |
+ mcp->mb[2] = BIT_0; |
1666 |
+- if (IS_CNA_CAPABLE(vha->hw)) |
1667 |
+- mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); |
1668 |
+- else |
1669 |
+- mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0); |
1670 |
++ mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0); |
1671 |
+ mcp->mb[9] = vha->vp_idx; |
1672 |
+ mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0; |
1673 |
+ mcp->in_mb = MBX_3|MBX_1|MBX_0; |
1674 |
+diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c |
1675 |
+index d6fe08de59a0..87e04c4a4982 100644 |
1676 |
+--- a/drivers/scsi/qla2xxx/qla_target.c |
1677 |
++++ b/drivers/scsi/qla2xxx/qla_target.c |
1678 |
+@@ -1203,7 +1203,8 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess, |
1679 |
+ qla24xx_chk_fcp_state(sess); |
1680 |
+ |
1681 |
+ ql_dbg(ql_dbg_tgt, sess->vha, 0xe001, |
1682 |
+- "Scheduling sess %p for deletion\n", sess); |
1683 |
++ "Scheduling sess %p for deletion %8phC\n", |
1684 |
++ sess, sess->port_name); |
1685 |
+ |
1686 |
+ INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn); |
1687 |
+ queue_work(sess->vha->hw->wq, &sess->del_work); |
1688 |
+diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
1689 |
+index 3f82ea1b72dc..9465acd18df0 100644 |
1690 |
+--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
1691 |
++++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c |
1692 |
+@@ -693,10 +693,6 @@ static int tcm_qla2xxx_queue_status(struct se_cmd *se_cmd) |
1693 |
+ cmd->sg_cnt = 0; |
1694 |
+ cmd->offset = 0; |
1695 |
+ cmd->dma_data_direction = target_reverse_dma_direction(se_cmd); |
1696 |
+- if (cmd->trc_flags & TRC_XMIT_STATUS) { |
1697 |
+- pr_crit("Multiple calls for status = %p.\n", cmd); |
1698 |
+- dump_stack(); |
1699 |
+- } |
1700 |
+ cmd->trc_flags |= TRC_XMIT_STATUS; |
1701 |
+ |
1702 |
+ if (se_cmd->data_direction == DMA_FROM_DEVICE) { |
1703 |
+diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c |
1704 |
+index bfd8f12d4e9a..7f505c027ce7 100644 |
1705 |
+--- a/drivers/scsi/scsi_lib.c |
1706 |
++++ b/drivers/scsi/scsi_lib.c |
1707 |
+@@ -683,6 +683,12 @@ static bool scsi_end_request(struct request *req, blk_status_t error, |
1708 |
+ */ |
1709 |
+ scsi_mq_uninit_cmd(cmd); |
1710 |
+ |
1711 |
++ /* |
1712 |
++ * queue is still alive, so grab the ref for preventing it |
1713 |
++ * from being cleaned up during running queue. |
1714 |
++ */ |
1715 |
++ percpu_ref_get(&q->q_usage_counter); |
1716 |
++ |
1717 |
+ __blk_mq_end_request(req, error); |
1718 |
+ |
1719 |
+ if (scsi_target(sdev)->single_lun || |
1720 |
+@@ -690,6 +696,8 @@ static bool scsi_end_request(struct request *req, blk_status_t error, |
1721 |
+ kblockd_schedule_work(&sdev->requeue_work); |
1722 |
+ else |
1723 |
+ blk_mq_run_hw_queues(q, true); |
1724 |
++ |
1725 |
++ percpu_ref_put(&q->q_usage_counter); |
1726 |
+ } else { |
1727 |
+ unsigned long flags; |
1728 |
+ |
1729 |
+diff --git a/drivers/soc/ti/knav_qmss.h b/drivers/soc/ti/knav_qmss.h |
1730 |
+index 905b974d1bdc..4686192e719e 100644 |
1731 |
+--- a/drivers/soc/ti/knav_qmss.h |
1732 |
++++ b/drivers/soc/ti/knav_qmss.h |
1733 |
+@@ -321,8 +321,8 @@ struct knav_range_ops { |
1734 |
+ }; |
1735 |
+ |
1736 |
+ struct knav_irq_info { |
1737 |
+- int irq; |
1738 |
+- u32 cpu_map; |
1739 |
++ int irq; |
1740 |
++ struct cpumask *cpu_mask; |
1741 |
+ }; |
1742 |
+ |
1743 |
+ struct knav_range_info { |
1744 |
+diff --git a/drivers/soc/ti/knav_qmss_acc.c b/drivers/soc/ti/knav_qmss_acc.c |
1745 |
+index 3d7225f4e77f..672aebe1e378 100644 |
1746 |
+--- a/drivers/soc/ti/knav_qmss_acc.c |
1747 |
++++ b/drivers/soc/ti/knav_qmss_acc.c |
1748 |
+@@ -205,18 +205,18 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, |
1749 |
+ { |
1750 |
+ struct knav_device *kdev = range->kdev; |
1751 |
+ struct knav_acc_channel *acc; |
1752 |
+- unsigned long cpu_map; |
1753 |
++ struct cpumask *cpu_mask; |
1754 |
+ int ret = 0, irq; |
1755 |
+ u32 old, new; |
1756 |
+ |
1757 |
+ if (range->flags & RANGE_MULTI_QUEUE) { |
1758 |
+ acc = range->acc; |
1759 |
+ irq = range->irqs[0].irq; |
1760 |
+- cpu_map = range->irqs[0].cpu_map; |
1761 |
++ cpu_mask = range->irqs[0].cpu_mask; |
1762 |
+ } else { |
1763 |
+ acc = range->acc + queue; |
1764 |
+ irq = range->irqs[queue].irq; |
1765 |
+- cpu_map = range->irqs[queue].cpu_map; |
1766 |
++ cpu_mask = range->irqs[queue].cpu_mask; |
1767 |
+ } |
1768 |
+ |
1769 |
+ old = acc->open_mask; |
1770 |
+@@ -239,8 +239,8 @@ static int knav_range_setup_acc_irq(struct knav_range_info *range, |
1771 |
+ acc->name, acc->name); |
1772 |
+ ret = request_irq(irq, knav_acc_int_handler, 0, acc->name, |
1773 |
+ range); |
1774 |
+- if (!ret && cpu_map) { |
1775 |
+- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); |
1776 |
++ if (!ret && cpu_mask) { |
1777 |
++ ret = irq_set_affinity_hint(irq, cpu_mask); |
1778 |
+ if (ret) { |
1779 |
+ dev_warn(range->kdev->dev, |
1780 |
+ "Failed to set IRQ affinity\n"); |
1781 |
+diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c |
1782 |
+index 39225de9d7f1..9879ca5f8c5f 100644 |
1783 |
+--- a/drivers/soc/ti/knav_qmss_queue.c |
1784 |
++++ b/drivers/soc/ti/knav_qmss_queue.c |
1785 |
+@@ -102,19 +102,17 @@ static int knav_queue_setup_irq(struct knav_range_info *range, |
1786 |
+ struct knav_queue_inst *inst) |
1787 |
+ { |
1788 |
+ unsigned queue = inst->id - range->queue_base; |
1789 |
+- unsigned long cpu_map; |
1790 |
+ int ret = 0, irq; |
1791 |
+ |
1792 |
+ if (range->flags & RANGE_HAS_IRQ) { |
1793 |
+ irq = range->irqs[queue].irq; |
1794 |
+- cpu_map = range->irqs[queue].cpu_map; |
1795 |
+ ret = request_irq(irq, knav_queue_int_handler, 0, |
1796 |
+ inst->irq_name, inst); |
1797 |
+ if (ret) |
1798 |
+ return ret; |
1799 |
+ disable_irq(irq); |
1800 |
+- if (cpu_map) { |
1801 |
+- ret = irq_set_affinity_hint(irq, to_cpumask(&cpu_map)); |
1802 |
++ if (range->irqs[queue].cpu_mask) { |
1803 |
++ ret = irq_set_affinity_hint(irq, range->irqs[queue].cpu_mask); |
1804 |
+ if (ret) { |
1805 |
+ dev_warn(range->kdev->dev, |
1806 |
+ "Failed to set IRQ affinity\n"); |
1807 |
+@@ -1222,9 +1220,19 @@ static int knav_setup_queue_range(struct knav_device *kdev, |
1808 |
+ |
1809 |
+ range->num_irqs++; |
1810 |
+ |
1811 |
+- if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) |
1812 |
+- range->irqs[i].cpu_map = |
1813 |
+- (oirq.args[2] & 0x0000ff00) >> 8; |
1814 |
++ if (IS_ENABLED(CONFIG_SMP) && oirq.args_count == 3) { |
1815 |
++ unsigned long mask; |
1816 |
++ int bit; |
1817 |
++ |
1818 |
++ range->irqs[i].cpu_mask = devm_kzalloc(dev, |
1819 |
++ cpumask_size(), GFP_KERNEL); |
1820 |
++ if (!range->irqs[i].cpu_mask) |
1821 |
++ return -ENOMEM; |
1822 |
++ |
1823 |
++ mask = (oirq.args[2] & 0x0000ff00) >> 8; |
1824 |
++ for_each_set_bit(bit, &mask, BITS_PER_LONG) |
1825 |
++ cpumask_set_cpu(bit, range->irqs[i].cpu_mask); |
1826 |
++ } |
1827 |
+ } |
1828 |
+ |
1829 |
+ range->num_irqs = min(range->num_irqs, range->num_queues); |
1830 |
+diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c |
1831 |
+index 18f5f139117e..0ff458fbee5e 100644 |
1832 |
+--- a/drivers/staging/iio/adc/ad7606.c |
1833 |
++++ b/drivers/staging/iio/adc/ad7606.c |
1834 |
+@@ -26,9 +26,12 @@ |
1835 |
+ |
1836 |
+ #include "ad7606.h" |
1837 |
+ |
1838 |
+-/* Scales are computed as 2.5/2**16 and 5/2**16 respectively */ |
1839 |
++/* |
1840 |
++ * Scales are computed as 5000/32768 and 10000/32768 respectively, |
1841 |
++ * so that when applied to the raw values they provide mV values |
1842 |
++ */ |
1843 |
+ static const unsigned int scale_avail[2][2] = { |
1844 |
+- {0, 38147}, {0, 76294} |
1845 |
++ {0, 152588}, {0, 305176} |
1846 |
+ }; |
1847 |
+ |
1848 |
+ static int ad7606_reset(struct ad7606_state *st) |
1849 |
+diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig |
1850 |
+index 07002df4f83a..e3f0d1fd1720 100644 |
1851 |
+--- a/drivers/thermal/Kconfig |
1852 |
++++ b/drivers/thermal/Kconfig |
1853 |
+@@ -408,7 +408,7 @@ config MTK_THERMAL |
1854 |
+ controller present in Mediatek SoCs |
1855 |
+ |
1856 |
+ menu "Broadcom thermal drivers" |
1857 |
+-depends on ARCH_BCM || COMPILE_TEST |
1858 |
++depends on ARCH_BCM || ARCH_BCM2835 || COMPILE_TEST |
1859 |
+ source "drivers/thermal/broadcom/Kconfig" |
1860 |
+ endmenu |
1861 |
+ |
1862 |
+diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c |
1863 |
+index ca54ce074a5f..a79f18edf2bd 100644 |
1864 |
+--- a/drivers/tty/serial/sc16is7xx.c |
1865 |
++++ b/drivers/tty/serial/sc16is7xx.c |
1866 |
+@@ -662,7 +662,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port) |
1867 |
+ uart_write_wakeup(port); |
1868 |
+ } |
1869 |
+ |
1870 |
+-static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
1871 |
++static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
1872 |
+ { |
1873 |
+ struct uart_port *port = &s->p[portno].port; |
1874 |
+ |
1875 |
+@@ -671,7 +671,7 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
1876 |
+ |
1877 |
+ iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); |
1878 |
+ if (iir & SC16IS7XX_IIR_NO_INT_BIT) |
1879 |
+- break; |
1880 |
++ return false; |
1881 |
+ |
1882 |
+ iir &= SC16IS7XX_IIR_ID_MASK; |
1883 |
+ |
1884 |
+@@ -693,16 +693,23 @@ static void sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) |
1885 |
+ port->line, iir); |
1886 |
+ break; |
1887 |
+ } |
1888 |
+- } while (1); |
1889 |
++ } while (0); |
1890 |
++ return true; |
1891 |
+ } |
1892 |
+ |
1893 |
+ static void sc16is7xx_ist(struct kthread_work *ws) |
1894 |
+ { |
1895 |
+ struct sc16is7xx_port *s = to_sc16is7xx_port(ws, irq_work); |
1896 |
+- int i; |
1897 |
+ |
1898 |
+- for (i = 0; i < s->devtype->nr_uart; ++i) |
1899 |
+- sc16is7xx_port_irq(s, i); |
1900 |
++ while (1) { |
1901 |
++ bool keep_polling = false; |
1902 |
++ int i; |
1903 |
++ |
1904 |
++ for (i = 0; i < s->devtype->nr_uart; ++i) |
1905 |
++ keep_polling |= sc16is7xx_port_irq(s, i); |
1906 |
++ if (!keep_polling) |
1907 |
++ break; |
1908 |
++ } |
1909 |
+ } |
1910 |
+ |
1911 |
+ static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) |
1912 |
+diff --git a/drivers/tty/tty_baudrate.c b/drivers/tty/tty_baudrate.c |
1913 |
+index ebc797fc1afd..42e5683147d5 100644 |
1914 |
+--- a/drivers/tty/tty_baudrate.c |
1915 |
++++ b/drivers/tty/tty_baudrate.c |
1916 |
+@@ -76,7 +76,7 @@ speed_t tty_termios_baud_rate(struct ktermios *termios) |
1917 |
+ else |
1918 |
+ cbaud += 15; |
1919 |
+ } |
1920 |
+- return baud_table[cbaud]; |
1921 |
++ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; |
1922 |
+ } |
1923 |
+ EXPORT_SYMBOL(tty_termios_baud_rate); |
1924 |
+ |
1925 |
+@@ -112,7 +112,7 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) |
1926 |
+ else |
1927 |
+ cbaud += 15; |
1928 |
+ } |
1929 |
+- return baud_table[cbaud]; |
1930 |
++ return cbaud >= n_baud_table ? 0 : baud_table[cbaud]; |
1931 |
+ #else |
1932 |
+ return tty_termios_baud_rate(termios); |
1933 |
+ #endif |
1934 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
1935 |
+index 8d65b2f9ee80..83376caa571b 100644 |
1936 |
+--- a/drivers/tty/tty_io.c |
1937 |
++++ b/drivers/tty/tty_io.c |
1938 |
+@@ -407,7 +407,7 @@ struct tty_driver *tty_find_polling_driver(char *name, int *line) |
1939 |
+ mutex_lock(&tty_mutex); |
1940 |
+ /* Search through the tty devices to look for a match */ |
1941 |
+ list_for_each_entry(p, &tty_drivers, tty_drivers) { |
1942 |
+- if (strncmp(name, p->name, len) != 0) |
1943 |
++ if (!len || strncmp(name, p->name, len) != 0) |
1944 |
+ continue; |
1945 |
+ stp = str; |
1946 |
+ if (*stp == ',') |
1947 |
+diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c |
1948 |
+index e47c5bc3ddca..35ebf06d9ecb 100644 |
1949 |
+--- a/drivers/vhost/scsi.c |
1950 |
++++ b/drivers/vhost/scsi.c |
1951 |
+@@ -993,7 +993,8 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) |
1952 |
+ prot_bytes = vhost32_to_cpu(vq, v_req_pi.pi_bytesin); |
1953 |
+ } |
1954 |
+ /* |
1955 |
+- * Set prot_iter to data_iter, and advance past any |
1956 |
++ * Set prot_iter to data_iter and truncate it to |
1957 |
++ * prot_bytes, and advance data_iter past any |
1958 |
+ * preceeding prot_bytes that may be present. |
1959 |
+ * |
1960 |
+ * Also fix up the exp_data_len to reflect only the |
1961 |
+@@ -1002,6 +1003,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq) |
1962 |
+ if (prot_bytes) { |
1963 |
+ exp_data_len -= prot_bytes; |
1964 |
+ prot_iter = data_iter; |
1965 |
++ iov_iter_truncate(&prot_iter, prot_bytes); |
1966 |
+ iov_iter_advance(&data_iter, prot_bytes); |
1967 |
+ } |
1968 |
+ tag = vhost64_to_cpu(vq, v_req_pi.tag); |
1969 |
+diff --git a/drivers/video/fbdev/aty/mach64_accel.c b/drivers/video/fbdev/aty/mach64_accel.c |
1970 |
+index 2541a0e0de76..3ad46255f990 100644 |
1971 |
+--- a/drivers/video/fbdev/aty/mach64_accel.c |
1972 |
++++ b/drivers/video/fbdev/aty/mach64_accel.c |
1973 |
+@@ -127,7 +127,7 @@ void aty_init_engine(struct atyfb_par *par, struct fb_info *info) |
1974 |
+ |
1975 |
+ /* set host attributes */ |
1976 |
+ wait_for_fifo(13, par); |
1977 |
+- aty_st_le32(HOST_CNTL, 0, par); |
1978 |
++ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); |
1979 |
+ |
1980 |
+ /* set pattern attributes */ |
1981 |
+ aty_st_le32(PAT_REG0, 0, par); |
1982 |
+@@ -233,7 +233,8 @@ void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) |
1983 |
+ rotation = rotation24bpp(dx, direction); |
1984 |
+ } |
1985 |
+ |
1986 |
+- wait_for_fifo(4, par); |
1987 |
++ wait_for_fifo(5, par); |
1988 |
++ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); |
1989 |
+ aty_st_le32(DP_SRC, FRGD_SRC_BLIT, par); |
1990 |
+ aty_st_le32(SRC_Y_X, (sx << 16) | sy, par); |
1991 |
+ aty_st_le32(SRC_HEIGHT1_WIDTH1, (width << 16) | area->height, par); |
1992 |
+@@ -269,7 +270,8 @@ void atyfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) |
1993 |
+ rotation = rotation24bpp(dx, DST_X_LEFT_TO_RIGHT); |
1994 |
+ } |
1995 |
+ |
1996 |
+- wait_for_fifo(3, par); |
1997 |
++ wait_for_fifo(4, par); |
1998 |
++ aty_st_le32(DP_PIX_WIDTH, par->crtc.dp_pix_width, par); |
1999 |
+ aty_st_le32(DP_FRGD_CLR, color, par); |
2000 |
+ aty_st_le32(DP_SRC, |
2001 |
+ BKGD_SRC_BKGD_CLR | FRGD_SRC_FRGD_CLR | MONO_SRC_ONE, |
2002 |
+@@ -284,7 +286,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2003 |
+ { |
2004 |
+ struct atyfb_par *par = (struct atyfb_par *) info->par; |
2005 |
+ u32 src_bytes, dx = image->dx, dy = image->dy, width = image->width; |
2006 |
+- u32 pix_width_save, pix_width, host_cntl, rotation = 0, src, mix; |
2007 |
++ u32 pix_width, rotation = 0, src, mix; |
2008 |
+ |
2009 |
+ if (par->asleep) |
2010 |
+ return; |
2011 |
+@@ -296,8 +298,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2012 |
+ return; |
2013 |
+ } |
2014 |
+ |
2015 |
+- pix_width = pix_width_save = aty_ld_le32(DP_PIX_WIDTH, par); |
2016 |
+- host_cntl = aty_ld_le32(HOST_CNTL, par) | HOST_BYTE_ALIGN; |
2017 |
++ pix_width = par->crtc.dp_pix_width; |
2018 |
+ |
2019 |
+ switch (image->depth) { |
2020 |
+ case 1: |
2021 |
+@@ -345,7 +346,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2022 |
+ * since Rage 3D IIc we have DP_HOST_TRIPLE_EN bit |
2023 |
+ * this hwaccelerated triple has an issue with not aligned data |
2024 |
+ */ |
2025 |
+- if (M64_HAS(HW_TRIPLE) && image->width % 8 == 0) |
2026 |
++ if (image->depth == 1 && M64_HAS(HW_TRIPLE) && image->width % 8 == 0) |
2027 |
+ pix_width |= DP_HOST_TRIPLE_EN; |
2028 |
+ } |
2029 |
+ |
2030 |
+@@ -370,19 +371,18 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2031 |
+ mix = FRGD_MIX_D_XOR_S | BKGD_MIX_D; |
2032 |
+ } |
2033 |
+ |
2034 |
+- wait_for_fifo(6, par); |
2035 |
+- aty_st_le32(DP_WRITE_MASK, 0xFFFFFFFF, par); |
2036 |
++ wait_for_fifo(5, par); |
2037 |
+ aty_st_le32(DP_PIX_WIDTH, pix_width, par); |
2038 |
+ aty_st_le32(DP_MIX, mix, par); |
2039 |
+ aty_st_le32(DP_SRC, src, par); |
2040 |
+- aty_st_le32(HOST_CNTL, host_cntl, par); |
2041 |
++ aty_st_le32(HOST_CNTL, HOST_BYTE_ALIGN, par); |
2042 |
+ aty_st_le32(DST_CNTL, DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT | rotation, par); |
2043 |
+ |
2044 |
+ draw_rect(dx, dy, width, image->height, par); |
2045 |
+ src_bytes = (((image->width * image->depth) + 7) / 8) * image->height; |
2046 |
+ |
2047 |
+ /* manual triple each pixel */ |
2048 |
+- if (info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { |
2049 |
++ if (image->depth == 1 && info->var.bits_per_pixel == 24 && !(pix_width & DP_HOST_TRIPLE_EN)) { |
2050 |
+ int inbit, outbit, mult24, byte_id_in_dword, width; |
2051 |
+ u8 *pbitmapin = (u8*)image->data, *pbitmapout; |
2052 |
+ u32 hostdword; |
2053 |
+@@ -415,7 +415,7 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2054 |
+ } |
2055 |
+ } |
2056 |
+ wait_for_fifo(1, par); |
2057 |
+- aty_st_le32(HOST_DATA0, hostdword, par); |
2058 |
++ aty_st_le32(HOST_DATA0, le32_to_cpu(hostdword), par); |
2059 |
+ } |
2060 |
+ } else { |
2061 |
+ u32 *pbitmap, dwords = (src_bytes + 3) / 4; |
2062 |
+@@ -424,8 +424,4 @@ void atyfb_imageblit(struct fb_info *info, const struct fb_image *image) |
2063 |
+ aty_st_le32(HOST_DATA0, get_unaligned_le32(pbitmap), par); |
2064 |
+ } |
2065 |
+ } |
2066 |
+- |
2067 |
+- /* restore pix_width */ |
2068 |
+- wait_for_fifo(1, par); |
2069 |
+- aty_st_le32(DP_PIX_WIDTH, pix_width_save, par); |
2070 |
+ } |
2071 |
+diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c |
2072 |
+index 03c9e325bfbc..3a2f37ad1f89 100644 |
2073 |
+--- a/fs/9p/vfs_file.c |
2074 |
++++ b/fs/9p/vfs_file.c |
2075 |
+@@ -204,6 +204,14 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) |
2076 |
+ break; |
2077 |
+ if (schedule_timeout_interruptible(P9_LOCK_TIMEOUT) != 0) |
2078 |
+ break; |
2079 |
++ /* |
2080 |
++ * p9_client_lock_dotl overwrites flock.client_id with the |
2081 |
++ * server message, free and reuse the client name |
2082 |
++ */ |
2083 |
++ if (flock.client_id != fid->clnt->name) { |
2084 |
++ kfree(flock.client_id); |
2085 |
++ flock.client_id = fid->clnt->name; |
2086 |
++ } |
2087 |
+ } |
2088 |
+ |
2089 |
+ /* map 9p status to VFS status */ |
2090 |
+@@ -235,6 +243,8 @@ out_unlock: |
2091 |
+ locks_lock_file_wait(filp, fl); |
2092 |
+ fl->fl_type = fl_type; |
2093 |
+ } |
2094 |
++ if (flock.client_id != fid->clnt->name) |
2095 |
++ kfree(flock.client_id); |
2096 |
+ out: |
2097 |
+ return res; |
2098 |
+ } |
2099 |
+@@ -269,7 +279,7 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) |
2100 |
+ |
2101 |
+ res = p9_client_getlock_dotl(fid, &glock); |
2102 |
+ if (res < 0) |
2103 |
+- return res; |
2104 |
++ goto out; |
2105 |
+ /* map 9p lock type to os lock type */ |
2106 |
+ switch (glock.type) { |
2107 |
+ case P9_LOCK_TYPE_RDLCK: |
2108 |
+@@ -290,7 +300,9 @@ static int v9fs_file_getlock(struct file *filp, struct file_lock *fl) |
2109 |
+ fl->fl_end = glock.start + glock.length - 1; |
2110 |
+ fl->fl_pid = -glock.proc_id; |
2111 |
+ } |
2112 |
+- kfree(glock.client_id); |
2113 |
++out: |
2114 |
++ if (glock.client_id != fid->clnt->name) |
2115 |
++ kfree(glock.client_id); |
2116 |
+ return res; |
2117 |
+ } |
2118 |
+ |
2119 |
+diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c |
2120 |
+index 5cf1bbe9754c..0e67cee73c53 100644 |
2121 |
+--- a/fs/btrfs/disk-io.c |
2122 |
++++ b/fs/btrfs/disk-io.c |
2123 |
+@@ -4428,13 +4428,23 @@ static int btrfs_destroy_pinned_extent(struct btrfs_fs_info *fs_info, |
2124 |
+ unpin = pinned_extents; |
2125 |
+ again: |
2126 |
+ while (1) { |
2127 |
++ /* |
2128 |
++ * The btrfs_finish_extent_commit() may get the same range as |
2129 |
++ * ours between find_first_extent_bit and clear_extent_dirty. |
2130 |
++ * Hence, hold the unused_bg_unpin_mutex to avoid double unpin |
2131 |
++ * the same extent range. |
2132 |
++ */ |
2133 |
++ mutex_lock(&fs_info->unused_bg_unpin_mutex); |
2134 |
+ ret = find_first_extent_bit(unpin, 0, &start, &end, |
2135 |
+ EXTENT_DIRTY, NULL); |
2136 |
+- if (ret) |
2137 |
++ if (ret) { |
2138 |
++ mutex_unlock(&fs_info->unused_bg_unpin_mutex); |
2139 |
+ break; |
2140 |
++ } |
2141 |
+ |
2142 |
+ clear_extent_dirty(unpin, start, end); |
2143 |
+ btrfs_error_unpin_extent_range(fs_info, start, end); |
2144 |
++ mutex_unlock(&fs_info->unused_bg_unpin_mutex); |
2145 |
+ cond_resched(); |
2146 |
+ } |
2147 |
+ |
2148 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
2149 |
+index 90568a21fa77..1c340d6c8568 100644 |
2150 |
+--- a/fs/btrfs/inode.c |
2151 |
++++ b/fs/btrfs/inode.c |
2152 |
+@@ -1565,12 +1565,11 @@ out_check: |
2153 |
+ } |
2154 |
+ btrfs_release_path(path); |
2155 |
+ |
2156 |
+- if (cur_offset <= end && cow_start == (u64)-1) { |
2157 |
++ if (cur_offset <= end && cow_start == (u64)-1) |
2158 |
+ cow_start = cur_offset; |
2159 |
+- cur_offset = end; |
2160 |
+- } |
2161 |
+ |
2162 |
+ if (cow_start != (u64)-1) { |
2163 |
++ cur_offset = end; |
2164 |
+ ret = cow_file_range(inode, locked_page, cow_start, end, end, |
2165 |
+ page_started, nr_written, 1, NULL); |
2166 |
+ if (ret) |
2167 |
+diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c |
2168 |
+index 9333e4cda68d..cddd63b9103f 100644 |
2169 |
+--- a/fs/btrfs/ioctl.c |
2170 |
++++ b/fs/btrfs/ioctl.c |
2171 |
+@@ -3178,6 +3178,8 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, |
2172 |
+ const u64 sz = BTRFS_I(src)->root->fs_info->sectorsize; |
2173 |
+ |
2174 |
+ len = round_down(i_size_read(src), sz) - loff; |
2175 |
++ if (len == 0) |
2176 |
++ return 0; |
2177 |
+ olen = len; |
2178 |
+ } |
2179 |
+ } |
2180 |
+@@ -3907,9 +3909,17 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, |
2181 |
+ goto out_unlock; |
2182 |
+ if (len == 0) |
2183 |
+ olen = len = src->i_size - off; |
2184 |
+- /* if we extend to eof, continue to block boundary */ |
2185 |
+- if (off + len == src->i_size) |
2186 |
++ /* |
2187 |
++ * If we extend to eof, continue to block boundary if and only if the |
2188 |
++ * destination end offset matches the destination file's size, otherwise |
2189 |
++ * we would be corrupting data by placing the eof block into the middle |
2190 |
++ * of a file. |
2191 |
++ */ |
2192 |
++ if (off + len == src->i_size) { |
2193 |
++ if (!IS_ALIGNED(len, bs) && destoff + len < inode->i_size) |
2194 |
++ goto out_unlock; |
2195 |
+ len = ALIGN(src->i_size, bs) - off; |
2196 |
++ } |
2197 |
+ |
2198 |
+ if (len == 0) { |
2199 |
+ ret = 0; |
2200 |
+diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c |
2201 |
+index d5124ed35154..a1492bdc6d03 100644 |
2202 |
+--- a/fs/ceph/inode.c |
2203 |
++++ b/fs/ceph/inode.c |
2204 |
+@@ -1087,8 +1087,12 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in) |
2205 |
+ if (IS_ERR(realdn)) { |
2206 |
+ pr_err("splice_dentry error %ld %p inode %p ino %llx.%llx\n", |
2207 |
+ PTR_ERR(realdn), dn, in, ceph_vinop(in)); |
2208 |
+- dput(dn); |
2209 |
+- dn = realdn; /* note realdn contains the error */ |
2210 |
++ dn = realdn; |
2211 |
++ /* |
2212 |
++ * Caller should release 'dn' in the case of error. |
2213 |
++ * If 'req->r_dentry' is passed to this function, |
2214 |
++ * caller should leave 'req->r_dentry' untouched. |
2215 |
++ */ |
2216 |
+ goto out; |
2217 |
+ } else if (realdn) { |
2218 |
+ dout("dn %p (%d) spliced with %p (%d) " |
2219 |
+diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c |
2220 |
+index c8aabba502f6..9993cdb81e7d 100644 |
2221 |
+--- a/fs/configfs/symlink.c |
2222 |
++++ b/fs/configfs/symlink.c |
2223 |
+@@ -64,7 +64,7 @@ static void fill_item_path(struct config_item * item, char * buffer, int length) |
2224 |
+ |
2225 |
+ /* back up enough to print this bus id with '/' */ |
2226 |
+ length -= cur; |
2227 |
+- strncpy(buffer + length,config_item_name(p),cur); |
2228 |
++ memcpy(buffer + length, config_item_name(p), cur); |
2229 |
+ *(buffer + --length) = '/'; |
2230 |
+ } |
2231 |
+ } |
2232 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
2233 |
+index 9808df52ceca..bd2bf83b1a1f 100644 |
2234 |
+--- a/fs/ext4/inode.c |
2235 |
++++ b/fs/ext4/inode.c |
2236 |
+@@ -5671,9 +5671,10 @@ int ext4_mark_iloc_dirty(handle_t *handle, |
2237 |
+ { |
2238 |
+ int err = 0; |
2239 |
+ |
2240 |
+- if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) |
2241 |
++ if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) { |
2242 |
++ put_bh(iloc->bh); |
2243 |
+ return -EIO; |
2244 |
+- |
2245 |
++ } |
2246 |
+ if (IS_I_VERSION(inode)) |
2247 |
+ inode_inc_iversion(inode); |
2248 |
+ |
2249 |
+diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c |
2250 |
+index eb0d8ee39827..4e301b0cdfb5 100644 |
2251 |
+--- a/fs/ext4/namei.c |
2252 |
++++ b/fs/ext4/namei.c |
2253 |
+@@ -125,6 +125,7 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode, |
2254 |
+ if (!is_dx_block && type == INDEX) { |
2255 |
+ ext4_error_inode(inode, func, line, block, |
2256 |
+ "directory leaf block found instead of index block"); |
2257 |
++ brelse(bh); |
2258 |
+ return ERR_PTR(-EFSCORRUPTED); |
2259 |
+ } |
2260 |
+ if (!ext4_has_metadata_csum(inode->i_sb) || |
2261 |
+@@ -2820,7 +2821,9 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) |
2262 |
+ list_del_init(&EXT4_I(inode)->i_orphan); |
2263 |
+ mutex_unlock(&sbi->s_orphan_lock); |
2264 |
+ } |
2265 |
+- } |
2266 |
++ } else |
2267 |
++ brelse(iloc.bh); |
2268 |
++ |
2269 |
+ jbd_debug(4, "superblock will point to %lu\n", inode->i_ino); |
2270 |
+ jbd_debug(4, "orphan inode %lu will point to %d\n", |
2271 |
+ inode->i_ino, NEXT_ORPHAN(inode)); |
2272 |
+diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c |
2273 |
+index e344e606c054..deebb8842c82 100644 |
2274 |
+--- a/fs/ext4/resize.c |
2275 |
++++ b/fs/ext4/resize.c |
2276 |
+@@ -444,16 +444,18 @@ static int set_flexbg_block_bitmap(struct super_block *sb, handle_t *handle, |
2277 |
+ |
2278 |
+ BUFFER_TRACE(bh, "get_write_access"); |
2279 |
+ err = ext4_journal_get_write_access(handle, bh); |
2280 |
+- if (err) |
2281 |
++ if (err) { |
2282 |
++ brelse(bh); |
2283 |
+ return err; |
2284 |
++ } |
2285 |
+ ext4_debug("mark block bitmap %#04llx (+%llu/%u)\n", block, |
2286 |
+ block - start, count2); |
2287 |
+ ext4_set_bits(bh->b_data, block - start, count2); |
2288 |
+ |
2289 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
2290 |
++ brelse(bh); |
2291 |
+ if (unlikely(err)) |
2292 |
+ return err; |
2293 |
+- brelse(bh); |
2294 |
+ } |
2295 |
+ |
2296 |
+ return 0; |
2297 |
+@@ -590,7 +592,6 @@ handle_bb: |
2298 |
+ bh = bclean(handle, sb, block); |
2299 |
+ if (IS_ERR(bh)) { |
2300 |
+ err = PTR_ERR(bh); |
2301 |
+- bh = NULL; |
2302 |
+ goto out; |
2303 |
+ } |
2304 |
+ overhead = ext4_group_overhead_blocks(sb, group); |
2305 |
+@@ -602,9 +603,9 @@ handle_bb: |
2306 |
+ ext4_mark_bitmap_end(group_data[i].blocks_count, |
2307 |
+ sb->s_blocksize * 8, bh->b_data); |
2308 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
2309 |
++ brelse(bh); |
2310 |
+ if (err) |
2311 |
+ goto out; |
2312 |
+- brelse(bh); |
2313 |
+ |
2314 |
+ handle_ib: |
2315 |
+ if (bg_flags[i] & EXT4_BG_INODE_UNINIT) |
2316 |
+@@ -619,18 +620,16 @@ handle_ib: |
2317 |
+ bh = bclean(handle, sb, block); |
2318 |
+ if (IS_ERR(bh)) { |
2319 |
+ err = PTR_ERR(bh); |
2320 |
+- bh = NULL; |
2321 |
+ goto out; |
2322 |
+ } |
2323 |
+ |
2324 |
+ ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), |
2325 |
+ sb->s_blocksize * 8, bh->b_data); |
2326 |
+ err = ext4_handle_dirty_metadata(handle, NULL, bh); |
2327 |
++ brelse(bh); |
2328 |
+ if (err) |
2329 |
+ goto out; |
2330 |
+- brelse(bh); |
2331 |
+ } |
2332 |
+- bh = NULL; |
2333 |
+ |
2334 |
+ /* Mark group tables in block bitmap */ |
2335 |
+ for (j = 0; j < GROUP_TABLE_COUNT; j++) { |
2336 |
+@@ -661,7 +660,6 @@ handle_ib: |
2337 |
+ } |
2338 |
+ |
2339 |
+ out: |
2340 |
+- brelse(bh); |
2341 |
+ err2 = ext4_journal_stop(handle); |
2342 |
+ if (err2 && !err) |
2343 |
+ err = err2; |
2344 |
+@@ -848,6 +846,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, |
2345 |
+ err = ext4_handle_dirty_metadata(handle, NULL, gdb_bh); |
2346 |
+ if (unlikely(err)) { |
2347 |
+ ext4_std_error(sb, err); |
2348 |
++ iloc.bh = NULL; |
2349 |
+ goto exit_inode; |
2350 |
+ } |
2351 |
+ brelse(dind); |
2352 |
+@@ -899,6 +898,7 @@ static int add_new_gdb_meta_bg(struct super_block *sb, |
2353 |
+ sizeof(struct buffer_head *), |
2354 |
+ GFP_NOFS); |
2355 |
+ if (!n_group_desc) { |
2356 |
++ brelse(gdb_bh); |
2357 |
+ err = -ENOMEM; |
2358 |
+ ext4_warning(sb, "not enough memory for %lu groups", |
2359 |
+ gdb_num + 1); |
2360 |
+@@ -914,8 +914,6 @@ static int add_new_gdb_meta_bg(struct super_block *sb, |
2361 |
+ kvfree(o_group_desc); |
2362 |
+ BUFFER_TRACE(gdb_bh, "get_write_access"); |
2363 |
+ err = ext4_journal_get_write_access(handle, gdb_bh); |
2364 |
+- if (unlikely(err)) |
2365 |
+- brelse(gdb_bh); |
2366 |
+ return err; |
2367 |
+ } |
2368 |
+ |
2369 |
+@@ -1097,8 +1095,10 @@ static void update_backups(struct super_block *sb, sector_t blk_off, char *data, |
2370 |
+ backup_block, backup_block - |
2371 |
+ ext4_group_first_block_no(sb, group)); |
2372 |
+ BUFFER_TRACE(bh, "get_write_access"); |
2373 |
+- if ((err = ext4_journal_get_write_access(handle, bh))) |
2374 |
++ if ((err = ext4_journal_get_write_access(handle, bh))) { |
2375 |
++ brelse(bh); |
2376 |
+ break; |
2377 |
++ } |
2378 |
+ lock_buffer(bh); |
2379 |
+ memcpy(bh->b_data, data, size); |
2380 |
+ if (rest) |
2381 |
+@@ -1993,7 +1993,7 @@ retry: |
2382 |
+ |
2383 |
+ err = ext4_alloc_flex_bg_array(sb, n_group + 1); |
2384 |
+ if (err) |
2385 |
+- return err; |
2386 |
++ goto out; |
2387 |
+ |
2388 |
+ err = ext4_mb_alloc_groupinfo(sb, n_group + 1); |
2389 |
+ if (err) |
2390 |
+@@ -2029,6 +2029,10 @@ retry: |
2391 |
+ n_blocks_count_retry = 0; |
2392 |
+ free_flex_gd(flex_gd); |
2393 |
+ flex_gd = NULL; |
2394 |
++ if (resize_inode) { |
2395 |
++ iput(resize_inode); |
2396 |
++ resize_inode = NULL; |
2397 |
++ } |
2398 |
+ goto retry; |
2399 |
+ } |
2400 |
+ |
2401 |
+diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
2402 |
+index 46ad267ef6d6..7fd64f5f70f0 100644 |
2403 |
+--- a/fs/ext4/super.c |
2404 |
++++ b/fs/ext4/super.c |
2405 |
+@@ -4012,6 +4012,14 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
2406 |
+ sbi->s_groups_count = blocks_count; |
2407 |
+ sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count, |
2408 |
+ (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); |
2409 |
++ if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != |
2410 |
++ le32_to_cpu(es->s_inodes_count)) { |
2411 |
++ ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", |
2412 |
++ le32_to_cpu(es->s_inodes_count), |
2413 |
++ ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); |
2414 |
++ ret = -EINVAL; |
2415 |
++ goto failed_mount; |
2416 |
++ } |
2417 |
+ db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / |
2418 |
+ EXT4_DESC_PER_BLOCK(sb); |
2419 |
+ if (ext4_has_feature_meta_bg(sb)) { |
2420 |
+@@ -4031,14 +4039,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) |
2421 |
+ ret = -ENOMEM; |
2422 |
+ goto failed_mount; |
2423 |
+ } |
2424 |
+- if (((u64)sbi->s_groups_count * sbi->s_inodes_per_group) != |
2425 |
+- le32_to_cpu(es->s_inodes_count)) { |
2426 |
+- ext4_msg(sb, KERN_ERR, "inodes count not valid: %u vs %llu", |
2427 |
+- le32_to_cpu(es->s_inodes_count), |
2428 |
+- ((u64)sbi->s_groups_count * sbi->s_inodes_per_group)); |
2429 |
+- ret = -EINVAL; |
2430 |
+- goto failed_mount; |
2431 |
+- } |
2432 |
+ |
2433 |
+ bgl_lock_init(sbi->s_blockgroup_lock); |
2434 |
+ |
2435 |
+@@ -4442,6 +4442,7 @@ failed_mount6: |
2436 |
+ percpu_counter_destroy(&sbi->s_freeinodes_counter); |
2437 |
+ percpu_counter_destroy(&sbi->s_dirs_counter); |
2438 |
+ percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
2439 |
++ percpu_free_rwsem(&sbi->s_journal_flag_rwsem); |
2440 |
+ failed_mount5: |
2441 |
+ ext4_ext_release(sb); |
2442 |
+ ext4_release_system_zone(sb); |
2443 |
+diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c |
2444 |
+index 9bc50eef6127..a5923a1d0ff4 100644 |
2445 |
+--- a/fs/ext4/xattr.c |
2446 |
++++ b/fs/ext4/xattr.c |
2447 |
+@@ -1387,6 +1387,12 @@ retry: |
2448 |
+ bh = ext4_getblk(handle, ea_inode, block, 0); |
2449 |
+ if (IS_ERR(bh)) |
2450 |
+ return PTR_ERR(bh); |
2451 |
++ if (!bh) { |
2452 |
++ WARN_ON_ONCE(1); |
2453 |
++ EXT4_ERROR_INODE(ea_inode, |
2454 |
++ "ext4_getblk() return bh = NULL"); |
2455 |
++ return -EFSCORRUPTED; |
2456 |
++ } |
2457 |
+ ret = ext4_journal_get_write_access(handle, bh); |
2458 |
+ if (ret) |
2459 |
+ goto out; |
2460 |
+@@ -2275,8 +2281,10 @@ static struct buffer_head *ext4_xattr_get_block(struct inode *inode) |
2461 |
+ if (!bh) |
2462 |
+ return ERR_PTR(-EIO); |
2463 |
+ error = ext4_xattr_check_block(inode, bh); |
2464 |
+- if (error) |
2465 |
++ if (error) { |
2466 |
++ brelse(bh); |
2467 |
+ return ERR_PTR(error); |
2468 |
++ } |
2469 |
+ return bh; |
2470 |
+ } |
2471 |
+ |
2472 |
+@@ -2396,6 +2404,8 @@ retry_inode: |
2473 |
+ error = ext4_xattr_block_set(handle, inode, &i, &bs); |
2474 |
+ } else if (error == -ENOSPC) { |
2475 |
+ if (EXT4_I(inode)->i_file_acl && !bs.s.base) { |
2476 |
++ brelse(bs.bh); |
2477 |
++ bs.bh = NULL; |
2478 |
+ error = ext4_xattr_block_find(inode, &i, &bs); |
2479 |
+ if (error) |
2480 |
+ goto cleanup; |
2481 |
+@@ -2616,6 +2626,8 @@ out: |
2482 |
+ kfree(buffer); |
2483 |
+ if (is) |
2484 |
+ brelse(is->iloc.bh); |
2485 |
++ if (bs) |
2486 |
++ brelse(bs->bh); |
2487 |
+ kfree(is); |
2488 |
+ kfree(bs); |
2489 |
+ |
2490 |
+@@ -2695,7 +2707,6 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, |
2491 |
+ struct ext4_inode *raw_inode, handle_t *handle) |
2492 |
+ { |
2493 |
+ struct ext4_xattr_ibody_header *header; |
2494 |
+- struct buffer_head *bh; |
2495 |
+ struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
2496 |
+ static unsigned int mnt_count; |
2497 |
+ size_t min_offs; |
2498 |
+@@ -2736,13 +2747,17 @@ retry: |
2499 |
+ * EA block can hold new_extra_isize bytes. |
2500 |
+ */ |
2501 |
+ if (EXT4_I(inode)->i_file_acl) { |
2502 |
++ struct buffer_head *bh; |
2503 |
++ |
2504 |
+ bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); |
2505 |
+ error = -EIO; |
2506 |
+ if (!bh) |
2507 |
+ goto cleanup; |
2508 |
+ error = ext4_xattr_check_block(inode, bh); |
2509 |
+- if (error) |
2510 |
++ if (error) { |
2511 |
++ brelse(bh); |
2512 |
+ goto cleanup; |
2513 |
++ } |
2514 |
+ base = BHDR(bh); |
2515 |
+ end = bh->b_data + bh->b_size; |
2516 |
+ min_offs = end - base; |
2517 |
+diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c |
2518 |
+index ee8105af4001..f7280c44cd4b 100644 |
2519 |
+--- a/fs/fuse/dev.c |
2520 |
++++ b/fs/fuse/dev.c |
2521 |
+@@ -384,12 +384,19 @@ static void request_end(struct fuse_conn *fc, struct fuse_req *req) |
2522 |
+ if (test_bit(FR_BACKGROUND, &req->flags)) { |
2523 |
+ spin_lock(&fc->lock); |
2524 |
+ clear_bit(FR_BACKGROUND, &req->flags); |
2525 |
+- if (fc->num_background == fc->max_background) |
2526 |
++ if (fc->num_background == fc->max_background) { |
2527 |
+ fc->blocked = 0; |
2528 |
+- |
2529 |
+- /* Wake up next waiter, if any */ |
2530 |
+- if (!fc->blocked && waitqueue_active(&fc->blocked_waitq)) |
2531 |
+ wake_up(&fc->blocked_waitq); |
2532 |
++ } else if (!fc->blocked) { |
2533 |
++ /* |
2534 |
++ * Wake up next waiter, if any. It's okay to use |
2535 |
++ * waitqueue_active(), as we've already synced up |
2536 |
++ * fc->blocked with waiters with the wake_up() call |
2537 |
++ * above. |
2538 |
++ */ |
2539 |
++ if (waitqueue_active(&fc->blocked_waitq)) |
2540 |
++ wake_up(&fc->blocked_waitq); |
2541 |
++ } |
2542 |
+ |
2543 |
+ if (fc->num_background == fc->congestion_threshold && fc->sb) { |
2544 |
+ clear_bdi_congested(fc->sb->s_bdi, BLK_RW_SYNC); |
2545 |
+@@ -1309,12 +1316,14 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, |
2546 |
+ goto out_end; |
2547 |
+ } |
2548 |
+ list_move_tail(&req->list, &fpq->processing); |
2549 |
+- spin_unlock(&fpq->lock); |
2550 |
++ __fuse_get_request(req); |
2551 |
+ set_bit(FR_SENT, &req->flags); |
2552 |
++ spin_unlock(&fpq->lock); |
2553 |
+ /* matches barrier in request_wait_answer() */ |
2554 |
+ smp_mb__after_atomic(); |
2555 |
+ if (test_bit(FR_INTERRUPTED, &req->flags)) |
2556 |
+ queue_interrupt(fiq, req); |
2557 |
++ fuse_put_request(fc, req); |
2558 |
+ |
2559 |
+ return reqsize; |
2560 |
+ |
2561 |
+@@ -1712,8 +1721,10 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, |
2562 |
+ req->in.args[1].size = total_len; |
2563 |
+ |
2564 |
+ err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique); |
2565 |
+- if (err) |
2566 |
++ if (err) { |
2567 |
+ fuse_retrieve_end(fc, req); |
2568 |
++ fuse_put_request(fc, req); |
2569 |
++ } |
2570 |
+ |
2571 |
+ return err; |
2572 |
+ } |
2573 |
+@@ -1872,16 +1883,20 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud, |
2574 |
+ |
2575 |
+ /* Is it an interrupt reply? */ |
2576 |
+ if (req->intr_unique == oh.unique) { |
2577 |
++ __fuse_get_request(req); |
2578 |
+ spin_unlock(&fpq->lock); |
2579 |
+ |
2580 |
+ err = -EINVAL; |
2581 |
+- if (nbytes != sizeof(struct fuse_out_header)) |
2582 |
++ if (nbytes != sizeof(struct fuse_out_header)) { |
2583 |
++ fuse_put_request(fc, req); |
2584 |
+ goto err_finish; |
2585 |
++ } |
2586 |
+ |
2587 |
+ if (oh.error == -ENOSYS) |
2588 |
+ fc->no_interrupt = 1; |
2589 |
+ else if (oh.error == -EAGAIN) |
2590 |
+ queue_interrupt(&fc->iq, req); |
2591 |
++ fuse_put_request(fc, req); |
2592 |
+ |
2593 |
+ fuse_copy_finish(cs); |
2594 |
+ return nbytes; |
2595 |
+diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
2596 |
+index fb4738ef162f..47d7a510be5b 100644 |
2597 |
+--- a/fs/fuse/file.c |
2598 |
++++ b/fs/fuse/file.c |
2599 |
+@@ -2912,10 +2912,12 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter) |
2600 |
+ } |
2601 |
+ |
2602 |
+ if (io->async) { |
2603 |
++ bool blocking = io->blocking; |
2604 |
++ |
2605 |
+ fuse_aio_complete(io, ret < 0 ? ret : 0, -1); |
2606 |
+ |
2607 |
+ /* we have a non-extending, async request, so return */ |
2608 |
+- if (!io->blocking) |
2609 |
++ if (!blocking) |
2610 |
+ return -EIOCBQUEUED; |
2611 |
+ |
2612 |
+ wait_for_completion(&wait); |
2613 |
+diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c |
2614 |
+index 5fe033131f03..b0eee90738ff 100644 |
2615 |
+--- a/fs/gfs2/rgrp.c |
2616 |
++++ b/fs/gfs2/rgrp.c |
2617 |
+@@ -706,6 +706,7 @@ void gfs2_clear_rgrpd(struct gfs2_sbd *sdp) |
2618 |
+ |
2619 |
+ if (gl) { |
2620 |
+ glock_clear_object(gl, rgd); |
2621 |
++ gfs2_rgrp_brelse(rgd); |
2622 |
+ gfs2_glock_put(gl); |
2623 |
+ } |
2624 |
+ |
2625 |
+@@ -1115,7 +1116,7 @@ static u32 count_unlinked(struct gfs2_rgrpd *rgd) |
2626 |
+ * @rgd: the struct gfs2_rgrpd describing the RG to read in |
2627 |
+ * |
2628 |
+ * Read in all of a Resource Group's header and bitmap blocks. |
2629 |
+- * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. |
2630 |
++ * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps. |
2631 |
+ * |
2632 |
+ * Returns: errno |
2633 |
+ */ |
2634 |
+diff --git a/fs/namespace.c b/fs/namespace.c |
2635 |
+index 9dc146e7b5e0..e9c13eedd739 100644 |
2636 |
+--- a/fs/namespace.c |
2637 |
++++ b/fs/namespace.c |
2638 |
+@@ -1625,8 +1625,13 @@ static int do_umount(struct mount *mnt, int flags) |
2639 |
+ |
2640 |
+ namespace_lock(); |
2641 |
+ lock_mount_hash(); |
2642 |
+- event++; |
2643 |
+ |
2644 |
++ /* Recheck MNT_LOCKED with the locks held */ |
2645 |
++ retval = -EINVAL; |
2646 |
++ if (mnt->mnt.mnt_flags & MNT_LOCKED) |
2647 |
++ goto out; |
2648 |
++ |
2649 |
++ event++; |
2650 |
+ if (flags & MNT_DETACH) { |
2651 |
+ if (!list_empty(&mnt->mnt_list)) |
2652 |
+ umount_tree(mnt, UMOUNT_PROPAGATE); |
2653 |
+@@ -1640,6 +1645,7 @@ static int do_umount(struct mount *mnt, int flags) |
2654 |
+ retval = 0; |
2655 |
+ } |
2656 |
+ } |
2657 |
++out: |
2658 |
+ unlock_mount_hash(); |
2659 |
+ namespace_unlock(); |
2660 |
+ return retval; |
2661 |
+@@ -1730,7 +1736,7 @@ SYSCALL_DEFINE2(umount, char __user *, name, int, flags) |
2662 |
+ goto dput_and_out; |
2663 |
+ if (!check_mnt(mnt)) |
2664 |
+ goto dput_and_out; |
2665 |
+- if (mnt->mnt.mnt_flags & MNT_LOCKED) |
2666 |
++ if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */ |
2667 |
+ goto dput_and_out; |
2668 |
+ retval = -EPERM; |
2669 |
+ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN)) |
2670 |
+@@ -1808,8 +1814,14 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry, |
2671 |
+ for (s = r; s; s = next_mnt(s, r)) { |
2672 |
+ if (!(flag & CL_COPY_UNBINDABLE) && |
2673 |
+ IS_MNT_UNBINDABLE(s)) { |
2674 |
+- s = skip_mnt_tree(s); |
2675 |
+- continue; |
2676 |
++ if (s->mnt.mnt_flags & MNT_LOCKED) { |
2677 |
++ /* Both unbindable and locked. */ |
2678 |
++ q = ERR_PTR(-EPERM); |
2679 |
++ goto out; |
2680 |
++ } else { |
2681 |
++ s = skip_mnt_tree(s); |
2682 |
++ continue; |
2683 |
++ } |
2684 |
+ } |
2685 |
+ if (!(flag & CL_COPY_MNT_NS_FILE) && |
2686 |
+ is_mnt_ns_file(s->mnt.mnt_root)) { |
2687 |
+@@ -1862,7 +1874,7 @@ void drop_collected_mounts(struct vfsmount *mnt) |
2688 |
+ { |
2689 |
+ namespace_lock(); |
2690 |
+ lock_mount_hash(); |
2691 |
+- umount_tree(real_mount(mnt), UMOUNT_SYNC); |
2692 |
++ umount_tree(real_mount(mnt), 0); |
2693 |
+ unlock_mount_hash(); |
2694 |
+ namespace_unlock(); |
2695 |
+ } |
2696 |
+diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c |
2697 |
+index 6d16399a350e..ee765abad2ef 100644 |
2698 |
+--- a/fs/nfsd/nfs4proc.c |
2699 |
++++ b/fs/nfsd/nfs4proc.c |
2700 |
+@@ -1049,6 +1049,9 @@ nfsd4_verify_copy(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, |
2701 |
+ { |
2702 |
+ __be32 status; |
2703 |
+ |
2704 |
++ if (!cstate->save_fh.fh_dentry) |
2705 |
++ return nfserr_nofilehandle; |
2706 |
++ |
2707 |
+ status = nfs4_preprocess_stateid_op(rqstp, cstate, &cstate->save_fh, |
2708 |
+ src_stateid, RD_STATE, src, NULL); |
2709 |
+ if (status) { |
2710 |
+diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c |
2711 |
+index d1516327b787..99550f4bd159 100644 |
2712 |
+--- a/fs/ocfs2/aops.c |
2713 |
++++ b/fs/ocfs2/aops.c |
2714 |
+@@ -2404,8 +2404,16 @@ static int ocfs2_dio_end_io(struct kiocb *iocb, |
2715 |
+ /* this io's submitter should not have unlocked this before we could */ |
2716 |
+ BUG_ON(!ocfs2_iocb_is_rw_locked(iocb)); |
2717 |
+ |
2718 |
+- if (bytes > 0 && private) |
2719 |
+- ret = ocfs2_dio_end_io_write(inode, private, offset, bytes); |
2720 |
++ if (bytes <= 0) |
2721 |
++ mlog_ratelimited(ML_ERROR, "Direct IO failed, bytes = %lld", |
2722 |
++ (long long)bytes); |
2723 |
++ if (private) { |
2724 |
++ if (bytes > 0) |
2725 |
++ ret = ocfs2_dio_end_io_write(inode, private, offset, |
2726 |
++ bytes); |
2727 |
++ else |
2728 |
++ ocfs2_dio_free_write_ctx(inode, private); |
2729 |
++ } |
2730 |
+ |
2731 |
+ ocfs2_iocb_clear_rw_locked(iocb); |
2732 |
+ |
2733 |
+diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h |
2734 |
+index 308ea0eb35fd..a396096a5099 100644 |
2735 |
+--- a/fs/ocfs2/cluster/masklog.h |
2736 |
++++ b/fs/ocfs2/cluster/masklog.h |
2737 |
+@@ -178,6 +178,15 @@ do { \ |
2738 |
+ ##__VA_ARGS__); \ |
2739 |
+ } while (0) |
2740 |
+ |
2741 |
++#define mlog_ratelimited(mask, fmt, ...) \ |
2742 |
++do { \ |
2743 |
++ static DEFINE_RATELIMIT_STATE(_rs, \ |
2744 |
++ DEFAULT_RATELIMIT_INTERVAL, \ |
2745 |
++ DEFAULT_RATELIMIT_BURST); \ |
2746 |
++ if (__ratelimit(&_rs)) \ |
2747 |
++ mlog(mask, fmt, ##__VA_ARGS__); \ |
2748 |
++} while (0) |
2749 |
++ |
2750 |
+ #define mlog_errno(st) ({ \ |
2751 |
+ int _st = (st); \ |
2752 |
+ if (_st != -ERESTARTSYS && _st != -EINTR && \ |
2753 |
+diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c |
2754 |
+index febe6312ceff..3c26f2dfedf1 100644 |
2755 |
+--- a/fs/ocfs2/dir.c |
2756 |
++++ b/fs/ocfs2/dir.c |
2757 |
+@@ -1896,8 +1896,7 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode, |
2758 |
+ /* On error, skip the f_pos to the |
2759 |
+ next block. */ |
2760 |
+ ctx->pos = (ctx->pos | (sb->s_blocksize - 1)) + 1; |
2761 |
+- brelse(bh); |
2762 |
+- continue; |
2763 |
++ break; |
2764 |
+ } |
2765 |
+ if (le64_to_cpu(de->inode)) { |
2766 |
+ unsigned char d_type = DT_UNKNOWN; |
2767 |
+diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c |
2768 |
+index cc961a3bd3bd..ef11fa7b869e 100644 |
2769 |
+--- a/fs/overlayfs/dir.c |
2770 |
++++ b/fs/overlayfs/dir.c |
2771 |
+@@ -392,6 +392,10 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, |
2772 |
+ if (IS_ERR(upper)) |
2773 |
+ goto out_dput; |
2774 |
+ |
2775 |
++ err = -ESTALE; |
2776 |
++ if (d_is_negative(upper) || !IS_WHITEOUT(d_inode(upper))) |
2777 |
++ goto out_dput2; |
2778 |
++ |
2779 |
+ err = ovl_create_real(wdir, newdentry, cattr, hardlink, true); |
2780 |
+ if (err) |
2781 |
+ goto out_dput2; |
2782 |
+@@ -595,6 +599,11 @@ static int ovl_link(struct dentry *old, struct inode *newdir, |
2783 |
+ if (err) |
2784 |
+ goto out_drop_write; |
2785 |
+ |
2786 |
++ err = ovl_copy_up(new->d_parent); |
2787 |
++ if (err) |
2788 |
++ goto out_drop_write; |
2789 |
++ |
2790 |
++ |
2791 |
+ err = ovl_nlink_start(old, &locked); |
2792 |
+ if (err) |
2793 |
+ goto out_drop_write; |
2794 |
+diff --git a/fs/overlayfs/namei.c b/fs/overlayfs/namei.c |
2795 |
+index d9468de3c951..8442f9839c90 100644 |
2796 |
+--- a/fs/overlayfs/namei.c |
2797 |
++++ b/fs/overlayfs/namei.c |
2798 |
+@@ -368,8 +368,10 @@ int ovl_verify_origin(struct dentry *dentry, struct vfsmount *mnt, |
2799 |
+ |
2800 |
+ fh = ovl_encode_fh(origin, is_upper); |
2801 |
+ err = PTR_ERR(fh); |
2802 |
+- if (IS_ERR(fh)) |
2803 |
++ if (IS_ERR(fh)) { |
2804 |
++ fh = NULL; |
2805 |
+ goto fail; |
2806 |
++ } |
2807 |
+ |
2808 |
+ err = ovl_verify_origin_fh(dentry, fh); |
2809 |
+ if (set && err == -ENODATA) |
2810 |
+diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h |
2811 |
+index c2ec44cf5098..d3b04f9589a9 100644 |
2812 |
+--- a/include/linux/ceph/libceph.h |
2813 |
++++ b/include/linux/ceph/libceph.h |
2814 |
+@@ -81,7 +81,13 @@ struct ceph_options { |
2815 |
+ |
2816 |
+ #define CEPH_MSG_MAX_FRONT_LEN (16*1024*1024) |
2817 |
+ #define CEPH_MSG_MAX_MIDDLE_LEN (16*1024*1024) |
2818 |
+-#define CEPH_MSG_MAX_DATA_LEN (16*1024*1024) |
2819 |
++ |
2820 |
++/* |
2821 |
++ * Handle the largest possible rbd object in one message. |
2822 |
++ * There is no limit on the size of cephfs objects, but it has to obey |
2823 |
++ * rsize and wsize mount options anyway. |
2824 |
++ */ |
2825 |
++#define CEPH_MSG_MAX_DATA_LEN (32*1024*1024) |
2826 |
+ |
2827 |
+ #define CEPH_AUTH_NAME_DEFAULT "guest" |
2828 |
+ |
2829 |
+diff --git a/include/linux/i8253.h b/include/linux/i8253.h |
2830 |
+index e6bb36a97519..8336b2f6f834 100644 |
2831 |
+--- a/include/linux/i8253.h |
2832 |
++++ b/include/linux/i8253.h |
2833 |
+@@ -21,6 +21,7 @@ |
2834 |
+ #define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ) |
2835 |
+ |
2836 |
+ extern raw_spinlock_t i8253_lock; |
2837 |
++extern bool i8253_clear_counter_on_shutdown; |
2838 |
+ extern struct clock_event_device i8253_clockevent; |
2839 |
+ extern void clockevent_i8253_init(bool oneshot); |
2840 |
+ |
2841 |
+diff --git a/include/linux/nmi.h b/include/linux/nmi.h |
2842 |
+index b8d868d23e79..50d143995338 100644 |
2843 |
+--- a/include/linux/nmi.h |
2844 |
++++ b/include/linux/nmi.h |
2845 |
+@@ -113,6 +113,8 @@ static inline int hardlockup_detector_perf_init(void) { return 0; } |
2846 |
+ void watchdog_nmi_stop(void); |
2847 |
+ void watchdog_nmi_start(void); |
2848 |
+ int watchdog_nmi_probe(void); |
2849 |
++int watchdog_nmi_enable(unsigned int cpu); |
2850 |
++void watchdog_nmi_disable(unsigned int cpu); |
2851 |
+ |
2852 |
+ /** |
2853 |
+ * touch_nmi_watchdog - restart NMI watchdog timeout. |
2854 |
+diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h |
2855 |
+index a95e65ec83c3..8d3786f290d9 100644 |
2856 |
+--- a/include/xen/xen-ops.h |
2857 |
++++ b/include/xen/xen-ops.h |
2858 |
+@@ -40,7 +40,7 @@ int xen_setup_shutdown_event(void); |
2859 |
+ |
2860 |
+ extern unsigned long *xen_contiguous_bitmap; |
2861 |
+ |
2862 |
+-#ifdef CONFIG_XEN_PV |
2863 |
++#if defined(CONFIG_XEN_PV) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) |
2864 |
+ int xen_create_contiguous_region(phys_addr_t pstart, unsigned int order, |
2865 |
+ unsigned int address_bits, |
2866 |
+ dma_addr_t *dma_handle); |
2867 |
+diff --git a/kernel/debug/kdb/kdb_bt.c b/kernel/debug/kdb/kdb_bt.c |
2868 |
+index 6ad4a9fcbd6f..7921ae4fca8d 100644 |
2869 |
+--- a/kernel/debug/kdb/kdb_bt.c |
2870 |
++++ b/kernel/debug/kdb/kdb_bt.c |
2871 |
+@@ -179,14 +179,14 @@ kdb_bt(int argc, const char **argv) |
2872 |
+ kdb_printf("no process for cpu %ld\n", cpu); |
2873 |
+ return 0; |
2874 |
+ } |
2875 |
+- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); |
2876 |
++ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); |
2877 |
+ kdb_parse(buf); |
2878 |
+ return 0; |
2879 |
+ } |
2880 |
+ kdb_printf("btc: cpu status: "); |
2881 |
+ kdb_parse("cpu\n"); |
2882 |
+ for_each_online_cpu(cpu) { |
2883 |
+- sprintf(buf, "btt 0x%p\n", KDB_TSK(cpu)); |
2884 |
++ sprintf(buf, "btt 0x%px\n", KDB_TSK(cpu)); |
2885 |
+ kdb_parse(buf); |
2886 |
+ touch_nmi_watchdog(); |
2887 |
+ } |
2888 |
+diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c |
2889 |
+index 07aefa8dbee8..993db6b2348e 100644 |
2890 |
+--- a/kernel/debug/kdb/kdb_main.c |
2891 |
++++ b/kernel/debug/kdb/kdb_main.c |
2892 |
+@@ -1182,7 +1182,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, |
2893 |
+ if (reason == KDB_REASON_DEBUG) { |
2894 |
+ /* special case below */ |
2895 |
+ } else { |
2896 |
+- kdb_printf("\nEntering kdb (current=0x%p, pid %d) ", |
2897 |
++ kdb_printf("\nEntering kdb (current=0x%px, pid %d) ", |
2898 |
+ kdb_current, kdb_current ? kdb_current->pid : 0); |
2899 |
+ #if defined(CONFIG_SMP) |
2900 |
+ kdb_printf("on processor %d ", raw_smp_processor_id()); |
2901 |
+@@ -1198,7 +1198,7 @@ static int kdb_local(kdb_reason_t reason, int error, struct pt_regs *regs, |
2902 |
+ */ |
2903 |
+ switch (db_result) { |
2904 |
+ case KDB_DB_BPT: |
2905 |
+- kdb_printf("\nEntering kdb (0x%p, pid %d) ", |
2906 |
++ kdb_printf("\nEntering kdb (0x%px, pid %d) ", |
2907 |
+ kdb_current, kdb_current->pid); |
2908 |
+ #if defined(CONFIG_SMP) |
2909 |
+ kdb_printf("on processor %d ", raw_smp_processor_id()); |
2910 |
+@@ -2037,7 +2037,7 @@ static int kdb_lsmod(int argc, const char **argv) |
2911 |
+ if (mod->state == MODULE_STATE_UNFORMED) |
2912 |
+ continue; |
2913 |
+ |
2914 |
+- kdb_printf("%-20s%8u 0x%p ", mod->name, |
2915 |
++ kdb_printf("%-20s%8u 0x%px ", mod->name, |
2916 |
+ mod->core_layout.size, (void *)mod); |
2917 |
+ #ifdef CONFIG_MODULE_UNLOAD |
2918 |
+ kdb_printf("%4d ", module_refcount(mod)); |
2919 |
+@@ -2048,7 +2048,7 @@ static int kdb_lsmod(int argc, const char **argv) |
2920 |
+ kdb_printf(" (Loading)"); |
2921 |
+ else |
2922 |
+ kdb_printf(" (Live)"); |
2923 |
+- kdb_printf(" 0x%p", mod->core_layout.base); |
2924 |
++ kdb_printf(" 0x%px", mod->core_layout.base); |
2925 |
+ |
2926 |
+ #ifdef CONFIG_MODULE_UNLOAD |
2927 |
+ { |
2928 |
+@@ -2330,7 +2330,7 @@ void kdb_ps1(const struct task_struct *p) |
2929 |
+ return; |
2930 |
+ |
2931 |
+ cpu = kdb_process_cpu(p); |
2932 |
+- kdb_printf("0x%p %8d %8d %d %4d %c 0x%p %c%s\n", |
2933 |
++ kdb_printf("0x%px %8d %8d %d %4d %c 0x%px %c%s\n", |
2934 |
+ (void *)p, p->pid, p->parent->pid, |
2935 |
+ kdb_task_has_cpu(p), kdb_process_cpu(p), |
2936 |
+ kdb_task_state_char(p), |
2937 |
+@@ -2343,7 +2343,7 @@ void kdb_ps1(const struct task_struct *p) |
2938 |
+ } else { |
2939 |
+ if (KDB_TSK(cpu) != p) |
2940 |
+ kdb_printf(" Error: does not match running " |
2941 |
+- "process table (0x%p)\n", KDB_TSK(cpu)); |
2942 |
++ "process table (0x%px)\n", KDB_TSK(cpu)); |
2943 |
+ } |
2944 |
+ } |
2945 |
+ } |
2946 |
+@@ -2722,7 +2722,7 @@ int kdb_register_flags(char *cmd, |
2947 |
+ for_each_kdbcmd(kp, i) { |
2948 |
+ if (kp->cmd_name && (strcmp(kp->cmd_name, cmd) == 0)) { |
2949 |
+ kdb_printf("Duplicate kdb command registered: " |
2950 |
+- "%s, func %p help %s\n", cmd, func, help); |
2951 |
++ "%s, func %px help %s\n", cmd, func, help); |
2952 |
+ return 1; |
2953 |
+ } |
2954 |
+ } |
2955 |
+diff --git a/kernel/debug/kdb/kdb_support.c b/kernel/debug/kdb/kdb_support.c |
2956 |
+index d35cc2d3a4cc..84422d2b95c0 100644 |
2957 |
+--- a/kernel/debug/kdb/kdb_support.c |
2958 |
++++ b/kernel/debug/kdb/kdb_support.c |
2959 |
+@@ -40,7 +40,7 @@ |
2960 |
+ int kdbgetsymval(const char *symname, kdb_symtab_t *symtab) |
2961 |
+ { |
2962 |
+ if (KDB_DEBUG(AR)) |
2963 |
+- kdb_printf("kdbgetsymval: symname=%s, symtab=%p\n", symname, |
2964 |
++ kdb_printf("kdbgetsymval: symname=%s, symtab=%px\n", symname, |
2965 |
+ symtab); |
2966 |
+ memset(symtab, 0, sizeof(*symtab)); |
2967 |
+ symtab->sym_start = kallsyms_lookup_name(symname); |
2968 |
+@@ -88,7 +88,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) |
2969 |
+ char *knt1 = NULL; |
2970 |
+ |
2971 |
+ if (KDB_DEBUG(AR)) |
2972 |
+- kdb_printf("kdbnearsym: addr=0x%lx, symtab=%p\n", addr, symtab); |
2973 |
++ kdb_printf("kdbnearsym: addr=0x%lx, symtab=%px\n", addr, symtab); |
2974 |
+ memset(symtab, 0, sizeof(*symtab)); |
2975 |
+ |
2976 |
+ if (addr < 4096) |
2977 |
+@@ -149,7 +149,7 @@ int kdbnearsym(unsigned long addr, kdb_symtab_t *symtab) |
2978 |
+ symtab->mod_name = "kernel"; |
2979 |
+ if (KDB_DEBUG(AR)) |
2980 |
+ kdb_printf("kdbnearsym: returns %d symtab->sym_start=0x%lx, " |
2981 |
+- "symtab->mod_name=%p, symtab->sym_name=%p (%s)\n", ret, |
2982 |
++ "symtab->mod_name=%px, symtab->sym_name=%px (%s)\n", ret, |
2983 |
+ symtab->sym_start, symtab->mod_name, symtab->sym_name, |
2984 |
+ symtab->sym_name); |
2985 |
+ |
2986 |
+@@ -887,13 +887,13 @@ void debug_kusage(void) |
2987 |
+ __func__, dah_first); |
2988 |
+ if (dah_first) { |
2989 |
+ h_used = (struct debug_alloc_header *)debug_alloc_pool; |
2990 |
+- kdb_printf("%s: h_used %p size %d\n", __func__, h_used, |
2991 |
++ kdb_printf("%s: h_used %px size %d\n", __func__, h_used, |
2992 |
+ h_used->size); |
2993 |
+ } |
2994 |
+ do { |
2995 |
+ h_used = (struct debug_alloc_header *) |
2996 |
+ ((char *)h_free + dah_overhead + h_free->size); |
2997 |
+- kdb_printf("%s: h_used %p size %d caller %p\n", |
2998 |
++ kdb_printf("%s: h_used %px size %d caller %px\n", |
2999 |
+ __func__, h_used, h_used->size, h_used->caller); |
3000 |
+ h_free = (struct debug_alloc_header *) |
3001 |
+ (debug_alloc_pool + h_free->next); |
3002 |
+@@ -902,7 +902,7 @@ void debug_kusage(void) |
3003 |
+ ((char *)h_free + dah_overhead + h_free->size); |
3004 |
+ if ((char *)h_used - debug_alloc_pool != |
3005 |
+ sizeof(debug_alloc_pool_aligned)) |
3006 |
+- kdb_printf("%s: h_used %p size %d caller %p\n", |
3007 |
++ kdb_printf("%s: h_used %px size %d caller %px\n", |
3008 |
+ __func__, h_used, h_used->size, h_used->caller); |
3009 |
+ out: |
3010 |
+ spin_unlock(&dap_lock); |
3011 |
+diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c |
3012 |
+index 7161312593dd..a9cf2e15f6a3 100644 |
3013 |
+--- a/kernel/printk/printk.c |
3014 |
++++ b/kernel/printk/printk.c |
3015 |
+@@ -1762,6 +1762,12 @@ asmlinkage int vprintk_emit(int facility, int level, |
3016 |
+ |
3017 |
+ /* If called from the scheduler, we can not call up(). */ |
3018 |
+ if (!in_sched) { |
3019 |
++ /* |
3020 |
++ * Disable preemption to avoid being preempted while holding |
3021 |
++ * console_sem which would prevent anyone from printing to |
3022 |
++ * console |
3023 |
++ */ |
3024 |
++ preempt_disable(); |
3025 |
+ /* |
3026 |
+ * Try to acquire and then immediately release the console |
3027 |
+ * semaphore. The release will print out buffers and wake up |
3028 |
+@@ -1769,6 +1775,7 @@ asmlinkage int vprintk_emit(int facility, int level, |
3029 |
+ */ |
3030 |
+ if (console_trylock()) |
3031 |
+ console_unlock(); |
3032 |
++ preempt_enable(); |
3033 |
+ } |
3034 |
+ |
3035 |
+ return printed_len; |
3036 |
+@@ -2083,20 +2090,7 @@ int console_trylock(void) |
3037 |
+ return 0; |
3038 |
+ } |
3039 |
+ console_locked = 1; |
3040 |
+- /* |
3041 |
+- * When PREEMPT_COUNT disabled we can't reliably detect if it's |
3042 |
+- * safe to schedule (e.g. calling printk while holding a spin_lock), |
3043 |
+- * because preempt_disable()/preempt_enable() are just barriers there |
3044 |
+- * and preempt_count() is always 0. |
3045 |
+- * |
3046 |
+- * RCU read sections have a separate preemption counter when |
3047 |
+- * PREEMPT_RCU enabled thus we must take extra care and check |
3048 |
+- * rcu_preempt_depth(), otherwise RCU read sections modify |
3049 |
+- * preempt_count(). |
3050 |
+- */ |
3051 |
+- console_may_schedule = !oops_in_progress && |
3052 |
+- preemptible() && |
3053 |
+- !rcu_preempt_depth(); |
3054 |
++ console_may_schedule = 0; |
3055 |
+ return 1; |
3056 |
+ } |
3057 |
+ EXPORT_SYMBOL(console_trylock); |
3058 |
+diff --git a/lib/ubsan.c b/lib/ubsan.c |
3059 |
+index 50d1d5c25deb..60e108c5c173 100644 |
3060 |
+--- a/lib/ubsan.c |
3061 |
++++ b/lib/ubsan.c |
3062 |
+@@ -451,8 +451,7 @@ void __ubsan_handle_shift_out_of_bounds(struct shift_out_of_bounds_data *data, |
3063 |
+ EXPORT_SYMBOL(__ubsan_handle_shift_out_of_bounds); |
3064 |
+ |
3065 |
+ |
3066 |
+-void __noreturn |
3067 |
+-__ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
3068 |
++void __ubsan_handle_builtin_unreachable(struct unreachable_data *data) |
3069 |
+ { |
3070 |
+ unsigned long flags; |
3071 |
+ |
3072 |
+diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
3073 |
+index e073099083ca..f46040aed2da 100644 |
3074 |
+--- a/mm/hugetlb.c |
3075 |
++++ b/mm/hugetlb.c |
3076 |
+@@ -3211,7 +3211,7 @@ static int is_hugetlb_entry_hwpoisoned(pte_t pte) |
3077 |
+ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
3078 |
+ struct vm_area_struct *vma) |
3079 |
+ { |
3080 |
+- pte_t *src_pte, *dst_pte, entry; |
3081 |
++ pte_t *src_pte, *dst_pte, entry, dst_entry; |
3082 |
+ struct page *ptepage; |
3083 |
+ unsigned long addr; |
3084 |
+ int cow; |
3085 |
+@@ -3239,15 +3239,30 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
3086 |
+ break; |
3087 |
+ } |
3088 |
+ |
3089 |
+- /* If the pagetables are shared don't copy or take references */ |
3090 |
+- if (dst_pte == src_pte) |
3091 |
++ /* |
3092 |
++ * If the pagetables are shared don't copy or take references. |
3093 |
++ * dst_pte == src_pte is the common case of src/dest sharing. |
3094 |
++ * |
3095 |
++ * However, src could have 'unshared' and dst shares with |
3096 |
++ * another vma. If dst_pte !none, this implies sharing. |
3097 |
++ * Check here before taking page table lock, and once again |
3098 |
++ * after taking the lock below. |
3099 |
++ */ |
3100 |
++ dst_entry = huge_ptep_get(dst_pte); |
3101 |
++ if ((dst_pte == src_pte) || !huge_pte_none(dst_entry)) |
3102 |
+ continue; |
3103 |
+ |
3104 |
+ dst_ptl = huge_pte_lock(h, dst, dst_pte); |
3105 |
+ src_ptl = huge_pte_lockptr(h, src, src_pte); |
3106 |
+ spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); |
3107 |
+ entry = huge_ptep_get(src_pte); |
3108 |
+- if (huge_pte_none(entry)) { /* skip none entry */ |
3109 |
++ dst_entry = huge_ptep_get(dst_pte); |
3110 |
++ if (huge_pte_none(entry) || !huge_pte_none(dst_entry)) { |
3111 |
++ /* |
3112 |
++ * Skip if src entry none. Also, skip in the |
3113 |
++ * unlikely case dst entry !none as this implies |
3114 |
++ * sharing with another vma. |
3115 |
++ */ |
3116 |
+ ; |
3117 |
+ } else if (unlikely(is_hugetlb_entry_migration(entry) || |
3118 |
+ is_hugetlb_entry_hwpoisoned(entry))) { |
3119 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
3120 |
+index ecbda7f5d494..1b93535d875f 100644 |
3121 |
+--- a/mm/mempolicy.c |
3122 |
++++ b/mm/mempolicy.c |
3123 |
+@@ -2012,8 +2012,36 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, |
3124 |
+ nmask = policy_nodemask(gfp, pol); |
3125 |
+ if (!nmask || node_isset(hpage_node, *nmask)) { |
3126 |
+ mpol_cond_put(pol); |
3127 |
+- page = __alloc_pages_node(hpage_node, |
3128 |
+- gfp | __GFP_THISNODE, order); |
3129 |
++ /* |
3130 |
++ * We cannot invoke reclaim if __GFP_THISNODE |
3131 |
++ * is set. Invoking reclaim with |
3132 |
++ * __GFP_THISNODE set, would cause THP |
3133 |
++ * allocations to trigger heavy swapping |
3134 |
++ * despite there may be tons of free memory |
3135 |
++ * (including potentially plenty of THP |
3136 |
++ * already available in the buddy) on all the |
3137 |
++ * other NUMA nodes. |
3138 |
++ * |
3139 |
++ * At most we could invoke compaction when |
3140 |
++ * __GFP_THISNODE is set (but we would need to |
3141 |
++ * refrain from invoking reclaim even if |
3142 |
++ * compaction returned COMPACT_SKIPPED because |
3143 |
++ * there wasn't not enough memory to succeed |
3144 |
++ * compaction). For now just avoid |
3145 |
++ * __GFP_THISNODE instead of limiting the |
3146 |
++ * allocation path to a strict and single |
3147 |
++ * compaction invocation. |
3148 |
++ * |
3149 |
++ * Supposedly if direct reclaim was enabled by |
3150 |
++ * the caller, the app prefers THP regardless |
3151 |
++ * of the node it comes from so this would be |
3152 |
++ * more desiderable behavior than only |
3153 |
++ * providing THP originated from the local |
3154 |
++ * node in such case. |
3155 |
++ */ |
3156 |
++ if (!(gfp & __GFP_DIRECT_RECLAIM)) |
3157 |
++ gfp |= __GFP_THISNODE; |
3158 |
++ page = __alloc_pages_node(hpage_node, gfp, order); |
3159 |
+ goto out; |
3160 |
+ } |
3161 |
+ } |
3162 |
+diff --git a/mm/swapfile.c b/mm/swapfile.c |
3163 |
+index 8cbc7d6fd52e..08e8cd21770c 100644 |
3164 |
+--- a/mm/swapfile.c |
3165 |
++++ b/mm/swapfile.c |
3166 |
+@@ -2830,7 +2830,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
3167 |
+ unsigned int type; |
3168 |
+ int i; |
3169 |
+ |
3170 |
+- p = kzalloc(sizeof(*p), GFP_KERNEL); |
3171 |
++ p = kvzalloc(sizeof(*p), GFP_KERNEL); |
3172 |
+ if (!p) |
3173 |
+ return ERR_PTR(-ENOMEM); |
3174 |
+ |
3175 |
+@@ -2841,7 +2841,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
3176 |
+ } |
3177 |
+ if (type >= MAX_SWAPFILES) { |
3178 |
+ spin_unlock(&swap_lock); |
3179 |
+- kfree(p); |
3180 |
++ kvfree(p); |
3181 |
+ return ERR_PTR(-EPERM); |
3182 |
+ } |
3183 |
+ if (type >= nr_swapfiles) { |
3184 |
+@@ -2855,7 +2855,7 @@ static struct swap_info_struct *alloc_swap_info(void) |
3185 |
+ smp_wmb(); |
3186 |
+ nr_swapfiles++; |
3187 |
+ } else { |
3188 |
+- kfree(p); |
3189 |
++ kvfree(p); |
3190 |
+ p = swap_info[type]; |
3191 |
+ /* |
3192 |
+ * Do not memset this entry: a racing procfs swap_next() |
3193 |
+diff --git a/net/9p/protocol.c b/net/9p/protocol.c |
3194 |
+index 16e10680518c..9743837aebc6 100644 |
3195 |
+--- a/net/9p/protocol.c |
3196 |
++++ b/net/9p/protocol.c |
3197 |
+@@ -46,10 +46,15 @@ p9pdu_writef(struct p9_fcall *pdu, int proto_version, const char *fmt, ...); |
3198 |
+ void p9stat_free(struct p9_wstat *stbuf) |
3199 |
+ { |
3200 |
+ kfree(stbuf->name); |
3201 |
++ stbuf->name = NULL; |
3202 |
+ kfree(stbuf->uid); |
3203 |
++ stbuf->uid = NULL; |
3204 |
+ kfree(stbuf->gid); |
3205 |
++ stbuf->gid = NULL; |
3206 |
+ kfree(stbuf->muid); |
3207 |
++ stbuf->muid = NULL; |
3208 |
+ kfree(stbuf->extension); |
3209 |
++ stbuf->extension = NULL; |
3210 |
+ } |
3211 |
+ EXPORT_SYMBOL(p9stat_free); |
3212 |
+ |
3213 |
+diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
3214 |
+index a268acc48af0..b793b55d1488 100644 |
3215 |
+--- a/net/netfilter/nf_conntrack_core.c |
3216 |
++++ b/net/netfilter/nf_conntrack_core.c |
3217 |
+@@ -932,19 +932,22 @@ static unsigned int early_drop_list(struct net *net, |
3218 |
+ return drops; |
3219 |
+ } |
3220 |
+ |
3221 |
+-static noinline int early_drop(struct net *net, unsigned int _hash) |
3222 |
++static noinline int early_drop(struct net *net, unsigned int hash) |
3223 |
+ { |
3224 |
+- unsigned int i; |
3225 |
++ unsigned int i, bucket; |
3226 |
+ |
3227 |
+ for (i = 0; i < NF_CT_EVICTION_RANGE; i++) { |
3228 |
+ struct hlist_nulls_head *ct_hash; |
3229 |
+- unsigned int hash, hsize, drops; |
3230 |
++ unsigned int hsize, drops; |
3231 |
+ |
3232 |
+ rcu_read_lock(); |
3233 |
+ nf_conntrack_get_ht(&ct_hash, &hsize); |
3234 |
+- hash = reciprocal_scale(_hash++, hsize); |
3235 |
++ if (!i) |
3236 |
++ bucket = reciprocal_scale(hash, hsize); |
3237 |
++ else |
3238 |
++ bucket = (bucket + 1) % hsize; |
3239 |
+ |
3240 |
+- drops = early_drop_list(net, &ct_hash[hash]); |
3241 |
++ drops = early_drop_list(net, &ct_hash[bucket]); |
3242 |
+ rcu_read_unlock(); |
3243 |
+ |
3244 |
+ if (drops) { |
3245 |
+diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c |
3246 |
+index e34f4ee7f2b6..13695ba8fc54 100644 |
3247 |
+--- a/net/sunrpc/xdr.c |
3248 |
++++ b/net/sunrpc/xdr.c |
3249 |
+@@ -639,11 +639,10 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len) |
3250 |
+ WARN_ON_ONCE(xdr->iov); |
3251 |
+ return; |
3252 |
+ } |
3253 |
+- if (fraglen) { |
3254 |
++ if (fraglen) |
3255 |
+ xdr->end = head->iov_base + head->iov_len; |
3256 |
+- xdr->page_ptr--; |
3257 |
+- } |
3258 |
+ /* (otherwise assume xdr->end is already set) */ |
3259 |
++ xdr->page_ptr--; |
3260 |
+ head->iov_len = len; |
3261 |
+ buf->len = len; |
3262 |
+ xdr->p = head->iov_base + head->iov_len; |
3263 |
+diff --git a/tools/testing/selftests/powerpc/tm/tm-tmspr.c b/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
3264 |
+index 2bda81c7bf23..df1d7d4b1c89 100644 |
3265 |
+--- a/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
3266 |
++++ b/tools/testing/selftests/powerpc/tm/tm-tmspr.c |
3267 |
+@@ -98,7 +98,7 @@ void texasr(void *in) |
3268 |
+ |
3269 |
+ int test_tmspr() |
3270 |
+ { |
3271 |
+- pthread_t thread; |
3272 |
++ pthread_t *thread; |
3273 |
+ int thread_num; |
3274 |
+ unsigned long i; |
3275 |
+ |
3276 |
+@@ -107,21 +107,28 @@ int test_tmspr() |
3277 |
+ /* To cause some context switching */ |
3278 |
+ thread_num = 10 * sysconf(_SC_NPROCESSORS_ONLN); |
3279 |
+ |
3280 |
++ thread = malloc(thread_num * sizeof(pthread_t)); |
3281 |
++ if (thread == NULL) |
3282 |
++ return EXIT_FAILURE; |
3283 |
++ |
3284 |
+ /* Test TFIAR and TFHAR */ |
3285 |
+- for (i = 0 ; i < thread_num ; i += 2){ |
3286 |
+- if (pthread_create(&thread, NULL, (void*)tfiar_tfhar, (void *)i)) |
3287 |
++ for (i = 0; i < thread_num; i += 2) { |
3288 |
++ if (pthread_create(&thread[i], NULL, (void *)tfiar_tfhar, |
3289 |
++ (void *)i)) |
3290 |
+ return EXIT_FAILURE; |
3291 |
+ } |
3292 |
+- if (pthread_join(thread, NULL) != 0) |
3293 |
+- return EXIT_FAILURE; |
3294 |
+- |
3295 |
+ /* Test TEXASR */ |
3296 |
+- for (i = 0 ; i < thread_num ; i++){ |
3297 |
+- if (pthread_create(&thread, NULL, (void*)texasr, (void *)i)) |
3298 |
++ for (i = 1; i < thread_num; i += 2) { |
3299 |
++ if (pthread_create(&thread[i], NULL, (void *)texasr, (void *)i)) |
3300 |
+ return EXIT_FAILURE; |
3301 |
+ } |
3302 |
+- if (pthread_join(thread, NULL) != 0) |
3303 |
+- return EXIT_FAILURE; |
3304 |
++ |
3305 |
++ for (i = 0; i < thread_num; i++) { |
3306 |
++ if (pthread_join(thread[i], NULL) != 0) |
3307 |
++ return EXIT_FAILURE; |
3308 |
++ } |
3309 |
++ |
3310 |
++ free(thread); |
3311 |
+ |
3312 |
+ if (passed) |
3313 |
+ return 0; |