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