1 |
commit: 94cda39085c2b3fc0a23421e3e340b7e2cd59aff |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 22 11:42:43 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 22 11:42:43 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=94cda390 |
7 |
|
8 |
Linux patch 4.9.283 |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 8 + |
13 |
1282_linux-4.9.283.patch | 4551 ++++++++++++++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 4559 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 8009106..046d9e8 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -1167,6 +1167,14 @@ Patch: 1280_linux-4.9.281.patch |
21 |
From: http://www.kernel.org |
22 |
Desc: Linux 4.9.281 |
23 |
|
24 |
+Patch: 1281_linux-4.9.282.patch |
25 |
+From: http://www.kernel.org |
26 |
+Desc: Linux 4.9.282 |
27 |
+ |
28 |
+Patch: 1282_linux-4.9.283.patch |
29 |
+From: http://www.kernel.org |
30 |
+Desc: Linux 4.9.283 |
31 |
+ |
32 |
Patch: 1500_XATTR_USER_PREFIX.patch |
33 |
From: https://bugs.gentoo.org/show_bug.cgi?id=470644 |
34 |
Desc: Support for namespace user.pax.* on tmpfs. |
35 |
|
36 |
diff --git a/1282_linux-4.9.283.patch b/1282_linux-4.9.283.patch |
37 |
new file mode 100644 |
38 |
index 0000000..d068cbe |
39 |
--- /dev/null |
40 |
+++ b/1282_linux-4.9.283.patch |
41 |
@@ -0,0 +1,4551 @@ |
42 |
+diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt |
43 |
+index 174f68c26c1b2..34981b98d807c 100644 |
44 |
+--- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt |
45 |
++++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt |
46 |
+@@ -123,7 +123,7 @@ on various other factors also like; |
47 |
+ so the device should have enough free bytes available its OOB/Spare |
48 |
+ area to accommodate ECC for entire page. In general following expression |
49 |
+ helps in determining if given device can accommodate ECC syndrome: |
50 |
+- "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE" |
51 |
++ "2 + (PAGESIZE / 512) * ECC_BYTES" <= OOBSIZE" |
52 |
+ where |
53 |
+ OOBSIZE number of bytes in OOB/spare area |
54 |
+ PAGESIZE number of bytes in main-area of device page |
55 |
+diff --git a/Makefile b/Makefile |
56 |
+index ca08ef26f416b..ef029a28bb53c 100644 |
57 |
+--- a/Makefile |
58 |
++++ b/Makefile |
59 |
+@@ -1,6 +1,6 @@ |
60 |
+ VERSION = 4 |
61 |
+ PATCHLEVEL = 9 |
62 |
+-SUBLEVEL = 282 |
63 |
++SUBLEVEL = 283 |
64 |
+ EXTRAVERSION = |
65 |
+ NAME = Roaring Lionus |
66 |
+ |
67 |
+diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c |
68 |
+index fefe357c3d31a..076b5e8c8562f 100644 |
69 |
+--- a/arch/arc/mm/cache.c |
70 |
++++ b/arch/arc/mm/cache.c |
71 |
+@@ -923,7 +923,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page) |
72 |
+ clear_page(to); |
73 |
+ clear_bit(PG_dc_clean, &page->flags); |
74 |
+ } |
75 |
+- |
76 |
++EXPORT_SYMBOL(clear_user_page); |
77 |
+ |
78 |
+ /********************************************************************** |
79 |
+ * Explicit Cache flush request from user space via syscall |
80 |
+diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile |
81 |
+index 552c7d7f84ce1..2f3ba4d9683c3 100644 |
82 |
+--- a/arch/arm/boot/compressed/Makefile |
83 |
++++ b/arch/arm/boot/compressed/Makefile |
84 |
+@@ -86,6 +86,8 @@ $(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \ |
85 |
+ $(addprefix $(obj)/,$(libfdt_hdrs)) |
86 |
+ |
87 |
+ ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y) |
88 |
++CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN} |
89 |
++CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280 |
90 |
+ OBJS += $(libfdt_objs) atags_to_fdt.o |
91 |
+ endif |
92 |
+ |
93 |
+diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
94 |
+index 27d2bbbf1eae2..a613e3b85b456 100644 |
95 |
+--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi |
96 |
++++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi |
97 |
+@@ -184,8 +184,9 @@ |
98 |
+ nvidia,pins = "ata", "atb", "atc", "atd", "ate", |
99 |
+ "cdev1", "cdev2", "dap1", "dtb", "gma", |
100 |
+ "gmb", "gmc", "gmd", "gme", "gpu7", |
101 |
+- "gpv", "i2cp", "pta", "rm", "slxa", |
102 |
+- "slxk", "spia", "spib", "uac"; |
103 |
++ "gpv", "i2cp", "irrx", "irtx", "pta", |
104 |
++ "rm", "slxa", "slxk", "spia", "spib", |
105 |
++ "uac"; |
106 |
+ nvidia,pull = <TEGRA_PIN_PULL_NONE>; |
107 |
+ nvidia,tristate = <TEGRA_PIN_DISABLE>; |
108 |
+ }; |
109 |
+@@ -210,7 +211,7 @@ |
110 |
+ conf_ddc { |
111 |
+ nvidia,pins = "ddc", "dta", "dtd", "kbca", |
112 |
+ "kbcb", "kbcc", "kbcd", "kbce", "kbcf", |
113 |
+- "sdc"; |
114 |
++ "sdc", "uad", "uca"; |
115 |
+ nvidia,pull = <TEGRA_PIN_PULL_UP>; |
116 |
+ nvidia,tristate = <TEGRA_PIN_DISABLE>; |
117 |
+ }; |
118 |
+@@ -220,10 +221,9 @@ |
119 |
+ "lvp0", "owc", "sdb"; |
120 |
+ nvidia,tristate = <TEGRA_PIN_ENABLE>; |
121 |
+ }; |
122 |
+- conf_irrx { |
123 |
+- nvidia,pins = "irrx", "irtx", "sdd", "spic", |
124 |
+- "spie", "spih", "uaa", "uab", "uad", |
125 |
+- "uca", "ucb"; |
126 |
++ conf_sdd { |
127 |
++ nvidia,pins = "sdd", "spic", "spie", "spih", |
128 |
++ "uaa", "uab", "ucb"; |
129 |
+ nvidia,pull = <TEGRA_PIN_PULL_UP>; |
130 |
+ nvidia,tristate = <TEGRA_PIN_ENABLE>; |
131 |
+ }; |
132 |
+diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile |
133 |
+index adb9add28b6f3..9bddd762880cf 100644 |
134 |
+--- a/arch/arm/kernel/Makefile |
135 |
++++ b/arch/arm/kernel/Makefile |
136 |
+@@ -16,10 +16,14 @@ CFLAGS_REMOVE_return_address.o = -pg |
137 |
+ # Object file lists. |
138 |
+ |
139 |
+ obj-y := elf.o entry-common.o irq.o opcodes.o \ |
140 |
+- process.o ptrace.o reboot.o return_address.o \ |
141 |
++ process.o ptrace.o reboot.o \ |
142 |
+ setup.o signal.o sigreturn_codes.o \ |
143 |
+ stacktrace.o sys_arm.o time.o traps.o |
144 |
+ |
145 |
++ifneq ($(CONFIG_ARM_UNWIND),y) |
146 |
++obj-$(CONFIG_FRAME_POINTER) += return_address.o |
147 |
++endif |
148 |
++ |
149 |
+ obj-$(CONFIG_ATAGS) += atags_parse.o |
150 |
+ obj-$(CONFIG_ATAGS_PROC) += atags_proc.o |
151 |
+ obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o |
152 |
+diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c |
153 |
+index 36ed35073289b..f945742dea449 100644 |
154 |
+--- a/arch/arm/kernel/return_address.c |
155 |
++++ b/arch/arm/kernel/return_address.c |
156 |
+@@ -10,8 +10,6 @@ |
157 |
+ */ |
158 |
+ #include <linux/export.h> |
159 |
+ #include <linux/ftrace.h> |
160 |
+- |
161 |
+-#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) |
162 |
+ #include <linux/sched.h> |
163 |
+ |
164 |
+ #include <asm/stacktrace.h> |
165 |
+@@ -56,6 +54,4 @@ void *return_address(unsigned int level) |
166 |
+ return NULL; |
167 |
+ } |
168 |
+ |
169 |
+-#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */ |
170 |
+- |
171 |
+ EXPORT_SYMBOL_GPL(return_address); |
172 |
+diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
173 |
+index 4c7c40ce50662..1fe4d1dd50ee7 100644 |
174 |
+--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi |
175 |
++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi |
176 |
+@@ -94,7 +94,7 @@ |
177 |
+ #address-cells = <0>; |
178 |
+ interrupt-controller; |
179 |
+ reg = <0x11001000 0x1000>, |
180 |
+- <0x11002000 0x1000>, |
181 |
++ <0x11002000 0x2000>, |
182 |
+ <0x11004000 0x2000>, |
183 |
+ <0x11006000 0x2000>; |
184 |
+ }; |
185 |
+diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c |
186 |
+index a0985fd088d1c..7d695fc7a2d02 100644 |
187 |
+--- a/arch/m68k/emu/nfeth.c |
188 |
++++ b/arch/m68k/emu/nfeth.c |
189 |
+@@ -260,8 +260,8 @@ static void __exit nfeth_cleanup(void) |
190 |
+ |
191 |
+ for (i = 0; i < MAX_UNIT; i++) { |
192 |
+ if (nfeth_dev[i]) { |
193 |
+- unregister_netdev(nfeth_dev[0]); |
194 |
+- free_netdev(nfeth_dev[0]); |
195 |
++ unregister_netdev(nfeth_dev[i]); |
196 |
++ free_netdev(nfeth_dev[i]); |
197 |
+ } |
198 |
+ } |
199 |
+ free_irq(nfEtherIRQ, nfeth_interrupt); |
200 |
+diff --git a/arch/mips/mti-malta/malta-dtshim.c b/arch/mips/mti-malta/malta-dtshim.c |
201 |
+index c398582c316fc..4fc73ee2ca9da 100644 |
202 |
+--- a/arch/mips/mti-malta/malta-dtshim.c |
203 |
++++ b/arch/mips/mti-malta/malta-dtshim.c |
204 |
+@@ -26,7 +26,7 @@ |
205 |
+ #define ROCIT_CONFIG_GEN1_MEMMAP_SHIFT 8 |
206 |
+ #define ROCIT_CONFIG_GEN1_MEMMAP_MASK (0xf << 8) |
207 |
+ |
208 |
+-static unsigned char fdt_buf[16 << 10] __initdata; |
209 |
++static unsigned char fdt_buf[16 << 10] __initdata __aligned(8); |
210 |
+ |
211 |
+ /* determined physical memory size, not overridden by command line args */ |
212 |
+ extern unsigned long physical_memsize; |
213 |
+diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S |
214 |
+index 3fbe420f49c43..92cdc1e56b602 100644 |
215 |
+--- a/arch/openrisc/kernel/entry.S |
216 |
++++ b/arch/openrisc/kernel/entry.S |
217 |
+@@ -491,6 +491,7 @@ EXCEPTION_ENTRY(_external_irq_handler) |
218 |
+ l.bnf 1f // ext irq enabled, all ok. |
219 |
+ l.nop |
220 |
+ |
221 |
++#ifdef CONFIG_PRINTK |
222 |
+ l.addi r1,r1,-0x8 |
223 |
+ l.movhi r3,hi(42f) |
224 |
+ l.ori r3,r3,lo(42f) |
225 |
+@@ -504,6 +505,7 @@ EXCEPTION_ENTRY(_external_irq_handler) |
226 |
+ .string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r" |
227 |
+ .align 4 |
228 |
+ .previous |
229 |
++#endif |
230 |
+ |
231 |
+ l.ori r4,r4,SPR_SR_IEE // fix the bug |
232 |
+ // l.sw PT_SR(r1),r4 |
233 |
+diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c |
234 |
+index 2264f68f3c2f9..d9a4d6ffc0a8d 100644 |
235 |
+--- a/arch/parisc/kernel/signal.c |
236 |
++++ b/arch/parisc/kernel/signal.c |
237 |
+@@ -239,6 +239,12 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs, |
238 |
+ #endif |
239 |
+ |
240 |
+ usp = (regs->gr[30] & ~(0x01UL)); |
241 |
++#ifdef CONFIG_64BIT |
242 |
++ if (is_compat_task()) { |
243 |
++ /* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */ |
244 |
++ usp = (compat_uint_t)usp; |
245 |
++ } |
246 |
++#endif |
247 |
+ /*FIXME: frame_size parameter is unused, remove it. */ |
248 |
+ frame = get_sigframe(&ksig->ka, usp, sizeof(*frame)); |
249 |
+ |
250 |
+diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S |
251 |
+index a3550e8f1a77b..51669cdbf011e 100644 |
252 |
+--- a/arch/powerpc/boot/crt0.S |
253 |
++++ b/arch/powerpc/boot/crt0.S |
254 |
+@@ -49,9 +49,6 @@ p_end: .long _end |
255 |
+ p_pstack: .long _platform_stack_top |
256 |
+ #endif |
257 |
+ |
258 |
+- .globl _zimage_start |
259 |
+- /* Clang appears to require the .weak directive to be after the symbol |
260 |
+- * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */ |
261 |
+ .weak _zimage_start |
262 |
+ _zimage_start: |
263 |
+ .globl _zimage_start_lib |
264 |
+diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c |
265 |
+index 99407cf12ad5b..e19dadffd9b7a 100644 |
266 |
+--- a/arch/powerpc/kernel/module_64.c |
267 |
++++ b/arch/powerpc/kernel/module_64.c |
268 |
+@@ -691,7 +691,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, |
269 |
+ /* |
270 |
+ * If found, replace it with: |
271 |
+ * addis r2, r12, (.TOC.-func)@ha |
272 |
+- * addi r2, r12, (.TOC.-func)@l |
273 |
++ * addi r2, r2, (.TOC.-func)@l |
274 |
+ */ |
275 |
+ ((uint32_t *)location)[0] = 0x3c4c0000 + PPC_HA(value); |
276 |
+ ((uint32_t *)location)[1] = 0x38420000 + PPC_LO(value); |
277 |
+diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c |
278 |
+index 43fabb3cae0fa..160b86d9d8199 100644 |
279 |
+--- a/arch/powerpc/perf/hv-gpci.c |
280 |
++++ b/arch/powerpc/perf/hv-gpci.c |
281 |
+@@ -168,7 +168,7 @@ static unsigned long single_gpci_request(u32 req, u32 starting_index, |
282 |
+ */ |
283 |
+ count = 0; |
284 |
+ for (i = offset; i < offset + length; i++) |
285 |
+- count |= arg->bytes[i] << (i - offset); |
286 |
++ count |= (u64)(arg->bytes[i]) << ((length - 1 - (i - offset)) * 8); |
287 |
+ |
288 |
+ *value = count; |
289 |
+ out: |
290 |
+diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c |
291 |
+index 17b3e82415f89..7dfc0c1ce4861 100644 |
292 |
+--- a/arch/s390/kernel/dis.c |
293 |
++++ b/arch/s390/kernel/dis.c |
294 |
+@@ -2018,7 +2018,7 @@ void show_code(struct pt_regs *regs) |
295 |
+ start += opsize; |
296 |
+ pr_cont("%s", buffer); |
297 |
+ ptr = buffer; |
298 |
+- ptr += sprintf(ptr, "\n\t "); |
299 |
++ ptr += sprintf(ptr, "\n "); |
300 |
+ hops++; |
301 |
+ } |
302 |
+ pr_cont("\n"); |
303 |
+diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c |
304 |
+index 083b05f5f5ab6..cbc1877066482 100644 |
305 |
+--- a/arch/s390/kernel/jump_label.c |
306 |
++++ b/arch/s390/kernel/jump_label.c |
307 |
+@@ -43,7 +43,7 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *expected, |
308 |
+ unsigned char *ipe = (unsigned char *)expected; |
309 |
+ unsigned char *ipn = (unsigned char *)new; |
310 |
+ |
311 |
+- pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc); |
312 |
++ pr_emerg("Jump label code mismatch at %pS [%px]\n", ipc, ipc); |
313 |
+ pr_emerg("Found: %6ph\n", ipc); |
314 |
+ pr_emerg("Expected: %6ph\n", ipe); |
315 |
+ pr_emerg("New: %6ph\n", ipn); |
316 |
+diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c |
317 |
+index ed58ebab96cd8..53bb9700cf411 100644 |
318 |
+--- a/arch/s390/net/bpf_jit_comp.c |
319 |
++++ b/arch/s390/net/bpf_jit_comp.c |
320 |
+@@ -625,8 +625,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i |
321 |
+ case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */ |
322 |
+ if (!imm) |
323 |
+ break; |
324 |
+- /* agfi %dst,-imm */ |
325 |
+- EMIT6_IMM(0xc2080000, dst_reg, -imm); |
326 |
++ if (imm == -0x80000000) { |
327 |
++ /* algfi %dst,0x80000000 */ |
328 |
++ EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000); |
329 |
++ } else { |
330 |
++ /* agfi %dst,-imm */ |
331 |
++ EMIT6_IMM(0xc2080000, dst_reg, -imm); |
332 |
++ } |
333 |
+ break; |
334 |
+ /* |
335 |
+ * BPF_MUL |
336 |
+diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c |
337 |
+index f6e57bebbc6bb..5c6aad14cdd96 100644 |
338 |
+--- a/arch/x86/events/amd/ibs.c |
339 |
++++ b/arch/x86/events/amd/ibs.c |
340 |
+@@ -89,6 +89,7 @@ struct perf_ibs { |
341 |
+ unsigned long offset_mask[1]; |
342 |
+ int offset_max; |
343 |
+ unsigned int fetch_count_reset_broken : 1; |
344 |
++ unsigned int fetch_ignore_if_zero_rip : 1; |
345 |
+ struct cpu_perf_ibs __percpu *pcpu; |
346 |
+ |
347 |
+ struct attribute **format_attrs; |
348 |
+@@ -673,6 +674,10 @@ fail: |
349 |
+ if (check_rip && (ibs_data.regs[2] & IBS_RIP_INVALID)) { |
350 |
+ regs.flags &= ~PERF_EFLAGS_EXACT; |
351 |
+ } else { |
352 |
++ /* Workaround for erratum #1197 */ |
353 |
++ if (perf_ibs->fetch_ignore_if_zero_rip && !(ibs_data.regs[1])) |
354 |
++ goto out; |
355 |
++ |
356 |
+ set_linear_ip(®s, ibs_data.regs[1]); |
357 |
+ regs.flags |= PERF_EFLAGS_EXACT; |
358 |
+ } |
359 |
+@@ -766,6 +771,9 @@ static __init void perf_event_ibs_init(void) |
360 |
+ if (boot_cpu_data.x86 >= 0x16 && boot_cpu_data.x86 <= 0x18) |
361 |
+ perf_ibs_fetch.fetch_count_reset_broken = 1; |
362 |
+ |
363 |
++ if (boot_cpu_data.x86 == 0x19 && boot_cpu_data.x86_model < 0x10) |
364 |
++ perf_ibs_fetch.fetch_ignore_if_zero_rip = 1; |
365 |
++ |
366 |
+ perf_ibs_pmu_init(&perf_ibs_fetch, "ibs_fetch"); |
367 |
+ |
368 |
+ if (ibs_caps & IBS_CAPS_OPCNT) { |
369 |
+diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c |
370 |
+index 75a1fd8b0e903..77e45db89d119 100644 |
371 |
+--- a/arch/x86/kernel/reboot.c |
372 |
++++ b/arch/x86/kernel/reboot.c |
373 |
+@@ -389,10 +389,11 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { |
374 |
+ }, |
375 |
+ { /* Handle problems with rebooting on the OptiPlex 990. */ |
376 |
+ .callback = set_pci_reboot, |
377 |
+- .ident = "Dell OptiPlex 990", |
378 |
++ .ident = "Dell OptiPlex 990 BIOS A0x", |
379 |
+ .matches = { |
380 |
+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), |
381 |
+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"), |
382 |
++ DMI_MATCH(DMI_BIOS_VERSION, "A0"), |
383 |
+ }, |
384 |
+ }, |
385 |
+ { /* Handle problems with rebooting on Dell 300's */ |
386 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
387 |
+index c959720c75938..c0f7e746722d9 100644 |
388 |
+--- a/arch/x86/kvm/x86.c |
389 |
++++ b/arch/x86/kvm/x86.c |
390 |
+@@ -2315,6 +2315,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info) |
391 |
+ if (!msr_info->host_initiated) { |
392 |
+ s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr; |
393 |
+ adjust_tsc_offset_guest(vcpu, adj); |
394 |
++ /* Before back to guest, tsc_timestamp must be adjusted |
395 |
++ * as well, otherwise guest's percpu pvclock time could jump. |
396 |
++ */ |
397 |
++ kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); |
398 |
+ } |
399 |
+ vcpu->arch.ia32_tsc_adjust_msr = data; |
400 |
+ } |
401 |
+diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c |
402 |
+index d35d0e4bbf99a..bd6905ce590fa 100644 |
403 |
+--- a/arch/x86/mm/init_64.c |
404 |
++++ b/arch/x86/mm/init_64.c |
405 |
+@@ -1126,21 +1126,21 @@ int kern_addr_valid(unsigned long addr) |
406 |
+ return 0; |
407 |
+ |
408 |
+ pud = pud_offset(pgd, addr); |
409 |
+- if (pud_none(*pud)) |
410 |
++ if (!pud_present(*pud)) |
411 |
+ return 0; |
412 |
+ |
413 |
+ if (pud_large(*pud)) |
414 |
+ return pfn_valid(pud_pfn(*pud)); |
415 |
+ |
416 |
+ pmd = pmd_offset(pud, addr); |
417 |
+- if (pmd_none(*pmd)) |
418 |
++ if (!pmd_present(*pmd)) |
419 |
+ return 0; |
420 |
+ |
421 |
+ if (pmd_large(*pmd)) |
422 |
+ return pfn_valid(pmd_pfn(*pmd)); |
423 |
+ |
424 |
+ pte = pte_offset_kernel(pmd, addr); |
425 |
+- if (pte_none(*pte)) |
426 |
++ if (!pte_present(*pte)) |
427 |
+ return 0; |
428 |
+ |
429 |
+ return pfn_valid(pte_pfn(*pte)); |
430 |
+diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
431 |
+index db7cf8727e1cf..21e01fc632adb 100644 |
432 |
+--- a/arch/x86/xen/enlighten.c |
433 |
++++ b/arch/x86/xen/enlighten.c |
434 |
+@@ -1576,6 +1576,11 @@ static int xen_cpuhp_setup(void) |
435 |
+ return rc >= 0 ? 0 : rc; |
436 |
+ } |
437 |
+ |
438 |
++static void __init xen_domu_set_legacy_features(void) |
439 |
++{ |
440 |
++ x86_platform.legacy.rtc = 0; |
441 |
++} |
442 |
++ |
443 |
+ /* First C function to be called on Xen boot */ |
444 |
+ asmlinkage __visible void __init xen_start_kernel(void) |
445 |
+ { |
446 |
+@@ -1741,6 +1746,8 @@ asmlinkage __visible void __init xen_start_kernel(void) |
447 |
+ add_preferred_console("hvc", 0, NULL); |
448 |
+ if (pci_xen) |
449 |
+ x86_init.pci.arch_init = pci_xen_init; |
450 |
++ x86_platform.set_legacy_features = |
451 |
++ xen_domu_set_legacy_features; |
452 |
+ } else { |
453 |
+ const struct dom0_vga_console_info *info = |
454 |
+ (void *)((char *)xen_start_info + |
455 |
+diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c |
456 |
+index d6ed664c1e39d..3d2015011ca94 100644 |
457 |
+--- a/arch/x86/xen/p2m.c |
458 |
++++ b/arch/x86/xen/p2m.c |
459 |
+@@ -623,8 +623,8 @@ int xen_alloc_p2m_entry(unsigned long pfn) |
460 |
+ } |
461 |
+ |
462 |
+ /* Expanded the p2m? */ |
463 |
+- if (pfn > xen_p2m_last_pfn) { |
464 |
+- xen_p2m_last_pfn = pfn; |
465 |
++ if (pfn >= xen_p2m_last_pfn) { |
466 |
++ xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE); |
467 |
+ HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn; |
468 |
+ } |
469 |
+ |
470 |
+diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig |
471 |
+index f61058617ada4..ff45491c64e0e 100644 |
472 |
+--- a/arch/xtensa/Kconfig |
473 |
++++ b/arch/xtensa/Kconfig |
474 |
+@@ -17,7 +17,7 @@ config XTENSA |
475 |
+ select HAVE_DMA_API_DEBUG |
476 |
+ select HAVE_EXIT_THREAD |
477 |
+ select HAVE_FUNCTION_TRACER |
478 |
+- select HAVE_FUTEX_CMPXCHG if !MMU |
479 |
++ select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX |
480 |
+ select HAVE_HW_BREAKPOINT if PERF_EVENTS |
481 |
+ select HAVE_IRQ_TIME_ACCOUNTING |
482 |
+ select HAVE_MEMBLOCK |
483 |
+diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c |
484 |
+index c68f1e6158aa6..a2d93a7c7ff24 100644 |
485 |
+--- a/arch/xtensa/platforms/iss/console.c |
486 |
++++ b/arch/xtensa/platforms/iss/console.c |
487 |
+@@ -182,9 +182,13 @@ static const struct tty_operations serial_ops = { |
488 |
+ |
489 |
+ int __init rs_init(void) |
490 |
+ { |
491 |
+- tty_port_init(&serial_port); |
492 |
++ int ret; |
493 |
+ |
494 |
+ serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES); |
495 |
++ if (!serial_driver) |
496 |
++ return -ENOMEM; |
497 |
++ |
498 |
++ tty_port_init(&serial_port); |
499 |
+ |
500 |
+ printk ("%s %s\n", serial_name, serial_version); |
501 |
+ |
502 |
+@@ -204,8 +208,15 @@ int __init rs_init(void) |
503 |
+ tty_set_operations(serial_driver, &serial_ops); |
504 |
+ tty_port_link_device(&serial_port, serial_driver, 0); |
505 |
+ |
506 |
+- if (tty_register_driver(serial_driver)) |
507 |
+- panic("Couldn't register serial driver\n"); |
508 |
++ ret = tty_register_driver(serial_driver); |
509 |
++ if (ret) { |
510 |
++ pr_err("Couldn't register serial driver\n"); |
511 |
++ tty_driver_kref_put(serial_driver); |
512 |
++ tty_port_destroy(&serial_port); |
513 |
++ |
514 |
++ return ret; |
515 |
++ } |
516 |
++ |
517 |
+ return 0; |
518 |
+ } |
519 |
+ |
520 |
+diff --git a/certs/Makefile b/certs/Makefile |
521 |
+index 2773c4afa24c0..4417cc5cf5e89 100644 |
522 |
+--- a/certs/Makefile |
523 |
++++ b/certs/Makefile |
524 |
+@@ -39,11 +39,19 @@ endif |
525 |
+ redirect_openssl = 2>&1 |
526 |
+ quiet_redirect_openssl = 2>&1 |
527 |
+ silent_redirect_openssl = 2>/dev/null |
528 |
++openssl_available = $(shell openssl help 2>/dev/null && echo yes) |
529 |
+ |
530 |
+ # We do it this way rather than having a boolean option for enabling an |
531 |
+ # external private key, because 'make randconfig' might enable such a |
532 |
+ # boolean option and we unfortunately can't make it depend on !RANDCONFIG. |
533 |
+ ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") |
534 |
++ |
535 |
++ifeq ($(openssl_available),yes) |
536 |
++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null) |
537 |
++ |
538 |
++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem")) |
539 |
++endif |
540 |
++ |
541 |
+ $(obj)/signing_key.pem: $(obj)/x509.genkey |
542 |
+ @$(kecho) "###" |
543 |
+ @$(kecho) "### Now generating an X.509 key pair to be used for signing modules." |
544 |
+diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c |
545 |
+index 228a4cfb0e7d2..adbf0486422b8 100644 |
546 |
+--- a/drivers/ata/libata-core.c |
547 |
++++ b/drivers/ata/libata-core.c |
548 |
+@@ -4447,6 +4447,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { |
549 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
550 |
+ { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
551 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
552 |
++ { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
553 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
554 |
++ { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
555 |
++ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
556 |
+ { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | |
557 |
+ ATA_HORKAGE_ZERO_AFTER_TRIM, }, |
558 |
+ |
559 |
+@@ -6213,7 +6217,7 @@ int ata_host_start(struct ata_host *host) |
560 |
+ have_stop = 1; |
561 |
+ } |
562 |
+ |
563 |
+- if (host->ops->host_stop) |
564 |
++ if (host->ops && host->ops->host_stop) |
565 |
+ have_stop = 1; |
566 |
+ |
567 |
+ if (have_stop) { |
568 |
+diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c |
569 |
+index e0939bd5ea735..6797871f8bc60 100644 |
570 |
+--- a/drivers/ata/sata_dwc_460ex.c |
571 |
++++ b/drivers/ata/sata_dwc_460ex.c |
572 |
+@@ -1253,24 +1253,20 @@ static int sata_dwc_probe(struct platform_device *ofdev) |
573 |
+ irq = irq_of_parse_and_map(np, 0); |
574 |
+ if (irq == NO_IRQ) { |
575 |
+ dev_err(&ofdev->dev, "no SATA DMA irq\n"); |
576 |
+- err = -ENODEV; |
577 |
+- goto error_out; |
578 |
++ return -ENODEV; |
579 |
+ } |
580 |
+ |
581 |
+ #ifdef CONFIG_SATA_DWC_OLD_DMA |
582 |
+ if (!of_find_property(np, "dmas", NULL)) { |
583 |
+ err = sata_dwc_dma_init_old(ofdev, hsdev); |
584 |
+ if (err) |
585 |
+- goto error_out; |
586 |
++ return err; |
587 |
+ } |
588 |
+ #endif |
589 |
+ |
590 |
+ hsdev->phy = devm_phy_optional_get(hsdev->dev, "sata-phy"); |
591 |
+- if (IS_ERR(hsdev->phy)) { |
592 |
+- err = PTR_ERR(hsdev->phy); |
593 |
+- hsdev->phy = NULL; |
594 |
+- goto error_out; |
595 |
+- } |
596 |
++ if (IS_ERR(hsdev->phy)) |
597 |
++ return PTR_ERR(hsdev->phy); |
598 |
+ |
599 |
+ err = phy_init(hsdev->phy); |
600 |
+ if (err) |
601 |
+diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c |
602 |
+index feba1b2118983..ee63ccaea8d57 100644 |
603 |
+--- a/drivers/base/power/wakeirq.c |
604 |
++++ b/drivers/base/power/wakeirq.c |
605 |
+@@ -319,8 +319,12 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq) |
606 |
+ if (!wirq) |
607 |
+ return; |
608 |
+ |
609 |
+- if (device_may_wakeup(wirq->dev)) |
610 |
++ if (device_may_wakeup(wirq->dev)) { |
611 |
++ if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) |
612 |
++ enable_irq(wirq->irq); |
613 |
++ |
614 |
+ enable_irq_wake(wirq->irq); |
615 |
++ } |
616 |
+ } |
617 |
+ |
618 |
+ /** |
619 |
+@@ -335,6 +339,10 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq) |
620 |
+ if (!wirq) |
621 |
+ return; |
622 |
+ |
623 |
+- if (device_may_wakeup(wirq->dev)) |
624 |
++ if (device_may_wakeup(wirq->dev)) { |
625 |
+ disable_irq_wake(wirq->irq); |
626 |
++ |
627 |
++ if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED) |
628 |
++ disable_irq_nosync(wirq->irq); |
629 |
++ } |
630 |
+ } |
631 |
+diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c |
632 |
+index cd984b59a8a16..40a9e5378633c 100644 |
633 |
+--- a/drivers/base/regmap/regmap.c |
634 |
++++ b/drivers/base/regmap/regmap.c |
635 |
+@@ -1375,7 +1375,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, |
636 |
+ if (ret) { |
637 |
+ dev_err(map->dev, |
638 |
+ "Error in caching of register: %x ret: %d\n", |
639 |
+- reg + i, ret); |
640 |
++ reg + regmap_get_offset(map, i), ret); |
641 |
+ return ret; |
642 |
+ } |
643 |
+ } |
644 |
+diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c |
645 |
+index 38688236b3cde..be551f01f7f07 100644 |
646 |
+--- a/drivers/bcma/main.c |
647 |
++++ b/drivers/bcma/main.c |
648 |
+@@ -239,6 +239,7 @@ EXPORT_SYMBOL(bcma_core_irq); |
649 |
+ |
650 |
+ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) |
651 |
+ { |
652 |
++ device_initialize(&core->dev); |
653 |
+ core->dev.release = bcma_release_core_dev; |
654 |
+ core->dev.bus = &bcma_bus_type; |
655 |
+ dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); |
656 |
+@@ -302,11 +303,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) |
657 |
+ { |
658 |
+ int err; |
659 |
+ |
660 |
+- err = device_register(&core->dev); |
661 |
++ err = device_add(&core->dev); |
662 |
+ if (err) { |
663 |
+ bcma_err(bus, "Could not register dev for core 0x%03X\n", |
664 |
+ core->id.id); |
665 |
+- put_device(&core->dev); |
666 |
+ return; |
667 |
+ } |
668 |
+ core->dev_registered = true; |
669 |
+@@ -397,7 +397,7 @@ void bcma_unregister_cores(struct bcma_bus *bus) |
670 |
+ /* Now noone uses internally-handled cores, we can free them */ |
671 |
+ list_for_each_entry_safe(core, tmp, &bus->cores, list) { |
672 |
+ list_del(&core->list); |
673 |
+- kfree(core); |
674 |
++ put_device(&core->dev); |
675 |
+ } |
676 |
+ } |
677 |
+ |
678 |
+diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig |
679 |
+index 894102fd5a069..b701c79f07e53 100644 |
680 |
+--- a/drivers/block/Kconfig |
681 |
++++ b/drivers/block/Kconfig |
682 |
+@@ -257,7 +257,7 @@ config BLK_DEV_LOOP_MIN_COUNT |
683 |
+ dynamically allocated with the /dev/loop-control interface. |
684 |
+ |
685 |
+ config BLK_DEV_CRYPTOLOOP |
686 |
+- tristate "Cryptoloop Support" |
687 |
++ tristate "Cryptoloop Support (DEPRECATED)" |
688 |
+ select CRYPTO |
689 |
+ select CRYPTO_CBC |
690 |
+ depends on BLK_DEV_LOOP |
691 |
+@@ -269,7 +269,7 @@ config BLK_DEV_CRYPTOLOOP |
692 |
+ WARNING: This device is not safe for journaled file systems like |
693 |
+ ext3 or Reiserfs. Please use the Device Mapper crypto module |
694 |
+ instead, which can be configured to be on-disk compatible with the |
695 |
+- cryptoloop device. |
696 |
++ cryptoloop device. cryptoloop support will be removed in Linux 5.16. |
697 |
+ |
698 |
+ source "drivers/block/drbd/Kconfig" |
699 |
+ |
700 |
+diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c |
701 |
+index 3d31761c0ed05..adbfd3e2a60f5 100644 |
702 |
+--- a/drivers/block/cryptoloop.c |
703 |
++++ b/drivers/block/cryptoloop.c |
704 |
+@@ -203,6 +203,8 @@ init_cryptoloop(void) |
705 |
+ |
706 |
+ if (rc) |
707 |
+ printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n"); |
708 |
++ else |
709 |
++ pr_warn("the cryptoloop driver has been deprecated and will be removed in in Linux 5.16\n"); |
710 |
+ return rc; |
711 |
+ } |
712 |
+ |
713 |
+diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c |
714 |
+index 890ebf623261b..38612cd9092eb 100644 |
715 |
+--- a/drivers/clk/mvebu/kirkwood.c |
716 |
++++ b/drivers/clk/mvebu/kirkwood.c |
717 |
+@@ -254,6 +254,7 @@ static const char *powersave_parents[] = { |
718 |
+ static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = { |
719 |
+ { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents), |
720 |
+ 11, 1, 0 }, |
721 |
++ { } |
722 |
+ }; |
723 |
+ |
724 |
+ static struct clk *clk_muxing_get_src( |
725 |
+diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c |
726 |
+index 34839b539207e..0e14a6642de42 100644 |
727 |
+--- a/drivers/crypto/mxs-dcp.c |
728 |
++++ b/drivers/crypto/mxs-dcp.c |
729 |
+@@ -167,15 +167,19 @@ static struct dcp *global_sdcp; |
730 |
+ |
731 |
+ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx) |
732 |
+ { |
733 |
++ int dma_err; |
734 |
+ struct dcp *sdcp = global_sdcp; |
735 |
+ const int chan = actx->chan; |
736 |
+ uint32_t stat; |
737 |
+ unsigned long ret; |
738 |
+ struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; |
739 |
+- |
740 |
+ dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc), |
741 |
+ DMA_TO_DEVICE); |
742 |
+ |
743 |
++ dma_err = dma_mapping_error(sdcp->dev, desc_phys); |
744 |
++ if (dma_err) |
745 |
++ return dma_err; |
746 |
++ |
747 |
+ reinit_completion(&sdcp->completion[chan]); |
748 |
+ |
749 |
+ /* Clear status register. */ |
750 |
+@@ -213,18 +217,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx) |
751 |
+ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
752 |
+ struct ablkcipher_request *req, int init) |
753 |
+ { |
754 |
++ dma_addr_t key_phys, src_phys, dst_phys; |
755 |
+ struct dcp *sdcp = global_sdcp; |
756 |
+ struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan]; |
757 |
+ struct dcp_aes_req_ctx *rctx = ablkcipher_request_ctx(req); |
758 |
+ int ret; |
759 |
+ |
760 |
+- dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key, |
761 |
+- 2 * AES_KEYSIZE_128, |
762 |
+- DMA_TO_DEVICE); |
763 |
+- dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf, |
764 |
+- DCP_BUF_SZ, DMA_TO_DEVICE); |
765 |
+- dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, |
766 |
+- DCP_BUF_SZ, DMA_FROM_DEVICE); |
767 |
++ key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key, |
768 |
++ 2 * AES_KEYSIZE_128, DMA_TO_DEVICE); |
769 |
++ ret = dma_mapping_error(sdcp->dev, key_phys); |
770 |
++ if (ret) |
771 |
++ return ret; |
772 |
++ |
773 |
++ src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf, |
774 |
++ DCP_BUF_SZ, DMA_TO_DEVICE); |
775 |
++ ret = dma_mapping_error(sdcp->dev, src_phys); |
776 |
++ if (ret) |
777 |
++ goto err_src; |
778 |
++ |
779 |
++ dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf, |
780 |
++ DCP_BUF_SZ, DMA_FROM_DEVICE); |
781 |
++ ret = dma_mapping_error(sdcp->dev, dst_phys); |
782 |
++ if (ret) |
783 |
++ goto err_dst; |
784 |
+ |
785 |
+ if (actx->fill % AES_BLOCK_SIZE) { |
786 |
+ dev_err(sdcp->dev, "Invalid block size!\n"); |
787 |
+@@ -262,10 +277,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx, |
788 |
+ ret = mxs_dcp_start_dma(actx); |
789 |
+ |
790 |
+ aes_done_run: |
791 |
++ dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE); |
792 |
++err_dst: |
793 |
++ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
794 |
++err_src: |
795 |
+ dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128, |
796 |
+ DMA_TO_DEVICE); |
797 |
+- dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE); |
798 |
+- dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE); |
799 |
+ |
800 |
+ return ret; |
801 |
+ } |
802 |
+@@ -280,21 +297,20 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
803 |
+ |
804 |
+ struct scatterlist *dst = req->dst; |
805 |
+ struct scatterlist *src = req->src; |
806 |
+- const int nents = sg_nents(req->src); |
807 |
++ int dst_nents = sg_nents(dst); |
808 |
+ |
809 |
+ const int out_off = DCP_BUF_SZ; |
810 |
+ uint8_t *in_buf = sdcp->coh->aes_in_buf; |
811 |
+ uint8_t *out_buf = sdcp->coh->aes_out_buf; |
812 |
+ |
813 |
+- uint8_t *out_tmp, *src_buf, *dst_buf = NULL; |
814 |
+ uint32_t dst_off = 0; |
815 |
++ uint8_t *src_buf = NULL; |
816 |
+ uint32_t last_out_len = 0; |
817 |
+ |
818 |
+ uint8_t *key = sdcp->coh->aes_key; |
819 |
+ |
820 |
+ int ret = 0; |
821 |
+- int split = 0; |
822 |
+- unsigned int i, len, clen, rem = 0, tlen = 0; |
823 |
++ unsigned int i, len, clen, tlen = 0; |
824 |
+ int init = 0; |
825 |
+ bool limit_hit = false; |
826 |
+ |
827 |
+@@ -312,7 +328,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
828 |
+ memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128); |
829 |
+ } |
830 |
+ |
831 |
+- for_each_sg(req->src, src, nents, i) { |
832 |
++ for_each_sg(req->src, src, sg_nents(src), i) { |
833 |
+ src_buf = sg_virt(src); |
834 |
+ len = sg_dma_len(src); |
835 |
+ tlen += len; |
836 |
+@@ -337,34 +353,17 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq) |
837 |
+ * submit the buffer. |
838 |
+ */ |
839 |
+ if (actx->fill == out_off || sg_is_last(src) || |
840 |
+- limit_hit) { |
841 |
++ limit_hit) { |
842 |
+ ret = mxs_dcp_run_aes(actx, req, init); |
843 |
+ if (ret) |
844 |
+ return ret; |
845 |
+ init = 0; |
846 |
+ |
847 |
+- out_tmp = out_buf; |
848 |
++ sg_pcopy_from_buffer(dst, dst_nents, out_buf, |
849 |
++ actx->fill, dst_off); |
850 |
++ dst_off += actx->fill; |
851 |
+ last_out_len = actx->fill; |
852 |
+- while (dst && actx->fill) { |
853 |
+- if (!split) { |
854 |
+- dst_buf = sg_virt(dst); |
855 |
+- dst_off = 0; |
856 |
+- } |
857 |
+- rem = min(sg_dma_len(dst) - dst_off, |
858 |
+- actx->fill); |
859 |
+- |
860 |
+- memcpy(dst_buf + dst_off, out_tmp, rem); |
861 |
+- out_tmp += rem; |
862 |
+- dst_off += rem; |
863 |
+- actx->fill -= rem; |
864 |
+- |
865 |
+- if (dst_off == sg_dma_len(dst)) { |
866 |
+- dst = sg_next(dst); |
867 |
+- split = 0; |
868 |
+- } else { |
869 |
+- split = 1; |
870 |
+- } |
871 |
+- } |
872 |
++ actx->fill = 0; |
873 |
+ } |
874 |
+ } while (len); |
875 |
+ |
876 |
+@@ -565,6 +564,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
877 |
+ dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf, |
878 |
+ DCP_BUF_SZ, DMA_TO_DEVICE); |
879 |
+ |
880 |
++ ret = dma_mapping_error(sdcp->dev, buf_phys); |
881 |
++ if (ret) |
882 |
++ return ret; |
883 |
++ |
884 |
+ /* Fill in the DMA descriptor. */ |
885 |
+ desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE | |
886 |
+ MXS_DCP_CONTROL0_INTERRUPT | |
887 |
+@@ -597,6 +600,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req) |
888 |
+ if (rctx->fini) { |
889 |
+ digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf, |
890 |
+ DCP_SHA_PAY_SZ, DMA_FROM_DEVICE); |
891 |
++ ret = dma_mapping_error(sdcp->dev, digest_phys); |
892 |
++ if (ret) |
893 |
++ goto done_run; |
894 |
++ |
895 |
+ desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM; |
896 |
+ desc->payload = digest_phys; |
897 |
+ } |
898 |
+diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c |
899 |
+index 4adcf89add252..801ae958b0adb 100644 |
900 |
+--- a/drivers/crypto/omap-sham.c |
901 |
++++ b/drivers/crypto/omap-sham.c |
902 |
+@@ -1745,7 +1745,7 @@ static void omap_sham_done_task(unsigned long data) |
903 |
+ if (test_and_clear_bit(FLAGS_OUTPUT_READY, &dd->flags)) |
904 |
+ goto finish; |
905 |
+ } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) { |
906 |
+- if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) { |
907 |
++ if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) { |
908 |
+ omap_sham_update_dma_stop(dd); |
909 |
+ if (dd->err) { |
910 |
+ err = dd->err; |
911 |
+diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
912 |
+index d2d0ae445fd89..7c7d49a8a4034 100644 |
913 |
+--- a/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
914 |
++++ b/drivers/crypto/qat/qat_c3xxxvf/adf_c3xxxvf_hw_data.c |
915 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c3xxxiov(struct adf_hw_device_data *hw_data) |
916 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
917 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
918 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
919 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
920 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
921 |
+ hw_data->init_arb = adf_vf_int_noop; |
922 |
+ hw_data->exit_arb = adf_vf_void_noop; |
923 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
924 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
925 |
+ hw_data->get_accel_mask = get_accel_mask; |
926 |
+ hw_data->get_ae_mask = get_ae_mask; |
927 |
+ hw_data->get_num_accels = get_num_accels; |
928 |
+diff --git a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
929 |
+index 38e4bc04f407b..90e8a7564756b 100644 |
930 |
+--- a/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
931 |
++++ b/drivers/crypto/qat/qat_c62xvf/adf_c62xvf_hw_data.c |
932 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_c62xiov(struct adf_hw_device_data *hw_data) |
933 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
934 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
935 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
936 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
937 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
938 |
+ hw_data->init_arb = adf_vf_int_noop; |
939 |
+ hw_data->exit_arb = adf_vf_void_noop; |
940 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
941 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
942 |
+ hw_data->get_accel_mask = get_accel_mask; |
943 |
+ hw_data->get_ae_mask = get_ae_mask; |
944 |
+ hw_data->get_num_accels = get_num_accels; |
945 |
+diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h |
946 |
+index 0d596a99f5645..88c8831503e4a 100644 |
947 |
+--- a/drivers/crypto/qat/qat_common/adf_common_drv.h |
948 |
++++ b/drivers/crypto/qat/qat_common/adf_common_drv.h |
949 |
+@@ -239,8 +239,8 @@ void adf_enable_vf2pf_interrupts(struct adf_accel_dev *accel_dev, |
950 |
+ void adf_enable_pf2vf_interrupts(struct adf_accel_dev *accel_dev); |
951 |
+ void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev); |
952 |
+ |
953 |
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev); |
954 |
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev); |
955 |
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev); |
956 |
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev); |
957 |
+ int adf_init_pf_wq(void); |
958 |
+ void adf_exit_pf_wq(void); |
959 |
+ int adf_init_vf_wq(void); |
960 |
+@@ -263,12 +263,12 @@ static inline void adf_disable_pf2vf_interrupts(struct adf_accel_dev *accel_dev) |
961 |
+ { |
962 |
+ } |
963 |
+ |
964 |
+-static inline int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
965 |
++static inline int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev) |
966 |
+ { |
967 |
+ return 0; |
968 |
+ } |
969 |
+ |
970 |
+-static inline void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
971 |
++static inline void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) |
972 |
+ { |
973 |
+ } |
974 |
+ |
975 |
+diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c |
976 |
+index 888c6675e7e54..03856cc604b6f 100644 |
977 |
+--- a/drivers/crypto/qat/qat_common/adf_init.c |
978 |
++++ b/drivers/crypto/qat/qat_common/adf_init.c |
979 |
+@@ -101,6 +101,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) |
980 |
+ struct service_hndl *service; |
981 |
+ struct list_head *list_itr; |
982 |
+ struct adf_hw_device_data *hw_data = accel_dev->hw_device; |
983 |
++ int ret; |
984 |
+ |
985 |
+ if (!hw_data) { |
986 |
+ dev_err(&GET_DEV(accel_dev), |
987 |
+@@ -167,9 +168,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev) |
988 |
+ } |
989 |
+ |
990 |
+ hw_data->enable_error_correction(accel_dev); |
991 |
+- hw_data->enable_vf2pf_comms(accel_dev); |
992 |
++ ret = hw_data->enable_vf2pf_comms(accel_dev); |
993 |
+ |
994 |
+- return 0; |
995 |
++ return ret; |
996 |
+ } |
997 |
+ EXPORT_SYMBOL_GPL(adf_dev_init); |
998 |
+ |
999 |
+diff --git a/drivers/crypto/qat/qat_common/adf_isr.c b/drivers/crypto/qat/qat_common/adf_isr.c |
1000 |
+index 2c0be14309cfa..7877ba6772203 100644 |
1001 |
+--- a/drivers/crypto/qat/qat_common/adf_isr.c |
1002 |
++++ b/drivers/crypto/qat/qat_common/adf_isr.c |
1003 |
+@@ -59,6 +59,8 @@ |
1004 |
+ #include "adf_transport_access_macros.h" |
1005 |
+ #include "adf_transport_internal.h" |
1006 |
+ |
1007 |
++#define ADF_MAX_NUM_VFS 32 |
1008 |
++ |
1009 |
+ static int adf_enable_msix(struct adf_accel_dev *accel_dev) |
1010 |
+ { |
1011 |
+ struct adf_accel_pci *pci_dev_info = &accel_dev->accel_pci_dev; |
1012 |
+@@ -111,7 +113,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr) |
1013 |
+ struct adf_bar *pmisc = |
1014 |
+ &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)]; |
1015 |
+ void __iomem *pmisc_bar_addr = pmisc->virt_addr; |
1016 |
+- u32 vf_mask; |
1017 |
++ unsigned long vf_mask; |
1018 |
+ |
1019 |
+ /* Get the interrupt sources triggered by VFs */ |
1020 |
+ vf_mask = ((ADF_CSR_RD(pmisc_bar_addr, ADF_ERRSOU5) & |
1021 |
+@@ -132,8 +134,7 @@ static irqreturn_t adf_msix_isr_ae(int irq, void *dev_ptr) |
1022 |
+ * unless the VF is malicious and is attempting to |
1023 |
+ * flood the host OS with VF2PF interrupts. |
1024 |
+ */ |
1025 |
+- for_each_set_bit(i, (const unsigned long *)&vf_mask, |
1026 |
+- (sizeof(vf_mask) * BITS_PER_BYTE)) { |
1027 |
++ for_each_set_bit(i, &vf_mask, ADF_MAX_NUM_VFS) { |
1028 |
+ vf_info = accel_dev->pf.vf_info + i; |
1029 |
+ |
1030 |
+ if (!__ratelimit(&vf_info->vf2pf_ratelimit)) { |
1031 |
+diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1032 |
+index b3875fdf6cd72..c64481160b711 100644 |
1033 |
+--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1034 |
++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c |
1035 |
+@@ -231,7 +231,6 @@ int adf_iov_putmsg(struct adf_accel_dev *accel_dev, u32 msg, u8 vf_nr) |
1036 |
+ |
1037 |
+ return ret; |
1038 |
+ } |
1039 |
+-EXPORT_SYMBOL_GPL(adf_iov_putmsg); |
1040 |
+ |
1041 |
+ void adf_vf2pf_req_hndl(struct adf_accel_vf_info *vf_info) |
1042 |
+ { |
1043 |
+@@ -361,6 +360,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev) |
1044 |
+ msg |= ADF_PFVF_COMPATIBILITY_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT; |
1045 |
+ BUILD_BUG_ON(ADF_PFVF_COMPATIBILITY_VERSION > 255); |
1046 |
+ |
1047 |
++ reinit_completion(&accel_dev->vf.iov_msg_completion); |
1048 |
++ |
1049 |
+ /* Send request from VF to PF */ |
1050 |
+ ret = adf_iov_putmsg(accel_dev, msg, 0); |
1051 |
+ if (ret) { |
1052 |
+diff --git a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1053 |
+index cd5f37dffe8a6..1830194567e84 100644 |
1054 |
+--- a/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1055 |
++++ b/drivers/crypto/qat/qat_common/adf_vf2pf_msg.c |
1056 |
+@@ -49,14 +49,14 @@ |
1057 |
+ #include "adf_pf2vf_msg.h" |
1058 |
+ |
1059 |
+ /** |
1060 |
+- * adf_vf2pf_init() - send init msg to PF |
1061 |
++ * adf_vf2pf_notify_init() - send init msg to PF |
1062 |
+ * @accel_dev: Pointer to acceleration VF device. |
1063 |
+ * |
1064 |
+ * Function sends an init messge from the VF to a PF |
1065 |
+ * |
1066 |
+ * Return: 0 on success, error code otherwise. |
1067 |
+ */ |
1068 |
+-int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
1069 |
++int adf_vf2pf_notify_init(struct adf_accel_dev *accel_dev) |
1070 |
+ { |
1071 |
+ u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | |
1072 |
+ (ADF_VF2PF_MSGTYPE_INIT << ADF_VF2PF_MSGTYPE_SHIFT)); |
1073 |
+@@ -69,17 +69,17 @@ int adf_vf2pf_init(struct adf_accel_dev *accel_dev) |
1074 |
+ set_bit(ADF_STATUS_PF_RUNNING, &accel_dev->status); |
1075 |
+ return 0; |
1076 |
+ } |
1077 |
+-EXPORT_SYMBOL_GPL(adf_vf2pf_init); |
1078 |
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_init); |
1079 |
+ |
1080 |
+ /** |
1081 |
+- * adf_vf2pf_shutdown() - send shutdown msg to PF |
1082 |
++ * adf_vf2pf_notify_shutdown() - send shutdown msg to PF |
1083 |
+ * @accel_dev: Pointer to acceleration VF device. |
1084 |
+ * |
1085 |
+ * Function sends a shutdown messge from the VF to a PF |
1086 |
+ * |
1087 |
+ * Return: void |
1088 |
+ */ |
1089 |
+-void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
1090 |
++void adf_vf2pf_notify_shutdown(struct adf_accel_dev *accel_dev) |
1091 |
+ { |
1092 |
+ u32 msg = (ADF_VF2PF_MSGORIGIN_SYSTEM | |
1093 |
+ (ADF_VF2PF_MSGTYPE_SHUTDOWN << ADF_VF2PF_MSGTYPE_SHIFT)); |
1094 |
+@@ -89,4 +89,4 @@ void adf_vf2pf_shutdown(struct adf_accel_dev *accel_dev) |
1095 |
+ dev_err(&GET_DEV(accel_dev), |
1096 |
+ "Failed to send Shutdown event to PF\n"); |
1097 |
+ } |
1098 |
+-EXPORT_SYMBOL_GPL(adf_vf2pf_shutdown); |
1099 |
++EXPORT_SYMBOL_GPL(adf_vf2pf_notify_shutdown); |
1100 |
+diff --git a/drivers/crypto/qat/qat_common/adf_vf_isr.c b/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1101 |
+index 4c1217ba83ae8..36db3c443e7e4 100644 |
1102 |
+--- a/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1103 |
++++ b/drivers/crypto/qat/qat_common/adf_vf_isr.c |
1104 |
+@@ -203,6 +203,7 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1105 |
+ struct adf_bar *pmisc = |
1106 |
+ &GET_BARS(accel_dev)[hw_data->get_misc_bar_id(hw_data)]; |
1107 |
+ void __iomem *pmisc_bar_addr = pmisc->virt_addr; |
1108 |
++ bool handled = false; |
1109 |
+ u32 v_int; |
1110 |
+ |
1111 |
+ /* Read VF INT source CSR to determine the source of VF interrupt */ |
1112 |
+@@ -215,7 +216,7 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1113 |
+ |
1114 |
+ /* Schedule tasklet to handle interrupt BH */ |
1115 |
+ tasklet_hi_schedule(&accel_dev->vf.pf2vf_bh_tasklet); |
1116 |
+- return IRQ_HANDLED; |
1117 |
++ handled = true; |
1118 |
+ } |
1119 |
+ |
1120 |
+ /* Check bundle interrupt */ |
1121 |
+@@ -227,10 +228,10 @@ static irqreturn_t adf_isr(int irq, void *privdata) |
1122 |
+ WRITE_CSR_INT_FLAG_AND_COL(bank->csr_addr, bank->bank_number, |
1123 |
+ 0); |
1124 |
+ tasklet_hi_schedule(&bank->resp_handler); |
1125 |
+- return IRQ_HANDLED; |
1126 |
++ handled = true; |
1127 |
+ } |
1128 |
+ |
1129 |
+- return IRQ_NONE; |
1130 |
++ return handled ? IRQ_HANDLED : IRQ_NONE; |
1131 |
+ } |
1132 |
+ |
1133 |
+ static int adf_request_msi_irq(struct adf_accel_dev *accel_dev) |
1134 |
+diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1135 |
+index a3b4dd8099a7b..3a8361c83f0b1 100644 |
1136 |
+--- a/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1137 |
++++ b/drivers/crypto/qat/qat_dh895xccvf/adf_dh895xccvf_hw_data.c |
1138 |
+@@ -123,10 +123,10 @@ void adf_init_hw_data_dh895xcciov(struct adf_hw_device_data *hw_data) |
1139 |
+ hw_data->enable_error_correction = adf_vf_void_noop; |
1140 |
+ hw_data->init_admin_comms = adf_vf_int_noop; |
1141 |
+ hw_data->exit_admin_comms = adf_vf_void_noop; |
1142 |
+- hw_data->send_admin_init = adf_vf2pf_init; |
1143 |
++ hw_data->send_admin_init = adf_vf2pf_notify_init; |
1144 |
+ hw_data->init_arb = adf_vf_int_noop; |
1145 |
+ hw_data->exit_arb = adf_vf_void_noop; |
1146 |
+- hw_data->disable_iov = adf_vf2pf_shutdown; |
1147 |
++ hw_data->disable_iov = adf_vf2pf_notify_shutdown; |
1148 |
+ hw_data->get_accel_mask = get_accel_mask; |
1149 |
+ hw_data->get_ae_mask = get_ae_mask; |
1150 |
+ hw_data->get_num_accels = get_num_accels; |
1151 |
+diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c |
1152 |
+index f4a6be76468d5..15eb1501915ca 100644 |
1153 |
+--- a/drivers/crypto/talitos.c |
1154 |
++++ b/drivers/crypto/talitos.c |
1155 |
+@@ -816,7 +816,11 @@ static void talitos_unregister_rng(struct device *dev) |
1156 |
+ * HMAC_SNOOP_NO_AFEA (HSNA) instead of type IPSEC_ESP |
1157 |
+ */ |
1158 |
+ #define TALITOS_CRA_PRIORITY_AEAD_HSNA (TALITOS_CRA_PRIORITY - 1) |
1159 |
++#ifdef CONFIG_CRYPTO_DEV_TALITOS_SEC2 |
1160 |
+ #define TALITOS_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + SHA512_BLOCK_SIZE) |
1161 |
++#else |
1162 |
++#define TALITOS_MAX_KEY_SIZE (AES_MAX_KEY_SIZE + SHA256_BLOCK_SIZE) |
1163 |
++#endif |
1164 |
+ #define TALITOS_MAX_IV_LENGTH 16 /* max of AES_BLOCK_SIZE, DES3_EDE_BLOCK_SIZE */ |
1165 |
+ |
1166 |
+ struct talitos_ctx { |
1167 |
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c |
1168 |
+index 91d367399956e..a334eb7dbff4d 100644 |
1169 |
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c |
1170 |
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c |
1171 |
+@@ -339,7 +339,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus, |
1172 |
+ void |
1173 |
+ amdgpu_i2c_router_select_ddc_port(const struct amdgpu_connector *amdgpu_connector) |
1174 |
+ { |
1175 |
+- u8 val; |
1176 |
++ u8 val = 0; |
1177 |
+ |
1178 |
+ if (!amdgpu_connector->router.ddc_valid) |
1179 |
+ return; |
1180 |
+diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c |
1181 |
+index ec572f8389edb..3a75586c1989b 100644 |
1182 |
+--- a/drivers/gpu/drm/msm/dsi/dsi.c |
1183 |
++++ b/drivers/gpu/drm/msm/dsi/dsi.c |
1184 |
+@@ -36,8 +36,10 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) |
1185 |
+ } |
1186 |
+ |
1187 |
+ phy_pdev = of_find_device_by_node(phy_node); |
1188 |
+- if (phy_pdev) |
1189 |
++ if (phy_pdev) { |
1190 |
+ msm_dsi->phy = platform_get_drvdata(phy_pdev); |
1191 |
++ msm_dsi->phy_dev = &phy_pdev->dev; |
1192 |
++ } |
1193 |
+ |
1194 |
+ of_node_put(phy_node); |
1195 |
+ |
1196 |
+@@ -46,8 +48,6 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi) |
1197 |
+ return -EPROBE_DEFER; |
1198 |
+ } |
1199 |
+ |
1200 |
+- msm_dsi->phy_dev = get_device(&phy_pdev->dev); |
1201 |
+- |
1202 |
+ return 0; |
1203 |
+ } |
1204 |
+ |
1205 |
+diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c |
1206 |
+index 56dc69e7349fc..9ad031ea33009 100644 |
1207 |
+--- a/drivers/i2c/busses/i2c-highlander.c |
1208 |
++++ b/drivers/i2c/busses/i2c-highlander.c |
1209 |
+@@ -382,7 +382,7 @@ static int highlander_i2c_probe(struct platform_device *pdev) |
1210 |
+ platform_set_drvdata(pdev, dev); |
1211 |
+ |
1212 |
+ dev->irq = platform_get_irq(pdev, 0); |
1213 |
+- if (iic_force_poll) |
1214 |
++ if (dev->irq < 0 || iic_force_poll) |
1215 |
+ dev->irq = 0; |
1216 |
+ |
1217 |
+ if (dev->irq) { |
1218 |
+diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c |
1219 |
+index 85cbe4b555786..d4fe7ccccb226 100644 |
1220 |
+--- a/drivers/i2c/busses/i2c-iop3xx.c |
1221 |
++++ b/drivers/i2c/busses/i2c-iop3xx.c |
1222 |
+@@ -456,16 +456,14 @@ iop3xx_i2c_probe(struct platform_device *pdev) |
1223 |
+ |
1224 |
+ irq = platform_get_irq(pdev, 0); |
1225 |
+ if (irq < 0) { |
1226 |
+- ret = -ENXIO; |
1227 |
++ ret = irq; |
1228 |
+ goto unmap; |
1229 |
+ } |
1230 |
+ ret = request_irq(irq, iop3xx_i2c_irq_handler, 0, |
1231 |
+ pdev->name, adapter_data); |
1232 |
+ |
1233 |
+- if (ret) { |
1234 |
+- ret = -EIO; |
1235 |
++ if (ret) |
1236 |
+ goto unmap; |
1237 |
+- } |
1238 |
+ |
1239 |
+ memcpy(new_adapter->name, pdev->name, strlen(pdev->name)); |
1240 |
+ new_adapter->owner = THIS_MODULE; |
1241 |
+diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c |
1242 |
+index 4a7d9bc2142ba..0f905f8387f2f 100644 |
1243 |
+--- a/drivers/i2c/busses/i2c-mt65xx.c |
1244 |
++++ b/drivers/i2c/busses/i2c-mt65xx.c |
1245 |
+@@ -708,7 +708,7 @@ static int mtk_i2c_probe(struct platform_device *pdev) |
1246 |
+ return PTR_ERR(i2c->pdmabase); |
1247 |
+ |
1248 |
+ irq = platform_get_irq(pdev, 0); |
1249 |
+- if (irq <= 0) |
1250 |
++ if (irq < 0) |
1251 |
+ return irq; |
1252 |
+ |
1253 |
+ init_completion(&i2c->msg_complete); |
1254 |
+diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c |
1255 |
+index acccdfb954207..3814c160ff174 100644 |
1256 |
+--- a/drivers/i2c/busses/i2c-s3c2410.c |
1257 |
++++ b/drivers/i2c/busses/i2c-s3c2410.c |
1258 |
+@@ -1181,7 +1181,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) |
1259 |
+ */ |
1260 |
+ if (!(i2c->quirks & QUIRK_POLL)) { |
1261 |
+ i2c->irq = ret = platform_get_irq(pdev, 0); |
1262 |
+- if (ret <= 0) { |
1263 |
++ if (ret < 0) { |
1264 |
+ dev_err(&pdev->dev, "cannot find IRQ\n"); |
1265 |
+ clk_unprepare(i2c->clk); |
1266 |
+ return ret; |
1267 |
+diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c |
1268 |
+index 5489ec43b95d7..e5cefdb674f80 100644 |
1269 |
+--- a/drivers/iio/dac/ad5624r_spi.c |
1270 |
++++ b/drivers/iio/dac/ad5624r_spi.c |
1271 |
+@@ -231,7 +231,7 @@ static int ad5624r_probe(struct spi_device *spi) |
1272 |
+ if (!indio_dev) |
1273 |
+ return -ENOMEM; |
1274 |
+ st = iio_priv(indio_dev); |
1275 |
+- st->reg = devm_regulator_get(&spi->dev, "vcc"); |
1276 |
++ st->reg = devm_regulator_get_optional(&spi->dev, "vref"); |
1277 |
+ if (!IS_ERR(st->reg)) { |
1278 |
+ ret = regulator_enable(st->reg); |
1279 |
+ if (ret) |
1280 |
+@@ -242,6 +242,22 @@ static int ad5624r_probe(struct spi_device *spi) |
1281 |
+ goto error_disable_reg; |
1282 |
+ |
1283 |
+ voltage_uv = ret; |
1284 |
++ } else { |
1285 |
++ if (PTR_ERR(st->reg) != -ENODEV) |
1286 |
++ return PTR_ERR(st->reg); |
1287 |
++ /* Backwards compatibility. This naming is not correct */ |
1288 |
++ st->reg = devm_regulator_get_optional(&spi->dev, "vcc"); |
1289 |
++ if (!IS_ERR(st->reg)) { |
1290 |
++ ret = regulator_enable(st->reg); |
1291 |
++ if (ret) |
1292 |
++ return ret; |
1293 |
++ |
1294 |
++ ret = regulator_get_voltage(st->reg); |
1295 |
++ if (ret < 0) |
1296 |
++ goto error_disable_reg; |
1297 |
++ |
1298 |
++ voltage_uv = ret; |
1299 |
++ } |
1300 |
+ } |
1301 |
+ |
1302 |
+ spi_set_drvdata(spi, indio_dev); |
1303 |
+diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c |
1304 |
+index c799071be66fc..45996c51a3018 100644 |
1305 |
+--- a/drivers/media/i2c/tc358743.c |
1306 |
++++ b/drivers/media/i2c/tc358743.c |
1307 |
+@@ -237,7 +237,7 @@ static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val) |
1308 |
+ |
1309 |
+ static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val) |
1310 |
+ { |
1311 |
+- i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2); |
1312 |
++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1); |
1313 |
+ } |
1314 |
+ |
1315 |
+ static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg) |
1316 |
+diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c |
1317 |
+index 63dace8198b0b..b3810b85e7d5f 100644 |
1318 |
+--- a/drivers/media/rc/rc-loopback.c |
1319 |
++++ b/drivers/media/rc/rc-loopback.c |
1320 |
+@@ -55,7 +55,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask) |
1321 |
+ |
1322 |
+ if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) { |
1323 |
+ dprintk("invalid tx mask: %u\n", mask); |
1324 |
+- return -EINVAL; |
1325 |
++ return 2; |
1326 |
+ } |
1327 |
+ |
1328 |
+ dprintk("setting tx mask: %u\n", mask); |
1329 |
+diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1330 |
+index 1babd33419106..016a6d1ad279b 100644 |
1331 |
+--- a/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1332 |
++++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c |
1333 |
+@@ -133,7 +133,7 @@ ret: |
1334 |
+ |
1335 |
+ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) |
1336 |
+ { |
1337 |
+- int i; |
1338 |
++ int i, ret; |
1339 |
+ u8 b; |
1340 |
+ |
1341 |
+ mac[0] = 0x00; |
1342 |
+@@ -142,7 +142,9 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6]) |
1343 |
+ |
1344 |
+ /* this is a complete guess, but works for my box */ |
1345 |
+ for (i = 136; i < 139; i++) { |
1346 |
+- dibusb_read_eeprom_byte(d,i, &b); |
1347 |
++ ret = dibusb_read_eeprom_byte(d, i, &b); |
1348 |
++ if (ret) |
1349 |
++ return ret; |
1350 |
+ |
1351 |
+ mac[5 - (i - 136)] = b; |
1352 |
+ } |
1353 |
+diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c |
1354 |
+index 40de33de90a7a..5c3b0a7ca27e1 100644 |
1355 |
+--- a/drivers/media/usb/dvb-usb/vp702x.c |
1356 |
++++ b/drivers/media/usb/dvb-usb/vp702x.c |
1357 |
+@@ -294,16 +294,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
1358 |
+ static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) |
1359 |
+ { |
1360 |
+ u8 i, *buf; |
1361 |
++ int ret; |
1362 |
+ struct vp702x_device_state *st = d->priv; |
1363 |
+ |
1364 |
+ mutex_lock(&st->buf_mutex); |
1365 |
+ buf = st->buf; |
1366 |
+- for (i = 6; i < 12; i++) |
1367 |
+- vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1); |
1368 |
++ for (i = 6; i < 12; i++) { |
1369 |
++ ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, |
1370 |
++ &buf[i - 6], 1); |
1371 |
++ if (ret < 0) |
1372 |
++ goto err; |
1373 |
++ } |
1374 |
+ |
1375 |
+ memcpy(mac, buf, 6); |
1376 |
++err: |
1377 |
+ mutex_unlock(&st->buf_mutex); |
1378 |
+- return 0; |
1379 |
++ return ret; |
1380 |
+ } |
1381 |
+ |
1382 |
+ static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) |
1383 |
+diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c |
1384 |
+index 05b1126f263ef..d861d7225f49d 100644 |
1385 |
+--- a/drivers/media/usb/go7007/go7007-driver.c |
1386 |
++++ b/drivers/media/usb/go7007/go7007-driver.c |
1387 |
+@@ -698,49 +698,23 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board, |
1388 |
+ struct device *dev) |
1389 |
+ { |
1390 |
+ struct go7007 *go; |
1391 |
+- int i; |
1392 |
+ |
1393 |
+ go = kzalloc(sizeof(struct go7007), GFP_KERNEL); |
1394 |
+ if (go == NULL) |
1395 |
+ return NULL; |
1396 |
+ go->dev = dev; |
1397 |
+ go->board_info = board; |
1398 |
+- go->board_id = 0; |
1399 |
+ go->tuner_type = -1; |
1400 |
+- go->channel_number = 0; |
1401 |
+- go->name[0] = 0; |
1402 |
+ mutex_init(&go->hw_lock); |
1403 |
+ init_waitqueue_head(&go->frame_waitq); |
1404 |
+ spin_lock_init(&go->spinlock); |
1405 |
+ go->status = STATUS_INIT; |
1406 |
+- memset(&go->i2c_adapter, 0, sizeof(go->i2c_adapter)); |
1407 |
+- go->i2c_adapter_online = 0; |
1408 |
+- go->interrupt_available = 0; |
1409 |
+ init_waitqueue_head(&go->interrupt_waitq); |
1410 |
+- go->input = 0; |
1411 |
+ go7007_update_board(go); |
1412 |
+- go->encoder_h_halve = 0; |
1413 |
+- go->encoder_v_halve = 0; |
1414 |
+- go->encoder_subsample = 0; |
1415 |
+ go->format = V4L2_PIX_FMT_MJPEG; |
1416 |
+ go->bitrate = 1500000; |
1417 |
+ go->fps_scale = 1; |
1418 |
+- go->pali = 0; |
1419 |
+ go->aspect_ratio = GO7007_RATIO_1_1; |
1420 |
+- go->gop_size = 0; |
1421 |
+- go->ipb = 0; |
1422 |
+- go->closed_gop = 0; |
1423 |
+- go->repeat_seqhead = 0; |
1424 |
+- go->seq_header_enable = 0; |
1425 |
+- go->gop_header_enable = 0; |
1426 |
+- go->dvd_mode = 0; |
1427 |
+- go->interlace_coding = 0; |
1428 |
+- for (i = 0; i < 4; ++i) |
1429 |
+- go->modet[i].enable = 0; |
1430 |
+- for (i = 0; i < 1624; ++i) |
1431 |
+- go->modet_map[i] = 0; |
1432 |
+- go->audio_deliver = NULL; |
1433 |
+- go->audio_enabled = 0; |
1434 |
+ |
1435 |
+ return go; |
1436 |
+ } |
1437 |
+diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c |
1438 |
+index f9844f87467b4..969a80855518f 100644 |
1439 |
+--- a/drivers/media/usb/stkwebcam/stk-webcam.c |
1440 |
++++ b/drivers/media/usb/stkwebcam/stk-webcam.c |
1441 |
+@@ -1362,7 +1362,7 @@ static int stk_camera_probe(struct usb_interface *interface, |
1442 |
+ if (!dev->isoc_ep) { |
1443 |
+ STK_ERROR("Could not find isoc-in endpoint"); |
1444 |
+ err = -ENODEV; |
1445 |
+- goto error; |
1446 |
++ goto error_put; |
1447 |
+ } |
1448 |
+ dev->vsettings.palette = V4L2_PIX_FMT_RGB565; |
1449 |
+ dev->vsettings.mode = MODE_VGA; |
1450 |
+@@ -1375,10 +1375,12 @@ static int stk_camera_probe(struct usb_interface *interface, |
1451 |
+ |
1452 |
+ err = stk_register_video_device(dev); |
1453 |
+ if (err) |
1454 |
+- goto error; |
1455 |
++ goto error_put; |
1456 |
+ |
1457 |
+ return 0; |
1458 |
+ |
1459 |
++error_put: |
1460 |
++ usb_put_intf(interface); |
1461 |
+ error: |
1462 |
+ v4l2_ctrl_handler_free(hdl); |
1463 |
+ v4l2_device_unregister(&dev->v4l2_dev); |
1464 |
+diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c |
1465 |
+index 6a19cf94705b1..4a270f88aa18c 100644 |
1466 |
+--- a/drivers/media/usb/uvc/uvc_v4l2.c |
1467 |
++++ b/drivers/media/usb/uvc/uvc_v4l2.c |
1468 |
+@@ -881,8 +881,8 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) |
1469 |
+ { |
1470 |
+ struct uvc_fh *handle = fh; |
1471 |
+ struct uvc_video_chain *chain = handle->chain; |
1472 |
++ u8 *buf; |
1473 |
+ int ret; |
1474 |
+- u8 i; |
1475 |
+ |
1476 |
+ if (chain->selector == NULL || |
1477 |
+ (chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { |
1478 |
+@@ -890,22 +890,27 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input) |
1479 |
+ return 0; |
1480 |
+ } |
1481 |
+ |
1482 |
++ buf = kmalloc(1, GFP_KERNEL); |
1483 |
++ if (!buf) |
1484 |
++ return -ENOMEM; |
1485 |
++ |
1486 |
+ ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, chain->selector->id, |
1487 |
+ chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, |
1488 |
+- &i, 1); |
1489 |
+- if (ret < 0) |
1490 |
+- return ret; |
1491 |
++ buf, 1); |
1492 |
++ if (!ret) |
1493 |
++ *input = *buf - 1; |
1494 |
+ |
1495 |
+- *input = i - 1; |
1496 |
+- return 0; |
1497 |
++ kfree(buf); |
1498 |
++ |
1499 |
++ return ret; |
1500 |
+ } |
1501 |
+ |
1502 |
+ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) |
1503 |
+ { |
1504 |
+ struct uvc_fh *handle = fh; |
1505 |
+ struct uvc_video_chain *chain = handle->chain; |
1506 |
++ u8 *buf; |
1507 |
+ int ret; |
1508 |
+- u32 i; |
1509 |
+ |
1510 |
+ ret = uvc_acquire_privileges(handle); |
1511 |
+ if (ret < 0) |
1512 |
+@@ -921,10 +926,17 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input) |
1513 |
+ if (input >= chain->selector->bNrInPins) |
1514 |
+ return -EINVAL; |
1515 |
+ |
1516 |
+- i = input + 1; |
1517 |
+- return uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, |
1518 |
+- chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, |
1519 |
+- &i, 1); |
1520 |
++ buf = kmalloc(1, GFP_KERNEL); |
1521 |
++ if (!buf) |
1522 |
++ return -ENOMEM; |
1523 |
++ |
1524 |
++ *buf = input + 1; |
1525 |
++ ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id, |
1526 |
++ chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL, |
1527 |
++ buf, 1); |
1528 |
++ kfree(buf); |
1529 |
++ |
1530 |
++ return ret; |
1531 |
+ } |
1532 |
+ |
1533 |
+ static int uvc_ioctl_queryctrl(struct file *file, void *fh, |
1534 |
+diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c |
1535 |
+index 2f212bdc187a4..83484c43b1dc6 100644 |
1536 |
+--- a/drivers/mfd/ab8500-core.c |
1537 |
++++ b/drivers/mfd/ab8500-core.c |
1538 |
+@@ -489,7 +489,7 @@ static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500, |
1539 |
+ if (line == AB8540_INT_GPIO43F || line == AB8540_INT_GPIO44F) |
1540 |
+ line += 1; |
1541 |
+ |
1542 |
+- handle_nested_irq(irq_create_mapping(ab8500->domain, line)); |
1543 |
++ handle_nested_irq(irq_find_mapping(ab8500->domain, line)); |
1544 |
+ } |
1545 |
+ |
1546 |
+ return 0; |
1547 |
+diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c |
1548 |
+index b0c7bcdaf5df5..61fb4873c0613 100644 |
1549 |
+--- a/drivers/mfd/stmpe.c |
1550 |
++++ b/drivers/mfd/stmpe.c |
1551 |
+@@ -1033,7 +1033,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) |
1552 |
+ |
1553 |
+ if (variant->id_val == STMPE801_ID || |
1554 |
+ variant->id_val == STMPE1600_ID) { |
1555 |
+- int base = irq_create_mapping(stmpe->domain, 0); |
1556 |
++ int base = irq_find_mapping(stmpe->domain, 0); |
1557 |
+ |
1558 |
+ handle_nested_irq(base); |
1559 |
+ return IRQ_HANDLED; |
1560 |
+@@ -1061,7 +1061,7 @@ static irqreturn_t stmpe_irq(int irq, void *data) |
1561 |
+ while (status) { |
1562 |
+ int bit = __ffs(status); |
1563 |
+ int line = bank * 8 + bit; |
1564 |
+- int nestedirq = irq_create_mapping(stmpe->domain, line); |
1565 |
++ int nestedirq = irq_find_mapping(stmpe->domain, line); |
1566 |
+ |
1567 |
+ handle_nested_irq(nestedirq); |
1568 |
+ status &= ~(1 << bit); |
1569 |
+diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c |
1570 |
+index 274bf39968aaa..96187c1e5f8f2 100644 |
1571 |
+--- a/drivers/mfd/tc3589x.c |
1572 |
++++ b/drivers/mfd/tc3589x.c |
1573 |
+@@ -187,7 +187,7 @@ again: |
1574 |
+ |
1575 |
+ while (status) { |
1576 |
+ int bit = __ffs(status); |
1577 |
+- int virq = irq_create_mapping(tc3589x->domain, bit); |
1578 |
++ int virq = irq_find_mapping(tc3589x->domain, bit); |
1579 |
+ |
1580 |
+ handle_nested_irq(virq); |
1581 |
+ status &= ~(1 << bit); |
1582 |
+diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c |
1583 |
+index 18710f3b5c534..2c58d9b99a394 100644 |
1584 |
+--- a/drivers/mfd/wm8994-irq.c |
1585 |
++++ b/drivers/mfd/wm8994-irq.c |
1586 |
+@@ -159,7 +159,7 @@ static irqreturn_t wm8994_edge_irq(int irq, void *data) |
1587 |
+ struct wm8994 *wm8994 = data; |
1588 |
+ |
1589 |
+ while (gpio_get_value_cansleep(wm8994->pdata.irq_gpio)) |
1590 |
+- handle_nested_irq(irq_create_mapping(wm8994->edge_irq, 0)); |
1591 |
++ handle_nested_irq(irq_find_mapping(wm8994->edge_irq, 0)); |
1592 |
+ |
1593 |
+ return IRQ_HANDLED; |
1594 |
+ } |
1595 |
+diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1596 |
+index 9c8887d3a4b9c..67863ec9231e8 100644 |
1597 |
+--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1598 |
++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c |
1599 |
+@@ -2344,7 +2344,8 @@ int vmci_qp_broker_map(struct vmci_handle handle, |
1600 |
+ is_local = entry->qp.flags & VMCI_QPFLAG_LOCAL; |
1601 |
+ result = VMCI_SUCCESS; |
1602 |
+ |
1603 |
+- if (context_id != VMCI_HOST_CONTEXT_ID) { |
1604 |
++ if (context_id != VMCI_HOST_CONTEXT_ID && |
1605 |
++ !QPBROKERSTATE_HAS_MEM(entry)) { |
1606 |
+ struct vmci_qp_page_store page_store; |
1607 |
+ |
1608 |
+ page_store.pages = guest_mem; |
1609 |
+@@ -2454,7 +2455,8 @@ int vmci_qp_broker_unmap(struct vmci_handle handle, |
1610 |
+ |
1611 |
+ is_local = entry->qp.flags & VMCI_QPFLAG_LOCAL; |
1612 |
+ |
1613 |
+- if (context_id != VMCI_HOST_CONTEXT_ID) { |
1614 |
++ if (context_id != VMCI_HOST_CONTEXT_ID && |
1615 |
++ QPBROKERSTATE_HAS_MEM(entry)) { |
1616 |
+ qp_acquire_queue_mutex(entry->produce_q); |
1617 |
+ result = qp_save_headers(entry); |
1618 |
+ if (result < VMCI_SUCCESS) |
1619 |
+diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c |
1620 |
+index c6b91efaa9568..209bdf0317b34 100644 |
1621 |
+--- a/drivers/mmc/host/dw_mmc.c |
1622 |
++++ b/drivers/mmc/host/dw_mmc.c |
1623 |
+@@ -762,6 +762,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host, |
1624 |
+ int ret = 0; |
1625 |
+ |
1626 |
+ /* Set external dma config: burst size, burst width */ |
1627 |
++ memset(&cfg, 0, sizeof(cfg)); |
1628 |
+ cfg.dst_addr = host->phy_regs + fifo_offset; |
1629 |
+ cfg.src_addr = cfg.dst_addr; |
1630 |
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1631 |
+diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c |
1632 |
+index bbad309679cf8..41a5493cb68d8 100644 |
1633 |
+--- a/drivers/mmc/host/moxart-mmc.c |
1634 |
++++ b/drivers/mmc/host/moxart-mmc.c |
1635 |
+@@ -633,6 +633,7 @@ static int moxart_probe(struct platform_device *pdev) |
1636 |
+ host->dma_chan_tx, host->dma_chan_rx); |
1637 |
+ host->have_dma = true; |
1638 |
+ |
1639 |
++ memset(&cfg, 0, sizeof(cfg)); |
1640 |
+ cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1641 |
+ cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
1642 |
+ |
1643 |
+diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c |
1644 |
+index 3ccaa1415f33b..efd995e3cb0b9 100644 |
1645 |
+--- a/drivers/mmc/host/rtsx_pci_sdmmc.c |
1646 |
++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c |
1647 |
+@@ -552,9 +552,22 @@ static int sd_write_long_data(struct realtek_pci_sdmmc *host, |
1648 |
+ return 0; |
1649 |
+ } |
1650 |
+ |
1651 |
++static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) |
1652 |
++{ |
1653 |
++ rtsx_pci_write_register(host->pcr, SD_CFG1, |
1654 |
++ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); |
1655 |
++} |
1656 |
++ |
1657 |
++static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) |
1658 |
++{ |
1659 |
++ rtsx_pci_write_register(host->pcr, SD_CFG1, |
1660 |
++ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); |
1661 |
++} |
1662 |
++ |
1663 |
+ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) |
1664 |
+ { |
1665 |
+ struct mmc_data *data = mrq->data; |
1666 |
++ int err; |
1667 |
+ |
1668 |
+ if (host->sg_count < 0) { |
1669 |
+ data->error = host->sg_count; |
1670 |
+@@ -563,22 +576,19 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq) |
1671 |
+ return data->error; |
1672 |
+ } |
1673 |
+ |
1674 |
+- if (data->flags & MMC_DATA_READ) |
1675 |
+- return sd_read_long_data(host, mrq); |
1676 |
++ if (data->flags & MMC_DATA_READ) { |
1677 |
++ if (host->initial_mode) |
1678 |
++ sd_disable_initial_mode(host); |
1679 |
+ |
1680 |
+- return sd_write_long_data(host, mrq); |
1681 |
+-} |
1682 |
++ err = sd_read_long_data(host, mrq); |
1683 |
+ |
1684 |
+-static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host) |
1685 |
+-{ |
1686 |
+- rtsx_pci_write_register(host->pcr, SD_CFG1, |
1687 |
+- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128); |
1688 |
+-} |
1689 |
++ if (host->initial_mode) |
1690 |
++ sd_enable_initial_mode(host); |
1691 |
+ |
1692 |
+-static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host) |
1693 |
+-{ |
1694 |
+- rtsx_pci_write_register(host->pcr, SD_CFG1, |
1695 |
+- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0); |
1696 |
++ return err; |
1697 |
++ } |
1698 |
++ |
1699 |
++ return sd_write_long_data(host, mrq); |
1700 |
+ } |
1701 |
+ |
1702 |
+ static void sd_normal_rw(struct realtek_pci_sdmmc *host, |
1703 |
+diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c |
1704 |
+index 45495bc1a70e2..bcae07e60574f 100644 |
1705 |
+--- a/drivers/mtd/nand/atmel_nand.c |
1706 |
++++ b/drivers/mtd/nand/atmel_nand.c |
1707 |
+@@ -2334,7 +2334,6 @@ err_nand_ioremap: |
1708 |
+ static int atmel_nand_remove(struct platform_device *pdev) |
1709 |
+ { |
1710 |
+ struct atmel_nand_host *host = platform_get_drvdata(pdev); |
1711 |
+- struct mtd_info *mtd = nand_to_mtd(&host->nand_chip); |
1712 |
+ |
1713 |
+ nand_release(&host->nand_chip); |
1714 |
+ |
1715 |
+diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c |
1716 |
+index c16e740c01c38..894d771c87aab 100644 |
1717 |
+--- a/drivers/mtd/nand/cafe_nand.c |
1718 |
++++ b/drivers/mtd/nand/cafe_nand.c |
1719 |
+@@ -700,7 +700,7 @@ static int cafe_nand_probe(struct pci_dev *pdev, |
1720 |
+ "CAFE NAND", mtd); |
1721 |
+ if (err) { |
1722 |
+ dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq); |
1723 |
+- goto out_ior; |
1724 |
++ goto out_free_rs; |
1725 |
+ } |
1726 |
+ |
1727 |
+ /* Disable master reset, enable NAND clock */ |
1728 |
+@@ -808,6 +808,8 @@ static int cafe_nand_probe(struct pci_dev *pdev, |
1729 |
+ /* Disable NAND IRQ in global IRQ mask register */ |
1730 |
+ cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK); |
1731 |
+ free_irq(pdev->irq, mtd); |
1732 |
++ out_free_rs: |
1733 |
++ free_rs(cafe->rs); |
1734 |
+ out_ior: |
1735 |
+ pci_iounmap(pdev, cafe->mmio); |
1736 |
+ out_free_mtd: |
1737 |
+diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c |
1738 |
+index b6867a8915dac..4b8f95ecd0561 100644 |
1739 |
+--- a/drivers/net/dsa/b53/b53_common.c |
1740 |
++++ b/drivers/net/dsa/b53/b53_common.c |
1741 |
+@@ -1798,9 +1798,8 @@ static int b53_switch_init(struct b53_device *dev) |
1742 |
+ dev->cpu_port = 5; |
1743 |
+ } |
1744 |
+ |
1745 |
+- /* cpu port is always last */ |
1746 |
+- dev->num_ports = dev->cpu_port + 1; |
1747 |
+ dev->enabled_ports |= BIT(dev->cpu_port); |
1748 |
++ dev->num_ports = fls(dev->enabled_ports); |
1749 |
+ |
1750 |
+ dev->ports = devm_kzalloc(dev->dev, |
1751 |
+ sizeof(struct b53_port) * dev->num_ports, |
1752 |
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1753 |
+index 545b59ff5d7e7..2f2e60f9b8842 100644 |
1754 |
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1755 |
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |
1756 |
+@@ -1241,7 +1241,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param, |
1757 |
+ |
1758 |
+ /* SR-IOV capability was enabled but there are no VFs*/ |
1759 |
+ if (iov->total == 0) { |
1760 |
+- err = -EINVAL; |
1761 |
++ err = 0; |
1762 |
+ goto failed; |
1763 |
+ } |
1764 |
+ |
1765 |
+diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c |
1766 |
+index f5f1b0b51ebd2..79eb2257a30e6 100644 |
1767 |
+--- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c |
1768 |
++++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c |
1769 |
+@@ -1133,6 +1133,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1770 |
+ if (!adapter->registered_device_map) { |
1771 |
+ pr_err("%s: could not register any net devices\n", |
1772 |
+ pci_name(pdev)); |
1773 |
++ err = -EINVAL; |
1774 |
+ goto out_release_adapter_res; |
1775 |
+ } |
1776 |
+ |
1777 |
+diff --git a/drivers/net/ethernet/qlogic/qed/qed_main.c b/drivers/net/ethernet/qlogic/qed/qed_main.c |
1778 |
+index 708117fc6f733..7669d36151c6e 100644 |
1779 |
+--- a/drivers/net/ethernet/qlogic/qed/qed_main.c |
1780 |
++++ b/drivers/net/ethernet/qlogic/qed/qed_main.c |
1781 |
+@@ -374,7 +374,12 @@ static int qed_enable_msix(struct qed_dev *cdev, |
1782 |
+ rc = cnt; |
1783 |
+ } |
1784 |
+ |
1785 |
+- if (rc > 0) { |
1786 |
++ /* For VFs, we should return with an error in case we didn't get the |
1787 |
++ * exact number of msix vectors as we requested. |
1788 |
++ * Not doing that will lead to a crash when starting queues for |
1789 |
++ * this VF. |
1790 |
++ */ |
1791 |
++ if ((IS_PF(cdev) && rc > 0) || (IS_VF(cdev) && rc == cnt)) { |
1792 |
+ /* MSI-x configuration was achieved */ |
1793 |
+ int_params->out.int_mode = QED_INT_MODE_MSIX; |
1794 |
+ int_params->out.num_vectors = rc; |
1795 |
+diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c |
1796 |
+index 9b1920b58594a..d21a73bc4cde2 100644 |
1797 |
+--- a/drivers/net/ethernet/qlogic/qede/qede_main.c |
1798 |
++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c |
1799 |
+@@ -3145,6 +3145,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev) |
1800 |
+ } |
1801 |
+ |
1802 |
+ edev->int_info.used_cnt = 0; |
1803 |
++ edev->int_info.msix_cnt = 0; |
1804 |
+ } |
1805 |
+ |
1806 |
+ static int qede_req_msix_irqs(struct qede_dev *edev) |
1807 |
+@@ -3644,7 +3645,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode) |
1808 |
+ |
1809 |
+ err4: |
1810 |
+ qede_sync_free_irqs(edev); |
1811 |
+- memset(&edev->int_info.msix_cnt, 0, sizeof(struct qed_int_info)); |
1812 |
+ err3: |
1813 |
+ qede_napi_disable_remove(edev); |
1814 |
+ err2: |
1815 |
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c |
1816 |
+index be41e4c77b657..eff587c6e9be8 100644 |
1817 |
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c |
1818 |
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c |
1819 |
+@@ -440,7 +440,6 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter) |
1820 |
+ QLCWR32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, 1); |
1821 |
+ msleep(20); |
1822 |
+ |
1823 |
+- qlcnic_rom_unlock(adapter); |
1824 |
+ /* big hammer don't reset CAM block on reset */ |
1825 |
+ QLCWR32(adapter, QLCNIC_ROMUSB_GLB_SW_RESET, 0xfeffffff); |
1826 |
+ |
1827 |
+diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c |
1828 |
+index 5ef5d728c2505..065a631238632 100644 |
1829 |
+--- a/drivers/net/ethernet/rdc/r6040.c |
1830 |
++++ b/drivers/net/ethernet/rdc/r6040.c |
1831 |
+@@ -133,6 +133,8 @@ |
1832 |
+ #define PHY_ST 0x8A /* PHY status register */ |
1833 |
+ #define MAC_SM 0xAC /* MAC status machine */ |
1834 |
+ #define MAC_SM_RST 0x0002 /* MAC status machine reset */ |
1835 |
++#define MD_CSC 0xb6 /* MDC speed control register */ |
1836 |
++#define MD_CSC_DEFAULT 0x0030 |
1837 |
+ #define MAC_ID 0xBE /* Identifier register */ |
1838 |
+ |
1839 |
+ #define TX_DCNT 0x80 /* TX descriptor count */ |
1840 |
+@@ -368,8 +370,9 @@ static void r6040_reset_mac(struct r6040_private *lp) |
1841 |
+ { |
1842 |
+ void __iomem *ioaddr = lp->base; |
1843 |
+ int limit = MAC_DEF_TIMEOUT; |
1844 |
+- u16 cmd; |
1845 |
++ u16 cmd, md_csc; |
1846 |
+ |
1847 |
++ md_csc = ioread16(ioaddr + MD_CSC); |
1848 |
+ iowrite16(MAC_RST, ioaddr + MCR1); |
1849 |
+ while (limit--) { |
1850 |
+ cmd = ioread16(ioaddr + MCR1); |
1851 |
+@@ -381,6 +384,10 @@ static void r6040_reset_mac(struct r6040_private *lp) |
1852 |
+ iowrite16(MAC_SM_RST, ioaddr + MAC_SM); |
1853 |
+ iowrite16(0, ioaddr + MAC_SM); |
1854 |
+ mdelay(5); |
1855 |
++ |
1856 |
++ /* Restore MDIO clock frequency */ |
1857 |
++ if (md_csc != MD_CSC_DEFAULT) |
1858 |
++ iowrite16(md_csc, ioaddr + MD_CSC); |
1859 |
+ } |
1860 |
+ |
1861 |
+ static void r6040_init_mac_regs(struct net_device *dev) |
1862 |
+diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c |
1863 |
+index 468f02beccee4..3bfae675b43a4 100644 |
1864 |
+--- a/drivers/net/ethernet/renesas/sh_eth.c |
1865 |
++++ b/drivers/net/ethernet/renesas/sh_eth.c |
1866 |
+@@ -2333,6 +2333,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1867 |
+ else |
1868 |
+ txdesc->status |= cpu_to_le32(TD_TACT); |
1869 |
+ |
1870 |
++ wmb(); /* cur_tx must be incremented after TACT bit was set */ |
1871 |
+ mdp->cur_tx++; |
1872 |
+ |
1873 |
+ if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp))) |
1874 |
+diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1875 |
+index f4ff43a1b5ba0..d8c40b68bc96f 100644 |
1876 |
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1877 |
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c |
1878 |
+@@ -300,10 +300,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
1879 |
+ val &= ~NSS_COMMON_GMAC_CTL_PHY_IFACE_SEL; |
1880 |
+ break; |
1881 |
+ default: |
1882 |
+- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", |
1883 |
+- phy_modes(gmac->phy_mode)); |
1884 |
+- err = -EINVAL; |
1885 |
+- goto err_remove_config_dt; |
1886 |
++ goto err_unsupported_phy; |
1887 |
+ } |
1888 |
+ regmap_write(gmac->nss_common, NSS_COMMON_GMAC_CTL(gmac->id), val); |
1889 |
+ |
1890 |
+@@ -320,10 +317,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
1891 |
+ NSS_COMMON_CLK_SRC_CTRL_OFFSET(gmac->id); |
1892 |
+ break; |
1893 |
+ default: |
1894 |
+- dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", |
1895 |
+- phy_modes(gmac->phy_mode)); |
1896 |
+- err = -EINVAL; |
1897 |
+- goto err_remove_config_dt; |
1898 |
++ goto err_unsupported_phy; |
1899 |
+ } |
1900 |
+ regmap_write(gmac->nss_common, NSS_COMMON_CLK_SRC_CTRL, val); |
1901 |
+ |
1902 |
+@@ -340,8 +334,7 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
1903 |
+ NSS_COMMON_CLK_GATE_GMII_TX_EN(gmac->id); |
1904 |
+ break; |
1905 |
+ default: |
1906 |
+- /* We don't get here; the switch above will have errored out */ |
1907 |
+- unreachable(); |
1908 |
++ goto err_unsupported_phy; |
1909 |
+ } |
1910 |
+ regmap_write(gmac->nss_common, NSS_COMMON_CLK_GATE, val); |
1911 |
+ |
1912 |
+@@ -372,6 +365,11 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) |
1913 |
+ |
1914 |
+ return 0; |
1915 |
+ |
1916 |
++err_unsupported_phy: |
1917 |
++ dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", |
1918 |
++ phy_modes(gmac->phy_mode)); |
1919 |
++ err = -EINVAL; |
1920 |
++ |
1921 |
+ err_remove_config_dt: |
1922 |
+ stmmac_remove_config_dt(pdev, plat_dat); |
1923 |
+ |
1924 |
+diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c |
1925 |
+index d2349a1bc6bae..ae357aecb1ebf 100644 |
1926 |
+--- a/drivers/net/ethernet/wiznet/w5100.c |
1927 |
++++ b/drivers/net/ethernet/wiznet/w5100.c |
1928 |
+@@ -1060,6 +1060,8 @@ static int w5100_mmio_probe(struct platform_device *pdev) |
1929 |
+ mac_addr = data->mac_addr; |
1930 |
+ |
1931 |
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1932 |
++ if (!mem) |
1933 |
++ return -EINVAL; |
1934 |
+ if (resource_size(mem) < W5100_BUS_DIRECT_SIZE) |
1935 |
+ ops = &w5100_mmio_indirect_ops; |
1936 |
+ else |
1937 |
+diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1938 |
+index 9ba36c930ce3b..af9a6a878b233 100644 |
1939 |
+--- a/drivers/net/ethernet/xilinx/ll_temac_main.c |
1940 |
++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c |
1941 |
+@@ -735,10 +735,8 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
1942 |
+ /* Kick off the transfer */ |
1943 |
+ lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */ |
1944 |
+ |
1945 |
+- if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) { |
1946 |
+- netdev_info(ndev, "%s -> netif_stop_queue\n", __func__); |
1947 |
++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) |
1948 |
+ netif_stop_queue(ndev); |
1949 |
+- } |
1950 |
+ |
1951 |
+ return NETDEV_TX_OK; |
1952 |
+ } |
1953 |
+diff --git a/drivers/net/phy/dp83640_reg.h b/drivers/net/phy/dp83640_reg.h |
1954 |
+index e7fe411170034..f7ad94773d81e 100644 |
1955 |
+--- a/drivers/net/phy/dp83640_reg.h |
1956 |
++++ b/drivers/net/phy/dp83640_reg.h |
1957 |
+@@ -4,7 +4,7 @@ |
1958 |
+ #ifndef HAVE_DP83640_REGISTERS |
1959 |
+ #define HAVE_DP83640_REGISTERS |
1960 |
+ |
1961 |
+-#define PAGE0 0x0000 |
1962 |
++/* #define PAGE0 0x0000 */ |
1963 |
+ #define PHYCR2 0x001c /* PHY Control Register 2 */ |
1964 |
+ |
1965 |
+ #define PAGE4 0x0004 |
1966 |
+diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c |
1967 |
+index 4c8baba729339..d86132d41416d 100644 |
1968 |
+--- a/drivers/net/usb/cdc_mbim.c |
1969 |
++++ b/drivers/net/usb/cdc_mbim.c |
1970 |
+@@ -647,6 +647,11 @@ static const struct usb_device_id mbim_devs[] = { |
1971 |
+ .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, |
1972 |
+ }, |
1973 |
+ |
1974 |
++ /* Telit LN920 */ |
1975 |
++ { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1061, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
1976 |
++ .driver_info = (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, |
1977 |
++ }, |
1978 |
++ |
1979 |
+ /* default entry */ |
1980 |
+ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), |
1981 |
+ .driver_info = (unsigned long)&cdc_mbim_info_zlp, |
1982 |
+diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h |
1983 |
+index da7a7c8dafb26..135600405dd09 100644 |
1984 |
+--- a/drivers/net/wireless/ath/ath.h |
1985 |
++++ b/drivers/net/wireless/ath/ath.h |
1986 |
+@@ -199,12 +199,13 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common, |
1987 |
+ bool ath_is_mybeacon(struct ath_common *common, struct ieee80211_hdr *hdr); |
1988 |
+ |
1989 |
+ void ath_hw_setbssidmask(struct ath_common *common); |
1990 |
+-void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key); |
1991 |
++void ath_key_delete(struct ath_common *common, u8 hw_key_idx); |
1992 |
+ int ath_key_config(struct ath_common *common, |
1993 |
+ struct ieee80211_vif *vif, |
1994 |
+ struct ieee80211_sta *sta, |
1995 |
+ struct ieee80211_key_conf *key); |
1996 |
+ bool ath_hw_keyreset(struct ath_common *common, u16 entry); |
1997 |
++bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac); |
1998 |
+ void ath_hw_cycle_counters_update(struct ath_common *common); |
1999 |
+ int32_t ath_hw_get_listen_time(struct ath_common *common); |
2000 |
+ |
2001 |
+diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2002 |
+index 16e052d02c940..0f4836fc3b7c1 100644 |
2003 |
+--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2004 |
++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c |
2005 |
+@@ -522,7 +522,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, |
2006 |
+ } |
2007 |
+ break; |
2008 |
+ case DISABLE_KEY: |
2009 |
+- ath_key_delete(common, key); |
2010 |
++ ath_key_delete(common, key->hw_key_idx); |
2011 |
+ break; |
2012 |
+ default: |
2013 |
+ ret = -EINVAL; |
2014 |
+diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c |
2015 |
+index 73eab12cb3bda..9c2d26b12b699 100644 |
2016 |
+--- a/drivers/net/wireless/ath/ath6kl/wmi.c |
2017 |
++++ b/drivers/net/wireless/ath/ath6kl/wmi.c |
2018 |
+@@ -2513,8 +2513,10 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx) |
2019 |
+ goto free_data_skb; |
2020 |
+ |
2021 |
+ for (index = 0; index < num_pri_streams; index++) { |
2022 |
+- if (WARN_ON(!data_sync_bufs[index].skb)) |
2023 |
++ if (WARN_ON(!data_sync_bufs[index].skb)) { |
2024 |
++ ret = -ENOMEM; |
2025 |
+ goto free_data_skb; |
2026 |
++ } |
2027 |
+ |
2028 |
+ ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev, |
2029 |
+ data_sync_bufs[index]. |
2030 |
+diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
2031 |
+index 7eff6f8023d82..969a2a581b0cd 100644 |
2032 |
+--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
2033 |
++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c |
2034 |
+@@ -3346,7 +3346,8 @@ found: |
2035 |
+ "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n", |
2036 |
+ cptr, code, reference, length, major, minor); |
2037 |
+ if ((!AR_SREV_9485(ah) && length >= 1024) || |
2038 |
+- (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) { |
2039 |
++ (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485) || |
2040 |
++ (length > cptr)) { |
2041 |
+ ath_dbg(common, EEPROM, "Skipping bad header\n"); |
2042 |
+ cptr -= COMP_HDR_LEN; |
2043 |
+ continue; |
2044 |
+diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c |
2045 |
+index a553c91d41a14..7d670a71b7b8b 100644 |
2046 |
+--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c |
2047 |
++++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c |
2048 |
+@@ -1460,7 +1460,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw, |
2049 |
+ } |
2050 |
+ break; |
2051 |
+ case DISABLE_KEY: |
2052 |
+- ath_key_delete(common, key); |
2053 |
++ ath_key_delete(common, key->hw_key_idx); |
2054 |
+ break; |
2055 |
+ default: |
2056 |
+ ret = -EINVAL; |
2057 |
+diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c |
2058 |
+index 9d664398a41b2..b707c14dab6f7 100644 |
2059 |
+--- a/drivers/net/wireless/ath/ath9k/hw.c |
2060 |
++++ b/drivers/net/wireless/ath/ath9k/hw.c |
2061 |
+@@ -1595,7 +1595,6 @@ static void ath9k_hw_apply_gpio_override(struct ath_hw *ah) |
2062 |
+ ath9k_hw_gpio_request_out(ah, i, NULL, |
2063 |
+ AR_GPIO_OUTPUT_MUX_AS_OUTPUT); |
2064 |
+ ath9k_hw_set_gpio(ah, i, !!(ah->gpio_val & BIT(i))); |
2065 |
+- ath9k_hw_gpio_free(ah, i); |
2066 |
+ } |
2067 |
+ } |
2068 |
+ |
2069 |
+@@ -2702,14 +2701,17 @@ static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah, u32 gpio, u32 type) |
2070 |
+ static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out, |
2071 |
+ const char *label) |
2072 |
+ { |
2073 |
++ int err; |
2074 |
++ |
2075 |
+ if (ah->caps.gpio_requested & BIT(gpio)) |
2076 |
+ return; |
2077 |
+ |
2078 |
+- /* may be requested by BSP, free anyway */ |
2079 |
+- gpio_free(gpio); |
2080 |
+- |
2081 |
+- if (gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label)) |
2082 |
++ err = gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label); |
2083 |
++ if (err) { |
2084 |
++ ath_err(ath9k_hw_common(ah), "request GPIO%d failed:%d\n", |
2085 |
++ gpio, err); |
2086 |
+ return; |
2087 |
++ } |
2088 |
+ |
2089 |
+ ah->caps.gpio_requested |= BIT(gpio); |
2090 |
+ } |
2091 |
+diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h |
2092 |
+index 9cbca1229bac0..eec60abe3b96c 100644 |
2093 |
+--- a/drivers/net/wireless/ath/ath9k/hw.h |
2094 |
++++ b/drivers/net/wireless/ath/ath9k/hw.h |
2095 |
+@@ -815,6 +815,7 @@ struct ath_hw { |
2096 |
+ struct ath9k_pacal_info pacal_info; |
2097 |
+ struct ar5416Stats stats; |
2098 |
+ struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES]; |
2099 |
++ DECLARE_BITMAP(pending_del_keymap, ATH_KEYMAX); |
2100 |
+ |
2101 |
+ enum ath9k_int imask; |
2102 |
+ u32 imrs2_reg; |
2103 |
+diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
2104 |
+index 454bf16d6b304..7776f4a8630e4 100644 |
2105 |
+--- a/drivers/net/wireless/ath/ath9k/main.c |
2106 |
++++ b/drivers/net/wireless/ath/ath9k/main.c |
2107 |
+@@ -821,12 +821,80 @@ exit: |
2108 |
+ ieee80211_free_txskb(hw, skb); |
2109 |
+ } |
2110 |
+ |
2111 |
++static bool ath9k_txq_list_has_key(struct list_head *txq_list, u32 keyix) |
2112 |
++{ |
2113 |
++ struct ath_buf *bf; |
2114 |
++ struct ieee80211_tx_info *txinfo; |
2115 |
++ struct ath_frame_info *fi; |
2116 |
++ |
2117 |
++ list_for_each_entry(bf, txq_list, list) { |
2118 |
++ if (bf->bf_state.stale || !bf->bf_mpdu) |
2119 |
++ continue; |
2120 |
++ |
2121 |
++ txinfo = IEEE80211_SKB_CB(bf->bf_mpdu); |
2122 |
++ fi = (struct ath_frame_info *)&txinfo->rate_driver_data[0]; |
2123 |
++ if (fi->keyix == keyix) |
2124 |
++ return true; |
2125 |
++ } |
2126 |
++ |
2127 |
++ return false; |
2128 |
++} |
2129 |
++ |
2130 |
++static bool ath9k_txq_has_key(struct ath_softc *sc, u32 keyix) |
2131 |
++{ |
2132 |
++ struct ath_hw *ah = sc->sc_ah; |
2133 |
++ int i; |
2134 |
++ struct ath_txq *txq; |
2135 |
++ bool key_in_use = false; |
2136 |
++ |
2137 |
++ for (i = 0; !key_in_use && i < ATH9K_NUM_TX_QUEUES; i++) { |
2138 |
++ if (!ATH_TXQ_SETUP(sc, i)) |
2139 |
++ continue; |
2140 |
++ txq = &sc->tx.txq[i]; |
2141 |
++ if (!txq->axq_depth) |
2142 |
++ continue; |
2143 |
++ if (!ath9k_hw_numtxpending(ah, txq->axq_qnum)) |
2144 |
++ continue; |
2145 |
++ |
2146 |
++ ath_txq_lock(sc, txq); |
2147 |
++ key_in_use = ath9k_txq_list_has_key(&txq->axq_q, keyix); |
2148 |
++ if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
2149 |
++ int idx = txq->txq_tailidx; |
2150 |
++ |
2151 |
++ while (!key_in_use && |
2152 |
++ !list_empty(&txq->txq_fifo[idx])) { |
2153 |
++ key_in_use = ath9k_txq_list_has_key( |
2154 |
++ &txq->txq_fifo[idx], keyix); |
2155 |
++ INCR(idx, ATH_TXFIFO_DEPTH); |
2156 |
++ } |
2157 |
++ } |
2158 |
++ ath_txq_unlock(sc, txq); |
2159 |
++ } |
2160 |
++ |
2161 |
++ return key_in_use; |
2162 |
++} |
2163 |
++ |
2164 |
++static void ath9k_pending_key_del(struct ath_softc *sc, u8 keyix) |
2165 |
++{ |
2166 |
++ struct ath_hw *ah = sc->sc_ah; |
2167 |
++ struct ath_common *common = ath9k_hw_common(ah); |
2168 |
++ |
2169 |
++ if (!test_bit(keyix, ah->pending_del_keymap) || |
2170 |
++ ath9k_txq_has_key(sc, keyix)) |
2171 |
++ return; |
2172 |
++ |
2173 |
++ /* No more TXQ frames point to this key cache entry, so delete it. */ |
2174 |
++ clear_bit(keyix, ah->pending_del_keymap); |
2175 |
++ ath_key_delete(common, keyix); |
2176 |
++} |
2177 |
++ |
2178 |
+ static void ath9k_stop(struct ieee80211_hw *hw) |
2179 |
+ { |
2180 |
+ struct ath_softc *sc = hw->priv; |
2181 |
+ struct ath_hw *ah = sc->sc_ah; |
2182 |
+ struct ath_common *common = ath9k_hw_common(ah); |
2183 |
+ bool prev_idle; |
2184 |
++ int i; |
2185 |
+ |
2186 |
+ ath9k_deinit_channel_context(sc); |
2187 |
+ |
2188 |
+@@ -894,6 +962,14 @@ static void ath9k_stop(struct ieee80211_hw *hw) |
2189 |
+ |
2190 |
+ spin_unlock_bh(&sc->sc_pcu_lock); |
2191 |
+ |
2192 |
++ for (i = 0; i < ATH_KEYMAX; i++) |
2193 |
++ ath9k_pending_key_del(sc, i); |
2194 |
++ |
2195 |
++ /* Clear key cache entries explicitly to get rid of any potentially |
2196 |
++ * remaining keys. |
2197 |
++ */ |
2198 |
++ ath9k_cmn_init_crypto(sc->sc_ah); |
2199 |
++ |
2200 |
+ ath9k_ps_restore(sc); |
2201 |
+ |
2202 |
+ sc->ps_idle = prev_idle; |
2203 |
+@@ -1539,12 +1615,11 @@ static void ath9k_del_ps_key(struct ath_softc *sc, |
2204 |
+ { |
2205 |
+ struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
2206 |
+ struct ath_node *an = (struct ath_node *) sta->drv_priv; |
2207 |
+- struct ieee80211_key_conf ps_key = { .hw_key_idx = an->ps_key }; |
2208 |
+ |
2209 |
+ if (!an->ps_key) |
2210 |
+ return; |
2211 |
+ |
2212 |
+- ath_key_delete(common, &ps_key); |
2213 |
++ ath_key_delete(common, an->ps_key); |
2214 |
+ an->ps_key = 0; |
2215 |
+ an->key_idx[0] = 0; |
2216 |
+ } |
2217 |
+@@ -1706,6 +1781,12 @@ static int ath9k_set_key(struct ieee80211_hw *hw, |
2218 |
+ if (sta) |
2219 |
+ an = (struct ath_node *)sta->drv_priv; |
2220 |
+ |
2221 |
++ /* Delete pending key cache entries if no more frames are pointing to |
2222 |
++ * them in TXQs. |
2223 |
++ */ |
2224 |
++ for (i = 0; i < ATH_KEYMAX; i++) |
2225 |
++ ath9k_pending_key_del(sc, i); |
2226 |
++ |
2227 |
+ switch (cmd) { |
2228 |
+ case SET_KEY: |
2229 |
+ if (sta) |
2230 |
+@@ -1735,7 +1816,15 @@ static int ath9k_set_key(struct ieee80211_hw *hw, |
2231 |
+ } |
2232 |
+ break; |
2233 |
+ case DISABLE_KEY: |
2234 |
+- ath_key_delete(common, key); |
2235 |
++ if (ath9k_txq_has_key(sc, key->hw_key_idx)) { |
2236 |
++ /* Delay key cache entry deletion until there are no |
2237 |
++ * remaining TXQ frames pointing to this entry. |
2238 |
++ */ |
2239 |
++ set_bit(key->hw_key_idx, sc->sc_ah->pending_del_keymap); |
2240 |
++ ath_hw_keysetmac(common, key->hw_key_idx, NULL); |
2241 |
++ } else { |
2242 |
++ ath_key_delete(common, key->hw_key_idx); |
2243 |
++ } |
2244 |
+ if (an) { |
2245 |
+ for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) { |
2246 |
+ if (an->key_idx[i] != key->hw_key_idx) |
2247 |
+diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c |
2248 |
+index 1816b4e7dc264..61b59a804e308 100644 |
2249 |
+--- a/drivers/net/wireless/ath/key.c |
2250 |
++++ b/drivers/net/wireless/ath/key.c |
2251 |
+@@ -84,8 +84,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry) |
2252 |
+ } |
2253 |
+ EXPORT_SYMBOL(ath_hw_keyreset); |
2254 |
+ |
2255 |
+-static bool ath_hw_keysetmac(struct ath_common *common, |
2256 |
+- u16 entry, const u8 *mac) |
2257 |
++bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac) |
2258 |
+ { |
2259 |
+ u32 macHi, macLo; |
2260 |
+ u32 unicast_flag = AR_KEYTABLE_VALID; |
2261 |
+@@ -125,6 +124,7 @@ static bool ath_hw_keysetmac(struct ath_common *common, |
2262 |
+ |
2263 |
+ return true; |
2264 |
+ } |
2265 |
++EXPORT_SYMBOL(ath_hw_keysetmac); |
2266 |
+ |
2267 |
+ static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry, |
2268 |
+ const struct ath_keyval *k, |
2269 |
+@@ -581,29 +581,38 @@ EXPORT_SYMBOL(ath_key_config); |
2270 |
+ /* |
2271 |
+ * Delete Key. |
2272 |
+ */ |
2273 |
+-void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key) |
2274 |
++void ath_key_delete(struct ath_common *common, u8 hw_key_idx) |
2275 |
+ { |
2276 |
+- ath_hw_keyreset(common, key->hw_key_idx); |
2277 |
+- if (key->hw_key_idx < IEEE80211_WEP_NKID) |
2278 |
++ /* Leave CCMP and TKIP (main key) configured to avoid disabling |
2279 |
++ * encryption for potentially pending frames already in a TXQ with the |
2280 |
++ * keyix pointing to this key entry. Instead, only clear the MAC address |
2281 |
++ * to prevent RX processing from using this key cache entry. |
2282 |
++ */ |
2283 |
++ if (test_bit(hw_key_idx, common->ccmp_keymap) || |
2284 |
++ test_bit(hw_key_idx, common->tkip_keymap)) |
2285 |
++ ath_hw_keysetmac(common, hw_key_idx, NULL); |
2286 |
++ else |
2287 |
++ ath_hw_keyreset(common, hw_key_idx); |
2288 |
++ if (hw_key_idx < IEEE80211_WEP_NKID) |
2289 |
+ return; |
2290 |
+ |
2291 |
+- clear_bit(key->hw_key_idx, common->keymap); |
2292 |
+- clear_bit(key->hw_key_idx, common->ccmp_keymap); |
2293 |
+- if (key->cipher != WLAN_CIPHER_SUITE_TKIP) |
2294 |
++ clear_bit(hw_key_idx, common->keymap); |
2295 |
++ clear_bit(hw_key_idx, common->ccmp_keymap); |
2296 |
++ if (!test_bit(hw_key_idx, common->tkip_keymap)) |
2297 |
+ return; |
2298 |
+ |
2299 |
+- clear_bit(key->hw_key_idx + 64, common->keymap); |
2300 |
++ clear_bit(hw_key_idx + 64, common->keymap); |
2301 |
+ |
2302 |
+- clear_bit(key->hw_key_idx, common->tkip_keymap); |
2303 |
+- clear_bit(key->hw_key_idx + 64, common->tkip_keymap); |
2304 |
++ clear_bit(hw_key_idx, common->tkip_keymap); |
2305 |
++ clear_bit(hw_key_idx + 64, common->tkip_keymap); |
2306 |
+ |
2307 |
+ if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) { |
2308 |
+- ath_hw_keyreset(common, key->hw_key_idx + 32); |
2309 |
+- clear_bit(key->hw_key_idx + 32, common->keymap); |
2310 |
+- clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |
2311 |
++ ath_hw_keyreset(common, hw_key_idx + 32); |
2312 |
++ clear_bit(hw_key_idx + 32, common->keymap); |
2313 |
++ clear_bit(hw_key_idx + 64 + 32, common->keymap); |
2314 |
+ |
2315 |
+- clear_bit(key->hw_key_idx + 32, common->tkip_keymap); |
2316 |
+- clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap); |
2317 |
++ clear_bit(hw_key_idx + 32, common->tkip_keymap); |
2318 |
++ clear_bit(hw_key_idx + 64 + 32, common->tkip_keymap); |
2319 |
+ } |
2320 |
+ } |
2321 |
+ EXPORT_SYMBOL(ath_key_delete); |
2322 |
+diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c |
2323 |
+index e2bce9385eda6..c87f27d3ee31f 100644 |
2324 |
+--- a/drivers/nvme/host/pci.c |
2325 |
++++ b/drivers/nvme/host/pci.c |
2326 |
+@@ -1927,7 +1927,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2327 |
+ |
2328 |
+ result = nvme_dev_map(dev); |
2329 |
+ if (result) |
2330 |
+- goto free; |
2331 |
++ goto put_pci; |
2332 |
+ |
2333 |
+ INIT_WORK(&dev->reset_work, nvme_reset_work); |
2334 |
+ INIT_WORK(&dev->remove_work, nvme_remove_dead_ctrl_work); |
2335 |
+@@ -1938,7 +1938,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2336 |
+ |
2337 |
+ result = nvme_setup_prp_pools(dev); |
2338 |
+ if (result) |
2339 |
+- goto put_pci; |
2340 |
++ goto unmap; |
2341 |
+ |
2342 |
+ result = nvme_init_ctrl(&dev->ctrl, &pdev->dev, &nvme_pci_ctrl_ops, |
2343 |
+ id->driver_data); |
2344 |
+@@ -1953,9 +1953,10 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
2345 |
+ |
2346 |
+ release_pools: |
2347 |
+ nvme_release_prp_pools(dev); |
2348 |
++ unmap: |
2349 |
++ nvme_dev_unmap(dev); |
2350 |
+ put_pci: |
2351 |
+ put_device(dev->dev); |
2352 |
+- nvme_dev_unmap(dev); |
2353 |
+ free: |
2354 |
+ kfree(dev->queues); |
2355 |
+ kfree(dev); |
2356 |
+diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c |
2357 |
+index 2e21af43d91ea..b6d808037045d 100644 |
2358 |
+--- a/drivers/parport/ieee1284_ops.c |
2359 |
++++ b/drivers/parport/ieee1284_ops.c |
2360 |
+@@ -534,7 +534,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port, |
2361 |
+ goto out; |
2362 |
+ |
2363 |
+ /* Yield the port for a while. */ |
2364 |
+- if (count && dev->port->irq != PARPORT_IRQ_NONE) { |
2365 |
++ if (dev->port->irq != PARPORT_IRQ_NONE) { |
2366 |
+ parport_release (dev); |
2367 |
+ schedule_timeout_interruptible(msecs_to_jiffies(40)); |
2368 |
+ parport_claim_or_block (dev); |
2369 |
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c |
2370 |
+index 77810f4240492..97c3515e3b543 100644 |
2371 |
+--- a/drivers/pci/msi.c |
2372 |
++++ b/drivers/pci/msi.c |
2373 |
+@@ -777,6 +777,9 @@ static void msix_mask_all(void __iomem *base, int tsize) |
2374 |
+ u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT; |
2375 |
+ int i; |
2376 |
+ |
2377 |
++ if (pci_msi_ignore_mask) |
2378 |
++ return; |
2379 |
++ |
2380 |
+ for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE) |
2381 |
+ writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL); |
2382 |
+ } |
2383 |
+diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c |
2384 |
+index e09653c73ab4b..2cf13578fe754 100644 |
2385 |
+--- a/drivers/pci/pci.c |
2386 |
++++ b/drivers/pci/pci.c |
2387 |
+@@ -1384,11 +1384,7 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags) |
2388 |
+ * so that things like MSI message writing will behave as expected |
2389 |
+ * (e.g. if the device really is in D0 at enable time). |
2390 |
+ */ |
2391 |
+- if (dev->pm_cap) { |
2392 |
+- u16 pmcsr; |
2393 |
+- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); |
2394 |
+- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); |
2395 |
+- } |
2396 |
++ pci_update_current_state(dev, dev->current_state); |
2397 |
+ |
2398 |
+ if (atomic_inc_return(&dev->enable_cnt) > 1) |
2399 |
+ return 0; /* already enabled */ |
2400 |
+@@ -1926,7 +1922,14 @@ int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, |
2401 |
+ if (enable) { |
2402 |
+ int error; |
2403 |
+ |
2404 |
+- if (pci_pme_capable(dev, state)) |
2405 |
++ /* |
2406 |
++ * Enable PME signaling if the device can signal PME from |
2407 |
++ * D3cold regardless of whether or not it can signal PME from |
2408 |
++ * the current target state, because that will allow it to |
2409 |
++ * signal PME when the hierarchy above it goes into D3cold and |
2410 |
++ * the device itself ends up in D3cold as a result of that. |
2411 |
++ */ |
2412 |
++ if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold)) |
2413 |
+ pci_pme_active(dev, true); |
2414 |
+ else |
2415 |
+ ret = 1; |
2416 |
+diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c |
2417 |
+index 096ba11ac1058..66e5bb7bfb67b 100644 |
2418 |
+--- a/drivers/pci/quirks.c |
2419 |
++++ b/drivers/pci/quirks.c |
2420 |
+@@ -2994,12 +2994,13 @@ static void fixup_mpss_256(struct pci_dev *dev) |
2421 |
+ { |
2422 |
+ dev->pcie_mpss = 1; /* 256 bytes */ |
2423 |
+ } |
2424 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
2425 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256); |
2426 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
2427 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); |
2428 |
+-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE, |
2429 |
+- PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); |
2430 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
2431 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256); |
2432 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
2433 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256); |
2434 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE, |
2435 |
++ PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256); |
2436 |
++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ASMEDIA, 0x0612, fixup_mpss_256); |
2437 |
+ |
2438 |
+ /* Intel 5000 and 5100 Memory controllers have an errata with read completion |
2439 |
+ * coalescing (which is enabled by default on some BIOSes) and MPS of 256B. |
2440 |
+diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c |
2441 |
+index 7958250856d36..f602176eb8b04 100644 |
2442 |
+--- a/drivers/pci/syscall.c |
2443 |
++++ b/drivers/pci/syscall.c |
2444 |
+@@ -23,8 +23,10 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn, |
2445 |
+ long err; |
2446 |
+ int cfg_ret; |
2447 |
+ |
2448 |
++ err = -EPERM; |
2449 |
++ dev = NULL; |
2450 |
+ if (!capable(CAP_SYS_ADMIN)) |
2451 |
+- return -EPERM; |
2452 |
++ goto error; |
2453 |
+ |
2454 |
+ err = -ENODEV; |
2455 |
+ dev = pci_get_bus_and_slot(bus, dfn); |
2456 |
+diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c |
2457 |
+index 8769a579ecb13..01f42090cd036 100644 |
2458 |
+--- a/drivers/pinctrl/pinctrl-single.c |
2459 |
++++ b/drivers/pinctrl/pinctrl-single.c |
2460 |
+@@ -1335,6 +1335,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs, |
2461 |
+ |
2462 |
+ if (PCS_HAS_PINCONF) { |
2463 |
+ dev_err(pcs->dev, "pinconf not supported\n"); |
2464 |
++ res = -ENOTSUPP; |
2465 |
+ goto free_pingroups; |
2466 |
+ } |
2467 |
+ |
2468 |
+diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c |
2469 |
+index d225a835a64cf..c1879e40d7187 100644 |
2470 |
+--- a/drivers/platform/chrome/cros_ec_proto.c |
2471 |
++++ b/drivers/platform/chrome/cros_ec_proto.c |
2472 |
+@@ -183,6 +183,15 @@ static int cros_ec_host_command_proto_query(struct cros_ec_device *ec_dev, |
2473 |
+ msg->insize = sizeof(struct ec_response_get_protocol_info); |
2474 |
+ |
2475 |
+ ret = send_command(ec_dev, msg); |
2476 |
++ /* |
2477 |
++ * Send command once again when timeout occurred. |
2478 |
++ * Fingerprint MCU (FPMCU) is restarted during system boot which |
2479 |
++ * introduces small window in which FPMCU won't respond for any |
2480 |
++ * messages sent by kernel. There is no need to wait before next |
2481 |
++ * attempt because we waited at least EC_MSG_DEADLINE_MS. |
2482 |
++ */ |
2483 |
++ if (ret == -ETIMEDOUT) |
2484 |
++ ret = send_command(ec_dev, msg); |
2485 |
+ |
2486 |
+ if (ret < 0) { |
2487 |
+ dev_dbg(ec_dev->dev, |
2488 |
+diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c |
2489 |
+index 089056cb8e73a..85e6c9bacf067 100644 |
2490 |
+--- a/drivers/power/supply/axp288_fuel_gauge.c |
2491 |
++++ b/drivers/power/supply/axp288_fuel_gauge.c |
2492 |
+@@ -169,7 +169,7 @@ static int fuel_gauge_reg_readb(struct axp288_fg_info *info, int reg) |
2493 |
+ } |
2494 |
+ |
2495 |
+ if (ret < 0) { |
2496 |
+- dev_err(&info->pdev->dev, "axp288 reg read err:%d\n", ret); |
2497 |
++ dev_err(&info->pdev->dev, "Error reading reg 0x%02x err: %d\n", reg, ret); |
2498 |
+ return ret; |
2499 |
+ } |
2500 |
+ |
2501 |
+@@ -183,7 +183,7 @@ static int fuel_gauge_reg_writeb(struct axp288_fg_info *info, int reg, u8 val) |
2502 |
+ ret = regmap_write(info->regmap, reg, (unsigned int)val); |
2503 |
+ |
2504 |
+ if (ret < 0) |
2505 |
+- dev_err(&info->pdev->dev, "axp288 reg write err:%d\n", ret); |
2506 |
++ dev_err(&info->pdev->dev, "Error writing reg 0x%02x err: %d\n", reg, ret); |
2507 |
+ |
2508 |
+ return ret; |
2509 |
+ } |
2510 |
+diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c |
2511 |
+index da7a75f824891..f18d845b3b92d 100644 |
2512 |
+--- a/drivers/power/supply/max17042_battery.c |
2513 |
++++ b/drivers/power/supply/max17042_battery.c |
2514 |
+@@ -644,7 +644,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip) |
2515 |
+ struct max17042_config_data *config = chip->pdata->config_data; |
2516 |
+ |
2517 |
+ max17042_override_por(map, MAX17042_TGAIN, config->tgain); |
2518 |
+- max17042_override_por(map, MAx17042_TOFF, config->toff); |
2519 |
++ max17042_override_por(map, MAX17042_TOFF, config->toff); |
2520 |
+ max17042_override_por(map, MAX17042_CGAIN, config->cgain); |
2521 |
+ max17042_override_por(map, MAX17042_COFF, config->coff); |
2522 |
+ |
2523 |
+@@ -760,8 +760,12 @@ static irqreturn_t max17042_thread_handler(int id, void *dev) |
2524 |
+ { |
2525 |
+ struct max17042_chip *chip = dev; |
2526 |
+ u32 val; |
2527 |
++ int ret; |
2528 |
++ |
2529 |
++ ret = regmap_read(chip->regmap, MAX17042_STATUS, &val); |
2530 |
++ if (ret) |
2531 |
++ return IRQ_HANDLED; |
2532 |
+ |
2533 |
+- regmap_read(chip->regmap, MAX17042_STATUS, &val); |
2534 |
+ if ((val & STATUS_INTR_SOCMIN_BIT) || |
2535 |
+ (val & STATUS_INTR_SOCMAX_BIT)) { |
2536 |
+ dev_info(&chip->client->dev, "SOC threshold INTR\n"); |
2537 |
+diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c |
2538 |
+index 5a3d53caa485f..74ddd2ab3fced 100644 |
2539 |
+--- a/drivers/rtc/rtc-tps65910.c |
2540 |
++++ b/drivers/rtc/rtc-tps65910.c |
2541 |
+@@ -332,6 +332,6 @@ static struct platform_driver tps65910_rtc_driver = { |
2542 |
+ }; |
2543 |
+ |
2544 |
+ module_platform_driver(tps65910_rtc_driver); |
2545 |
+-MODULE_ALIAS("platform:rtc-tps65910"); |
2546 |
++MODULE_ALIAS("platform:tps65910-rtc"); |
2547 |
+ MODULE_AUTHOR("Venu Byravarasu <vbyravarasu@××××××.com>"); |
2548 |
+ MODULE_LICENSE("GPL"); |
2549 |
+diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c |
2550 |
+index b9b4491d732ab..72a66f1130174 100644 |
2551 |
+--- a/drivers/scsi/BusLogic.c |
2552 |
++++ b/drivers/scsi/BusLogic.c |
2553 |
+@@ -3597,7 +3597,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, |
2554 |
+ if (buf[0] != '\n' || len > 1) |
2555 |
+ printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf); |
2556 |
+ } else |
2557 |
+- printk("%s", buf); |
2558 |
++ pr_cont("%s", buf); |
2559 |
+ } else { |
2560 |
+ if (begin) { |
2561 |
+ if (adapter != NULL && adapter->adapter_initd) |
2562 |
+@@ -3605,7 +3605,7 @@ static void blogic_msg(enum blogic_msglevel msglevel, char *fmt, |
2563 |
+ else |
2564 |
+ printk("%s%s", blogic_msglevelmap[msglevel], buf); |
2565 |
+ } else |
2566 |
+- printk("%s", buf); |
2567 |
++ pr_cont("%s", buf); |
2568 |
+ } |
2569 |
+ begin = (buf[len - 1] == '\n'); |
2570 |
+ } |
2571 |
+diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c |
2572 |
+index d0337b2a71c81..783cb3364599b 100644 |
2573 |
+--- a/drivers/soc/qcom/smsm.c |
2574 |
++++ b/drivers/soc/qcom/smsm.c |
2575 |
+@@ -117,7 +117,7 @@ struct smsm_entry { |
2576 |
+ DECLARE_BITMAP(irq_enabled, 32); |
2577 |
+ DECLARE_BITMAP(irq_rising, 32); |
2578 |
+ DECLARE_BITMAP(irq_falling, 32); |
2579 |
+- u32 last_value; |
2580 |
++ unsigned long last_value; |
2581 |
+ |
2582 |
+ u32 *remote_state; |
2583 |
+ u32 *subscription; |
2584 |
+@@ -212,8 +212,7 @@ static irqreturn_t smsm_intr(int irq, void *data) |
2585 |
+ u32 val; |
2586 |
+ |
2587 |
+ val = readl(entry->remote_state); |
2588 |
+- changed = val ^ entry->last_value; |
2589 |
+- entry->last_value = val; |
2590 |
++ changed = val ^ xchg(&entry->last_value, val); |
2591 |
+ |
2592 |
+ for_each_set_bit(i, entry->irq_enabled, 32) { |
2593 |
+ if (!(changed & BIT(i))) |
2594 |
+@@ -274,6 +273,12 @@ static void smsm_unmask_irq(struct irq_data *irqd) |
2595 |
+ struct qcom_smsm *smsm = entry->smsm; |
2596 |
+ u32 val; |
2597 |
+ |
2598 |
++ /* Make sure our last cached state is up-to-date */ |
2599 |
++ if (readl(entry->remote_state) & BIT(irq)) |
2600 |
++ set_bit(irq, &entry->last_value); |
2601 |
++ else |
2602 |
++ clear_bit(irq, &entry->last_value); |
2603 |
++ |
2604 |
+ set_bit(irq, entry->irq_enabled); |
2605 |
+ |
2606 |
+ if (entry->subscription) { |
2607 |
+diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c |
2608 |
+index 9a97ad973c416..021dddf484e5b 100644 |
2609 |
+--- a/drivers/spi/spi-pic32.c |
2610 |
++++ b/drivers/spi/spi-pic32.c |
2611 |
+@@ -369,6 +369,7 @@ static int pic32_spi_dma_config(struct pic32_spi *pic32s, u32 dma_width) |
2612 |
+ struct dma_slave_config cfg; |
2613 |
+ int ret; |
2614 |
+ |
2615 |
++ memset(&cfg, 0, sizeof(cfg)); |
2616 |
+ cfg.device_fc = true; |
2617 |
+ cfg.src_addr = pic32s->dma_base + buf_offset; |
2618 |
+ cfg.dst_addr = pic32s->dma_base + buf_offset; |
2619 |
+diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c |
2620 |
+index 86dc411016105..1e2b33912a8a4 100644 |
2621 |
+--- a/drivers/staging/board/board.c |
2622 |
++++ b/drivers/staging/board/board.c |
2623 |
+@@ -139,6 +139,7 @@ int __init board_staging_register_clock(const struct board_staging_clk *bsc) |
2624 |
+ static int board_staging_add_dev_domain(struct platform_device *pdev, |
2625 |
+ const char *domain) |
2626 |
+ { |
2627 |
++ struct device *dev = &pdev->dev; |
2628 |
+ struct of_phandle_args pd_args; |
2629 |
+ struct device_node *np; |
2630 |
+ |
2631 |
+@@ -151,7 +152,11 @@ static int board_staging_add_dev_domain(struct platform_device *pdev, |
2632 |
+ pd_args.np = np; |
2633 |
+ pd_args.args_count = 0; |
2634 |
+ |
2635 |
+- return of_genpd_add_device(&pd_args, &pdev->dev); |
2636 |
++ /* Initialization similar to device_pm_init_common() */ |
2637 |
++ spin_lock_init(&dev->power.lock); |
2638 |
++ dev->power.early_init = true; |
2639 |
++ |
2640 |
++ return of_genpd_add_device(&pd_args, dev); |
2641 |
+ } |
2642 |
+ #else |
2643 |
+ static inline int board_staging_add_dev_domain(struct platform_device *pdev, |
2644 |
+diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c |
2645 |
+index 81c46f4d0935a..16d2036018e27 100644 |
2646 |
+--- a/drivers/staging/ks7010/ks7010_sdio.c |
2647 |
++++ b/drivers/staging/ks7010/ks7010_sdio.c |
2648 |
+@@ -1037,9 +1037,9 @@ static int ks7010_sdio_probe(struct sdio_func *func, |
2649 |
+ memset(&priv->wstats, 0, sizeof(priv->wstats)); |
2650 |
+ |
2651 |
+ /* sleep mode */ |
2652 |
++ atomic_set(&priv->sleepstatus.status, 0); |
2653 |
+ atomic_set(&priv->sleepstatus.doze_request, 0); |
2654 |
+ atomic_set(&priv->sleepstatus.wakeup_request, 0); |
2655 |
+- atomic_set(&priv->sleepstatus.wakeup_request, 0); |
2656 |
+ |
2657 |
+ trx_device_init(priv); |
2658 |
+ hostif_init(priv); |
2659 |
+diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c |
2660 |
+index 96ce6bd1cc6f6..4b6f93067ae49 100644 |
2661 |
+--- a/drivers/tty/hvc/hvsi.c |
2662 |
++++ b/drivers/tty/hvc/hvsi.c |
2663 |
+@@ -1051,7 +1051,7 @@ static const struct tty_operations hvsi_ops = { |
2664 |
+ |
2665 |
+ static int __init hvsi_init(void) |
2666 |
+ { |
2667 |
+- int i; |
2668 |
++ int i, ret; |
2669 |
+ |
2670 |
+ hvsi_driver = alloc_tty_driver(hvsi_count); |
2671 |
+ if (!hvsi_driver) |
2672 |
+@@ -1082,12 +1082,25 @@ static int __init hvsi_init(void) |
2673 |
+ } |
2674 |
+ hvsi_wait = wait_for_state; /* irqs active now */ |
2675 |
+ |
2676 |
+- if (tty_register_driver(hvsi_driver)) |
2677 |
+- panic("Couldn't register hvsi console driver\n"); |
2678 |
++ ret = tty_register_driver(hvsi_driver); |
2679 |
++ if (ret) { |
2680 |
++ pr_err("Couldn't register hvsi console driver\n"); |
2681 |
++ goto err_free_irq; |
2682 |
++ } |
2683 |
+ |
2684 |
+ printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count); |
2685 |
+ |
2686 |
+ return 0; |
2687 |
++err_free_irq: |
2688 |
++ hvsi_wait = poll_for_state; |
2689 |
++ for (i = 0; i < hvsi_count; i++) { |
2690 |
++ struct hvsi_struct *hp = &hvsi_ports[i]; |
2691 |
++ |
2692 |
++ free_irq(hp->virq, hp); |
2693 |
++ } |
2694 |
++ tty_driver_kref_put(hvsi_driver); |
2695 |
++ |
2696 |
++ return ret; |
2697 |
+ } |
2698 |
+ device_initcall(hvsi_init); |
2699 |
+ |
2700 |
+diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c |
2701 |
+index a9c46e10d204c..550f2f0523d84 100644 |
2702 |
+--- a/drivers/tty/serial/8250/8250_pci.c |
2703 |
++++ b/drivers/tty/serial/8250/8250_pci.c |
2704 |
+@@ -73,7 +73,7 @@ static void moan_device(const char *str, struct pci_dev *dev) |
2705 |
+ |
2706 |
+ static int |
2707 |
+ setup_port(struct serial_private *priv, struct uart_8250_port *port, |
2708 |
+- int bar, int offset, int regshift) |
2709 |
++ u8 bar, unsigned int offset, int regshift) |
2710 |
+ { |
2711 |
+ struct pci_dev *dev = priv->dev; |
2712 |
+ |
2713 |
+diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c |
2714 |
+index 611bc05565719..460c35b2b54d9 100644 |
2715 |
+--- a/drivers/tty/serial/8250/8250_port.c |
2716 |
++++ b/drivers/tty/serial/8250/8250_port.c |
2717 |
+@@ -125,7 +125,8 @@ static const struct serial8250_config uart_config[] = { |
2718 |
+ .name = "16C950/954", |
2719 |
+ .fifo_size = 128, |
2720 |
+ .tx_loadsz = 128, |
2721 |
+- .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10, |
2722 |
++ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01, |
2723 |
++ .rxtrig_bytes = {16, 32, 112, 120}, |
2724 |
+ /* UART_CAP_EFR breaks billionon CF bluetooth card. */ |
2725 |
+ .flags = UART_CAP_FIFO | UART_CAP_SLEEP, |
2726 |
+ }, |
2727 |
+diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c |
2728 |
+index c6fdd6369534c..96e01bf4599c9 100644 |
2729 |
+--- a/drivers/tty/serial/jsm/jsm_neo.c |
2730 |
++++ b/drivers/tty/serial/jsm/jsm_neo.c |
2731 |
+@@ -827,7 +827,9 @@ static void neo_parse_isr(struct jsm_board *brd, u32 port) |
2732 |
+ /* Parse any modem signal changes */ |
2733 |
+ jsm_dbg(INTR, &ch->ch_bd->pci_dev, |
2734 |
+ "MOD_STAT: sending to parse_modem_sigs\n"); |
2735 |
++ spin_lock_irqsave(&ch->uart_port.lock, lock_flags); |
2736 |
+ neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr)); |
2737 |
++ spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags); |
2738 |
+ } |
2739 |
+ } |
2740 |
+ |
2741 |
+diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c |
2742 |
+index ec7d8383900fc..7c790ff6b5116 100644 |
2743 |
+--- a/drivers/tty/serial/jsm/jsm_tty.c |
2744 |
++++ b/drivers/tty/serial/jsm/jsm_tty.c |
2745 |
+@@ -195,6 +195,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state) |
2746 |
+ |
2747 |
+ static int jsm_tty_open(struct uart_port *port) |
2748 |
+ { |
2749 |
++ unsigned long lock_flags; |
2750 |
+ struct jsm_board *brd; |
2751 |
+ struct jsm_channel *channel = |
2752 |
+ container_of(port, struct jsm_channel, uart_port); |
2753 |
+@@ -248,6 +249,7 @@ static int jsm_tty_open(struct uart_port *port) |
2754 |
+ channel->ch_cached_lsr = 0; |
2755 |
+ channel->ch_stops_sent = 0; |
2756 |
+ |
2757 |
++ spin_lock_irqsave(&port->lock, lock_flags); |
2758 |
+ termios = &port->state->port.tty->termios; |
2759 |
+ channel->ch_c_cflag = termios->c_cflag; |
2760 |
+ channel->ch_c_iflag = termios->c_iflag; |
2761 |
+@@ -267,6 +269,7 @@ static int jsm_tty_open(struct uart_port *port) |
2762 |
+ jsm_carrier(channel); |
2763 |
+ |
2764 |
+ channel->ch_open_count++; |
2765 |
++ spin_unlock_irqrestore(&port->lock, lock_flags); |
2766 |
+ |
2767 |
+ jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n"); |
2768 |
+ return 0; |
2769 |
+diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c |
2770 |
+index e16a74b68cd0f..f755bfbe0f3bf 100644 |
2771 |
+--- a/drivers/tty/tty_io.c |
2772 |
++++ b/drivers/tty/tty_io.c |
2773 |
+@@ -2312,8 +2312,6 @@ static int tty_fasync(int fd, struct file *filp, int on) |
2774 |
+ * Locking: |
2775 |
+ * Called functions take tty_ldiscs_lock |
2776 |
+ * current->signal->tty check is safe without locks |
2777 |
+- * |
2778 |
+- * FIXME: may race normal receive processing |
2779 |
+ */ |
2780 |
+ |
2781 |
+ static int tiocsti(struct tty_struct *tty, char __user *p) |
2782 |
+@@ -2329,8 +2327,10 @@ static int tiocsti(struct tty_struct *tty, char __user *p) |
2783 |
+ ld = tty_ldisc_ref_wait(tty); |
2784 |
+ if (!ld) |
2785 |
+ return -EIO; |
2786 |
++ tty_buffer_lock_exclusive(tty->port); |
2787 |
+ if (ld->ops->receive_buf) |
2788 |
+ ld->ops->receive_buf(tty, &ch, &mbz, 1); |
2789 |
++ tty_buffer_unlock_exclusive(tty->port); |
2790 |
+ tty_ldisc_deref(ld); |
2791 |
+ return 0; |
2792 |
+ } |
2793 |
+diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c |
2794 |
+index f33635ab967f7..438efa36552c8 100644 |
2795 |
+--- a/drivers/usb/gadget/composite.c |
2796 |
++++ b/drivers/usb/gadget/composite.c |
2797 |
+@@ -481,7 +481,7 @@ static u8 encode_bMaxPower(enum usb_device_speed speed, |
2798 |
+ { |
2799 |
+ unsigned val; |
2800 |
+ |
2801 |
+- if (c->MaxPower) |
2802 |
++ if (c->MaxPower || (c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) |
2803 |
+ val = c->MaxPower; |
2804 |
+ else |
2805 |
+ val = CONFIG_USB_GADGET_VBUS_DRAW; |
2806 |
+@@ -886,7 +886,11 @@ static int set_config(struct usb_composite_dev *cdev, |
2807 |
+ } |
2808 |
+ |
2809 |
+ /* when we return, be sure our power usage is valid */ |
2810 |
+- power = c->MaxPower ? c->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW; |
2811 |
++ if (c->MaxPower || (c->bmAttributes & USB_CONFIG_ATT_SELFPOWER)) |
2812 |
++ power = c->MaxPower; |
2813 |
++ else |
2814 |
++ power = CONFIG_USB_GADGET_VBUS_DRAW; |
2815 |
++ |
2816 |
+ if (gadget->speed < USB_SPEED_SUPER) |
2817 |
+ power = min(power, 500U); |
2818 |
+ else |
2819 |
+diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c |
2820 |
+index 589d1f5fb575a..5d72872310e72 100644 |
2821 |
+--- a/drivers/usb/gadget/function/u_ether.c |
2822 |
++++ b/drivers/usb/gadget/function/u_ether.c |
2823 |
+@@ -499,8 +499,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, |
2824 |
+ } |
2825 |
+ spin_unlock_irqrestore(&dev->lock, flags); |
2826 |
+ |
2827 |
+- if (skb && !in) { |
2828 |
+- dev_kfree_skb_any(skb); |
2829 |
++ if (!in) { |
2830 |
++ if (skb) |
2831 |
++ dev_kfree_skb_any(skb); |
2832 |
+ return NETDEV_TX_OK; |
2833 |
+ } |
2834 |
+ |
2835 |
+diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c |
2836 |
+index 8bc78418d40e4..cd92cda03d710 100644 |
2837 |
+--- a/drivers/usb/gadget/udc/at91_udc.c |
2838 |
++++ b/drivers/usb/gadget/udc/at91_udc.c |
2839 |
+@@ -1895,7 +1895,9 @@ static int at91udc_probe(struct platform_device *pdev) |
2840 |
+ clk_disable(udc->iclk); |
2841 |
+ |
2842 |
+ /* request UDC and maybe VBUS irqs */ |
2843 |
+- udc->udp_irq = platform_get_irq(pdev, 0); |
2844 |
++ udc->udp_irq = retval = platform_get_irq(pdev, 0); |
2845 |
++ if (retval < 0) |
2846 |
++ goto err_unprepare_iclk; |
2847 |
+ retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0, |
2848 |
+ driver_name, udc); |
2849 |
+ if (retval) { |
2850 |
+diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c |
2851 |
+index b9e19a5913224..d75c6449616bd 100644 |
2852 |
+--- a/drivers/usb/gadget/udc/mv_u3d_core.c |
2853 |
++++ b/drivers/usb/gadget/udc/mv_u3d_core.c |
2854 |
+@@ -1912,14 +1912,6 @@ static int mv_u3d_probe(struct platform_device *dev) |
2855 |
+ goto err_get_irq; |
2856 |
+ } |
2857 |
+ u3d->irq = r->start; |
2858 |
+- if (request_irq(u3d->irq, mv_u3d_irq, |
2859 |
+- IRQF_SHARED, driver_name, u3d)) { |
2860 |
+- u3d->irq = 0; |
2861 |
+- dev_err(&dev->dev, "Request irq %d for u3d failed\n", |
2862 |
+- u3d->irq); |
2863 |
+- retval = -ENODEV; |
2864 |
+- goto err_request_irq; |
2865 |
+- } |
2866 |
+ |
2867 |
+ /* initialize gadget structure */ |
2868 |
+ u3d->gadget.ops = &mv_u3d_ops; /* usb_gadget_ops */ |
2869 |
+@@ -1932,6 +1924,15 @@ static int mv_u3d_probe(struct platform_device *dev) |
2870 |
+ |
2871 |
+ mv_u3d_eps_init(u3d); |
2872 |
+ |
2873 |
++ if (request_irq(u3d->irq, mv_u3d_irq, |
2874 |
++ IRQF_SHARED, driver_name, u3d)) { |
2875 |
++ u3d->irq = 0; |
2876 |
++ dev_err(&dev->dev, "Request irq %d for u3d failed\n", |
2877 |
++ u3d->irq); |
2878 |
++ retval = -ENODEV; |
2879 |
++ goto err_request_irq; |
2880 |
++ } |
2881 |
++ |
2882 |
+ /* external vbus detection */ |
2883 |
+ if (u3d->vbus) { |
2884 |
+ u3d->clock_gating = 1; |
2885 |
+@@ -1955,8 +1956,8 @@ static int mv_u3d_probe(struct platform_device *dev) |
2886 |
+ |
2887 |
+ err_unregister: |
2888 |
+ free_irq(u3d->irq, u3d); |
2889 |
+-err_request_irq: |
2890 |
+ err_get_irq: |
2891 |
++err_request_irq: |
2892 |
+ kfree(u3d->status_req); |
2893 |
+ err_alloc_status_req: |
2894 |
+ kfree(u3d->eps); |
2895 |
+diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c |
2896 |
+index ee8d5faa01947..3eecf47d4e89b 100644 |
2897 |
+--- a/drivers/usb/host/ehci-orion.c |
2898 |
++++ b/drivers/usb/host/ehci-orion.c |
2899 |
+@@ -218,8 +218,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev) |
2900 |
+ * the clock does not exists. |
2901 |
+ */ |
2902 |
+ priv->clk = devm_clk_get(&pdev->dev, NULL); |
2903 |
+- if (!IS_ERR(priv->clk)) |
2904 |
+- clk_prepare_enable(priv->clk); |
2905 |
++ if (!IS_ERR(priv->clk)) { |
2906 |
++ err = clk_prepare_enable(priv->clk); |
2907 |
++ if (err) |
2908 |
++ goto err_put_hcd; |
2909 |
++ } |
2910 |
+ |
2911 |
+ priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); |
2912 |
+ if (IS_ERR(priv->phy)) { |
2913 |
+@@ -280,6 +283,7 @@ err_phy_init: |
2914 |
+ err_phy_get: |
2915 |
+ if (!IS_ERR(priv->clk)) |
2916 |
+ clk_disable_unprepare(priv->clk); |
2917 |
++err_put_hcd: |
2918 |
+ usb_put_hcd(hcd); |
2919 |
+ err: |
2920 |
+ dev_err(&pdev->dev, "init %s fail, %d\n", |
2921 |
+diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c |
2922 |
+index 15249e664b89e..f0ec538a8813b 100644 |
2923 |
+--- a/drivers/usb/host/fotg210-hcd.c |
2924 |
++++ b/drivers/usb/host/fotg210-hcd.c |
2925 |
+@@ -2537,11 +2537,6 @@ retry_xacterr: |
2926 |
+ return count; |
2927 |
+ } |
2928 |
+ |
2929 |
+-/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ |
2930 |
+-#define hb_mult(wMaxPacketSize) (1 + (((wMaxPacketSize) >> 11) & 0x03)) |
2931 |
+-/* ... and packet size, for any kind of endpoint descriptor */ |
2932 |
+-#define max_packet(wMaxPacketSize) ((wMaxPacketSize) & 0x07ff) |
2933 |
+- |
2934 |
+ /* reverse of qh_urb_transaction: free a list of TDs. |
2935 |
+ * used for cleanup after errors, before HC sees an URB's TDs. |
2936 |
+ */ |
2937 |
+@@ -2627,7 +2622,7 @@ static struct list_head *qh_urb_transaction(struct fotg210_hcd *fotg210, |
2938 |
+ token |= (1 /* "in" */ << 8); |
2939 |
+ /* else it's already initted to "out" pid (0 << 8) */ |
2940 |
+ |
2941 |
+- maxpacket = max_packet(usb_maxpacket(urb->dev, urb->pipe, !is_input)); |
2942 |
++ maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input); |
2943 |
+ |
2944 |
+ /* |
2945 |
+ * buffer gets wrapped in one or more qtds; |
2946 |
+@@ -2741,9 +2736,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, |
2947 |
+ gfp_t flags) |
2948 |
+ { |
2949 |
+ struct fotg210_qh *qh = fotg210_qh_alloc(fotg210, flags); |
2950 |
++ struct usb_host_endpoint *ep; |
2951 |
+ u32 info1 = 0, info2 = 0; |
2952 |
+ int is_input, type; |
2953 |
+ int maxp = 0; |
2954 |
++ int mult; |
2955 |
+ struct usb_tt *tt = urb->dev->tt; |
2956 |
+ struct fotg210_qh_hw *hw; |
2957 |
+ |
2958 |
+@@ -2758,14 +2755,15 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, |
2959 |
+ |
2960 |
+ is_input = usb_pipein(urb->pipe); |
2961 |
+ type = usb_pipetype(urb->pipe); |
2962 |
+- maxp = usb_maxpacket(urb->dev, urb->pipe, !is_input); |
2963 |
++ ep = usb_pipe_endpoint(urb->dev, urb->pipe); |
2964 |
++ maxp = usb_endpoint_maxp(&ep->desc); |
2965 |
++ mult = usb_endpoint_maxp_mult(&ep->desc); |
2966 |
+ |
2967 |
+ /* 1024 byte maxpacket is a hardware ceiling. High bandwidth |
2968 |
+ * acts like up to 3KB, but is built from smaller packets. |
2969 |
+ */ |
2970 |
+- if (max_packet(maxp) > 1024) { |
2971 |
+- fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", |
2972 |
+- max_packet(maxp)); |
2973 |
++ if (maxp > 1024) { |
2974 |
++ fotg210_dbg(fotg210, "bogus qh maxpacket %d\n", maxp); |
2975 |
+ goto done; |
2976 |
+ } |
2977 |
+ |
2978 |
+@@ -2779,8 +2777,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, |
2979 |
+ */ |
2980 |
+ if (type == PIPE_INTERRUPT) { |
2981 |
+ qh->usecs = NS_TO_US(usb_calc_bus_time(USB_SPEED_HIGH, |
2982 |
+- is_input, 0, |
2983 |
+- hb_mult(maxp) * max_packet(maxp))); |
2984 |
++ is_input, 0, mult * maxp)); |
2985 |
+ qh->start = NO_FRAME; |
2986 |
+ |
2987 |
+ if (urb->dev->speed == USB_SPEED_HIGH) { |
2988 |
+@@ -2817,7 +2814,7 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, |
2989 |
+ think_time = tt ? tt->think_time : 0; |
2990 |
+ qh->tt_usecs = NS_TO_US(think_time + |
2991 |
+ usb_calc_bus_time(urb->dev->speed, |
2992 |
+- is_input, 0, max_packet(maxp))); |
2993 |
++ is_input, 0, maxp)); |
2994 |
+ qh->period = urb->interval; |
2995 |
+ if (qh->period > fotg210->periodic_size) { |
2996 |
+ qh->period = fotg210->periodic_size; |
2997 |
+@@ -2880,11 +2877,11 @@ static struct fotg210_qh *qh_make(struct fotg210_hcd *fotg210, struct urb *urb, |
2998 |
+ * to help them do so. So now people expect to use |
2999 |
+ * such nonconformant devices with Linux too; sigh. |
3000 |
+ */ |
3001 |
+- info1 |= max_packet(maxp) << 16; |
3002 |
++ info1 |= maxp << 16; |
3003 |
+ info2 |= (FOTG210_TUNE_MULT_HS << 30); |
3004 |
+ } else { /* PIPE_INTERRUPT */ |
3005 |
+- info1 |= max_packet(maxp) << 16; |
3006 |
+- info2 |= hb_mult(maxp) << 30; |
3007 |
++ info1 |= maxp << 16; |
3008 |
++ info2 |= mult << 30; |
3009 |
+ } |
3010 |
+ break; |
3011 |
+ default: |
3012 |
+@@ -3954,6 +3951,7 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, |
3013 |
+ int is_input; |
3014 |
+ long bandwidth; |
3015 |
+ unsigned multi; |
3016 |
++ struct usb_host_endpoint *ep; |
3017 |
+ |
3018 |
+ /* |
3019 |
+ * this might be a "high bandwidth" highspeed endpoint, |
3020 |
+@@ -3961,14 +3959,14 @@ static void iso_stream_init(struct fotg210_hcd *fotg210, |
3021 |
+ */ |
3022 |
+ epnum = usb_pipeendpoint(pipe); |
3023 |
+ is_input = usb_pipein(pipe) ? USB_DIR_IN : 0; |
3024 |
+- maxp = usb_maxpacket(dev, pipe, !is_input); |
3025 |
++ ep = usb_pipe_endpoint(dev, pipe); |
3026 |
++ maxp = usb_endpoint_maxp(&ep->desc); |
3027 |
+ if (is_input) |
3028 |
+ buf1 = (1 << 11); |
3029 |
+ else |
3030 |
+ buf1 = 0; |
3031 |
+ |
3032 |
+- maxp = max_packet(maxp); |
3033 |
+- multi = hb_mult(maxp); |
3034 |
++ multi = usb_endpoint_maxp_mult(&ep->desc); |
3035 |
+ buf1 |= maxp; |
3036 |
+ maxp *= multi; |
3037 |
+ |
3038 |
+@@ -4490,13 +4488,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd) |
3039 |
+ |
3040 |
+ /* HC need not update length with this error */ |
3041 |
+ if (!(t & FOTG210_ISOC_BABBLE)) { |
3042 |
+- desc->actual_length = |
3043 |
+- fotg210_itdlen(urb, desc, t); |
3044 |
++ desc->actual_length = FOTG210_ITD_LENGTH(t); |
3045 |
+ urb->actual_length += desc->actual_length; |
3046 |
+ } |
3047 |
+ } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) { |
3048 |
+ desc->status = 0; |
3049 |
+- desc->actual_length = fotg210_itdlen(urb, desc, t); |
3050 |
++ desc->actual_length = FOTG210_ITD_LENGTH(t); |
3051 |
+ urb->actual_length += desc->actual_length; |
3052 |
+ } else { |
3053 |
+ /* URB was too late */ |
3054 |
+diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h |
3055 |
+index b5cfa7aeb277c..1a3f94123c885 100644 |
3056 |
+--- a/drivers/usb/host/fotg210.h |
3057 |
++++ b/drivers/usb/host/fotg210.h |
3058 |
+@@ -682,11 +682,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210) |
3059 |
+ return fotg210_readl(fotg210, &fotg210->regs->frame_index); |
3060 |
+ } |
3061 |
+ |
3062 |
+-#define fotg210_itdlen(urb, desc, t) ({ \ |
3063 |
+- usb_pipein((urb)->pipe) ? \ |
3064 |
+- (desc)->length - FOTG210_ITD_LENGTH(t) : \ |
3065 |
+- FOTG210_ITD_LENGTH(t); \ |
3066 |
+-}) |
3067 |
+ /*-------------------------------------------------------------------------*/ |
3068 |
+ |
3069 |
+ #endif /* __LINUX_FOTG210_H */ |
3070 |
+diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c |
3071 |
+index cfcfadfc94fc2..9c9e97294c18d 100644 |
3072 |
+--- a/drivers/usb/host/ohci-tmio.c |
3073 |
++++ b/drivers/usb/host/ohci-tmio.c |
3074 |
+@@ -202,6 +202,9 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev) |
3075 |
+ if (!cell) |
3076 |
+ return -EINVAL; |
3077 |
+ |
3078 |
++ if (irq < 0) |
3079 |
++ return irq; |
3080 |
++ |
3081 |
+ hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev)); |
3082 |
+ if (!hcd) { |
3083 |
+ ret = -ENOMEM; |
3084 |
+diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
3085 |
+index ec00eff017942..2df61fff8ae32 100644 |
3086 |
+--- a/drivers/usb/host/xhci.c |
3087 |
++++ b/drivers/usb/host/xhci.c |
3088 |
+@@ -4419,19 +4419,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci, |
3089 |
+ { |
3090 |
+ unsigned long long timeout_ns; |
3091 |
+ |
3092 |
+- if (xhci->quirks & XHCI_INTEL_HOST) |
3093 |
+- timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); |
3094 |
+- else |
3095 |
+- timeout_ns = udev->u1_params.sel; |
3096 |
+- |
3097 |
+ /* Prevent U1 if service interval is shorter than U1 exit latency */ |
3098 |
+ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { |
3099 |
+- if (xhci_service_interval_to_ns(desc) <= timeout_ns) { |
3100 |
++ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) { |
3101 |
+ dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n"); |
3102 |
+ return USB3_LPM_DISABLED; |
3103 |
+ } |
3104 |
+ } |
3105 |
+ |
3106 |
++ if (xhci->quirks & XHCI_INTEL_HOST) |
3107 |
++ timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc); |
3108 |
++ else |
3109 |
++ timeout_ns = udev->u1_params.sel; |
3110 |
++ |
3111 |
+ /* The U1 timeout is encoded in 1us intervals. |
3112 |
+ * Don't return a timeout of zero, because that's USB3_LPM_DISABLED. |
3113 |
+ */ |
3114 |
+@@ -4483,19 +4483,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci, |
3115 |
+ { |
3116 |
+ unsigned long long timeout_ns; |
3117 |
+ |
3118 |
+- if (xhci->quirks & XHCI_INTEL_HOST) |
3119 |
+- timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); |
3120 |
+- else |
3121 |
+- timeout_ns = udev->u2_params.sel; |
3122 |
+- |
3123 |
+ /* Prevent U2 if service interval is shorter than U2 exit latency */ |
3124 |
+ if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) { |
3125 |
+- if (xhci_service_interval_to_ns(desc) <= timeout_ns) { |
3126 |
++ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) { |
3127 |
+ dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n"); |
3128 |
+ return USB3_LPM_DISABLED; |
3129 |
+ } |
3130 |
+ } |
3131 |
+ |
3132 |
++ if (xhci->quirks & XHCI_INTEL_HOST) |
3133 |
++ timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc); |
3134 |
++ else |
3135 |
++ timeout_ns = udev->u2_params.sel; |
3136 |
++ |
3137 |
+ /* The U2 timeout is encoded in 256us intervals */ |
3138 |
+ timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000); |
3139 |
+ /* If the necessary timeout value is bigger than what we can set in the |
3140 |
+diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c |
3141 |
+index 85d031ce85c1f..63798de8b5ae2 100644 |
3142 |
+--- a/drivers/usb/phy/phy-fsl-usb.c |
3143 |
++++ b/drivers/usb/phy/phy-fsl-usb.c |
3144 |
+@@ -891,6 +891,8 @@ int usb_otg_start(struct platform_device *pdev) |
3145 |
+ |
3146 |
+ /* request irq */ |
3147 |
+ p_otg->irq = platform_get_irq(pdev, 0); |
3148 |
++ if (p_otg->irq < 0) |
3149 |
++ return p_otg->irq; |
3150 |
+ status = request_irq(p_otg->irq, fsl_otg_isr, |
3151 |
+ IRQF_SHARED, driver_name, p_otg); |
3152 |
+ if (status) { |
3153 |
+diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c |
3154 |
+index b3b33cf7ddf60..f333024660b4d 100644 |
3155 |
+--- a/drivers/usb/phy/phy-isp1301.c |
3156 |
++++ b/drivers/usb/phy/phy-isp1301.c |
3157 |
+@@ -136,7 +136,7 @@ static int isp1301_remove(struct i2c_client *client) |
3158 |
+ static struct i2c_driver isp1301_driver = { |
3159 |
+ .driver = { |
3160 |
+ .name = DRV_NAME, |
3161 |
+- .of_match_table = of_match_ptr(isp1301_of_match), |
3162 |
++ .of_match_table = isp1301_of_match, |
3163 |
+ }, |
3164 |
+ .probe = isp1301_probe, |
3165 |
+ .remove = isp1301_remove, |
3166 |
+diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c |
3167 |
+index 335a1ef352242..ec86eedd789bc 100644 |
3168 |
+--- a/drivers/usb/phy/phy-tahvo.c |
3169 |
++++ b/drivers/usb/phy/phy-tahvo.c |
3170 |
+@@ -404,7 +404,9 @@ static int tahvo_usb_probe(struct platform_device *pdev) |
3171 |
+ |
3172 |
+ dev_set_drvdata(&pdev->dev, tu); |
3173 |
+ |
3174 |
+- tu->irq = platform_get_irq(pdev, 0); |
3175 |
++ tu->irq = ret = platform_get_irq(pdev, 0); |
3176 |
++ if (ret < 0) |
3177 |
++ return ret; |
3178 |
+ ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, |
3179 |
+ IRQF_ONESHOT, |
3180 |
+ "tahvo-vbus", tu); |
3181 |
+diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c |
3182 |
+index cf0b67433ac95..ccb36e2409530 100644 |
3183 |
+--- a/drivers/usb/phy/phy-twl6030-usb.c |
3184 |
++++ b/drivers/usb/phy/phy-twl6030-usb.c |
3185 |
+@@ -352,6 +352,11 @@ static int twl6030_usb_probe(struct platform_device *pdev) |
3186 |
+ twl->irq2 = platform_get_irq(pdev, 1); |
3187 |
+ twl->linkstat = MUSB_UNKNOWN; |
3188 |
+ |
3189 |
++ if (twl->irq1 < 0) |
3190 |
++ return twl->irq1; |
3191 |
++ if (twl->irq2 < 0) |
3192 |
++ return twl->irq2; |
3193 |
++ |
3194 |
+ twl->comparator.set_vbus = twl6030_set_vbus; |
3195 |
+ twl->comparator.start_srp = twl6030_start_srp; |
3196 |
+ |
3197 |
+diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c |
3198 |
+index b16e37f43247b..1278d6ce97b9d 100644 |
3199 |
+--- a/drivers/usb/serial/mos7720.c |
3200 |
++++ b/drivers/usb/serial/mos7720.c |
3201 |
+@@ -229,8 +229,10 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum, |
3202 |
+ int status; |
3203 |
+ |
3204 |
+ buf = kmalloc(1, GFP_KERNEL); |
3205 |
+- if (!buf) |
3206 |
++ if (!buf) { |
3207 |
++ *data = 0; |
3208 |
+ return -ENOMEM; |
3209 |
++ } |
3210 |
+ |
3211 |
+ status = usb_control_msg(usbdev, pipe, request, requesttype, value, |
3212 |
+ index, buf, 1, MOS_WDR_TIMEOUT); |
3213 |
+diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c |
3214 |
+index fb7b03029b8e6..91ccf57759aeb 100644 |
3215 |
+--- a/drivers/usb/usbip/vhci_hcd.c |
3216 |
++++ b/drivers/usb/usbip/vhci_hcd.c |
3217 |
+@@ -762,8 +762,32 @@ static void vhci_device_unlink_cleanup(struct vhci_device *vdev) |
3218 |
+ spin_lock(&vdev->priv_lock); |
3219 |
+ |
3220 |
+ list_for_each_entry_safe(unlink, tmp, &vdev->unlink_tx, list) { |
3221 |
++ struct urb *urb; |
3222 |
++ |
3223 |
++ /* give back urb of unsent unlink request */ |
3224 |
+ pr_info("unlink cleanup tx %lu\n", unlink->unlink_seqnum); |
3225 |
++ |
3226 |
++ urb = pickup_urb_and_free_priv(vdev, unlink->unlink_seqnum); |
3227 |
++ if (!urb) { |
3228 |
++ list_del(&unlink->list); |
3229 |
++ kfree(unlink); |
3230 |
++ continue; |
3231 |
++ } |
3232 |
++ |
3233 |
++ urb->status = -ENODEV; |
3234 |
++ |
3235 |
++ usb_hcd_unlink_urb_from_ep(hcd, urb); |
3236 |
++ |
3237 |
+ list_del(&unlink->list); |
3238 |
++ |
3239 |
++ spin_unlock(&vdev->priv_lock); |
3240 |
++ spin_unlock_irqrestore(&vhci->lock, flags); |
3241 |
++ |
3242 |
++ usb_hcd_giveback_urb(hcd, urb, urb->status); |
3243 |
++ |
3244 |
++ spin_lock_irqsave(&vhci->lock, flags); |
3245 |
++ spin_lock(&vdev->priv_lock); |
3246 |
++ |
3247 |
+ kfree(unlink); |
3248 |
+ } |
3249 |
+ |
3250 |
+diff --git a/drivers/vfio/Kconfig b/drivers/vfio/Kconfig |
3251 |
+index da6e2ce77495b..e5156b3486695 100644 |
3252 |
+--- a/drivers/vfio/Kconfig |
3253 |
++++ b/drivers/vfio/Kconfig |
3254 |
+@@ -31,7 +31,7 @@ menuconfig VFIO |
3255 |
+ |
3256 |
+ If you don't know what to do here, say N. |
3257 |
+ |
3258 |
+-menuconfig VFIO_NOIOMMU |
3259 |
++config VFIO_NOIOMMU |
3260 |
+ bool "VFIO No-IOMMU support" |
3261 |
+ depends on VFIO |
3262 |
+ help |
3263 |
+diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c |
3264 |
+index 91eea4583382d..ceb579eff1eab 100644 |
3265 |
+--- a/drivers/video/fbdev/asiliantfb.c |
3266 |
++++ b/drivers/video/fbdev/asiliantfb.c |
3267 |
+@@ -227,6 +227,9 @@ static int asiliantfb_check_var(struct fb_var_screeninfo *var, |
3268 |
+ { |
3269 |
+ unsigned long Ftarget, ratio, remainder; |
3270 |
+ |
3271 |
++ if (!var->pixclock) |
3272 |
++ return -EINVAL; |
3273 |
++ |
3274 |
+ ratio = 1000000 / var->pixclock; |
3275 |
+ remainder = 1000000 % var->pixclock; |
3276 |
+ Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock; |
3277 |
+diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c |
3278 |
+index 16f5f56332433..e83b7ca500b73 100644 |
3279 |
+--- a/drivers/video/fbdev/core/fbmem.c |
3280 |
++++ b/drivers/video/fbdev/core/fbmem.c |
3281 |
+@@ -32,6 +32,7 @@ |
3282 |
+ #include <linux/device.h> |
3283 |
+ #include <linux/efi.h> |
3284 |
+ #include <linux/fb.h> |
3285 |
++#include <linux/overflow.h> |
3286 |
+ |
3287 |
+ #include <asm/fb.h> |
3288 |
+ |
3289 |
+@@ -981,6 +982,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
3290 |
+ if ((var->activate & FB_ACTIVATE_FORCE) || |
3291 |
+ memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { |
3292 |
+ u32 activate = var->activate; |
3293 |
++ u32 unused; |
3294 |
+ |
3295 |
+ /* When using FOURCC mode, make sure the red, green, blue and |
3296 |
+ * transp fields are set to 0. |
3297 |
+@@ -1005,6 +1007,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
3298 |
+ if (var->xres < 8 || var->yres < 8) |
3299 |
+ return -EINVAL; |
3300 |
+ |
3301 |
++ /* Too huge resolution causes multiplication overflow. */ |
3302 |
++ if (check_mul_overflow(var->xres, var->yres, &unused) || |
3303 |
++ check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused)) |
3304 |
++ return -EINVAL; |
3305 |
++ |
3306 |
+ ret = info->fbops->fb_check_var(var, info); |
3307 |
+ |
3308 |
+ if (ret) |
3309 |
+diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c |
3310 |
+index f77478fb3d14a..0b844f6d8a30b 100644 |
3311 |
+--- a/drivers/video/fbdev/kyro/fbdev.c |
3312 |
++++ b/drivers/video/fbdev/kyro/fbdev.c |
3313 |
+@@ -372,6 +372,11 @@ static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight |
3314 |
+ /* probably haven't called CreateOverlay yet */ |
3315 |
+ return -EINVAL; |
3316 |
+ |
3317 |
++ if (ulWidth == 0 || ulWidth == 0xffffffff || |
3318 |
++ ulHeight == 0 || ulHeight == 0xffffffff || |
3319 |
++ (x < 2 && ulWidth + 2 == 0)) |
3320 |
++ return -EINVAL; |
3321 |
++ |
3322 |
+ /* Stop Ramdac Output */ |
3323 |
+ DisableRamdacOutput(deviceInfo.pSTGReg); |
3324 |
+ |
3325 |
+@@ -394,6 +399,9 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
3326 |
+ { |
3327 |
+ struct kyrofb_info *par = info->par; |
3328 |
+ |
3329 |
++ if (!var->pixclock) |
3330 |
++ return -EINVAL; |
3331 |
++ |
3332 |
+ if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { |
3333 |
+ printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); |
3334 |
+ return -EINVAL; |
3335 |
+diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c |
3336 |
+index 2ef26ad993413..69f3acd405c55 100644 |
3337 |
+--- a/drivers/video/fbdev/riva/fbdev.c |
3338 |
++++ b/drivers/video/fbdev/riva/fbdev.c |
3339 |
+@@ -1088,6 +1088,9 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) |
3340 |
+ int mode_valid = 0; |
3341 |
+ |
3342 |
+ NVTRACE_ENTER(); |
3343 |
++ if (!var->pixclock) |
3344 |
++ return -EINVAL; |
3345 |
++ |
3346 |
+ switch (var->bits_per_pixel) { |
3347 |
+ case 1 ... 8: |
3348 |
+ var->red.offset = var->green.offset = var->blue.offset = 0; |
3349 |
+diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c |
3350 |
+index b744e7d33d87f..26866785e1c77 100644 |
3351 |
+--- a/fs/btrfs/inode.c |
3352 |
++++ b/fs/btrfs/inode.c |
3353 |
+@@ -484,7 +484,7 @@ again: |
3354 |
+ * inode has not been flagged as nocompress. This flag can |
3355 |
+ * change at any time if we discover bad compression ratios. |
3356 |
+ */ |
3357 |
+- if (nr_pages > 1 && inode_need_compress(inode)) { |
3358 |
++ if (inode_need_compress(inode)) { |
3359 |
+ WARN_ON(pages); |
3360 |
+ pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS); |
3361 |
+ if (!pages) { |
3362 |
+diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c |
3363 |
+index 942874257a092..e5e7801457280 100644 |
3364 |
+--- a/fs/cifs/cifs_unicode.c |
3365 |
++++ b/fs/cifs/cifs_unicode.c |
3366 |
+@@ -367,14 +367,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen, |
3367 |
+ if (!dst) |
3368 |
+ return NULL; |
3369 |
+ cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage, |
3370 |
+- NO_MAP_UNI_RSVD); |
3371 |
++ NO_MAP_UNI_RSVD); |
3372 |
+ } else { |
3373 |
+- len = strnlen(src, maxlen); |
3374 |
+- len++; |
3375 |
+- dst = kmalloc(len, GFP_KERNEL); |
3376 |
+- if (!dst) |
3377 |
+- return NULL; |
3378 |
+- strlcpy(dst, src, len); |
3379 |
++ dst = kstrndup(src, maxlen, GFP_KERNEL); |
3380 |
+ } |
3381 |
+ |
3382 |
+ return dst; |
3383 |
+diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c |
3384 |
+index bb208076cb71a..aeec5a896ea64 100644 |
3385 |
+--- a/fs/cifs/sess.c |
3386 |
++++ b/fs/cifs/sess.c |
3387 |
+@@ -602,7 +602,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct) |
3388 |
+ return 0; |
3389 |
+ |
3390 |
+ out_free_smb_buf: |
3391 |
+- kfree(smb_buf); |
3392 |
++ cifs_small_buf_release(smb_buf); |
3393 |
+ sess_data->iov[0].iov_base = NULL; |
3394 |
+ sess_data->iov[0].iov_len = 0; |
3395 |
+ sess_data->buf0_type = CIFS_NO_BUFFER; |
3396 |
+diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c |
3397 |
+index 5bf62bdd84b87..a0f20a048347c 100644 |
3398 |
+--- a/fs/ext4/inline.c |
3399 |
++++ b/fs/ext4/inline.c |
3400 |
+@@ -747,6 +747,12 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, |
3401 |
+ ext4_write_lock_xattr(inode, &no_expand); |
3402 |
+ BUG_ON(!ext4_has_inline_data(inode)); |
3403 |
+ |
3404 |
++ /* |
3405 |
++ * ei->i_inline_off may have changed since ext4_write_begin() |
3406 |
++ * called ext4_try_to_write_inline_data() |
3407 |
++ */ |
3408 |
++ (void) ext4_find_inline_data_nolock(inode); |
3409 |
++ |
3410 |
+ kaddr = kmap_atomic(page); |
3411 |
+ ext4_write_inline_data(inode, &iloc, kaddr, pos, len); |
3412 |
+ kunmap_atomic(kaddr); |
3413 |
+diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c |
3414 |
+index 2524807ee0703..a6d962323790c 100644 |
3415 |
+--- a/fs/gfs2/acl.c |
3416 |
++++ b/fs/gfs2/acl.c |
3417 |
+@@ -86,19 +86,6 @@ int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
3418 |
+ char *data; |
3419 |
+ const char *name = gfs2_acl_name(type); |
3420 |
+ |
3421 |
+- if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode))) |
3422 |
+- return -E2BIG; |
3423 |
+- |
3424 |
+- if (type == ACL_TYPE_ACCESS) { |
3425 |
+- umode_t mode = inode->i_mode; |
3426 |
+- |
3427 |
+- error = posix_acl_update_mode(inode, &inode->i_mode, &acl); |
3428 |
+- if (error) |
3429 |
+- return error; |
3430 |
+- if (mode != inode->i_mode) |
3431 |
+- mark_inode_dirty(inode); |
3432 |
+- } |
3433 |
+- |
3434 |
+ if (acl) { |
3435 |
+ len = posix_acl_to_xattr(&init_user_ns, acl, NULL, 0); |
3436 |
+ if (len == 0) |
3437 |
+@@ -130,6 +117,9 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
3438 |
+ bool need_unlock = false; |
3439 |
+ int ret; |
3440 |
+ |
3441 |
++ if (acl && acl->a_count > GFS2_ACL_MAX_ENTRIES(GFS2_SB(inode))) |
3442 |
++ return -E2BIG; |
3443 |
++ |
3444 |
+ ret = gfs2_rsqa_alloc(ip); |
3445 |
+ if (ret) |
3446 |
+ return ret; |
3447 |
+@@ -140,7 +130,18 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
3448 |
+ return ret; |
3449 |
+ need_unlock = true; |
3450 |
+ } |
3451 |
++ if (type == ACL_TYPE_ACCESS && acl) { |
3452 |
++ umode_t mode = inode->i_mode; |
3453 |
++ |
3454 |
++ ret = posix_acl_update_mode(inode, &inode->i_mode, &acl); |
3455 |
++ if (ret) |
3456 |
++ goto unlock; |
3457 |
++ if (mode != inode->i_mode) |
3458 |
++ mark_inode_dirty(inode); |
3459 |
++ } |
3460 |
++ |
3461 |
+ ret = __gfs2_set_acl(inode, acl, type); |
3462 |
++unlock: |
3463 |
+ if (need_unlock) |
3464 |
+ gfs2_glock_dq_uninit(&gh); |
3465 |
+ return ret; |
3466 |
+diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c |
3467 |
+index 3cbc9147286dd..da9f979118524 100644 |
3468 |
+--- a/fs/gfs2/lock_dlm.c |
3469 |
++++ b/fs/gfs2/lock_dlm.c |
3470 |
+@@ -296,6 +296,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl) |
3471 |
+ gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT); |
3472 |
+ gfs2_update_request_times(gl); |
3473 |
+ |
3474 |
++ /* don't want to call dlm if we've unmounted the lock protocol */ |
3475 |
++ if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) { |
3476 |
++ gfs2_glock_free(gl); |
3477 |
++ return; |
3478 |
++ } |
3479 |
+ /* don't want to skip dlm_unlock writing the lvb when lock has one */ |
3480 |
+ |
3481 |
+ if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) && |
3482 |
+diff --git a/fs/udf/misc.c b/fs/udf/misc.c |
3483 |
+index 71d1c25f360d1..8c7f9ea251e52 100644 |
3484 |
+--- a/fs/udf/misc.c |
3485 |
++++ b/fs/udf/misc.c |
3486 |
+@@ -175,13 +175,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type, |
3487 |
+ else |
3488 |
+ offset = le32_to_cpu(eahd->appAttrLocation); |
3489 |
+ |
3490 |
+- while (offset < iinfo->i_lenEAttr) { |
3491 |
++ while (offset + sizeof(*gaf) < iinfo->i_lenEAttr) { |
3492 |
++ uint32_t attrLength; |
3493 |
++ |
3494 |
+ gaf = (struct genericFormat *)&ea[offset]; |
3495 |
++ attrLength = le32_to_cpu(gaf->attrLength); |
3496 |
++ |
3497 |
++ /* Detect undersized elements and buffer overflows */ |
3498 |
++ if ((attrLength < sizeof(*gaf)) || |
3499 |
++ (attrLength > (iinfo->i_lenEAttr - offset))) |
3500 |
++ break; |
3501 |
++ |
3502 |
+ if (le32_to_cpu(gaf->attrType) == type && |
3503 |
+ gaf->attrSubtype == subtype) |
3504 |
+ return gaf; |
3505 |
+ else |
3506 |
+- offset += le32_to_cpu(gaf->attrLength); |
3507 |
++ offset += attrLength; |
3508 |
+ } |
3509 |
+ } |
3510 |
+ |
3511 |
+diff --git a/fs/udf/super.c b/fs/udf/super.c |
3512 |
+index c8c037e8e57b5..cf2e770080f9b 100644 |
3513 |
+--- a/fs/udf/super.c |
3514 |
++++ b/fs/udf/super.c |
3515 |
+@@ -115,16 +115,10 @@ struct logicalVolIntegrityDescImpUse *udf_sb_lvidiu(struct super_block *sb) |
3516 |
+ return NULL; |
3517 |
+ lvid = (struct logicalVolIntegrityDesc *)UDF_SB(sb)->s_lvid_bh->b_data; |
3518 |
+ partnum = le32_to_cpu(lvid->numOfPartitions); |
3519 |
+- if ((sb->s_blocksize - sizeof(struct logicalVolIntegrityDescImpUse) - |
3520 |
+- offsetof(struct logicalVolIntegrityDesc, impUse)) / |
3521 |
+- (2 * sizeof(uint32_t)) < partnum) { |
3522 |
+- udf_err(sb, "Logical volume integrity descriptor corrupted " |
3523 |
+- "(numOfPartitions = %u)!\n", partnum); |
3524 |
+- return NULL; |
3525 |
+- } |
3526 |
+ /* The offset is to skip freeSpaceTable and sizeTable arrays */ |
3527 |
+ offset = partnum * 2 * sizeof(uint32_t); |
3528 |
+- return (struct logicalVolIntegrityDescImpUse *)&(lvid->impUse[offset]); |
3529 |
++ return (struct logicalVolIntegrityDescImpUse *) |
3530 |
++ (((uint8_t *)(lvid + 1)) + offset); |
3531 |
+ } |
3532 |
+ |
3533 |
+ /* UDF filesystem type */ |
3534 |
+@@ -1571,6 +1565,7 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ |
3535 |
+ struct udf_sb_info *sbi = UDF_SB(sb); |
3536 |
+ struct logicalVolIntegrityDesc *lvid; |
3537 |
+ int indirections = 0; |
3538 |
++ u32 parts, impuselen; |
3539 |
+ |
3540 |
+ while (++indirections <= UDF_MAX_LVID_NESTING) { |
3541 |
+ final_bh = NULL; |
3542 |
+@@ -1597,15 +1592,27 @@ static void udf_load_logicalvolint(struct super_block *sb, struct kernel_extent_ |
3543 |
+ |
3544 |
+ lvid = (struct logicalVolIntegrityDesc *)final_bh->b_data; |
3545 |
+ if (lvid->nextIntegrityExt.extLength == 0) |
3546 |
+- return; |
3547 |
++ goto check; |
3548 |
+ |
3549 |
+ loc = leea_to_cpu(lvid->nextIntegrityExt); |
3550 |
+ } |
3551 |
+ |
3552 |
+ udf_warn(sb, "Too many LVID indirections (max %u), ignoring.\n", |
3553 |
+ UDF_MAX_LVID_NESTING); |
3554 |
++out_err: |
3555 |
+ brelse(sbi->s_lvid_bh); |
3556 |
+ sbi->s_lvid_bh = NULL; |
3557 |
++ return; |
3558 |
++check: |
3559 |
++ parts = le32_to_cpu(lvid->numOfPartitions); |
3560 |
++ impuselen = le32_to_cpu(lvid->lengthOfImpUse); |
3561 |
++ if (parts >= sb->s_blocksize || impuselen >= sb->s_blocksize || |
3562 |
++ sizeof(struct logicalVolIntegrityDesc) + impuselen + |
3563 |
++ 2 * parts * sizeof(u32) > sb->s_blocksize) { |
3564 |
++ udf_warn(sb, "Corrupted LVID (parts=%u, impuselen=%u), " |
3565 |
++ "ignoring.\n", parts, impuselen); |
3566 |
++ goto out_err; |
3567 |
++ } |
3568 |
+ } |
3569 |
+ |
3570 |
+ |
3571 |
+diff --git a/include/crypto/public_key.h b/include/crypto/public_key.h |
3572 |
+index 882ca0e1e7a59..d8435eac37293 100644 |
3573 |
+--- a/include/crypto/public_key.h |
3574 |
++++ b/include/crypto/public_key.h |
3575 |
+@@ -35,9 +35,9 @@ extern void public_key_free(struct public_key *key); |
3576 |
+ struct public_key_signature { |
3577 |
+ struct asymmetric_key_id *auth_ids[2]; |
3578 |
+ u8 *s; /* Signature */ |
3579 |
+- u32 s_size; /* Number of bytes in signature */ |
3580 |
+ u8 *digest; |
3581 |
+- u8 digest_size; /* Number of bytes in digest */ |
3582 |
++ u32 s_size; /* Number of bytes in signature */ |
3583 |
++ u32 digest_size; /* Number of bytes in digest */ |
3584 |
+ const char *pkey_algo; |
3585 |
+ const char *hash_algo; |
3586 |
+ }; |
3587 |
+diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h |
3588 |
+index 6417bc845db56..4b377186fddd3 100644 |
3589 |
+--- a/include/linux/hugetlb.h |
3590 |
++++ b/include/linux/hugetlb.h |
3591 |
+@@ -482,6 +482,11 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, |
3592 |
+ |
3593 |
+ void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm); |
3594 |
+ |
3595 |
++static inline void hugetlb_count_init(struct mm_struct *mm) |
3596 |
++{ |
3597 |
++ atomic_long_set(&mm->hugetlb_usage, 0); |
3598 |
++} |
3599 |
++ |
3600 |
+ static inline void hugetlb_count_add(long l, struct mm_struct *mm) |
3601 |
+ { |
3602 |
+ atomic_long_add(l, &mm->hugetlb_usage); |
3603 |
+@@ -527,6 +532,10 @@ static inline spinlock_t *huge_pte_lockptr(struct hstate *h, |
3604 |
+ return &mm->page_table_lock; |
3605 |
+ } |
3606 |
+ |
3607 |
++static inline void hugetlb_count_init(struct mm_struct *mm) |
3608 |
++{ |
3609 |
++} |
3610 |
++ |
3611 |
+ static inline void hugetlb_report_usage(struct seq_file *f, struct mm_struct *m) |
3612 |
+ { |
3613 |
+ } |
3614 |
+diff --git a/include/linux/pci.h b/include/linux/pci.h |
3615 |
+index b9ac0ba812211..7563261bed885 100644 |
3616 |
+--- a/include/linux/pci.h |
3617 |
++++ b/include/linux/pci.h |
3618 |
+@@ -1552,8 +1552,9 @@ static inline int pci_enable_device(struct pci_dev *dev) { return -EIO; } |
3619 |
+ static inline void pci_disable_device(struct pci_dev *dev) { } |
3620 |
+ static inline int pci_assign_resource(struct pci_dev *dev, int i) |
3621 |
+ { return -EBUSY; } |
3622 |
+-static inline int __pci_register_driver(struct pci_driver *drv, |
3623 |
+- struct module *owner) |
3624 |
++static inline int __must_check __pci_register_driver(struct pci_driver *drv, |
3625 |
++ struct module *owner, |
3626 |
++ const char *mod_name) |
3627 |
+ { return 0; } |
3628 |
+ static inline int pci_register_driver(struct pci_driver *drv) |
3629 |
+ { return 0; } |
3630 |
+diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h |
3631 |
+index 522757ac9cd4d..890f53881fad8 100644 |
3632 |
+--- a/include/linux/power/max17042_battery.h |
3633 |
++++ b/include/linux/power/max17042_battery.h |
3634 |
+@@ -75,7 +75,7 @@ enum max17042_register { |
3635 |
+ MAX17042_RelaxCFG = 0x2A, |
3636 |
+ MAX17042_MiscCFG = 0x2B, |
3637 |
+ MAX17042_TGAIN = 0x2C, |
3638 |
+- MAx17042_TOFF = 0x2D, |
3639 |
++ MAX17042_TOFF = 0x2D, |
3640 |
+ MAX17042_CGAIN = 0x2E, |
3641 |
+ MAX17042_COFF = 0x2F, |
3642 |
+ |
3643 |
+diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h |
3644 |
+index 67b798b7115d8..dab550cf29c12 100644 |
3645 |
+--- a/include/linux/skbuff.h |
3646 |
++++ b/include/linux/skbuff.h |
3647 |
+@@ -1613,7 +1613,7 @@ static inline void __skb_insert(struct sk_buff *newsk, |
3648 |
+ newsk->next = next; |
3649 |
+ newsk->prev = prev; |
3650 |
+ next->prev = prev->next = newsk; |
3651 |
+- list->qlen++; |
3652 |
++ WRITE_ONCE(list->qlen, list->qlen + 1); |
3653 |
+ } |
3654 |
+ |
3655 |
+ static inline void __skb_queue_splice(const struct sk_buff_head *list, |
3656 |
+diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h |
3657 |
+index b4c04842a8c08..bad5c56a78a2d 100644 |
3658 |
+--- a/include/uapi/linux/serial_reg.h |
3659 |
++++ b/include/uapi/linux/serial_reg.h |
3660 |
+@@ -61,6 +61,7 @@ |
3661 |
+ * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654 |
3662 |
+ * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750 |
3663 |
+ * TI16C752: 8 16 56 60 8 16 32 56 |
3664 |
++ * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950 |
3665 |
+ * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA |
3666 |
+ */ |
3667 |
+ #define UART_FCR_R_TRIG_00 0x00 |
3668 |
+diff --git a/kernel/events/core.c b/kernel/events/core.c |
3669 |
+index 7615a97a3511d..e56a74fd5c814 100644 |
3670 |
+--- a/kernel/events/core.c |
3671 |
++++ b/kernel/events/core.c |
3672 |
+@@ -8115,7 +8115,7 @@ static void perf_event_addr_filters_apply(struct perf_event *event) |
3673 |
+ if (task == TASK_TOMBSTONE) |
3674 |
+ return; |
3675 |
+ |
3676 |
+- mm = get_task_mm(event->ctx->task); |
3677 |
++ mm = get_task_mm(task); |
3678 |
+ if (!mm) |
3679 |
+ goto restart; |
3680 |
+ |
3681 |
+diff --git a/kernel/fork.c b/kernel/fork.c |
3682 |
+index 91349fd3e162d..bcb851299b3fe 100644 |
3683 |
+--- a/kernel/fork.c |
3684 |
++++ b/kernel/fork.c |
3685 |
+@@ -789,6 +789,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p, |
3686 |
+ mm->pmd_huge_pte = NULL; |
3687 |
+ #endif |
3688 |
+ mm_init_uprobes_state(mm); |
3689 |
++ hugetlb_count_init(mm); |
3690 |
+ |
3691 |
+ if (current->mm) { |
3692 |
+ mm->flags = current->mm->flags & MMF_INIT_MASK; |
3693 |
+diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c |
3694 |
+index 0eab538841fd4..64b91b8d4d840 100644 |
3695 |
+--- a/kernel/pid_namespace.c |
3696 |
++++ b/kernel/pid_namespace.c |
3697 |
+@@ -52,7 +52,7 @@ static struct kmem_cache *create_pid_cachep(int nr_ids) |
3698 |
+ snprintf(pcache->name, sizeof(pcache->name), "pid_%d", nr_ids); |
3699 |
+ cachep = kmem_cache_create(pcache->name, |
3700 |
+ sizeof(struct pid) + (nr_ids - 1) * sizeof(struct upid), |
3701 |
+- 0, SLAB_HWCACHE_ALIGN, NULL); |
3702 |
++ 0, SLAB_HWCACHE_ALIGN | SLAB_ACCOUNT, NULL); |
3703 |
+ if (cachep == NULL) |
3704 |
+ goto err_cachep; |
3705 |
+ |
3706 |
+diff --git a/lib/test_bpf.c b/lib/test_bpf.c |
3707 |
+index 960d4d627361e..0c62275630fac 100644 |
3708 |
+--- a/lib/test_bpf.c |
3709 |
++++ b/lib/test_bpf.c |
3710 |
+@@ -4295,8 +4295,8 @@ static struct bpf_test tests[] = { |
3711 |
+ .u.insns_int = { |
3712 |
+ BPF_LD_IMM64(R0, 0), |
3713 |
+ BPF_LD_IMM64(R1, 0xffffffffffffffffLL), |
3714 |
+- BPF_STX_MEM(BPF_W, R10, R1, -40), |
3715 |
+- BPF_LDX_MEM(BPF_W, R0, R10, -40), |
3716 |
++ BPF_STX_MEM(BPF_DW, R10, R1, -40), |
3717 |
++ BPF_LDX_MEM(BPF_DW, R0, R10, -40), |
3718 |
+ BPF_EXIT_INSN(), |
3719 |
+ }, |
3720 |
+ INTERNAL, |
3721 |
+@@ -5744,7 +5744,14 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test) |
3722 |
+ u64 duration; |
3723 |
+ u32 ret; |
3724 |
+ |
3725 |
+- if (test->test[i].data_size == 0 && |
3726 |
++ /* |
3727 |
++ * NOTE: Several sub-tests may be present, in which case |
3728 |
++ * a zero {data_size, result} tuple indicates the end of |
3729 |
++ * the sub-test array. The first test is always run, |
3730 |
++ * even if both data_size and result happen to be zero. |
3731 |
++ */ |
3732 |
++ if (i > 0 && |
3733 |
++ test->test[i].data_size == 0 && |
3734 |
+ test->test[i].result == 0) |
3735 |
+ break; |
3736 |
+ |
3737 |
+diff --git a/mm/kmemleak.c b/mm/kmemleak.c |
3738 |
+index d05133b37b173..59bb2b9ec0e2e 100644 |
3739 |
+--- a/mm/kmemleak.c |
3740 |
++++ b/mm/kmemleak.c |
3741 |
+@@ -1442,7 +1442,7 @@ static void kmemleak_scan(void) |
3742 |
+ if (page_count(page) == 0) |
3743 |
+ continue; |
3744 |
+ scan_block(page, page + 1, NULL); |
3745 |
+- if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page)))) |
3746 |
++ if (!(pfn & 63)) |
3747 |
+ cond_resched(); |
3748 |
+ } |
3749 |
+ } |
3750 |
+diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
3751 |
+index b0c451e3b59f3..babcbd8b94ea8 100644 |
3752 |
+--- a/mm/page_alloc.c |
3753 |
++++ b/mm/page_alloc.c |
3754 |
+@@ -814,7 +814,7 @@ static inline void __free_one_page(struct page *page, |
3755 |
+ struct page *buddy; |
3756 |
+ unsigned int max_order; |
3757 |
+ |
3758 |
+- max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1); |
3759 |
++ max_order = min_t(unsigned int, MAX_ORDER - 1, pageblock_order); |
3760 |
+ |
3761 |
+ VM_BUG_ON(!zone_is_initialized(zone)); |
3762 |
+ VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page); |
3763 |
+@@ -829,7 +829,7 @@ static inline void __free_one_page(struct page *page, |
3764 |
+ VM_BUG_ON_PAGE(bad_range(zone, page), page); |
3765 |
+ |
3766 |
+ continue_merging: |
3767 |
+- while (order < max_order - 1) { |
3768 |
++ while (order < max_order) { |
3769 |
+ buddy_idx = __find_buddy_index(page_idx, order); |
3770 |
+ buddy = page + (buddy_idx - page_idx); |
3771 |
+ if (!page_is_buddy(page, buddy, order)) |
3772 |
+@@ -850,7 +850,7 @@ continue_merging: |
3773 |
+ page_idx = combined_idx; |
3774 |
+ order++; |
3775 |
+ } |
3776 |
+- if (max_order < MAX_ORDER) { |
3777 |
++ if (order < MAX_ORDER - 1) { |
3778 |
+ /* If we are here, it means order is >= pageblock_order. |
3779 |
+ * We want to prevent merge between freepages on isolate |
3780 |
+ * pageblock and normal pageblock. Without this, pageblock |
3781 |
+@@ -871,7 +871,7 @@ continue_merging: |
3782 |
+ is_migrate_isolate(buddy_mt))) |
3783 |
+ goto done_merging; |
3784 |
+ } |
3785 |
+- max_order++; |
3786 |
++ max_order = order + 1; |
3787 |
+ goto continue_merging; |
3788 |
+ } |
3789 |
+ |
3790 |
+diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h |
3791 |
+index c32638dddbf94..f6b9dc4e408f2 100644 |
3792 |
+--- a/net/bluetooth/cmtp/cmtp.h |
3793 |
++++ b/net/bluetooth/cmtp/cmtp.h |
3794 |
+@@ -26,7 +26,7 @@ |
3795 |
+ #include <linux/types.h> |
3796 |
+ #include <net/bluetooth/bluetooth.h> |
3797 |
+ |
3798 |
+-#define BTNAMSIZ 18 |
3799 |
++#define BTNAMSIZ 21 |
3800 |
+ |
3801 |
+ /* CMTP ioctl defines */ |
3802 |
+ #define CMTPCONNADD _IOW('C', 200, int) |
3803 |
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c |
3804 |
+index 8517da7f282ed..b43f31203a430 100644 |
3805 |
+--- a/net/bluetooth/hci_core.c |
3806 |
++++ b/net/bluetooth/hci_core.c |
3807 |
+@@ -1223,6 +1223,12 @@ int hci_inquiry(void __user *arg) |
3808 |
+ goto done; |
3809 |
+ } |
3810 |
+ |
3811 |
++ /* Restrict maximum inquiry length to 60 seconds */ |
3812 |
++ if (ir.length > 60) { |
3813 |
++ err = -EINVAL; |
3814 |
++ goto done; |
3815 |
++ } |
3816 |
++ |
3817 |
+ hci_dev_lock(hdev); |
3818 |
+ if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX || |
3819 |
+ inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) { |
3820 |
+@@ -1546,6 +1552,14 @@ int hci_dev_do_close(struct hci_dev *hdev) |
3821 |
+ hci_request_cancel_all(hdev); |
3822 |
+ hci_req_sync_lock(hdev); |
3823 |
+ |
3824 |
++ if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) && |
3825 |
++ !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) && |
3826 |
++ test_bit(HCI_UP, &hdev->flags)) { |
3827 |
++ /* Execute vendor specific shutdown routine */ |
3828 |
++ if (hdev->shutdown) |
3829 |
++ hdev->shutdown(hdev); |
3830 |
++ } |
3831 |
++ |
3832 |
+ if (!test_and_clear_bit(HCI_UP, &hdev->flags)) { |
3833 |
+ cancel_delayed_work_sync(&hdev->cmd_timer); |
3834 |
+ hci_req_sync_unlock(hdev); |
3835 |
+diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c |
3836 |
+index 44eeb27e341af..f9484755a9baf 100644 |
3837 |
+--- a/net/bluetooth/hci_event.c |
3838 |
++++ b/net/bluetooth/hci_event.c |
3839 |
+@@ -3761,6 +3761,21 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, |
3840 |
+ |
3841 |
+ switch (ev->status) { |
3842 |
+ case 0x00: |
3843 |
++ /* The synchronous connection complete event should only be |
3844 |
++ * sent once per new connection. Receiving a successful |
3845 |
++ * complete event when the connection status is already |
3846 |
++ * BT_CONNECTED means that the device is misbehaving and sent |
3847 |
++ * multiple complete event packets for the same new connection. |
3848 |
++ * |
3849 |
++ * Registering the device more than once can corrupt kernel |
3850 |
++ * memory, hence upon detecting this invalid event, we report |
3851 |
++ * an error and ignore the packet. |
3852 |
++ */ |
3853 |
++ if (conn->state == BT_CONNECTED) { |
3854 |
++ bt_dev_err(hdev, "Ignoring connect complete event for existing connection"); |
3855 |
++ goto unlock; |
3856 |
++ } |
3857 |
++ |
3858 |
+ conn->handle = __le16_to_cpu(ev->handle); |
3859 |
+ conn->state = BT_CONNECTED; |
3860 |
+ conn->type = ev->link_type; |
3861 |
+diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c |
3862 |
+index 95fd7a837dc5c..77f88c7df6053 100644 |
3863 |
+--- a/net/bluetooth/sco.c |
3864 |
++++ b/net/bluetooth/sco.c |
3865 |
+@@ -83,7 +83,6 @@ static void sco_sock_timeout(unsigned long arg) |
3866 |
+ sk->sk_state_change(sk); |
3867 |
+ bh_unlock_sock(sk); |
3868 |
+ |
3869 |
+- sco_sock_kill(sk); |
3870 |
+ sock_put(sk); |
3871 |
+ } |
3872 |
+ |
3873 |
+@@ -175,7 +174,6 @@ static void sco_conn_del(struct hci_conn *hcon, int err) |
3874 |
+ sco_sock_clear_timer(sk); |
3875 |
+ sco_chan_del(sk, err); |
3876 |
+ bh_unlock_sock(sk); |
3877 |
+- sco_sock_kill(sk); |
3878 |
+ sock_put(sk); |
3879 |
+ } |
3880 |
+ |
3881 |
+@@ -210,44 +208,32 @@ static int sco_chan_add(struct sco_conn *conn, struct sock *sk, |
3882 |
+ return err; |
3883 |
+ } |
3884 |
+ |
3885 |
+-static int sco_connect(struct sock *sk) |
3886 |
++static int sco_connect(struct hci_dev *hdev, struct sock *sk) |
3887 |
+ { |
3888 |
+ struct sco_conn *conn; |
3889 |
+ struct hci_conn *hcon; |
3890 |
+- struct hci_dev *hdev; |
3891 |
+ int err, type; |
3892 |
+ |
3893 |
+ BT_DBG("%pMR -> %pMR", &sco_pi(sk)->src, &sco_pi(sk)->dst); |
3894 |
+ |
3895 |
+- hdev = hci_get_route(&sco_pi(sk)->dst, &sco_pi(sk)->src, BDADDR_BREDR); |
3896 |
+- if (!hdev) |
3897 |
+- return -EHOSTUNREACH; |
3898 |
+- |
3899 |
+- hci_dev_lock(hdev); |
3900 |
+- |
3901 |
+ if (lmp_esco_capable(hdev) && !disable_esco) |
3902 |
+ type = ESCO_LINK; |
3903 |
+ else |
3904 |
+ type = SCO_LINK; |
3905 |
+ |
3906 |
+ if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT && |
3907 |
+- (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) { |
3908 |
+- err = -EOPNOTSUPP; |
3909 |
+- goto done; |
3910 |
+- } |
3911 |
++ (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) |
3912 |
++ return -EOPNOTSUPP; |
3913 |
+ |
3914 |
+ hcon = hci_connect_sco(hdev, type, &sco_pi(sk)->dst, |
3915 |
+ sco_pi(sk)->setting); |
3916 |
+- if (IS_ERR(hcon)) { |
3917 |
+- err = PTR_ERR(hcon); |
3918 |
+- goto done; |
3919 |
+- } |
3920 |
++ if (IS_ERR(hcon)) |
3921 |
++ return PTR_ERR(hcon); |
3922 |
+ |
3923 |
+ conn = sco_conn_add(hcon); |
3924 |
+ if (!conn) { |
3925 |
+ hci_conn_drop(hcon); |
3926 |
+- err = -ENOMEM; |
3927 |
+- goto done; |
3928 |
++ return -ENOMEM; |
3929 |
+ } |
3930 |
+ |
3931 |
+ /* Update source addr of the socket */ |
3932 |
+@@ -255,7 +241,7 @@ static int sco_connect(struct sock *sk) |
3933 |
+ |
3934 |
+ err = sco_chan_add(conn, sk, NULL); |
3935 |
+ if (err) |
3936 |
+- goto done; |
3937 |
++ return err; |
3938 |
+ |
3939 |
+ if (hcon->state == BT_CONNECTED) { |
3940 |
+ sco_sock_clear_timer(sk); |
3941 |
+@@ -265,9 +251,6 @@ static int sco_connect(struct sock *sk) |
3942 |
+ sco_sock_set_timer(sk, sk->sk_sndtimeo); |
3943 |
+ } |
3944 |
+ |
3945 |
+-done: |
3946 |
+- hci_dev_unlock(hdev); |
3947 |
+- hci_dev_put(hdev); |
3948 |
+ return err; |
3949 |
+ } |
3950 |
+ |
3951 |
+@@ -392,8 +375,7 @@ static void sco_sock_cleanup_listen(struct sock *parent) |
3952 |
+ */ |
3953 |
+ static void sco_sock_kill(struct sock *sk) |
3954 |
+ { |
3955 |
+- if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket || |
3956 |
+- sock_flag(sk, SOCK_DEAD)) |
3957 |
++ if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket) |
3958 |
+ return; |
3959 |
+ |
3960 |
+ BT_DBG("sk %p state %d", sk, sk->sk_state); |
3961 |
+@@ -445,7 +427,6 @@ static void sco_sock_close(struct sock *sk) |
3962 |
+ lock_sock(sk); |
3963 |
+ __sco_sock_close(sk); |
3964 |
+ release_sock(sk); |
3965 |
+- sco_sock_kill(sk); |
3966 |
+ } |
3967 |
+ |
3968 |
+ static void sco_sock_init(struct sock *sk, struct sock *parent) |
3969 |
+@@ -555,6 +536,7 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen |
3970 |
+ { |
3971 |
+ struct sockaddr_sco *sa = (struct sockaddr_sco *) addr; |
3972 |
+ struct sock *sk = sock->sk; |
3973 |
++ struct hci_dev *hdev; |
3974 |
+ int err; |
3975 |
+ |
3976 |
+ BT_DBG("sk %p", sk); |
3977 |
+@@ -569,12 +551,19 @@ static int sco_sock_connect(struct socket *sock, struct sockaddr *addr, int alen |
3978 |
+ if (sk->sk_type != SOCK_SEQPACKET) |
3979 |
+ return -EINVAL; |
3980 |
+ |
3981 |
++ hdev = hci_get_route(&sa->sco_bdaddr, &sco_pi(sk)->src, BDADDR_BREDR); |
3982 |
++ if (!hdev) |
3983 |
++ return -EHOSTUNREACH; |
3984 |
++ hci_dev_lock(hdev); |
3985 |
++ |
3986 |
+ lock_sock(sk); |
3987 |
+ |
3988 |
+ /* Set destination address and psm */ |
3989 |
+ bacpy(&sco_pi(sk)->dst, &sa->sco_bdaddr); |
3990 |
+ |
3991 |
+- err = sco_connect(sk); |
3992 |
++ err = sco_connect(hdev, sk); |
3993 |
++ hci_dev_unlock(hdev); |
3994 |
++ hci_dev_put(hdev); |
3995 |
+ if (err) |
3996 |
+ goto done; |
3997 |
+ |
3998 |
+@@ -763,6 +752,11 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting) |
3999 |
+ cp.max_latency = cpu_to_le16(0xffff); |
4000 |
+ cp.retrans_effort = 0xff; |
4001 |
+ break; |
4002 |
++ default: |
4003 |
++ /* use CVSD settings as fallback */ |
4004 |
++ cp.max_latency = cpu_to_le16(0xffff); |
4005 |
++ cp.retrans_effort = 0xff; |
4006 |
++ break; |
4007 |
+ } |
4008 |
+ |
4009 |
+ hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, |
4010 |
+diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c |
4011 |
+index 3408ed51b611c..12063f3338972 100644 |
4012 |
+--- a/net/caif/chnl_net.c |
4013 |
++++ b/net/caif/chnl_net.c |
4014 |
+@@ -55,20 +55,6 @@ struct chnl_net { |
4015 |
+ enum caif_states state; |
4016 |
+ }; |
4017 |
+ |
4018 |
+-static void robust_list_del(struct list_head *delete_node) |
4019 |
+-{ |
4020 |
+- struct list_head *list_node; |
4021 |
+- struct list_head *n; |
4022 |
+- ASSERT_RTNL(); |
4023 |
+- list_for_each_safe(list_node, n, &chnl_net_list) { |
4024 |
+- if (list_node == delete_node) { |
4025 |
+- list_del(list_node); |
4026 |
+- return; |
4027 |
+- } |
4028 |
+- } |
4029 |
+- WARN_ON(1); |
4030 |
+-} |
4031 |
+- |
4032 |
+ static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt) |
4033 |
+ { |
4034 |
+ struct sk_buff *skb; |
4035 |
+@@ -370,6 +356,7 @@ static int chnl_net_init(struct net_device *dev) |
4036 |
+ ASSERT_RTNL(); |
4037 |
+ priv = netdev_priv(dev); |
4038 |
+ strncpy(priv->name, dev->name, sizeof(priv->name)); |
4039 |
++ INIT_LIST_HEAD(&priv->list_field); |
4040 |
+ return 0; |
4041 |
+ } |
4042 |
+ |
4043 |
+@@ -378,7 +365,7 @@ static void chnl_net_uninit(struct net_device *dev) |
4044 |
+ struct chnl_net *priv; |
4045 |
+ ASSERT_RTNL(); |
4046 |
+ priv = netdev_priv(dev); |
4047 |
+- robust_list_del(&priv->list_field); |
4048 |
++ list_del_init(&priv->list_field); |
4049 |
+ } |
4050 |
+ |
4051 |
+ static const struct net_device_ops netdev_ops = { |
4052 |
+@@ -541,7 +528,7 @@ static void __exit chnl_exit_module(void) |
4053 |
+ rtnl_lock(); |
4054 |
+ list_for_each_safe(list_node, _tmp, &chnl_net_list) { |
4055 |
+ dev = list_entry(list_node, struct chnl_net, list_field); |
4056 |
+- list_del(list_node); |
4057 |
++ list_del_init(list_node); |
4058 |
+ delete_device(dev); |
4059 |
+ } |
4060 |
+ rtnl_unlock(); |
4061 |
+diff --git a/net/core/flow_dissector.c b/net/core/flow_dissector.c |
4062 |
+index 26b0f70d2f1c9..6b04cbd008425 100644 |
4063 |
+--- a/net/core/flow_dissector.c |
4064 |
++++ b/net/core/flow_dissector.c |
4065 |
+@@ -176,8 +176,10 @@ ip: |
4066 |
+ FLOW_DISSECTOR_KEY_IPV4_ADDRS, |
4067 |
+ target_container); |
4068 |
+ |
4069 |
+- memcpy(&key_addrs->v4addrs, &iph->saddr, |
4070 |
+- sizeof(key_addrs->v4addrs)); |
4071 |
++ memcpy(&key_addrs->v4addrs.src, &iph->saddr, |
4072 |
++ sizeof(key_addrs->v4addrs.src)); |
4073 |
++ memcpy(&key_addrs->v4addrs.dst, &iph->daddr, |
4074 |
++ sizeof(key_addrs->v4addrs.dst)); |
4075 |
+ key_control->addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; |
4076 |
+ } |
4077 |
+ |
4078 |
+@@ -216,8 +218,10 @@ ipv6: |
4079 |
+ FLOW_DISSECTOR_KEY_IPV6_ADDRS, |
4080 |
+ target_container); |
4081 |
+ |
4082 |
+- memcpy(&key_addrs->v6addrs, &iph->saddr, |
4083 |
+- sizeof(key_addrs->v6addrs)); |
4084 |
++ memcpy(&key_addrs->v6addrs.src, &iph->saddr, |
4085 |
++ sizeof(key_addrs->v6addrs.src)); |
4086 |
++ memcpy(&key_addrs->v6addrs.dst, &iph->daddr, |
4087 |
++ sizeof(key_addrs->v6addrs.dst)); |
4088 |
+ key_control->addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; |
4089 |
+ } |
4090 |
+ |
4091 |
+diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c |
4092 |
+index 62522b8d2f971..010ff46529088 100644 |
4093 |
+--- a/net/dccp/minisocks.c |
4094 |
++++ b/net/dccp/minisocks.c |
4095 |
+@@ -98,6 +98,8 @@ struct sock *dccp_create_openreq_child(const struct sock *sk, |
4096 |
+ newdp->dccps_role = DCCP_ROLE_SERVER; |
4097 |
+ newdp->dccps_hc_rx_ackvec = NULL; |
4098 |
+ newdp->dccps_service_list = NULL; |
4099 |
++ newdp->dccps_hc_rx_ccid = NULL; |
4100 |
++ newdp->dccps_hc_tx_ccid = NULL; |
4101 |
+ newdp->dccps_service = dreq->dreq_service; |
4102 |
+ newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo; |
4103 |
+ newdp->dccps_timestamp_time = dreq->dreq_timestamp_time; |
4104 |
+diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c |
4105 |
+index 27518ea7ec3c8..e27ebd00bff26 100644 |
4106 |
+--- a/net/ipv4/icmp.c |
4107 |
++++ b/net/ipv4/icmp.c |
4108 |
+@@ -460,6 +460,23 @@ static int icmp_multipath_hash_skb(const struct sk_buff *skb) |
4109 |
+ |
4110 |
+ #endif |
4111 |
+ |
4112 |
++/* |
4113 |
++ * The device used for looking up which routing table to use for sending an ICMP |
4114 |
++ * error is preferably the source whenever it is set, which should ensure the |
4115 |
++ * icmp error can be sent to the source host, else lookup using the routing |
4116 |
++ * table of the destination device, else use the main routing table (index 0). |
4117 |
++ */ |
4118 |
++static struct net_device *icmp_get_route_lookup_dev(struct sk_buff *skb) |
4119 |
++{ |
4120 |
++ struct net_device *route_lookup_dev = NULL; |
4121 |
++ |
4122 |
++ if (skb->dev) |
4123 |
++ route_lookup_dev = skb->dev; |
4124 |
++ else if (skb_dst(skb)) |
4125 |
++ route_lookup_dev = skb_dst(skb)->dev; |
4126 |
++ return route_lookup_dev; |
4127 |
++} |
4128 |
++ |
4129 |
+ static struct rtable *icmp_route_lookup(struct net *net, |
4130 |
+ struct flowi4 *fl4, |
4131 |
+ struct sk_buff *skb_in, |
4132 |
+@@ -468,6 +485,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
4133 |
+ int type, int code, |
4134 |
+ struct icmp_bxm *param) |
4135 |
+ { |
4136 |
++ struct net_device *route_lookup_dev; |
4137 |
+ struct rtable *rt, *rt2; |
4138 |
+ struct flowi4 fl4_dec; |
4139 |
+ int err; |
4140 |
+@@ -481,7 +499,8 @@ static struct rtable *icmp_route_lookup(struct net *net, |
4141 |
+ fl4->flowi4_proto = IPPROTO_ICMP; |
4142 |
+ fl4->fl4_icmp_type = type; |
4143 |
+ fl4->fl4_icmp_code = code; |
4144 |
+- fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev); |
4145 |
++ route_lookup_dev = icmp_get_route_lookup_dev(skb_in); |
4146 |
++ fl4->flowi4_oif = l3mdev_master_ifindex(route_lookup_dev); |
4147 |
+ |
4148 |
+ security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4)); |
4149 |
+ rt = __ip_route_output_key_hash(net, fl4, |
4150 |
+@@ -506,7 +525,7 @@ static struct rtable *icmp_route_lookup(struct net *net, |
4151 |
+ if (err) |
4152 |
+ goto relookup_failed; |
4153 |
+ |
4154 |
+- if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev, |
4155 |
++ if (inet_addr_type_dev_table(net, route_lookup_dev, |
4156 |
+ fl4_dec.saddr) == RTN_LOCAL) { |
4157 |
+ rt2 = __ip_route_output_key(net, &fl4_dec); |
4158 |
+ if (IS_ERR(rt2)) |
4159 |
+diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c |
4160 |
+index f4a827964b685..381fc854ad199 100644 |
4161 |
+--- a/net/ipv4/igmp.c |
4162 |
++++ b/net/ipv4/igmp.c |
4163 |
+@@ -2685,6 +2685,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u |
4164 |
+ rv = 1; |
4165 |
+ } else if (im) { |
4166 |
+ if (src_addr) { |
4167 |
++ spin_lock_bh(&im->lock); |
4168 |
+ for (psf = im->sources; psf; psf = psf->sf_next) { |
4169 |
+ if (psf->sf_inaddr == src_addr) |
4170 |
+ break; |
4171 |
+@@ -2695,6 +2696,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u |
4172 |
+ im->sfcount[MCAST_EXCLUDE]; |
4173 |
+ else |
4174 |
+ rv = im->sfcount[MCAST_EXCLUDE] != 0; |
4175 |
++ spin_unlock_bh(&im->lock); |
4176 |
+ } else |
4177 |
+ rv = 1; /* unspecified source; tentatively allow */ |
4178 |
+ } |
4179 |
+diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c |
4180 |
+index 3164bae4024a4..589fd0904e0de 100644 |
4181 |
+--- a/net/ipv4/ip_output.c |
4182 |
++++ b/net/ipv4/ip_output.c |
4183 |
+@@ -393,8 +393,9 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) |
4184 |
+ { |
4185 |
+ BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) != |
4186 |
+ offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr)); |
4187 |
+- memcpy(&iph->saddr, &fl4->saddr, |
4188 |
+- sizeof(fl4->saddr) + sizeof(fl4->daddr)); |
4189 |
++ |
4190 |
++ iph->saddr = fl4->saddr; |
4191 |
++ iph->daddr = fl4->daddr; |
4192 |
+ } |
4193 |
+ |
4194 |
+ /* Note: skb->sk can be different from sk, in case of tunnels */ |
4195 |
+diff --git a/net/ipv4/route.c b/net/ipv4/route.c |
4196 |
+index 5350e1b61c06b..f05b8d63dba38 100644 |
4197 |
+--- a/net/ipv4/route.c |
4198 |
++++ b/net/ipv4/route.c |
4199 |
+@@ -597,18 +597,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe) |
4200 |
+ } |
4201 |
+ } |
4202 |
+ |
4203 |
+-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash) |
4204 |
++static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash) |
4205 |
+ { |
4206 |
+- struct fib_nh_exception *fnhe, *oldest; |
4207 |
++ struct fib_nh_exception __rcu **fnhe_p, **oldest_p; |
4208 |
++ struct fib_nh_exception *fnhe, *oldest = NULL; |
4209 |
+ |
4210 |
+- oldest = rcu_dereference(hash->chain); |
4211 |
+- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe; |
4212 |
+- fnhe = rcu_dereference(fnhe->fnhe_next)) { |
4213 |
+- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) |
4214 |
++ for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) { |
4215 |
++ fnhe = rcu_dereference_protected(*fnhe_p, |
4216 |
++ lockdep_is_held(&fnhe_lock)); |
4217 |
++ if (!fnhe) |
4218 |
++ break; |
4219 |
++ if (!oldest || |
4220 |
++ time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) { |
4221 |
+ oldest = fnhe; |
4222 |
++ oldest_p = fnhe_p; |
4223 |
++ } |
4224 |
+ } |
4225 |
+ fnhe_flush_routes(oldest); |
4226 |
+- return oldest; |
4227 |
++ *oldest_p = oldest->fnhe_next; |
4228 |
++ kfree_rcu(oldest, rcu); |
4229 |
+ } |
4230 |
+ |
4231 |
+ static inline u32 fnhe_hashfun(__be32 daddr) |
4232 |
+@@ -685,16 +692,21 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
4233 |
+ if (rt) |
4234 |
+ fill_route_from_fnhe(rt, fnhe); |
4235 |
+ } else { |
4236 |
+- if (depth > FNHE_RECLAIM_DEPTH) |
4237 |
+- fnhe = fnhe_oldest(hash); |
4238 |
+- else { |
4239 |
+- fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); |
4240 |
+- if (!fnhe) |
4241 |
+- goto out_unlock; |
4242 |
+- |
4243 |
+- fnhe->fnhe_next = hash->chain; |
4244 |
+- rcu_assign_pointer(hash->chain, fnhe); |
4245 |
++ /* Randomize max depth to avoid some side channels attacks. */ |
4246 |
++ int max_depth = FNHE_RECLAIM_DEPTH + |
4247 |
++ prandom_u32_max(FNHE_RECLAIM_DEPTH); |
4248 |
++ |
4249 |
++ while (depth > max_depth) { |
4250 |
++ fnhe_remove_oldest(hash); |
4251 |
++ depth--; |
4252 |
+ } |
4253 |
++ |
4254 |
++ fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC); |
4255 |
++ if (!fnhe) |
4256 |
++ goto out_unlock; |
4257 |
++ |
4258 |
++ fnhe->fnhe_next = hash->chain; |
4259 |
++ |
4260 |
+ fnhe->fnhe_genid = genid; |
4261 |
+ fnhe->fnhe_daddr = daddr; |
4262 |
+ fnhe->fnhe_gw = gw; |
4263 |
+@@ -702,6 +714,8 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw, |
4264 |
+ fnhe->fnhe_mtu_locked = lock; |
4265 |
+ fnhe->fnhe_expires = expires; |
4266 |
+ |
4267 |
++ rcu_assign_pointer(hash->chain, fnhe); |
4268 |
++ |
4269 |
+ /* Exception created; mark the cached routes for the nexthop |
4270 |
+ * stale, so anyone caching it rechecks if this exception |
4271 |
+ * applies to them. |
4272 |
+diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c |
4273 |
+index d05135ea3c289..01c73775ed007 100644 |
4274 |
+--- a/net/ipv4/tcp_input.c |
4275 |
++++ b/net/ipv4/tcp_input.c |
4276 |
+@@ -1220,7 +1220,7 @@ static u8 tcp_sacktag_one(struct sock *sk, |
4277 |
+ if (dup_sack && (sacked & TCPCB_RETRANS)) { |
4278 |
+ if (tp->undo_marker && tp->undo_retrans > 0 && |
4279 |
+ after(end_seq, tp->undo_marker)) |
4280 |
+- tp->undo_retrans--; |
4281 |
++ tp->undo_retrans = max_t(int, 0, tp->undo_retrans - pcount); |
4282 |
+ if (sacked & TCPCB_SACKED_ACKED) |
4283 |
+ state->reord = min(fack_count, state->reord); |
4284 |
+ } |
4285 |
+diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c |
4286 |
+index 10860c089fda2..6f895694cca1c 100644 |
4287 |
+--- a/net/ipv4/tcp_ipv4.c |
4288 |
++++ b/net/ipv4/tcp_ipv4.c |
4289 |
+@@ -2068,6 +2068,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos) |
4290 |
+ static void *tcp_seek_last_pos(struct seq_file *seq) |
4291 |
+ { |
4292 |
+ struct tcp_iter_state *st = seq->private; |
4293 |
++ int bucket = st->bucket; |
4294 |
+ int offset = st->offset; |
4295 |
+ int orig_num = st->num; |
4296 |
+ void *rc = NULL; |
4297 |
+@@ -2078,7 +2079,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq) |
4298 |
+ break; |
4299 |
+ st->state = TCP_SEQ_STATE_LISTENING; |
4300 |
+ rc = listening_get_next(seq, NULL); |
4301 |
+- while (offset-- && rc) |
4302 |
++ while (offset-- && rc && bucket == st->bucket) |
4303 |
+ rc = listening_get_next(seq, rc); |
4304 |
+ if (rc) |
4305 |
+ break; |
4306 |
+@@ -2089,7 +2090,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq) |
4307 |
+ if (st->bucket > tcp_hashinfo.ehash_mask) |
4308 |
+ break; |
4309 |
+ rc = established_get_first(seq); |
4310 |
+- while (offset-- && rc) |
4311 |
++ while (offset-- && rc && bucket == st->bucket) |
4312 |
+ rc = established_get_next(seq, rc); |
4313 |
+ } |
4314 |
+ |
4315 |
+diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c |
4316 |
+index 15f8bd0364c24..f55ba81462541 100644 |
4317 |
+--- a/net/l2tp/l2tp_core.c |
4318 |
++++ b/net/l2tp/l2tp_core.c |
4319 |
+@@ -994,8 +994,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb, |
4320 |
+ } |
4321 |
+ |
4322 |
+ if (tunnel->version == L2TP_HDR_VER_3 && |
4323 |
+- l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) |
4324 |
++ l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) { |
4325 |
++ l2tp_session_dec_refcount(session); |
4326 |
+ goto error; |
4327 |
++ } |
4328 |
+ |
4329 |
+ l2tp_recv_common(session, skb, ptr, optr, hdrflags, length, payload_hook); |
4330 |
+ l2tp_session_dec_refcount(session); |
4331 |
+diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c |
4332 |
+index 7fd1104ba9007..422fac2a4a3c8 100644 |
4333 |
+--- a/net/netlabel/netlabel_cipso_v4.c |
4334 |
++++ b/net/netlabel/netlabel_cipso_v4.c |
4335 |
+@@ -163,8 +163,8 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4336 |
+ return -ENOMEM; |
4337 |
+ doi_def->map.std = kzalloc(sizeof(*doi_def->map.std), GFP_KERNEL); |
4338 |
+ if (doi_def->map.std == NULL) { |
4339 |
+- ret_val = -ENOMEM; |
4340 |
+- goto add_std_failure; |
4341 |
++ kfree(doi_def); |
4342 |
++ return -ENOMEM; |
4343 |
+ } |
4344 |
+ doi_def->type = CIPSO_V4_MAP_TRANS; |
4345 |
+ |
4346 |
+@@ -205,14 +205,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4347 |
+ } |
4348 |
+ doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size, |
4349 |
+ sizeof(u32), |
4350 |
+- GFP_KERNEL); |
4351 |
++ GFP_KERNEL | __GFP_NOWARN); |
4352 |
+ if (doi_def->map.std->lvl.local == NULL) { |
4353 |
+ ret_val = -ENOMEM; |
4354 |
+ goto add_std_failure; |
4355 |
+ } |
4356 |
+ doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size, |
4357 |
+ sizeof(u32), |
4358 |
+- GFP_KERNEL); |
4359 |
++ GFP_KERNEL | __GFP_NOWARN); |
4360 |
+ if (doi_def->map.std->lvl.cipso == NULL) { |
4361 |
+ ret_val = -ENOMEM; |
4362 |
+ goto add_std_failure; |
4363 |
+@@ -279,7 +279,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4364 |
+ doi_def->map.std->cat.local = kcalloc( |
4365 |
+ doi_def->map.std->cat.local_size, |
4366 |
+ sizeof(u32), |
4367 |
+- GFP_KERNEL); |
4368 |
++ GFP_KERNEL | __GFP_NOWARN); |
4369 |
+ if (doi_def->map.std->cat.local == NULL) { |
4370 |
+ ret_val = -ENOMEM; |
4371 |
+ goto add_std_failure; |
4372 |
+@@ -287,7 +287,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info, |
4373 |
+ doi_def->map.std->cat.cipso = kcalloc( |
4374 |
+ doi_def->map.std->cat.cipso_size, |
4375 |
+ sizeof(u32), |
4376 |
+- GFP_KERNEL); |
4377 |
++ GFP_KERNEL | __GFP_NOWARN); |
4378 |
+ if (doi_def->map.std->cat.cipso == NULL) { |
4379 |
+ ret_val = -ENOMEM; |
4380 |
+ goto add_std_failure; |
4381 |
+diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c |
4382 |
+index 541410f1c3b74..453b0efdc0d71 100644 |
4383 |
+--- a/net/netlink/af_netlink.c |
4384 |
++++ b/net/netlink/af_netlink.c |
4385 |
+@@ -2409,13 +2409,15 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid, |
4386 |
+ /* errors reported via destination sk->sk_err, but propagate |
4387 |
+ * delivery errors if NETLINK_BROADCAST_ERROR flag is set */ |
4388 |
+ err = nlmsg_multicast(sk, skb, exclude_portid, group, flags); |
4389 |
++ if (err == -ESRCH) |
4390 |
++ err = 0; |
4391 |
+ } |
4392 |
+ |
4393 |
+ if (report) { |
4394 |
+ int err2; |
4395 |
+ |
4396 |
+ err2 = nlmsg_unicast(sk, skb, portid); |
4397 |
+- if (!err || err == -ESRCH) |
4398 |
++ if (!err) |
4399 |
+ err = err2; |
4400 |
+ } |
4401 |
+ |
4402 |
+diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c |
4403 |
+index 18904313bd4e6..5d3698199757a 100644 |
4404 |
+--- a/net/sched/cls_flower.c |
4405 |
++++ b/net/sched/cls_flower.c |
4406 |
+@@ -445,6 +445,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb, |
4407 |
+ |
4408 |
+ if (tb[TCA_FLOWER_KEY_IPV4_SRC] || tb[TCA_FLOWER_KEY_IPV4_DST]) { |
4409 |
+ key->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; |
4410 |
++ mask->control.addr_type = ~0; |
4411 |
+ fl_set_key_val(tb, &key->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC, |
4412 |
+ &mask->ipv4.src, TCA_FLOWER_KEY_IPV4_SRC_MASK, |
4413 |
+ sizeof(key->ipv4.src)); |
4414 |
+@@ -453,6 +454,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb, |
4415 |
+ sizeof(key->ipv4.dst)); |
4416 |
+ } else if (tb[TCA_FLOWER_KEY_IPV6_SRC] || tb[TCA_FLOWER_KEY_IPV6_DST]) { |
4417 |
+ key->control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; |
4418 |
++ mask->control.addr_type = ~0; |
4419 |
+ fl_set_key_val(tb, &key->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC, |
4420 |
+ &mask->ipv6.src, TCA_FLOWER_KEY_IPV6_SRC_MASK, |
4421 |
+ sizeof(key->ipv6.src)); |
4422 |
+@@ -480,6 +482,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb, |
4423 |
+ if (tb[TCA_FLOWER_KEY_ENC_IPV4_SRC] || |
4424 |
+ tb[TCA_FLOWER_KEY_ENC_IPV4_DST]) { |
4425 |
+ key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS; |
4426 |
++ mask->enc_control.addr_type = ~0; |
4427 |
+ fl_set_key_val(tb, &key->enc_ipv4.src, |
4428 |
+ TCA_FLOWER_KEY_ENC_IPV4_SRC, |
4429 |
+ &mask->enc_ipv4.src, |
4430 |
+@@ -495,6 +498,7 @@ static int fl_set_key(struct net *net, struct nlattr **tb, |
4431 |
+ if (tb[TCA_FLOWER_KEY_ENC_IPV6_SRC] || |
4432 |
+ tb[TCA_FLOWER_KEY_ENC_IPV6_DST]) { |
4433 |
+ key->enc_control.addr_type = FLOW_DISSECTOR_KEY_IPV6_ADDRS; |
4434 |
++ mask->enc_control.addr_type = ~0; |
4435 |
+ fl_set_key_val(tb, &key->enc_ipv6.src, |
4436 |
+ TCA_FLOWER_KEY_ENC_IPV6_SRC, |
4437 |
+ &mask->enc_ipv6.src, |
4438 |
+diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c |
4439 |
+index 85ad23d9a8a9b..5a7041c34c7b1 100644 |
4440 |
+--- a/net/sunrpc/auth_gss/svcauth_gss.c |
4441 |
++++ b/net/sunrpc/auth_gss/svcauth_gss.c |
4442 |
+@@ -1853,7 +1853,7 @@ gss_svc_init_net(struct net *net) |
4443 |
+ goto out2; |
4444 |
+ return 0; |
4445 |
+ out2: |
4446 |
+- destroy_use_gss_proxy_proc_entry(net); |
4447 |
++ rsi_cache_destroy_net(net); |
4448 |
+ out1: |
4449 |
+ rsc_cache_destroy_net(net); |
4450 |
+ return rv; |
4451 |
+diff --git a/net/tipc/socket.c b/net/tipc/socket.c |
4452 |
+index 6077850774454..9f39276e5d4e2 100644 |
4453 |
+--- a/net/tipc/socket.c |
4454 |
++++ b/net/tipc/socket.c |
4455 |
+@@ -1755,7 +1755,7 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb) |
4456 |
+ static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, |
4457 |
+ u32 dport, struct sk_buff_head *xmitq) |
4458 |
+ { |
4459 |
+- unsigned long time_limit = jiffies + 2; |
4460 |
++ unsigned long time_limit = jiffies + usecs_to_jiffies(20000); |
4461 |
+ struct sk_buff *skb; |
4462 |
+ unsigned int lim; |
4463 |
+ atomic_t *dcnt; |
4464 |
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c |
4465 |
+index bfdfb958a37d6..2c643e1919aab 100644 |
4466 |
+--- a/net/unix/af_unix.c |
4467 |
++++ b/net/unix/af_unix.c |
4468 |
+@@ -2694,7 +2694,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, |
4469 |
+ |
4470 |
+ other = unix_peer(sk); |
4471 |
+ if (other && unix_peer(other) != sk && |
4472 |
+- unix_recvq_full(other) && |
4473 |
++ unix_recvq_full_lockless(other) && |
4474 |
+ unix_dgram_peer_wake_me(sk, other)) |
4475 |
+ writable = 0; |
4476 |
+ |
4477 |
+diff --git a/security/integrity/ima/ima_mok.c b/security/integrity/ima/ima_mok.c |
4478 |
+index 74a2799574642..315a638ec8d13 100644 |
4479 |
+--- a/security/integrity/ima/ima_mok.c |
4480 |
++++ b/security/integrity/ima/ima_mok.c |
4481 |
+@@ -25,7 +25,7 @@ struct key *ima_blacklist_keyring; |
4482 |
+ /* |
4483 |
+ * Allocate the IMA blacklist keyring |
4484 |
+ */ |
4485 |
+-__init int ima_mok_init(void) |
4486 |
++static __init int ima_mok_init(void) |
4487 |
+ { |
4488 |
+ pr_notice("Allocating IMA blacklist keyring.\n"); |
4489 |
+ |
4490 |
+diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c |
4491 |
+index e5d5c7fb2dace..b25cc69ef7ba9 100644 |
4492 |
+--- a/security/smack/smack_access.c |
4493 |
++++ b/security/smack/smack_access.c |
4494 |
+@@ -90,23 +90,22 @@ int log_policy = SMACK_AUDIT_DENIED; |
4495 |
+ int smk_access_entry(char *subject_label, char *object_label, |
4496 |
+ struct list_head *rule_list) |
4497 |
+ { |
4498 |
+- int may = -ENOENT; |
4499 |
+ struct smack_rule *srp; |
4500 |
+ |
4501 |
+ list_for_each_entry_rcu(srp, rule_list, list) { |
4502 |
+ if (srp->smk_object->smk_known == object_label && |
4503 |
+ srp->smk_subject->smk_known == subject_label) { |
4504 |
+- may = srp->smk_access; |
4505 |
+- break; |
4506 |
++ int may = srp->smk_access; |
4507 |
++ /* |
4508 |
++ * MAY_WRITE implies MAY_LOCK. |
4509 |
++ */ |
4510 |
++ if ((may & MAY_WRITE) == MAY_WRITE) |
4511 |
++ may |= MAY_LOCK; |
4512 |
++ return may; |
4513 |
+ } |
4514 |
+ } |
4515 |
+ |
4516 |
+- /* |
4517 |
+- * MAY_WRITE implies MAY_LOCK. |
4518 |
+- */ |
4519 |
+- if ((may & MAY_WRITE) == MAY_WRITE) |
4520 |
+- may |= MAY_LOCK; |
4521 |
+- return may; |
4522 |
++ return -ENOENT; |
4523 |
+ } |
4524 |
+ |
4525 |
+ /** |
4526 |
+diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c |
4527 |
+index f0052c06d0651..a479f21f49c5b 100644 |
4528 |
+--- a/sound/core/pcm_lib.c |
4529 |
++++ b/sound/core/pcm_lib.c |
4530 |
+@@ -1830,7 +1830,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, |
4531 |
+ channels = params_channels(params); |
4532 |
+ frame_size = snd_pcm_format_size(format, channels); |
4533 |
+ if (frame_size > 0) |
4534 |
+- params->fifo_size /= (unsigned)frame_size; |
4535 |
++ params->fifo_size /= frame_size; |
4536 |
+ } |
4537 |
+ return 0; |
4538 |
+ } |
4539 |
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c |
4540 |
+index c17f262f0834b..18e002fef401d 100644 |
4541 |
+--- a/sound/soc/intel/boards/bytcr_rt5640.c |
4542 |
++++ b/sound/soc/intel/boards/bytcr_rt5640.c |
4543 |
+@@ -172,9 +172,6 @@ static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = { |
4544 |
+ static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { |
4545 |
+ {"Headphone", NULL, "Platform Clock"}, |
4546 |
+ {"Headset Mic", NULL, "Platform Clock"}, |
4547 |
+- {"Internal Mic", NULL, "Platform Clock"}, |
4548 |
+- {"Speaker", NULL, "Platform Clock"}, |
4549 |
+- |
4550 |
+ {"Headset Mic", NULL, "MICBIAS1"}, |
4551 |
+ {"IN2P", NULL, "Headset Mic"}, |
4552 |
+ {"Headphone", NULL, "HPOL"}, |
4553 |
+@@ -182,19 +179,23 @@ static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = { |
4554 |
+ }; |
4555 |
+ |
4556 |
+ static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic1_map[] = { |
4557 |
++ {"Internal Mic", NULL, "Platform Clock"}, |
4558 |
+ {"DMIC1", NULL, "Internal Mic"}, |
4559 |
+ }; |
4560 |
+ |
4561 |
+ static const struct snd_soc_dapm_route byt_rt5640_intmic_dmic2_map[] = { |
4562 |
++ {"Internal Mic", NULL, "Platform Clock"}, |
4563 |
+ {"DMIC2", NULL, "Internal Mic"}, |
4564 |
+ }; |
4565 |
+ |
4566 |
+ static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = { |
4567 |
++ {"Internal Mic", NULL, "Platform Clock"}, |
4568 |
+ {"Internal Mic", NULL, "MICBIAS1"}, |
4569 |
+ {"IN1P", NULL, "Internal Mic"}, |
4570 |
+ }; |
4571 |
+ |
4572 |
+ static const struct snd_soc_dapm_route byt_rt5640_intmic_in3_map[] = { |
4573 |
++ {"Internal Mic", NULL, "Platform Clock"}, |
4574 |
+ {"Internal Mic", NULL, "MICBIAS1"}, |
4575 |
+ {"IN3P", NULL, "Internal Mic"}, |
4576 |
+ }; |
4577 |
+@@ -236,6 +237,7 @@ static const struct snd_soc_dapm_route byt_rt5640_ssp0_aif2_map[] = { |
4578 |
+ }; |
4579 |
+ |
4580 |
+ static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { |
4581 |
++ {"Speaker", NULL, "Platform Clock"}, |
4582 |
+ {"Speaker", NULL, "SPOLP"}, |
4583 |
+ {"Speaker", NULL, "SPOLN"}, |
4584 |
+ {"Speaker", NULL, "SPORP"}, |
4585 |
+@@ -243,6 +245,7 @@ static const struct snd_soc_dapm_route byt_rt5640_stereo_spk_map[] = { |
4586 |
+ }; |
4587 |
+ |
4588 |
+ static const struct snd_soc_dapm_route byt_rt5640_mono_spk_map[] = { |
4589 |
++ {"Speaker", NULL, "Platform Clock"}, |
4590 |
+ {"Speaker", NULL, "SPOLP"}, |
4591 |
+ {"Speaker", NULL, "SPOLN"}, |
4592 |
+ }; |