Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.4 commit in: /
Date: Wed, 22 Sep 2021 11:43:41
Message-Id: 1632311007.e9f113f979e8cbfc3e13e24e479607359a16a6b3.mpagano@gentoo
1 commit: e9f113f979e8cbfc3e13e24e479607359a16a6b3
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 22 11:43:27 2021 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 22 11:43:27 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e9f113f9
7
8 Linux patch 4.4.284
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1283_linux-4.4.284.patch | 3202 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 3206 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 66d01d4..b242c5e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -1175,6 +1175,10 @@ Patch: 1282_linux-4.4.283.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.283
23
24 +Patch: 1283_linux-4.4.284.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.284
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1283_linux-4.4.284.patch b/1283_linux-4.4.284.patch
33 new file mode 100644
34 index 0000000..0ae0662
35 --- /dev/null
36 +++ b/1283_linux-4.4.284.patch
37 @@ -0,0 +1,3202 @@
38 +diff --git a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt
39 +index fb733c4e1c116..3a58fdf0c566b 100644
40 +--- a/Documentation/devicetree/bindings/mtd/gpmc-nand.txt
41 ++++ b/Documentation/devicetree/bindings/mtd/gpmc-nand.txt
42 +@@ -112,7 +112,7 @@ on various other factors also like;
43 + so the device should have enough free bytes available its OOB/Spare
44 + area to accommodate ECC for entire page. In general following expression
45 + helps in determining if given device can accommodate ECC syndrome:
46 +- "2 + (PAGESIZE / 512) * ECC_BYTES" >= OOBSIZE"
47 ++ "2 + (PAGESIZE / 512) * ECC_BYTES" <= OOBSIZE"
48 + where
49 + OOBSIZE number of bytes in OOB/spare area
50 + PAGESIZE number of bytes in main-area of device page
51 +diff --git a/Makefile b/Makefile
52 +index 2ec9a780cfe73..05fe3ae4e67aa 100644
53 +--- a/Makefile
54 ++++ b/Makefile
55 +@@ -1,6 +1,6 @@
56 + VERSION = 4
57 + PATCHLEVEL = 4
58 +-SUBLEVEL = 283
59 ++SUBLEVEL = 284
60 + EXTRAVERSION =
61 + NAME = Blurry Fish Butt
62 +
63 +diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
64 +index a5d8bef65911f..77f6b1c737370 100644
65 +--- a/arch/arc/Kconfig
66 ++++ b/arch/arc/Kconfig
67 +@@ -23,7 +23,7 @@ config ARC
68 + select GENERIC_SMP_IDLE_THREAD
69 + select HAVE_ARCH_KGDB
70 + select HAVE_ARCH_TRACEHOOK
71 +- select HAVE_FUTEX_CMPXCHG
72 ++ select HAVE_FUTEX_CMPXCHG if FUTEX
73 + select HAVE_IOREMAP_PROT
74 + select HAVE_KPROBES
75 + select HAVE_KRETPROBES
76 +diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
77 +index 017fb440bba4b..f425405a8a76c 100644
78 +--- a/arch/arc/mm/cache.c
79 ++++ b/arch/arc/mm/cache.c
80 +@@ -904,7 +904,7 @@ void clear_user_page(void *to, unsigned long u_vaddr, struct page *page)
81 + clear_page(to);
82 + clear_bit(PG_dc_clean, &page->flags);
83 + }
84 +-
85 ++EXPORT_SYMBOL(clear_user_page);
86 +
87 + /**********************************************************************
88 + * Explicit Cache flush request from user space via syscall
89 +diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
90 +index 3f9a9ebc77c38..7f167276d4c5a 100644
91 +--- a/arch/arm/boot/compressed/Makefile
92 ++++ b/arch/arm/boot/compressed/Makefile
93 +@@ -86,6 +86,8 @@ $(addprefix $(obj)/,$(libfdt_objs) atags_to_fdt.o): \
94 + $(addprefix $(obj)/,$(libfdt_hdrs))
95 +
96 + ifeq ($(CONFIG_ARM_ATAG_DTB_COMPAT),y)
97 ++CFLAGS_REMOVE_atags_to_fdt.o += -Wframe-larger-than=${CONFIG_FRAME_WARN}
98 ++CFLAGS_atags_to_fdt.o += -Wframe-larger-than=1280
99 + OBJS += $(libfdt_objs) atags_to_fdt.o
100 + endif
101 +
102 +diff --git a/arch/arm/boot/dts/tegra20-tamonten.dtsi b/arch/arm/boot/dts/tegra20-tamonten.dtsi
103 +index 13d4e6185275f..c70d1ec029574 100644
104 +--- a/arch/arm/boot/dts/tegra20-tamonten.dtsi
105 ++++ b/arch/arm/boot/dts/tegra20-tamonten.dtsi
106 +@@ -180,8 +180,9 @@
107 + nvidia,pins = "ata", "atb", "atc", "atd", "ate",
108 + "cdev1", "cdev2", "dap1", "dtb", "gma",
109 + "gmb", "gmc", "gmd", "gme", "gpu7",
110 +- "gpv", "i2cp", "pta", "rm", "slxa",
111 +- "slxk", "spia", "spib", "uac";
112 ++ "gpv", "i2cp", "irrx", "irtx", "pta",
113 ++ "rm", "slxa", "slxk", "spia", "spib",
114 ++ "uac";
115 + nvidia,pull = <TEGRA_PIN_PULL_NONE>;
116 + nvidia,tristate = <TEGRA_PIN_DISABLE>;
117 + };
118 +@@ -206,7 +207,7 @@
119 + conf_ddc {
120 + nvidia,pins = "ddc", "dta", "dtd", "kbca",
121 + "kbcb", "kbcc", "kbcd", "kbce", "kbcf",
122 +- "sdc";
123 ++ "sdc", "uad", "uca";
124 + nvidia,pull = <TEGRA_PIN_PULL_UP>;
125 + nvidia,tristate = <TEGRA_PIN_DISABLE>;
126 + };
127 +@@ -216,10 +217,9 @@
128 + "lvp0", "owc", "sdb";
129 + nvidia,tristate = <TEGRA_PIN_ENABLE>;
130 + };
131 +- conf_irrx {
132 +- nvidia,pins = "irrx", "irtx", "sdd", "spic",
133 +- "spie", "spih", "uaa", "uab", "uad",
134 +- "uca", "ucb";
135 ++ conf_sdd {
136 ++ nvidia,pins = "sdd", "spic", "spie", "spih",
137 ++ "uaa", "uab", "ucb";
138 + nvidia,pull = <TEGRA_PIN_PULL_UP>;
139 + nvidia,tristate = <TEGRA_PIN_ENABLE>;
140 + };
141 +diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
142 +index 649bc3300c93d..a43601d61ce07 100644
143 +--- a/arch/arm/kernel/Makefile
144 ++++ b/arch/arm/kernel/Makefile
145 +@@ -16,10 +16,14 @@ CFLAGS_REMOVE_return_address.o = -pg
146 + # Object file lists.
147 +
148 + obj-y := elf.o entry-common.o irq.o opcodes.o \
149 +- process.o ptrace.o reboot.o return_address.o \
150 ++ process.o ptrace.o reboot.o \
151 + setup.o signal.o sigreturn_codes.o \
152 + stacktrace.o sys_arm.o time.o traps.o
153 +
154 ++ifneq ($(CONFIG_ARM_UNWIND),y)
155 ++obj-$(CONFIG_FRAME_POINTER) += return_address.o
156 ++endif
157 ++
158 + obj-$(CONFIG_ATAGS) += atags_parse.o
159 + obj-$(CONFIG_ATAGS_PROC) += atags_proc.o
160 + obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o
161 +diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
162 +index 36ed35073289b..f945742dea449 100644
163 +--- a/arch/arm/kernel/return_address.c
164 ++++ b/arch/arm/kernel/return_address.c
165 +@@ -10,8 +10,6 @@
166 + */
167 + #include <linux/export.h>
168 + #include <linux/ftrace.h>
169 +-
170 +-#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND)
171 + #include <linux/sched.h>
172 +
173 + #include <asm/stacktrace.h>
174 +@@ -56,6 +54,4 @@ void *return_address(unsigned int level)
175 + return NULL;
176 + }
177 +
178 +-#endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */
179 +-
180 + EXPORT_SYMBOL_GPL(return_address);
181 +diff --git a/arch/arm64/boot/dts/exynos/exynos7.dtsi b/arch/arm64/boot/dts/exynos/exynos7.dtsi
182 +index f9c5a549c2c02..cb863891f29e5 100644
183 +--- a/arch/arm64/boot/dts/exynos/exynos7.dtsi
184 ++++ b/arch/arm64/boot/dts/exynos/exynos7.dtsi
185 +@@ -90,7 +90,7 @@
186 + #address-cells = <0>;
187 + interrupt-controller;
188 + reg = <0x11001000 0x1000>,
189 +- <0x11002000 0x1000>,
190 ++ <0x11002000 0x2000>,
191 + <0x11004000 0x2000>,
192 + <0x11006000 0x2000>;
193 + };
194 +diff --git a/arch/m68k/emu/nfeth.c b/arch/m68k/emu/nfeth.c
195 +index a0985fd088d1c..7d695fc7a2d02 100644
196 +--- a/arch/m68k/emu/nfeth.c
197 ++++ b/arch/m68k/emu/nfeth.c
198 +@@ -260,8 +260,8 @@ static void __exit nfeth_cleanup(void)
199 +
200 + for (i = 0; i < MAX_UNIT; i++) {
201 + if (nfeth_dev[i]) {
202 +- unregister_netdev(nfeth_dev[0]);
203 +- free_netdev(nfeth_dev[0]);
204 ++ unregister_netdev(nfeth_dev[i]);
205 ++ free_netdev(nfeth_dev[i]);
206 + }
207 + }
208 + free_irq(nfEtherIRQ, nfeth_interrupt);
209 +diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S
210 +index 3fbe420f49c43..92cdc1e56b602 100644
211 +--- a/arch/openrisc/kernel/entry.S
212 ++++ b/arch/openrisc/kernel/entry.S
213 +@@ -491,6 +491,7 @@ EXCEPTION_ENTRY(_external_irq_handler)
214 + l.bnf 1f // ext irq enabled, all ok.
215 + l.nop
216 +
217 ++#ifdef CONFIG_PRINTK
218 + l.addi r1,r1,-0x8
219 + l.movhi r3,hi(42f)
220 + l.ori r3,r3,lo(42f)
221 +@@ -504,6 +505,7 @@ EXCEPTION_ENTRY(_external_irq_handler)
222 + .string "\n\rESR interrupt bug: in _external_irq_handler (ESR %x)\n\r"
223 + .align 4
224 + .previous
225 ++#endif
226 +
227 + l.ori r4,r4,SPR_SR_IEE // fix the bug
228 + // l.sw PT_SR(r1),r4
229 +diff --git a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
230 +index 2264f68f3c2f9..d9a4d6ffc0a8d 100644
231 +--- a/arch/parisc/kernel/signal.c
232 ++++ b/arch/parisc/kernel/signal.c
233 +@@ -239,6 +239,12 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs,
234 + #endif
235 +
236 + usp = (regs->gr[30] & ~(0x01UL));
237 ++#ifdef CONFIG_64BIT
238 ++ if (is_compat_task()) {
239 ++ /* The gcc alloca implementation leaves garbage in the upper 32 bits of sp */
240 ++ usp = (compat_uint_t)usp;
241 ++ }
242 ++#endif
243 + /*FIXME: frame_size parameter is unused, remove it. */
244 + frame = get_sigframe(&ksig->ka, usp, sizeof(*frame));
245 +
246 +diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
247 +index a3550e8f1a77b..51669cdbf011e 100644
248 +--- a/arch/powerpc/boot/crt0.S
249 ++++ b/arch/powerpc/boot/crt0.S
250 +@@ -49,9 +49,6 @@ p_end: .long _end
251 + p_pstack: .long _platform_stack_top
252 + #endif
253 +
254 +- .globl _zimage_start
255 +- /* Clang appears to require the .weak directive to be after the symbol
256 +- * is defined. See https://bugs.llvm.org/show_bug.cgi?id=38921 */
257 + .weak _zimage_start
258 + _zimage_start:
259 + .globl _zimage_start_lib
260 +diff --git a/arch/powerpc/kernel/module_64.c b/arch/powerpc/kernel/module_64.c
261 +index 08b7a40de5f85..0a96b19413976 100644
262 +--- a/arch/powerpc/kernel/module_64.c
263 ++++ b/arch/powerpc/kernel/module_64.c
264 +@@ -662,7 +662,7 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
265 + /*
266 + * If found, replace it with:
267 + * addis r2, r12, (.TOC.-func)@ha
268 +- * addi r2, r12, (.TOC.-func)@l
269 ++ * addi r2, r2, (.TOC.-func)@l
270 + */
271 + ((uint32_t *)location)[0] = 0x3c4c0000 + PPC_HA(value);
272 + ((uint32_t *)location)[1] = 0x38420000 + PPC_LO(value);
273 +diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c
274 +index 1d4a054ce59ab..c4def044f27bf 100644
275 +--- a/arch/s390/kernel/dis.c
276 ++++ b/arch/s390/kernel/dis.c
277 +@@ -2025,7 +2025,7 @@ void show_code(struct pt_regs *regs)
278 + start += opsize;
279 + printk(buffer);
280 + ptr = buffer;
281 +- ptr += sprintf(ptr, "\n\t ");
282 ++ ptr += sprintf(ptr, "\n ");
283 + hops++;
284 + }
285 + printk("\n");
286 +diff --git a/arch/s390/kernel/jump_label.c b/arch/s390/kernel/jump_label.c
287 +index 083b05f5f5ab6..cbc1877066482 100644
288 +--- a/arch/s390/kernel/jump_label.c
289 ++++ b/arch/s390/kernel/jump_label.c
290 +@@ -43,7 +43,7 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *expected,
291 + unsigned char *ipe = (unsigned char *)expected;
292 + unsigned char *ipn = (unsigned char *)new;
293 +
294 +- pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc);
295 ++ pr_emerg("Jump label code mismatch at %pS [%px]\n", ipc, ipc);
296 + pr_emerg("Found: %6ph\n", ipc);
297 + pr_emerg("Expected: %6ph\n", ipe);
298 + pr_emerg("New: %6ph\n", ipn);
299 +diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
300 +index c5c3056f4c4a4..8b73ef59a8de6 100644
301 +--- a/arch/s390/net/bpf_jit_comp.c
302 ++++ b/arch/s390/net/bpf_jit_comp.c
303 +@@ -630,8 +630,13 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i
304 + case BPF_ALU64 | BPF_SUB | BPF_K: /* dst = dst - imm */
305 + if (!imm)
306 + break;
307 +- /* agfi %dst,-imm */
308 +- EMIT6_IMM(0xc2080000, dst_reg, -imm);
309 ++ if (imm == -0x80000000) {
310 ++ /* algfi %dst,0x80000000 */
311 ++ EMIT6_IMM(0xc20a0000, dst_reg, 0x80000000);
312 ++ } else {
313 ++ /* agfi %dst,-imm */
314 ++ EMIT6_IMM(0xc2080000, dst_reg, -imm);
315 ++ }
316 + break;
317 + /*
318 + * BPF_MUL
319 +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
320 +index 1c2451107e49d..143c06f845961 100644
321 +--- a/arch/x86/kernel/reboot.c
322 ++++ b/arch/x86/kernel/reboot.c
323 +@@ -337,10 +337,11 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
324 + },
325 + { /* Handle problems with rebooting on the OptiPlex 990. */
326 + .callback = set_pci_reboot,
327 +- .ident = "Dell OptiPlex 990",
328 ++ .ident = "Dell OptiPlex 990 BIOS A0x",
329 + .matches = {
330 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
331 + DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 990"),
332 ++ DMI_MATCH(DMI_BIOS_VERSION, "A0"),
333 + },
334 + },
335 + { /* Handle problems with rebooting on Dell 300's */
336 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
337 +index 42000fffe77ea..8dce61ca934b2 100644
338 +--- a/arch/x86/kvm/x86.c
339 ++++ b/arch/x86/kvm/x86.c
340 +@@ -2172,6 +2172,10 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
341 + if (!msr_info->host_initiated) {
342 + s64 adj = data - vcpu->arch.ia32_tsc_adjust_msr;
343 + adjust_tsc_offset_guest(vcpu, adj);
344 ++ /* Before back to guest, tsc_timestamp must be adjusted
345 ++ * as well, otherwise guest's percpu pvclock time could jump.
346 ++ */
347 ++ kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
348 + }
349 + vcpu->arch.ia32_tsc_adjust_msr = data;
350 + }
351 +diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
352 +index d76ec9348cff4..547d80fc76d71 100644
353 +--- a/arch/x86/mm/init_64.c
354 ++++ b/arch/x86/mm/init_64.c
355 +@@ -1182,21 +1182,21 @@ int kern_addr_valid(unsigned long addr)
356 + return 0;
357 +
358 + pud = pud_offset(pgd, addr);
359 +- if (pud_none(*pud))
360 ++ if (!pud_present(*pud))
361 + return 0;
362 +
363 + if (pud_large(*pud))
364 + return pfn_valid(pud_pfn(*pud));
365 +
366 + pmd = pmd_offset(pud, addr);
367 +- if (pmd_none(*pmd))
368 ++ if (!pmd_present(*pmd))
369 + return 0;
370 +
371 + if (pmd_large(*pmd))
372 + return pfn_valid(pmd_pfn(*pmd));
373 +
374 + pte = pte_offset_kernel(pmd, addr);
375 +- if (pte_none(*pte))
376 ++ if (!pte_present(*pte))
377 + return 0;
378 +
379 + return pfn_valid(pte_pfn(*pte));
380 +diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
381 +index 86047b18b0136..af0ebe18248a5 100644
382 +--- a/arch/x86/xen/p2m.c
383 ++++ b/arch/x86/xen/p2m.c
384 +@@ -623,8 +623,8 @@ int xen_alloc_p2m_entry(unsigned long pfn)
385 + }
386 +
387 + /* Expanded the p2m? */
388 +- if (pfn > xen_p2m_last_pfn) {
389 +- xen_p2m_last_pfn = pfn;
390 ++ if (pfn >= xen_p2m_last_pfn) {
391 ++ xen_p2m_last_pfn = ALIGN(pfn + 1, P2M_PER_PAGE);
392 + HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
393 + }
394 +
395 +diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
396 +index 82044f7323233..00fdd3246ce91 100644
397 +--- a/arch/xtensa/Kconfig
398 ++++ b/arch/xtensa/Kconfig
399 +@@ -17,7 +17,7 @@ config XTENSA
400 + select HAVE_DMA_API_DEBUG
401 + select HAVE_DMA_ATTRS
402 + select HAVE_FUNCTION_TRACER
403 +- select HAVE_FUTEX_CMPXCHG if !MMU
404 ++ select HAVE_FUTEX_CMPXCHG if !MMU && FUTEX
405 + select HAVE_IRQ_TIME_ACCOUNTING
406 + select HAVE_OPROFILE
407 + select HAVE_PERF_EVENTS
408 +diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
409 +index 92d785fefb6d0..5d264ae517f51 100644
410 +--- a/arch/xtensa/platforms/iss/console.c
411 ++++ b/arch/xtensa/platforms/iss/console.c
412 +@@ -186,9 +186,13 @@ static const struct tty_operations serial_ops = {
413 +
414 + int __init rs_init(void)
415 + {
416 +- tty_port_init(&serial_port);
417 ++ int ret;
418 +
419 + serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
420 ++ if (!serial_driver)
421 ++ return -ENOMEM;
422 ++
423 ++ tty_port_init(&serial_port);
424 +
425 + printk ("%s %s\n", serial_name, serial_version);
426 +
427 +@@ -208,8 +212,15 @@ int __init rs_init(void)
428 + tty_set_operations(serial_driver, &serial_ops);
429 + tty_port_link_device(&serial_port, serial_driver, 0);
430 +
431 +- if (tty_register_driver(serial_driver))
432 +- panic("Couldn't register serial driver\n");
433 ++ ret = tty_register_driver(serial_driver);
434 ++ if (ret) {
435 ++ pr_err("Couldn't register serial driver\n");
436 ++ tty_driver_kref_put(serial_driver);
437 ++ tty_port_destroy(&serial_port);
438 ++
439 ++ return ret;
440 ++ }
441 ++
442 + return 0;
443 + }
444 +
445 +diff --git a/certs/Makefile b/certs/Makefile
446 +index 2773c4afa24c0..4417cc5cf5e89 100644
447 +--- a/certs/Makefile
448 ++++ b/certs/Makefile
449 +@@ -39,11 +39,19 @@ endif
450 + redirect_openssl = 2>&1
451 + quiet_redirect_openssl = 2>&1
452 + silent_redirect_openssl = 2>/dev/null
453 ++openssl_available = $(shell openssl help 2>/dev/null && echo yes)
454 +
455 + # We do it this way rather than having a boolean option for enabling an
456 + # external private key, because 'make randconfig' might enable such a
457 + # boolean option and we unfortunately can't make it depend on !RANDCONFIG.
458 + ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
459 ++
460 ++ifeq ($(openssl_available),yes)
461 ++X509TEXT=$(shell openssl x509 -in "certs/signing_key.pem" -text 2>/dev/null)
462 ++
463 ++$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f "certs/signing_key.pem"))
464 ++endif
465 ++
466 + $(obj)/signing_key.pem: $(obj)/x509.genkey
467 + @$(kecho) "###"
468 + @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
469 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
470 +index 8ed3f6d75ff13..8e7ce9bab0db5 100644
471 +--- a/drivers/ata/libata-core.c
472 ++++ b/drivers/ata/libata-core.c
473 +@@ -4269,6 +4269,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
474 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
475 + { "Samsung SSD 850*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
476 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
477 ++ { "Samsung SSD 860*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
478 ++ ATA_HORKAGE_ZERO_AFTER_TRIM, },
479 ++ { "Samsung SSD 870*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
480 ++ ATA_HORKAGE_ZERO_AFTER_TRIM, },
481 + { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM |
482 + ATA_HORKAGE_ZERO_AFTER_TRIM, },
483 +
484 +@@ -6026,7 +6030,7 @@ int ata_host_start(struct ata_host *host)
485 + have_stop = 1;
486 + }
487 +
488 +- if (host->ops->host_stop)
489 ++ if (host->ops && host->ops->host_stop)
490 + have_stop = 1;
491 +
492 + if (have_stop) {
493 +diff --git a/drivers/base/power/wakeirq.c b/drivers/base/power/wakeirq.c
494 +index feba1b2118983..ee63ccaea8d57 100644
495 +--- a/drivers/base/power/wakeirq.c
496 ++++ b/drivers/base/power/wakeirq.c
497 +@@ -319,8 +319,12 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)
498 + if (!wirq)
499 + return;
500 +
501 +- if (device_may_wakeup(wirq->dev))
502 ++ if (device_may_wakeup(wirq->dev)) {
503 ++ if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)
504 ++ enable_irq(wirq->irq);
505 ++
506 + enable_irq_wake(wirq->irq);
507 ++ }
508 + }
509 +
510 + /**
511 +@@ -335,6 +339,10 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
512 + if (!wirq)
513 + return;
514 +
515 +- if (device_may_wakeup(wirq->dev))
516 ++ if (device_may_wakeup(wirq->dev)) {
517 + disable_irq_wake(wirq->irq);
518 ++
519 ++ if (wirq->status & WAKE_IRQ_DEDICATED_ALLOCATED)
520 ++ disable_irq_nosync(wirq->irq);
521 ++ }
522 + }
523 +diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
524 +index 327f9e374b442..30827ab3bb073 100644
525 +--- a/drivers/bcma/main.c
526 ++++ b/drivers/bcma/main.c
527 +@@ -246,6 +246,7 @@ EXPORT_SYMBOL(bcma_core_irq);
528 +
529 + void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core)
530 + {
531 ++ device_initialize(&core->dev);
532 + core->dev.release = bcma_release_core_dev;
533 + core->dev.bus = &bcma_bus_type;
534 + dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index);
535 +@@ -309,11 +310,10 @@ static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core)
536 + {
537 + int err;
538 +
539 +- err = device_register(&core->dev);
540 ++ err = device_add(&core->dev);
541 + if (err) {
542 + bcma_err(bus, "Could not register dev for core 0x%03X\n",
543 + core->id.id);
544 +- put_device(&core->dev);
545 + return;
546 + }
547 + core->dev_registered = true;
548 +@@ -404,7 +404,7 @@ void bcma_unregister_cores(struct bcma_bus *bus)
549 + /* Now noone uses internally-handled cores, we can free them */
550 + list_for_each_entry_safe(core, tmp, &bus->cores, list) {
551 + list_del(&core->list);
552 +- kfree(core);
553 ++ put_device(&core->dev);
554 + }
555 + }
556 +
557 +diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
558 +index c794e215ea3d9..324abc8d53fa9 100644
559 +--- a/drivers/block/Kconfig
560 ++++ b/drivers/block/Kconfig
561 +@@ -267,7 +267,7 @@ config BLK_DEV_LOOP_MIN_COUNT
562 + dynamically allocated with the /dev/loop-control interface.
563 +
564 + config BLK_DEV_CRYPTOLOOP
565 +- tristate "Cryptoloop Support"
566 ++ tristate "Cryptoloop Support (DEPRECATED)"
567 + select CRYPTO
568 + select CRYPTO_CBC
569 + depends on BLK_DEV_LOOP
570 +@@ -279,7 +279,7 @@ config BLK_DEV_CRYPTOLOOP
571 + WARNING: This device is not safe for journaled file systems like
572 + ext3 or Reiserfs. Please use the Device Mapper crypto module
573 + instead, which can be configured to be on-disk compatible with the
574 +- cryptoloop device.
575 ++ cryptoloop device. cryptoloop support will be removed in Linux 5.16.
576 +
577 + source "drivers/block/drbd/Kconfig"
578 +
579 +diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
580 +index 99e773cb70d0b..d3d1f24ca7a3e 100644
581 +--- a/drivers/block/cryptoloop.c
582 ++++ b/drivers/block/cryptoloop.c
583 +@@ -201,6 +201,8 @@ init_cryptoloop(void)
584 +
585 + if (rc)
586 + printk(KERN_ERR "cryptoloop: loop_register_transfer failed\n");
587 ++ else
588 ++ pr_warn("the cryptoloop driver has been deprecated and will be removed in in Linux 5.16\n");
589 + return rc;
590 + }
591 +
592 +diff --git a/drivers/clk/mvebu/kirkwood.c b/drivers/clk/mvebu/kirkwood.c
593 +index 1d2b9a1a96094..53b1d300ed8fc 100644
594 +--- a/drivers/clk/mvebu/kirkwood.c
595 ++++ b/drivers/clk/mvebu/kirkwood.c
596 +@@ -254,6 +254,7 @@ static const char *powersave_parents[] = {
597 + static const struct clk_muxing_soc_desc kirkwood_mux_desc[] __initconst = {
598 + { "powersave", powersave_parents, ARRAY_SIZE(powersave_parents),
599 + 11, 1, 0 },
600 ++ { }
601 + };
602 +
603 + #define to_clk_mux(_hw) container_of(_hw, struct clk_mux, hw)
604 +diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
605 +index 1a8dc76e117e8..b83e8970a2dbb 100644
606 +--- a/drivers/crypto/mxs-dcp.c
607 ++++ b/drivers/crypto/mxs-dcp.c
608 +@@ -167,15 +167,19 @@ static struct dcp *global_sdcp;
609 +
610 + static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
611 + {
612 ++ int dma_err;
613 + struct dcp *sdcp = global_sdcp;
614 + const int chan = actx->chan;
615 + uint32_t stat;
616 + unsigned long ret;
617 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
618 +-
619 + dma_addr_t desc_phys = dma_map_single(sdcp->dev, desc, sizeof(*desc),
620 + DMA_TO_DEVICE);
621 +
622 ++ dma_err = dma_mapping_error(sdcp->dev, desc_phys);
623 ++ if (dma_err)
624 ++ return dma_err;
625 ++
626 + reinit_completion(&sdcp->completion[chan]);
627 +
628 + /* Clear status register. */
629 +@@ -213,18 +217,29 @@ static int mxs_dcp_start_dma(struct dcp_async_ctx *actx)
630 + static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
631 + struct ablkcipher_request *req, int init)
632 + {
633 ++ dma_addr_t key_phys, src_phys, dst_phys;
634 + struct dcp *sdcp = global_sdcp;
635 + struct dcp_dma_desc *desc = &sdcp->coh->desc[actx->chan];
636 + struct dcp_aes_req_ctx *rctx = ablkcipher_request_ctx(req);
637 + int ret;
638 +
639 +- dma_addr_t key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
640 +- 2 * AES_KEYSIZE_128,
641 +- DMA_TO_DEVICE);
642 +- dma_addr_t src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
643 +- DCP_BUF_SZ, DMA_TO_DEVICE);
644 +- dma_addr_t dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
645 +- DCP_BUF_SZ, DMA_FROM_DEVICE);
646 ++ key_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_key,
647 ++ 2 * AES_KEYSIZE_128, DMA_TO_DEVICE);
648 ++ ret = dma_mapping_error(sdcp->dev, key_phys);
649 ++ if (ret)
650 ++ return ret;
651 ++
652 ++ src_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_in_buf,
653 ++ DCP_BUF_SZ, DMA_TO_DEVICE);
654 ++ ret = dma_mapping_error(sdcp->dev, src_phys);
655 ++ if (ret)
656 ++ goto err_src;
657 ++
658 ++ dst_phys = dma_map_single(sdcp->dev, sdcp->coh->aes_out_buf,
659 ++ DCP_BUF_SZ, DMA_FROM_DEVICE);
660 ++ ret = dma_mapping_error(sdcp->dev, dst_phys);
661 ++ if (ret)
662 ++ goto err_dst;
663 +
664 + if (actx->fill % AES_BLOCK_SIZE) {
665 + dev_err(sdcp->dev, "Invalid block size!\n");
666 +@@ -262,10 +277,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,
667 + ret = mxs_dcp_start_dma(actx);
668 +
669 + aes_done_run:
670 ++ dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
671 ++err_dst:
672 ++ dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
673 ++err_src:
674 + dma_unmap_single(sdcp->dev, key_phys, 2 * AES_KEYSIZE_128,
675 + DMA_TO_DEVICE);
676 +- dma_unmap_single(sdcp->dev, src_phys, DCP_BUF_SZ, DMA_TO_DEVICE);
677 +- dma_unmap_single(sdcp->dev, dst_phys, DCP_BUF_SZ, DMA_FROM_DEVICE);
678 +
679 + return ret;
680 + }
681 +@@ -280,21 +297,20 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
682 +
683 + struct scatterlist *dst = req->dst;
684 + struct scatterlist *src = req->src;
685 +- const int nents = sg_nents(req->src);
686 ++ int dst_nents = sg_nents(dst);
687 +
688 + const int out_off = DCP_BUF_SZ;
689 + uint8_t *in_buf = sdcp->coh->aes_in_buf;
690 + uint8_t *out_buf = sdcp->coh->aes_out_buf;
691 +
692 +- uint8_t *out_tmp, *src_buf, *dst_buf = NULL;
693 + uint32_t dst_off = 0;
694 ++ uint8_t *src_buf = NULL;
695 + uint32_t last_out_len = 0;
696 +
697 + uint8_t *key = sdcp->coh->aes_key;
698 +
699 + int ret = 0;
700 +- int split = 0;
701 +- unsigned int i, len, clen, rem = 0, tlen = 0;
702 ++ unsigned int i, len, clen, tlen = 0;
703 + int init = 0;
704 + bool limit_hit = false;
705 +
706 +@@ -312,7 +328,7 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
707 + memset(key + AES_KEYSIZE_128, 0, AES_KEYSIZE_128);
708 + }
709 +
710 +- for_each_sg(req->src, src, nents, i) {
711 ++ for_each_sg(req->src, src, sg_nents(src), i) {
712 + src_buf = sg_virt(src);
713 + len = sg_dma_len(src);
714 + tlen += len;
715 +@@ -337,34 +353,17 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
716 + * submit the buffer.
717 + */
718 + if (actx->fill == out_off || sg_is_last(src) ||
719 +- limit_hit) {
720 ++ limit_hit) {
721 + ret = mxs_dcp_run_aes(actx, req, init);
722 + if (ret)
723 + return ret;
724 + init = 0;
725 +
726 +- out_tmp = out_buf;
727 ++ sg_pcopy_from_buffer(dst, dst_nents, out_buf,
728 ++ actx->fill, dst_off);
729 ++ dst_off += actx->fill;
730 + last_out_len = actx->fill;
731 +- while (dst && actx->fill) {
732 +- if (!split) {
733 +- dst_buf = sg_virt(dst);
734 +- dst_off = 0;
735 +- }
736 +- rem = min(sg_dma_len(dst) - dst_off,
737 +- actx->fill);
738 +-
739 +- memcpy(dst_buf + dst_off, out_tmp, rem);
740 +- out_tmp += rem;
741 +- dst_off += rem;
742 +- actx->fill -= rem;
743 +-
744 +- if (dst_off == sg_dma_len(dst)) {
745 +- dst = sg_next(dst);
746 +- split = 0;
747 +- } else {
748 +- split = 1;
749 +- }
750 +- }
751 ++ actx->fill = 0;
752 + }
753 + } while (len);
754 +
755 +@@ -570,6 +569,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
756 + dma_addr_t buf_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_in_buf,
757 + DCP_BUF_SZ, DMA_TO_DEVICE);
758 +
759 ++ ret = dma_mapping_error(sdcp->dev, buf_phys);
760 ++ if (ret)
761 ++ return ret;
762 ++
763 + /* Fill in the DMA descriptor. */
764 + desc->control0 = MXS_DCP_CONTROL0_DECR_SEMAPHORE |
765 + MXS_DCP_CONTROL0_INTERRUPT |
766 +@@ -602,6 +605,10 @@ static int mxs_dcp_run_sha(struct ahash_request *req)
767 + if (rctx->fini) {
768 + digest_phys = dma_map_single(sdcp->dev, sdcp->coh->sha_out_buf,
769 + DCP_SHA_PAY_SZ, DMA_FROM_DEVICE);
770 ++ ret = dma_mapping_error(sdcp->dev, digest_phys);
771 ++ if (ret)
772 ++ goto done_run;
773 ++
774 + desc->control0 |= MXS_DCP_CONTROL0_HASH_TERM;
775 + desc->payload = digest_phys;
776 + }
777 +diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
778 +index 7e9a44cee4250..be82186a8afba 100644
779 +--- a/drivers/crypto/omap-sham.c
780 ++++ b/drivers/crypto/omap-sham.c
781 +@@ -1630,7 +1630,7 @@ static void omap_sham_done_task(unsigned long data)
782 + goto finish;
783 + }
784 + } else if (test_bit(FLAGS_DMA_READY, &dd->flags)) {
785 +- if (test_and_clear_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
786 ++ if (test_bit(FLAGS_DMA_ACTIVE, &dd->flags)) {
787 + omap_sham_update_dma_stop(dd);
788 + if (dd->err) {
789 + err = dd->err;
790 +diff --git a/drivers/crypto/qat/qat_common/adf_init.c b/drivers/crypto/qat/qat_common/adf_init.c
791 +index d873eeecc363c..06b35edb0d43b 100644
792 +--- a/drivers/crypto/qat/qat_common/adf_init.c
793 ++++ b/drivers/crypto/qat/qat_common/adf_init.c
794 +@@ -121,6 +121,7 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
795 + struct service_hndl *service;
796 + struct list_head *list_itr;
797 + struct adf_hw_device_data *hw_data = accel_dev->hw_device;
798 ++ int ret;
799 +
800 + if (!hw_data) {
801 + dev_err(&GET_DEV(accel_dev),
802 +@@ -187,9 +188,9 @@ int adf_dev_init(struct adf_accel_dev *accel_dev)
803 + }
804 +
805 + hw_data->enable_error_correction(accel_dev);
806 +- hw_data->enable_vf2pf_comms(accel_dev);
807 ++ ret = hw_data->enable_vf2pf_comms(accel_dev);
808 +
809 +- return 0;
810 ++ return ret;
811 + }
812 + EXPORT_SYMBOL_GPL(adf_dev_init);
813 +
814 +diff --git a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
815 +index 5fdbad809343d..711706819b05d 100644
816 +--- a/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
817 ++++ b/drivers/crypto/qat/qat_common/adf_pf2vf_msg.c
818 +@@ -384,6 +384,8 @@ static int adf_vf2pf_request_version(struct adf_accel_dev *accel_dev)
819 + msg |= ADF_PFVF_COMPATIBILITY_VERSION << ADF_VF2PF_COMPAT_VER_REQ_SHIFT;
820 + BUILD_BUG_ON(ADF_PFVF_COMPATIBILITY_VERSION > 255);
821 +
822 ++ reinit_completion(&accel_dev->vf.iov_msg_completion);
823 ++
824 + /* Send request from VF to PF */
825 + ret = adf_iov_putmsg(accel_dev, msg, 0);
826 + if (ret) {
827 +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
828 +index 31a676376d732..3490d300bed23 100644
829 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
830 ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
831 +@@ -340,7 +340,7 @@ static void amdgpu_i2c_put_byte(struct amdgpu_i2c_chan *i2c_bus,
832 + void
833 + amdgpu_i2c_router_select_ddc_port(struct amdgpu_connector *amdgpu_connector)
834 + {
835 +- u8 val;
836 ++ u8 val = 0;
837 +
838 + if (!amdgpu_connector->router.ddc_valid)
839 + return;
840 +diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
841 +index 6edcd6f57e70d..8176614626763 100644
842 +--- a/drivers/gpu/drm/msm/dsi/dsi.c
843 ++++ b/drivers/gpu/drm/msm/dsi/dsi.c
844 +@@ -36,8 +36,10 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
845 + }
846 +
847 + phy_pdev = of_find_device_by_node(phy_node);
848 +- if (phy_pdev)
849 ++ if (phy_pdev) {
850 + msm_dsi->phy = platform_get_drvdata(phy_pdev);
851 ++ msm_dsi->phy_dev = &phy_pdev->dev;
852 ++ }
853 +
854 + of_node_put(phy_node);
855 +
856 +@@ -46,8 +48,6 @@ static int dsi_get_phy(struct msm_dsi *msm_dsi)
857 + return -EPROBE_DEFER;
858 + }
859 +
860 +- msm_dsi->phy_dev = get_device(&phy_pdev->dev);
861 +-
862 + return 0;
863 + }
864 +
865 +diff --git a/drivers/i2c/busses/i2c-highlander.c b/drivers/i2c/busses/i2c-highlander.c
866 +index 56dc69e7349fc..9ad031ea33009 100644
867 +--- a/drivers/i2c/busses/i2c-highlander.c
868 ++++ b/drivers/i2c/busses/i2c-highlander.c
869 +@@ -382,7 +382,7 @@ static int highlander_i2c_probe(struct platform_device *pdev)
870 + platform_set_drvdata(pdev, dev);
871 +
872 + dev->irq = platform_get_irq(pdev, 0);
873 +- if (iic_force_poll)
874 ++ if (dev->irq < 0 || iic_force_poll)
875 + dev->irq = 0;
876 +
877 + if (dev->irq) {
878 +diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
879 +index 72d6161cf77c0..6b9031ccd7679 100644
880 +--- a/drivers/i2c/busses/i2c-iop3xx.c
881 ++++ b/drivers/i2c/busses/i2c-iop3xx.c
882 +@@ -459,16 +459,14 @@ iop3xx_i2c_probe(struct platform_device *pdev)
883 +
884 + irq = platform_get_irq(pdev, 0);
885 + if (irq < 0) {
886 +- ret = -ENXIO;
887 ++ ret = irq;
888 + goto unmap;
889 + }
890 + ret = request_irq(irq, iop3xx_i2c_irq_handler, 0,
891 + pdev->name, adapter_data);
892 +
893 +- if (ret) {
894 +- ret = -EIO;
895 ++ if (ret)
896 + goto unmap;
897 +- }
898 +
899 + memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
900 + new_adapter->owner = THIS_MODULE;
901 +diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
902 +index 9b867169142fd..42a998fa5f791 100644
903 +--- a/drivers/i2c/busses/i2c-mt65xx.c
904 ++++ b/drivers/i2c/busses/i2c-mt65xx.c
905 +@@ -639,7 +639,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
906 + return PTR_ERR(i2c->pdmabase);
907 +
908 + irq = platform_get_irq(pdev, 0);
909 +- if (irq <= 0)
910 ++ if (irq < 0)
911 + return irq;
912 +
913 + init_completion(&i2c->msg_complete);
914 +diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
915 +index bea74aa3f56cb..44af640496bbc 100644
916 +--- a/drivers/i2c/busses/i2c-s3c2410.c
917 ++++ b/drivers/i2c/busses/i2c-s3c2410.c
918 +@@ -1213,7 +1213,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
919 +
920 + if (!(i2c->quirks & QUIRK_POLL)) {
921 + i2c->irq = ret = platform_get_irq(pdev, 0);
922 +- if (ret <= 0) {
923 ++ if (ret < 0) {
924 + dev_err(&pdev->dev, "cannot find IRQ\n");
925 + clk_unprepare(i2c->clk);
926 + return ret;
927 +diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
928 +index 5489ec43b95d7..e5cefdb674f80 100644
929 +--- a/drivers/iio/dac/ad5624r_spi.c
930 ++++ b/drivers/iio/dac/ad5624r_spi.c
931 +@@ -231,7 +231,7 @@ static int ad5624r_probe(struct spi_device *spi)
932 + if (!indio_dev)
933 + return -ENOMEM;
934 + st = iio_priv(indio_dev);
935 +- st->reg = devm_regulator_get(&spi->dev, "vcc");
936 ++ st->reg = devm_regulator_get_optional(&spi->dev, "vref");
937 + if (!IS_ERR(st->reg)) {
938 + ret = regulator_enable(st->reg);
939 + if (ret)
940 +@@ -242,6 +242,22 @@ static int ad5624r_probe(struct spi_device *spi)
941 + goto error_disable_reg;
942 +
943 + voltage_uv = ret;
944 ++ } else {
945 ++ if (PTR_ERR(st->reg) != -ENODEV)
946 ++ return PTR_ERR(st->reg);
947 ++ /* Backwards compatibility. This naming is not correct */
948 ++ st->reg = devm_regulator_get_optional(&spi->dev, "vcc");
949 ++ if (!IS_ERR(st->reg)) {
950 ++ ret = regulator_enable(st->reg);
951 ++ if (ret)
952 ++ return ret;
953 ++
954 ++ ret = regulator_get_voltage(st->reg);
955 ++ if (ret < 0)
956 ++ goto error_disable_reg;
957 ++
958 ++ voltage_uv = ret;
959 ++ }
960 + }
961 +
962 + spi_set_drvdata(spi, indio_dev);
963 +diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
964 +index c3befb3f5dcda..546cd995ab294 100644
965 +--- a/drivers/media/i2c/tc358743.c
966 ++++ b/drivers/media/i2c/tc358743.c
967 +@@ -241,7 +241,7 @@ static void i2c_wr16(struct v4l2_subdev *sd, u16 reg, u16 val)
968 +
969 + static void i2c_wr16_and_or(struct v4l2_subdev *sd, u16 reg, u16 mask, u16 val)
970 + {
971 +- i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 2) & mask) | val, 2);
972 ++ i2c_wrreg(sd, reg, (i2c_rdreg(sd, reg, 1) & mask) | val, 1);
973 + }
974 +
975 + static u32 i2c_rd32(struct v4l2_subdev *sd, u16 reg)
976 +diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
977 +index 63dace8198b0b..b3810b85e7d5f 100644
978 +--- a/drivers/media/rc/rc-loopback.c
979 ++++ b/drivers/media/rc/rc-loopback.c
980 +@@ -55,7 +55,7 @@ static int loop_set_tx_mask(struct rc_dev *dev, u32 mask)
981 +
982 + if ((mask & (RXMASK_REGULAR | RXMASK_LEARNING)) != mask) {
983 + dprintk("invalid tx mask: %u\n", mask);
984 +- return -EINVAL;
985 ++ return 2;
986 + }
987 +
988 + dprintk("setting tx mask: %u\n", mask);
989 +diff --git a/drivers/media/usb/dvb-usb/nova-t-usb2.c b/drivers/media/usb/dvb-usb/nova-t-usb2.c
990 +index 6c55384e2fca8..c570c4af64f30 100644
991 +--- a/drivers/media/usb/dvb-usb/nova-t-usb2.c
992 ++++ b/drivers/media/usb/dvb-usb/nova-t-usb2.c
993 +@@ -122,7 +122,7 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
994 +
995 + static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
996 + {
997 +- int i;
998 ++ int i, ret;
999 + u8 b;
1000 +
1001 + mac[0] = 0x00;
1002 +@@ -131,7 +131,9 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
1003 +
1004 + /* this is a complete guess, but works for my box */
1005 + for (i = 136; i < 139; i++) {
1006 +- dibusb_read_eeprom_byte(d,i, &b);
1007 ++ ret = dibusb_read_eeprom_byte(d, i, &b);
1008 ++ if (ret)
1009 ++ return ret;
1010 +
1011 + mac[5 - (i - 136)] = b;
1012 + }
1013 +diff --git a/drivers/media/usb/dvb-usb/vp702x.c b/drivers/media/usb/dvb-usb/vp702x.c
1014 +index ee1e19e364452..55d515507f0ed 100644
1015 +--- a/drivers/media/usb/dvb-usb/vp702x.c
1016 ++++ b/drivers/media/usb/dvb-usb/vp702x.c
1017 +@@ -294,16 +294,22 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
1018 + static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
1019 + {
1020 + u8 i, *buf;
1021 ++ int ret;
1022 + struct vp702x_device_state *st = d->priv;
1023 +
1024 + mutex_lock(&st->buf_mutex);
1025 + buf = st->buf;
1026 +- for (i = 6; i < 12; i++)
1027 +- vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &buf[i - 6], 1);
1028 ++ for (i = 6; i < 12; i++) {
1029 ++ ret = vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1,
1030 ++ &buf[i - 6], 1);
1031 ++ if (ret < 0)
1032 ++ goto err;
1033 ++ }
1034 +
1035 + memcpy(mac, buf, 6);
1036 ++err:
1037 + mutex_unlock(&st->buf_mutex);
1038 +- return 0;
1039 ++ return ret;
1040 + }
1041 +
1042 + static int vp702x_frontend_attach(struct dvb_usb_adapter *adap)
1043 +diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c
1044 +index ae1cfa792c589..11429bf28c8a4 100644
1045 +--- a/drivers/media/usb/go7007/go7007-driver.c
1046 ++++ b/drivers/media/usb/go7007/go7007-driver.c
1047 +@@ -698,49 +698,23 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board,
1048 + struct device *dev)
1049 + {
1050 + struct go7007 *go;
1051 +- int i;
1052 +
1053 + go = kzalloc(sizeof(struct go7007), GFP_KERNEL);
1054 + if (go == NULL)
1055 + return NULL;
1056 + go->dev = dev;
1057 + go->board_info = board;
1058 +- go->board_id = 0;
1059 + go->tuner_type = -1;
1060 +- go->channel_number = 0;
1061 +- go->name[0] = 0;
1062 + mutex_init(&go->hw_lock);
1063 + init_waitqueue_head(&go->frame_waitq);
1064 + spin_lock_init(&go->spinlock);
1065 + go->status = STATUS_INIT;
1066 +- memset(&go->i2c_adapter, 0, sizeof(go->i2c_adapter));
1067 +- go->i2c_adapter_online = 0;
1068 +- go->interrupt_available = 0;
1069 + init_waitqueue_head(&go->interrupt_waitq);
1070 +- go->input = 0;
1071 + go7007_update_board(go);
1072 +- go->encoder_h_halve = 0;
1073 +- go->encoder_v_halve = 0;
1074 +- go->encoder_subsample = 0;
1075 + go->format = V4L2_PIX_FMT_MJPEG;
1076 + go->bitrate = 1500000;
1077 + go->fps_scale = 1;
1078 +- go->pali = 0;
1079 + go->aspect_ratio = GO7007_RATIO_1_1;
1080 +- go->gop_size = 0;
1081 +- go->ipb = 0;
1082 +- go->closed_gop = 0;
1083 +- go->repeat_seqhead = 0;
1084 +- go->seq_header_enable = 0;
1085 +- go->gop_header_enable = 0;
1086 +- go->dvd_mode = 0;
1087 +- go->interlace_coding = 0;
1088 +- for (i = 0; i < 4; ++i)
1089 +- go->modet[i].enable = 0;
1090 +- for (i = 0; i < 1624; ++i)
1091 +- go->modet_map[i] = 0;
1092 +- go->audio_deliver = NULL;
1093 +- go->audio_enabled = 0;
1094 +
1095 + return go;
1096 + }
1097 +diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
1098 +index 17ee9cde41565..51ac9d067acfa 100644
1099 +--- a/drivers/media/usb/stkwebcam/stk-webcam.c
1100 ++++ b/drivers/media/usb/stkwebcam/stk-webcam.c
1101 +@@ -1353,7 +1353,7 @@ static int stk_camera_probe(struct usb_interface *interface,
1102 + if (!dev->isoc_ep) {
1103 + STK_ERROR("Could not find isoc-in endpoint");
1104 + err = -ENODEV;
1105 +- goto error;
1106 ++ goto error_put;
1107 + }
1108 + dev->vsettings.palette = V4L2_PIX_FMT_RGB565;
1109 + dev->vsettings.mode = MODE_VGA;
1110 +@@ -1366,10 +1366,12 @@ static int stk_camera_probe(struct usb_interface *interface,
1111 +
1112 + err = stk_register_video_device(dev);
1113 + if (err)
1114 +- goto error;
1115 ++ goto error_put;
1116 +
1117 + return 0;
1118 +
1119 ++error_put:
1120 ++ usb_put_intf(interface);
1121 + error:
1122 + v4l2_ctrl_handler_free(hdl);
1123 + v4l2_device_unregister(&dev->v4l2_dev);
1124 +diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
1125 +index 154f5bd45940e..049d664e94f07 100644
1126 +--- a/drivers/media/usb/uvc/uvc_v4l2.c
1127 ++++ b/drivers/media/usb/uvc/uvc_v4l2.c
1128 +@@ -866,8 +866,8 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input)
1129 + {
1130 + struct uvc_fh *handle = fh;
1131 + struct uvc_video_chain *chain = handle->chain;
1132 ++ u8 *buf;
1133 + int ret;
1134 +- u8 i;
1135 +
1136 + if (chain->selector == NULL ||
1137 + (chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) {
1138 +@@ -875,22 +875,27 @@ static int uvc_ioctl_g_input(struct file *file, void *fh, unsigned int *input)
1139 + return 0;
1140 + }
1141 +
1142 ++ buf = kmalloc(1, GFP_KERNEL);
1143 ++ if (!buf)
1144 ++ return -ENOMEM;
1145 ++
1146 + ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, chain->selector->id,
1147 + chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL,
1148 +- &i, 1);
1149 +- if (ret < 0)
1150 +- return ret;
1151 ++ buf, 1);
1152 ++ if (!ret)
1153 ++ *input = *buf - 1;
1154 +
1155 +- *input = i - 1;
1156 +- return 0;
1157 ++ kfree(buf);
1158 ++
1159 ++ return ret;
1160 + }
1161 +
1162 + static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input)
1163 + {
1164 + struct uvc_fh *handle = fh;
1165 + struct uvc_video_chain *chain = handle->chain;
1166 ++ u8 *buf;
1167 + int ret;
1168 +- u32 i;
1169 +
1170 + ret = uvc_acquire_privileges(handle);
1171 + if (ret < 0)
1172 +@@ -906,10 +911,17 @@ static int uvc_ioctl_s_input(struct file *file, void *fh, unsigned int input)
1173 + if (input >= chain->selector->bNrInPins)
1174 + return -EINVAL;
1175 +
1176 +- i = input + 1;
1177 +- return uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id,
1178 +- chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL,
1179 +- &i, 1);
1180 ++ buf = kmalloc(1, GFP_KERNEL);
1181 ++ if (!buf)
1182 ++ return -ENOMEM;
1183 ++
1184 ++ *buf = input + 1;
1185 ++ ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, chain->selector->id,
1186 ++ chain->dev->intfnum, UVC_SU_INPUT_SELECT_CONTROL,
1187 ++ buf, 1);
1188 ++ kfree(buf);
1189 ++
1190 ++ return ret;
1191 + }
1192 +
1193 + static int uvc_ioctl_queryctrl(struct file *file, void *fh,
1194 +diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1195 +index fcc4b4026834c..11325bc70aef3 100644
1196 +--- a/drivers/misc/vmw_vmci/vmci_queue_pair.c
1197 ++++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c
1198 +@@ -2344,7 +2344,8 @@ int vmci_qp_broker_map(struct vmci_handle handle,
1199 + is_local = entry->qp.flags & VMCI_QPFLAG_LOCAL;
1200 + result = VMCI_SUCCESS;
1201 +
1202 +- if (context_id != VMCI_HOST_CONTEXT_ID) {
1203 ++ if (context_id != VMCI_HOST_CONTEXT_ID &&
1204 ++ !QPBROKERSTATE_HAS_MEM(entry)) {
1205 + struct vmci_qp_page_store page_store;
1206 +
1207 + page_store.pages = guest_mem;
1208 +@@ -2454,7 +2455,8 @@ int vmci_qp_broker_unmap(struct vmci_handle handle,
1209 +
1210 + is_local = entry->qp.flags & VMCI_QPFLAG_LOCAL;
1211 +
1212 +- if (context_id != VMCI_HOST_CONTEXT_ID) {
1213 ++ if (context_id != VMCI_HOST_CONTEXT_ID &&
1214 ++ QPBROKERSTATE_HAS_MEM(entry)) {
1215 + qp_acquire_queue_mutex(entry->produce_q);
1216 + result = qp_save_headers(entry);
1217 + if (result < VMCI_SUCCESS)
1218 +diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
1219 +index 9eff3b41a086c..03ac8d5997632 100644
1220 +--- a/drivers/mmc/host/dw_mmc.c
1221 ++++ b/drivers/mmc/host/dw_mmc.c
1222 +@@ -701,6 +701,7 @@ static int dw_mci_edmac_start_dma(struct dw_mci *host,
1223 + int ret = 0;
1224 +
1225 + /* Set external dma config: burst size, burst width */
1226 ++ memset(&cfg, 0, sizeof(cfg));
1227 + cfg.dst_addr = host->phy_regs + fifo_offset;
1228 + cfg.src_addr = cfg.dst_addr;
1229 + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1230 +diff --git a/drivers/mmc/host/moxart-mmc.c b/drivers/mmc/host/moxart-mmc.c
1231 +index bbad309679cf8..41a5493cb68d8 100644
1232 +--- a/drivers/mmc/host/moxart-mmc.c
1233 ++++ b/drivers/mmc/host/moxart-mmc.c
1234 +@@ -633,6 +633,7 @@ static int moxart_probe(struct platform_device *pdev)
1235 + host->dma_chan_tx, host->dma_chan_rx);
1236 + host->have_dma = true;
1237 +
1238 ++ memset(&cfg, 0, sizeof(cfg));
1239 + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1240 + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
1241 +
1242 +diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
1243 +index 93137483ecde9..10ec888338899 100644
1244 +--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
1245 ++++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
1246 +@@ -553,9 +553,22 @@ static int sd_write_long_data(struct realtek_pci_sdmmc *host,
1247 + return 0;
1248 + }
1249 +
1250 ++static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host)
1251 ++{
1252 ++ rtsx_pci_write_register(host->pcr, SD_CFG1,
1253 ++ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128);
1254 ++}
1255 ++
1256 ++static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host)
1257 ++{
1258 ++ rtsx_pci_write_register(host->pcr, SD_CFG1,
1259 ++ SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0);
1260 ++}
1261 ++
1262 + static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq)
1263 + {
1264 + struct mmc_data *data = mrq->data;
1265 ++ int err;
1266 +
1267 + if (host->sg_count < 0) {
1268 + data->error = host->sg_count;
1269 +@@ -564,22 +577,19 @@ static int sd_rw_multi(struct realtek_pci_sdmmc *host, struct mmc_request *mrq)
1270 + return data->error;
1271 + }
1272 +
1273 +- if (data->flags & MMC_DATA_READ)
1274 +- return sd_read_long_data(host, mrq);
1275 ++ if (data->flags & MMC_DATA_READ) {
1276 ++ if (host->initial_mode)
1277 ++ sd_disable_initial_mode(host);
1278 +
1279 +- return sd_write_long_data(host, mrq);
1280 +-}
1281 ++ err = sd_read_long_data(host, mrq);
1282 +
1283 +-static inline void sd_enable_initial_mode(struct realtek_pci_sdmmc *host)
1284 +-{
1285 +- rtsx_pci_write_register(host->pcr, SD_CFG1,
1286 +- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_128);
1287 +-}
1288 ++ if (host->initial_mode)
1289 ++ sd_enable_initial_mode(host);
1290 +
1291 +-static inline void sd_disable_initial_mode(struct realtek_pci_sdmmc *host)
1292 +-{
1293 +- rtsx_pci_write_register(host->pcr, SD_CFG1,
1294 +- SD_CLK_DIVIDE_MASK, SD_CLK_DIVIDE_0);
1295 ++ return err;
1296 ++ }
1297 ++
1298 ++ return sd_write_long_data(host, mrq);
1299 + }
1300 +
1301 + static void sd_normal_rw(struct realtek_pci_sdmmc *host,
1302 +diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
1303 +index 9de78d2a2eb18..10c063d73ee33 100644
1304 +--- a/drivers/mtd/nand/cafe_nand.c
1305 ++++ b/drivers/mtd/nand/cafe_nand.c
1306 +@@ -672,7 +672,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
1307 + "CAFE NAND", mtd);
1308 + if (err) {
1309 + dev_warn(&pdev->dev, "Could not register IRQ %d\n", pdev->irq);
1310 +- goto out_ior;
1311 ++ goto out_free_rs;
1312 + }
1313 +
1314 + /* Disable master reset, enable NAND clock */
1315 +@@ -781,6 +781,8 @@ static int cafe_nand_probe(struct pci_dev *pdev,
1316 + /* Disable NAND IRQ in global IRQ mask register */
1317 + cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
1318 + free_irq(pdev->irq, mtd);
1319 ++ out_free_rs:
1320 ++ free_rs(cafe->rs);
1321 + out_ior:
1322 + pci_iounmap(pdev, cafe->mmio);
1323 + out_free_mtd:
1324 +diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
1325 +index 92c965cb36330..38fae88026639 100644
1326 +--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
1327 ++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
1328 +@@ -1246,7 +1246,7 @@ int bnx2x_iov_init_one(struct bnx2x *bp, int int_mode_param,
1329 +
1330 + /* SR-IOV capability was enabled but there are no VFs*/
1331 + if (iov->total == 0) {
1332 +- err = -EINVAL;
1333 ++ err = 0;
1334 + goto failed;
1335 + }
1336 +
1337 +diff --git a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
1338 +index f5f1b0b51ebd2..79eb2257a30e6 100644
1339 +--- a/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
1340 ++++ b/drivers/net/ethernet/chelsio/cxgb/cxgb2.c
1341 +@@ -1133,6 +1133,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
1342 + if (!adapter->registered_device_map) {
1343 + pr_err("%s: could not register any net devices\n",
1344 + pci_name(pdev));
1345 ++ err = -EINVAL;
1346 + goto out_release_adapter_res;
1347 + }
1348 +
1349 +diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
1350 +index c677b69bbb0b0..22c6eaaf3d9fc 100644
1351 +--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
1352 ++++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
1353 +@@ -1918,6 +1918,7 @@ static void qede_sync_free_irqs(struct qede_dev *edev)
1354 + }
1355 +
1356 + edev->int_info.used_cnt = 0;
1357 ++ edev->int_info.msix_cnt = 0;
1358 + }
1359 +
1360 + static int qede_req_msix_irqs(struct qede_dev *edev)
1361 +@@ -2341,7 +2342,6 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode)
1362 +
1363 + err4:
1364 + qede_sync_free_irqs(edev);
1365 +- memset(&edev->int_info.msix_cnt, 0, sizeof(struct qed_int_info));
1366 + err3:
1367 + qede_napi_disable_remove(edev);
1368 + err2:
1369 +diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
1370 +index be41e4c77b657..eff587c6e9be8 100644
1371 +--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
1372 ++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c
1373 +@@ -440,7 +440,6 @@ int qlcnic_pinit_from_rom(struct qlcnic_adapter *adapter)
1374 + QLCWR32(adapter, QLCNIC_CRB_PEG_NET_4 + 0x3c, 1);
1375 + msleep(20);
1376 +
1377 +- qlcnic_rom_unlock(adapter);
1378 + /* big hammer don't reset CAM block on reset */
1379 + QLCWR32(adapter, QLCNIC_ROMUSB_GLB_SW_RESET, 0xfeffffff);
1380 +
1381 +diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
1382 +index 9a37247cf4b8c..15a4a266824ae 100644
1383 +--- a/drivers/net/ethernet/rdc/r6040.c
1384 ++++ b/drivers/net/ethernet/rdc/r6040.c
1385 +@@ -133,6 +133,8 @@
1386 + #define PHY_ST 0x8A /* PHY status register */
1387 + #define MAC_SM 0xAC /* MAC status machine */
1388 + #define MAC_SM_RST 0x0002 /* MAC status machine reset */
1389 ++#define MD_CSC 0xb6 /* MDC speed control register */
1390 ++#define MD_CSC_DEFAULT 0x0030
1391 + #define MAC_ID 0xBE /* Identifier register */
1392 +
1393 + #define TX_DCNT 0x80 /* TX descriptor count */
1394 +@@ -369,8 +371,9 @@ static void r6040_reset_mac(struct r6040_private *lp)
1395 + {
1396 + void __iomem *ioaddr = lp->base;
1397 + int limit = MAC_DEF_TIMEOUT;
1398 +- u16 cmd;
1399 ++ u16 cmd, md_csc;
1400 +
1401 ++ md_csc = ioread16(ioaddr + MD_CSC);
1402 + iowrite16(MAC_RST, ioaddr + MCR1);
1403 + while (limit--) {
1404 + cmd = ioread16(ioaddr + MCR1);
1405 +@@ -382,6 +385,10 @@ static void r6040_reset_mac(struct r6040_private *lp)
1406 + iowrite16(MAC_SM_RST, ioaddr + MAC_SM);
1407 + iowrite16(0, ioaddr + MAC_SM);
1408 + mdelay(5);
1409 ++
1410 ++ /* Restore MDIO clock frequency */
1411 ++ if (md_csc != MD_CSC_DEFAULT)
1412 ++ iowrite16(md_csc, ioaddr + MD_CSC);
1413 + }
1414 +
1415 + static void r6040_init_mac_regs(struct net_device *dev)
1416 +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
1417 +index 1942264b621bc..73fc8e9683b76 100644
1418 +--- a/drivers/net/ethernet/renesas/sh_eth.c
1419 ++++ b/drivers/net/ethernet/renesas/sh_eth.c
1420 +@@ -2426,6 +2426,7 @@ static int sh_eth_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1421 + else
1422 + txdesc->status |= cpu_to_edmac(mdp, TD_TACT);
1423 +
1424 ++ wmb(); /* cur_tx must be incremented after TACT bit was set */
1425 + mdp->cur_tx++;
1426 +
1427 + if (!(sh_eth_read(ndev, EDTRR) & sh_eth_get_edtrr_trns(mdp)))
1428 +diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
1429 +index 98a1c712b62a7..74092c0eeafd1 100644
1430 +--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
1431 ++++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
1432 +@@ -735,10 +735,8 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
1433 + /* Kick off the transfer */
1434 + lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
1435 +
1436 +- if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1)) {
1437 +- netdev_info(ndev, "%s -> netif_stop_queue\n", __func__);
1438 ++ if (temac_check_tx_bd_space(lp, MAX_SKB_FRAGS + 1))
1439 + netif_stop_queue(ndev);
1440 +- }
1441 +
1442 + return NETDEV_TX_OK;
1443 + }
1444 +diff --git a/drivers/net/phy/dp83640_reg.h b/drivers/net/phy/dp83640_reg.h
1445 +index e7fe411170034..f7ad94773d81e 100644
1446 +--- a/drivers/net/phy/dp83640_reg.h
1447 ++++ b/drivers/net/phy/dp83640_reg.h
1448 +@@ -4,7 +4,7 @@
1449 + #ifndef HAVE_DP83640_REGISTERS
1450 + #define HAVE_DP83640_REGISTERS
1451 +
1452 +-#define PAGE0 0x0000
1453 ++/* #define PAGE0 0x0000 */
1454 + #define PHYCR2 0x001c /* PHY Control Register 2 */
1455 +
1456 + #define PAGE4 0x0004
1457 +diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
1458 +index 65ef483ebf505..3000dd0cb19de 100644
1459 +--- a/drivers/net/wireless/ath/ath.h
1460 ++++ b/drivers/net/wireless/ath/ath.h
1461 +@@ -199,12 +199,13 @@ struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
1462 + bool ath_is_mybeacon(struct ath_common *common, struct ieee80211_hdr *hdr);
1463 +
1464 + void ath_hw_setbssidmask(struct ath_common *common);
1465 +-void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key);
1466 ++void ath_key_delete(struct ath_common *common, u8 hw_key_idx);
1467 + int ath_key_config(struct ath_common *common,
1468 + struct ieee80211_vif *vif,
1469 + struct ieee80211_sta *sta,
1470 + struct ieee80211_key_conf *key);
1471 + bool ath_hw_keyreset(struct ath_common *common, u16 entry);
1472 ++bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac);
1473 + void ath_hw_cycle_counters_update(struct ath_common *common);
1474 + int32_t ath_hw_get_listen_time(struct ath_common *common);
1475 +
1476 +diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
1477 +index 16e052d02c940..0f4836fc3b7c1 100644
1478 +--- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c
1479 ++++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c
1480 +@@ -522,7 +522,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1481 + }
1482 + break;
1483 + case DISABLE_KEY:
1484 +- ath_key_delete(common, key);
1485 ++ ath_key_delete(common, key->hw_key_idx);
1486 + break;
1487 + default:
1488 + ret = -EINVAL;
1489 +diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
1490 +index 7e1010475cfb2..f94d2433a42fe 100644
1491 +--- a/drivers/net/wireless/ath/ath6kl/wmi.c
1492 ++++ b/drivers/net/wireless/ath/ath6kl/wmi.c
1493 +@@ -2508,8 +2508,10 @@ static int ath6kl_wmi_sync_point(struct wmi *wmi, u8 if_idx)
1494 + goto free_data_skb;
1495 +
1496 + for (index = 0; index < num_pri_streams; index++) {
1497 +- if (WARN_ON(!data_sync_bufs[index].skb))
1498 ++ if (WARN_ON(!data_sync_bufs[index].skb)) {
1499 ++ ret = -ENOMEM;
1500 + goto free_data_skb;
1501 ++ }
1502 +
1503 + ep_id = ath6kl_ac2_endpoint_id(wmi->parent_dev,
1504 + data_sync_bufs[index].
1505 +diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
1506 +index c876dc2437b0d..96e1f54cccaf6 100644
1507 +--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
1508 ++++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
1509 +@@ -3345,7 +3345,8 @@ found:
1510 + "Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n",
1511 + cptr, code, reference, length, major, minor);
1512 + if ((!AR_SREV_9485(ah) && length >= 1024) ||
1513 +- (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485)) {
1514 ++ (AR_SREV_9485(ah) && length > EEPROM_DATA_LEN_9485) ||
1515 ++ (length > cptr)) {
1516 + ath_dbg(common, EEPROM, "Skipping bad header\n");
1517 + cptr -= COMP_HDR_LEN;
1518 + continue;
1519 +diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1520 +index e4281438c04fb..2d8537c731b76 100644
1521 +--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1522 ++++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
1523 +@@ -1463,7 +1463,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
1524 + }
1525 + break;
1526 + case DISABLE_KEY:
1527 +- ath_key_delete(common, key);
1528 ++ ath_key_delete(common, key->hw_key_idx);
1529 + break;
1530 + default:
1531 + ret = -EINVAL;
1532 +diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
1533 +index 831a54415a251..52afc1506cf56 100644
1534 +--- a/drivers/net/wireless/ath/ath9k/hw.h
1535 ++++ b/drivers/net/wireless/ath/ath9k/hw.h
1536 +@@ -814,6 +814,7 @@ struct ath_hw {
1537 + struct ath9k_pacal_info pacal_info;
1538 + struct ar5416Stats stats;
1539 + struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES];
1540 ++ DECLARE_BITMAP(pending_del_keymap, ATH_KEYMAX);
1541 +
1542 + enum ath9k_int imask;
1543 + u32 imrs2_reg;
1544 +diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
1545 +index f09168a885a5f..298c7957dd160 100644
1546 +--- a/drivers/net/wireless/ath/ath9k/main.c
1547 ++++ b/drivers/net/wireless/ath/ath9k/main.c
1548 +@@ -819,12 +819,80 @@ exit:
1549 + ieee80211_free_txskb(hw, skb);
1550 + }
1551 +
1552 ++static bool ath9k_txq_list_has_key(struct list_head *txq_list, u32 keyix)
1553 ++{
1554 ++ struct ath_buf *bf;
1555 ++ struct ieee80211_tx_info *txinfo;
1556 ++ struct ath_frame_info *fi;
1557 ++
1558 ++ list_for_each_entry(bf, txq_list, list) {
1559 ++ if (bf->bf_state.stale || !bf->bf_mpdu)
1560 ++ continue;
1561 ++
1562 ++ txinfo = IEEE80211_SKB_CB(bf->bf_mpdu);
1563 ++ fi = (struct ath_frame_info *)&txinfo->rate_driver_data[0];
1564 ++ if (fi->keyix == keyix)
1565 ++ return true;
1566 ++ }
1567 ++
1568 ++ return false;
1569 ++}
1570 ++
1571 ++static bool ath9k_txq_has_key(struct ath_softc *sc, u32 keyix)
1572 ++{
1573 ++ struct ath_hw *ah = sc->sc_ah;
1574 ++ int i;
1575 ++ struct ath_txq *txq;
1576 ++ bool key_in_use = false;
1577 ++
1578 ++ for (i = 0; !key_in_use && i < ATH9K_NUM_TX_QUEUES; i++) {
1579 ++ if (!ATH_TXQ_SETUP(sc, i))
1580 ++ continue;
1581 ++ txq = &sc->tx.txq[i];
1582 ++ if (!txq->axq_depth)
1583 ++ continue;
1584 ++ if (!ath9k_hw_numtxpending(ah, txq->axq_qnum))
1585 ++ continue;
1586 ++
1587 ++ ath_txq_lock(sc, txq);
1588 ++ key_in_use = ath9k_txq_list_has_key(&txq->axq_q, keyix);
1589 ++ if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
1590 ++ int idx = txq->txq_tailidx;
1591 ++
1592 ++ while (!key_in_use &&
1593 ++ !list_empty(&txq->txq_fifo[idx])) {
1594 ++ key_in_use = ath9k_txq_list_has_key(
1595 ++ &txq->txq_fifo[idx], keyix);
1596 ++ INCR(idx, ATH_TXFIFO_DEPTH);
1597 ++ }
1598 ++ }
1599 ++ ath_txq_unlock(sc, txq);
1600 ++ }
1601 ++
1602 ++ return key_in_use;
1603 ++}
1604 ++
1605 ++static void ath9k_pending_key_del(struct ath_softc *sc, u8 keyix)
1606 ++{
1607 ++ struct ath_hw *ah = sc->sc_ah;
1608 ++ struct ath_common *common = ath9k_hw_common(ah);
1609 ++
1610 ++ if (!test_bit(keyix, ah->pending_del_keymap) ||
1611 ++ ath9k_txq_has_key(sc, keyix))
1612 ++ return;
1613 ++
1614 ++ /* No more TXQ frames point to this key cache entry, so delete it. */
1615 ++ clear_bit(keyix, ah->pending_del_keymap);
1616 ++ ath_key_delete(common, keyix);
1617 ++}
1618 ++
1619 + static void ath9k_stop(struct ieee80211_hw *hw)
1620 + {
1621 + struct ath_softc *sc = hw->priv;
1622 + struct ath_hw *ah = sc->sc_ah;
1623 + struct ath_common *common = ath9k_hw_common(ah);
1624 + bool prev_idle;
1625 ++ int i;
1626 +
1627 + ath9k_deinit_channel_context(sc);
1628 +
1629 +@@ -890,6 +958,14 @@ static void ath9k_stop(struct ieee80211_hw *hw)
1630 +
1631 + spin_unlock_bh(&sc->sc_pcu_lock);
1632 +
1633 ++ for (i = 0; i < ATH_KEYMAX; i++)
1634 ++ ath9k_pending_key_del(sc, i);
1635 ++
1636 ++ /* Clear key cache entries explicitly to get rid of any potentially
1637 ++ * remaining keys.
1638 ++ */
1639 ++ ath9k_cmn_init_crypto(sc->sc_ah);
1640 ++
1641 + ath9k_ps_restore(sc);
1642 +
1643 + sc->ps_idle = prev_idle;
1644 +@@ -1521,12 +1597,11 @@ static void ath9k_del_ps_key(struct ath_softc *sc,
1645 + {
1646 + struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1647 + struct ath_node *an = (struct ath_node *) sta->drv_priv;
1648 +- struct ieee80211_key_conf ps_key = { .hw_key_idx = an->ps_key };
1649 +
1650 + if (!an->ps_key)
1651 + return;
1652 +
1653 +- ath_key_delete(common, &ps_key);
1654 ++ ath_key_delete(common, an->ps_key);
1655 + an->ps_key = 0;
1656 + an->key_idx[0] = 0;
1657 + }
1658 +@@ -1688,6 +1763,12 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
1659 + if (sta)
1660 + an = (struct ath_node *)sta->drv_priv;
1661 +
1662 ++ /* Delete pending key cache entries if no more frames are pointing to
1663 ++ * them in TXQs.
1664 ++ */
1665 ++ for (i = 0; i < ATH_KEYMAX; i++)
1666 ++ ath9k_pending_key_del(sc, i);
1667 ++
1668 + switch (cmd) {
1669 + case SET_KEY:
1670 + if (sta)
1671 +@@ -1717,7 +1798,15 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
1672 + }
1673 + break;
1674 + case DISABLE_KEY:
1675 +- ath_key_delete(common, key);
1676 ++ if (ath9k_txq_has_key(sc, key->hw_key_idx)) {
1677 ++ /* Delay key cache entry deletion until there are no
1678 ++ * remaining TXQ frames pointing to this entry.
1679 ++ */
1680 ++ set_bit(key->hw_key_idx, sc->sc_ah->pending_del_keymap);
1681 ++ ath_hw_keysetmac(common, key->hw_key_idx, NULL);
1682 ++ } else {
1683 ++ ath_key_delete(common, key->hw_key_idx);
1684 ++ }
1685 + if (an) {
1686 + for (i = 0; i < ARRAY_SIZE(an->key_idx); i++) {
1687 + if (an->key_idx[i] != key->hw_key_idx)
1688 +diff --git a/drivers/net/wireless/ath/key.c b/drivers/net/wireless/ath/key.c
1689 +index 1816b4e7dc264..61b59a804e308 100644
1690 +--- a/drivers/net/wireless/ath/key.c
1691 ++++ b/drivers/net/wireless/ath/key.c
1692 +@@ -84,8 +84,7 @@ bool ath_hw_keyreset(struct ath_common *common, u16 entry)
1693 + }
1694 + EXPORT_SYMBOL(ath_hw_keyreset);
1695 +
1696 +-static bool ath_hw_keysetmac(struct ath_common *common,
1697 +- u16 entry, const u8 *mac)
1698 ++bool ath_hw_keysetmac(struct ath_common *common, u16 entry, const u8 *mac)
1699 + {
1700 + u32 macHi, macLo;
1701 + u32 unicast_flag = AR_KEYTABLE_VALID;
1702 +@@ -125,6 +124,7 @@ static bool ath_hw_keysetmac(struct ath_common *common,
1703 +
1704 + return true;
1705 + }
1706 ++EXPORT_SYMBOL(ath_hw_keysetmac);
1707 +
1708 + static bool ath_hw_set_keycache_entry(struct ath_common *common, u16 entry,
1709 + const struct ath_keyval *k,
1710 +@@ -581,29 +581,38 @@ EXPORT_SYMBOL(ath_key_config);
1711 + /*
1712 + * Delete Key.
1713 + */
1714 +-void ath_key_delete(struct ath_common *common, struct ieee80211_key_conf *key)
1715 ++void ath_key_delete(struct ath_common *common, u8 hw_key_idx)
1716 + {
1717 +- ath_hw_keyreset(common, key->hw_key_idx);
1718 +- if (key->hw_key_idx < IEEE80211_WEP_NKID)
1719 ++ /* Leave CCMP and TKIP (main key) configured to avoid disabling
1720 ++ * encryption for potentially pending frames already in a TXQ with the
1721 ++ * keyix pointing to this key entry. Instead, only clear the MAC address
1722 ++ * to prevent RX processing from using this key cache entry.
1723 ++ */
1724 ++ if (test_bit(hw_key_idx, common->ccmp_keymap) ||
1725 ++ test_bit(hw_key_idx, common->tkip_keymap))
1726 ++ ath_hw_keysetmac(common, hw_key_idx, NULL);
1727 ++ else
1728 ++ ath_hw_keyreset(common, hw_key_idx);
1729 ++ if (hw_key_idx < IEEE80211_WEP_NKID)
1730 + return;
1731 +
1732 +- clear_bit(key->hw_key_idx, common->keymap);
1733 +- clear_bit(key->hw_key_idx, common->ccmp_keymap);
1734 +- if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
1735 ++ clear_bit(hw_key_idx, common->keymap);
1736 ++ clear_bit(hw_key_idx, common->ccmp_keymap);
1737 ++ if (!test_bit(hw_key_idx, common->tkip_keymap))
1738 + return;
1739 +
1740 +- clear_bit(key->hw_key_idx + 64, common->keymap);
1741 ++ clear_bit(hw_key_idx + 64, common->keymap);
1742 +
1743 +- clear_bit(key->hw_key_idx, common->tkip_keymap);
1744 +- clear_bit(key->hw_key_idx + 64, common->tkip_keymap);
1745 ++ clear_bit(hw_key_idx, common->tkip_keymap);
1746 ++ clear_bit(hw_key_idx + 64, common->tkip_keymap);
1747 +
1748 + if (!(common->crypt_caps & ATH_CRYPT_CAP_MIC_COMBINED)) {
1749 +- ath_hw_keyreset(common, key->hw_key_idx + 32);
1750 +- clear_bit(key->hw_key_idx + 32, common->keymap);
1751 +- clear_bit(key->hw_key_idx + 64 + 32, common->keymap);
1752 ++ ath_hw_keyreset(common, hw_key_idx + 32);
1753 ++ clear_bit(hw_key_idx + 32, common->keymap);
1754 ++ clear_bit(hw_key_idx + 64 + 32, common->keymap);
1755 +
1756 +- clear_bit(key->hw_key_idx + 32, common->tkip_keymap);
1757 +- clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap);
1758 ++ clear_bit(hw_key_idx + 32, common->tkip_keymap);
1759 ++ clear_bit(hw_key_idx + 64 + 32, common->tkip_keymap);
1760 + }
1761 + }
1762 + EXPORT_SYMBOL(ath_key_delete);
1763 +diff --git a/drivers/parport/ieee1284_ops.c b/drivers/parport/ieee1284_ops.c
1764 +index 2e21af43d91ea..b6d808037045d 100644
1765 +--- a/drivers/parport/ieee1284_ops.c
1766 ++++ b/drivers/parport/ieee1284_ops.c
1767 +@@ -534,7 +534,7 @@ size_t parport_ieee1284_ecp_read_data (struct parport *port,
1768 + goto out;
1769 +
1770 + /* Yield the port for a while. */
1771 +- if (count && dev->port->irq != PARPORT_IRQ_NONE) {
1772 ++ if (dev->port->irq != PARPORT_IRQ_NONE) {
1773 + parport_release (dev);
1774 + schedule_timeout_interruptible(msecs_to_jiffies(40));
1775 + parport_claim_or_block (dev);
1776 +diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
1777 +index e9c98f1576dd4..a635af3b9076c 100644
1778 +--- a/drivers/pci/msi.c
1779 ++++ b/drivers/pci/msi.c
1780 +@@ -748,6 +748,9 @@ static void msix_mask_all(void __iomem *base, int tsize)
1781 + u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT;
1782 + int i;
1783 +
1784 ++ if (pci_msi_ignore_mask)
1785 ++ return;
1786 ++
1787 + for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE)
1788 + writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL);
1789 + }
1790 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
1791 +index b7f65fc54dc2c..21ad9fea78780 100644
1792 +--- a/drivers/pci/pci.c
1793 ++++ b/drivers/pci/pci.c
1794 +@@ -1334,11 +1334,7 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
1795 + * so that things like MSI message writing will behave as expected
1796 + * (e.g. if the device really is in D0 at enable time).
1797 + */
1798 +- if (dev->pm_cap) {
1799 +- u16 pmcsr;
1800 +- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
1801 +- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
1802 +- }
1803 ++ pci_update_current_state(dev, dev->current_state);
1804 +
1805 + if (atomic_inc_return(&dev->enable_cnt) > 1)
1806 + return 0; /* already enabled */
1807 +@@ -1876,7 +1872,14 @@ int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1808 + if (enable) {
1809 + int error;
1810 +
1811 +- if (pci_pme_capable(dev, state))
1812 ++ /*
1813 ++ * Enable PME signaling if the device can signal PME from
1814 ++ * D3cold regardless of whether or not it can signal PME from
1815 ++ * the current target state, because that will allow it to
1816 ++ * signal PME when the hierarchy above it goes into D3cold and
1817 ++ * the device itself ends up in D3cold as a result of that.
1818 ++ */
1819 ++ if (pci_pme_capable(dev, state) || pci_pme_capable(dev, PCI_D3cold))
1820 + pci_pme_active(dev, true);
1821 + else
1822 + ret = 1;
1823 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
1824 +index e65eec0644a76..f8f0849b9cdcb 100644
1825 +--- a/drivers/pci/quirks.c
1826 ++++ b/drivers/pci/quirks.c
1827 +@@ -2915,12 +2915,13 @@ static void fixup_mpss_256(struct pci_dev *dev)
1828 + {
1829 + dev->pcie_mpss = 1; /* 256 bytes */
1830 + }
1831 +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
1832 +- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256);
1833 +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
1834 +- PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256);
1835 +-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SOLARFLARE,
1836 +- PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256);
1837 ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
1838 ++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_0, fixup_mpss_256);
1839 ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
1840 ++ PCI_DEVICE_ID_SOLARFLARE_SFC4000A_1, fixup_mpss_256);
1841 ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SOLARFLARE,
1842 ++ PCI_DEVICE_ID_SOLARFLARE_SFC4000B, fixup_mpss_256);
1843 ++DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ASMEDIA, 0x0612, fixup_mpss_256);
1844 +
1845 + /* Intel 5000 and 5100 Memory controllers have an errata with read completion
1846 + * coalescing (which is enabled by default on some BIOSes) and MPS of 256B.
1847 +diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c
1848 +index 7958250856d36..f602176eb8b04 100644
1849 +--- a/drivers/pci/syscall.c
1850 ++++ b/drivers/pci/syscall.c
1851 +@@ -23,8 +23,10 @@ SYSCALL_DEFINE5(pciconfig_read, unsigned long, bus, unsigned long, dfn,
1852 + long err;
1853 + int cfg_ret;
1854 +
1855 ++ err = -EPERM;
1856 ++ dev = NULL;
1857 + if (!capable(CAP_SYS_ADMIN))
1858 +- return -EPERM;
1859 ++ goto error;
1860 +
1861 + err = -ENODEV;
1862 + dev = pci_get_bus_and_slot(bus, dfn);
1863 +diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
1864 +index 17714793c08e4..9c6afaebc9cf8 100644
1865 +--- a/drivers/pinctrl/pinctrl-single.c
1866 ++++ b/drivers/pinctrl/pinctrl-single.c
1867 +@@ -1328,6 +1328,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
1868 +
1869 + if (PCS_HAS_PINCONF) {
1870 + dev_err(pcs->dev, "pinconf not supported\n");
1871 ++ res = -ENOTSUPP;
1872 + goto free_pingroups;
1873 + }
1874 +
1875 +diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
1876 +index d20190c8f0c06..db2cd5994c2d8 100644
1877 +--- a/drivers/platform/chrome/cros_ec_proto.c
1878 ++++ b/drivers/platform/chrome/cros_ec_proto.c
1879 +@@ -182,6 +182,15 @@ static int cros_ec_host_command_proto_query(struct cros_ec_device *ec_dev,
1880 + msg->insize = sizeof(struct ec_response_get_protocol_info);
1881 +
1882 + ret = send_command(ec_dev, msg);
1883 ++ /*
1884 ++ * Send command once again when timeout occurred.
1885 ++ * Fingerprint MCU (FPMCU) is restarted during system boot which
1886 ++ * introduces small window in which FPMCU won't respond for any
1887 ++ * messages sent by kernel. There is no need to wait before next
1888 ++ * attempt because we waited at least EC_MSG_DEADLINE_MS.
1889 ++ */
1890 ++ if (ret == -ETIMEDOUT)
1891 ++ ret = send_command(ec_dev, msg);
1892 +
1893 + if (ret < 0) {
1894 + dev_dbg(ec_dev->dev,
1895 +diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
1896 +index da7a75f824891..f18d845b3b92d 100644
1897 +--- a/drivers/power/max17042_battery.c
1898 ++++ b/drivers/power/max17042_battery.c
1899 +@@ -644,7 +644,7 @@ static inline void max17042_override_por_values(struct max17042_chip *chip)
1900 + struct max17042_config_data *config = chip->pdata->config_data;
1901 +
1902 + max17042_override_por(map, MAX17042_TGAIN, config->tgain);
1903 +- max17042_override_por(map, MAx17042_TOFF, config->toff);
1904 ++ max17042_override_por(map, MAX17042_TOFF, config->toff);
1905 + max17042_override_por(map, MAX17042_CGAIN, config->cgain);
1906 + max17042_override_por(map, MAX17042_COFF, config->coff);
1907 +
1908 +@@ -760,8 +760,12 @@ static irqreturn_t max17042_thread_handler(int id, void *dev)
1909 + {
1910 + struct max17042_chip *chip = dev;
1911 + u32 val;
1912 ++ int ret;
1913 ++
1914 ++ ret = regmap_read(chip->regmap, MAX17042_STATUS, &val);
1915 ++ if (ret)
1916 ++ return IRQ_HANDLED;
1917 +
1918 +- regmap_read(chip->regmap, MAX17042_STATUS, &val);
1919 + if ((val & STATUS_INTR_SOCMIN_BIT) ||
1920 + (val & STATUS_INTR_SOCMAX_BIT)) {
1921 + dev_info(&chip->client->dev, "SOC threshold INTR\n");
1922 +diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
1923 +index f42aa2b2dcba5..f78360d99fb9d 100644
1924 +--- a/drivers/rtc/rtc-tps65910.c
1925 ++++ b/drivers/rtc/rtc-tps65910.c
1926 +@@ -332,6 +332,6 @@ static struct platform_driver tps65910_rtc_driver = {
1927 + };
1928 +
1929 + module_platform_driver(tps65910_rtc_driver);
1930 +-MODULE_ALIAS("platform:rtc-tps65910");
1931 ++MODULE_ALIAS("platform:tps65910-rtc");
1932 + MODULE_AUTHOR("Venu Byravarasu <vbyravarasu@××××××.com>");
1933 + MODULE_LICENSE("GPL");
1934 +diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c
1935 +index a75146f600cb7..3e29f5f0d4cae 100644
1936 +--- a/drivers/tty/hvc/hvsi.c
1937 ++++ b/drivers/tty/hvc/hvsi.c
1938 +@@ -1051,7 +1051,7 @@ static const struct tty_operations hvsi_ops = {
1939 +
1940 + static int __init hvsi_init(void)
1941 + {
1942 +- int i;
1943 ++ int i, ret;
1944 +
1945 + hvsi_driver = alloc_tty_driver(hvsi_count);
1946 + if (!hvsi_driver)
1947 +@@ -1082,12 +1082,25 @@ static int __init hvsi_init(void)
1948 + }
1949 + hvsi_wait = wait_for_state; /* irqs active now */
1950 +
1951 +- if (tty_register_driver(hvsi_driver))
1952 +- panic("Couldn't register hvsi console driver\n");
1953 ++ ret = tty_register_driver(hvsi_driver);
1954 ++ if (ret) {
1955 ++ pr_err("Couldn't register hvsi console driver\n");
1956 ++ goto err_free_irq;
1957 ++ }
1958 +
1959 + printk(KERN_DEBUG "HVSI: registered %i devices\n", hvsi_count);
1960 +
1961 + return 0;
1962 ++err_free_irq:
1963 ++ hvsi_wait = poll_for_state;
1964 ++ for (i = 0; i < hvsi_count; i++) {
1965 ++ struct hvsi_struct *hp = &hvsi_ports[i];
1966 ++
1967 ++ free_irq(hp->virq, hp);
1968 ++ }
1969 ++ tty_driver_kref_put(hvsi_driver);
1970 ++
1971 ++ return ret;
1972 + }
1973 + device_initcall(hvsi_init);
1974 +
1975 +diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1976 +index 72f6cde146b5c..db66e533319ea 100644
1977 +--- a/drivers/tty/serial/8250/8250_pci.c
1978 ++++ b/drivers/tty/serial/8250/8250_pci.c
1979 +@@ -78,7 +78,7 @@ static void moan_device(const char *str, struct pci_dev *dev)
1980 +
1981 + static int
1982 + setup_port(struct serial_private *priv, struct uart_8250_port *port,
1983 +- int bar, int offset, int regshift)
1984 ++ u8 bar, unsigned int offset, int regshift)
1985 + {
1986 + struct pci_dev *dev = priv->dev;
1987 +
1988 +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
1989 +index 041bfe1d41911..d0d90752f9f3d 100644
1990 +--- a/drivers/tty/serial/8250/8250_port.c
1991 ++++ b/drivers/tty/serial/8250/8250_port.c
1992 +@@ -124,7 +124,8 @@ static const struct serial8250_config uart_config[] = {
1993 + .name = "16C950/954",
1994 + .fifo_size = 128,
1995 + .tx_loadsz = 128,
1996 +- .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
1997 ++ .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_01,
1998 ++ .rxtrig_bytes = {16, 32, 112, 120},
1999 + /* UART_CAP_EFR breaks billionon CF bluetooth card. */
2000 + .flags = UART_CAP_FIFO | UART_CAP_SLEEP,
2001 + },
2002 +diff --git a/drivers/tty/serial/jsm/jsm_neo.c b/drivers/tty/serial/jsm/jsm_neo.c
2003 +index 932b2accd06f7..4ed0c099c7574 100644
2004 +--- a/drivers/tty/serial/jsm/jsm_neo.c
2005 ++++ b/drivers/tty/serial/jsm/jsm_neo.c
2006 +@@ -827,7 +827,9 @@ static inline void neo_parse_isr(struct jsm_board *brd, u32 port)
2007 + /* Parse any modem signal changes */
2008 + jsm_dbg(INTR, &ch->ch_bd->pci_dev,
2009 + "MOD_STAT: sending to parse_modem_sigs\n");
2010 ++ spin_lock_irqsave(&ch->uart_port.lock, lock_flags);
2011 + neo_parse_modem(ch, readb(&ch->ch_neo_uart->msr));
2012 ++ spin_unlock_irqrestore(&ch->uart_port.lock, lock_flags);
2013 + }
2014 + }
2015 +
2016 +diff --git a/drivers/tty/serial/jsm/jsm_tty.c b/drivers/tty/serial/jsm/jsm_tty.c
2017 +index 524e86ab3cae7..dad3abab82805 100644
2018 +--- a/drivers/tty/serial/jsm/jsm_tty.c
2019 ++++ b/drivers/tty/serial/jsm/jsm_tty.c
2020 +@@ -195,6 +195,7 @@ static void jsm_tty_break(struct uart_port *port, int break_state)
2021 +
2022 + static int jsm_tty_open(struct uart_port *port)
2023 + {
2024 ++ unsigned long lock_flags;
2025 + struct jsm_board *brd;
2026 + struct jsm_channel *channel =
2027 + container_of(port, struct jsm_channel, uart_port);
2028 +@@ -248,6 +249,7 @@ static int jsm_tty_open(struct uart_port *port)
2029 + channel->ch_cached_lsr = 0;
2030 + channel->ch_stops_sent = 0;
2031 +
2032 ++ spin_lock_irqsave(&port->lock, lock_flags);
2033 + termios = &port->state->port.tty->termios;
2034 + channel->ch_c_cflag = termios->c_cflag;
2035 + channel->ch_c_iflag = termios->c_iflag;
2036 +@@ -267,6 +269,7 @@ static int jsm_tty_open(struct uart_port *port)
2037 + jsm_carrier(channel);
2038 +
2039 + channel->ch_open_count++;
2040 ++ spin_unlock_irqrestore(&port->lock, lock_flags);
2041 +
2042 + jsm_dbg(OPEN, &channel->ch_bd->pci_dev, "finish\n");
2043 + return 0;
2044 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
2045 +index bdb25b23e8d3a..c896b4e98aaa2 100644
2046 +--- a/drivers/tty/tty_io.c
2047 ++++ b/drivers/tty/tty_io.c
2048 +@@ -2287,8 +2287,6 @@ static int tty_fasync(int fd, struct file *filp, int on)
2049 + * Locking:
2050 + * Called functions take tty_ldiscs_lock
2051 + * current->signal->tty check is safe without locks
2052 +- *
2053 +- * FIXME: may race normal receive processing
2054 + */
2055 +
2056 + static int tiocsti(struct tty_struct *tty, char __user *p)
2057 +@@ -2302,8 +2300,10 @@ static int tiocsti(struct tty_struct *tty, char __user *p)
2058 + return -EFAULT;
2059 + tty_audit_tiocsti(tty, ch);
2060 + ld = tty_ldisc_ref_wait(tty);
2061 ++ tty_buffer_lock_exclusive(tty->port);
2062 + if (ld->ops->receive_buf)
2063 + ld->ops->receive_buf(tty, &ch, &mbz, 1);
2064 ++ tty_buffer_unlock_exclusive(tty->port);
2065 + tty_ldisc_deref(ld);
2066 + return 0;
2067 + }
2068 +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
2069 +index 46c50135ef9f7..4bc95ac3d4485 100644
2070 +--- a/drivers/usb/gadget/function/u_ether.c
2071 ++++ b/drivers/usb/gadget/function/u_ether.c
2072 +@@ -507,8 +507,9 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
2073 + }
2074 + spin_unlock_irqrestore(&dev->lock, flags);
2075 +
2076 +- if (skb && !in) {
2077 +- dev_kfree_skb_any(skb);
2078 ++ if (!in) {
2079 ++ if (skb)
2080 ++ dev_kfree_skb_any(skb);
2081 + return NETDEV_TX_OK;
2082 + }
2083 +
2084 +diff --git a/drivers/usb/gadget/udc/at91_udc.c b/drivers/usb/gadget/udc/at91_udc.c
2085 +index d0d18947f58bf..2da281a743b87 100644
2086 +--- a/drivers/usb/gadget/udc/at91_udc.c
2087 ++++ b/drivers/usb/gadget/udc/at91_udc.c
2088 +@@ -1898,7 +1898,9 @@ static int at91udc_probe(struct platform_device *pdev)
2089 + clk_disable(udc->iclk);
2090 +
2091 + /* request UDC and maybe VBUS irqs */
2092 +- udc->udp_irq = platform_get_irq(pdev, 0);
2093 ++ udc->udp_irq = retval = platform_get_irq(pdev, 0);
2094 ++ if (retval < 0)
2095 ++ goto err_unprepare_iclk;
2096 + retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0,
2097 + driver_name, udc);
2098 + if (retval) {
2099 +diff --git a/drivers/usb/gadget/udc/mv_u3d_core.c b/drivers/usb/gadget/udc/mv_u3d_core.c
2100 +index dafe74eb9adec..9ee4a2605dea9 100644
2101 +--- a/drivers/usb/gadget/udc/mv_u3d_core.c
2102 ++++ b/drivers/usb/gadget/udc/mv_u3d_core.c
2103 +@@ -1929,14 +1929,6 @@ static int mv_u3d_probe(struct platform_device *dev)
2104 + goto err_get_irq;
2105 + }
2106 + u3d->irq = r->start;
2107 +- if (request_irq(u3d->irq, mv_u3d_irq,
2108 +- IRQF_SHARED, driver_name, u3d)) {
2109 +- u3d->irq = 0;
2110 +- dev_err(&dev->dev, "Request irq %d for u3d failed\n",
2111 +- u3d->irq);
2112 +- retval = -ENODEV;
2113 +- goto err_request_irq;
2114 +- }
2115 +
2116 + /* initialize gadget structure */
2117 + u3d->gadget.ops = &mv_u3d_ops; /* usb_gadget_ops */
2118 +@@ -1949,6 +1941,15 @@ static int mv_u3d_probe(struct platform_device *dev)
2119 +
2120 + mv_u3d_eps_init(u3d);
2121 +
2122 ++ if (request_irq(u3d->irq, mv_u3d_irq,
2123 ++ IRQF_SHARED, driver_name, u3d)) {
2124 ++ u3d->irq = 0;
2125 ++ dev_err(&dev->dev, "Request irq %d for u3d failed\n",
2126 ++ u3d->irq);
2127 ++ retval = -ENODEV;
2128 ++ goto err_request_irq;
2129 ++ }
2130 ++
2131 + /* external vbus detection */
2132 + if (u3d->vbus) {
2133 + u3d->clock_gating = 1;
2134 +@@ -1972,8 +1973,8 @@ static int mv_u3d_probe(struct platform_device *dev)
2135 +
2136 + err_unregister:
2137 + free_irq(u3d->irq, u3d);
2138 +-err_request_irq:
2139 + err_get_irq:
2140 ++err_request_irq:
2141 + kfree(u3d->status_req);
2142 + err_alloc_status_req:
2143 + kfree(u3d->eps);
2144 +diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
2145 +index ee8d5faa01947..3eecf47d4e89b 100644
2146 +--- a/drivers/usb/host/ehci-orion.c
2147 ++++ b/drivers/usb/host/ehci-orion.c
2148 +@@ -218,8 +218,11 @@ static int ehci_orion_drv_probe(struct platform_device *pdev)
2149 + * the clock does not exists.
2150 + */
2151 + priv->clk = devm_clk_get(&pdev->dev, NULL);
2152 +- if (!IS_ERR(priv->clk))
2153 +- clk_prepare_enable(priv->clk);
2154 ++ if (!IS_ERR(priv->clk)) {
2155 ++ err = clk_prepare_enable(priv->clk);
2156 ++ if (err)
2157 ++ goto err_put_hcd;
2158 ++ }
2159 +
2160 + priv->phy = devm_phy_optional_get(&pdev->dev, "usb");
2161 + if (IS_ERR(priv->phy)) {
2162 +@@ -280,6 +283,7 @@ err_phy_init:
2163 + err_phy_get:
2164 + if (!IS_ERR(priv->clk))
2165 + clk_disable_unprepare(priv->clk);
2166 ++err_put_hcd:
2167 + usb_put_hcd(hcd);
2168 + err:
2169 + dev_err(&pdev->dev, "init %s fail, %d\n",
2170 +diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
2171 +index 5dacc3076efdf..e081392ec8302 100644
2172 +--- a/drivers/usb/host/fotg210-hcd.c
2173 ++++ b/drivers/usb/host/fotg210-hcd.c
2174 +@@ -4495,13 +4495,12 @@ static bool itd_complete(struct fotg210_hcd *fotg210, struct fotg210_itd *itd)
2175 +
2176 + /* HC need not update length with this error */
2177 + if (!(t & FOTG210_ISOC_BABBLE)) {
2178 +- desc->actual_length =
2179 +- fotg210_itdlen(urb, desc, t);
2180 ++ desc->actual_length = FOTG210_ITD_LENGTH(t);
2181 + urb->actual_length += desc->actual_length;
2182 + }
2183 + } else if (likely((t & FOTG210_ISOC_ACTIVE) == 0)) {
2184 + desc->status = 0;
2185 +- desc->actual_length = fotg210_itdlen(urb, desc, t);
2186 ++ desc->actual_length = FOTG210_ITD_LENGTH(t);
2187 + urb->actual_length += desc->actual_length;
2188 + } else {
2189 + /* URB was too late */
2190 +diff --git a/drivers/usb/host/fotg210.h b/drivers/usb/host/fotg210.h
2191 +index b5cfa7aeb277c..1a3f94123c885 100644
2192 +--- a/drivers/usb/host/fotg210.h
2193 ++++ b/drivers/usb/host/fotg210.h
2194 +@@ -682,11 +682,6 @@ static inline unsigned fotg210_read_frame_index(struct fotg210_hcd *fotg210)
2195 + return fotg210_readl(fotg210, &fotg210->regs->frame_index);
2196 + }
2197 +
2198 +-#define fotg210_itdlen(urb, desc, t) ({ \
2199 +- usb_pipein((urb)->pipe) ? \
2200 +- (desc)->length - FOTG210_ITD_LENGTH(t) : \
2201 +- FOTG210_ITD_LENGTH(t); \
2202 +-})
2203 + /*-------------------------------------------------------------------------*/
2204 +
2205 + #endif /* __LINUX_FOTG210_H */
2206 +diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
2207 +index cfcfadfc94fc2..9c9e97294c18d 100644
2208 +--- a/drivers/usb/host/ohci-tmio.c
2209 ++++ b/drivers/usb/host/ohci-tmio.c
2210 +@@ -202,6 +202,9 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
2211 + if (!cell)
2212 + return -EINVAL;
2213 +
2214 ++ if (irq < 0)
2215 ++ return irq;
2216 ++
2217 + hcd = usb_create_hcd(&ohci_tmio_hc_driver, &dev->dev, dev_name(&dev->dev));
2218 + if (!hcd) {
2219 + ret = -ENOMEM;
2220 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
2221 +index b1994b03341fe..bd010f8caf87e 100644
2222 +--- a/drivers/usb/host/xhci.c
2223 ++++ b/drivers/usb/host/xhci.c
2224 +@@ -4438,19 +4438,19 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci,
2225 + {
2226 + unsigned long long timeout_ns;
2227 +
2228 +- if (xhci->quirks & XHCI_INTEL_HOST)
2229 +- timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc);
2230 +- else
2231 +- timeout_ns = udev->u1_params.sel;
2232 +-
2233 + /* Prevent U1 if service interval is shorter than U1 exit latency */
2234 + if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {
2235 +- if (xhci_service_interval_to_ns(desc) <= timeout_ns) {
2236 ++ if (xhci_service_interval_to_ns(desc) <= udev->u1_params.mel) {
2237 + dev_dbg(&udev->dev, "Disable U1, ESIT shorter than exit latency\n");
2238 + return USB3_LPM_DISABLED;
2239 + }
2240 + }
2241 +
2242 ++ if (xhci->quirks & XHCI_INTEL_HOST)
2243 ++ timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc);
2244 ++ else
2245 ++ timeout_ns = udev->u1_params.sel;
2246 ++
2247 + /* The U1 timeout is encoded in 1us intervals.
2248 + * Don't return a timeout of zero, because that's USB3_LPM_DISABLED.
2249 + */
2250 +@@ -4502,19 +4502,19 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci,
2251 + {
2252 + unsigned long long timeout_ns;
2253 +
2254 +- if (xhci->quirks & XHCI_INTEL_HOST)
2255 +- timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
2256 +- else
2257 +- timeout_ns = udev->u2_params.sel;
2258 +-
2259 + /* Prevent U2 if service interval is shorter than U2 exit latency */
2260 + if (usb_endpoint_xfer_int(desc) || usb_endpoint_xfer_isoc(desc)) {
2261 +- if (xhci_service_interval_to_ns(desc) <= timeout_ns) {
2262 ++ if (xhci_service_interval_to_ns(desc) <= udev->u2_params.mel) {
2263 + dev_dbg(&udev->dev, "Disable U2, ESIT shorter than exit latency\n");
2264 + return USB3_LPM_DISABLED;
2265 + }
2266 + }
2267 +
2268 ++ if (xhci->quirks & XHCI_INTEL_HOST)
2269 ++ timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
2270 ++ else
2271 ++ timeout_ns = udev->u2_params.sel;
2272 ++
2273 + /* The U2 timeout is encoded in 256us intervals */
2274 + timeout_ns = DIV_ROUND_UP_ULL(timeout_ns, 256 * 1000);
2275 + /* If the necessary timeout value is bigger than what we can set in the
2276 +diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
2277 +index 85d031ce85c1f..63798de8b5ae2 100644
2278 +--- a/drivers/usb/phy/phy-fsl-usb.c
2279 ++++ b/drivers/usb/phy/phy-fsl-usb.c
2280 +@@ -891,6 +891,8 @@ int usb_otg_start(struct platform_device *pdev)
2281 +
2282 + /* request irq */
2283 + p_otg->irq = platform_get_irq(pdev, 0);
2284 ++ if (p_otg->irq < 0)
2285 ++ return p_otg->irq;
2286 + status = request_irq(p_otg->irq, fsl_otg_isr,
2287 + IRQF_SHARED, driver_name, p_otg);
2288 + if (status) {
2289 +diff --git a/drivers/usb/phy/phy-isp1301.c b/drivers/usb/phy/phy-isp1301.c
2290 +index b3b33cf7ddf60..f333024660b4d 100644
2291 +--- a/drivers/usb/phy/phy-isp1301.c
2292 ++++ b/drivers/usb/phy/phy-isp1301.c
2293 +@@ -136,7 +136,7 @@ static int isp1301_remove(struct i2c_client *client)
2294 + static struct i2c_driver isp1301_driver = {
2295 + .driver = {
2296 + .name = DRV_NAME,
2297 +- .of_match_table = of_match_ptr(isp1301_of_match),
2298 ++ .of_match_table = isp1301_of_match,
2299 + },
2300 + .probe = isp1301_probe,
2301 + .remove = isp1301_remove,
2302 +diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
2303 +index 335a1ef352242..ec86eedd789bc 100644
2304 +--- a/drivers/usb/phy/phy-tahvo.c
2305 ++++ b/drivers/usb/phy/phy-tahvo.c
2306 +@@ -404,7 +404,9 @@ static int tahvo_usb_probe(struct platform_device *pdev)
2307 +
2308 + dev_set_drvdata(&pdev->dev, tu);
2309 +
2310 +- tu->irq = platform_get_irq(pdev, 0);
2311 ++ tu->irq = ret = platform_get_irq(pdev, 0);
2312 ++ if (ret < 0)
2313 ++ return ret;
2314 + ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
2315 + IRQF_ONESHOT,
2316 + "tahvo-vbus", tu);
2317 +diff --git a/drivers/usb/phy/phy-twl6030-usb.c b/drivers/usb/phy/phy-twl6030-usb.c
2318 +index 12741856a75c3..220e1a59a8718 100644
2319 +--- a/drivers/usb/phy/phy-twl6030-usb.c
2320 ++++ b/drivers/usb/phy/phy-twl6030-usb.c
2321 +@@ -336,6 +336,11 @@ static int twl6030_usb_probe(struct platform_device *pdev)
2322 + twl->irq2 = platform_get_irq(pdev, 1);
2323 + twl->linkstat = OMAP_MUSB_UNKNOWN;
2324 +
2325 ++ if (twl->irq1 < 0)
2326 ++ return twl->irq1;
2327 ++ if (twl->irq2 < 0)
2328 ++ return twl->irq2;
2329 ++
2330 + twl->comparator.set_vbus = twl6030_set_vbus;
2331 + twl->comparator.start_srp = twl6030_start_srp;
2332 +
2333 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
2334 +index 7f3af3ed347d7..2c85801ffccdb 100644
2335 +--- a/drivers/usb/serial/mos7720.c
2336 ++++ b/drivers/usb/serial/mos7720.c
2337 +@@ -229,8 +229,10 @@ static int read_mos_reg(struct usb_serial *serial, unsigned int serial_portnum,
2338 + int status;
2339 +
2340 + buf = kmalloc(1, GFP_KERNEL);
2341 +- if (!buf)
2342 ++ if (!buf) {
2343 ++ *data = 0;
2344 + return -ENOMEM;
2345 ++ }
2346 +
2347 + status = usb_control_msg(usbdev, pipe, request, requesttype, value,
2348 + index, buf, 1, MOS_WDR_TIMEOUT);
2349 +diff --git a/drivers/video/fbdev/asiliantfb.c b/drivers/video/fbdev/asiliantfb.c
2350 +index 7e8ddf00ccc2d..dbcc6ebaf9049 100644
2351 +--- a/drivers/video/fbdev/asiliantfb.c
2352 ++++ b/drivers/video/fbdev/asiliantfb.c
2353 +@@ -227,6 +227,9 @@ static int asiliantfb_check_var(struct fb_var_screeninfo *var,
2354 + {
2355 + unsigned long Ftarget, ratio, remainder;
2356 +
2357 ++ if (!var->pixclock)
2358 ++ return -EINVAL;
2359 ++
2360 + ratio = 1000000 / var->pixclock;
2361 + remainder = 1000000 % var->pixclock;
2362 + Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock;
2363 +diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
2364 +index afb84c27110d8..e3c692294adce 100644
2365 +--- a/drivers/video/fbdev/core/fbmem.c
2366 ++++ b/drivers/video/fbdev/core/fbmem.c
2367 +@@ -32,6 +32,7 @@
2368 + #include <linux/device.h>
2369 + #include <linux/efi.h>
2370 + #include <linux/fb.h>
2371 ++#include <linux/overflow.h>
2372 +
2373 + #include <asm/fb.h>
2374 +
2375 +@@ -981,6 +982,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
2376 + if ((var->activate & FB_ACTIVATE_FORCE) ||
2377 + memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) {
2378 + u32 activate = var->activate;
2379 ++ u32 unused;
2380 +
2381 + /* When using FOURCC mode, make sure the red, green, blue and
2382 + * transp fields are set to 0.
2383 +@@ -1005,6 +1007,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
2384 + if (var->xres < 8 || var->yres < 8)
2385 + return -EINVAL;
2386 +
2387 ++ /* Too huge resolution causes multiplication overflow. */
2388 ++ if (check_mul_overflow(var->xres, var->yres, &unused) ||
2389 ++ check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused))
2390 ++ return -EINVAL;
2391 ++
2392 + ret = info->fbops->fb_check_var(var, info);
2393 +
2394 + if (ret)
2395 +diff --git a/drivers/video/fbdev/kyro/fbdev.c b/drivers/video/fbdev/kyro/fbdev.c
2396 +index 5bb01533271e1..d98c3f5d80dfc 100644
2397 +--- a/drivers/video/fbdev/kyro/fbdev.c
2398 ++++ b/drivers/video/fbdev/kyro/fbdev.c
2399 +@@ -372,6 +372,11 @@ static int kyro_dev_overlay_viewport_set(u32 x, u32 y, u32 ulWidth, u32 ulHeight
2400 + /* probably haven't called CreateOverlay yet */
2401 + return -EINVAL;
2402 +
2403 ++ if (ulWidth == 0 || ulWidth == 0xffffffff ||
2404 ++ ulHeight == 0 || ulHeight == 0xffffffff ||
2405 ++ (x < 2 && ulWidth + 2 == 0))
2406 ++ return -EINVAL;
2407 ++
2408 + /* Stop Ramdac Output */
2409 + DisableRamdacOutput(deviceInfo.pSTGReg);
2410 +
2411 +@@ -394,6 +399,9 @@ static int kyrofb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
2412 + {
2413 + struct kyrofb_info *par = info->par;
2414 +
2415 ++ if (!var->pixclock)
2416 ++ return -EINVAL;
2417 ++
2418 + if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) {
2419 + printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel);
2420 + return -EINVAL;
2421 +diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
2422 +index f1ad2747064bf..6e5e29fe13db5 100644
2423 +--- a/drivers/video/fbdev/riva/fbdev.c
2424 ++++ b/drivers/video/fbdev/riva/fbdev.c
2425 +@@ -1088,6 +1088,9 @@ static int rivafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
2426 + int mode_valid = 0;
2427 +
2428 + NVTRACE_ENTER();
2429 ++ if (!var->pixclock)
2430 ++ return -EINVAL;
2431 ++
2432 + switch (var->bits_per_pixel) {
2433 + case 1 ... 8:
2434 + var->red.offset = var->green.offset = var->blue.offset = 0;
2435 +diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
2436 +index da4ad006739db..6d846ff696fb3 100644
2437 +--- a/fs/btrfs/inode.c
2438 ++++ b/fs/btrfs/inode.c
2439 +@@ -476,7 +476,7 @@ again:
2440 + * inode has not been flagged as nocompress. This flag can
2441 + * change at any time if we discover bad compression ratios.
2442 + */
2443 +- if (nr_pages > 1 && inode_need_compress(inode)) {
2444 ++ if (inode_need_compress(inode)) {
2445 + WARN_ON(pages);
2446 + pages = kcalloc(nr_pages, sizeof(struct page *), GFP_NOFS);
2447 + if (!pages) {
2448 +diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
2449 +index 942874257a092..e5e7801457280 100644
2450 +--- a/fs/cifs/cifs_unicode.c
2451 ++++ b/fs/cifs/cifs_unicode.c
2452 +@@ -367,14 +367,9 @@ cifs_strndup_from_utf16(const char *src, const int maxlen,
2453 + if (!dst)
2454 + return NULL;
2455 + cifs_from_utf16(dst, (__le16 *) src, len, maxlen, codepage,
2456 +- NO_MAP_UNI_RSVD);
2457 ++ NO_MAP_UNI_RSVD);
2458 + } else {
2459 +- len = strnlen(src, maxlen);
2460 +- len++;
2461 +- dst = kmalloc(len, GFP_KERNEL);
2462 +- if (!dst)
2463 +- return NULL;
2464 +- strlcpy(dst, src, len);
2465 ++ dst = kstrndup(src, maxlen, GFP_KERNEL);
2466 + }
2467 +
2468 + return dst;
2469 +diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
2470 +index 9bc7a29f88d65..2d3918cdcc284 100644
2471 +--- a/fs/cifs/sess.c
2472 ++++ b/fs/cifs/sess.c
2473 +@@ -602,7 +602,7 @@ sess_alloc_buffer(struct sess_data *sess_data, int wct)
2474 + return 0;
2475 +
2476 + out_free_smb_buf:
2477 +- kfree(smb_buf);
2478 ++ cifs_small_buf_release(smb_buf);
2479 + sess_data->iov[0].iov_base = NULL;
2480 + sess_data->iov[0].iov_len = 0;
2481 + sess_data->buf0_type = CIFS_NO_BUFFER;
2482 +diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
2483 +index df585267d3c25..6f5e292e86f72 100644
2484 +--- a/fs/ext4/inline.c
2485 ++++ b/fs/ext4/inline.c
2486 +@@ -746,6 +746,12 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len,
2487 + ext4_write_lock_xattr(inode, &no_expand);
2488 + BUG_ON(!ext4_has_inline_data(inode));
2489 +
2490 ++ /*
2491 ++ * ei->i_inline_off may have changed since ext4_write_begin()
2492 ++ * called ext4_try_to_write_inline_data()
2493 ++ */
2494 ++ (void) ext4_find_inline_data_nolock(inode);
2495 ++
2496 + kaddr = kmap_atomic(page);
2497 + ext4_write_inline_data(inode, &iloc, kaddr, pos, len);
2498 + kunmap_atomic(kaddr);
2499 +diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c
2500 +index 3cbc9147286dd..da9f979118524 100644
2501 +--- a/fs/gfs2/lock_dlm.c
2502 ++++ b/fs/gfs2/lock_dlm.c
2503 +@@ -296,6 +296,11 @@ static void gdlm_put_lock(struct gfs2_glock *gl)
2504 + gfs2_sbstats_inc(gl, GFS2_LKS_DCOUNT);
2505 + gfs2_update_request_times(gl);
2506 +
2507 ++ /* don't want to call dlm if we've unmounted the lock protocol */
2508 ++ if (test_bit(DFL_UNMOUNT, &ls->ls_recover_flags)) {
2509 ++ gfs2_glock_free(gl);
2510 ++ return;
2511 ++ }
2512 + /* don't want to skip dlm_unlock writing the lvb when lock has one */
2513 +
2514 + if (test_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags) &&
2515 +diff --git a/fs/udf/misc.c b/fs/udf/misc.c
2516 +index 71d1c25f360d1..8c7f9ea251e52 100644
2517 +--- a/fs/udf/misc.c
2518 ++++ b/fs/udf/misc.c
2519 +@@ -175,13 +175,22 @@ struct genericFormat *udf_get_extendedattr(struct inode *inode, uint32_t type,
2520 + else
2521 + offset = le32_to_cpu(eahd->appAttrLocation);
2522 +
2523 +- while (offset < iinfo->i_lenEAttr) {
2524 ++ while (offset + sizeof(*gaf) < iinfo->i_lenEAttr) {
2525 ++ uint32_t attrLength;
2526 ++
2527 + gaf = (struct genericFormat *)&ea[offset];
2528 ++ attrLength = le32_to_cpu(gaf->attrLength);
2529 ++
2530 ++ /* Detect undersized elements and buffer overflows */
2531 ++ if ((attrLength < sizeof(*gaf)) ||
2532 ++ (attrLength > (iinfo->i_lenEAttr - offset)))
2533 ++ break;
2534 ++
2535 + if (le32_to_cpu(gaf->attrType) == type &&
2536 + gaf->attrSubtype == subtype)
2537 + return gaf;
2538 + else
2539 +- offset += le32_to_cpu(gaf->attrLength);
2540 ++ offset += attrLength;
2541 + }
2542 + }
2543 +
2544 +diff --git a/include/linux/pci.h b/include/linux/pci.h
2545 +index 5f37614f2451f..c871b19cc9155 100644
2546 +--- a/include/linux/pci.h
2547 ++++ b/include/linux/pci.h
2548 +@@ -1442,8 +1442,9 @@ static inline int pci_set_dma_seg_boundary(struct pci_dev *dev,
2549 + { return -EIO; }
2550 + static inline int pci_assign_resource(struct pci_dev *dev, int i)
2551 + { return -EBUSY; }
2552 +-static inline int __pci_register_driver(struct pci_driver *drv,
2553 +- struct module *owner)
2554 ++static inline int __must_check __pci_register_driver(struct pci_driver *drv,
2555 ++ struct module *owner,
2556 ++ const char *mod_name)
2557 + { return 0; }
2558 + static inline int pci_register_driver(struct pci_driver *drv)
2559 + { return 0; }
2560 +diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
2561 +index 522757ac9cd4d..890f53881fad8 100644
2562 +--- a/include/linux/power/max17042_battery.h
2563 ++++ b/include/linux/power/max17042_battery.h
2564 +@@ -75,7 +75,7 @@ enum max17042_register {
2565 + MAX17042_RelaxCFG = 0x2A,
2566 + MAX17042_MiscCFG = 0x2B,
2567 + MAX17042_TGAIN = 0x2C,
2568 +- MAx17042_TOFF = 0x2D,
2569 ++ MAX17042_TOFF = 0x2D,
2570 + MAX17042_CGAIN = 0x2E,
2571 + MAX17042_COFF = 0x2F,
2572 +
2573 +diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
2574 +index 95feb153fe9a8..5436e629259db 100644
2575 +--- a/include/linux/skbuff.h
2576 ++++ b/include/linux/skbuff.h
2577 +@@ -1502,7 +1502,7 @@ static inline void __skb_insert(struct sk_buff *newsk,
2578 + newsk->next = next;
2579 + newsk->prev = prev;
2580 + next->prev = prev->next = newsk;
2581 +- list->qlen++;
2582 ++ WRITE_ONCE(list->qlen, list->qlen + 1);
2583 + }
2584 +
2585 + static inline void __skb_queue_splice(const struct sk_buff_head *list,
2586 +diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
2587 +index 1e5ac4e776da7..5bcc637cee461 100644
2588 +--- a/include/uapi/linux/serial_reg.h
2589 ++++ b/include/uapi/linux/serial_reg.h
2590 +@@ -61,6 +61,7 @@
2591 + * ST16C654: 8 16 56 60 8 16 32 56 PORT_16654
2592 + * TI16C750: 1 16 32 56 xx xx xx xx PORT_16750
2593 + * TI16C752: 8 16 56 60 8 16 32 56
2594 ++ * OX16C950: 16 32 112 120 16 32 64 112 PORT_16C950
2595 + * Tegra: 1 4 8 14 16 8 4 1 PORT_TEGRA
2596 + */
2597 + #define UART_FCR_R_TRIG_00 0x00
2598 +diff --git a/lib/test_bpf.c b/lib/test_bpf.c
2599 +index b1495f586f295..cf2880d2ce3f4 100644
2600 +--- a/lib/test_bpf.c
2601 ++++ b/lib/test_bpf.c
2602 +@@ -3983,8 +3983,8 @@ static struct bpf_test tests[] = {
2603 + .u.insns_int = {
2604 + BPF_LD_IMM64(R0, 0),
2605 + BPF_LD_IMM64(R1, 0xffffffffffffffffLL),
2606 +- BPF_STX_MEM(BPF_W, R10, R1, -40),
2607 +- BPF_LDX_MEM(BPF_W, R0, R10, -40),
2608 ++ BPF_STX_MEM(BPF_DW, R10, R1, -40),
2609 ++ BPF_LDX_MEM(BPF_DW, R0, R10, -40),
2610 + BPF_EXIT_INSN(),
2611 + },
2612 + INTERNAL,
2613 +@@ -5399,7 +5399,14 @@ static int run_one(const struct bpf_prog *fp, struct bpf_test *test)
2614 + u64 duration;
2615 + u32 ret;
2616 +
2617 +- if (test->test[i].data_size == 0 &&
2618 ++ /*
2619 ++ * NOTE: Several sub-tests may be present, in which case
2620 ++ * a zero {data_size, result} tuple indicates the end of
2621 ++ * the sub-test array. The first test is always run,
2622 ++ * even if both data_size and result happen to be zero.
2623 ++ */
2624 ++ if (i > 0 &&
2625 ++ test->test[i].data_size == 0 &&
2626 + test->test[i].result == 0)
2627 + break;
2628 +
2629 +diff --git a/mm/kmemleak.c b/mm/kmemleak.c
2630 +index 4d675318754e7..abcf9e47adc5b 100644
2631 +--- a/mm/kmemleak.c
2632 ++++ b/mm/kmemleak.c
2633 +@@ -1394,7 +1394,7 @@ static void kmemleak_scan(void)
2634 + if (page_count(page) == 0)
2635 + continue;
2636 + scan_block(page, page + 1, NULL);
2637 +- if (!(pfn % (MAX_SCAN_SIZE / sizeof(*page))))
2638 ++ if (!(pfn & 63))
2639 + cond_resched();
2640 + }
2641 + }
2642 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
2643 +index 3570aaf2a6204..c62d58055baf3 100644
2644 +--- a/mm/page_alloc.c
2645 ++++ b/mm/page_alloc.c
2646 +@@ -700,7 +700,7 @@ static inline void __free_one_page(struct page *page,
2647 + struct page *buddy;
2648 + unsigned int max_order;
2649 +
2650 +- max_order = min_t(unsigned int, MAX_ORDER, pageblock_order + 1);
2651 ++ max_order = min_t(unsigned int, MAX_ORDER - 1, pageblock_order);
2652 +
2653 + VM_BUG_ON(!zone_is_initialized(zone));
2654 + VM_BUG_ON_PAGE(page->flags & PAGE_FLAGS_CHECK_AT_PREP, page);
2655 +@@ -715,7 +715,7 @@ static inline void __free_one_page(struct page *page,
2656 + VM_BUG_ON_PAGE(bad_range(zone, page), page);
2657 +
2658 + continue_merging:
2659 +- while (order < max_order - 1) {
2660 ++ while (order < max_order) {
2661 + buddy_idx = __find_buddy_index(page_idx, order);
2662 + buddy = page + (buddy_idx - page_idx);
2663 + if (!page_is_buddy(page, buddy, order))
2664 +@@ -736,7 +736,7 @@ continue_merging:
2665 + page_idx = combined_idx;
2666 + order++;
2667 + }
2668 +- if (max_order < MAX_ORDER) {
2669 ++ if (order < MAX_ORDER - 1) {
2670 + /* If we are here, it means order is >= pageblock_order.
2671 + * We want to prevent merge between freepages on isolate
2672 + * pageblock and normal pageblock. Without this, pageblock
2673 +@@ -757,7 +757,7 @@ continue_merging:
2674 + is_migrate_isolate(buddy_mt)))
2675 + goto done_merging;
2676 + }
2677 +- max_order++;
2678 ++ max_order = order + 1;
2679 + goto continue_merging;
2680 + }
2681 +
2682 +diff --git a/net/bluetooth/cmtp/cmtp.h b/net/bluetooth/cmtp/cmtp.h
2683 +index c32638dddbf94..f6b9dc4e408f2 100644
2684 +--- a/net/bluetooth/cmtp/cmtp.h
2685 ++++ b/net/bluetooth/cmtp/cmtp.h
2686 +@@ -26,7 +26,7 @@
2687 + #include <linux/types.h>
2688 + #include <net/bluetooth/bluetooth.h>
2689 +
2690 +-#define BTNAMSIZ 18
2691 ++#define BTNAMSIZ 21
2692 +
2693 + /* CMTP ioctl defines */
2694 + #define CMTPCONNADD _IOW('C', 200, int)
2695 +diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
2696 +index 304abf2af9f3e..eefaa10c74dbb 100644
2697 +--- a/net/bluetooth/hci_core.c
2698 ++++ b/net/bluetooth/hci_core.c
2699 +@@ -1357,6 +1357,12 @@ int hci_inquiry(void __user *arg)
2700 + goto done;
2701 + }
2702 +
2703 ++ /* Restrict maximum inquiry length to 60 seconds */
2704 ++ if (ir.length > 60) {
2705 ++ err = -EINVAL;
2706 ++ goto done;
2707 ++ }
2708 ++
2709 + hci_dev_lock(hdev);
2710 + if (inquiry_cache_age(hdev) > INQUIRY_CACHE_AGE_MAX ||
2711 + inquiry_cache_empty(hdev) || ir.flags & IREQ_CACHE_FLUSH) {
2712 +@@ -1679,6 +1685,14 @@ int hci_dev_do_close(struct hci_dev *hdev)
2713 + hci_req_cancel(hdev, ENODEV);
2714 + hci_req_lock(hdev);
2715 +
2716 ++ if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
2717 ++ !hci_dev_test_flag(hdev, HCI_USER_CHANNEL) &&
2718 ++ test_bit(HCI_UP, &hdev->flags)) {
2719 ++ /* Execute vendor specific shutdown routine */
2720 ++ if (hdev->shutdown)
2721 ++ hdev->shutdown(hdev);
2722 ++ }
2723 ++
2724 + if (!test_and_clear_bit(HCI_UP, &hdev->flags)) {
2725 + cancel_delayed_work_sync(&hdev->cmd_timer);
2726 + hci_req_unlock(hdev);
2727 +diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
2728 +index 7ed3c7df271a6..6528ecc3a3bc5 100644
2729 +--- a/net/bluetooth/hci_event.c
2730 ++++ b/net/bluetooth/hci_event.c
2731 +@@ -3747,6 +3747,21 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev,
2732 +
2733 + switch (ev->status) {
2734 + case 0x00:
2735 ++ /* The synchronous connection complete event should only be
2736 ++ * sent once per new connection. Receiving a successful
2737 ++ * complete event when the connection status is already
2738 ++ * BT_CONNECTED means that the device is misbehaving and sent
2739 ++ * multiple complete event packets for the same new connection.
2740 ++ *
2741 ++ * Registering the device more than once can corrupt kernel
2742 ++ * memory, hence upon detecting this invalid event, we report
2743 ++ * an error and ignore the packet.
2744 ++ */
2745 ++ if (conn->state == BT_CONNECTED) {
2746 ++ bt_dev_err(hdev, "Ignoring connect complete event for existing connection");
2747 ++ goto unlock;
2748 ++ }
2749 ++
2750 + conn->handle = __le16_to_cpu(ev->handle);
2751 + conn->state = BT_CONNECTED;
2752 + conn->type = ev->link_type;
2753 +diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
2754 +index 2209fd2ff2e32..701d230fb9cf6 100644
2755 +--- a/net/bluetooth/sco.c
2756 ++++ b/net/bluetooth/sco.c
2757 +@@ -83,7 +83,6 @@ static void sco_sock_timeout(unsigned long arg)
2758 + sk->sk_state_change(sk);
2759 + bh_unlock_sock(sk);
2760 +
2761 +- sco_sock_kill(sk);
2762 + sock_put(sk);
2763 + }
2764 +
2765 +@@ -175,7 +174,6 @@ static void sco_conn_del(struct hci_conn *hcon, int err)
2766 + sco_sock_clear_timer(sk);
2767 + sco_chan_del(sk, err);
2768 + bh_unlock_sock(sk);
2769 +- sco_sock_kill(sk);
2770 + sock_put(sk);
2771 + }
2772 +
2773 +@@ -392,8 +390,7 @@ static void sco_sock_cleanup_listen(struct sock *parent)
2774 + */
2775 + static void sco_sock_kill(struct sock *sk)
2776 + {
2777 +- if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket ||
2778 +- sock_flag(sk, SOCK_DEAD))
2779 ++ if (!sock_flag(sk, SOCK_ZAPPED) || sk->sk_socket)
2780 + return;
2781 +
2782 + BT_DBG("sk %p state %d", sk, sk->sk_state);
2783 +@@ -445,7 +442,6 @@ static void sco_sock_close(struct sock *sk)
2784 + lock_sock(sk);
2785 + __sco_sock_close(sk);
2786 + release_sock(sk);
2787 +- sco_sock_kill(sk);
2788 + }
2789 +
2790 + static void sco_sock_init(struct sock *sk, struct sock *parent)
2791 +@@ -763,6 +759,11 @@ static void sco_conn_defer_accept(struct hci_conn *conn, u16 setting)
2792 + cp.max_latency = cpu_to_le16(0xffff);
2793 + cp.retrans_effort = 0xff;
2794 + break;
2795 ++ default:
2796 ++ /* use CVSD settings as fallback */
2797 ++ cp.max_latency = cpu_to_le16(0xffff);
2798 ++ cp.retrans_effort = 0xff;
2799 ++ break;
2800 + }
2801 +
2802 + hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
2803 +diff --git a/net/caif/chnl_net.c b/net/caif/chnl_net.c
2804 +index 67a4a36febd1a..40f032f620291 100644
2805 +--- a/net/caif/chnl_net.c
2806 ++++ b/net/caif/chnl_net.c
2807 +@@ -56,20 +56,6 @@ struct chnl_net {
2808 + enum caif_states state;
2809 + };
2810 +
2811 +-static void robust_list_del(struct list_head *delete_node)
2812 +-{
2813 +- struct list_head *list_node;
2814 +- struct list_head *n;
2815 +- ASSERT_RTNL();
2816 +- list_for_each_safe(list_node, n, &chnl_net_list) {
2817 +- if (list_node == delete_node) {
2818 +- list_del(list_node);
2819 +- return;
2820 +- }
2821 +- }
2822 +- WARN_ON(1);
2823 +-}
2824 +-
2825 + static int chnl_recv_cb(struct cflayer *layr, struct cfpkt *pkt)
2826 + {
2827 + struct sk_buff *skb;
2828 +@@ -371,6 +357,7 @@ static int chnl_net_init(struct net_device *dev)
2829 + ASSERT_RTNL();
2830 + priv = netdev_priv(dev);
2831 + strncpy(priv->name, dev->name, sizeof(priv->name));
2832 ++ INIT_LIST_HEAD(&priv->list_field);
2833 + return 0;
2834 + }
2835 +
2836 +@@ -379,7 +366,7 @@ static void chnl_net_uninit(struct net_device *dev)
2837 + struct chnl_net *priv;
2838 + ASSERT_RTNL();
2839 + priv = netdev_priv(dev);
2840 +- robust_list_del(&priv->list_field);
2841 ++ list_del_init(&priv->list_field);
2842 + }
2843 +
2844 + static const struct net_device_ops netdev_ops = {
2845 +@@ -542,7 +529,7 @@ static void __exit chnl_exit_module(void)
2846 + rtnl_lock();
2847 + list_for_each_safe(list_node, _tmp, &chnl_net_list) {
2848 + dev = list_entry(list_node, struct chnl_net, list_field);
2849 +- list_del(list_node);
2850 ++ list_del_init(list_node);
2851 + delete_device(dev);
2852 + }
2853 + rtnl_unlock();
2854 +diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
2855 +index 68eed344b4712..1f03a590288d3 100644
2856 +--- a/net/dccp/minisocks.c
2857 ++++ b/net/dccp/minisocks.c
2858 +@@ -92,6 +92,8 @@ struct sock *dccp_create_openreq_child(const struct sock *sk,
2859 + newdp->dccps_role = DCCP_ROLE_SERVER;
2860 + newdp->dccps_hc_rx_ackvec = NULL;
2861 + newdp->dccps_service_list = NULL;
2862 ++ newdp->dccps_hc_rx_ccid = NULL;
2863 ++ newdp->dccps_hc_tx_ccid = NULL;
2864 + newdp->dccps_service = dreq->dreq_service;
2865 + newdp->dccps_timestamp_echo = dreq->dreq_timestamp_echo;
2866 + newdp->dccps_timestamp_time = dreq->dreq_timestamp_time;
2867 +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
2868 +index c16c199d9cd99..0a9fb3d2ba907 100644
2869 +--- a/net/ipv4/icmp.c
2870 ++++ b/net/ipv4/icmp.c
2871 +@@ -460,6 +460,23 @@ static int icmp_multipath_hash_skb(const struct sk_buff *skb)
2872 +
2873 + #endif
2874 +
2875 ++/*
2876 ++ * The device used for looking up which routing table to use for sending an ICMP
2877 ++ * error is preferably the source whenever it is set, which should ensure the
2878 ++ * icmp error can be sent to the source host, else lookup using the routing
2879 ++ * table of the destination device, else use the main routing table (index 0).
2880 ++ */
2881 ++static struct net_device *icmp_get_route_lookup_dev(struct sk_buff *skb)
2882 ++{
2883 ++ struct net_device *route_lookup_dev = NULL;
2884 ++
2885 ++ if (skb->dev)
2886 ++ route_lookup_dev = skb->dev;
2887 ++ else if (skb_dst(skb))
2888 ++ route_lookup_dev = skb_dst(skb)->dev;
2889 ++ return route_lookup_dev;
2890 ++}
2891 ++
2892 + static struct rtable *icmp_route_lookup(struct net *net,
2893 + struct flowi4 *fl4,
2894 + struct sk_buff *skb_in,
2895 +@@ -468,6 +485,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
2896 + int type, int code,
2897 + struct icmp_bxm *param)
2898 + {
2899 ++ struct net_device *route_lookup_dev;
2900 + struct rtable *rt, *rt2;
2901 + struct flowi4 fl4_dec;
2902 + int err;
2903 +@@ -481,7 +499,8 @@ static struct rtable *icmp_route_lookup(struct net *net,
2904 + fl4->flowi4_proto = IPPROTO_ICMP;
2905 + fl4->fl4_icmp_type = type;
2906 + fl4->fl4_icmp_code = code;
2907 +- fl4->flowi4_oif = l3mdev_master_ifindex(skb_dst(skb_in)->dev);
2908 ++ route_lookup_dev = icmp_get_route_lookup_dev(skb_in);
2909 ++ fl4->flowi4_oif = l3mdev_master_ifindex(route_lookup_dev);
2910 +
2911 + security_skb_classify_flow(skb_in, flowi4_to_flowi(fl4));
2912 + rt = __ip_route_output_key_hash(net, fl4,
2913 +@@ -506,7 +525,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
2914 + if (err)
2915 + goto relookup_failed;
2916 +
2917 +- if (inet_addr_type_dev_table(net, skb_dst(skb_in)->dev,
2918 ++ if (inet_addr_type_dev_table(net, route_lookup_dev,
2919 + fl4_dec.saddr) == RTN_LOCAL) {
2920 + rt2 = __ip_route_output_key(net, &fl4_dec);
2921 + if (IS_ERR(rt2))
2922 +diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
2923 +index c67efa3e79dd7..7b0bbda676b3f 100644
2924 +--- a/net/ipv4/igmp.c
2925 ++++ b/net/ipv4/igmp.c
2926 +@@ -2631,6 +2631,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u
2927 + rv = 1;
2928 + } else if (im) {
2929 + if (src_addr) {
2930 ++ spin_lock_bh(&im->lock);
2931 + for (psf = im->sources; psf; psf = psf->sf_next) {
2932 + if (psf->sf_inaddr == src_addr)
2933 + break;
2934 +@@ -2641,6 +2642,7 @@ int ip_check_mc_rcu(struct in_device *in_dev, __be32 mc_addr, __be32 src_addr, u
2935 + im->sfcount[MCAST_EXCLUDE];
2936 + else
2937 + rv = im->sfcount[MCAST_EXCLUDE] != 0;
2938 ++ spin_unlock_bh(&im->lock);
2939 + } else
2940 + rv = 1; /* unspecified source; tentatively allow */
2941 + }
2942 +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
2943 +index e808227c58d6b..477540b3d3207 100644
2944 +--- a/net/ipv4/ip_output.c
2945 ++++ b/net/ipv4/ip_output.c
2946 +@@ -376,8 +376,9 @@ static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4)
2947 + {
2948 + BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) !=
2949 + offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr));
2950 +- memcpy(&iph->saddr, &fl4->saddr,
2951 +- sizeof(fl4->saddr) + sizeof(fl4->daddr));
2952 ++
2953 ++ iph->saddr = fl4->saddr;
2954 ++ iph->daddr = fl4->daddr;
2955 + }
2956 +
2957 + /* Note: skb->sk can be different from sk, in case of tunnels */
2958 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
2959 +index 2ab2289d97a09..ed64831816762 100644
2960 +--- a/net/ipv4/route.c
2961 ++++ b/net/ipv4/route.c
2962 +@@ -597,18 +597,25 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
2963 + }
2964 + }
2965 +
2966 +-static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
2967 ++static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
2968 + {
2969 +- struct fib_nh_exception *fnhe, *oldest;
2970 ++ struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
2971 ++ struct fib_nh_exception *fnhe, *oldest = NULL;
2972 +
2973 +- oldest = rcu_dereference(hash->chain);
2974 +- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
2975 +- fnhe = rcu_dereference(fnhe->fnhe_next)) {
2976 +- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
2977 ++ for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
2978 ++ fnhe = rcu_dereference_protected(*fnhe_p,
2979 ++ lockdep_is_held(&fnhe_lock));
2980 ++ if (!fnhe)
2981 ++ break;
2982 ++ if (!oldest ||
2983 ++ time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
2984 + oldest = fnhe;
2985 ++ oldest_p = fnhe_p;
2986 ++ }
2987 + }
2988 + fnhe_flush_routes(oldest);
2989 +- return oldest;
2990 ++ *oldest_p = oldest->fnhe_next;
2991 ++ kfree_rcu(oldest, rcu);
2992 + }
2993 +
2994 + static inline u32 fnhe_hashfun(__be32 daddr)
2995 +@@ -685,16 +692,21 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
2996 + if (rt)
2997 + fill_route_from_fnhe(rt, fnhe);
2998 + } else {
2999 +- if (depth > FNHE_RECLAIM_DEPTH)
3000 +- fnhe = fnhe_oldest(hash);
3001 +- else {
3002 +- fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
3003 +- if (!fnhe)
3004 +- goto out_unlock;
3005 +-
3006 +- fnhe->fnhe_next = hash->chain;
3007 +- rcu_assign_pointer(hash->chain, fnhe);
3008 ++ /* Randomize max depth to avoid some side channels attacks. */
3009 ++ int max_depth = FNHE_RECLAIM_DEPTH +
3010 ++ prandom_u32_max(FNHE_RECLAIM_DEPTH);
3011 ++
3012 ++ while (depth > max_depth) {
3013 ++ fnhe_remove_oldest(hash);
3014 ++ depth--;
3015 + }
3016 ++
3017 ++ fnhe = kzalloc(sizeof(*fnhe), GFP_ATOMIC);
3018 ++ if (!fnhe)
3019 ++ goto out_unlock;
3020 ++
3021 ++ fnhe->fnhe_next = hash->chain;
3022 ++
3023 + fnhe->fnhe_genid = genid;
3024 + fnhe->fnhe_daddr = daddr;
3025 + fnhe->fnhe_gw = gw;
3026 +@@ -702,6 +714,8 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
3027 + fnhe->fnhe_mtu_locked = lock;
3028 + fnhe->fnhe_expires = expires;
3029 +
3030 ++ rcu_assign_pointer(hash->chain, fnhe);
3031 ++
3032 + /* Exception created; mark the cached routes for the nexthop
3033 + * stale, so anyone caching it rechecks if this exception
3034 + * applies to them.
3035 +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
3036 +index bb6d251ce103c..f9d55dd2dec85 100644
3037 +--- a/net/ipv4/tcp_ipv4.c
3038 ++++ b/net/ipv4/tcp_ipv4.c
3039 +@@ -2033,6 +2033,7 @@ static void *tcp_get_idx(struct seq_file *seq, loff_t pos)
3040 + static void *tcp_seek_last_pos(struct seq_file *seq)
3041 + {
3042 + struct tcp_iter_state *st = seq->private;
3043 ++ int bucket = st->bucket;
3044 + int offset = st->offset;
3045 + int orig_num = st->num;
3046 + void *rc = NULL;
3047 +@@ -2043,7 +2044,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
3048 + break;
3049 + st->state = TCP_SEQ_STATE_LISTENING;
3050 + rc = listening_get_next(seq, NULL);
3051 +- while (offset-- && rc)
3052 ++ while (offset-- && rc && bucket == st->bucket)
3053 + rc = listening_get_next(seq, rc);
3054 + if (rc)
3055 + break;
3056 +@@ -2054,7 +2055,7 @@ static void *tcp_seek_last_pos(struct seq_file *seq)
3057 + if (st->bucket > tcp_hashinfo.ehash_mask)
3058 + break;
3059 + rc = established_get_first(seq);
3060 +- while (offset-- && rc)
3061 ++ while (offset-- && rc && bucket == st->bucket)
3062 + rc = established_get_next(seq, rc);
3063 + }
3064 +
3065 +diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
3066 +index 653892ea8f143..9a85b0133991d 100644
3067 +--- a/net/l2tp/l2tp_core.c
3068 ++++ b/net/l2tp/l2tp_core.c
3069 +@@ -990,8 +990,10 @@ static int l2tp_udp_recv_core(struct l2tp_tunnel *tunnel, struct sk_buff *skb,
3070 + }
3071 +
3072 + if (tunnel->version == L2TP_HDR_VER_3 &&
3073 +- l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr))
3074 ++ l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr)) {
3075 ++ l2tp_session_dec_refcount(session);
3076 + goto error;
3077 ++ }
3078 +
3079 + l2tp_recv_common(session, skb, ptr, optr, hdrflags, length, payload_hook);
3080 + l2tp_session_dec_refcount(session);
3081 +diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c
3082 +index 7fd1104ba9007..422fac2a4a3c8 100644
3083 +--- a/net/netlabel/netlabel_cipso_v4.c
3084 ++++ b/net/netlabel/netlabel_cipso_v4.c
3085 +@@ -163,8 +163,8 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
3086 + return -ENOMEM;
3087 + doi_def->map.std = kzalloc(sizeof(*doi_def->map.std), GFP_KERNEL);
3088 + if (doi_def->map.std == NULL) {
3089 +- ret_val = -ENOMEM;
3090 +- goto add_std_failure;
3091 ++ kfree(doi_def);
3092 ++ return -ENOMEM;
3093 + }
3094 + doi_def->type = CIPSO_V4_MAP_TRANS;
3095 +
3096 +@@ -205,14 +205,14 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
3097 + }
3098 + doi_def->map.std->lvl.local = kcalloc(doi_def->map.std->lvl.local_size,
3099 + sizeof(u32),
3100 +- GFP_KERNEL);
3101 ++ GFP_KERNEL | __GFP_NOWARN);
3102 + if (doi_def->map.std->lvl.local == NULL) {
3103 + ret_val = -ENOMEM;
3104 + goto add_std_failure;
3105 + }
3106 + doi_def->map.std->lvl.cipso = kcalloc(doi_def->map.std->lvl.cipso_size,
3107 + sizeof(u32),
3108 +- GFP_KERNEL);
3109 ++ GFP_KERNEL | __GFP_NOWARN);
3110 + if (doi_def->map.std->lvl.cipso == NULL) {
3111 + ret_val = -ENOMEM;
3112 + goto add_std_failure;
3113 +@@ -279,7 +279,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
3114 + doi_def->map.std->cat.local = kcalloc(
3115 + doi_def->map.std->cat.local_size,
3116 + sizeof(u32),
3117 +- GFP_KERNEL);
3118 ++ GFP_KERNEL | __GFP_NOWARN);
3119 + if (doi_def->map.std->cat.local == NULL) {
3120 + ret_val = -ENOMEM;
3121 + goto add_std_failure;
3122 +@@ -287,7 +287,7 @@ static int netlbl_cipsov4_add_std(struct genl_info *info,
3123 + doi_def->map.std->cat.cipso = kcalloc(
3124 + doi_def->map.std->cat.cipso_size,
3125 + sizeof(u32),
3126 +- GFP_KERNEL);
3127 ++ GFP_KERNEL | __GFP_NOWARN);
3128 + if (doi_def->map.std->cat.cipso == NULL) {
3129 + ret_val = -ENOMEM;
3130 + goto add_std_failure;
3131 +diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
3132 +index c20c41801845f..260cba93a2cfb 100644
3133 +--- a/net/netlink/af_netlink.c
3134 ++++ b/net/netlink/af_netlink.c
3135 +@@ -2405,13 +2405,15 @@ int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
3136 + /* errors reported via destination sk->sk_err, but propagate
3137 + * delivery errors if NETLINK_BROADCAST_ERROR flag is set */
3138 + err = nlmsg_multicast(sk, skb, exclude_portid, group, flags);
3139 ++ if (err == -ESRCH)
3140 ++ err = 0;
3141 + }
3142 +
3143 + if (report) {
3144 + int err2;
3145 +
3146 + err2 = nlmsg_unicast(sk, skb, portid);
3147 +- if (!err || err == -ESRCH)
3148 ++ if (!err)
3149 + err = err2;
3150 + }
3151 +
3152 +diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
3153 +index bb8b0ef5de82c..daf0c1ea39173 100644
3154 +--- a/net/sunrpc/auth_gss/svcauth_gss.c
3155 ++++ b/net/sunrpc/auth_gss/svcauth_gss.c
3156 +@@ -1845,7 +1845,7 @@ gss_svc_init_net(struct net *net)
3157 + goto out2;
3158 + return 0;
3159 + out2:
3160 +- destroy_use_gss_proxy_proc_entry(net);
3161 ++ rsi_cache_destroy_net(net);
3162 + out1:
3163 + rsc_cache_destroy_net(net);
3164 + return rv;
3165 +diff --git a/net/tipc/socket.c b/net/tipc/socket.c
3166 +index 9d15bb865eea8..9d380d55ea1c2 100644
3167 +--- a/net/tipc/socket.c
3168 ++++ b/net/tipc/socket.c
3169 +@@ -1757,7 +1757,7 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
3170 + static void tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
3171 + u32 dport, struct sk_buff_head *xmitq)
3172 + {
3173 +- unsigned long time_limit = jiffies + 2;
3174 ++ unsigned long time_limit = jiffies + usecs_to_jiffies(20000);
3175 + struct sk_buff *skb;
3176 + unsigned int lim;
3177 + atomic_t *dcnt;
3178 +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
3179 +index ac95ef6444122..cb9911dcafdbd 100644
3180 +--- a/net/unix/af_unix.c
3181 ++++ b/net/unix/af_unix.c
3182 +@@ -2700,7 +2700,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock,
3183 +
3184 + other = unix_peer(sk);
3185 + if (other && unix_peer(other) != sk &&
3186 +- unix_recvq_full(other) &&
3187 ++ unix_recvq_full_lockless(other) &&
3188 + unix_dgram_peer_wake_me(sk, other))
3189 + writable = 0;
3190 +
3191 +diff --git a/security/smack/smack_access.c b/security/smack/smack_access.c
3192 +index 0df316c620050..84f38b6942426 100644
3193 +--- a/security/smack/smack_access.c
3194 ++++ b/security/smack/smack_access.c
3195 +@@ -90,23 +90,22 @@ int log_policy = SMACK_AUDIT_DENIED;
3196 + int smk_access_entry(char *subject_label, char *object_label,
3197 + struct list_head *rule_list)
3198 + {
3199 +- int may = -ENOENT;
3200 + struct smack_rule *srp;
3201 +
3202 + list_for_each_entry_rcu(srp, rule_list, list) {
3203 + if (srp->smk_object->smk_known == object_label &&
3204 + srp->smk_subject->smk_known == subject_label) {
3205 +- may = srp->smk_access;
3206 +- break;
3207 ++ int may = srp->smk_access;
3208 ++ /*
3209 ++ * MAY_WRITE implies MAY_LOCK.
3210 ++ */
3211 ++ if ((may & MAY_WRITE) == MAY_WRITE)
3212 ++ may |= MAY_LOCK;
3213 ++ return may;
3214 + }
3215 + }
3216 +
3217 +- /*
3218 +- * MAY_WRITE implies MAY_LOCK.
3219 +- */
3220 +- if ((may & MAY_WRITE) == MAY_WRITE)
3221 +- may |= MAY_LOCK;
3222 +- return may;
3223 ++ return -ENOENT;
3224 + }
3225 +
3226 + /**
3227 +diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
3228 +index ab8846e7e8ff1..b4910b38ba348 100644
3229 +--- a/sound/core/pcm_lib.c
3230 ++++ b/sound/core/pcm_lib.c
3231 +@@ -1830,7 +1830,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream,
3232 + channels = params_channels(params);
3233 + frame_size = snd_pcm_format_size(format, channels);
3234 + if (frame_size > 0)
3235 +- params->fifo_size /= (unsigned)frame_size;
3236 ++ params->fifo_size /= frame_size;
3237 + }
3238 + return 0;
3239 + }