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, 21 Nov 2018 15:02:40
Message-Id: 1542812493.6a9de5dd538f4e008be493d481230377ae38b6c3.mpagano@gentoo
1 commit: 6a9de5dd538f4e008be493d481230377ae38b6c3
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 19 22:37:15 2018 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 21 15:01:33 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=6a9de5dd
7
8 Linux patch 4.4.157
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1156_linux-4.4.157.patch | 1664 ++++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 1668 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 6a3a701..3388582 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -667,6 +667,10 @@ Patch: 1155_linux-4.4.156.patch
21 From: http://www.kernel.org
22 Desc: Linux 4.4.156
23
24 +Patch: 1156_linux-4.4.157.patch
25 +From: http://www.kernel.org
26 +Desc: Linux 4.4.157
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/1156_linux-4.4.157.patch b/1156_linux-4.4.157.patch
33 new file mode 100644
34 index 0000000..45066d8
35 --- /dev/null
36 +++ b/1156_linux-4.4.157.patch
37 @@ -0,0 +1,1664 @@
38 +diff --git a/Makefile b/Makefile
39 +index 6dd5924a7ea5..2d55f88e6a08 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,6 +1,6 @@
43 + VERSION = 4
44 + PATCHLEVEL = 4
45 +-SUBLEVEL = 156
46 ++SUBLEVEL = 157
47 + EXTRAVERSION =
48 + NAME = Blurry Fish Butt
49 +
50 +diff --git a/arch/arc/configs/axs101_defconfig b/arch/arc/configs/axs101_defconfig
51 +index f1ac9818b751..dbee1934dfc6 100644
52 +--- a/arch/arc/configs/axs101_defconfig
53 ++++ b/arch/arc/configs/axs101_defconfig
54 +@@ -1,6 +1,5 @@
55 + CONFIG_CROSS_COMPILE="arc-linux-"
56 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
57 +-# CONFIG_SWAP is not set
58 + CONFIG_SYSVIPC=y
59 + CONFIG_POSIX_MQUEUE=y
60 + # CONFIG_CROSS_MEMORY_ATTACH is not set
61 +diff --git a/arch/arc/configs/axs103_defconfig b/arch/arc/configs/axs103_defconfig
62 +index 323486d6ee83..561eac854cc3 100644
63 +--- a/arch/arc/configs/axs103_defconfig
64 ++++ b/arch/arc/configs/axs103_defconfig
65 +@@ -1,6 +1,5 @@
66 + CONFIG_CROSS_COMPILE="arc-linux-"
67 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
68 +-# CONFIG_SWAP is not set
69 + CONFIG_SYSVIPC=y
70 + CONFIG_POSIX_MQUEUE=y
71 + # CONFIG_CROSS_MEMORY_ATTACH is not set
72 +diff --git a/arch/arc/configs/axs103_smp_defconfig b/arch/arc/configs/axs103_smp_defconfig
73 +index 66191cd0447e..aa4f261b6508 100644
74 +--- a/arch/arc/configs/axs103_smp_defconfig
75 ++++ b/arch/arc/configs/axs103_smp_defconfig
76 +@@ -1,6 +1,5 @@
77 + CONFIG_CROSS_COMPILE="arc-linux-"
78 + CONFIG_DEFAULT_HOSTNAME="ARCLinux"
79 +-# CONFIG_SWAP is not set
80 + CONFIG_SYSVIPC=y
81 + CONFIG_POSIX_MQUEUE=y
82 + # CONFIG_CROSS_MEMORY_ATTACH is not set
83 +diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
84 +index d113c8ded6e2..6df3a4ea77fc 100644
85 +--- a/arch/mips/cavium-octeon/octeon-platform.c
86 ++++ b/arch/mips/cavium-octeon/octeon-platform.c
87 +@@ -349,6 +349,7 @@ static int __init octeon_ehci_device_init(void)
88 + return 0;
89 +
90 + pd = of_find_device_by_node(ehci_node);
91 ++ of_node_put(ehci_node);
92 + if (!pd)
93 + return 0;
94 +
95 +@@ -411,6 +412,7 @@ static int __init octeon_ohci_device_init(void)
96 + return 0;
97 +
98 + pd = of_find_device_by_node(ohci_node);
99 ++ of_node_put(ohci_node);
100 + if (!pd)
101 + return 0;
102 +
103 +diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
104 +index 75fa296836fc..ab1df19b0957 100644
105 +--- a/arch/mips/include/asm/io.h
106 ++++ b/arch/mips/include/asm/io.h
107 +@@ -141,14 +141,14 @@ static inline void * phys_to_virt(unsigned long address)
108 + /*
109 + * ISA I/O bus memory addresses are 1:1 with the physical address.
110 + */
111 +-static inline unsigned long isa_virt_to_bus(volatile void * address)
112 ++static inline unsigned long isa_virt_to_bus(volatile void *address)
113 + {
114 +- return (unsigned long)address - PAGE_OFFSET;
115 ++ return virt_to_phys(address);
116 + }
117 +
118 +-static inline void * isa_bus_to_virt(unsigned long address)
119 ++static inline void *isa_bus_to_virt(unsigned long address)
120 + {
121 +- return (void *)(address + PAGE_OFFSET);
122 ++ return phys_to_virt(address);
123 + }
124 +
125 + #define isa_page_to_bus page_to_phys
126 +diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
127 +index 354b99f56c1e..ed6cac4a4df0 100644
128 +--- a/arch/mips/kernel/process.c
129 ++++ b/arch/mips/kernel/process.c
130 +@@ -115,7 +115,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
131 + struct thread_info *ti = task_thread_info(p);
132 + struct pt_regs *childregs, *regs = current_pt_regs();
133 + unsigned long childksp;
134 +- p->set_child_tid = p->clear_child_tid = NULL;
135 +
136 + childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
137 +
138 +diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
139 +index 5d3a25e1cfae..52e8c2026853 100644
140 +--- a/arch/mips/mm/c-r4k.c
141 ++++ b/arch/mips/mm/c-r4k.c
142 +@@ -712,7 +712,8 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
143 + static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
144 + {
145 + /* Catch bad driver code */
146 +- BUG_ON(size == 0);
147 ++ if (WARN_ON(size == 0))
148 ++ return;
149 +
150 + preempt_disable();
151 + if (cpu_has_inclusive_pcaches) {
152 +@@ -745,7 +746,8 @@ static void r4k_dma_cache_wback_inv(unsigned long addr, unsigned long size)
153 + static void r4k_dma_cache_inv(unsigned long addr, unsigned long size)
154 + {
155 + /* Catch bad driver code */
156 +- BUG_ON(size == 0);
157 ++ if (WARN_ON(size == 0))
158 ++ return;
159 +
160 + preempt_disable();
161 + if (cpu_has_inclusive_pcaches) {
162 +diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c
163 +index 7095dfe7666b..962372143fda 100644
164 +--- a/arch/openrisc/kernel/process.c
165 ++++ b/arch/openrisc/kernel/process.c
166 +@@ -152,8 +152,6 @@ copy_thread(unsigned long clone_flags, unsigned long usp,
167 +
168 + top_of_kernel_stack = sp;
169 +
170 +- p->set_child_tid = p->clear_child_tid = NULL;
171 +-
172 + /* Locate userspace context on stack... */
173 + sp -= STACK_FRAME_OVERHEAD; /* redzone */
174 + sp -= sizeof(struct pt_regs);
175 +diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
176 +index 337c52192278..440a948c4feb 100644
177 +--- a/arch/x86/include/asm/processor.h
178 ++++ b/arch/x86/include/asm/processor.h
179 +@@ -104,6 +104,8 @@ struct cpuinfo_x86 {
180 + __u8 x86_phys_bits;
181 + /* CPUID returned core id bits: */
182 + __u8 x86_coreid_bits;
183 ++
184 ++ __u8 x86_cache_bits;
185 + /* Max extended CPUID function supported: */
186 + __u32 extended_cpuid_level;
187 + /* Maximum supported CPUID level, -1=no CPUID: */
188 +@@ -174,7 +176,7 @@ extern void cpu_detect(struct cpuinfo_x86 *c);
189 +
190 + static inline unsigned long long l1tf_pfn_limit(void)
191 + {
192 +- return BIT_ULL(boot_cpu_data.x86_phys_bits - 1 - PAGE_SHIFT);
193 ++ return BIT_ULL(boot_cpu_data.x86_cache_bits - 1 - PAGE_SHIFT);
194 + }
195 +
196 + extern void early_cpu_init(void);
197 +diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
198 +index b9e6b60df148..621bc6561189 100644
199 +--- a/arch/x86/kernel/cpu/bugs.c
200 ++++ b/arch/x86/kernel/cpu/bugs.c
201 +@@ -634,6 +634,46 @@ void x86_spec_ctrl_setup_ap(void)
202 +
203 + #undef pr_fmt
204 + #define pr_fmt(fmt) "L1TF: " fmt
205 ++
206 ++/*
207 ++ * These CPUs all support 44bits physical address space internally in the
208 ++ * cache but CPUID can report a smaller number of physical address bits.
209 ++ *
210 ++ * The L1TF mitigation uses the top most address bit for the inversion of
211 ++ * non present PTEs. When the installed memory reaches into the top most
212 ++ * address bit due to memory holes, which has been observed on machines
213 ++ * which report 36bits physical address bits and have 32G RAM installed,
214 ++ * then the mitigation range check in l1tf_select_mitigation() triggers.
215 ++ * This is a false positive because the mitigation is still possible due to
216 ++ * the fact that the cache uses 44bit internally. Use the cache bits
217 ++ * instead of the reported physical bits and adjust them on the affected
218 ++ * machines to 44bit if the reported bits are less than 44.
219 ++ */
220 ++static void override_cache_bits(struct cpuinfo_x86 *c)
221 ++{
222 ++ if (c->x86 != 6)
223 ++ return;
224 ++
225 ++ switch (c->x86_model) {
226 ++ case INTEL_FAM6_NEHALEM:
227 ++ case INTEL_FAM6_WESTMERE:
228 ++ case INTEL_FAM6_SANDYBRIDGE:
229 ++ case INTEL_FAM6_IVYBRIDGE:
230 ++ case INTEL_FAM6_HASWELL_CORE:
231 ++ case INTEL_FAM6_HASWELL_ULT:
232 ++ case INTEL_FAM6_HASWELL_GT3E:
233 ++ case INTEL_FAM6_BROADWELL_CORE:
234 ++ case INTEL_FAM6_BROADWELL_GT3E:
235 ++ case INTEL_FAM6_SKYLAKE_MOBILE:
236 ++ case INTEL_FAM6_SKYLAKE_DESKTOP:
237 ++ case INTEL_FAM6_KABYLAKE_MOBILE:
238 ++ case INTEL_FAM6_KABYLAKE_DESKTOP:
239 ++ if (c->x86_cache_bits < 44)
240 ++ c->x86_cache_bits = 44;
241 ++ break;
242 ++ }
243 ++}
244 ++
245 + static void __init l1tf_select_mitigation(void)
246 + {
247 + u64 half_pa;
248 +@@ -641,16 +681,13 @@ static void __init l1tf_select_mitigation(void)
249 + if (!boot_cpu_has_bug(X86_BUG_L1TF))
250 + return;
251 +
252 ++ override_cache_bits(&boot_cpu_data);
253 ++
254 + #if CONFIG_PGTABLE_LEVELS == 2
255 + pr_warn("Kernel not compiled for PAE. No mitigation for L1TF\n");
256 + return;
257 + #endif
258 +
259 +- /*
260 +- * This is extremely unlikely to happen because almost all
261 +- * systems have far more MAX_PA/2 than RAM can be fit into
262 +- * DIMM slots.
263 +- */
264 + half_pa = (u64)l1tf_pfn_limit() << PAGE_SHIFT;
265 + if (e820_any_mapped(half_pa, ULLONG_MAX - half_pa, E820_RAM)) {
266 + pr_warn("System has more than MAX_PA/2 memory. L1TF mitigation not effective.\n");
267 +diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
268 +index 4d3fa79c0f09..b12c0287d6cf 100644
269 +--- a/arch/x86/kernel/cpu/common.c
270 ++++ b/arch/x86/kernel/cpu/common.c
271 +@@ -798,6 +798,8 @@ void get_cpu_cap(struct cpuinfo_x86 *c)
272 + c->x86_phys_bits = 36;
273 + #endif
274 +
275 ++ c->x86_cache_bits = c->x86_phys_bits;
276 ++
277 + if (c->extended_cpuid_level >= 0x8000000a)
278 + c->x86_capability[CPUID_8000_000A_EDX] = cpuid_edx(0x8000000a);
279 +
280 +diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
281 +index e0a34b0d381e..c4dffae5d939 100644
282 +--- a/arch/x86/mm/fault.c
283 ++++ b/arch/x86/mm/fault.c
284 +@@ -273,8 +273,6 @@ static noinline int vmalloc_fault(unsigned long address)
285 + if (!(address >= VMALLOC_START && address < VMALLOC_END))
286 + return -1;
287 +
288 +- WARN_ON_ONCE(in_nmi());
289 +-
290 + /*
291 + * Synchronize this task's top level page-table
292 + * with the 'reference' page table.
293 +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
294 +index 46ba2402c8f9..987361113ecd 100644
295 +--- a/block/blk-cgroup.c
296 ++++ b/block/blk-cgroup.c
297 +@@ -185,7 +185,8 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
298 + }
299 +
300 + wb_congested = wb_congested_get_create(&q->backing_dev_info,
301 +- blkcg->css.id, GFP_NOWAIT);
302 ++ blkcg->css.id,
303 ++ GFP_NOWAIT | __GFP_NOWARN);
304 + if (!wb_congested) {
305 + ret = -ENOMEM;
306 + goto err_put_css;
307 +@@ -193,7 +194,7 @@ static struct blkcg_gq *blkg_create(struct blkcg *blkcg,
308 +
309 + /* allocate */
310 + if (!new_blkg) {
311 +- new_blkg = blkg_alloc(blkcg, q, GFP_NOWAIT);
312 ++ new_blkg = blkg_alloc(blkcg, q, GFP_NOWAIT | __GFP_NOWARN);
313 + if (unlikely(!new_blkg)) {
314 + ret = -ENOMEM;
315 + goto err_put_congested;
316 +@@ -1022,7 +1023,7 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
317 + }
318 +
319 + spin_lock_init(&blkcg->lock);
320 +- INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT);
321 ++ INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_NOWAIT | __GFP_NOWARN);
322 + INIT_HLIST_HEAD(&blkcg->blkg_list);
323 + #ifdef CONFIG_CGROUP_WRITEBACK
324 + INIT_LIST_HEAD(&blkcg->cgwb_list);
325 +@@ -1238,7 +1239,7 @@ pd_prealloc:
326 + if (blkg->pd[pol->plid])
327 + continue;
328 +
329 +- pd = pol->pd_alloc_fn(GFP_NOWAIT, q->node);
330 ++ pd = pol->pd_alloc_fn(GFP_NOWAIT | __GFP_NOWARN, q->node);
331 + if (!pd)
332 + swap(pd, pd_prealloc);
333 + if (!pd) {
334 +diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
335 +index e04a7b8492cf..4e1f49434bbe 100644
336 +--- a/block/cfq-iosched.c
337 ++++ b/block/cfq-iosched.c
338 +@@ -2905,7 +2905,8 @@ static void cfq_arm_slice_timer(struct cfq_data *cfqd)
339 + * for devices that support queuing, otherwise we still have a problem
340 + * with sync vs async workloads.
341 + */
342 +- if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag)
343 ++ if (blk_queue_nonrot(cfqd->queue) && cfqd->hw_tag &&
344 ++ !cfqd->cfq_group_idle)
345 + return;
346 +
347 + WARN_ON(!RB_EMPTY_ROOT(&cfqq->sort_list));
348 +@@ -3810,7 +3811,8 @@ cfq_get_queue(struct cfq_data *cfqd, bool is_sync, struct cfq_io_cq *cic,
349 + goto out;
350 + }
351 +
352 +- cfqq = kmem_cache_alloc_node(cfq_pool, GFP_NOWAIT | __GFP_ZERO,
353 ++ cfqq = kmem_cache_alloc_node(cfq_pool,
354 ++ GFP_NOWAIT | __GFP_ZERO | __GFP_NOWARN,
355 + cfqd->queue->node);
356 + if (!cfqq) {
357 + cfqq = &cfqd->oom_cfqq;
358 +diff --git a/block/partitions/aix.c b/block/partitions/aix.c
359 +index f3ed7b2d89bf..8e7d358e0226 100644
360 +--- a/block/partitions/aix.c
361 ++++ b/block/partitions/aix.c
362 +@@ -177,7 +177,7 @@ int aix_partition(struct parsed_partitions *state)
363 + u32 vgda_sector = 0;
364 + u32 vgda_len = 0;
365 + int numlvs = 0;
366 +- struct pvd *pvd;
367 ++ struct pvd *pvd = NULL;
368 + struct lv_info {
369 + unsigned short pps_per_lv;
370 + unsigned short pps_found;
371 +@@ -231,10 +231,11 @@ int aix_partition(struct parsed_partitions *state)
372 + if (lvip[i].pps_per_lv)
373 + foundlvs += 1;
374 + }
375 ++ /* pvd loops depend on n[].name and lvip[].pps_per_lv */
376 ++ pvd = alloc_pvd(state, vgda_sector + 17);
377 + }
378 + put_dev_sector(sect);
379 + }
380 +- pvd = alloc_pvd(state, vgda_sector + 17);
381 + if (pvd) {
382 + int numpps = be16_to_cpu(pvd->pp_count);
383 + int psn_part1 = be32_to_cpu(pvd->psn_part1);
384 +@@ -281,10 +282,14 @@ int aix_partition(struct parsed_partitions *state)
385 + next_lp_ix += 1;
386 + }
387 + for (i = 0; i < state->limit; i += 1)
388 +- if (lvip[i].pps_found && !lvip[i].lv_is_contiguous)
389 ++ if (lvip[i].pps_found && !lvip[i].lv_is_contiguous) {
390 ++ char tmp[sizeof(n[i].name) + 1]; // null char
391 ++
392 ++ snprintf(tmp, sizeof(tmp), "%s", n[i].name);
393 + pr_warn("partition %s (%u pp's found) is "
394 + "not contiguous\n",
395 +- n[i].name, lvip[i].pps_found);
396 ++ tmp, lvip[i].pps_found);
397 ++ }
398 + kfree(pvd);
399 + }
400 + kfree(n);
401 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
402 +index 9628fa131757..8116cb2fef2d 100644
403 +--- a/drivers/ata/libahci.c
404 ++++ b/drivers/ata/libahci.c
405 +@@ -2113,6 +2113,8 @@ static void ahci_set_aggressive_devslp(struct ata_port *ap, bool sleep)
406 + deto = 20;
407 + }
408 +
409 ++ /* Make dito, mdat, deto bits to 0s */
410 ++ devslp &= ~GENMASK_ULL(24, 2);
411 + devslp |= ((dito << PORT_DEVSLP_DITO_OFFSET) |
412 + (mdat << PORT_DEVSLP_MDAT_OFFSET) |
413 + (deto << PORT_DEVSLP_DETO_OFFSET) |
414 +diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
415 +index ec6af1595062..4685bd10c473 100644
416 +--- a/drivers/bluetooth/Kconfig
417 ++++ b/drivers/bluetooth/Kconfig
418 +@@ -125,6 +125,7 @@ config BT_HCIUART_LL
419 + config BT_HCIUART_3WIRE
420 + bool "Three-wire UART (H5) protocol support"
421 + depends on BT_HCIUART
422 ++ depends on BT_HCIUART_SERDEV
423 + help
424 + The HCI Three-wire UART Transport Layer makes it possible to
425 + user the Bluetooth HCI over a serial port interface. The HCI
426 +diff --git a/drivers/crypto/vmx/aes_cbc.c b/drivers/crypto/vmx/aes_cbc.c
427 +index 9506e8693c81..d8ef1147b344 100644
428 +--- a/drivers/crypto/vmx/aes_cbc.c
429 ++++ b/drivers/crypto/vmx/aes_cbc.c
430 +@@ -111,24 +111,23 @@ static int p8_aes_cbc_encrypt(struct blkcipher_desc *desc,
431 + ret = crypto_blkcipher_encrypt(&fallback_desc, dst, src,
432 + nbytes);
433 + } else {
434 +- preempt_disable();
435 +- pagefault_disable();
436 +- enable_kernel_altivec();
437 +- enable_kernel_vsx();
438 +-
439 + blkcipher_walk_init(&walk, dst, src, nbytes);
440 + ret = blkcipher_walk_virt(desc, &walk);
441 + while ((nbytes = walk.nbytes)) {
442 ++ preempt_disable();
443 ++ pagefault_disable();
444 ++ enable_kernel_vsx();
445 ++ enable_kernel_altivec();
446 + aes_p8_cbc_encrypt(walk.src.virt.addr,
447 + walk.dst.virt.addr,
448 + nbytes & AES_BLOCK_MASK,
449 + &ctx->enc_key, walk.iv, 1);
450 ++ pagefault_enable();
451 ++ preempt_enable();
452 ++
453 + nbytes &= AES_BLOCK_SIZE - 1;
454 + ret = blkcipher_walk_done(desc, &walk, nbytes);
455 + }
456 +-
457 +- pagefault_enable();
458 +- preempt_enable();
459 + }
460 +
461 + return ret;
462 +@@ -152,24 +151,23 @@ static int p8_aes_cbc_decrypt(struct blkcipher_desc *desc,
463 + ret = crypto_blkcipher_decrypt(&fallback_desc, dst, src,
464 + nbytes);
465 + } else {
466 +- preempt_disable();
467 +- pagefault_disable();
468 +- enable_kernel_altivec();
469 +- enable_kernel_vsx();
470 +-
471 + blkcipher_walk_init(&walk, dst, src, nbytes);
472 + ret = blkcipher_walk_virt(desc, &walk);
473 + while ((nbytes = walk.nbytes)) {
474 ++ preempt_disable();
475 ++ pagefault_disable();
476 ++ enable_kernel_vsx();
477 ++ enable_kernel_altivec();
478 + aes_p8_cbc_encrypt(walk.src.virt.addr,
479 + walk.dst.virt.addr,
480 + nbytes & AES_BLOCK_MASK,
481 + &ctx->dec_key, walk.iv, 0);
482 ++ pagefault_enable();
483 ++ preempt_enable();
484 ++
485 + nbytes &= AES_BLOCK_SIZE - 1;
486 + ret = blkcipher_walk_done(desc, &walk, nbytes);
487 + }
488 +-
489 +- pagefault_enable();
490 +- preempt_enable();
491 + }
492 +
493 + return ret;
494 +diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
495 +index 5536108aa9db..fe21734bbe5c 100644
496 +--- a/drivers/gpio/gpio-ml-ioh.c
497 ++++ b/drivers/gpio/gpio-ml-ioh.c
498 +@@ -495,9 +495,10 @@ err_irq_alloc_descs:
499 +
500 + chip = chip_save;
501 + err_gpiochip_add:
502 ++ chip = chip_save;
503 + while (--i >= 0) {
504 +- chip--;
505 + gpiochip_remove(&chip->gpio);
506 ++ chip++;
507 + }
508 + kfree(chip_save);
509 +
510 +diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
511 +index 896bf29776b0..fb2c1df4f588 100644
512 +--- a/drivers/gpio/gpio-tegra.c
513 ++++ b/drivers/gpio/gpio-tegra.c
514 +@@ -591,4 +591,4 @@ static int __init tegra_gpio_init(void)
515 + {
516 + return platform_driver_register(&tegra_gpio_driver);
517 + }
518 +-postcore_initcall(tegra_gpio_init);
519 ++subsys_initcall(tegra_gpio_init);
520 +diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
521 +index 85f39cc3e276..47581c32b1e1 100644
522 +--- a/drivers/i2c/busses/i2c-i801.c
523 ++++ b/drivers/i2c/busses/i2c-i801.c
524 +@@ -128,6 +128,7 @@
525 +
526 + #define SBREG_BAR 0x10
527 + #define SBREG_SMBCTRL 0xc6000c
528 ++#define SBREG_SMBCTRL_DNV 0xcf000c
529 +
530 + /* Host status bits for SMBPCISTS */
531 + #define SMBPCISTS_INTS 0x08
532 +@@ -1251,7 +1252,11 @@ static void i801_add_tco(struct i801_priv *priv)
533 + spin_unlock(&p2sb_spinlock);
534 +
535 + res = &tco_res[ICH_RES_MEM_OFF];
536 +- res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
537 ++ if (pci_dev->device == PCI_DEVICE_ID_INTEL_DNV_SMBUS)
538 ++ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL_DNV;
539 ++ else
540 ++ res->start = (resource_size_t)base64_addr + SBREG_SMBCTRL;
541 ++
542 + res->end = res->start + 3;
543 + res->flags = IORESOURCE_MEM;
544 +
545 +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
546 +index 0b20449e48cf..da9acec1a029 100644
547 +--- a/drivers/i2c/busses/i2c-xiic.c
548 ++++ b/drivers/i2c/busses/i2c-xiic.c
549 +@@ -533,6 +533,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
550 + {
551 + u8 rx_watermark;
552 + struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg;
553 ++ unsigned long flags;
554 +
555 + /* Clear and enable Rx full interrupt. */
556 + xiic_irq_clr_en(i2c, XIIC_INTR_RX_FULL_MASK | XIIC_INTR_TX_ERROR_MASK);
557 +@@ -548,6 +549,7 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
558 + rx_watermark = IIC_RX_FIFO_DEPTH;
559 + xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rx_watermark - 1);
560 +
561 ++ local_irq_save(flags);
562 + if (!(msg->flags & I2C_M_NOSTART))
563 + /* write the address */
564 + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
565 +@@ -558,6 +560,8 @@ static void xiic_start_recv(struct xiic_i2c *i2c)
566 +
567 + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET,
568 + msg->len | ((i2c->nmsgs == 1) ? XIIC_TX_DYN_STOP_MASK : 0));
569 ++ local_irq_restore(flags);
570 ++
571 + if (i2c->nmsgs == 1)
572 + /* very last, enable bus not busy as well */
573 + xiic_irq_clr_en(i2c, XIIC_INTR_BNB_MASK);
574 +diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
575 +index d57a78ec7425..0f42411d6a79 100644
576 +--- a/drivers/infiniband/core/cma.c
577 ++++ b/drivers/infiniband/core/cma.c
578 +@@ -1280,9 +1280,16 @@ static bool cma_match_net_dev(const struct rdma_cm_id *id,
579 + (addr->src_addr.ss_family == AF_IB ||
580 + cma_protocol_roce_dev_port(id->device, port_num));
581 +
582 +- return !addr->dev_addr.bound_dev_if ||
583 +- (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
584 +- addr->dev_addr.bound_dev_if == net_dev->ifindex);
585 ++ /*
586 ++ * Net namespaces must match, and if the listner is listening
587 ++ * on a specific netdevice than netdevice must match as well.
588 ++ */
589 ++ if (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
590 ++ (!!addr->dev_addr.bound_dev_if ==
591 ++ (addr->dev_addr.bound_dev_if == net_dev->ifindex)))
592 ++ return true;
593 ++ else
594 ++ return false;
595 + }
596 +
597 + static struct rdma_id_private *cma_find_listener(
598 +diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
599 +index 88dfe3008cf4..be2f2521c1c5 100644
600 +--- a/drivers/input/touchscreen/atmel_mxt_ts.c
601 ++++ b/drivers/input/touchscreen/atmel_mxt_ts.c
602 +@@ -1593,10 +1593,11 @@ static int mxt_get_object_table(struct mxt_data *data)
603 + break;
604 + case MXT_TOUCH_MULTI_T9:
605 + data->multitouch = MXT_TOUCH_MULTI_T9;
606 ++ /* Only handle messages from first T9 instance */
607 + data->T9_reportid_min = min_id;
608 +- data->T9_reportid_max = max_id;
609 +- data->num_touchids = object->num_report_ids
610 +- * mxt_obj_instances(object);
611 ++ data->T9_reportid_max = min_id +
612 ++ object->num_report_ids - 1;
613 ++ data->num_touchids = object->num_report_ids;
614 + break;
615 + case MXT_SPT_MESSAGECOUNT_T44:
616 + data->T44_address = object->start_address;
617 +diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
618 +index dfb868e2d129..624e7ff76166 100644
619 +--- a/drivers/iommu/ipmmu-vmsa.c
620 ++++ b/drivers/iommu/ipmmu-vmsa.c
621 +@@ -44,7 +44,7 @@ struct ipmmu_vmsa_domain {
622 + struct io_pgtable_ops *iop;
623 +
624 + unsigned int context_id;
625 +- spinlock_t lock; /* Protects mappings */
626 ++ struct mutex mutex; /* Protects mappings */
627 + };
628 +
629 + struct ipmmu_vmsa_archdata {
630 +@@ -464,7 +464,7 @@ static struct iommu_domain *ipmmu_domain_alloc(unsigned type)
631 + if (!domain)
632 + return NULL;
633 +
634 +- spin_lock_init(&domain->lock);
635 ++ mutex_init(&domain->mutex);
636 +
637 + return &domain->io_domain;
638 + }
639 +@@ -488,7 +488,6 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
640 + struct ipmmu_vmsa_archdata *archdata = dev->archdata.iommu;
641 + struct ipmmu_vmsa_device *mmu = archdata->mmu;
642 + struct ipmmu_vmsa_domain *domain = to_vmsa_domain(io_domain);
643 +- unsigned long flags;
644 + unsigned int i;
645 + int ret = 0;
646 +
647 +@@ -497,7 +496,7 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
648 + return -ENXIO;
649 + }
650 +
651 +- spin_lock_irqsave(&domain->lock, flags);
652 ++ mutex_lock(&domain->mutex);
653 +
654 + if (!domain->mmu) {
655 + /* The domain hasn't been used yet, initialize it. */
656 +@@ -513,7 +512,7 @@ static int ipmmu_attach_device(struct iommu_domain *io_domain,
657 + ret = -EINVAL;
658 + }
659 +
660 +- spin_unlock_irqrestore(&domain->lock, flags);
661 ++ mutex_unlock(&domain->mutex);
662 +
663 + if (ret < 0)
664 + return ret;
665 +diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
666 +index f9512bfa6c3c..0a41132ffba7 100644
667 +--- a/drivers/macintosh/via-pmu.c
668 ++++ b/drivers/macintosh/via-pmu.c
669 +@@ -530,8 +530,9 @@ init_pmu(void)
670 + int timeout;
671 + struct adb_request req;
672 +
673 +- out_8(&via[B], via[B] | TREQ); /* negate TREQ */
674 +- out_8(&via[DIRB], (via[DIRB] | TREQ) & ~TACK); /* TACK in, TREQ out */
675 ++ /* Negate TREQ. Set TACK to input and TREQ to output. */
676 ++ out_8(&via[B], in_8(&via[B]) | TREQ);
677 ++ out_8(&via[DIRB], (in_8(&via[DIRB]) | TREQ) & ~TACK);
678 +
679 + pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, pmu_intr_mask);
680 + timeout = 100000;
681 +@@ -1453,8 +1454,8 @@ pmu_sr_intr(void)
682 + struct adb_request *req;
683 + int bite = 0;
684 +
685 +- if (via[B] & TREQ) {
686 +- printk(KERN_ERR "PMU: spurious SR intr (%x)\n", via[B]);
687 ++ if (in_8(&via[B]) & TREQ) {
688 ++ printk(KERN_ERR "PMU: spurious SR intr (%x)\n", in_8(&via[B]));
689 + out_8(&via[IFR], SR_INT);
690 + return NULL;
691 + }
692 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
693 +index d59b861764a1..0841d8f10a58 100644
694 +--- a/drivers/md/raid5.c
695 ++++ b/drivers/md/raid5.c
696 +@@ -4190,6 +4190,12 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s)
697 + s->failed++;
698 + if (rdev && !test_bit(Faulty, &rdev->flags))
699 + do_recovery = 1;
700 ++ else if (!rdev) {
701 ++ rdev = rcu_dereference(
702 ++ conf->disks[i].replacement);
703 ++ if (rdev && !test_bit(Faulty, &rdev->flags))
704 ++ do_recovery = 1;
705 ++ }
706 + }
707 + }
708 + if (test_bit(STRIPE_SYNCING, &sh->state)) {
709 +diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
710 +index e4e4b22eebc9..4a0f076c91ba 100644
711 +--- a/drivers/mfd/ti_am335x_tscadc.c
712 ++++ b/drivers/mfd/ti_am335x_tscadc.c
713 +@@ -224,14 +224,13 @@ static int ti_tscadc_probe(struct platform_device *pdev)
714 + * The TSC_ADC_SS controller design assumes the OCP clock is
715 + * at least 6x faster than the ADC clock.
716 + */
717 +- clk = clk_get(&pdev->dev, "adc_tsc_fck");
718 ++ clk = devm_clk_get(&pdev->dev, "adc_tsc_fck");
719 + if (IS_ERR(clk)) {
720 + dev_err(&pdev->dev, "failed to get TSC fck\n");
721 + err = PTR_ERR(clk);
722 + goto err_disable_clk;
723 + }
724 + clock_rate = clk_get_rate(clk);
725 +- clk_put(clk);
726 + tscadc->clk_div = clock_rate / ADC_CLK;
727 +
728 + /* TSCADC_CLKDIV needs to be configured to the value minus 1 */
729 +diff --git a/drivers/misc/mic/scif/scif_api.c b/drivers/misc/mic/scif/scif_api.c
730 +index ddc9e4b08b5c..56efa9d18a9a 100644
731 +--- a/drivers/misc/mic/scif/scif_api.c
732 ++++ b/drivers/misc/mic/scif/scif_api.c
733 +@@ -370,11 +370,10 @@ int scif_bind(scif_epd_t epd, u16 pn)
734 + goto scif_bind_exit;
735 + }
736 + } else {
737 +- pn = scif_get_new_port();
738 +- if (!pn) {
739 +- ret = -ENOSPC;
740 ++ ret = scif_get_new_port();
741 ++ if (ret < 0)
742 + goto scif_bind_exit;
743 +- }
744 ++ pn = ret;
745 + }
746 +
747 + ep->state = SCIFEP_BOUND;
748 +@@ -648,13 +647,12 @@ int __scif_connect(scif_epd_t epd, struct scif_port_id *dst, bool non_block)
749 + err = -EISCONN;
750 + break;
751 + case SCIFEP_UNBOUND:
752 +- ep->port.port = scif_get_new_port();
753 +- if (!ep->port.port) {
754 +- err = -ENOSPC;
755 +- } else {
756 +- ep->port.node = scif_info.nodeid;
757 +- ep->conn_async_state = ASYNC_CONN_IDLE;
758 +- }
759 ++ err = scif_get_new_port();
760 ++ if (err < 0)
761 ++ break;
762 ++ ep->port.port = err;
763 ++ ep->port.node = scif_info.nodeid;
764 ++ ep->conn_async_state = ASYNC_CONN_IDLE;
765 + /* Fall through */
766 + case SCIFEP_BOUND:
767 + /*
768 +diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
769 +index 71b64550b591..a1bca836e506 100644
770 +--- a/drivers/misc/ti-st/st_kim.c
771 ++++ b/drivers/misc/ti-st/st_kim.c
772 +@@ -757,14 +757,14 @@ static int kim_probe(struct platform_device *pdev)
773 + err = gpio_request(kim_gdata->nshutdown, "kim");
774 + if (unlikely(err)) {
775 + pr_err(" gpio %d request failed ", kim_gdata->nshutdown);
776 +- return err;
777 ++ goto err_sysfs_group;
778 + }
779 +
780 + /* Configure nShutdown GPIO as output=0 */
781 + err = gpio_direction_output(kim_gdata->nshutdown, 0);
782 + if (unlikely(err)) {
783 + pr_err(" unable to configure gpio %d", kim_gdata->nshutdown);
784 +- return err;
785 ++ goto err_sysfs_group;
786 + }
787 + /* get reference of pdev for request_firmware
788 + */
789 +diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
790 +index 518e2dec2aa2..5e9122cd3898 100644
791 +--- a/drivers/misc/vmw_balloon.c
792 ++++ b/drivers/misc/vmw_balloon.c
793 +@@ -45,6 +45,7 @@
794 + #include <linux/seq_file.h>
795 + #include <linux/vmw_vmci_defs.h>
796 + #include <linux/vmw_vmci_api.h>
797 ++#include <linux/io.h>
798 + #include <asm/hypervisor.h>
799 +
800 + MODULE_AUTHOR("VMware, Inc.");
801 +diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
802 +index b3c1b8106a68..f4b3ce2b2bc3 100644
803 +--- a/drivers/mtd/ubi/wl.c
804 ++++ b/drivers/mtd/ubi/wl.c
805 +@@ -1597,8 +1597,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
806 + cond_resched();
807 +
808 + e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
809 +- if (!e)
810 ++ if (!e) {
811 ++ err = -ENOMEM;
812 + goto out_free;
813 ++ }
814 +
815 + e->pnum = aeb->pnum;
816 + e->ec = aeb->ec;
817 +@@ -1617,8 +1619,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
818 + cond_resched();
819 +
820 + e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
821 +- if (!e)
822 ++ if (!e) {
823 ++ err = -ENOMEM;
824 + goto out_free;
825 ++ }
826 +
827 + e->pnum = aeb->pnum;
828 + e->ec = aeb->ec;
829 +diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
830 +index ea693bbf56d8..1c300259d70a 100644
831 +--- a/drivers/net/ethernet/marvell/mvneta.c
832 ++++ b/drivers/net/ethernet/marvell/mvneta.c
833 +@@ -2569,7 +2569,6 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
834 + }
835 +
836 + mvneta_start_dev(pp);
837 +- mvneta_port_up(pp);
838 +
839 + netdev_update_features(dev);
840 +
841 +diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
842 +index c69b0bdd891d..c2e110b2549b 100644
843 +--- a/drivers/net/ethernet/ti/cpsw.c
844 ++++ b/drivers/net/ethernet/ti/cpsw.c
845 +@@ -371,7 +371,6 @@ struct cpsw_priv {
846 + spinlock_t lock;
847 + struct platform_device *pdev;
848 + struct net_device *ndev;
849 +- struct device_node *phy_node;
850 + struct napi_struct napi_rx;
851 + struct napi_struct napi_tx;
852 + struct device *dev;
853 +@@ -1165,8 +1164,8 @@ static void cpsw_slave_open(struct cpsw_slave *slave, struct cpsw_priv *priv)
854 + cpsw_ale_add_mcast(priv->ale, priv->ndev->broadcast,
855 + 1 << slave_port, 0, 0, ALE_MCAST_FWD_2);
856 +
857 +- if (priv->phy_node)
858 +- slave->phy = of_phy_connect(priv->ndev, priv->phy_node,
859 ++ if (slave->data->phy_node)
860 ++ slave->phy = of_phy_connect(priv->ndev, slave->data->phy_node,
861 + &cpsw_adjust_link, 0, slave->data->phy_if);
862 + else
863 + slave->phy = phy_connect(priv->ndev, slave->data->phy_id,
864 +@@ -1957,12 +1956,11 @@ static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_priv *priv,
865 + slave->port_vlan = data->dual_emac_res_vlan;
866 + }
867 +
868 +-static int cpsw_probe_dt(struct cpsw_priv *priv,
869 ++static int cpsw_probe_dt(struct cpsw_platform_data *data,
870 + struct platform_device *pdev)
871 + {
872 + struct device_node *node = pdev->dev.of_node;
873 + struct device_node *slave_node;
874 +- struct cpsw_platform_data *data = &priv->data;
875 + int i = 0, ret;
876 + u32 prop;
877 +
878 +@@ -2050,7 +2048,8 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
879 + if (strcmp(slave_node->name, "slave"))
880 + continue;
881 +
882 +- priv->phy_node = of_parse_phandle(slave_node, "phy-handle", 0);
883 ++ slave_data->phy_node = of_parse_phandle(slave_node,
884 ++ "phy-handle", 0);
885 + parp = of_get_property(slave_node, "phy_id", &lenp);
886 + if (of_phy_is_fixed_link(slave_node)) {
887 + struct device_node *phy_node;
888 +@@ -2087,6 +2086,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv,
889 + }
890 + snprintf(slave_data->phy_id, sizeof(slave_data->phy_id),
891 + PHY_ID_FMT, mdio->name, phyid);
892 ++ put_device(&mdio->dev);
893 + } else {
894 + dev_err(&pdev->dev, "No slave[%d] phy_id or fixed-link property\n", i);
895 + goto no_phy_slave;
896 +@@ -2291,7 +2291,7 @@ static int cpsw_probe(struct platform_device *pdev)
897 + /* Select default pin state */
898 + pinctrl_pm_select_default_state(&pdev->dev);
899 +
900 +- if (cpsw_probe_dt(priv, pdev)) {
901 ++ if (cpsw_probe_dt(&priv->data, pdev)) {
902 + dev_err(&pdev->dev, "cpsw: platform data missing\n");
903 + ret = -ENODEV;
904 + goto clean_runtime_disable_ret;
905 +diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
906 +index 442a7038e660..e50afd1b2eda 100644
907 +--- a/drivers/net/ethernet/ti/cpsw.h
908 ++++ b/drivers/net/ethernet/ti/cpsw.h
909 +@@ -18,6 +18,7 @@
910 + #include <linux/phy.h>
911 +
912 + struct cpsw_slave_data {
913 ++ struct device_node *phy_node;
914 + char phy_id[MII_BUS_ID_SIZE];
915 + int phy_if;
916 + u8 mac_addr[ETH_ALEN];
917 +diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
918 +index 6be315303d61..8ecb24186b7f 100644
919 +--- a/drivers/net/ethernet/ti/davinci_emac.c
920 ++++ b/drivers/net/ethernet/ti/davinci_emac.c
921 +@@ -2108,6 +2108,7 @@ static int davinci_emac_remove(struct platform_device *pdev)
922 + cpdma_ctlr_destroy(priv->dma);
923 +
924 + unregister_netdev(ndev);
925 ++ of_node_put(priv->phy_node);
926 + free_netdev(ndev);
927 +
928 + return 0;
929 +diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
930 +index 916b9b12edd2..4644357d291a 100644
931 +--- a/drivers/net/wireless/ath/ath10k/mac.c
932 ++++ b/drivers/net/wireless/ath/ath10k/mac.c
933 +@@ -2901,6 +2901,13 @@ static int ath10k_update_channel_list(struct ath10k *ar)
934 + passive = channel->flags & IEEE80211_CHAN_NO_IR;
935 + ch->passive = passive;
936 +
937 ++ /* the firmware is ignoring the "radar" flag of the
938 ++ * channel and is scanning actively using Probe Requests
939 ++ * on "Radar detection"/DFS channels which are not
940 ++ * marked as "available"
941 ++ */
942 ++ ch->passive |= ch->chan_radar;
943 ++
944 + ch->freq = channel->center_freq;
945 + ch->band_center_freq1 = channel->center_freq;
946 + ch->min_power = 0;
947 +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
948 +index 02eea3c3b5d3..c72eb4464de9 100644
949 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
950 ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
951 +@@ -1424,6 +1424,11 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
952 + cfg->keep_alive_pattern_size = __cpu_to_le32(0);
953 + cfg->max_tdls_concurrent_sleep_sta = __cpu_to_le32(1);
954 + cfg->max_tdls_concurrent_buffer_sta = __cpu_to_le32(1);
955 ++ cfg->wmi_send_separate = __cpu_to_le32(0);
956 ++ cfg->num_ocb_vdevs = __cpu_to_le32(0);
957 ++ cfg->num_ocb_channels = __cpu_to_le32(0);
958 ++ cfg->num_ocb_schedules = __cpu_to_le32(0);
959 ++ cfg->host_capab = __cpu_to_le32(0);
960 +
961 + ath10k_wmi_put_host_mem_chunks(ar, chunks);
962 +
963 +diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
964 +index ad655c44afdb..f5031f3965c5 100644
965 +--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
966 ++++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
967 +@@ -1209,6 +1209,11 @@ struct wmi_tlv_resource_config {
968 + __le32 keep_alive_pattern_size;
969 + __le32 max_tdls_concurrent_sleep_sta;
970 + __le32 max_tdls_concurrent_buffer_sta;
971 ++ __le32 wmi_send_separate;
972 ++ __le32 num_ocb_vdevs;
973 ++ __le32 num_ocb_channels;
974 ++ __le32 num_ocb_schedules;
975 ++ __le32 host_capab;
976 + } __packed;
977 +
978 + struct wmi_tlv_init_cmd {
979 +diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c
980 +index 5466246c69b4..b78a2f3745f2 100644
981 +--- a/drivers/scsi/3w-9xxx.c
982 ++++ b/drivers/scsi/3w-9xxx.c
983 +@@ -2045,6 +2045,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
984 +
985 + if (twa_initialize_device_extension(tw_dev)) {
986 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x25, "Failed to initialize device extension");
987 ++ retval = -ENOMEM;
988 + goto out_free_device_extension;
989 + }
990 +
991 +@@ -2067,6 +2068,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
992 + tw_dev->base_addr = ioremap(mem_addr, mem_len);
993 + if (!tw_dev->base_addr) {
994 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x35, "Failed to ioremap");
995 ++ retval = -ENOMEM;
996 + goto out_release_mem_region;
997 + }
998 +
999 +@@ -2074,8 +2076,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1000 + TW_DISABLE_INTERRUPTS(tw_dev);
1001 +
1002 + /* Initialize the card */
1003 +- if (twa_reset_sequence(tw_dev, 0))
1004 ++ if (twa_reset_sequence(tw_dev, 0)) {
1005 ++ retval = -ENOMEM;
1006 + goto out_iounmap;
1007 ++ }
1008 +
1009 + /* Set host specific parameters */
1010 + if ((pdev->device == PCI_DEVICE_ID_3WARE_9650SE) ||
1011 +diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
1012 +index f8374850f714..f0a5536a9ff5 100644
1013 +--- a/drivers/scsi/3w-sas.c
1014 ++++ b/drivers/scsi/3w-sas.c
1015 +@@ -1600,6 +1600,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1016 +
1017 + if (twl_initialize_device_extension(tw_dev)) {
1018 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1a, "Failed to initialize device extension");
1019 ++ retval = -ENOMEM;
1020 + goto out_free_device_extension;
1021 + }
1022 +
1023 +@@ -1614,6 +1615,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1024 + tw_dev->base_addr = pci_iomap(pdev, 1, 0);
1025 + if (!tw_dev->base_addr) {
1026 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1c, "Failed to ioremap");
1027 ++ retval = -ENOMEM;
1028 + goto out_release_mem_region;
1029 + }
1030 +
1031 +@@ -1623,6 +1625,7 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1032 + /* Initialize the card */
1033 + if (twl_reset_sequence(tw_dev, 0)) {
1034 + TW_PRINTK(tw_dev->host, TW_DRIVER, 0x1d, "Controller reset failed during probe");
1035 ++ retval = -ENOMEM;
1036 + goto out_iounmap;
1037 + }
1038 +
1039 +diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c
1040 +index 14af38036287..308a4206b636 100644
1041 +--- a/drivers/scsi/3w-xxxx.c
1042 ++++ b/drivers/scsi/3w-xxxx.c
1043 +@@ -2278,6 +2278,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1044 +
1045 + if (tw_initialize_device_extension(tw_dev)) {
1046 + printk(KERN_WARNING "3w-xxxx: Failed to initialize device extension.");
1047 ++ retval = -ENOMEM;
1048 + goto out_free_device_extension;
1049 + }
1050 +
1051 +@@ -2292,6 +2293,7 @@ static int tw_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
1052 + tw_dev->base_addr = pci_resource_start(pdev, 0);
1053 + if (!tw_dev->base_addr) {
1054 + printk(KERN_WARNING "3w-xxxx: Failed to get io address.");
1055 ++ retval = -ENOMEM;
1056 + goto out_release_mem_region;
1057 + }
1058 +
1059 +diff --git a/drivers/staging/rts5208/rtsx_scsi.c b/drivers/staging/rts5208/rtsx_scsi.c
1060 +index 12a3893b98fd..ade29c4295b7 100644
1061 +--- a/drivers/staging/rts5208/rtsx_scsi.c
1062 ++++ b/drivers/staging/rts5208/rtsx_scsi.c
1063 +@@ -536,7 +536,7 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip)
1064 +
1065 + if (sendbytes > 8) {
1066 + memcpy(buf, inquiry_buf, 8);
1067 +- memcpy(buf + 8, inquiry_string, sendbytes - 8);
1068 ++ strncpy(buf + 8, inquiry_string, sendbytes - 8);
1069 + if (pro_formatter_flag) {
1070 + /* Additional Length */
1071 + buf[4] = 0x33;
1072 +diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
1073 +index 10fea7bb8f30..3db4a2570b19 100644
1074 +--- a/drivers/staging/rts5208/xd.c
1075 ++++ b/drivers/staging/rts5208/xd.c
1076 +@@ -1252,7 +1252,7 @@ static int xd_copy_page(struct rtsx_chip *chip, u32 old_blk, u32 new_blk,
1077 + reg = 0;
1078 + rtsx_read_register(chip, XD_CTL, &reg);
1079 + if (reg & (XD_ECC1_ERROR | XD_ECC2_ERROR)) {
1080 +- wait_timeout(100);
1081 ++ mdelay(100);
1082 +
1083 + if (detect_card_cd(chip,
1084 + XD_CARD) != STATUS_SUCCESS) {
1085 +diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
1086 +index 21f888ac550e..7199bac67333 100644
1087 +--- a/drivers/target/target_core_transport.c
1088 ++++ b/drivers/target/target_core_transport.c
1089 +@@ -306,6 +306,7 @@ void __transport_register_session(
1090 + {
1091 + const struct target_core_fabric_ops *tfo = se_tpg->se_tpg_tfo;
1092 + unsigned char buf[PR_REG_ISID_LEN];
1093 ++ unsigned long flags;
1094 +
1095 + se_sess->se_tpg = se_tpg;
1096 + se_sess->fabric_sess_ptr = fabric_sess_ptr;
1097 +@@ -342,7 +343,7 @@ void __transport_register_session(
1098 + se_sess->sess_bin_isid = get_unaligned_be64(&buf[0]);
1099 + }
1100 +
1101 +- spin_lock_irq(&se_nacl->nacl_sess_lock);
1102 ++ spin_lock_irqsave(&se_nacl->nacl_sess_lock, flags);
1103 + /*
1104 + * The se_nacl->nacl_sess pointer will be set to the
1105 + * last active I_T Nexus for each struct se_node_acl.
1106 +@@ -351,7 +352,7 @@ void __transport_register_session(
1107 +
1108 + list_add_tail(&se_sess->sess_acl_list,
1109 + &se_nacl->acl_sess_list);
1110 +- spin_unlock_irq(&se_nacl->nacl_sess_lock);
1111 ++ spin_unlock_irqrestore(&se_nacl->nacl_sess_lock, flags);
1112 + }
1113 + list_add_tail(&se_sess->sess_list, &se_tpg->tpg_sess_list);
1114 +
1115 +diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
1116 +index 802eac7e561b..2b8f2e0a4224 100644
1117 +--- a/drivers/tty/rocket.c
1118 ++++ b/drivers/tty/rocket.c
1119 +@@ -1915,7 +1915,7 @@ static __init int register_PCI(int i, struct pci_dev *dev)
1120 + ByteIO_t UPCIRingInd = 0;
1121 +
1122 + if (!dev || !pci_match_id(rocket_pci_ids, dev) ||
1123 +- pci_enable_device(dev))
1124 ++ pci_enable_device(dev) || i >= NUM_BOARDS)
1125 + return 0;
1126 +
1127 + rcktpt_io_addr[i] = pci_resource_start(dev, 0);
1128 +diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
1129 +index bcc1fc027311..b9823eb9c195 100644
1130 +--- a/drivers/uio/uio.c
1131 ++++ b/drivers/uio/uio.c
1132 +@@ -833,8 +833,6 @@ int __uio_register_device(struct module *owner,
1133 + if (ret)
1134 + goto err_uio_dev_add_attributes;
1135 +
1136 +- info->uio_dev = idev;
1137 +-
1138 + if (info->irq && (info->irq != UIO_IRQ_CUSTOM)) {
1139 + /*
1140 + * Note that we deliberately don't use devm_request_irq
1141 +@@ -850,6 +848,7 @@ int __uio_register_device(struct module *owner,
1142 + goto err_request_irq;
1143 + }
1144 +
1145 ++ info->uio_dev = idev;
1146 + return 0;
1147 +
1148 + err_request_irq:
1149 +diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1150 +index 128a3c0a9286..9dbf1583bd7a 100644
1151 +--- a/drivers/usb/host/xhci.c
1152 ++++ b/drivers/usb/host/xhci.c
1153 +@@ -3675,6 +3675,9 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
1154 + }
1155 +
1156 + spin_lock_irqsave(&xhci->lock, flags);
1157 ++
1158 ++ virt_dev->udev = NULL;
1159 ++
1160 + /* Don't disable the slot if the host controller is dead. */
1161 + state = readl(&xhci->op_regs->status);
1162 + if (state == 0xffffffff || (xhci->xhc_state & XHCI_STATE_DYING) ||
1163 +diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
1164 +index 502d3892d8a4..d71e7ad4d382 100644
1165 +--- a/fs/autofs4/autofs_i.h
1166 ++++ b/fs/autofs4/autofs_i.h
1167 +@@ -18,6 +18,7 @@
1168 + #include <linux/mutex.h>
1169 + #include <linux/spinlock.h>
1170 + #include <linux/list.h>
1171 ++#include <linux/magic.h>
1172 +
1173 + /* This is the range of ioctl() numbers we claim as ours */
1174 + #define AUTOFS_IOC_FIRST AUTOFS_IOC_READY
1175 +@@ -135,7 +136,8 @@ struct autofs_sb_info {
1176 +
1177 + static inline struct autofs_sb_info *autofs4_sbi(struct super_block *sb)
1178 + {
1179 +- return (struct autofs_sb_info *)(sb->s_fs_info);
1180 ++ return sb->s_magic != AUTOFS_SUPER_MAGIC ?
1181 ++ NULL : (struct autofs_sb_info *)(sb->s_fs_info);
1182 + }
1183 +
1184 + static inline struct autofs_info *autofs4_dentry_ino(struct dentry *dentry)
1185 +diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
1186 +index a3ae0b2aeb5a..1132fe71b312 100644
1187 +--- a/fs/autofs4/inode.c
1188 ++++ b/fs/autofs4/inode.c
1189 +@@ -18,7 +18,6 @@
1190 + #include <linux/pagemap.h>
1191 + #include <linux/parser.h>
1192 + #include <linux/bitops.h>
1193 +-#include <linux/magic.h>
1194 + #include "autofs_i.h"
1195 + #include <linux/module.h>
1196 +
1197 +diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h
1198 +index ee44d346ea44..bfa1d31f79aa 100644
1199 +--- a/fs/f2fs/segment.h
1200 ++++ b/fs/f2fs/segment.h
1201 +@@ -381,6 +381,8 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
1202 + if (test_and_clear_bit(segno, free_i->free_segmap)) {
1203 + free_i->free_segments++;
1204 +
1205 ++ if (IS_CURSEC(sbi, secno))
1206 ++ goto skip_free;
1207 + next = find_next_bit(free_i->free_segmap,
1208 + start_segno + sbi->segs_per_sec, start_segno);
1209 + if (next >= start_segno + sbi->segs_per_sec) {
1210 +@@ -388,6 +390,7 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi,
1211 + free_i->free_sections++;
1212 + }
1213 + }
1214 ++skip_free:
1215 + spin_unlock(&free_i->segmap_lock);
1216 + }
1217 +
1218 +diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
1219 +index 6cc67e1bbb41..2ffc53d0c9c7 100644
1220 +--- a/fs/f2fs/super.c
1221 ++++ b/fs/f2fs/super.c
1222 +@@ -1079,12 +1079,17 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
1223 + struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi);
1224 + struct f2fs_checkpoint *ckpt = F2FS_CKPT(sbi);
1225 + unsigned int main_segs, blocks_per_seg;
1226 ++ unsigned int sit_segs, nat_segs;
1227 ++ unsigned int sit_bitmap_size, nat_bitmap_size;
1228 ++ unsigned int log_blocks_per_seg;
1229 + int i;
1230 +
1231 + total = le32_to_cpu(raw_super->segment_count);
1232 + fsmeta = le32_to_cpu(raw_super->segment_count_ckpt);
1233 +- fsmeta += le32_to_cpu(raw_super->segment_count_sit);
1234 +- fsmeta += le32_to_cpu(raw_super->segment_count_nat);
1235 ++ sit_segs = le32_to_cpu(raw_super->segment_count_sit);
1236 ++ fsmeta += sit_segs;
1237 ++ nat_segs = le32_to_cpu(raw_super->segment_count_nat);
1238 ++ fsmeta += nat_segs;
1239 + fsmeta += le32_to_cpu(ckpt->rsvd_segment_count);
1240 + fsmeta += le32_to_cpu(raw_super->segment_count_ssa);
1241 +
1242 +@@ -1105,6 +1110,18 @@ static int sanity_check_ckpt(struct f2fs_sb_info *sbi)
1243 + return 1;
1244 + }
1245 +
1246 ++ sit_bitmap_size = le32_to_cpu(ckpt->sit_ver_bitmap_bytesize);
1247 ++ nat_bitmap_size = le32_to_cpu(ckpt->nat_ver_bitmap_bytesize);
1248 ++ log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg);
1249 ++
1250 ++ if (sit_bitmap_size != ((sit_segs / 2) << log_blocks_per_seg) / 8 ||
1251 ++ nat_bitmap_size != ((nat_segs / 2) << log_blocks_per_seg) / 8) {
1252 ++ f2fs_msg(sbi->sb, KERN_ERR,
1253 ++ "Wrong bitmap size: sit: %u, nat:%u",
1254 ++ sit_bitmap_size, nat_bitmap_size);
1255 ++ return 1;
1256 ++ }
1257 ++
1258 + if (unlikely(f2fs_cp_error(sbi))) {
1259 + f2fs_msg(sbi->sb, KERN_ERR, "A bug case: need to run fsck");
1260 + return 1;
1261 +diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
1262 +index e2e857affbf2..0647cb1ede56 100644
1263 +--- a/fs/nfs/callback_xdr.c
1264 ++++ b/fs/nfs/callback_xdr.c
1265 +@@ -911,16 +911,21 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
1266 +
1267 + if (hdr_arg.minorversion == 0) {
1268 + cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
1269 +- if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
1270 ++ if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp)) {
1271 ++ if (cps.clp)
1272 ++ nfs_put_client(cps.clp);
1273 + goto out_invalidcred;
1274 ++ }
1275 + }
1276 +
1277 + cps.minorversion = hdr_arg.minorversion;
1278 + hdr_res.taglen = hdr_arg.taglen;
1279 + hdr_res.tag = hdr_arg.tag;
1280 +- if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0)
1281 ++ if (encode_compound_hdr_res(&xdr_out, &hdr_res) != 0) {
1282 ++ if (cps.clp)
1283 ++ nfs_put_client(cps.clp);
1284 + return rpc_system_err;
1285 +-
1286 ++ }
1287 + while (status == 0 && nops != hdr_arg.nops) {
1288 + status = process_op(nops, rqstp, &xdr_in,
1289 + argp, &xdr_out, resp, &cps);
1290 +diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
1291 +index 36f4695aa604..ad2a081bac66 100644
1292 +--- a/include/linux/mm_types.h
1293 ++++ b/include/linux/mm_types.h
1294 +@@ -392,7 +392,7 @@ struct kioctx_table;
1295 + struct mm_struct {
1296 + struct vm_area_struct *mmap; /* list of VMAs */
1297 + struct rb_root mm_rb;
1298 +- u32 vmacache_seqnum; /* per-thread vmacache */
1299 ++ u64 vmacache_seqnum; /* per-thread vmacache */
1300 + #ifdef CONFIG_MMU
1301 + unsigned long (*get_unmapped_area) (struct file *filp,
1302 + unsigned long addr, unsigned long len,
1303 +diff --git a/include/linux/sched.h b/include/linux/sched.h
1304 +index 725498cc5d30..b30540d6d125 100644
1305 +--- a/include/linux/sched.h
1306 ++++ b/include/linux/sched.h
1307 +@@ -1454,7 +1454,7 @@ struct task_struct {
1308 +
1309 + struct mm_struct *mm, *active_mm;
1310 + /* per-thread vma caching */
1311 +- u32 vmacache_seqnum;
1312 ++ u64 vmacache_seqnum;
1313 + struct vm_area_struct *vmacache[VMACACHE_SIZE];
1314 + #if defined(SPLIT_RSS_COUNTING)
1315 + struct task_rss_stat rss_stat;
1316 +diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
1317 +index 8ef3a61fdc74..fdac5800872d 100644
1318 +--- a/include/linux/vm_event_item.h
1319 ++++ b/include/linux/vm_event_item.h
1320 +@@ -88,7 +88,6 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
1321 + #ifdef CONFIG_DEBUG_VM_VMACACHE
1322 + VMACACHE_FIND_CALLS,
1323 + VMACACHE_FIND_HITS,
1324 +- VMACACHE_FULL_FLUSHES,
1325 + #endif
1326 + NR_VM_EVENT_ITEMS
1327 + };
1328 +diff --git a/include/linux/vmacache.h b/include/linux/vmacache.h
1329 +index c3fa0fd43949..4f58ff2dacd6 100644
1330 +--- a/include/linux/vmacache.h
1331 ++++ b/include/linux/vmacache.h
1332 +@@ -15,7 +15,6 @@ static inline void vmacache_flush(struct task_struct *tsk)
1333 + memset(tsk->vmacache, 0, sizeof(tsk->vmacache));
1334 + }
1335 +
1336 +-extern void vmacache_flush_all(struct mm_struct *mm);
1337 + extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma);
1338 + extern struct vm_area_struct *vmacache_find(struct mm_struct *mm,
1339 + unsigned long addr);
1340 +@@ -29,10 +28,6 @@ extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,
1341 + static inline void vmacache_invalidate(struct mm_struct *mm)
1342 + {
1343 + mm->vmacache_seqnum++;
1344 +-
1345 +- /* deal with overflows */
1346 +- if (unlikely(mm->vmacache_seqnum == 0))
1347 +- vmacache_flush_all(mm);
1348 + }
1349 +
1350 + #endif /* __LINUX_VMACACHE_H */
1351 +diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
1352 +index cd1629170103..08f47e0e9f8d 100644
1353 +--- a/include/uapi/linux/ethtool.h
1354 ++++ b/include/uapi/linux/ethtool.h
1355 +@@ -819,13 +819,13 @@ struct ethtool_rx_flow_spec {
1356 + static inline __u64 ethtool_get_flow_spec_ring(__u64 ring_cookie)
1357 + {
1358 + return ETHTOOL_RX_FLOW_SPEC_RING & ring_cookie;
1359 +-};
1360 ++}
1361 +
1362 + static inline __u64 ethtool_get_flow_spec_ring_vf(__u64 ring_cookie)
1363 + {
1364 + return (ETHTOOL_RX_FLOW_SPEC_RING_VF & ring_cookie) >>
1365 + ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF;
1366 +-};
1367 ++}
1368 +
1369 + /**
1370 + * struct ethtool_rxnfc - command to get or set RX flow classification rules
1371 +diff --git a/kernel/fork.c b/kernel/fork.c
1372 +index 37ec96fe739d..dd2f79ac0771 100644
1373 +--- a/kernel/fork.c
1374 ++++ b/kernel/fork.c
1375 +@@ -1337,6 +1337,18 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1376 + if (!p)
1377 + goto fork_out;
1378 +
1379 ++ /*
1380 ++ * This _must_ happen before we call free_task(), i.e. before we jump
1381 ++ * to any of the bad_fork_* labels. This is to avoid freeing
1382 ++ * p->set_child_tid which is (ab)used as a kthread's data pointer for
1383 ++ * kernel threads (PF_KTHREAD).
1384 ++ */
1385 ++ p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1386 ++ /*
1387 ++ * Clear TID on mm_release()?
1388 ++ */
1389 ++ p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1390 ++
1391 + ftrace_graph_init_task(p);
1392 +
1393 + rt_mutex_init_task(p);
1394 +@@ -1498,11 +1510,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1395 + }
1396 + }
1397 +
1398 +- p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1399 +- /*
1400 +- * Clear TID on mm_release()?
1401 +- */
1402 +- p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1403 + #ifdef CONFIG_BLOCK
1404 + p->plug = NULL;
1405 + #endif
1406 +diff --git a/kernel/locking/osq_lock.c b/kernel/locking/osq_lock.c
1407 +index 05a37857ab55..8d7047ecef4e 100644
1408 +--- a/kernel/locking/osq_lock.c
1409 ++++ b/kernel/locking/osq_lock.c
1410 +@@ -104,6 +104,19 @@ bool osq_lock(struct optimistic_spin_queue *lock)
1411 +
1412 + prev = decode_cpu(old);
1413 + node->prev = prev;
1414 ++
1415 ++ /*
1416 ++ * osq_lock() unqueue
1417 ++ *
1418 ++ * node->prev = prev osq_wait_next()
1419 ++ * WMB MB
1420 ++ * prev->next = node next->prev = prev // unqueue-C
1421 ++ *
1422 ++ * Here 'node->prev' and 'next->prev' are the same variable and we need
1423 ++ * to ensure these stores happen in-order to avoid corrupting the list.
1424 ++ */
1425 ++ smp_wmb();
1426 ++
1427 + WRITE_ONCE(prev->next, node);
1428 +
1429 + /*
1430 +diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
1431 +index a4d4de05b2d1..1be33caf157d 100644
1432 +--- a/kernel/locking/rwsem-xadd.c
1433 ++++ b/kernel/locking/rwsem-xadd.c
1434 +@@ -510,6 +510,33 @@ struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem)
1435 + {
1436 + unsigned long flags;
1437 +
1438 ++ /*
1439 ++ * __rwsem_down_write_failed_common(sem)
1440 ++ * rwsem_optimistic_spin(sem)
1441 ++ * osq_unlock(sem->osq)
1442 ++ * ...
1443 ++ * atomic_long_add_return(&sem->count)
1444 ++ *
1445 ++ * - VS -
1446 ++ *
1447 ++ * __up_write()
1448 ++ * if (atomic_long_sub_return_release(&sem->count) < 0)
1449 ++ * rwsem_wake(sem)
1450 ++ * osq_is_locked(&sem->osq)
1451 ++ *
1452 ++ * And __up_write() must observe !osq_is_locked() when it observes the
1453 ++ * atomic_long_add_return() in order to not miss a wakeup.
1454 ++ *
1455 ++ * This boils down to:
1456 ++ *
1457 ++ * [S.rel] X = 1 [RmW] r0 = (Y += 0)
1458 ++ * MB RMB
1459 ++ * [RmW] Y += 1 [L] r1 = X
1460 ++ *
1461 ++ * exists (r0=1 /\ r1=0)
1462 ++ */
1463 ++ smp_rmb();
1464 ++
1465 + /*
1466 + * If a spinner is present, it is not necessary to do the wakeup.
1467 + * Try to do wakeup only if the trylock succeeds to minimize
1468 +diff --git a/mm/debug.c b/mm/debug.c
1469 +index 668aa35191ca..689b6e911cae 100644
1470 +--- a/mm/debug.c
1471 ++++ b/mm/debug.c
1472 +@@ -168,7 +168,7 @@ EXPORT_SYMBOL(dump_vma);
1473 +
1474 + void dump_mm(const struct mm_struct *mm)
1475 + {
1476 +- pr_emerg("mm %p mmap %p seqnum %d task_size %lu\n"
1477 ++ pr_emerg("mm %p mmap %p seqnum %llu task_size %lu\n"
1478 + #ifdef CONFIG_MMU
1479 + "get_unmapped_area %p\n"
1480 + #endif
1481 +@@ -198,7 +198,7 @@ void dump_mm(const struct mm_struct *mm)
1482 + #endif
1483 + "%s", /* This is here to hold the comma */
1484 +
1485 +- mm, mm->mmap, mm->vmacache_seqnum, mm->task_size,
1486 ++ mm, mm->mmap, (long long) mm->vmacache_seqnum, mm->task_size,
1487 + #ifdef CONFIG_MMU
1488 + mm->get_unmapped_area,
1489 + #endif
1490 +diff --git a/mm/vmacache.c b/mm/vmacache.c
1491 +index fd09dc9c6812..9c8ff3d4eda9 100644
1492 +--- a/mm/vmacache.c
1493 ++++ b/mm/vmacache.c
1494 +@@ -5,44 +5,6 @@
1495 + #include <linux/mm.h>
1496 + #include <linux/vmacache.h>
1497 +
1498 +-/*
1499 +- * Flush vma caches for threads that share a given mm.
1500 +- *
1501 +- * The operation is safe because the caller holds the mmap_sem
1502 +- * exclusively and other threads accessing the vma cache will
1503 +- * have mmap_sem held at least for read, so no extra locking
1504 +- * is required to maintain the vma cache.
1505 +- */
1506 +-void vmacache_flush_all(struct mm_struct *mm)
1507 +-{
1508 +- struct task_struct *g, *p;
1509 +-
1510 +- count_vm_vmacache_event(VMACACHE_FULL_FLUSHES);
1511 +-
1512 +- /*
1513 +- * Single threaded tasks need not iterate the entire
1514 +- * list of process. We can avoid the flushing as well
1515 +- * since the mm's seqnum was increased and don't have
1516 +- * to worry about other threads' seqnum. Current's
1517 +- * flush will occur upon the next lookup.
1518 +- */
1519 +- if (atomic_read(&mm->mm_users) == 1)
1520 +- return;
1521 +-
1522 +- rcu_read_lock();
1523 +- for_each_process_thread(g, p) {
1524 +- /*
1525 +- * Only flush the vmacache pointers as the
1526 +- * mm seqnum is already set and curr's will
1527 +- * be set upon invalidation when the next
1528 +- * lookup is done.
1529 +- */
1530 +- if (mm == p->mm)
1531 +- vmacache_flush(p);
1532 +- }
1533 +- rcu_read_unlock();
1534 +-}
1535 +-
1536 + /*
1537 + * This task may be accessing a foreign mm via (for example)
1538 + * get_user_pages()->find_vma(). The vmacache is task-local and this
1539 +diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
1540 +index 1811f8e7ddf4..552e00b07196 100644
1541 +--- a/net/bluetooth/hidp/core.c
1542 ++++ b/net/bluetooth/hidp/core.c
1543 +@@ -774,7 +774,7 @@ static int hidp_setup_hid(struct hidp_session *session,
1544 + hid->version = req->version;
1545 + hid->country = req->country;
1546 +
1547 +- strncpy(hid->name, req->name, sizeof(req->name) - 1);
1548 ++ strncpy(hid->name, req->name, sizeof(hid->name));
1549 +
1550 + snprintf(hid->phys, sizeof(hid->phys), "%pMR",
1551 + &l2cap_pi(session->ctrl_sock->sk)->chan->src);
1552 +diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
1553 +index 4f6c1862dfd2..6fe2b615518c 100644
1554 +--- a/net/dcb/dcbnl.c
1555 ++++ b/net/dcb/dcbnl.c
1556 +@@ -1763,7 +1763,7 @@ static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app,
1557 + if (itr->app.selector == app->selector &&
1558 + itr->app.protocol == app->protocol &&
1559 + itr->ifindex == ifindex &&
1560 +- (!prio || itr->app.priority == prio))
1561 ++ ((prio == -1) || itr->app.priority == prio))
1562 + return itr;
1563 + }
1564 +
1565 +@@ -1798,7 +1798,8 @@ u8 dcb_getapp(struct net_device *dev, struct dcb_app *app)
1566 + u8 prio = 0;
1567 +
1568 + spin_lock_bh(&dcb_lock);
1569 +- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1570 ++ itr = dcb_app_lookup(app, dev->ifindex, -1);
1571 ++ if (itr)
1572 + prio = itr->app.priority;
1573 + spin_unlock_bh(&dcb_lock);
1574 +
1575 +@@ -1826,7 +1827,8 @@ int dcb_setapp(struct net_device *dev, struct dcb_app *new)
1576 +
1577 + spin_lock_bh(&dcb_lock);
1578 + /* Search for existing match and replace */
1579 +- if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) {
1580 ++ itr = dcb_app_lookup(new, dev->ifindex, -1);
1581 ++ if (itr) {
1582 + if (new->priority)
1583 + itr->app.priority = new->priority;
1584 + else {
1585 +@@ -1859,7 +1861,8 @@ u8 dcb_ieee_getapp_mask(struct net_device *dev, struct dcb_app *app)
1586 + u8 prio = 0;
1587 +
1588 + spin_lock_bh(&dcb_lock);
1589 +- if ((itr = dcb_app_lookup(app, dev->ifindex, 0)))
1590 ++ itr = dcb_app_lookup(app, dev->ifindex, -1);
1591 ++ if (itr)
1592 + prio |= 1 << itr->app.priority;
1593 + spin_unlock_bh(&dcb_lock);
1594 +
1595 +diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
1596 +index 1f3c305df45d..b6e72af15237 100644
1597 +--- a/net/netfilter/x_tables.c
1598 ++++ b/net/netfilter/x_tables.c
1599 +@@ -876,7 +876,7 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
1600 + if (copy_from_user(&compat_tmp, user, sizeof(compat_tmp)) != 0)
1601 + return ERR_PTR(-EFAULT);
1602 +
1603 +- strlcpy(info->name, compat_tmp.name, sizeof(info->name));
1604 ++ memcpy(info->name, compat_tmp.name, sizeof(info->name) - 1);
1605 + info->num_counters = compat_tmp.num_counters;
1606 + user += sizeof(compat_tmp);
1607 + } else
1608 +@@ -889,9 +889,9 @@ void *xt_copy_counters_from_user(const void __user *user, unsigned int len,
1609 + if (copy_from_user(info, user, sizeof(*info)) != 0)
1610 + return ERR_PTR(-EFAULT);
1611 +
1612 +- info->name[sizeof(info->name) - 1] = '\0';
1613 + user += sizeof(*info);
1614 + }
1615 ++ info->name[sizeof(info->name) - 1] = '\0';
1616 +
1617 + size = sizeof(struct xt_counters);
1618 + size *= info->num_counters;
1619 +diff --git a/security/selinux/avc.c b/security/selinux/avc.c
1620 +index e60c79de13e1..52f3c550abcc 100644
1621 +--- a/security/selinux/avc.c
1622 ++++ b/security/selinux/avc.c
1623 +@@ -348,27 +348,26 @@ static struct avc_xperms_decision_node
1624 + struct avc_xperms_decision_node *xpd_node;
1625 + struct extended_perms_decision *xpd;
1626 +
1627 +- xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep,
1628 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1629 ++ xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep, GFP_NOWAIT);
1630 + if (!xpd_node)
1631 + return NULL;
1632 +
1633 + xpd = &xpd_node->xpd;
1634 + if (which & XPERMS_ALLOWED) {
1635 + xpd->allowed = kmem_cache_zalloc(avc_xperms_data_cachep,
1636 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1637 ++ GFP_NOWAIT);
1638 + if (!xpd->allowed)
1639 + goto error;
1640 + }
1641 + if (which & XPERMS_AUDITALLOW) {
1642 + xpd->auditallow = kmem_cache_zalloc(avc_xperms_data_cachep,
1643 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1644 ++ GFP_NOWAIT);
1645 + if (!xpd->auditallow)
1646 + goto error;
1647 + }
1648 + if (which & XPERMS_DONTAUDIT) {
1649 + xpd->dontaudit = kmem_cache_zalloc(avc_xperms_data_cachep,
1650 +- GFP_ATOMIC | __GFP_NOMEMALLOC);
1651 ++ GFP_NOWAIT);
1652 + if (!xpd->dontaudit)
1653 + goto error;
1654 + }
1655 +@@ -396,8 +395,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void)
1656 + {
1657 + struct avc_xperms_node *xp_node;
1658 +
1659 +- xp_node = kmem_cache_zalloc(avc_xperms_cachep,
1660 +- GFP_ATOMIC|__GFP_NOMEMALLOC);
1661 ++ xp_node = kmem_cache_zalloc(avc_xperms_cachep, GFP_NOWAIT);
1662 + if (!xp_node)
1663 + return xp_node;
1664 + INIT_LIST_HEAD(&xp_node->xpd_head);
1665 +@@ -550,7 +548,7 @@ static struct avc_node *avc_alloc_node(void)
1666 + {
1667 + struct avc_node *node;
1668 +
1669 +- node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC|__GFP_NOMEMALLOC);
1670 ++ node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
1671 + if (!node)
1672 + goto out;
1673 +
1674 +diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
1675 +index 3324f98c35f6..f6d4a1046e54 100644
1676 +--- a/sound/pci/hda/hda_codec.c
1677 ++++ b/sound/pci/hda/hda_codec.c
1678 +@@ -4019,7 +4019,8 @@ void snd_hda_bus_reset_codecs(struct hda_bus *bus)
1679 +
1680 + list_for_each_codec(codec, bus) {
1681 + /* FIXME: maybe a better way needed for forced reset */
1682 +- cancel_delayed_work_sync(&codec->jackpoll_work);
1683 ++ if (current_work() != &codec->jackpoll_work.work)
1684 ++ cancel_delayed_work_sync(&codec->jackpoll_work);
1685 + #ifdef CONFIG_PM
1686 + if (hda_codec_is_power_on(codec)) {
1687 + hda_call_codec_suspend(codec);
1688 +diff --git a/tools/perf/perf.h b/tools/perf/perf.h
1689 +index 90129accffbe..4341ed267d4e 100644
1690 +--- a/tools/perf/perf.h
1691 ++++ b/tools/perf/perf.h
1692 +@@ -29,7 +29,9 @@ static inline unsigned long long rdclock(void)
1693 + return ts.tv_sec * 1000000000ULL + ts.tv_nsec;
1694 + }
1695 +
1696 ++#ifndef MAX_NR_CPUS
1697 + #define MAX_NR_CPUS 1024
1698 ++#endif
1699 +
1700 + extern const char *input_name;
1701 + extern bool perf_host, perf_guest;